1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt4 GUI ("VirtualBox"):
|
---|
4 | * VBoxUpdateDlg class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2008 Sun Microsystems, Inc.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __VBoxUpdateDlg_h__
|
---|
24 | #define __VBoxUpdateDlg_h__
|
---|
25 |
|
---|
26 | #include "QIAbstractWizard.h"
|
---|
27 | #include "QIWithRetranslateUI.h"
|
---|
28 | #include "VBoxUpdateDlg.gen.h"
|
---|
29 |
|
---|
30 | /* Qt includes */
|
---|
31 | #include <QUrl>
|
---|
32 | #include <QDate>
|
---|
33 |
|
---|
34 | class QIHttp;
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * This structure is used to store retranslated reminder values.
|
---|
38 | */
|
---|
39 | struct UpdateDay
|
---|
40 | {
|
---|
41 | UpdateDay (const QString &aVal, const QString &aKey)
|
---|
42 | : val (aVal), key (aKey) {}
|
---|
43 |
|
---|
44 | QString val;
|
---|
45 | QString key;
|
---|
46 |
|
---|
47 | bool operator== (const UpdateDay &aOther)
|
---|
48 | {
|
---|
49 | return val == aOther.val || key == aOther.key;
|
---|
50 | }
|
---|
51 | };
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * This class is used to encode/decode the registration data.
|
---|
55 | */
|
---|
56 | class VBoxUpdateData
|
---|
57 | {
|
---|
58 | public:
|
---|
59 |
|
---|
60 | enum
|
---|
61 | {
|
---|
62 | NeverCheck = -2
|
---|
63 | };
|
---|
64 |
|
---|
65 | static void populate();
|
---|
66 | static QStringList list();
|
---|
67 |
|
---|
68 | VBoxUpdateData (const QString &aData);
|
---|
69 | VBoxUpdateData (int aIndex);
|
---|
70 |
|
---|
71 | bool isNecessary();
|
---|
72 | bool isNeverCheck();
|
---|
73 |
|
---|
74 | QString data() const;
|
---|
75 | int index() const;
|
---|
76 | QString date() const;
|
---|
77 |
|
---|
78 | private:
|
---|
79 |
|
---|
80 | /* Private functions */
|
---|
81 | void decode (const QString &aData);
|
---|
82 | void encode (int aIndex);
|
---|
83 |
|
---|
84 | /* Private variables */
|
---|
85 | static QList <UpdateDay> mDayList;
|
---|
86 |
|
---|
87 | QString mData;
|
---|
88 | int mIndex;
|
---|
89 | QDate mDate;
|
---|
90 | };
|
---|
91 |
|
---|
92 | class VBoxUpdateDlg : public QIWithRetranslateUI <QIAbstractWizard>,
|
---|
93 | public Ui::VBoxUpdateDlg
|
---|
94 | {
|
---|
95 | Q_OBJECT;
|
---|
96 |
|
---|
97 | public:
|
---|
98 |
|
---|
99 | static bool isNecessary();
|
---|
100 |
|
---|
101 | VBoxUpdateDlg (VBoxUpdateDlg **aSelf, bool aForceRun, QWidget *aParent = 0);
|
---|
102 | ~VBoxUpdateDlg();
|
---|
103 |
|
---|
104 | public slots:
|
---|
105 |
|
---|
106 | void search();
|
---|
107 |
|
---|
108 | protected:
|
---|
109 |
|
---|
110 | void retranslateUi();
|
---|
111 |
|
---|
112 | private slots:
|
---|
113 |
|
---|
114 | void accept();
|
---|
115 | void searchResponse (bool aError);
|
---|
116 | void onPageShow();
|
---|
117 |
|
---|
118 | private:
|
---|
119 |
|
---|
120 | void abortRequest (const QString &aReason);
|
---|
121 |
|
---|
122 | /* Private variables */
|
---|
123 | VBoxUpdateDlg **mSelf;
|
---|
124 | QUrl mUrl;
|
---|
125 | QIHttp *mHttp;
|
---|
126 | bool mForceRun;
|
---|
127 | };
|
---|
128 |
|
---|
129 | #endif // __VBoxUpdateDlg_h__
|
---|
130 |
|
---|