- Timestamp:
- Sep 21, 2023 4:10:07 PM (17 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSTypeII.cpp
r101209 r101226 109 109 } 110 110 111 UIGuestOSTypeII UIGuestOSTypeManager::findGuestTypeById(const QString &strTypeId) const 112 { 113 if (strTypeId.isEmpty()) 114 return UIGuestOSTypeII(); 115 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 116 { 117 if (type.getId() == strTypeId) 118 return type; 119 } 120 return UIGuestOSTypeII(); 121 } 122 123 UIGuestOSTypeII::UIGuestOSTypeII() 124 { 125 } 111 126 112 127 UIGuestOSTypeII::UIGuestOSTypeII(const CGuestOSType &comGuestOSType) 113 128 : m_comGuestOSType(comGuestOSType) 114 129 { 130 } 131 132 bool UIGuestOSTypeII::isOk() const 133 { 134 return (!m_comGuestOSType.isNull() && m_comGuestOSType.isOk()); 115 135 } 116 136 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSTypeII.h
r101209 r101226 61 61 UIGuestOSTypeInfo getTypeListForVariant(const QString &strVariant) const; 62 62 63 UIGuestOSTypeII findGuestTypeById(const QString &strTypeId) const; 64 63 65 private: 64 66 … … 74 76 class SHARED_LIBRARY_STUFF UIGuestOSTypeII 75 77 { 78 76 79 public: 77 80 78 81 79 82 UIGuestOSTypeII(const CGuestOSType &comGuestOSType); 83 UIGuestOSTypeII(); 80 84 81 85 const QString &getFamilyId() const; … … 85 89 const QString &getDescription() const; 86 90 91 bool isOk() const; 87 92 88 93 private: -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp
r101209 r101226 47 47 enum 48 48 { 49 TypeID = Qt::UserRole + 1 49 TypeID = Qt::UserRole + 1, 50 FamilyID = Qt::UserRole + 2 50 51 }; 51 52 … … 250 251 } 251 252 253 void UINameAndSystemEditor::setGuestOSTypeByTypeId(const QString &strTypeId) 254 { 255 AssertReturnVoid(m_pComboFamily); 256 257 const UIGuestOSTypeManager * const pGuestOSTypeManager = uiCommon().guestOSTypeManager(); 258 AssertReturnVoid(pGuestOSTypeManager); 259 const UIGuestOSTypeII &type = pGuestOSTypeManager->findGuestTypeById(strTypeId); 260 if (!type.isOk()) 261 return; 262 263 int iFamilyComboIndex = -1; 264 /* We already have to have an item in the family combo box for this family id: */ 265 for (int i = 0; i < m_pComboFamily->count() && iFamilyComboIndex == -1; ++i) 266 { 267 QString strComboFamilyId = m_pComboFamily->itemData(i, FamilyID).toString(); 268 if (!strComboFamilyId.isEmpty() && strComboFamilyId == type.getFamilyId()) 269 iFamilyComboIndex = i; 270 } 271 /* Bail out if family combo has no such item: */ 272 if (iFamilyComboIndex == -1) 273 return; 274 /* Set the family combo's index. This will cause variant combo to be populated accordingly: */ 275 m_pComboFamily->setCurrentIndex(iFamilyComboIndex); 276 277 /* If variant is not empty then try to select correct index. This will populate type combo: */ 278 if (!type.getVariant().isEmpty()) 279 { 280 int index = -1; 281 for (int i = 0; i < m_pComboVariant->count() && index == -1; ++i) 282 { 283 if (type.getVariant() == m_pComboVariant->itemText(i)) 284 index = i; 285 } 286 if (index != -1) 287 m_pComboVariant->setCurrentIndex(index); 288 else 289 return; 290 } 291 292 /* At this point type combo should include the type we want to select: */ 293 int iTypeIndex = -1; 294 for (int i = 0; i < m_pComboType->count() && iTypeIndex == -1; ++i) 295 { 296 if (strTypeId == m_pComboType->itemData(i, TypeID)) 297 iTypeIndex = i; 298 } 299 if (iTypeIndex != -1) 300 m_pComboType->setCurrentIndex(iTypeIndex); 301 } 302 252 303 QString UINameAndSystemEditor::typeId() const 253 304 { … … 375 426 AssertReturnVoid(pGuestOSTypeManager); 376 427 377 QString strFamilyId = m_pComboFamily->itemData(index ).toString();428 QString strFamilyId = m_pComboFamily->itemData(index, FamilyID).toString(); 378 429 379 430 AssertReturnVoid(!strFamilyId.isEmpty()); … … 742 793 743 794 m_pComboFamily->addItem(families[i].second); 744 m_pComboFamily->setItemData(i, families[i].first );795 m_pComboFamily->setItemData(i, families[i].first, FamilyID); 745 796 746 797 /* Fill in the type cache: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h
r101209 r101226 121 121 void setISOImagePath(const QString &strPath); 122 122 123 /* strTypeId should be one of the type ids defined in Global.cpp and returned by IGuestOSType::getId(). */ 124 void setGuestOSTypeByTypeId(const QString &strTypeId); 123 125 /** Defines the VM OS @a strTypeId and @a strFamilyId if passed. */ 124 126 void setTypeId(QString strTypeId, QString strFamilyId = QString()); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.cpp
r101217 r101226 189 189 { QRegularExpression("jessie.*32", QRegularExpression::CaseInsensitiveOption), "Debian8" }, 190 190 { QRegularExpression("stretch.*64", QRegularExpression::CaseInsensitiveOption), "Debian9_x64" }, 191 { QRegularExpression("debian.*9.*64", QRegularExpression::CaseInsensitiveOption), "Debian9_x64" }, 192 { QRegularExpression("debian.*9.*32", QRegularExpression::CaseInsensitiveOption), "Debian9" }, 191 193 { QRegularExpression("stretch.*32", QRegularExpression::CaseInsensitiveOption), "Debian9" }, 192 194 { QRegularExpression("buster.*64", QRegularExpression::CaseInsensitiveOption), "Debian10_x64" }, 195 { QRegularExpression("debian.*10.*64", QRegularExpression::CaseInsensitiveOption), "Debian10_x64" }, 193 196 { QRegularExpression("buster.*32", QRegularExpression::CaseInsensitiveOption), "Debian10" }, 197 { QRegularExpression("debian.*10.*32", QRegularExpression::CaseInsensitiveOption), "Debian10" }, 194 198 { QRegularExpression("bullseye.*64", QRegularExpression::CaseInsensitiveOption), "Debian11_x64" }, 199 { QRegularExpression("debian.*11.*64", QRegularExpression::CaseInsensitiveOption), "Debian11_x64" }, 195 200 { QRegularExpression("bullseye.*32", QRegularExpression::CaseInsensitiveOption), "Debian11" }, 201 { QRegularExpression("debian.*11.*32", QRegularExpression::CaseInsensitiveOption), "Debian11" }, 196 202 { QRegularExpression("bookworm.*64", QRegularExpression::CaseInsensitiveOption), "Debian12_x64" }, 203 { QRegularExpression("debian.*12.*64", QRegularExpression::CaseInsensitiveOption), "Debian12_x64" }, 204 { QRegularExpression("debian.*12", QRegularExpression::CaseInsensitiveOption), "Debian12" }, 197 205 { QRegularExpression("bookworm.*32", QRegularExpression::CaseInsensitiveOption), "Debian12" }, 198 206 { QRegularExpression("((trixie)|(sid)).*64", QRegularExpression::CaseInsensitiveOption), "Debian_x64" }, … … 280 288 if (strNewName.contains(gs_OSTypePattern[i].pattern)) 281 289 { 282 pNameAndSystemEditor->set Type(uiCommon().vmGuestOSType(gs_OSTypePattern[i].pcstId));290 pNameAndSystemEditor->setGuestOSTypeByTypeId(gs_OSTypePattern[i].pcstId); 283 291 return true; 284 292 } … … 290 298 { 291 299 AssertReturn(pNameAndSystemEditor, false); 300 292 301 if (!strDetectedOSType.isEmpty()) 293 302 {
Note:
See TracChangeset
for help on using the changeset viewer.