Changeset 86128 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 15, 2020 4:14:08 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 5 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r86124 r86128 848 848 src/settings/editors/UIScaleFactorEditor.h \ 849 849 src/settings/editors/UIShortcutConfigurationEditor.h \ 850 src/settings/editors/UIUpdateSettingsEditor.h \ 850 851 src/settings/editors/UIVideoMemoryEditor.h \ 851 852 src/settings/editors/UIVirtualCPUEditor.h \ … … 1365 1366 src/settings/editors/UIScaleFactorEditor.cpp \ 1366 1367 src/settings/editors/UIShortcutConfigurationEditor.cpp \ 1368 src/settings/editors/UIUpdateSettingsEditor.cpp \ 1367 1369 src/settings/editors/UIVideoMemoryEditor.cpp \ 1368 1370 src/settings/editors/UIVirtualCPUEditor.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.cpp
r84319 r86128 80 80 } 81 81 82 VBoxUpdateData::VBoxUpdateData(const VBoxUpdateData &another) 83 : m_strData(another.data()) 84 , m_enmPeriodIndex(another.periodIndex()) 85 , m_date(another.internalDate()) 86 , m_enmBranchIndex(another.branchIndex()) 87 , m_version(another.version()) 88 { 89 } 90 82 91 bool VBoxUpdateData::isNoNeedToCheck() const 83 92 { … … 117 126 { 118 127 return isNoNeedToCheck() ? QCoreApplication::translate("UIUpdateManager", "Never") : m_date.toString(Qt::LocaleDate); 128 } 129 130 QDate VBoxUpdateData::internalDate() const 131 { 132 return m_date; 119 133 } 120 134 … … 143 157 } 144 158 159 bool VBoxUpdateData::isEqual(const VBoxUpdateData &another) const 160 { 161 return true 162 && (m_strData == another.data()) 163 && (m_enmPeriodIndex == another.periodIndex()) 164 && (m_date == another.internalDate()) 165 && (m_enmBranchIndex == another.branchIndex()) 166 && (m_version == another.version()) 167 ; 168 } 169 170 bool VBoxUpdateData::operator==(const VBoxUpdateData &another) const 171 { 172 return isEqual(another); 173 } 174 175 bool VBoxUpdateData::operator!=(const VBoxUpdateData &another) const 176 { 177 return !isEqual(another); 178 } 179 145 180 void VBoxUpdateData::decode() 146 181 { -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.h
r82968 r86128 80 80 81 81 /** Constructs update description on the basis of passed @a strData. */ 82 VBoxUpdateData(const QString &strData );82 VBoxUpdateData(const QString &strData = QString()); 83 83 /** Constructs update description on the basis of passed @a enmPeriodIndex and @a enmBranchIndex. */ 84 84 VBoxUpdateData(PeriodType enmPeriodIndex, BranchType enmBranchIndex); 85 /** Constructs update description on the basis of @a another one. */ 86 VBoxUpdateData(const VBoxUpdateData &another); 85 87 86 88 /** Returns whether there is no need to check. */ … … 94 96 /** Returns update date. */ 95 97 QString date() const; 98 /** Returns internal update date. */ 99 QDate internalDate() const; 96 100 /** Returns branch index. */ 97 101 BranchType branchIndex() const; … … 100 104 /** Returns version. */ 101 105 UIVersion version() const; 106 107 /** Returns whether this item equals to @a another one. */ 108 bool isEqual(const VBoxUpdateData &another) const; 109 /** Returns whether this item equals to @a another one. */ 110 bool operator==(const VBoxUpdateData &another) const; 111 /** Returns whether this item isn't equal to @a another one. */ 112 bool operator!=(const VBoxUpdateData &another) const; 102 113 103 114 private: -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUpdateSettingsEditor.cpp
r86125 r86128 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI GlobalSettingsUpdateclass implementation.3 * VBox Qt GUI - UIUpdateSettingsEditor class implementation. 4 4 */ 5 5 … … 17 17 18 18 /* Qt includes: */ 19 #include <QButtonGroup> 19 20 #include <QCheckBox> 20 21 #include <QComboBox> … … 24 25 25 26 /* GUI includes: */ 26 #include "UIGlobalSettingsUpdate.h" 27 #include "UIExtraDataManager.h" 28 #include "UIMessageCenter.h" 29 #include "UICommon.h" 30 31 32 /** Global settings: Update page data structure. */ 33 struct UIDataSettingsGlobalUpdate 34 { 35 /** Constructs data. */ 36 UIDataSettingsGlobalUpdate() 37 : m_fCheckEnabled(false) 38 , m_periodIndex(VBoxUpdateData::PeriodUndefined) 39 , m_branchIndex(VBoxUpdateData::BranchStable) 40 , m_strDate(QString()) 41 {} 42 43 /** Returns whether the @a other passed data is equal to this one. */ 44 bool equal(const UIDataSettingsGlobalUpdate &other) const 45 { 46 return true 47 && (m_fCheckEnabled == other.m_fCheckEnabled) 48 && (m_periodIndex == other.m_periodIndex) 49 && (m_branchIndex == other.m_branchIndex) 50 && (m_strDate == other.m_strDate) 51 ; 52 } 53 54 /** Returns whether the @a other passed data is equal to this one. */ 55 bool operator==(const UIDataSettingsGlobalUpdate &other) const { return equal(other); } 56 /** Returns whether the @a other passed data is different from this one. */ 57 bool operator!=(const UIDataSettingsGlobalUpdate &other) const { return !equal(other); } 58 59 /** Holds whether the update check is enabled. */ 60 bool m_fCheckEnabled; 61 /** Holds the update check period. */ 62 VBoxUpdateData::PeriodType m_periodIndex; 63 /** Holds the update branch type. */ 64 VBoxUpdateData::BranchType m_branchIndex; 65 /** Holds the next update date. */ 66 QString m_strDate; 67 }; 68 69 70 UIGlobalSettingsUpdate::UIGlobalSettingsUpdate() 71 : m_pCache(0) 72 , m_pCheckBoxUpdate(0) 27 #include "UIUpdateSettingsEditor.h" 28 29 30 UIUpdateSettingsEditor::UIUpdateSettingsEditor(QWidget *pParent /* = 0 */) 31 : QIWithRetranslateUI<QWidget>(pParent) 32 , m_pCheckBox(0) 73 33 , m_pWidgetUpdateSettings(0) 74 34 , m_pLabelUpdatePeriod(0) … … 77 37 , m_pFieldUpdateDate(0) 78 38 , m_pLabelUpdateFilter(0) 79 , m_pRadioUpdateFilterStable(0) 80 , m_pRadioUpdateFilterEvery(0) 81 , m_pRadioUpdateFilterBetas(0) 82 { 83 /* Prepare: */ 39 , m_pRadioButtonGroup(0) 40 { 84 41 prepare(); 85 42 } 86 43 87 UIGlobalSettingsUpdate::~UIGlobalSettingsUpdate() 88 { 89 /* Cleanup: */ 90 cleanup(); 91 } 92 93 void UIGlobalSettingsUpdate::loadToCacheFrom(QVariant &data) 94 { 95 /* Fetch data to properties: */ 96 UISettingsPageGlobal::fetchData(data); 97 98 /* Clear cache initially: */ 99 m_pCache->clear(); 100 101 /* Prepare old update data: */ 102 UIDataSettingsGlobalUpdate oldUpdateData; 103 104 /* Gather old update data: */ 105 const VBoxUpdateData updateData(gEDataManager->applicationUpdateData()); 106 oldUpdateData.m_fCheckEnabled = !updateData.isNoNeedToCheck(); 107 oldUpdateData.m_periodIndex = updateData.periodIndex(); 108 oldUpdateData.m_branchIndex = updateData.branchIndex(); 109 oldUpdateData.m_strDate = updateData.date(); 110 111 /* Cache old update data: */ 112 m_pCache->cacheInitialData(oldUpdateData); 113 114 /* Upload properties to data: */ 115 UISettingsPageGlobal::uploadData(data); 116 } 117 118 void UIGlobalSettingsUpdate::getFromCache() 119 { 120 /* Get old update data from the cache: */ 121 const UIDataSettingsGlobalUpdate &oldUpdateData = m_pCache->base(); 122 123 /* Load old update data from the cache: */ 124 m_pCheckBoxUpdate->setChecked(oldUpdateData.m_fCheckEnabled); 125 if (m_pCheckBoxUpdate->isChecked()) 126 { 127 m_pComboUpdatePeriod->setCurrentIndex(oldUpdateData.m_periodIndex); 128 if (oldUpdateData.m_branchIndex == VBoxUpdateData::BranchWithBetas) 129 m_pRadioUpdateFilterBetas->setChecked(true); 130 else if (oldUpdateData.m_branchIndex == VBoxUpdateData::BranchAllRelease) 131 m_pRadioUpdateFilterEvery->setChecked(true); 132 else 133 m_pRadioUpdateFilterStable->setChecked(true); 134 } 135 m_pFieldUpdateDate->setText(oldUpdateData.m_strDate); 136 sltHandleUpdateToggle(oldUpdateData.m_fCheckEnabled); 137 } 138 139 void UIGlobalSettingsUpdate::putToCache() 140 { 141 /* Prepare new update data: */ 142 UIDataSettingsGlobalUpdate newUpdateData = m_pCache->base(); 143 144 /* Gather new update data: */ 145 newUpdateData.m_periodIndex = periodType(); 146 newUpdateData.m_branchIndex = branchType(); 147 148 /* Cache new update data: */ 149 m_pCache->cacheCurrentData(newUpdateData); 150 } 151 152 void UIGlobalSettingsUpdate::saveFromCacheTo(QVariant &data) 153 { 154 /* Fetch data to properties: */ 155 UISettingsPageGlobal::fetchData(data); 156 157 /* Update update data and failing state: */ 158 setFailed(!saveUpdateData()); 159 160 /* Upload properties to data: */ 161 UISettingsPageGlobal::uploadData(data); 162 } 163 164 void UIGlobalSettingsUpdate::setOrderAfter(QWidget *pWidget) 165 { 166 /* Configure navigation: */ 167 setTabOrder(pWidget, m_pCheckBoxUpdate); 168 setTabOrder(m_pCheckBoxUpdate, m_pComboUpdatePeriod); 169 setTabOrder(m_pComboUpdatePeriod, m_pRadioUpdateFilterStable); 170 setTabOrder(m_pRadioUpdateFilterStable, m_pRadioUpdateFilterEvery); 171 setTabOrder(m_pRadioUpdateFilterEvery, m_pRadioUpdateFilterBetas); 172 } 173 174 void UIGlobalSettingsUpdate::retranslateUi() 175 { 176 m_pCheckBoxUpdate->setWhatsThis(tr("When checked, the application will " 177 "periodically connect to the VirtualBox website and check whether a " 178 "new VirtualBox version is available.")); 179 m_pCheckBoxUpdate->setText(tr("&Check for Updates")); 180 m_pLabelUpdatePeriod->setText(tr("&Once per:")); 181 m_pComboUpdatePeriod->setWhatsThis(tr("Selects how often the new version " 182 "check should be performed. Note that if you want to completely " 183 "disable this check, just clear the above check box.")); 184 m_pLabelUpdateDate->setText(tr("Next Check:")); 185 m_pLabelUpdateFilter->setText(tr("Check for:")); 186 m_pRadioUpdateFilterStable->setWhatsThis(tr("<p>Choose this if you only wish to " 187 "be notified about stable updates to VirtualBox.</p>")); 188 m_pRadioUpdateFilterStable->setText(tr("&Stable Release Versions")); 189 m_pRadioUpdateFilterEvery->setWhatsThis(tr("<p>Choose this if you wish to be " 190 "notified about all new VirtualBox releases.</p>")); 191 m_pRadioUpdateFilterEvery->setText(tr("&All New Releases")); 192 m_pRadioUpdateFilterBetas->setWhatsThis(tr("<p>Choose this to be notified about " 193 "all new VirtualBox releases and pre-release versions of VirtualBox.</p>")); 194 m_pRadioUpdateFilterBetas->setText(tr("All New Releases and &Pre-Releases")); 195 196 /* Retranslate m_pComboUpdatePeriod combobox: */ 197 int iCurrenIndex = m_pComboUpdatePeriod->currentIndex(); 198 m_pComboUpdatePeriod->clear(); 199 VBoxUpdateData::populate(); 200 m_pComboUpdatePeriod->insertItems(0, VBoxUpdateData::list()); 201 m_pComboUpdatePeriod->setCurrentIndex(iCurrenIndex == -1 ? 0 : iCurrenIndex); 202 } 203 204 void UIGlobalSettingsUpdate::sltHandleUpdateToggle(bool fEnabled) 44 void UIUpdateSettingsEditor::setValue(const VBoxUpdateData &guiValue) 45 { 46 /* Update value if changed: */ 47 if (m_guiValue != guiValue) 48 { 49 /* Update value itself: */ 50 m_guiValue = guiValue; 51 52 /* Update check-box if present: */ 53 if (m_pCheckBox) 54 { 55 m_pCheckBox->setChecked(!m_guiValue.isNoNeedToCheck()); 56 57 if (m_pCheckBox->isChecked()) 58 { 59 /* Update period combo if present: */ 60 if (m_pComboUpdatePeriod) 61 m_pComboUpdatePeriod->setCurrentIndex(m_guiValue.periodIndex()); 62 63 /* Update branch radio-buttons if present: */ 64 if (m_mapRadioButtons.value(m_guiValue.branchIndex())) 65 m_mapRadioButtons.value(m_guiValue.branchIndex())->setChecked(true); 66 } 67 68 /* Update other related widgets: */ 69 sltHandleUpdateToggle(m_pCheckBox->isChecked()); 70 } 71 } 72 } 73 74 VBoxUpdateData UIUpdateSettingsEditor::value() const 75 { 76 return m_pCheckBox ? VBoxUpdateData(periodType(), branchType()) : m_guiValue; 77 } 78 79 void UIUpdateSettingsEditor::retranslateUi() 80 { 81 /* Translate check-box: */ 82 if (m_pCheckBox) 83 { 84 m_pCheckBox->setWhatsThis(tr("When checked, the application will periodically connect to the VirtualBox " 85 "website and check whether a new VirtualBox version is available.")); 86 m_pCheckBox->setText(tr("&Check for Updates")); 87 } 88 89 /* Translate period widgets: */ 90 if (m_pLabelUpdatePeriod) 91 m_pLabelUpdatePeriod->setText(tr("&Once per:")); 92 if (m_pComboUpdatePeriod) 93 { 94 m_pComboUpdatePeriod->setWhatsThis(tr("Selects how often the new version check should be performed. Note that if you want " 95 "to completely disable this check, just clear the above check box.")); 96 const int iCurrenIndex = m_pComboUpdatePeriod->currentIndex(); 97 m_pComboUpdatePeriod->clear(); 98 VBoxUpdateData::populate(); 99 m_pComboUpdatePeriod->insertItems(0, VBoxUpdateData::list()); 100 m_pComboUpdatePeriod->setCurrentIndex(iCurrenIndex == -1 ? 0 : iCurrenIndex); 101 } 102 if (m_pLabelUpdateDate) 103 m_pLabelUpdateDate->setText(tr("Next Check:")); 104 if (m_pLabelUpdateFilter) 105 m_pLabelUpdateFilter->setText(tr("Check for:")); 106 107 /* Translate branch widgets: */ 108 if (m_mapRadioButtons.value(VBoxUpdateData::BranchStable)) 109 { 110 m_mapRadioButtons.value(VBoxUpdateData::BranchStable)->setWhatsThis(tr("<p>Choose this if you only wish to be notified " 111 "about stable updates to VirtualBox.</p>")); 112 m_mapRadioButtons.value(VBoxUpdateData::BranchStable)->setText(tr("&Stable Release Versions")); 113 } 114 if (m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease)) 115 { 116 m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease)->setWhatsThis(tr("<p>Choose this if you wish to be notified " 117 "about all new VirtualBox releases.</p>")); 118 m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease)->setText(tr("&All New Releases")); 119 } 120 if (m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas)) 121 { 122 m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas)->setWhatsThis(tr("<p>Choose this to be notified about all new " 123 "VirtualBox releases and pre-release versions " 124 "of VirtualBox.</p>")); 125 m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas)->setText(tr("All New Releases and &Pre-Releases")); 126 } 127 } 128 129 void UIUpdateSettingsEditor::sltHandleUpdateToggle(bool fEnabled) 205 130 { 206 131 /* Update activity status: */ 207 m_pWidgetUpdateSettings->setEnabled(fEnabled); 132 if (m_pWidgetUpdateSettings) 133 m_pWidgetUpdateSettings->setEnabled(fEnabled); 208 134 209 135 /* Update time of next check: */ 210 136 sltHandleUpdatePeriodChange(); 211 137 212 /* Choose stable branch if nothingchosen: */138 /* Choose stable branch if update enabled but branch isn't chosen: */ 213 139 if ( fEnabled 214 && !m_pRadioUpdateFilterStable->isChecked() 215 && !m_pRadioUpdateFilterEvery->isChecked() 216 && !m_pRadioUpdateFilterBetas->isChecked()) 217 m_pRadioUpdateFilterStable->setChecked(true); 218 } 219 220 void UIGlobalSettingsUpdate::sltHandleUpdatePeriodChange() 221 { 222 const VBoxUpdateData data(periodType(), branchType()); 223 m_pFieldUpdateDate->setText(data.date()); 224 } 225 226 void UIGlobalSettingsUpdate::prepare() 227 { 228 /* Prepare cache: */ 229 m_pCache = new UISettingsCacheGlobalUpdate; 230 AssertPtrReturnVoid(m_pCache); 231 140 && m_pRadioButtonGroup 141 && !m_pRadioButtonGroup->checkedButton() 142 && m_mapRadioButtons.value(VBoxUpdateData::BranchStable)) 143 m_mapRadioButtons.value(VBoxUpdateData::BranchStable)->setChecked(true); 144 } 145 146 void UIUpdateSettingsEditor::sltHandleUpdatePeriodChange() 147 { 148 if (m_pFieldUpdateDate) 149 m_pFieldUpdateDate->setText(VBoxUpdateData(periodType(), branchType()).date()); 150 } 151 152 void UIUpdateSettingsEditor::prepare() 153 { 232 154 /* Prepare everything: */ 233 155 prepareWidgets(); … … 238 160 } 239 161 240 void UI GlobalSettingsUpdate::prepareWidgets()162 void UIUpdateSettingsEditor::prepareWidgets() 241 163 { 242 164 /* Prepare main layout: */ … … 244 166 if (pLayoutMain) 245 167 { 168 pLayoutMain->setContentsMargins(0, 0, 0, 0); 246 169 pLayoutMain->setRowStretch(2, 1); 247 170 248 171 /* Prepare update check-box: */ 249 m_pCheckBox Update= new QCheckBox(this);250 if (m_pCheckBox Update)251 pLayoutMain->addWidget(m_pCheckBox Update, 0, 0, 1, 2);172 m_pCheckBox = new QCheckBox(this); 173 if (m_pCheckBox) 174 pLayoutMain->addWidget(m_pCheckBox, 0, 0, 1, 2); 252 175 253 176 /* Prepare 20-px shifting spacer: */ … … 306 229 pLayoutUpdateSettings->addWidget(m_pLabelUpdateFilter, 2, 0); 307 230 } 308 /* Prepare 'update to stable' radio-button: */ 309 m_pRadioUpdateFilterStable = new QRadioButton(m_pWidgetUpdateSettings); 310 if (m_pRadioUpdateFilterStable) 311 pLayoutUpdateSettings->addWidget(m_pRadioUpdateFilterStable, 2, 1); 312 /* Prepare 'update to every' radio-button: */ 313 m_pRadioUpdateFilterEvery = new QRadioButton(m_pWidgetUpdateSettings); 314 if (m_pRadioUpdateFilterEvery) 315 pLayoutUpdateSettings->addWidget(m_pRadioUpdateFilterEvery, 3, 1); 316 /* Prepare 'update to betas' radio-button: */ 317 m_pRadioUpdateFilterBetas = new QRadioButton(m_pWidgetUpdateSettings); 318 if (m_pRadioUpdateFilterBetas) 319 pLayoutUpdateSettings->addWidget(m_pRadioUpdateFilterBetas, 4, 1); 231 /* Prepare radio-button group: */ 232 m_pRadioButtonGroup = new QButtonGroup(m_pWidgetUpdateSettings); 233 if (m_pRadioButtonGroup) 234 { 235 /* Prepare 'update to "stable"' radio-button: */ 236 m_mapRadioButtons[VBoxUpdateData::BranchStable] = new QRadioButton(m_pWidgetUpdateSettings); 237 if (m_mapRadioButtons.value(VBoxUpdateData::BranchStable)) 238 { 239 m_pRadioButtonGroup->addButton(m_mapRadioButtons.value(VBoxUpdateData::BranchStable)); 240 pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value(VBoxUpdateData::BranchStable), 2, 1); 241 } 242 /* Prepare 'update to "all release"' radio-button: */ 243 m_mapRadioButtons[VBoxUpdateData::BranchAllRelease] = new QRadioButton(m_pWidgetUpdateSettings); 244 if (m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease)) 245 { 246 m_pRadioButtonGroup->addButton(m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease)); 247 pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease), 3, 1); 248 } 249 /* Prepare 'update to "with betas"' radio-button: */ 250 m_mapRadioButtons[VBoxUpdateData::BranchWithBetas] = new QRadioButton(m_pWidgetUpdateSettings); 251 if (m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas)) 252 { 253 m_pRadioButtonGroup->addButton(m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas)); 254 pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas), 4, 1); 255 } 256 } 320 257 } 321 258 … … 325 262 } 326 263 327 void UIGlobalSettingsUpdate::prepareConnections() 328 { 329 connect(m_pCheckBoxUpdate, &QCheckBox::toggled, this, &UIGlobalSettingsUpdate::sltHandleUpdateToggle); 330 connect(m_pComboUpdatePeriod, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated), 331 this, &UIGlobalSettingsUpdate::sltHandleUpdatePeriodChange); 332 } 333 334 void UIGlobalSettingsUpdate::cleanup() 335 { 336 /* Cleanup cache: */ 337 delete m_pCache; 338 m_pCache = 0; 339 } 340 341 VBoxUpdateData::PeriodType UIGlobalSettingsUpdate::periodType() const 342 { 343 const VBoxUpdateData::PeriodType result = m_pCheckBoxUpdate->isChecked() ? 344 (VBoxUpdateData::PeriodType)m_pComboUpdatePeriod->currentIndex() : VBoxUpdateData::PeriodNever; 345 return result == VBoxUpdateData::PeriodUndefined ? VBoxUpdateData::Period1Day : result; 346 } 347 348 VBoxUpdateData::BranchType UIGlobalSettingsUpdate::branchType() const 349 { 350 if (m_pRadioUpdateFilterBetas->isChecked()) 351 return VBoxUpdateData::BranchWithBetas; 352 else if (m_pRadioUpdateFilterEvery->isChecked()) 353 return VBoxUpdateData::BranchAllRelease; 354 else 355 return VBoxUpdateData::BranchStable; 356 } 357 358 bool UIGlobalSettingsUpdate::saveUpdateData() 359 { 360 /* Prepare result: */ 361 bool fSuccess = true; 362 /* Save update settings from the cache: */ 363 if (fSuccess && m_pCache->wasChanged()) 364 { 365 /* Get old update data from the cache: */ 366 //const UIDataSettingsGlobalUpdate &oldUpdateData = m_pCache->base(); 367 /* Get new update data from the cache: */ 368 const UIDataSettingsGlobalUpdate &newUpdateData = m_pCache->data(); 369 370 /* Save new update data from the cache: */ 371 const VBoxUpdateData newData(newUpdateData.m_periodIndex, newUpdateData.m_branchIndex); 372 gEDataManager->setApplicationUpdateData(newData.data()); 373 } 374 /* Return result: */ 375 return fSuccess; 376 } 264 void UIUpdateSettingsEditor::prepareConnections() 265 { 266 if (m_pCheckBox) 267 connect(m_pCheckBox, &QCheckBox::toggled, this, &UIUpdateSettingsEditor::sltHandleUpdateToggle); 268 if (m_pComboUpdatePeriod) 269 connect(m_pComboUpdatePeriod, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated), 270 this, &UIUpdateSettingsEditor::sltHandleUpdatePeriodChange); 271 } 272 273 VBoxUpdateData::PeriodType UIUpdateSettingsEditor::periodType() const 274 { 275 const VBoxUpdateData::PeriodType enmResult = m_pCheckBox && m_pCheckBox->isChecked() && m_pComboUpdatePeriod 276 ? (VBoxUpdateData::PeriodType)m_pComboUpdatePeriod->currentIndex() 277 : VBoxUpdateData::PeriodNever; 278 return enmResult == VBoxUpdateData::PeriodUndefined ? VBoxUpdateData::Period1Day : enmResult; 279 } 280 281 VBoxUpdateData::BranchType UIUpdateSettingsEditor::branchType() const 282 { 283 QAbstractButton *pCheckedButton = m_pRadioButtonGroup ? m_pRadioButtonGroup->checkedButton() : 0; 284 return pCheckedButton ? m_mapRadioButtons.key(pCheckedButton, VBoxUpdateData::BranchStable) : VBoxUpdateData::BranchStable; 285 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUpdateSettingsEditor.h
r86125 r86128 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI GlobalSettingsUpdateclass declaration.3 * VBox Qt GUI - UIUpdateSettingsEditor class declaration. 4 4 */ 5 5 … … 16 16 */ 17 17 18 #ifndef FEQT_INCLUDED_SRC_settings_ global_UIGlobalSettingsUpdate_h19 #define FEQT_INCLUDED_SRC_settings_ global_UIGlobalSettingsUpdate_h18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UIUpdateSettingsEditor_h 19 #define FEQT_INCLUDED_SRC_settings_editors_UIUpdateSettingsEditor_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once 22 22 #endif 23 23 24 /* Qt includes: */ 25 #include <QMap> 26 24 27 /* GUI includes: */ 25 #include " UISettingsPage.h"28 #include "QIWithRetranslateUI.h" 26 29 #include "UIUpdateDefs.h" 27 30 28 31 /* Forward declarations: */ 32 class QAbstractButton; 33 class QButtonGroup; 29 34 class QCheckBox; 30 35 class QComboBox; 31 36 class QLabel; 32 class QRadioButton;33 struct UIDataSettingsGlobalUpdate;34 typedef UISettingsCache<UIDataSettingsGlobalUpdate> UISettingsCacheGlobalUpdate;35 37 36 /** Global settings: Update page. */37 class SHARED_LIBRARY_STUFF UI GlobalSettingsUpdate : public UISettingsPageGlobal38 /** QWidget subclass used as a global update settings editor. */ 39 class SHARED_LIBRARY_STUFF UIUpdateSettingsEditor : public QIWithRetranslateUI<QWidget> 38 40 { 39 41 Q_OBJECT; … … 41 43 public: 42 44 43 /** Constructs Update settings page. */ 44 UIGlobalSettingsUpdate(); 45 /** Destructs Update settings page. */ 46 ~UIGlobalSettingsUpdate(); 45 /** Constructs global update settings editor passing @a pParent to the base-class. */ 46 UIUpdateSettingsEditor(QWidget *pParent = 0); 47 48 /** Defines editor @a guiValue. */ 49 void setValue(const VBoxUpdateData &guiValue); 50 /** Returns editor value. */ 51 VBoxUpdateData value() const; 52 53 /** Returns period type. */ 54 VBoxUpdateData::PeriodType periodType() const; 55 /** Returns branch type. */ 56 VBoxUpdateData::BranchType branchType() const; 47 57 48 58 protected: 49 50 /** Loads settings from external object(s) packed inside @a data to cache.51 * @note This task WILL be performed in other than the GUI thread, no widget interactions! */52 virtual void loadToCacheFrom(QVariant &data) /* override */;53 /** Loads data from cache to corresponding widgets.54 * @note This task WILL be performed in the GUI thread only, all widget interactions here! */55 virtual void getFromCache() /* override */;56 57 /** Saves data from corresponding widgets to cache.58 * @note This task WILL be performed in the GUI thread only, all widget interactions here! */59 virtual void putToCache() /* override */;60 /** Saves settings from cache to external object(s) packed inside @a data.61 * @note This task WILL be performed in other than the GUI thread, no widget interactions! */62 virtual void saveFromCacheTo(QVariant &data) /* overrride */;63 64 /** Defines TAB order for passed @a pWidget. */65 virtual void setOrderAfter(QWidget *pWidget) /* override */;66 59 67 60 /** Handles translation event. */ … … 83 76 /** Prepares connections. */ 84 77 void prepareConnections(); 85 /** Cleanups all. */86 void cleanup();87 78 88 /** Returns period type. */ 89 VBoxUpdateData::PeriodType periodType() const; 90 /** Returns branch type. */ 91 VBoxUpdateData::BranchType branchType() const; 92 93 /** Saves existing update data from the cache. */ 94 bool saveUpdateData(); 95 96 /** Holds the page data cache instance. */ 97 UISettingsCacheGlobalUpdate *m_pCache; 79 /** Holds the value to be set. */ 80 VBoxUpdateData m_guiValue; 98 81 99 82 /** @name Widgets 100 83 * @{ */ 101 84 /** Holds the update check-box instance. */ 102 QCheckBox *m_pCheckBox Update;85 QCheckBox *m_pCheckBox; 103 86 /** Holds the update settings widget instance. */ 104 87 QWidget *m_pWidgetUpdateSettings; … … 113 96 /** Holds the update filter label instance. */ 114 97 QLabel *m_pLabelUpdateFilter; 115 /** Holds the 'update to stable' radio-button instance. */ 116 QRadioButton *m_pRadioUpdateFilterStable; 117 /** Holds the 'update to every' radio-button instance. */ 118 QRadioButton *m_pRadioUpdateFilterEvery; 119 /** Holds the 'update to betas' radio-button instance. */ 120 QRadioButton *m_pRadioUpdateFilterBetas; 98 99 /** Holds the radio button group instance. */ 100 QButtonGroup *m_pRadioButtonGroup; 101 /** Holds the radio button map instance. */ 102 QMap<VBoxUpdateData::BranchType, QAbstractButton*> m_mapRadioButtons; 121 103 /** @} */ 122 104 }; 123 105 124 #endif /* !FEQT_INCLUDED_SRC_settings_ global_UIGlobalSettingsUpdate_h */106 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UIUpdateSettingsEditor_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.cpp
r86020 r86128 17 17 18 18 /* Qt includes: */ 19 #include <QCheckBox> 20 #include <QComboBox> 21 #include <QGridLayout> 22 #include <QLabel> 23 #include <QRadioButton> 19 #include <QVBoxLayout> 24 20 25 21 /* GUI includes: */ 22 #include "UIExtraDataManager.h" 26 23 #include "UIGlobalSettingsUpdate.h" 27 #include "UIExtraDataManager.h" 28 #include "UIMessageCenter.h" 29 #include "UICommon.h" 24 #include "UIUpdateSettingsEditor.h" 30 25 31 26 … … 35 30 /** Constructs data. */ 36 31 UIDataSettingsGlobalUpdate() 37 : m_fCheckEnabled(false) 38 , m_periodIndex(VBoxUpdateData::PeriodUndefined) 39 , m_branchIndex(VBoxUpdateData::BranchStable) 40 , m_strDate(QString()) 32 : m_guiUpdateData(VBoxUpdateData()) 41 33 {} 42 34 … … 44 36 bool equal(const UIDataSettingsGlobalUpdate &other) const 45 37 { 46 return true 47 && (m_fCheckEnabled == other.m_fCheckEnabled) 48 && (m_periodIndex == other.m_periodIndex) 49 && (m_branchIndex == other.m_branchIndex) 50 && (m_strDate == other.m_strDate) 51 ; 38 return true 39 && (m_guiUpdateData == other.m_guiUpdateData) 40 ; 52 41 } 53 42 … … 57 46 bool operator!=(const UIDataSettingsGlobalUpdate &other) const { return !equal(other); } 58 47 59 /** Holds whether the update check is enabled. */ 60 bool m_fCheckEnabled; 61 /** Holds the update check period. */ 62 VBoxUpdateData::PeriodType m_periodIndex; 63 /** Holds the update branch type. */ 64 VBoxUpdateData::BranchType m_branchIndex; 65 /** Holds the next update date. */ 66 QString m_strDate; 48 /** Holds VBox update data. */ 49 VBoxUpdateData m_guiUpdateData; 67 50 }; 68 51 … … 70 53 UIGlobalSettingsUpdate::UIGlobalSettingsUpdate() 71 54 : m_pCache(0) 72 , m_pCheckBoxUpdate(0) 73 , m_pWidgetUpdateSettings(0) 74 , m_pLabelUpdatePeriod(0) 75 , m_pComboUpdatePeriod(0) 76 , m_pLabelUpdateDate(0) 77 , m_pFieldUpdateDate(0) 78 , m_pLabelUpdateFilter(0) 79 , m_pRadioUpdateFilterStable(0) 80 , m_pRadioUpdateFilterEvery(0) 81 , m_pRadioUpdateFilterBetas(0) 55 , m_pEditorUpdateSettings(0) 82 56 { 83 /* Prepare: */84 57 prepare(); 85 58 } … … 87 60 UIGlobalSettingsUpdate::~UIGlobalSettingsUpdate() 88 61 { 89 /* Cleanup: */90 62 cleanup(); 91 63 } … … 99 71 m_pCache->clear(); 100 72 101 /* Prepare old update data: */ 102 UIDataSettingsGlobalUpdate oldUpdateData; 103 104 /* Gather old update data: */ 105 const VBoxUpdateData updateData(gEDataManager->applicationUpdateData()); 106 oldUpdateData.m_fCheckEnabled = !updateData.isNoNeedToCheck(); 107 oldUpdateData.m_periodIndex = updateData.periodIndex(); 108 oldUpdateData.m_branchIndex = updateData.branchIndex(); 109 oldUpdateData.m_strDate = updateData.date(); 110 111 /* Cache old update data: */ 112 m_pCache->cacheInitialData(oldUpdateData); 73 /* Cache old data: */ 74 UIDataSettingsGlobalUpdate oldData; 75 oldData.m_guiUpdateData = gEDataManager->applicationUpdateData(); 76 m_pCache->cacheInitialData(oldData); 113 77 114 78 /* Upload properties to data: */ … … 118 82 void UIGlobalSettingsUpdate::getFromCache() 119 83 { 120 /* Get old update data from the cache: */ 121 const UIDataSettingsGlobalUpdate &oldUpdateData = m_pCache->base(); 122 123 /* Load old update data from the cache: */ 124 m_pCheckBoxUpdate->setChecked(oldUpdateData.m_fCheckEnabled); 125 if (m_pCheckBoxUpdate->isChecked()) 126 { 127 m_pComboUpdatePeriod->setCurrentIndex(oldUpdateData.m_periodIndex); 128 if (oldUpdateData.m_branchIndex == VBoxUpdateData::BranchWithBetas) 129 m_pRadioUpdateFilterBetas->setChecked(true); 130 else if (oldUpdateData.m_branchIndex == VBoxUpdateData::BranchAllRelease) 131 m_pRadioUpdateFilterEvery->setChecked(true); 132 else 133 m_pRadioUpdateFilterStable->setChecked(true); 134 } 135 m_pFieldUpdateDate->setText(oldUpdateData.m_strDate); 136 sltHandleUpdateToggle(oldUpdateData.m_fCheckEnabled); 84 /* Load old data from cache: */ 85 const UIDataSettingsGlobalUpdate &oldData = m_pCache->base(); 86 m_pEditorUpdateSettings->setValue(oldData.m_guiUpdateData); 137 87 } 138 88 139 89 void UIGlobalSettingsUpdate::putToCache() 140 90 { 141 /* Prepare new updatedata: */142 UIDataSettingsGlobalUpdate new UpdateData = m_pCache->base();91 /* Prepare new data: */ 92 UIDataSettingsGlobalUpdate newData = m_pCache->base(); 143 93 144 /* Gather new update data: */ 145 newUpdateData.m_periodIndex = periodType(); 146 newUpdateData.m_branchIndex = branchType(); 147 148 /* Cache new update data: */ 149 m_pCache->cacheCurrentData(newUpdateData); 94 /* Cache new data: */ 95 newData.m_guiUpdateData = m_pEditorUpdateSettings->value(); 96 m_pCache->cacheCurrentData(newData); 150 97 } 151 98 … … 155 102 UISettingsPageGlobal::fetchData(data); 156 103 157 /* Update updatedata and failing state: */158 setFailed(!save UpdateData());104 /* Update data and failing state: */ 105 setFailed(!saveData()); 159 106 160 107 /* Upload properties to data: */ … … 162 109 } 163 110 164 void UIGlobalSettingsUpdate::setOrderAfter(QWidget *pWidget)165 {166 /* Configure navigation: */167 setTabOrder(pWidget, m_pCheckBoxUpdate);168 setTabOrder(m_pCheckBoxUpdate, m_pComboUpdatePeriod);169 setTabOrder(m_pComboUpdatePeriod, m_pRadioUpdateFilterStable);170 setTabOrder(m_pRadioUpdateFilterStable, m_pRadioUpdateFilterEvery);171 setTabOrder(m_pRadioUpdateFilterEvery, m_pRadioUpdateFilterBetas);172 }173 174 111 void UIGlobalSettingsUpdate::retranslateUi() 175 112 { 176 m_pCheckBoxUpdate->setWhatsThis(tr("When checked, the application will "177 "periodically connect to the VirtualBox website and check whether a "178 "new VirtualBox version is available."));179 m_pCheckBoxUpdate->setText(tr("&Check for Updates"));180 m_pLabelUpdatePeriod->setText(tr("&Once per:"));181 m_pComboUpdatePeriod->setWhatsThis(tr("Selects how often the new version "182 "check should be performed. Note that if you want to completely "183 "disable this check, just clear the above check box."));184 m_pLabelUpdateDate->setText(tr("Next Check:"));185 m_pLabelUpdateFilter->setText(tr("Check for:"));186 m_pRadioUpdateFilterStable->setWhatsThis(tr("<p>Choose this if you only wish to "187 "be notified about stable updates to VirtualBox.</p>"));188 m_pRadioUpdateFilterStable->setText(tr("&Stable Release Versions"));189 m_pRadioUpdateFilterEvery->setWhatsThis(tr("<p>Choose this if you wish to be "190 "notified about all new VirtualBox releases.</p>"));191 m_pRadioUpdateFilterEvery->setText(tr("&All New Releases"));192 m_pRadioUpdateFilterBetas->setWhatsThis(tr("<p>Choose this to be notified about "193 "all new VirtualBox releases and pre-release versions of VirtualBox.</p>"));194 m_pRadioUpdateFilterBetas->setText(tr("All New Releases and &Pre-Releases"));195 196 /* Retranslate m_pComboUpdatePeriod combobox: */197 int iCurrenIndex = m_pComboUpdatePeriod->currentIndex();198 m_pComboUpdatePeriod->clear();199 VBoxUpdateData::populate();200 m_pComboUpdatePeriod->insertItems(0, VBoxUpdateData::list());201 m_pComboUpdatePeriod->setCurrentIndex(iCurrenIndex == -1 ? 0 : iCurrenIndex);202 }203 204 void UIGlobalSettingsUpdate::sltHandleUpdateToggle(bool fEnabled)205 {206 /* Update activity status: */207 m_pWidgetUpdateSettings->setEnabled(fEnabled);208 209 /* Update time of next check: */210 sltHandleUpdatePeriodChange();211 212 /* Choose stable branch if nothing chosen: */213 if ( fEnabled214 && !m_pRadioUpdateFilterStable->isChecked()215 && !m_pRadioUpdateFilterEvery->isChecked()216 && !m_pRadioUpdateFilterBetas->isChecked())217 m_pRadioUpdateFilterStable->setChecked(true);218 }219 220 void UIGlobalSettingsUpdate::sltHandleUpdatePeriodChange()221 {222 const VBoxUpdateData data(periodType(), branchType());223 m_pFieldUpdateDate->setText(data.date());224 113 } 225 114 … … 232 121 /* Prepare everything: */ 233 122 prepareWidgets(); 234 prepareConnections();235 123 236 124 /* Apply language settings: */ … … 241 129 { 242 130 /* Prepare main layout: */ 243 Q GridLayout *pLayoutMain = new QGridLayout(this);131 QVBoxLayout *pLayoutMain = new QVBoxLayout(this); 244 132 if (pLayoutMain) 245 133 { 246 pLayoutMain->setRowStretch(2, 1); 247 248 /* Prepare update check-box: */ 249 m_pCheckBoxUpdate = new QCheckBox(this); 250 if (m_pCheckBoxUpdate) 251 pLayoutMain->addWidget(m_pCheckBoxUpdate, 0, 0, 1, 2); 252 253 /* Prepare 20-px shifting spacer: */ 254 QSpacerItem *pSpacerItem = new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum); 255 if (pSpacerItem) 256 pLayoutMain->addItem(pSpacerItem, 1, 0); 257 258 /* Prepare update settings widget: */ 259 m_pWidgetUpdateSettings = new QWidget(this); 260 if (m_pWidgetUpdateSettings) 261 { 262 /* Prepare update settings widget layout: */ 263 QGridLayout *pLayoutUpdateSettings = new QGridLayout(m_pWidgetUpdateSettings); 264 if (pLayoutUpdateSettings) 265 { 266 pLayoutUpdateSettings->setContentsMargins(0, 0, 0, 0); 267 pLayoutUpdateSettings->setColumnStretch(2, 1); 268 pLayoutUpdateSettings->setRowStretch(5, 1); 269 270 /* Prepare update period label: */ 271 m_pLabelUpdatePeriod = new QLabel(m_pWidgetUpdateSettings); 272 if (m_pLabelUpdatePeriod) 273 { 274 m_pLabelUpdatePeriod->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 275 pLayoutUpdateSettings->addWidget(m_pLabelUpdatePeriod, 0, 0); 276 } 277 /* Prepare update period combo: */ 278 m_pComboUpdatePeriod = new QComboBox(m_pWidgetUpdateSettings); 279 if (m_pComboUpdatePeriod) 280 { 281 if (m_pLabelUpdatePeriod) 282 m_pLabelUpdatePeriod->setBuddy(m_pComboUpdatePeriod); 283 m_pComboUpdatePeriod->setSizeAdjustPolicy(QComboBox::AdjustToContents); 284 m_pComboUpdatePeriod->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); 285 286 pLayoutUpdateSettings->addWidget(m_pComboUpdatePeriod, 0, 1); 287 } 288 289 /* Prepare update date label: */ 290 m_pLabelUpdateDate = new QLabel(m_pWidgetUpdateSettings); 291 if (m_pLabelUpdateDate) 292 { 293 m_pLabelUpdateDate->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 294 pLayoutUpdateSettings->addWidget(m_pLabelUpdateDate, 1, 0); 295 } 296 /* Prepare update date field: */ 297 m_pFieldUpdateDate = new QLabel(m_pWidgetUpdateSettings); 298 if (m_pFieldUpdateDate) 299 pLayoutUpdateSettings->addWidget(m_pFieldUpdateDate, 1, 1); 300 301 /* Prepare update date label: */ 302 m_pLabelUpdateFilter = new QLabel(m_pWidgetUpdateSettings); 303 if (m_pLabelUpdateFilter) 304 { 305 m_pLabelUpdateFilter->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 306 pLayoutUpdateSettings->addWidget(m_pLabelUpdateFilter, 2, 0); 307 } 308 /* Prepare 'update to stable' radio-button: */ 309 m_pRadioUpdateFilterStable = new QRadioButton(m_pWidgetUpdateSettings); 310 if (m_pRadioUpdateFilterStable) 311 pLayoutUpdateSettings->addWidget(m_pRadioUpdateFilterStable, 2, 1); 312 /* Prepare 'update to every' radio-button: */ 313 m_pRadioUpdateFilterEvery = new QRadioButton(m_pWidgetUpdateSettings); 314 if (m_pRadioUpdateFilterEvery) 315 pLayoutUpdateSettings->addWidget(m_pRadioUpdateFilterEvery, 3, 1); 316 /* Prepare 'update to betas' radio-button: */ 317 m_pRadioUpdateFilterBetas = new QRadioButton(m_pWidgetUpdateSettings); 318 if (m_pRadioUpdateFilterBetas) 319 pLayoutUpdateSettings->addWidget(m_pRadioUpdateFilterBetas, 4, 1); 320 } 321 322 pLayoutMain->addWidget(m_pWidgetUpdateSettings, 1, 1); 323 } 134 /* Prepare update settings editor: */ 135 m_pEditorUpdateSettings = new UIUpdateSettingsEditor(this); 136 if (m_pEditorUpdateSettings) 137 pLayoutMain->addWidget(m_pEditorUpdateSettings); 324 138 } 325 }326 327 void UIGlobalSettingsUpdate::prepareConnections()328 {329 connect(m_pCheckBoxUpdate, &QCheckBox::toggled, this, &UIGlobalSettingsUpdate::sltHandleUpdateToggle);330 connect(m_pComboUpdatePeriod, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated),331 this, &UIGlobalSettingsUpdate::sltHandleUpdatePeriodChange);332 139 } 333 140 … … 339 146 } 340 147 341 VBoxUpdateData::PeriodType UIGlobalSettingsUpdate::periodType() const 342 { 343 const VBoxUpdateData::PeriodType result = m_pCheckBoxUpdate->isChecked() ? 344 (VBoxUpdateData::PeriodType)m_pComboUpdatePeriod->currentIndex() : VBoxUpdateData::PeriodNever; 345 return result == VBoxUpdateData::PeriodUndefined ? VBoxUpdateData::Period1Day : result; 346 } 347 348 VBoxUpdateData::BranchType UIGlobalSettingsUpdate::branchType() const 349 { 350 if (m_pRadioUpdateFilterBetas->isChecked()) 351 return VBoxUpdateData::BranchWithBetas; 352 else if (m_pRadioUpdateFilterEvery->isChecked()) 353 return VBoxUpdateData::BranchAllRelease; 354 else 355 return VBoxUpdateData::BranchStable; 356 } 357 358 bool UIGlobalSettingsUpdate::saveUpdateData() 148 bool UIGlobalSettingsUpdate::saveData() 359 149 { 360 150 /* Prepare result: */ 361 151 bool fSuccess = true; 362 /* Save update settings from thecache: */152 /* Save update settings from cache: */ 363 153 if (fSuccess && m_pCache->wasChanged()) 364 154 { 365 /* Get old update data from thecache: */366 //const UIDataSettingsGlobalUpdate &oldUpdateData = m_pCache->base();367 /* Get new update data from thecache: */368 const UIDataSettingsGlobalUpdate &new UpdateData = m_pCache->data();155 /* Get old data from cache: */ 156 const UIDataSettingsGlobalUpdate &oldData = m_pCache->base(); 157 /* Get new data from cache: */ 158 const UIDataSettingsGlobalUpdate &newData = m_pCache->data(); 369 159 370 /* Save new update data from the cache: */ 371 const VBoxUpdateData newData(newUpdateData.m_periodIndex, newUpdateData.m_branchIndex); 372 gEDataManager->setApplicationUpdateData(newData.data()); 160 /* Save new data from cache: */ 161 if ( fSuccess 162 && newData != oldData) 163 gEDataManager->setApplicationUpdateData(newData.m_guiUpdateData.data()); 373 164 } 374 165 /* Return result: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.h
r86095 r86128 27 27 28 28 /* Forward declarations: */ 29 class QCheckBox; 30 class QComboBox; 31 class QLabel; 32 class QRadioButton; 29 class UIUpdateSettingsEditor; 33 30 struct UIDataSettingsGlobalUpdate; 34 31 typedef UISettingsCache<UIDataSettingsGlobalUpdate> UISettingsCacheGlobalUpdate; … … 41 38 public: 42 39 43 /** Constructs Updatesettings page. */40 /** Constructs settings page. */ 44 41 UIGlobalSettingsUpdate(); 45 /** Destructs Updatesettings page. */46 ~UIGlobalSettingsUpdate();42 /** Destructs settings page. */ 43 virtual ~UIGlobalSettingsUpdate() /* override */; 47 44 48 45 protected: … … 62 59 virtual void saveFromCacheTo(QVariant &data) /* overrride */; 63 60 64 /** Defines TAB order for passed @a pWidget. */65 virtual void setOrderAfter(QWidget *pWidget) /* override */;66 67 61 /** Handles translation event. */ 68 62 virtual void retranslateUi() /* override */; 69 70 private slots:71 72 /** Handles whether update is @a fEnabled. */73 void sltHandleUpdateToggle(bool fEnabled);74 /** Handles update period change. */75 void sltHandleUpdatePeriodChange();76 63 77 64 private: … … 81 68 /** Prepares widgets. */ 82 69 void prepareWidgets(); 83 /** Prepares connections. */84 void prepareConnections();85 70 /** Cleanups all. */ 86 71 void cleanup(); 87 72 88 /** Returns period type. */ 89 VBoxUpdateData::PeriodType periodType() const; 90 /** Returns branch type. */ 91 VBoxUpdateData::BranchType branchType() const; 92 93 /** Saves existing update data from the cache. */ 94 bool saveUpdateData(); 73 /** Saves existing data from cache. */ 74 bool saveData(); 95 75 96 76 /** Holds the page data cache instance. */ … … 99 79 /** @name Widgets 100 80 * @{ */ 101 /** Holds the update check-box instance. */ 102 QCheckBox *m_pCheckBoxUpdate; 103 /** Holds the update settings widget instance. */ 104 QWidget *m_pWidgetUpdateSettings; 105 /** Holds the update period label instance. */ 106 QLabel *m_pLabelUpdatePeriod; 107 /** Holds the update period combo instance. */ 108 QComboBox *m_pComboUpdatePeriod; 109 /** Holds the update date label instance. */ 110 QLabel *m_pLabelUpdateDate; 111 /** Holds the update date field instance. */ 112 QLabel *m_pFieldUpdateDate; 113 /** Holds the update filter label instance. */ 114 QLabel *m_pLabelUpdateFilter; 115 /** Holds the 'update to stable' radio-button instance. */ 116 QRadioButton *m_pRadioUpdateFilterStable; 117 /** Holds the 'update to every' radio-button instance. */ 118 QRadioButton *m_pRadioUpdateFilterEvery; 119 /** Holds the 'update to betas' radio-button instance. */ 120 QRadioButton *m_pRadioUpdateFilterBetas; 81 /** Holds the update settings editor instance. */ 82 UIUpdateSettingsEditor *m_pEditorUpdateSettings; 121 83 /** @} */ 122 84 };
Note:
See TracChangeset
for help on using the changeset viewer.