VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.h@ 65689

Last change on this file since 65689 was 65689, checked in by vboxsync, 8 years ago

FE/Qt: Global preferences: Update page: Integrate settings caching.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
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. */
28struct 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};
63typedef UISettingsCache<UIDataSettingsGlobalUpdate> UISettingsCacheGlobalUpdate;
64
65
66/** Global settings: Update page. */
67class UIGlobalSettingsUpdate : public UISettingsPageGlobal, public Ui::UIGlobalSettingsUpdate
68{
69 Q_OBJECT;
70
71public:
72
73 /* Constructor: */
74 UIGlobalSettingsUpdate();
75
76protected:
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
98private slots:
99
100 /* Handlers: */
101 void sltUpdaterToggled(bool fEnabled);
102 void sltPeriodActivated();
103
104private:
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
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette