- Timestamp:
- Oct 20, 2023 1:37:34 PM (12 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
-
globals/UIGuestOSType.cpp (modified) (4 diffs)
-
globals/UIGuestOSType.h (modified) (5 diffs)
-
settings/editors/UINameAndSystemEditor.cpp (modified) (10 diffs)
-
settings/editors/UINameAndSystemEditor.h (modified) (4 diffs)
-
widgets/UIGuestOSTypeSelectionButton.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.cpp
r101326 r101519 72 72 } 73 73 74 QStringList UIGuestOSTypeManager::get VariantListForFamilyId(const QString &strFamilyId) const75 { 76 QStringList variantList;74 QStringList UIGuestOSTypeManager::getSubtypeListForFamilyId(const QString &strFamilyId) const 75 { 76 QStringList subtypeList; 77 77 foreach (const UIGuestOSType &type, m_guestOSTypes) 78 78 { 79 79 if (type.getFamilyId() != strFamilyId) 80 80 continue; 81 const QString &str Variant = type.getVariant();82 if (!str Variant.isEmpty() && !variantList.contains(strVariant))83 variantList << strVariant;81 const QString &strSubtype = type.getSubtype(); 82 if (!strSubtype.isEmpty() && !subtypeList.contains(strSubtype)) 83 subtypeList << strSubtype; 84 84 } 85 return variantList;85 return subtypeList; 86 86 } 87 87 … … 101 101 } 102 102 103 UIGuestOSTypeManager::UIGuestOSTypeInfo UIGuestOSTypeManager::getTypeListFor Variant(const QString &strVariant) const103 UIGuestOSTypeManager::UIGuestOSTypeInfo UIGuestOSTypeManager::getTypeListForSubtype(const QString &strSubtype) const 104 104 { 105 105 UIGuestOSTypeInfo typeInfoList; 106 if (str Variant.isEmpty())106 if (strSubtype.isEmpty()) 107 107 return typeInfoList; 108 108 109 109 foreach (const UIGuestOSType &type, m_guestOSTypes) 110 110 { 111 if (type.get Variant() != strVariant)111 if (type.getSubtype() != strSubtype) 112 112 continue; 113 113 QPair<QString, QString> info(type.getId(), type.getDescription()); … … 124 124 } 125 125 126 QString UIGuestOSTypeManager::get Variant(const QString &strTypeId) const127 { 128 return m_guestOSTypes.value(m_typeIdIndexMap.value(strTypeId, -1)).get Variant();126 QString UIGuestOSTypeManager::getSubtype(const QString &strTypeId) const 127 { 128 return m_guestOSTypes.value(m_typeIdIndexMap.value(strTypeId, -1)).getSubtype(); 129 129 } 130 130 … … 245 245 } 246 246 247 const QString &UIGuestOSType::get Variant() const248 { 249 if (m_str Variant.isEmpty() && m_comGuestOSType.isOk())250 m_str Variant= m_comGuestOSType.GetVariant();251 return m_str Variant;247 const QString &UIGuestOSType::getSubtype() const 248 { 249 if (m_strSubtype.isEmpty() && m_comGuestOSType.isOk()) 250 m_strSubtype = m_comGuestOSType.GetVariant(); 251 return m_strSubtype; 252 252 } 253 253 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.h
r101326 r101519 56 56 const QString &getFamilyDescription() const; 57 57 const QString &getId() const; 58 const QString &get Variant() const;58 const QString &getSubtype() const; 59 59 const QString &getDescription() const; 60 60 … … 81 81 mutable QString m_strFamilyDescription; 82 82 mutable QString m_strId; 83 mutable QString m_str Variant;83 mutable QString m_strSubtype; 84 84 mutable QString m_strDescription; 85 85 /** @} */ … … 90 90 91 91 /** A wrapper and manager class for Guest OS types (IGuestOSType). Logically we structure os types into families 92 * e.g. Window, Linux etc. Some families have so-called variants which for Linux corresponds to distros, while some93 * families have no variant. Under variants (and when no variantexists direcly under family) we have guest os92 * e.g. Window, Linux etc. Some families have so-called subtypes which for Linux corresponds to distros, while some 93 * families have no subtype. Under subtypes (and when no subtype exists direcly under family) we have guest os 94 94 * types, e.g. Debian12_x64 etc. */ 95 95 class SHARED_LIBRARY_STUFF UIGuestOSTypeManager … … 111 111 /** Returns a list of all families (id and description). */ 112 112 const UIGuestOSTypeFamilyInfo &getFamilies() const; 113 /** Returns the list of variants for @p strFamilyId. This may be an empty list. */114 QStringList get VariantListForFamilyId(const QString &strFamilyId) const;113 /** Returns the list of subtypes for @p strFamilyId. This may be an empty list. */ 114 QStringList getSubtypeListForFamilyId(const QString &strFamilyId) const; 115 115 /** Returns a list of OS types for the @p strFamilyId. */ 116 116 UIGuestOSTypeInfo getTypeListForFamilyId(const QString &strFamilyId) const; 117 /** Returns a list of OS types for the @p str Variant. */118 UIGuestOSTypeInfo getTypeListFor Variant(const QString &strVariant) const;117 /** Returns a list of OS types for the @p strSubtype. */ 118 UIGuestOSTypeInfo getTypeListForSubtype(const QString &strSubtype) const; 119 119 120 120 static bool isDOSType(const QString &strOSTypeId); … … 123 123 * @{ */ 124 124 QString getFamilyId(const QString &strTypeId) const; 125 QString get Variant(const QString &strTypeId) const;125 QString getSubtype(const QString &strTypeId) const; 126 126 KGraphicsControllerType getRecommendedGraphicsController(const QString &strTypeId) const; 127 127 ULONG getRecommendedRAM(const QString &strTypeId) const; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp
r101510 r101519 71 71 , m_pLabelType(0) 72 72 , m_pIconType(0) 73 , m_pLabel Variant(0)73 , m_pLabelSubtype(0) 74 74 , m_pEditorName(0) 75 75 , m_pSelectorPath(0) … … 78 78 , m_pComboFamily(0) 79 79 , m_pComboType(0) 80 , m_pCombo Variant(0)80 , m_pComboSubtype(0) 81 81 { 82 82 prepare(); … … 175 175 if (iFamilyComboIndex == -1) 176 176 return false; 177 /* Set the family combo's index. This will cause variantcombo to be populated accordingly: */177 /* Set the family combo's index. This will cause subtype combo to be populated accordingly: */ 178 178 m_pComboFamily->setCurrentIndex(iFamilyComboIndex); 179 179 180 /* If variantis not empty then try to select correct index. This will populate type combo: */181 QString str Variant = uiCommon().guestOSTypeManager().getVariant(strTypeId);182 if (!str Variant.isEmpty())180 /* If subtype is not empty then try to select correct index. This will populate type combo: */ 181 QString strSubtype = uiCommon().guestOSTypeManager().getSubtype(strTypeId); 182 if (!strSubtype.isEmpty()) 183 183 { 184 184 int index = -1; 185 for (int i = 0; i < m_pCombo Variant->count() && index == -1; ++i)186 { 187 if (str Variant == m_pComboVariant->itemText(i))185 for (int i = 0; i < m_pComboSubtype->count() && index == -1; ++i) 186 { 187 if (strSubtype == m_pComboSubtype->itemText(i)) 188 188 index = i; 189 189 } 190 190 if (index != -1) 191 m_pCombo Variant->setCurrentIndex(index);191 m_pComboSubtype->setCurrentIndex(index); 192 192 else 193 193 return false; … … 285 285 if (m_pLabelType) 286 286 m_pLabelType->setText(tr("&Version:")); 287 if (m_pLabel Variant)288 m_pLabel Variant->setText(tr("&Kind:"));287 if (m_pLabelSubtype) 288 m_pLabelSubtype->setText(tr("&Subtype:")); 289 289 290 290 if (m_pEditorName) … … 307 307 { 308 308 AssertReturnVoid(m_pComboFamily); 309 AssertReturnVoid(m_pCombo Variant);309 AssertReturnVoid(m_pComboSubtype); 310 310 311 311 m_strFamilyId = m_pComboFamily->itemData(index, FamilyID).toString(); … … 313 313 AssertReturnVoid(!m_strFamilyId.isEmpty()); 314 314 315 m_pCombo Variant->blockSignals(true);316 m_pLabel Variant->setEnabled(true);317 318 m_pCombo Variant->setEnabled(true);319 m_pCombo Variant->clear();320 321 const QStringList variantList = uiCommon().guestOSTypeManager().getVariantListForFamilyId(m_strFamilyId);322 323 if ( variantList.isEmpty())324 { 325 m_pCombo Variant->setEnabled(false);326 m_pLabel Variant->setEnabled(false);327 /* If variantlist is empty the all the types of the family are added to typ selection combo: */315 m_pComboSubtype->blockSignals(true); 316 m_pLabelSubtype->setEnabled(true); 317 318 m_pComboSubtype->setEnabled(true); 319 m_pComboSubtype->clear(); 320 321 const QStringList subtypeList = uiCommon().guestOSTypeManager().getSubtypeListForFamilyId(m_strFamilyId); 322 323 if (subtypeList.isEmpty()) 324 { 325 m_pComboSubtype->setEnabled(false); 326 m_pLabelSubtype->setEnabled(false); 327 /* If subtype list is empty the all the types of the family are added to typ selection combo: */ 328 328 populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForFamilyId(m_strFamilyId)); 329 329 } 330 330 else 331 331 { 332 /* Populate variantcombo: */333 /* If family is Linux then select Oracle Linux as variant: */332 /* Populate subtype combo: */ 333 /* If family is Linux then select Oracle Linux as subtype: */ 334 334 int iOracleIndex = -1; 335 foreach (const QString &str Variant, variantList)336 { 337 m_pCombo Variant->addItem(strVariant);338 if (str Variant.contains(QRegularExpression("Oracle.*Linux")))339 iOracleIndex = m_pCombo Variant->count() - 1;335 foreach (const QString &strSubtype, subtypeList) 336 { 337 m_pComboSubtype->addItem(strSubtype); 338 if (strSubtype.contains(QRegularExpression("Oracle.*Linux"))) 339 iOracleIndex = m_pComboSubtype->count() - 1; 340 340 } 341 341 if (iOracleIndex != -1) 342 m_pCombo Variant->setCurrentIndex(iOracleIndex);343 344 populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListFor Variant(m_pComboVariant->currentText()));345 } 346 m_pCombo Variant->blockSignals(false);342 m_pComboSubtype->setCurrentIndex(iOracleIndex); 343 344 populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(m_pComboSubtype->currentText())); 345 } 346 m_pComboSubtype->blockSignals(false); 347 347 348 348 /* Notify listeners about this change: */ … … 350 350 } 351 351 352 void UINameAndSystemEditor::slt VariantChanged(const QString &strVariant)353 { 354 m_str Variant = strVariant;355 populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListFor Variant(strVariant));352 void UINameAndSystemEditor::sltSubtypeChanged(const QString &strSubtype) 353 { 354 m_strSubtype = strSubtype; 355 populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(strSubtype)); 356 356 } 357 357 … … 386 386 } 387 387 /* Or select Oracle Linux item for Linux family as default: */ 388 if (m_str Variant== "Oracle")388 if (m_strSubtype == "Oracle") 389 389 { 390 390 QString strDefaultID = GUEST_OS_ID_STR_X64("Oracle"); … … 565 565 ++iRow; 566 566 567 /* Prepare VM OS variantlabel: */568 m_pLabel Variant= new QLabel(this);569 if (m_pLabel Variant)570 { 571 m_pLabel Variant->setAlignment(Qt::AlignRight);572 m_pLabel Variant->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);573 574 m_pLayout->addWidget(m_pLabel Variant, iRow, 0);575 } 576 /* Prepare VM OS variantcombo: */577 m_pCombo Variant= new QComboBox(this);578 if (m_pCombo Variant)579 { 580 m_pLabel Variant->setBuddy(m_pComboVariant);581 m_pLayout->addWidget(m_pCombo Variant, iRow, 1);567 /* Prepare VM OS subtype label: */ 568 m_pLabelSubtype = new QLabel(this); 569 if (m_pLabelSubtype) 570 { 571 m_pLabelSubtype->setAlignment(Qt::AlignRight); 572 m_pLabelSubtype->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 573 574 m_pLayout->addWidget(m_pLabelSubtype, iRow, 0); 575 } 576 /* Prepare VM OS subtype combo: */ 577 m_pComboSubtype = new QComboBox(this); 578 if (m_pComboSubtype) 579 { 580 m_pLabelSubtype->setBuddy(m_pComboSubtype); 581 m_pLayout->addWidget(m_pComboSubtype, iRow, 1); 582 582 } 583 583 ++iRow; … … 669 669 connect(m_pComboFamily, &QComboBox::currentIndexChanged, 670 670 this, &UINameAndSystemEditor::sltFamilyChanged); 671 if (m_pCombo Variant)672 connect(m_pCombo Variant, &QComboBox::currentTextChanged,673 this, &UINameAndSystemEditor::slt VariantChanged);671 if (m_pComboSubtype) 672 connect(m_pComboSubtype, &QComboBox::currentTextChanged, 673 this, &UINameAndSystemEditor::sltSubtypeChanged); 674 674 if (m_pComboType) 675 675 connect(m_pComboType, &QComboBox::currentIndexChanged, -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h
r101294 r101519 143 143 144 144 void sltFamilyChanged(int index); 145 void slt VariantChanged(const QString &strVariant);145 void sltSubtypeChanged(const QString &strSubtype); 146 146 147 147 /** Handles VM OS type @a iIndex change. */ … … 189 189 /** Holds the VM OS family ID. */ 190 190 QString m_strFamilyId; 191 QString m_str Variant;191 QString m_strSubtype; 192 192 193 193 /** Holds the currently chosen OS type IDs on per-family basis. */ … … 214 214 /** Holds the VM OS type icon instance. */ 215 215 QLabel *m_pIconType; 216 /** Holds the VM OS variantlabel instance. */217 QLabel *m_pLabel Variant;216 /** Holds the VM OS subtype label instance. */ 217 QLabel *m_pLabelSubtype; 218 218 219 219 /** Holds the VM name editor instance. */ … … 229 229 /** Holds the VM OS type combo instance. */ 230 230 QComboBox *m_pComboType; 231 /** Holds the VM OS type variantinstance. */232 QComboBox *m_pCombo Variant;231 /** Holds the VM OS type subtype instance. */ 232 QComboBox *m_pComboSubtype; 233 233 234 234 /** @} */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIGuestOSTypeSelectionButton.cpp
r101316 r101519 119 119 const QPair<QString, QString> &familyInfo = familyList[i]; 120 120 QMenu *pSubMenu = m_pMainMenu->addMenu(familyInfo.second); 121 QStringList variantList = uiCommon().guestOSTypeManager().getVariantListForFamilyId(familyInfo.first);121 QStringList subtypeList = uiCommon().guestOSTypeManager().getSubtypeListForFamilyId(familyInfo.first); 122 122 123 if ( variantList.isEmpty())123 if (subtypeList.isEmpty()) 124 124 createOSTypeMenu(uiCommon().guestOSTypeManager().getTypeListForFamilyId(familyInfo.first), pSubMenu); 125 125 else 126 126 { 127 foreach (const QString &str Variant, variantList)128 createOSTypeMenu(uiCommon().guestOSTypeManager().getTypeListFor Variant(strVariant), pSubMenu->addMenu(strVariant));127 foreach (const QString &strSubtype, subtypeList) 128 createOSTypeMenu(uiCommon().guestOSTypeManager().getTypeListForSubtype(strSubtype), pSubMenu->addMenu(strSubtype)); 129 129 } 130 130 }
Note:
See TracChangeset
for help on using the changeset viewer.

