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.215389.xyz. 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 | /* Common includes */
|
---|
27 | #include "QIAbstractWizard.h"
|
---|
28 | #include "VBoxUpdateDlg.gen.h"
|
---|
29 | #include "QIWithRetranslateUI.h"
|
---|
30 |
|
---|
31 | /* Qt includes */
|
---|
32 | #include <QUrl>
|
---|
33 |
|
---|
34 | class VBoxNetworkFramework;
|
---|
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 | static void populate();
|
---|
61 | static QStringList list();
|
---|
62 |
|
---|
63 | VBoxUpdateData (const QString &aData, bool aEncode);
|
---|
64 |
|
---|
65 | bool isNecessary();
|
---|
66 | bool isAutomatic();
|
---|
67 |
|
---|
68 | const QString& data() const { return mData; }
|
---|
69 | int index() { return mIndex; }
|
---|
70 |
|
---|
71 | private:
|
---|
72 |
|
---|
73 | /* Private functions */
|
---|
74 | int decode (const QString &aData) const;
|
---|
75 | QString encode (int aIndex) const;
|
---|
76 |
|
---|
77 | /* Private variables */
|
---|
78 | static QList<UpdateDay> mDayList;
|
---|
79 |
|
---|
80 | QString mData;
|
---|
81 | int mIndex;
|
---|
82 | };
|
---|
83 |
|
---|
84 | class VBoxUpdateDlg : public QIWithRetranslateUI2<QIAbstractWizard>,
|
---|
85 | public Ui::VBoxUpdateDlg
|
---|
86 | {
|
---|
87 | Q_OBJECT;
|
---|
88 |
|
---|
89 | public:
|
---|
90 |
|
---|
91 | static bool isNecessary();
|
---|
92 | static bool isAutomatic();
|
---|
93 |
|
---|
94 | VBoxUpdateDlg (VBoxUpdateDlg **aSelf, QWidget *aParent = 0,
|
---|
95 | Qt::WindowFlags aFlags = 0);
|
---|
96 | ~VBoxUpdateDlg();
|
---|
97 |
|
---|
98 | public slots:
|
---|
99 |
|
---|
100 | void accept();
|
---|
101 | void reject();
|
---|
102 | void search();
|
---|
103 |
|
---|
104 | protected:
|
---|
105 |
|
---|
106 | void retranslateUi();
|
---|
107 |
|
---|
108 | private slots:
|
---|
109 |
|
---|
110 | void processTimeout();
|
---|
111 | void onToggleFirstPage();
|
---|
112 | void onToggleSecondPage();
|
---|
113 |
|
---|
114 | void onNetBegin (int aStatus);
|
---|
115 | void onNetData (const QByteArray &aData);
|
---|
116 | void onNetEnd (const QByteArray &aData);
|
---|
117 | void onNetError (const QString &aError);
|
---|
118 |
|
---|
119 | void onPageShow();
|
---|
120 |
|
---|
121 | private:
|
---|
122 |
|
---|
123 | /* Private functions */
|
---|
124 | void searchAbort (const QString &aReason);
|
---|
125 | void searchComplete (const QString &aFullList);
|
---|
126 |
|
---|
127 | /* Private variables */
|
---|
128 | VBoxUpdateDlg **mSelf;
|
---|
129 | VBoxNetworkFramework *mNetfw;
|
---|
130 | QTimer *mTimeout;
|
---|
131 | QUrl mUrl;
|
---|
132 | bool mSuicide;
|
---|
133 | };
|
---|
134 |
|
---|
135 | #endif // __VBoxUpdateDlg_h__
|
---|
136 |
|
---|