1 | /* $Id: UIUpdateDefs.h 76532 2018-12-30 06:08:06Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Update routine related declarations.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2018 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___UIUpdateDefs_h___
|
---|
19 | #define ___UIUpdateDefs_h___
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QDate>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "UILibraryDefs.h"
|
---|
29 | #include "UIVersion.h"
|
---|
30 |
|
---|
31 |
|
---|
32 | /** Structure to store retranslated reminder values. */
|
---|
33 | struct VBoxUpdateDay
|
---|
34 | {
|
---|
35 | VBoxUpdateDay(const QString &strVal, const QString &strKey)
|
---|
36 | : val(strVal), key(strKey) {}
|
---|
37 |
|
---|
38 | bool operator==(const VBoxUpdateDay &other) { return val == other.val || key == other.key; }
|
---|
39 |
|
---|
40 | QString val;
|
---|
41 | QString key;
|
---|
42 | };
|
---|
43 | typedef QList<VBoxUpdateDay> VBoxUpdateDayList;
|
---|
44 |
|
---|
45 |
|
---|
46 | /** Class used to encode/decode update data. */
|
---|
47 | class SHARED_LIBRARY_STUFF VBoxUpdateData
|
---|
48 | {
|
---|
49 | public:
|
---|
50 |
|
---|
51 | /** Period types. */
|
---|
52 | enum PeriodType
|
---|
53 | {
|
---|
54 | PeriodNever = -2,
|
---|
55 | PeriodUndefined = -1,
|
---|
56 | Period1Day = 0,
|
---|
57 | Period2Days = 1,
|
---|
58 | Period3Days = 2,
|
---|
59 | Period4Days = 3,
|
---|
60 | Period5Days = 4,
|
---|
61 | Period6Days = 5,
|
---|
62 | Period1Week = 6,
|
---|
63 | Period2Weeks = 7,
|
---|
64 | Period3Weeks = 8,
|
---|
65 | Period1Month = 9
|
---|
66 | };
|
---|
67 |
|
---|
68 | /** Branch types. */
|
---|
69 | enum BranchType
|
---|
70 | {
|
---|
71 | BranchStable = 0,
|
---|
72 | BranchAllRelease = 1,
|
---|
73 | BranchWithBetas = 2
|
---|
74 | };
|
---|
75 |
|
---|
76 | /** Populates a set of update options. */
|
---|
77 | static void populate();
|
---|
78 | /** Returns a list of update options. */
|
---|
79 | static QStringList list();
|
---|
80 |
|
---|
81 | /** Constructs update description on the basis of passed @a strData. */
|
---|
82 | VBoxUpdateData(const QString &strData);
|
---|
83 | /** Constructs update description on the basis of passed @a enmPeriodIndex and @a enmBranchIndex. */
|
---|
84 | VBoxUpdateData(PeriodType enmPeriodIndex, BranchType enmBranchIndex);
|
---|
85 |
|
---|
86 | /** Returns whether there is no need to check. */
|
---|
87 | bool isNoNeedToCheck() const;
|
---|
88 | /** Returns whether there is really need to check. */
|
---|
89 | bool isNeedToCheck() const;
|
---|
90 | /** Returns update data. */
|
---|
91 | QString data() const;
|
---|
92 | /** Returns period index. */
|
---|
93 | PeriodType periodIndex() const;
|
---|
94 | /** Returns update date. */
|
---|
95 | QString date() const;
|
---|
96 | /** Returns branch index. */
|
---|
97 | BranchType branchIndex() const;
|
---|
98 | /** Returns period name. */
|
---|
99 | QString branchName() const;
|
---|
100 | /** Returns version. */
|
---|
101 | UIVersion version() const;
|
---|
102 |
|
---|
103 | private:
|
---|
104 |
|
---|
105 | /** Decodes data. */
|
---|
106 | void decode();
|
---|
107 | /** Encodes data. */
|
---|
108 | void encode();
|
---|
109 |
|
---|
110 | /** Holds the populated list of update options. */
|
---|
111 | static VBoxUpdateDayList m_dayList;
|
---|
112 |
|
---|
113 | /** Holds the update data. */
|
---|
114 | QString m_strData;
|
---|
115 | /** Holds the update period index. */
|
---|
116 | PeriodType m_enmPeriodIndex;
|
---|
117 | /** Holds the update date. */
|
---|
118 | QDate m_date;
|
---|
119 | /** Holds the update branch index. */
|
---|
120 | BranchType m_enmBranchIndex;
|
---|
121 | /** Holds the update version. */
|
---|
122 | UIVersion m_version;
|
---|
123 | };
|
---|
124 |
|
---|
125 |
|
---|
126 | #endif /* !___UIUpdateDefs_h___ */
|
---|
127 |
|
---|