1 | /* $Id: UIGlobalSettingsUpdate.h 65689 2017-02-08 16:08:34Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIGlobalSettingsUpdate class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2017 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 ___UIGlobalSettingsUpdate_h___
|
---|
19 | #define ___UIGlobalSettingsUpdate_h___
|
---|
20 |
|
---|
21 | /* GUI includes: */
|
---|
22 | #include "UISettingsPage.h"
|
---|
23 | #include "UIGlobalSettingsUpdate.gen.h"
|
---|
24 | #include "UIUpdateDefs.h"
|
---|
25 |
|
---|
26 |
|
---|
27 | /** Global settings: Update page data structure. */
|
---|
28 | struct UIDataSettingsGlobalUpdate
|
---|
29 | {
|
---|
30 | /** Constructs data. */
|
---|
31 | UIDataSettingsGlobalUpdate()
|
---|
32 | : m_fCheckEnabled(false)
|
---|
33 | , m_periodIndex(VBoxUpdateData::PeriodUndefined)
|
---|
34 | , m_branchIndex(VBoxUpdateData::BranchStable)
|
---|
35 | , m_strDate(QString())
|
---|
36 | {}
|
---|
37 |
|
---|
38 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
39 | bool equal(const UIDataSettingsGlobalUpdate &other) const
|
---|
40 | {
|
---|
41 | return true
|
---|
42 | && (m_fCheckEnabled == other.m_fCheckEnabled)
|
---|
43 | && (m_periodIndex == other.m_periodIndex)
|
---|
44 | && (m_branchIndex == other.m_branchIndex)
|
---|
45 | && (m_strDate == other.m_strDate)
|
---|
46 | ;
|
---|
47 | }
|
---|
48 |
|
---|
49 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
50 | bool operator==(const UIDataSettingsGlobalUpdate &other) const { return equal(other); }
|
---|
51 | /** Returns whether the @a other passed data is different from this one. */
|
---|
52 | bool operator!=(const UIDataSettingsGlobalUpdate &other) const { return !equal(other); }
|
---|
53 |
|
---|
54 | /** Holds whether the update check is enabled. */
|
---|
55 | bool m_fCheckEnabled;
|
---|
56 | /** Holds the update check period. */
|
---|
57 | VBoxUpdateData::PeriodType m_periodIndex;
|
---|
58 | /** Holds the update branch type. */
|
---|
59 | VBoxUpdateData::BranchType m_branchIndex;
|
---|
60 | /** Holds the next update date. */
|
---|
61 | QString m_strDate;
|
---|
62 | };
|
---|
63 | typedef UISettingsCache<UIDataSettingsGlobalUpdate> UISettingsCacheGlobalUpdate;
|
---|
64 |
|
---|
65 |
|
---|
66 | /** Global settings: Update page. */
|
---|
67 | class UIGlobalSettingsUpdate : public UISettingsPageGlobal, public Ui::UIGlobalSettingsUpdate
|
---|
68 | {
|
---|
69 | Q_OBJECT;
|
---|
70 |
|
---|
71 | public:
|
---|
72 |
|
---|
73 | /* Constructor: */
|
---|
74 | UIGlobalSettingsUpdate();
|
---|
75 |
|
---|
76 | protected:
|
---|
77 |
|
---|
78 | /* Load data to cache from corresponding external object(s),
|
---|
79 | * this task COULD be performed in other than GUI thread: */
|
---|
80 | void loadToCacheFrom(QVariant &data);
|
---|
81 | /* Load data to corresponding widgets from cache,
|
---|
82 | * this task SHOULD be performed in GUI thread only: */
|
---|
83 | void getFromCache();
|
---|
84 |
|
---|
85 | /* Save data from corresponding widgets to cache,
|
---|
86 | * this task SHOULD be performed in GUI thread only: */
|
---|
87 | void putToCache();
|
---|
88 | /* Save data from cache to corresponding external object(s),
|
---|
89 | * this task COULD be performed in other than GUI thread: */
|
---|
90 | void saveFromCacheTo(QVariant &data);
|
---|
91 |
|
---|
92 | /* Helper: Navigation stuff: */
|
---|
93 | void setOrderAfter(QWidget *pWidget);
|
---|
94 |
|
---|
95 | /* Helper: Translation stuff: */
|
---|
96 | void retranslateUi();
|
---|
97 |
|
---|
98 | private slots:
|
---|
99 |
|
---|
100 | /* Handlers: */
|
---|
101 | void sltUpdaterToggled(bool fEnabled);
|
---|
102 | void sltPeriodActivated();
|
---|
103 |
|
---|
104 | private:
|
---|
105 |
|
---|
106 | /* Helpers: */
|
---|
107 | VBoxUpdateData::PeriodType periodType() const;
|
---|
108 | VBoxUpdateData::BranchType branchType() const;
|
---|
109 |
|
---|
110 | /* Variables: */
|
---|
111 | QRadioButton *m_pLastChosenRadio;
|
---|
112 |
|
---|
113 | /* Cache: */
|
---|
114 | UISettingsCacheGlobalUpdate m_cache;
|
---|
115 | };
|
---|
116 |
|
---|
117 | #endif /* !___UIGlobalSettingsUpdate_h___ */
|
---|
118 |
|
---|