source: src-qt4/libpcbsd/ui/pcbsd-ui.h @ 0cfe72f

9.1-release9.2-releasereleng/10.0releng/10.0.1
Last change on this file since 0cfe72f was 0cfe72f, checked in by Kris Moore <kris@…>, 12 months ago

Add all the changes for related using of split pcbsd-utils libs

  • 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   public:
48    static QStringList quickUserInputBox( QString title, QStringList inputList );
49};
50
51}
52
53class PCApplication: public QApplication
54{
55    Q_OBJECT
56
57public:
58    PCApplication(int &argc, char **argv, bool GUIenabled = true);
59    PCApplication(int &argc, char **argv, Type type);
60    PCApplication(int &argc, char **argv, const QString& appname);
61
62    bool loadTranslations(QString appname);
63};
64
65class PCSingleApplication: public QtSingleApplication
66{
67    Q_OBJECT
68
69public:
70    PCSingleApplication(int &argc, char **argv, bool GUIenabled = true);
71    PCSingleApplication(const QString &id, int &argc, char **argv);
72    PCSingleApplication(int &argc, char **argv, Type type);
73
74    PCSingleApplication(int &argc, char **argv, const QString& appname);
75
76    bool loadTranslations(QString appname);
77
78protected:
79
80    virtual bool onSecondInstance(QStringList args) {(void)args;return true;}
81
82};
83
84class dialogWPAEnterprise;
85
86class dialogWPAE:public QObject {
87  Q_OBJECT
88
89public:
90  dialogWPAE();
91  void setVariables( int type, QString EAPIdent, QString CACert, QString ClientCert, QString PrivKeyFile, QString Password, int keyMgmt );
92  void show();
93  void exec();
94
95private:
96  dialogWPAEnterprise *d_wpae;
97
98private slots:
99  void slotSigInt(int, QString, QString, QString, QString, QString, int);
100
101signals:
102  void saved(int, QString, QString, QString, QString, QString, int);
103
104};
105
106class dialogInfoBox;
107class dialogInfo {
108
109public:
110  dialogInfo();
111  void programInit(QString title);
112  void setInfoText(QString text);
113  void show();
114
115private:
116  dialogInfoBox *d_p;
117};
118
119class dialogMetaProgress;
120class metaProgressDialog:public QObject {
121
122  Q_OBJECT
123
124public:
125  metaProgressDialog();
126  void programInit(QString desc);
127  void setTotalDesc(QString desc);
128  void setSubDesc(QString desc);
129  void setTotalRange(int min, int max);
130  void setTotalVal(int val);
131  int  getTotalVal();
132  void setSubRange(int min, int max);
133  void setSubVal(int val);
134  int  getSubVal();
135  void setDLVisible(bool);
136  void setDLDesc(QString desc);
137  void setDLRange(int min, int max);
138  void setDLVal(int val);
139  int  getDLVal();
140  void show();
141  void close();
142  void hide();
143
144private slots:
145  void slotCancel();
146
147private:
148  dialogMetaProgress *d_p;
149
150signals:
151  void canceled();
152
153};
154
155class metaWidget : public QWidget
156{
157        Q_OBJECT
158
159public:
160        metaWidget() : QWidget()
161        {
162      QTranslator translator;
163          QLocale mylocale;
164          QString langCode = mylocale.name();
165          if ( ! QFile::exists( "/usr/local/share/lifePreserver/i18n/libpcbsd_" + langCode + ".qm" ) )
166            langCode.truncate(langCode.indexOf("_"));
167          translator.load( QString("libpcbsd_") + langCode, "/usr/local/share/lifePreserver/i18n/" );
168          QCoreApplication::installTranslator( &translator );
169          qDebug() << "Locale:" << langCode;
170        }
171
172     void init(QString chroot);
173     void setPackageSet(QString set);
174     void stop();
175
176public slots:
177
178private slots:
179   void slotMetaRightClick();
180   void slotMetaViewPkgs();
181   void slotDeskPkgsChanged(QTreeWidgetItem *aItem, int __unused);
182   void slotApplyMetaChanges();
183   void slotMetaAddDone();
184   void slotMetaAddCanceled();
185   void slotMetaAddRead();
186   void slotMetaDelDone();
187   void slotMetaDelCanceled();
188   void slotMetaDelRead();
189   void startMetaChanges();
190   void slotFinishLoadingMetaPkgs();
191   void slotGetPackageDataOutput();
192
193private:
194   QTreeWidget *treeMetaPkgs;
195   QLabel *label_2;
196   QPushButton *pushApplyMeta;
197   QList<QStringList> metaPkgList;
198   QStringList tmpMetaPkgList;
199   QProcess *addMetaProc;
200   QProcess *delMetaProc;
201   QProcess *getMetaProc;
202   QProgressDialog *delprogress;
203   QProgressDialog *addprogress;
204   QString addPkgs;
205   QString delPkgs;
206   QString pkgSource;
207   QString Arch;
208   QString chrootArg1;
209   QString chrootArg2;
210   bool stopped;
211   bool canceled;
212   QString PkgSet;
213
214   QMenu *popup;
215   metaProgressDialog *metaProgressDel;
216   metaProgressDialog *metaProgressAdd;
217   dialogInfo *dIB;
218
219
220   void uncheckAllChildrenPkgs(QString parent);
221   void checkAllChildrenPkgs(QString parent);
222   bool allChildrenPkgsUnchecked(QString parent);
223   bool allChildrenPkgsChecked(QString parent);
224   QString getDelPkgs();
225   QString getAddPkgs();
226   bool haveMetaPkgChanges();
227   bool haveAMetaDesktop();
228   void saveMetaPkgs();
229   void parseTmpMetaList();
230   bool isMetaPkgInstalled(QString mPkg);
231   void addTreeItems(QString parent);
232   void populateMetaPkgs();
233   QString getLineFromCommandOutput( QString cmd );
234
235signals:
236
237} ;
238
239#endif // PCBSDUI_H
Note: See TracBrowser for help on using the repository browser.