- Timestamp:
- Apr 28, 2022 7:11:26 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIUpdateDefs.cpp
r94740 r94750 67 67 VBoxUpdateData::VBoxUpdateData(const QString &strData) 68 68 : m_strData(strData) 69 , m_fCheckEnabled(false) 70 , m_fCheckRequired(false) 69 71 , m_enmUpdatePeriod(UpdatePeriodType_Never) 70 72 , m_enmUpdateChannel(KUpdateChannel_Invalid) … … 73 75 if (m_strData == "never") 74 76 return; 77 78 /* Check is enabled in all cases besides 'never': */ 79 m_fCheckEnabled = true; 75 80 76 81 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) … … 108 113 m_version = UIVersion(parser.at(3)); 109 114 } 110 } 111 112 VBoxUpdateData::VBoxUpdateData(UpdatePeriodType enmUpdatePeriod, KUpdateChannel enmUpdateChannel) 115 116 /* Decide whether we need to check: */ 117 m_fCheckRequired = (QDate::currentDate() >= date()) 118 && ( !version().isValid() 119 || version() != UIVersion(uiCommon().vboxVersionStringNormalized())); 120 } 121 122 VBoxUpdateData::VBoxUpdateData(bool fCheckEnabled, UpdatePeriodType enmUpdatePeriod, KUpdateChannel enmUpdateChannel) 113 123 : m_strData("never") 124 , m_fCheckEnabled(fCheckEnabled) 125 , m_fCheckRequired(false) 114 126 , m_enmUpdatePeriod(enmUpdatePeriod) 115 127 , m_enmUpdateChannel(enmUpdateChannel) 116 128 { 117 /* Skip ' UpdatePeriodType_Never' case: */118 if ( m_enmUpdatePeriod == UpdatePeriodType_Never)129 /* Skip 'check disabled' case: */ 130 if (!m_fCheckEnabled) 119 131 return; 120 132 … … 144 156 /* Compose m_strData: */ 145 157 m_strData = QString("%1, %2, %3, %4").arg(strRemindPeriod, strRemindDate, strUpdateChannel, strVersionValue); 158 159 /* Decide whether we need to check: */ 160 m_fCheckRequired = (QDate::currentDate() >= date()) 161 && ( !version().isValid() 162 || version() != UIVersion(uiCommon().vboxVersionStringNormalized())); 146 163 } 147 164 148 165 bool VBoxUpdateData::isCheckEnabled() const 149 166 { 150 /* Check is enabled if Period != Never: */ 151 return m_enmUpdatePeriod != UpdatePeriodType_Never; 167 return m_fCheckEnabled; 152 168 } 153 169 154 170 bool VBoxUpdateData::isCheckRequired() const 155 171 { 156 /* Return 'false' if there check is disabled: */ 157 if (!isCheckEnabled()) 158 return false; 159 160 /* Return 'true' if date of next check is today or missed: */ 161 if (QDate::currentDate() >= m_date) 162 return true; 163 164 /* Return 'true' if saved version value is NOT valid or NOT equal to current: */ 165 if (!version().isValid() || version() != UIVersion(uiCommon().vboxVersionStringNormalized())) 166 return true; 167 168 /* Return 'false' in all other cases: */ 169 return false; 172 return m_fCheckRequired; 170 173 } 171 174 -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIUpdateDefs.h
r94740 r94750 82 82 /** Constructs update description on the basis of passed @a strData. */ 83 83 VBoxUpdateData(const QString &strData = QString()); 84 /** Constructs update description on the basis of passed @a enmUpdatePeriod and @a enmUpdateChannel. */85 VBoxUpdateData( UpdatePeriodType enmUpdatePeriod, KUpdateChannel enmUpdateChannel);84 /** Constructs update description on the basis of passed @a fCheckEnabled, @a enmUpdatePeriod and @a enmUpdateChannel. */ 85 VBoxUpdateData(bool fCheckEnabled, UpdatePeriodType enmUpdatePeriod, KUpdateChannel enmUpdateChannel); 86 86 87 87 /** Returns whether check is enabled. */ … … 130 130 QString m_strData; 131 131 132 /** Holds whether check is enabled. */ 133 bool m_fCheckEnabled; 134 /** Holds whether it's need to check for update. */ 135 bool m_fCheckRequired; 136 132 137 /** Holds the update period. */ 133 UpdatePeriodType m_enmUpdatePeriod;138 UpdatePeriodType m_enmUpdatePeriod; 134 139 /** Holds the update date. */ 135 QDate 140 QDate m_date; 136 141 /** Holds the update channel. */ 137 KUpdateChannel 142 KUpdateChannel m_enmUpdateChannel; 138 143 /** Holds the update version. */ 139 UIVersion 144 UIVersion m_version; 140 145 }; 141 146 -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIUpdateManager.cpp
r94740 r94750 364 364 VBoxUpdateData currentData(gEDataManager->applicationUpdateData()); 365 365 /* Encode/save new update data: */ 366 VBoxUpdateData newData(currentData. updatePeriod(), currentData.updateChannel());366 VBoxUpdateData newData(currentData.isCheckEnabled(), currentData.updatePeriod(), currentData.updateChannel()); 367 367 gEDataManager->setApplicationUpdateData(newData.data()); 368 368 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUpdateSettingsEditor.cpp
r94740 r94750 69 69 VBoxUpdateData UIUpdateSettingsEditor::value() const 70 70 { 71 return m_pCheckBox ? VBoxUpdateData(updatePeriod(), updateChannel()) : m_guiValue;71 return VBoxUpdateData(isCheckEnabled(), updatePeriod(), updateChannel()); 72 72 } 73 73 … … 141 141 { 142 142 if (m_pFieldUpdateDate) 143 m_pFieldUpdateDate->setText(VBoxUpdateData( updatePeriod(), updateChannel()).dateToString());143 m_pFieldUpdateDate->setText(VBoxUpdateData(isCheckEnabled(), updatePeriod(), updateChannel()).dateToString()); 144 144 } 145 145 … … 265 265 } 266 266 267 bool UIUpdateSettingsEditor::isCheckEnabled() const 268 { 269 return m_pCheckBox ? m_pCheckBox->isChecked() : m_guiValue.isCheckEnabled(); 270 } 271 267 272 UpdatePeriodType UIUpdateSettingsEditor::updatePeriod() const 268 273 { 269 return m_pCheckBox && m_pCheckBox->isChecked() && m_pComboUpdatePeriod 270 ? (UpdatePeriodType)m_pComboUpdatePeriod->currentIndex() 271 : UpdatePeriodType_Never; 274 return m_pComboUpdatePeriod ? (UpdatePeriodType)m_pComboUpdatePeriod->currentIndex() : m_guiValue.updatePeriod(); 272 275 } 273 276 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUpdateSettingsEditor.h
r94733 r94750 72 72 void prepareConnections(); 73 73 74 /** Returns whether check is enabled. */ 75 bool isCheckEnabled() const; 74 76 /** Returns update period. */ 75 77 UpdatePeriodType updatePeriod() const;
Note:
See TracChangeset
for help on using the changeset viewer.