1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt4 GUI ("VirtualBox"):
|
---|
4 | * VBoxUpdateDlg class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
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 |
|
---|
19 | #ifndef __VBoxUpdateDlg_h__
|
---|
20 | #define __VBoxUpdateDlg_h__
|
---|
21 |
|
---|
22 | /* Global includes */
|
---|
23 | #include <QUrl>
|
---|
24 | #include <QDate>
|
---|
25 |
|
---|
26 | /* Local includes */
|
---|
27 | #include "QIWithRetranslateUI.h"
|
---|
28 | #include "VBoxUpdateDlg.gen.h"
|
---|
29 |
|
---|
30 | /* Global forwards */
|
---|
31 | class QIHttp;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * This structure is used to store retranslated reminder values.
|
---|
35 | */
|
---|
36 | struct UpdateDay
|
---|
37 | {
|
---|
38 | UpdateDay (const QString &aVal, const QString &aKey)
|
---|
39 | : val (aVal), key (aKey) {}
|
---|
40 |
|
---|
41 | QString val;
|
---|
42 | QString key;
|
---|
43 |
|
---|
44 | bool operator== (const UpdateDay &aOther)
|
---|
45 | {
|
---|
46 | return val == aOther.val || key == aOther.key;
|
---|
47 | }
|
---|
48 | };
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * This class is used to encode/decode the registration data.
|
---|
52 | */
|
---|
53 | class VBoxUpdateData
|
---|
54 | {
|
---|
55 | public:
|
---|
56 |
|
---|
57 | enum PeriodType
|
---|
58 | {
|
---|
59 | PeriodNever = -2,
|
---|
60 | PeriodUndefined = -1,
|
---|
61 | Period1Day = 0,
|
---|
62 | Period2Days = 1,
|
---|
63 | Period3Days = 2,
|
---|
64 | Period4Days = 3,
|
---|
65 | Period5Days = 4,
|
---|
66 | Period6Days = 5,
|
---|
67 | Period1Week = 6,
|
---|
68 | Period2Weeks = 7,
|
---|
69 | Period3Weeks = 8,
|
---|
70 | Period1Month = 9
|
---|
71 | };
|
---|
72 |
|
---|
73 | enum BranchType
|
---|
74 | {
|
---|
75 | BranchStable = 0,
|
---|
76 | BranchAllRelease = 1,
|
---|
77 | BranchWithBetas = 2
|
---|
78 | };
|
---|
79 |
|
---|
80 | static void populate();
|
---|
81 | static QStringList list();
|
---|
82 |
|
---|
83 | VBoxUpdateData (const QString &aData);
|
---|
84 | VBoxUpdateData (PeriodType aPeriodIndex, BranchType aBranchIndex);
|
---|
85 |
|
---|
86 | bool isNecessary();
|
---|
87 | bool isNoNeedToCheck();
|
---|
88 |
|
---|
89 | QString data() const;
|
---|
90 | PeriodType periodIndex() const;
|
---|
91 | QString date() const;
|
---|
92 | BranchType branchIndex() const;
|
---|
93 | QString branchName() const;
|
---|
94 |
|
---|
95 | private:
|
---|
96 |
|
---|
97 | /* Private functions */
|
---|
98 | void decode();
|
---|
99 | void encode();
|
---|
100 |
|
---|
101 | /* Private variables */
|
---|
102 | static QList <UpdateDay> mDayList;
|
---|
103 |
|
---|
104 | QString mData;
|
---|
105 | PeriodType mPeriodIndex;
|
---|
106 | QDate mDate;
|
---|
107 | BranchType mBranchIndex;
|
---|
108 | };
|
---|
109 |
|
---|
110 | class VBoxUpdateDlg : public QIWithRetranslateUI <QDialog>,
|
---|
111 | public Ui::VBoxUpdateDlg
|
---|
112 | {
|
---|
113 | Q_OBJECT;
|
---|
114 |
|
---|
115 | public:
|
---|
116 |
|
---|
117 | static bool isNecessary();
|
---|
118 |
|
---|
119 | VBoxUpdateDlg (VBoxUpdateDlg **aSelf, bool aForceRun, QWidget *aParent = 0);
|
---|
120 | ~VBoxUpdateDlg();
|
---|
121 |
|
---|
122 | public slots:
|
---|
123 |
|
---|
124 | void search();
|
---|
125 |
|
---|
126 | protected:
|
---|
127 |
|
---|
128 | void retranslateUi();
|
---|
129 |
|
---|
130 | private slots:
|
---|
131 |
|
---|
132 | void accept();
|
---|
133 | void searchResponse (bool aError);
|
---|
134 |
|
---|
135 | private:
|
---|
136 |
|
---|
137 | void abortRequest (const QString &aReason);
|
---|
138 |
|
---|
139 | /* Private variables */
|
---|
140 | VBoxUpdateDlg **mSelf;
|
---|
141 | QUrl mUrl;
|
---|
142 | QIHttp *mHttp;
|
---|
143 | bool mForceRun;
|
---|
144 | };
|
---|
145 |
|
---|
146 | #endif // __VBoxUpdateDlg_h__
|
---|
147 |
|
---|