Changeset 94725 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 27, 2022 2:39:28 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/networking/UINewVersionChecker.cpp
r93996 r94725 65 65 } 66 66 url.addQueryItem("count", QString::number(gEDataManager->applicationUpdateCheckCounter())); 67 url.addQueryItem("branch", VBoxUpdateData(gEDataManager->applicationUpdateData()). branchName());67 url.addQueryItem("branch", VBoxUpdateData(gEDataManager->applicationUpdateData()).updateChannelName()); 68 68 const QString strUserAgent(QString("VirtualBox %1 <%2>").arg(uiCommon().virtualBox().GetVersion()).arg(platformInfo())); 69 69 -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIUpdateDefs.cpp
r94009 r94725 68 68 : m_strData(strData) 69 69 , m_enmPeriodIndex(Period1Day) 70 , m_enm BranchIndex(BranchStable)70 , m_enmUpdateChannel(KUpdateChannel_Stable) 71 71 { 72 72 decode(); 73 73 } 74 74 75 VBoxUpdateData::VBoxUpdateData(PeriodType enmPeriodIndex, BranchType enmBranchIndex)75 VBoxUpdateData::VBoxUpdateData(PeriodType enmPeriodIndex, KUpdateChannel enmUpdateChannel) 76 76 : m_strData(QString()) 77 77 , m_enmPeriodIndex(enmPeriodIndex) 78 , m_enm BranchIndex(enmBranchIndex)78 , m_enmUpdateChannel(enmUpdateChannel) 79 79 { 80 80 encode(); … … 126 126 } 127 127 128 VBoxUpdateData::BranchType VBoxUpdateData::branchIndex() const 129 { 130 return m_enmBranchIndex; 131 } 132 133 QString VBoxUpdateData::branchName() const 134 { 135 switch (m_enmBranchIndex) 136 { 137 case BranchStable: 138 return "stable"; 139 case BranchAllRelease: 140 return "allrelease"; 141 case BranchWithBetas: 142 return "withbetas"; 143 } 144 return QString(); 128 KUpdateChannel VBoxUpdateData::updateChannel() const 129 { 130 return m_enmUpdateChannel; 131 } 132 133 QString VBoxUpdateData::updateChannelName() const 134 { 135 return updateChannelToInternalString(m_enmUpdateChannel); 145 136 } 146 137 … … 156 147 && (m_enmPeriodIndex == another.periodIndex()) 157 148 && (m_date == another.internalDate()) 158 && (m_enm BranchIndex == another.branchIndex())149 && (m_enmUpdateChannel == another.updateChannel()) 159 150 && (m_version == another.version()) 160 151 ; … … 169 160 { 170 161 return !isEqual(another); 162 } 163 164 /* static */ 165 QString VBoxUpdateData::updateChannelToInternalString(KUpdateChannel enmUpdateChannel) 166 { 167 switch (enmUpdateChannel) 168 { 169 case KUpdateChannel_WithTesting: return "withtesting"; 170 case KUpdateChannel_WithBetas: return "withbetas"; 171 case KUpdateChannel_All: return "allrelease"; 172 default: return "stable"; 173 } 174 } 175 176 /* static */ 177 KUpdateChannel VBoxUpdateData::updateChannelFromInternalString(const QString &strUpdateChannel) 178 { 179 QMap<QString, KUpdateChannel> pairs; 180 pairs["withtesting"] = KUpdateChannel_WithTesting; 181 pairs["withbetas"] = KUpdateChannel_WithBetas; 182 pairs["allrelease"] = KUpdateChannel_All; 183 return pairs.value(strUpdateChannel, KUpdateChannel_Stable); 171 184 } 172 185 … … 180 193 { 181 194 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) 182 QStringList parser (m_strData.split(", ", Qt::SkipEmptyParts));195 QStringList parser = m_strData.split(", ", Qt::SkipEmptyParts); 183 196 #else 184 QStringList parser (m_strData.split(", ", QString::SkipEmptyParts));197 QStringList parser = m_strData.split(", ", QString::SkipEmptyParts); 185 198 #endif 186 199 … … 190 203 if (m_dayList.isEmpty()) 191 204 populate(); 192 PeriodType index = (PeriodType)m_dayList.indexOf(VBoxUpdateDay(QString(), parser [0]));205 PeriodType index = (PeriodType)m_dayList.indexOf(VBoxUpdateDay(QString(), parser.at(0))); 193 206 m_enmPeriodIndex = index == PeriodUndefined ? Period1Day : index; 194 207 } … … 197 210 if (parser.size() > 1) 198 211 { 199 QDate date = QDate::fromString(parser [1], Qt::ISODate);212 QDate date = QDate::fromString(parser.at(1), Qt::ISODate); 200 213 m_date = date.isValid() ? date : QDate::currentDate(); 201 214 } 202 215 203 /* Parse ' branch' value: */216 /* Parse 'update channel' value: */ 204 217 if (parser.size() > 2) 205 218 { 206 QString branch(parser[2]); 207 m_enmBranchIndex = branch == "withbetas" ? BranchWithBetas : 208 branch == "allrelease" ? BranchAllRelease : BranchStable; 219 m_enmUpdateChannel = updateChannelFromInternalString(parser.at(2)); 209 220 } 210 221 … … 212 223 if (parser.size() > 3) 213 224 { 214 m_version = UIVersion(parser [3]);225 m_version = UIVersion(parser.at(3)); 215 226 } 216 227 } … … 241 252 QString remindDate = m_date.toString(Qt::ISODate); 242 253 243 /* Encode 'branch' value: */ 244 QString branchValue = m_enmBranchIndex == BranchWithBetas ? "withbetas" : 245 m_enmBranchIndex == BranchAllRelease ? "allrelease" : "stable"; 254 /* Encode 'update channel' value: */ 255 QString strUpdateChannel = updateChannelName(); 246 256 247 257 /* Encode 'version' value: */ … … 249 259 250 260 /* Composite m_strData: */ 251 m_strData = QString("%1, %2, %3, %4").arg(remindPeriod, remindDate, branchValue, versionValue);261 m_strData = QString("%1, %2, %3, %4").arg(remindPeriod, remindDate, strUpdateChannel, versionValue); 252 262 } 253 263 } -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIUpdateDefs.h
r94017 r94725 28 28 #include "UILibraryDefs.h" 29 29 #include "UIVersion.h" 30 31 /* COM includes: */ 32 #include "COMEnums.h" 30 33 31 34 … … 66 69 }; 67 70 68 /** Branch types. */69 enum BranchType70 {71 BranchStable = 0,72 BranchAllRelease = 1,73 BranchWithBetas = 274 };75 76 71 /** Populates a set of update options. */ 77 72 static void populate(); … … 81 76 /** Constructs update description on the basis of passed @a strData. */ 82 77 VBoxUpdateData(const QString &strData = QString()); 83 /** Constructs update description on the basis of passed @a enmPeriodIndex and @a enm BranchIndex. */84 VBoxUpdateData(PeriodType enmPeriodIndex, BranchType enmBranchIndex);78 /** Constructs update description on the basis of passed @a enmPeriodIndex and @a enmUpdateChannel. */ 79 VBoxUpdateData(PeriodType enmPeriodIndex, KUpdateChannel enmUpdateChannel); 85 80 86 81 /** Returns whether there is no need to check. */ … … 96 91 /** Returns internal update date. */ 97 92 QDate internalDate() const; 98 /** Returns branch index. */99 BranchType branchIndex() const;100 /** Returns periodname. */101 QString branchName() const;93 /** Returns update channel. */ 94 KUpdateChannel updateChannel() const; 95 /** Returns update channel name. */ 96 QString updateChannelName() const; 102 97 /** Returns version. */ 103 98 UIVersion version() const; … … 109 104 /** Returns whether this item isn't equal to @a another one. */ 110 105 bool operator!=(const VBoxUpdateData &another) const; 106 107 /** Converts passed @a enmUpdateChannel to internal QString value. 108 * @note This isn't a member of UIConverter since it's used for 109 * legacy extra-data settings saving routine only. */ 110 static QString updateChannelToInternalString(KUpdateChannel enmUpdateChannel); 111 /** Converts passed @a strUpdateChannel to KUpdateChannel value. 112 * @note This isn't a member of UIConverter since it's used for 113 * legacy extra-data settings saving routine only. */ 114 static KUpdateChannel updateChannelFromInternalString(const QString &strUpdateChannel); 111 115 112 116 private: … … 121 125 122 126 /** Holds the update data. */ 123 QString m_strData;127 QString m_strData; 124 128 /** Holds the update period index. */ 125 PeriodType m_enmPeriodIndex;129 PeriodType m_enmPeriodIndex; 126 130 /** Holds the update date. */ 127 QDate m_date;128 /** Holds the update branch index. */129 BranchType m_enmBranchIndex;131 QDate m_date; 132 /** Holds the update channel. */ 133 KUpdateChannel m_enmUpdateChannel; 130 134 /** Holds the update version. */ 131 UIVersion m_version;135 UIVersion m_version; 132 136 }; 133 137 -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIUpdateManager.cpp
r94516 r94725 364 364 VBoxUpdateData currentData(gEDataManager->applicationUpdateData()); 365 365 /* Encode/save new update data: */ 366 VBoxUpdateData newData(currentData.periodIndex(), currentData. branchIndex());366 VBoxUpdateData newData(currentData.periodIndex(), currentData.updateChannel()); 367 367 gEDataManager->setApplicationUpdateData(newData.data()); 368 368 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUpdateSettingsEditor.cpp
r94395 r94725 58 58 if (m_pComboUpdatePeriod) 59 59 m_pComboUpdatePeriod->setCurrentIndex(m_guiValue.periodIndex()); 60 if (m_mapRadioButtons.value(m_guiValue. branchIndex()))61 m_mapRadioButtons.value(m_guiValue. branchIndex())->setChecked(true);60 if (m_mapRadioButtons.value(m_guiValue.updateChannel())) 61 m_mapRadioButtons.value(m_guiValue.updateChannel())->setChecked(true); 62 62 } 63 63 … … 69 69 VBoxUpdateData UIUpdateSettingsEditor::value() const 70 70 { 71 return m_pCheckBox ? VBoxUpdateData(periodType(), branchType()) : m_guiValue;71 return m_pCheckBox ? VBoxUpdateData(periodType(), updateChannel()) : m_guiValue; 72 72 } 73 73 … … 100 100 101 101 /* Translate branch widgets: */ 102 if (m_mapRadioButtons.value( VBoxUpdateData::BranchStable))103 { 104 m_mapRadioButtons.value( VBoxUpdateData::BranchStable)->setToolTip(tr("When chosen, you will be notified "105 "about stable updates to VirtualBox."));106 m_mapRadioButtons.value(VBoxUpdateData::BranchStable)->setText(tr("&Stable Release Versions"));107 } 108 if (m_mapRadioButtons.value( VBoxUpdateData::BranchAllRelease))109 { 110 m_mapRadioButtons.value( VBoxUpdateData::BranchAllRelease)->setToolTip(tr("When chosen, you will be notified "111 "about all new VirtualBox releases."));112 m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease)->setText(tr("&All New Releases"));113 } 114 if (m_mapRadioButtons.value( VBoxUpdateData::BranchWithBetas))115 { 116 m_mapRadioButtons.value( VBoxUpdateData::BranchWithBetas)->setToolTip(tr("When chosen, you will be notified "117 "about all new VirtualBox releases and "118 "pre-release versions of VirtualBox."));119 m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas)->setText(tr("All New Releases and &Pre-Releases"));102 if (m_mapRadioButtons.value(KUpdateChannel_Stable)) 103 { 104 m_mapRadioButtons.value(KUpdateChannel_Stable)->setText(tr("&Stable Release Versions")); 105 m_mapRadioButtons.value(KUpdateChannel_Stable)->setToolTip(tr("When chosen, you will be notified " 106 "about stable updates to VirtualBox.")); 107 } 108 if (m_mapRadioButtons.value(KUpdateChannel_All)) 109 { 110 m_mapRadioButtons.value(KUpdateChannel_All)->setText(tr("&All New Releases")); 111 m_mapRadioButtons.value(KUpdateChannel_All)->setToolTip(tr("When chosen, you will be notified " 112 "about all new VirtualBox releases.")); 113 } 114 if (m_mapRadioButtons.value(KUpdateChannel_WithBetas)) 115 { 116 m_mapRadioButtons.value(KUpdateChannel_WithBetas)->setText(tr("All New Releases and &Pre-Releases")); 117 m_mapRadioButtons.value(KUpdateChannel_WithBetas)->setToolTip(tr("When chosen, you will be notified " 118 "about all new VirtualBox releases and " 119 "pre-release versions of VirtualBox.")); 120 120 } 121 121 } … … 134 134 && m_pRadioButtonGroup 135 135 && !m_pRadioButtonGroup->checkedButton() 136 && m_mapRadioButtons.value( VBoxUpdateData::BranchStable))137 m_mapRadioButtons.value( VBoxUpdateData::BranchStable)->setChecked(true);136 && m_mapRadioButtons.value(KUpdateChannel_Stable)) 137 m_mapRadioButtons.value(KUpdateChannel_Stable)->setChecked(true); 138 138 } 139 139 … … 141 141 { 142 142 if (m_pFieldUpdateDate) 143 m_pFieldUpdateDate->setText(VBoxUpdateData(periodType(), branchType()).date());143 m_pFieldUpdateDate->setText(VBoxUpdateData(periodType(), updateChannel()).date()); 144 144 } 145 145 … … 228 228 { 229 229 /* Prepare 'update to "stable"' radio-button: */ 230 m_mapRadioButtons[ VBoxUpdateData::BranchStable] = new QRadioButton(m_pWidgetUpdateSettings);231 if (m_mapRadioButtons.value( VBoxUpdateData::BranchStable))230 m_mapRadioButtons[KUpdateChannel_Stable] = new QRadioButton(m_pWidgetUpdateSettings); 231 if (m_mapRadioButtons.value(KUpdateChannel_Stable)) 232 232 { 233 m_pRadioButtonGroup->addButton(m_mapRadioButtons.value( VBoxUpdateData::BranchStable));234 pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value( VBoxUpdateData::BranchStable), 2, 1);233 m_pRadioButtonGroup->addButton(m_mapRadioButtons.value(KUpdateChannel_Stable)); 234 pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value(KUpdateChannel_Stable), 2, 1); 235 235 } 236 236 /* Prepare 'update to "all release"' radio-button: */ 237 m_mapRadioButtons[ VBoxUpdateData::BranchAllRelease] = new QRadioButton(m_pWidgetUpdateSettings);238 if (m_mapRadioButtons.value( VBoxUpdateData::BranchAllRelease))237 m_mapRadioButtons[KUpdateChannel_All] = new QRadioButton(m_pWidgetUpdateSettings); 238 if (m_mapRadioButtons.value(KUpdateChannel_All)) 239 239 { 240 m_pRadioButtonGroup->addButton(m_mapRadioButtons.value( VBoxUpdateData::BranchAllRelease));241 pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value( VBoxUpdateData::BranchAllRelease), 3, 1);240 m_pRadioButtonGroup->addButton(m_mapRadioButtons.value(KUpdateChannel_All)); 241 pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value(KUpdateChannel_All), 3, 1); 242 242 } 243 243 /* Prepare 'update to "with betas"' radio-button: */ 244 m_mapRadioButtons[ VBoxUpdateData::BranchWithBetas] = new QRadioButton(m_pWidgetUpdateSettings);245 if (m_mapRadioButtons.value( VBoxUpdateData::BranchWithBetas))244 m_mapRadioButtons[KUpdateChannel_WithBetas] = new QRadioButton(m_pWidgetUpdateSettings); 245 if (m_mapRadioButtons.value(KUpdateChannel_WithBetas)) 246 246 { 247 m_pRadioButtonGroup->addButton(m_mapRadioButtons.value( VBoxUpdateData::BranchWithBetas));248 pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value( VBoxUpdateData::BranchWithBetas), 4, 1);247 m_pRadioButtonGroup->addButton(m_mapRadioButtons.value(KUpdateChannel_WithBetas)); 248 pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value(KUpdateChannel_WithBetas), 4, 1); 249 249 } 250 250 } … … 273 273 } 274 274 275 VBoxUpdateData::BranchType UIUpdateSettingsEditor::branchType() const275 KUpdateChannel UIUpdateSettingsEditor::updateChannel() const 276 276 { 277 277 QAbstractButton *pCheckedButton = m_pRadioButtonGroup ? m_pRadioButtonGroup->checkedButton() : 0; 278 return pCheckedButton ? m_mapRadioButtons.key(pCheckedButton, VBoxUpdateData::BranchStable) : VBoxUpdateData::BranchStable;279 } 278 return m_mapRadioButtons.key(pCheckedButton, KUpdateChannel_Stable); 279 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUpdateSettingsEditor.h
r94395 r94725 74 74 /** Returns period type. */ 75 75 VBoxUpdateData::PeriodType periodType() const; 76 /** Returns branch type. */77 VBoxUpdateData::BranchType branchType() const;76 /** Returns update channel. */ 77 KUpdateChannel updateChannel() const; 78 78 79 79 /** Holds the value to be set. */ … … 98 98 99 99 /** Holds the radio button group instance. */ 100 QButtonGroup 100 QButtonGroup *m_pRadioButtonGroup; 101 101 /** Holds the radio button map instance. */ 102 QMap< VBoxUpdateData::BranchType, QAbstractButton*> m_mapRadioButtons;102 QMap<KUpdateChannel, QAbstractButton*> m_mapRadioButtons; 103 103 /** @} */ 104 104 };
Note:
See TracChangeset
for help on using the changeset viewer.