- Timestamp:
- Sep 21, 2023 6:38:06 AM (15 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r101183 r101209 3017 3017 { 3018 3018 const CGuestOSType os = guestOSTypes.at(i); 3019 //printf("%s -- %s -- %s\n", qPrintable(os.GetId()), qPrintable(os.GetVariant()), qPrintable(os.GetDescription()));3019 printf("%s -- %s -- %s\n", qPrintable(os.GetFamilyId()), qPrintable(os.GetVariant()), qPrintable(os.GetDescription())); 3020 3020 const QString strFamilyID = os.GetFamilyId(); 3021 3021 const QString strFamilyDescription = os.GetFamilyDescription(); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r101183 r101209 529 529 /** @} */ 530 530 531 const UIGuestOSTypeManager *guestOSTypeManager() const { return m_pGuestOSTypeManager; } 532 531 533 public slots: 532 534 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSTypeII.cpp
r101183 r101209 33 33 { 34 34 m_guestOSTypes.clear(); 35 m_guestOSFamil yIds.clear();36 m_guestOSTypesPerFamily.clear();35 m_guestOSFamilies.clear(); 36 //m_guestOSTypesPerFamily.clear(); 37 37 QList<CGuestOSType> otherOSTypes; 38 38 foreach (const CGuestOSType &comType, guestOSTypes) … … 48 48 foreach (const CGuestOSType &comType, otherOSTypes) 49 49 addGuestOSType(comType); 50 51 for (int i = 0; i < m_guestOSTypes.size(); ++i)52 {53 QList<int> &indexList = m_guestOSTypesPerFamily[m_guestOSTypes[i].getFamilyId()];54 indexList << i;55 }56 57 // foreach (const QString &strFamilyId, m_guestOSFamilyIds)58 // {59 // printf(" ----family---%s\n", qPrintable(strFamilyId));60 // const QList<int> &indices = m_guestOSTypesPerFamily[strFamilyId];61 // if (!m_guestOSTypesPerFamily.contains(strFamilyId))62 // {63 // printf("\t-----empty\n");64 // continue;65 // }66 // for (int i = 0; i < indices.size(); ++i)67 // {68 // if (indices[i] >= 0 && indices[i] < m_guestOSTypes.size())69 // {70 // //printf("\t%s %s\n", qPrintable(m_guestOSTypes[indices[i]].getDescription()), qPrintable(m_guestOSTypes[indices[i]].getVariant()));71 // }72 // }73 // }74 50 } 75 51 … … 77 53 { 78 54 m_guestOSTypes << UIGuestOSTypeII(comType); 79 const QString &strFamilyId = m_guestOSTypes.last().getFamilyId();80 if (!m_guestOSFamil yIds.contains(strFamilyId))81 m_guestOSFamil yIds << strFamilyId;55 QPair<QString, QString> family = QPair<QString, QString>(m_guestOSTypes.last().getFamilyId(), m_guestOSTypes.last().getFamilyDescription()); 56 if (!m_guestOSFamilies.contains(family)) 57 m_guestOSFamilies << family; 82 58 } 59 60 const UIGuestOSTypeManager::UIGuestOSTypeFamilyInfo &UIGuestOSTypeManager::getFamilies() const 61 { 62 return m_guestOSFamilies; 63 } 64 65 QStringList UIGuestOSTypeManager::getVariantListForFamilyId(const QString &strFamilyId) const 66 { 67 QStringList variantList; 68 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 69 { 70 if (type.getFamilyId() != strFamilyId) 71 continue; 72 const QString &strVariant = type.getVariant(); 73 if (!strVariant.isEmpty() && !variantList.contains(strVariant)) 74 variantList << strVariant; 75 } 76 return variantList; 77 } 78 79 UIGuestOSTypeManager::UIGuestOSTypeInfo UIGuestOSTypeManager::getTypeListForFamilyId(const QString &strFamilyId) const 80 { 81 UIGuestOSTypeInfo typeInfoList; 82 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 83 { 84 if (type.getFamilyId() != strFamilyId) 85 continue; 86 QPair<QString, QString> info(type.getId(), type.getDescription()); 87 88 if (!typeInfoList.contains(info)) 89 typeInfoList << info; 90 } 91 return typeInfoList; 92 } 93 94 UIGuestOSTypeManager::UIGuestOSTypeInfo UIGuestOSTypeManager::getTypeListForVariant(const QString &strVariant) const 95 { 96 UIGuestOSTypeInfo typeInfoList; 97 if (strVariant.isEmpty()) 98 return typeInfoList; 99 100 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 101 { 102 if (type.getVariant() != strVariant) 103 continue; 104 QPair<QString, QString> info(type.getId(), type.getDescription()); 105 if (!typeInfoList.contains(info)) 106 typeInfoList << info; 107 } 108 return typeInfoList; 109 } 110 83 111 84 112 UIGuestOSTypeII::UIGuestOSTypeII(const CGuestOSType &comGuestOSType) … … 87 115 } 88 116 89 const QString &UIGuestOSTypeII::getFamilyId() 117 const QString &UIGuestOSTypeII::getFamilyId() const 90 118 { 91 119 if (m_strFamilyId.isEmpty() && m_comGuestOSType.isOk()) … … 94 122 } 95 123 96 const QString &UIGuestOSTypeII::getFamilyDescription() 124 const QString &UIGuestOSTypeII::getFamilyDescription() const 97 125 { 98 126 if (m_strFamilyDescription.isEmpty() && m_comGuestOSType.isOk()) … … 101 129 } 102 130 103 const QString &UIGuestOSTypeII::getId() 131 const QString &UIGuestOSTypeII::getId() const 104 132 { 105 133 if (m_strId.isEmpty() && m_comGuestOSType.isOk()) … … 108 136 } 109 137 110 const QString &UIGuestOSTypeII::getVariant() 138 const QString &UIGuestOSTypeII::getVariant() const 111 139 { 112 140 if (m_strVariant.isEmpty() && m_comGuestOSType.isOk()) … … 115 143 } 116 144 117 const QString &UIGuestOSTypeII::getDescription() 145 const QString &UIGuestOSTypeII::getDescription() const 118 146 { 119 147 if (m_strDescription.isEmpty() && m_comGuestOSType.isOk()) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSTypeII.h
r101183 r101209 41 41 #include "CGuestOSType.h" 42 42 43 class UIGuestOSTypeII; 43 44 44 class UIGuestOSTypeII; 45 45 46 46 47 class UIGuestOSTypeManager … … 49 50 public: 50 51 52 typedef QList<QPair<QString, QString> > UIGuestOSTypeFamilyInfo; 53 typedef QList<QPair<QString, QString> > UIGuestOSTypeInfo; 54 51 55 void reCacheGuestOSTypes(const CGuestOSTypeVector &guestOSTypes); 56 57 const UIGuestOSTypeFamilyInfo &getFamilies() const; 58 QStringList getVariantListForFamilyId(const QString &strFamilyId) const; 59 60 UIGuestOSTypeInfo getTypeListForFamilyId(const QString &strFamilyId) const; 61 UIGuestOSTypeInfo getTypeListForVariant(const QString &strVariant) const; 52 62 53 63 private: … … 56 66 57 67 QList<UIGuestOSTypeII> m_guestOSTypes; 58 QStringList m_guestOSFamilyIds; 59 /* Key is family id (linux, windows, etc) and value is the list of indices to m_guestOSTypes. */ 60 QMap<QString, QList<int> > m_guestOSTypesPerFamily; 61 /* Key is variant (debian, ubuntu, ) and value is the list of indices to m_guestOSTypes. */ 62 QMap<QString, QList<int> > m_guestOSTypesPerVariant; 68 /* First item of the pair is family id and the 2nd is family description. */ 69 UIGuestOSTypeInfo m_guestOSFamilies; 70 63 71 }; 64 72 … … 71 79 UIGuestOSTypeII(const CGuestOSType &comGuestOSType); 72 80 73 const QString &getFamilyId() ;74 const QString &getFamilyDescription() ;75 const QString &getId() ;76 const QString &getVariant() ;77 const QString &getDescription() ;81 const QString &getFamilyId() const; 82 const QString &getFamilyDescription() const; 83 const QString &getId() const; 84 const QString &getVariant() const; 85 const QString &getDescription() const; 78 86 79 87 … … 82 90 /** @name CGuestOSType properties. Cached here for a faster access. 83 91 * @{ */ 84 QString m_strFamilyId;85 QString m_strFamilyDescription;86 QString m_strId;87 QString m_strVariant;88 QString m_strDescription;92 mutable QString m_strFamilyId; 93 mutable QString m_strFamilyDescription; 94 mutable QString m_strId; 95 mutable QString m_strVariant; 96 mutable QString m_strDescription; 89 97 /** @} */ 90 98 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp
r101011 r101209 35 35 #include "QILineEdit.h" 36 36 #include "UICommon.h" 37 #include "UIGuestOSTypeII.h" 37 38 #include "UIIconPool.h" 38 39 #include "UIFilePathSelector.h" … … 70 71 , m_pLabelType(0) 71 72 , m_pIconType(0) 73 , m_pLabelVariant(0) 72 74 , m_pEditorName(0) 73 75 , m_pSelectorPath(0) … … 76 78 , m_pComboFamily(0) 77 79 , m_pComboType(0) 80 , m_pComboVariant(0) 78 81 { 79 82 prepare(); … … 159 162 void UINameAndSystemEditor::setTypeId(QString strTypeId, QString strFamilyId /* = QString() */) 160 163 { 161 if (!m_pComboType) 162 return; 163 AssertMsgReturnVoid(!strTypeId.isNull(), ("Null guest OS type ID")); 164 165 /* Initialize indexes: */ 166 int iTypeIndex = -1; 167 int iFamilyIndex = -1; 168 169 /* If family ID isn't empty: */ 170 if (!strFamilyId.isEmpty()) 171 { 172 /* Search for corresponding family ID index: */ 173 iFamilyIndex = m_pComboFamily->findData(strFamilyId, TypeID); 174 175 /* If that family ID isn't present, we have to add it: */ 176 if (iFamilyIndex == -1) 177 { 178 /* Append family ID to corresponding combo: */ 179 m_pComboFamily->addItem(strFamilyId); 180 m_pComboFamily->setItemData(m_pComboFamily->count() - 1, strFamilyId, TypeID); 181 /* Append family ID to type cache: */ 182 m_types[strFamilyId] = QList<UIGuestOSType>(); 183 184 /* Search for corresponding family ID index finally: */ 185 iFamilyIndex = m_pComboFamily->findData(strFamilyId, TypeID); 186 } 187 } 188 /* If family ID is empty: */ 189 else 190 { 191 /* We'll try to find it by type ID: */ 192 foreach (const QString &strKnownFamilyId, m_types.keys()) 193 { 194 foreach (const UIGuestOSType &guiType, m_types.value(strKnownFamilyId)) 195 { 196 if (guiType.typeId == strTypeId) 197 strFamilyId = strKnownFamilyId; 198 if (!strFamilyId.isNull()) 199 break; 200 } 201 if (!strFamilyId.isNull()) 202 break; 203 } 204 205 /* If we were unable to find it => use "Other": */ 206 if (strFamilyId.isNull()) 207 strFamilyId = "Other"; 208 209 /* Search for corresponding family ID index finally: */ 210 iFamilyIndex = m_pComboFamily->findData(strFamilyId, TypeID); 211 } 212 213 /* To that moment family ID index should be always found: */ 214 AssertReturnVoid(iFamilyIndex != -1); 215 /* So we choose it: */ 216 m_pComboFamily->setCurrentIndex(iFamilyIndex); 217 sltFamilyChanged(m_pComboFamily->currentIndex()); 218 219 /* Search for corresponding type ID index: */ 220 iTypeIndex = m_pComboType->findData(strTypeId, TypeID); 221 222 /* If that type ID isn't present, we have to add it: */ 223 if (iTypeIndex == -1) 224 { 225 /* Append type ID to type cache: */ 226 UIGuestOSType guiType; 227 guiType.typeId = strTypeId; 228 guiType.typeDescription = strTypeId; 229 guiType.is64bit = false; 230 m_types[strFamilyId] << guiType; 231 232 /* So we re-choose family again: */ 233 m_pComboFamily->setCurrentIndex(iFamilyIndex); 234 sltFamilyChanged(m_pComboFamily->currentIndex()); 235 236 /* Search for corresponding type ID index finally: */ 237 iTypeIndex = m_pComboType->findData(strTypeId, TypeID); 238 } 239 240 /* To that moment type ID index should be always found: */ 241 AssertReturnVoid(iTypeIndex != -1); 242 /* So we choose it: */ 243 m_pComboType->setCurrentIndex(iTypeIndex); 244 sltTypeChanged(m_pComboType->currentIndex()); 164 Q_UNUSED(strTypeId); 165 Q_UNUSED(strFamilyId); 166 // if (!m_pComboType) 167 // return; 168 // AssertMsgReturnVoid(!strTypeId.isNull(), ("Null guest OS type ID")); 169 170 // /* Initialize indexes: */ 171 // int iTypeIndex = -1; 172 // int iFamilyIndex = -1; 173 174 // /* If family ID isn't empty: */ 175 // if (!strFamilyId.isEmpty()) 176 // { 177 // /* Search for corresponding family ID index: */ 178 // iFamilyIndex = m_pComboFamily->findData(strFamilyId, TypeID); 179 180 // /* If that family ID isn't present, we have to add it: */ 181 // if (iFamilyIndex == -1) 182 // { 183 // /* Append family ID to corresponding combo: */ 184 // m_pComboFamily->addItem(strFamilyId); 185 // m_pComboFamily->setItemData(m_pComboFamily->count() - 1, strFamilyId, TypeID); 186 // /* Append family ID to type cache: */ 187 // m_types[strFamilyId] = QList<UIGuestOSType>(); 188 189 // /* Search for corresponding family ID index finally: */ 190 // iFamilyIndex = m_pComboFamily->findData(strFamilyId, TypeID); 191 // } 192 // } 193 // /* If family ID is empty: */ 194 // else 195 // { 196 // /* We'll try to find it by type ID: */ 197 // foreach (const QString &strKnownFamilyId, m_types.keys()) 198 // { 199 // foreach (const UIGuestOSType &guiType, m_types.value(strKnownFamilyId)) 200 // { 201 // if (guiType.typeId == strTypeId) 202 // strFamilyId = strKnownFamilyId; 203 // if (!strFamilyId.isNull()) 204 // break; 205 // } 206 // if (!strFamilyId.isNull()) 207 // break; 208 // } 209 210 // /* If we were unable to find it => use "Other": */ 211 // if (strFamilyId.isNull()) 212 // strFamilyId = "Other"; 213 214 // /* Search for corresponding family ID index finally: */ 215 // iFamilyIndex = m_pComboFamily->findData(strFamilyId, TypeID); 216 // } 217 218 // /* To that moment family ID index should be always found: */ 219 // AssertReturnVoid(iFamilyIndex != -1); 220 // /* So we choose it: */ 221 // m_pComboFamily->setCurrentIndex(iFamilyIndex); 222 // sltFamilyChanged(m_pComboFamily->currentIndex()); 223 224 // /* Search for corresponding type ID index: */ 225 // iTypeIndex = m_pComboType->findData(strTypeId, TypeID); 226 227 // /* If that type ID isn't present, we have to add it: */ 228 // if (iTypeIndex == -1) 229 // { 230 // /* Append type ID to type cache: */ 231 // UIGuestOSType guiType; 232 // guiType.typeId = strTypeId; 233 // guiType.typeDescription = strTypeId; 234 // guiType.is64bit = false; 235 // m_types[strFamilyId] << guiType; 236 237 // /* So we re-choose family again: */ 238 // m_pComboFamily->setCurrentIndex(iFamilyIndex); 239 // sltFamilyChanged(m_pComboFamily->currentIndex()); 240 241 // /* Search for corresponding type ID index finally: */ 242 // iTypeIndex = m_pComboType->findData(strTypeId, TypeID); 243 // } 244 245 // /* To that moment type ID index should be always found: */ 246 // AssertReturnVoid(iTypeIndex != -1); 247 // /* So we choose it: */ 248 // m_pComboType->setCurrentIndex(iTypeIndex); 249 // sltTypeChanged(m_pComboType->currentIndex()); 245 250 } 246 251 … … 344 349 if (m_pLabelType) 345 350 m_pLabelType->setText(tr("&Version:")); 351 if (m_pLabelVariant) 352 m_pLabelVariant->setText(tr("Variant:")); 346 353 347 354 if (m_pEditorName) … … 361 368 } 362 369 363 void UINameAndSystemEditor::sltFamilyChanged(int iIndex) 364 { 365 AssertPtrReturnVoid(m_pComboFamily); 366 367 /* Lock the signals of m_pComboType to prevent it's reaction on clearing: */ 370 void UINameAndSystemEditor::sltFamilyChanged(int index) 371 { 372 AssertReturnVoid(m_pComboFamily); 373 AssertReturnVoid(m_pComboVariant); 374 const UIGuestOSTypeManager * const pGuestOSTypeManager = uiCommon().guestOSTypeManager(); 375 AssertReturnVoid(pGuestOSTypeManager); 376 377 QString strFamilyId = m_pComboFamily->itemData(index).toString(); 378 379 AssertReturnVoid(!strFamilyId.isEmpty()); 380 381 m_pComboVariant->blockSignals(true); 382 m_pLabelVariant->setEnabled(true); 383 384 m_pComboVariant->setEnabled(true); 385 m_pComboVariant->clear(); 386 387 const QStringList variantList = pGuestOSTypeManager->getVariantListForFamilyId(strFamilyId); 388 389 if (variantList.isEmpty()) 390 { 391 m_pComboVariant->setEnabled(false); 392 m_pLabelVariant->setEnabled(false); 393 /* If variant list is empty the all the types of the family are added to typ selection combo: */ 394 populateTypeCombo(pGuestOSTypeManager->getTypeListForFamilyId(strFamilyId)); 395 } 396 else 397 { 398 foreach (const QString &strVariant, variantList) 399 { 400 m_pComboVariant->addItem(strVariant); 401 } 402 populateTypeCombo(pGuestOSTypeManager->getTypeListForVariant(m_pComboVariant->currentText())); 403 } 404 m_pComboVariant->blockSignals(false); 405 // AssertPtrReturnVoid(m_pComboFamily); 406 407 // /* Lock the signals of m_pComboType to prevent it's reaction on clearing: */ 408 // m_pComboType->blockSignals(true); 409 // m_pComboType->clear(); 410 411 // /* Acquire family ID: */ 412 // m_strFamilyId = m_pComboFamily->itemData(iIndex, TypeID).toString(); 413 414 // /* Populate combo-box with OS types related to currently selected family id: */ 415 // foreach (const UIGuestOSType &guiType, m_types.value(m_strFamilyId)) 416 // { 417 // const int idxItem = m_pComboType->count(); 418 // m_pComboType->insertItem(idxItem, guiType.typeDescription); 419 // m_pComboType->setItemData(idxItem, guiType.typeId, TypeID); 420 // } 421 422 // /* Select the most recently chosen item: */ 423 // if (m_currentIds.contains(m_strFamilyId)) 424 // { 425 // const QString strTypeId = m_currentIds.value(m_strFamilyId); 426 // const int iTypeIndex = m_pComboType->findData(strTypeId, TypeID); 427 // if (iTypeIndex != -1) 428 // m_pComboType->setCurrentIndex(iTypeIndex); 429 // } 430 // /* Or select Windows 10 item for Windows family as default: */ 431 // else if (m_strFamilyId == "Windows") 432 // { 433 // QString strDefaultID = "Windows11_64"; 434 // const int iIndexWin = m_pComboType->findData(strDefaultID, TypeID); 435 // if (iIndexWin != -1) 436 // m_pComboType->setCurrentIndex(iIndexWin); 437 // } 438 // /* Or select Oracle Linux item for Linux family as default: */ 439 // else if (m_strFamilyId == "Linux") 440 // { 441 // QString strDefaultID = "Oracle_64"; 442 // const int iIndexOracle = m_pComboType->findData(strDefaultID, TypeID); 443 // if (iIndexOracle != -1) 444 // m_pComboType->setCurrentIndex(iIndexOracle); 445 // } 446 // else if (m_strFamilyId == "Other") 447 // { 448 // QString strDefaultID = "Other_64"; 449 // const int iIndexOther = m_pComboType->findData(strDefaultID, TypeID); 450 // if (iIndexOther != -1) 451 // m_pComboType->setCurrentIndex(iIndexOther); 452 // } 453 // /* Else try to pick the first 64-bit one if it exists.: */ 454 // else 455 // { 456 // QString strDefaultID = "_64"; 457 // const int iIndexAll = m_pComboType->findData(strDefaultID, TypeID, Qt::MatchContains); 458 // if (iIndexAll != -1) 459 // m_pComboType->setCurrentIndex(iIndexAll); 460 // else 461 // m_pComboType->setCurrentIndex(0); 462 // } 463 464 // /* Update all the stuff: */ 465 // sltTypeChanged(m_pComboType->currentIndex()); 466 467 // /* Unlock the signals of m_pComboType: */ 468 // m_pComboType->blockSignals(false); 469 470 // /* Notify listeners about this change: */ 471 // emit sigOSFamilyChanged(m_strFamilyId); 472 } 473 474 void UINameAndSystemEditor::sltVariantChanged(const QString &strVariant) 475 { 476 const UIGuestOSTypeManager * const pGuestOSTypeManager = uiCommon().guestOSTypeManager(); 477 AssertReturnVoid(pGuestOSTypeManager); 478 479 populateTypeCombo(pGuestOSTypeManager->getTypeListForVariant(strVariant)); 480 } 481 482 void UINameAndSystemEditor::populateTypeCombo(const UIGuestOSTypeManager::UIGuestOSTypeInfo &typeList) 483 { 484 AssertReturnVoid(m_pComboType); 485 AssertReturnVoid(!typeList.isEmpty()); 486 368 487 m_pComboType->blockSignals(true); 369 488 m_pComboType->clear(); 370 371 /* Acquire family ID: */ 372 m_strFamilyId = m_pComboFamily->itemData(iIndex, TypeID).toString(); 373 374 /* Populate combo-box with OS types related to currently selected family id: */ 375 foreach (const UIGuestOSType &guiType, m_types.value(m_strFamilyId)) 489 for (int i = 0; i < typeList.size(); ++i) 376 490 { 377 const int idxItem = m_pComboType->count(); 378 m_pComboType->insertItem(idxItem, guiType.typeDescription); 379 m_pComboType->setItemData(idxItem, guiType.typeId, TypeID); 491 m_pComboType->addItem(typeList[i].second); 492 m_pComboType->setItemData(i, typeList[i].first, TypeID); 380 493 } 381 382 /* Select the most recently chosen item: */ 383 if (m_currentIds.contains(m_strFamilyId)) 384 { 385 const QString strTypeId = m_currentIds.value(m_strFamilyId); 386 const int iTypeIndex = m_pComboType->findData(strTypeId, TypeID); 387 if (iTypeIndex != -1) 388 m_pComboType->setCurrentIndex(iTypeIndex); 389 } 390 /* Or select Windows 10 item for Windows family as default: */ 391 else if (m_strFamilyId == "Windows") 392 { 393 QString strDefaultID = "Windows11_64"; 394 const int iIndexWin = m_pComboType->findData(strDefaultID, TypeID); 395 if (iIndexWin != -1) 396 m_pComboType->setCurrentIndex(iIndexWin); 397 } 398 /* Or select Oracle Linux item for Linux family as default: */ 399 else if (m_strFamilyId == "Linux") 400 { 401 QString strDefaultID = "Oracle_64"; 402 const int iIndexOracle = m_pComboType->findData(strDefaultID, TypeID); 403 if (iIndexOracle != -1) 404 m_pComboType->setCurrentIndex(iIndexOracle); 405 } 406 else if (m_strFamilyId == "Other") 407 { 408 QString strDefaultID = "Other_64"; 409 const int iIndexOther = m_pComboType->findData(strDefaultID, TypeID); 410 if (iIndexOther != -1) 411 m_pComboType->setCurrentIndex(iIndexOther); 412 } 413 /* Else try to pick the first 64-bit one if it exists.: */ 414 else 415 { 416 QString strDefaultID = "_64"; 417 const int iIndexAll = m_pComboType->findData(strDefaultID, TypeID, Qt::MatchContains); 418 if (iIndexAll != -1) 419 m_pComboType->setCurrentIndex(iIndexAll); 420 else 421 m_pComboType->setCurrentIndex(0); 422 } 423 424 /* Update all the stuff: */ 494 m_pComboType->blockSignals(false); 425 495 sltTypeChanged(m_pComboType->currentIndex()); 426 427 /* Unlock the signals of m_pComboType: */428 m_pComboType->blockSignals(false);429 430 /* Notify listeners about this change: */431 emit sigOSFamilyChanged(m_strFamilyId);432 496 } 433 497 … … 588 652 } 589 653 654 ++iRow; 655 m_pLabelVariant = new QLabel(this); 656 if (m_pLabelVariant) 657 { 658 m_pLabelVariant->setAlignment(Qt::AlignRight); 659 m_pLabelVariant->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 660 661 m_pLayout->addWidget(m_pLabelVariant, iRow, 0); 662 } 663 m_pComboVariant = new QComboBox(this); 664 if (m_pComboVariant) 665 { 666 m_pLabelFamily->setBuddy(m_pComboVariant); 667 m_pLayout->addWidget(m_pComboVariant, iRow, 1); 668 } 669 590 670 const int iIconRow = iRow; 591 671 ++iRow; … … 626 706 627 707 /* Add into layout: */ 628 m_pLayout->addLayout(pLayoutIcon, iIconRow, 2, 2, 1);708 m_pLayout->addLayout(pLayoutIcon, iIconRow, 2, 3, 1); 629 709 } 630 710 … … 650 730 AssertPtrReturnVoid(m_pComboFamily); 651 731 732 const UIGuestOSTypeManager * const pGuestOSTypeManager = uiCommon().guestOSTypeManager(); 733 AssertPtrReturnVoid(pGuestOSTypeManager); 734 652 735 /* Acquire family IDs: */ 653 m_familyIDs = uiCommon().vmGuestOSFamilyIDs();736 const UIGuestOSTypeManager::UIGuestOSTypeFamilyInfo &families = pGuestOSTypeManager->getFamilies(); 654 737 655 738 /* For each known family ID: */ 656 for (int i = 0; i < m_familyIDs.size(); ++i)739 for (int i = 0; i < families.size(); ++i) 657 740 { 658 const QString &strFamilyId = m_familyIDs.at(i); 659 660 /* Append VM OS family combo: */ 661 m_pComboFamily->insertItem(i, uiCommon().vmGuestOSFamilyDescription(strFamilyId)); 662 m_pComboFamily->setItemData(i, strFamilyId, TypeID); 741 //const QString &strFamilyId = familyIds.at(i); 742 743 m_pComboFamily->addItem(families[i].second); 744 m_pComboFamily->setItemData(i, families[i].first); 663 745 664 746 /* Fill in the type cache: */ 665 m_types[strFamilyId] = QList<UIGuestOSType>();666 foreach (const CGuestOSType &comType, uiCommon().vmGuestOSTypeList(strFamilyId))667 {668 UIGuestOSType guiType;669 guiType.typeId = comType.GetId();670 guiType.typeDescription = QString(comType.GetDescription()).remove(" (64-bit)", Qt::CaseInsensitive);671 guiType.is64bit = comType.GetIs64Bit();672 m_types[strFamilyId] << guiType;673 }747 // m_types[strFamilyId] = QList<UIGuestOSType>(); 748 // foreach (const CGuestOSType &comType, uiCommon().vmGuestOSTypeList(strFamilyId)) 749 // { 750 // UIGuestOSType guiType; 751 // guiType.typeId = comType.GetId(); 752 // guiType.typeDescription = QString(comType.GetDescription()).remove(" (64-bit)", Qt::CaseInsensitive); 753 // guiType.is64bit = comType.GetIs64Bit(); 754 // m_types[strFamilyId] << guiType; 755 // } 674 756 } 675 757 … … 690 772 this, &UINameAndSystemEditor::sigPathChanged); 691 773 if (m_pComboFamily) 692 connect(m_pComboFamily, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),774 connect(m_pComboFamily, &QComboBox::currentIndexChanged, 693 775 this, &UINameAndSystemEditor::sltFamilyChanged); 776 if (m_pComboVariant) 777 connect(m_pComboVariant, &QComboBox::currentTextChanged, 778 this, &UINameAndSystemEditor::sltVariantChanged); 694 779 if (m_pComboType) 695 connect(m_pComboType, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),780 connect(m_pComboType, &QComboBox::currentIndexChanged, 696 781 this, &UINameAndSystemEditor::sltTypeChanged); 697 782 if (m_pSelectorImage) -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h
r101011 r101209 155 155 private slots: 156 156 157 /** Handles VM OS family @a iIndex change. */ 158 void sltFamilyChanged(int iIndex); 157 void sltFamilyChanged(int index); 158 void sltVariantChanged(const QString &strVariant); 159 159 160 /** Handles VM OS type @a iIndex change. */ 160 161 void sltTypeChanged(int iIndex); … … 178 179 179 180 ulong selectedEditionIndex() const; 181 void populateTypeCombo(const QList<QPair<QString, QString> > &typeList); 180 182 181 183 /** @name Arguments … … 195 197 /** @name Values 196 198 * @{ */ 197 /** Holds the current family ID list. */198 QStringList m_familyIDs;199 200 199 /** Holds the current type cache. */ 201 200 QMap<QString, QList<UIGuestOSType> > m_types; … … 229 228 /** Holds the VM OS type icon instance. */ 230 229 QLabel *m_pIconType; 230 /** Holds the VM OS variant label instance. */ 231 QLabel *m_pLabelVariant; 231 232 232 233 /** Holds the VM name editor instance. */ … … 242 243 /** Holds the VM OS type combo instance. */ 243 244 QComboBox *m_pComboType; 245 /** Holds the VM OS type variant instance. */ 246 QComboBox *m_pComboVariant; 247 244 248 /** @} */ 245 249 };
Note:
See TracChangeset
for help on using the changeset viewer.