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 PeriodType
|
---|
61 | {
|
---|
62 | PeriodNever = -2,
|
---|
63 | PeriodUndefined = -1,
|
---|
64 | Period1Day = 0,
|
---|
65 | Period2Days = 1,
|
---|
66 | Period3Days = 2,
|
---|
67 | Period4Days = 3,
|
---|
68 | Period5Days = 4,
|
---|
69 | Period6Days = 5,
|
---|
70 | Period1Week = 6,
|
---|
71 | Period2Weeks = 7,
|
---|
72 | Period3Weeks = 8,
|
---|
73 | Period1Month = 9
|
---|
74 | };
|
---|
75 |
|
---|
76 | enum BranchType
|
---|
77 | {
|
---|
78 | BranchStable = 0,
|
---|
79 | BranchAllRelease = 1,
|
---|
80 | BranchWithBetas = 2
|
---|
81 | };
|
---|
82 |
|
---|
83 | static void populate();
|
---|
84 | static QStringList list();
|
---|
85 |
|
---|
86 | VBoxUpdateData (const QString &aData);
|
---|
87 | VBoxUpdateData (PeriodType aPeriodIndex, BranchType aBranchIndex);
|
---|
88 |
|
---|
89 | bool isNecessary();
|
---|
90 | bool isNoNeedToCheck();
|
---|
91 |
|
---|
92 | QString data() const;
|
---|
93 | PeriodType periodIndex() const;
|
---|
94 | QString date() const;
|
---|
95 | BranchType branchIndex() const;
|
---|
96 | QString branchName() const;
|
---|
97 |
|
---|
98 | private:
|
---|
99 |
|
---|
100 | /* Private functions */
|
---|
101 | void decode();
|
---|
102 | void encode();
|
---|
103 |
|
---|
104 | /* Private variables */
|
---|
105 | static QList <UpdateDay> mDayList;
|
---|
106 |
|
---|
107 | QString mData;
|
---|
108 | PeriodType mPeriodIndex;
|
---|
109 | QDate mDate;
|
---|
110 | BranchType mBranchIndex;
|
---|
111 | };
|
---|
112 |
|
---|
113 | class VBoxUpdateDlg : public QIWithRetranslateUI <QIAbstractWizard>,
|
---|
114 | public Ui::VBoxUpdateDlg
|
---|
115 | {
|
---|
116 | Q_OBJECT;
|
---|
117 |
|
---|
118 | public:
|
---|
119 |
|
---|
120 | static bool isNecessary();
|
---|
121 |
|
---|
122 | VBoxUpdateDlg (VBoxUpdateDlg **aSelf, bool aForceRun, QWidget *aParent = 0);
|
---|
123 | ~VBoxUpdateDlg();
|
---|
124 |
|
---|
125 | public slots:
|
---|
126 |
|
---|
127 | void search();
|
---|
128 |
|
---|
129 | protected:
|
---|
130 |
|
---|
131 | void retranslateUi();
|
---|
132 |
|
---|
133 | private slots:
|
---|
134 |
|
---|
135 | void accept();
|
---|
136 | void searchResponse (bool aError);
|
---|
137 | void onPageShow();
|
---|
138 |
|
---|
139 | private:
|
---|
140 |
|
---|
141 | void abortRequest (const QString &aReason);
|
---|
142 |
|
---|
143 | /* Private variables */
|
---|
144 | VBoxUpdateDlg **mSelf;
|
---|
145 | QUrl mUrl;
|
---|
146 | QIHttp *mHttp;
|
---|
147 | bool mForceRun;
|
---|
148 | };
|
---|
149 |
|
---|
150 | #endif // __VBoxUpdateDlg_h__
|
---|
151 |
|
---|