source: src-qt4/libpcbsd/ui/pcbsd-ui.h @ 1f0939e

9.1-release9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 1f0939e was 1f0939e, checked in by Kris Moore <kris@…>, 21 months ago
  • Initial merge of code from PC-BSD SVN repo for my private (pre-release) hacking
  • Property mode set to 100644
File size: 6.5 KB
Line 
1/***************************************************************************
2 *   Copyright (C) 2013 by Yuriy Momotyuk                                                  *
3 *   yurkis@gmail.com                                                      *
4 *                                                                         *
5 *   Permission is hereby granted, free of charge, to any person obtaining *
6 *   a copy of this software and associated documentation files (the       *
7 *   "Software"), to deal in the Software without restriction, including   *
8 *   without limitation the rights to use, copy, modify, merge, publish,   *
9 *   distribute, sublicense, and/or sell copies of the Software, and to    *
10 *   permit persons to whom the Software is furnished to do so, subject to *
11 *   the following conditions:                                             *
12 *                                                                         *
13 *   The above copyright notice and this permission notice shall be        *
14 *   included in all copies or substantial portions of the Software.       *
15 *                                                                         *
16 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
17 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
18 *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
19 *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
20 *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
21 *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
22 *   OTHER DEALINGS IN THE SOFTWARE.                                       *
23 ***************************************************************************/
24
25#ifndef PCBSDUI_H
26#define PCBSDUI_H
27
28#include <QtGui/QApplication>
29#include <qtsingleapplication.h>
30#include <QStringList>
31#include <QTreeWidgetItem>
32#include <QProgressDialog>
33#include <QTranslator>
34#include <QMessageBox>
35#include <QMenu>
36#include <QProcess>
37#include <QFile>
38#include <QDebug>
39
40#include "../../config.h"
41
42namespace pcbsd
43{
44
45class UI
46{
47    static QStringList quickUserInputBox( QString title, QStringList inputList );
48};
49
50}
51
52class PCApplication: public QApplication
53{
54    Q_OBJECT
55
56public:
57    PCApplication(int &argc, char **argv, bool GUIenabled = true);
58    PCApplication(int &argc, char **argv, Type type);
59    PCApplication(int &argc, char **argv, const QString& appname);
60
61    bool loadTranslations(QString appname);
62};
63
64class PCSingleApplication: public QtSingleApplication
65{
66    Q_OBJECT
67
68public:
69    PCSingleApplication(int &argc, char **argv, bool GUIenabled = true);
70    PCSingleApplication(const QString &id, int &argc, char **argv);
71    PCSingleApplication(int &argc, char **argv, Type type);
72
73    PCSingleApplication(int &argc, char **argv, const QString& appname);
74
75    bool loadTranslations(QString appname);
76
77protected:
78
79    virtual bool onSecondInstance(QStringList args) {(void)args;return true;}
80
81};
82
83class dialogWPAEnterprise;
84
85class dialogWPAE:public QObject {
86  Q_OBJECT
87
88public:
89  dialogWPAE();
90  void setVariables( int type, QString EAPIdent, QString CACert, QString ClientCert, QString PrivKeyFile, QString Password, int keyMgmt );
91  void show();
92  void exec();
93
94private:
95  dialogWPAEnterprise *d_wpae;
96
97private slots:
98  void slotSigInt(int, QString, QString, QString, QString, QString, int);
99
100signals:
101  void saved(int, QString, QString, QString, QString, QString, int);
102
103};
104
105class dialogInfoBox;
106class dialogInfo {
107
108public:
109  dialogInfo();
110  void programInit(QString title);
111  void setInfoText(QString text);
112  void show();
113
114private:
115  dialogInfoBox *d_p;
116};
117
118class dialogMetaProgress;
119class metaProgressDialog:public QObject {
120
121  Q_OBJECT
122
123public:
124  metaProgressDialog();
125  void programInit(QString desc);
126  void setTotalDesc(QString desc);
127  void setSubDesc(QString desc);
128  void setTotalRange(int min, int max);
129  void setTotalVal(int val);
130  int  getTotalVal();
131  void setSubRange(int min, int max);
132  void setSubVal(int val);
133  int  getSubVal();
134  void setDLVisible(bool);
135  void setDLDesc(QString desc);
136  void setDLRange(int min, int max);
137  void setDLVal(int val);
138  int  getDLVal();
139  void show();
140  void close();
141  void hide();
142
143private slots:
144  void slotCancel();
145
146private:
147  dialogMetaProgress *d_p;
148
149signals:
150  void canceled();
151
152};
153
154class metaWidget : public QWidget
155{
156        Q_OBJECT
157
158public:
159        metaWidget() : QWidget()
160        {
161      QTranslator translator;
162          QLocale mylocale;
163          QString langCode = mylocale.name();
164          if ( ! QFile::exists( "/usr/local/share/lifePreserver/i18n/libpcbsd_" + langCode + ".qm" ) )
165            langCode.truncate(langCode.indexOf("_"));
166          translator.load( QString("libpcbsd_") + langCode, "/usr/local/share/lifePreserver/i18n/" );
167          QCoreApplication::installTranslator( &translator );
168          qDebug() << "Locale:" << langCode;
169        }
170
171     void init(QString chroot);
172     void setPackageSet(QString set);
173     void stop();
174
175public slots:
176
177private slots:
178   void slotMetaRightClick();
179   void slotMetaViewPkgs();
180   void slotDeskPkgsChanged(QTreeWidgetItem *aItem, int __unused);
181   void slotApplyMetaChanges();
182   void slotMetaAddDone();
183   void slotMetaAddCanceled();
184   void slotMetaAddRead();
185   void slotMetaDelDone();
186   void slotMetaDelCanceled();
187   void slotMetaDelRead();
188   void startMetaChanges();
189   void slotFinishLoadingMetaPkgs();
190   void slotGetPackageDataOutput();
191
192private:
193   QTreeWidget *treeMetaPkgs;
194   QLabel *label_2;
195   QPushButton *pushApplyMeta;
196   QList<QStringList> metaPkgList;
197   QStringList tmpMetaPkgList;
198   QProcess *addMetaProc;
199   QProcess *delMetaProc;
200   QProcess *getMetaProc;
201   QProgressDialog *delprogress;
202   QProgressDialog *addprogress;
203   QString addPkgs;
204   QString delPkgs;
205   QString pkgSource;
206   QString Arch;
207   QString chrootArg1;
208   QString chrootArg2;
209   bool stopped;
210   bool canceled;
211   QString PkgSet;
212
213   QMenu *popup;
214   metaProgressDialog *metaProgressDel;
215   metaProgressDialog *metaProgressAdd;
216   dialogInfo *dIB;
217
218
219   void uncheckAllChildrenPkgs(QString parent);
220   void checkAllChildrenPkgs(QString parent);
221   bool allChildrenPkgsUnchecked(QString parent);
222   bool allChildrenPkgsChecked(QString parent);
223   QString getDelPkgs();
224   QString getAddPkgs();
225   bool haveMetaPkgChanges();
226   bool haveAMetaDesktop();
227   void saveMetaPkgs();
228   void parseTmpMetaList();
229   bool isMetaPkgInstalled(QString mPkg);
230   void addTreeItems(QString parent);
231   void populateMetaPkgs();
232   QString getLineFromCommandOutput( QString cmd );
233
234signals:
235
236} ;
237
238#endif // PCBSDUI_H
Note: See TracBrowser for help on using the repository browser.