Changeset 101315 in vbox
- Timestamp:
- Sep 29, 2023 10:39:08 AM (12 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
-
globals/UICommon.cpp (modified) (3 diffs)
-
globals/UICommon.h (modified) (3 diffs)
-
globals/UIDetailsGenerator.cpp (modified) (3 diffs)
-
globals/UIGuestOSType.cpp (modified) (5 diffs)
-
globals/UIGuestOSType.h (modified) (3 diffs)
-
runtime/UISession.cpp (modified) (4 diffs)
-
runtime/information/UIInformationRuntime.cpp (modified) (2 diffs)
-
snapshots/UISnapshotDetailsWidget.cpp (modified) (2 diffs)
-
widgets/UIApplianceEditorWidget.cpp (modified) (2 diffs)
-
wizards/newvm/UIWizardNewVMNameOSTypePage.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r101278 r101315 814 814 m_pThreadPoolCloud = 0; 815 815 816 /* Ensure CGuestOSType objects are no longer used: */817 m_guestOSFamilyIDs.clear();818 m_guestOSTypes.clear();819 820 816 /* Starting COM cleanup: */ 821 817 m_comCleanupProtectionToken.lockForWrite(); … … 1127 1123 1128 1124 #endif /* VBOX_GUI_WITH_PIDFILE */ 1129 1130 QString UICommon::vmGuestOSFamilyDescription(const QString &strFamilyId) const1131 {1132 AssertMsg(m_guestOSFamilyDescriptions.contains(strFamilyId),1133 ("Family ID incorrect: '%s'.", strFamilyId.toLatin1().constData()));1134 return m_guestOSFamilyDescriptions.value(strFamilyId);1135 }1136 1137 QList<CGuestOSType> UICommon::vmGuestOSTypeList(const QString &strFamilyId) const1138 {1139 AssertMsg(m_guestOSFamilyIDs.contains(strFamilyId),1140 ("Family ID incorrect: '%s'.", strFamilyId.toLatin1().constData()));1141 return m_guestOSFamilyIDs.contains(strFamilyId) ?1142 m_guestOSTypes[m_guestOSFamilyIDs.indexOf(strFamilyId)] : QList<CGuestOSType>();1143 }1144 1145 CGuestOSType UICommon::vmGuestOSType(const QString &strTypeId,1146 const QString &strFamilyId /* = QString() */) const1147 {1148 QList<CGuestOSType> list;1149 if (m_guestOSFamilyIDs.contains(strFamilyId))1150 {1151 list = m_guestOSTypes.at(m_guestOSFamilyIDs.indexOf(strFamilyId));1152 }1153 else1154 {1155 for (int i = 0; i < m_guestOSFamilyIDs.size(); ++i)1156 list += m_guestOSTypes.at(i);1157 }1158 for (int j = 0; j < list.size(); ++j)1159 if (!list.at(j).GetId().compare(strTypeId))1160 return list.at(j);1161 return CGuestOSType();1162 }1163 1164 QString UICommon::vmGuestOSTypeDescription(const QString &strTypeId) const1165 {1166 for (int i = 0; i < m_guestOSFamilyIDs.size(); ++i)1167 {1168 QList<CGuestOSType> list(m_guestOSTypes[i]);1169 for (int j = 0; j < list.size(); ++j)1170 if (!list.at(j).GetId().compare(strTypeId))1171 return list.at(j).GetDescription();1172 }1173 return QString();1174 }1175 1176 /* static */1177 bool UICommon::isDOSType(const QString &strOSTypeId)1178 {1179 if ( strOSTypeId.left(3) == "dos"1180 || strOSTypeId.left(3) == "win"1181 || strOSTypeId.left(3) == "os2")1182 return true;1183 1184 return false;1185 }1186 1125 1187 1126 /* static */ … … 3007 2946 m_strHomeFolder = virtualBox().GetHomeFolder(); 3008 2947 3009 /* Re-initialize guest OS Type list: */ 3010 m_guestOSFamilyIDs.clear(); 3011 m_guestOSTypes.clear(); 3012 const CGuestOSTypeVector guestOSTypes = m_comVBox.GetGuestOSTypes(); 3013 const int cGuestOSTypeCount = guestOSTypes.size(); 3014 AssertMsg(cGuestOSTypeCount > 0, ("Number of OS types must not be zero")); 3015 if (cGuestOSTypeCount > 0) 3016 { 3017 /* Here we ASSUME the 'Other' types are always the first, 3018 * so we remember them and will append them to the list when finished. 3019 * We do a two pass, first adding the specific types, then the two 'Other' types. */ 3020 for (int j = 0; j < 2; ++j) 3021 { 3022 int cMax = j == 0 ? cGuestOSTypeCount : RT_MIN(2, cGuestOSTypeCount); 3023 for (int i = j == 0 ? 2 : 0; i < cMax; ++i) 3024 { 3025 const CGuestOSType os = guestOSTypes.at(i); 3026 const QString strFamilyID = os.GetFamilyId(); 3027 const QString strFamilyDescription = os.GetFamilyDescription(); 3028 if (!m_guestOSFamilyIDs.contains(strFamilyID)) 3029 { 3030 m_guestOSFamilyIDs << strFamilyID; 3031 m_guestOSFamilyDescriptions[strFamilyID] = strFamilyDescription; 3032 m_guestOSTypes << QList<CGuestOSType>(); 3033 } 3034 m_guestOSTypes[m_guestOSFamilyIDs.indexOf(strFamilyID)].append(os); 3035 } 3036 } 3037 } 2948 /* Re-initialize guest OS Type database: */ 3038 2949 if (m_pGuestOSTypeManager) 3039 m_pGuestOSTypeManager->reCacheGuestOSTypes( guestOSTypes);2950 m_pGuestOSTypeManager->reCacheGuestOSTypes(m_comVBox.GetGuestOSTypes()); 3040 2951 /* Mark wrappers valid: */ 3041 2952 m_fWrappersValid = true; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r101265 r101315 317 317 /** @name COM: Guest OS Type stuff. 318 318 * @{ */ 319 /** Returns the list of family IDs. */ 320 QList<QString> vmGuestOSFamilyIDs() const { return m_guestOSFamilyIDs; } 321 322 /** Returns a family description with passed @a strFamilyId. */ 323 QString vmGuestOSFamilyDescription(const QString &strFamilyId) const; 324 /** Returns a list of all guest OS types with passed @a strFamilyId. */ 325 QList<CGuestOSType> vmGuestOSTypeList(const QString &strFamilyId) const; 326 327 /** Returns the guest OS type for passed @a strTypeId. 328 * It is being serached through the list of family with passed @a strFamilyId if specified. */ 329 CGuestOSType vmGuestOSType(const QString &strTypeId, const QString &strFamilyId = QString()) const; 330 /** Returns a type description with passed @a strTypeId. */ 331 QString vmGuestOSTypeDescription(const QString &strTypeId) const; 332 333 /** Returns whether guest type with passed @a strOSTypeId is one of DOS types. */ 334 static bool isDOSType(const QString &strOSTypeId); 319 const UIGuestOSTypeManager *guestOSTypeManager() const { return m_pGuestOSTypeManager; } 320 UIGuestOSTypeManager &guestOSTypeManager2() const { return *m_pGuestOSTypeManager; } 335 321 /** @} */ 336 322 … … 529 515 bool isExtentionPackInstalled() const; 530 516 /** @} */ 531 532 const UIGuestOSTypeManager *guestOSTypeManager() const { return m_pGuestOSTypeManager; }533 517 534 518 public slots: … … 749 733 bool m_fVBoxSVCAvailable; 750 734 751 /** Holds the guest OS family IDs. */752 QList<QString> m_guestOSFamilyIDs;753 /** Holds the guest OS family descriptions. */754 QMap<QString, QString> m_guestOSFamilyDescriptions;755 /** Holds the guest OS types for each family ID. */756 QList<QList<CGuestOSType> > m_guestOSTypes;757 735 UIGuestOSTypeManager *m_pGuestOSTypeManager; 758 736 /** @} */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp
r101074 r101315 37 37 #include "UIDetailsGenerator.h" 38 38 #include "UIErrorString.h" 39 #include "UIGuestOSType.h" 39 40 #include "UIMedium.h" 40 41 #include "UITranslator.h" … … 118 119 const QString strAnchorType = QString("os_type"); 119 120 const QString strOsTypeId = comMachine.GetOSTypeId(); 121 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 122 QString strOsTypeDescription; 123 if (pManager) 124 strOsTypeDescription = pManager->getDescription(strOsTypeId); 120 125 table << UITextTableLine(QApplication::translate("UIDetails", "Operating System", "details (general)"), 121 126 QString("<a href=#%1,%2>%3</a>") 122 127 .arg(strAnchorType, 123 128 strOsTypeId, 124 uiCommon().vmGuestOSTypeDescription(strOsTypeId)));129 strOsTypeDescription)); 125 130 } 126 131 … … 1409 1414 { 1410 1415 /* Select slashes depending on the OS type: */ 1411 if (UI Common::isDOSType(comGuest.GetOSTypeId()))1416 if (UIGuestOSTypeManager::isDOSType(comGuest.GetOSTypeId())) 1412 1417 strInfo += e_strTableRow2.arg(QString("<b>\\\\vboxsvr\\%1</b>").arg(it.key()), it.value()); 1413 1418 else -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.cpp
r101295 r101315 29 29 #include "UIGuestOSType.h" 30 30 31 /* COM includes: */ 32 #include "CGuestOSType.h" 31 33 32 34 /********************************************************************************************************************************* … … 60 62 LONG64 getRecommendedHDD() const; 61 63 KGraphicsControllerType getRecommendedGraphicsController() const; 64 KStorageControllerType getRecommendedDVDStorageController() const; 62 65 /** @} */ 63 66 … … 192 195 } 193 196 197 KStorageControllerType UIGuestOSTypeManager::getRecommendedDVDStorageController(const QString &strTypeId) const 198 { 199 AssertReturn(m_guestOSTypes, KStorageControllerType_Null); 200 return m_guestOSTypes->value(m_typeIdIndexMap.value(strTypeId, -1)).getRecommendedDVDStorageController(); 201 } 202 194 203 ULONG UIGuestOSTypeManager::getRecommendedRAM(const QString &strTypeId) const 195 204 { … … 238 247 AssertReturn(m_guestOSTypes, false); 239 248 return m_guestOSTypes->value(m_typeIdIndexMap.value(strTypeId, -1)).getRecommendedFloppy(); 249 } 250 251 bool UIGuestOSTypeManager::isLinux(const QString &strTypeId) const 252 { 253 QString strFamilyId = getFamilyId(strTypeId); 254 if (strFamilyId.contains("linux", Qt::CaseInsensitive)) 255 return true; 256 return false; 257 } 258 259 bool UIGuestOSTypeManager::isWindows(const QString &strTypeId) const 260 { 261 QString strFamilyId = getFamilyId(strTypeId); 262 if (strFamilyId.contains("windows", Qt::CaseInsensitive)) 263 return true; 264 return false; 265 } 266 267 /* static */ 268 bool UIGuestOSTypeManager::isDOSType(const QString &strOSTypeId) 269 { 270 if ( strOSTypeId.left(3) == "dos" 271 || strOSTypeId.left(3) == "win" 272 || strOSTypeId.left(3) == "os2") 273 return true; 274 275 return false; 240 276 } 241 277 … … 348 384 return KGraphicsControllerType_Null; 349 385 } 386 387 KStorageControllerType UIGuestOSType::getRecommendedDVDStorageController() const 388 { 389 if (m_comGuestOSType.isOk()) 390 return m_comGuestOSType.GetRecommendedDVDStorageController(); 391 return KStorageControllerType_Null; 392 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.h
r101295 r101315 42 42 43 43 class UIGuestOSType; 44 class UIFoo;45 44 46 45 /** A wrapper and manager class for Guest OS types (IGuestOSType). Logically we structure os types into families … … 73 72 UIGuestOSTypeInfo getTypeListForVariant(const QString &strVariant) const; 74 73 74 static bool isDOSType(const QString &strOSTypeId); 75 75 76 /** @name Getters for UIGuestOSType properties. They utilize a map for faster access to UIGuestOSType instance with @p strTypeId 76 77 * @{ */ … … 86 87 KStorageBus getRecommendedDVDStorageBus(const QString &strTypeId) const; 87 88 bool getRecommendedFloppy(const QString &strTypeId) const; 89 KStorageControllerType getRecommendedDVDStorageController(const QString &strTypeId) const; 90 bool isLinux(const QString &strTypeId) const; 91 bool isWindows(const QString &strTypeId) const; 88 92 /** @} */ 89 93 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r101155 r101315 40 40 #include "UIFrameBuffer.h" 41 41 #include "UIIconPool.h" 42 #include "UIGuestOSType.h" 42 43 #include "UIMachine.h" 43 44 #include "UIMachineLogic.h" … … 840 841 /* Get recommended controller bus & type: */ 841 842 CVirtualBox comVBox = uiCommon().virtualBox(); 842 const CGuestOSType comOsType = comVBox.GetGuestOSType(osTypeId()); 843 843 844 if (!comVBox.isOk()) 844 845 { … … 846 847 return false; 847 848 } 848 const KStorageBus enmRecommendedDvdBus = comOsType.GetRecommendedDVDStorageBus(); 849 if (!comOsType.isOk()) 850 { 851 UINotificationMessage::cannotAcquireGuestOSTypeParameter(comOsType); 852 return false; 853 } 854 const KStorageControllerType enmRecommendedDvdType = comOsType.GetRecommendedDVDStorageController(); 855 if (!comOsType.isOk()) 856 { 857 UINotificationMessage::cannotAcquireGuestOSTypeParameter(comOsType); 858 return false; 859 } 849 850 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 851 AssertReturn(pManager, false); 852 853 const KStorageBus enmRecommendedDvdBus = pManager->getRecommendedDVDStorageBus(osTypeId()); 854 const KStorageControllerType enmRecommendedDvdType = pManager->getRecommendedDVDStorageController(osTypeId()); 860 855 861 856 /* Search for an attachment of required bus & type: */ … … 1310 1305 1311 1306 /* Auto GA update is currently for Windows and Linux guests only */ 1312 const CGuestOSType osType = uiCommon().vmGuestOSType(uimachine()->osTypeId()); 1313 if (!osType.isOk()) 1314 return false; 1315 1316 const QString strGuestFamily = osType.GetFamilyId(); 1317 bool fIsWindowOrLinux = strGuestFamily.contains("windows", Qt::CaseInsensitive) || strGuestFamily.contains("linux", Qt::CaseInsensitive); 1307 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 1308 AssertReturn(pManager, false); 1309 1310 bool fIsWindowOrLinux = pManager->isLinux(uimachine()->osTypeId()) || pManager->isWindows(uimachine()->osTypeId()); 1318 1311 1319 1312 if (!fIsWindowOrLinux) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp
r98874 r101315 41 41 #include "UIIconPool.h" 42 42 #include "UIInformationRuntime.h" 43 #include "UIGuestOSType.h" 43 44 #include "UIMachine.h" 44 45 … … 350 351 strOSType = m_strOSNotDetected; 351 352 else 352 strOSType = uiCommon().vmGuestOSTypeDescription(strOSType); 353 { 354 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 355 if (pManager) 356 strOSType = pManager->getDescription(strOSType); 357 } 353 358 updateInfoRow(InfoRow_GuestOSType, QString("%1").arg(m_strGuestOSTypeLabel), strOSType); 354 359 } -
trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotDetailsWidget.cpp
r101074 r101315 54 54 #include "UIDesktopWidgetWatchdog.h" 55 55 #include "UIIconPool.h" 56 #include "UIGuestOSType.h" 56 57 #include "UISnapshotDetailsWidget.h" 57 58 #include "UIMessageCenter.h" … … 1296 1297 /* Operating System: */ 1297 1298 ++iRowCount; 1298 strItem += QString(sSectionItemTpl2).arg(QApplication::translate("UIDetails", "Operating System", "details (general)"), 1299 empReport(uiCommon().vmGuestOSTypeDescription(comMachine.GetOSTypeId()), 1300 uiCommon().vmGuestOSTypeDescription(comMachineOld.GetOSTypeId()))); 1299 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 1300 if (pManager) 1301 strItem += QString(sSectionItemTpl2).arg(QApplication::translate("UIDetails", "Operating System", "details (general)"), 1302 empReport(pManager->getDescription(comMachine.GetOSTypeId()), 1303 pManager->getDescription(comMachineOld.GetOSTypeId()))); 1301 1304 1302 1305 /* Location of the settings file: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp
r101035 r101315 41 41 #include "QITreeView.h" 42 42 #include "UICommon.h" 43 #include "UIGuestOSType.h" 43 44 #include "UIGuestOSTypeSelectionButton.h" 44 45 #include "UIApplianceEditorWidget.h" … … 537 538 value = strTmp; break; 538 539 } 539 case KVirtualSystemDescriptionType_OS: value = uiCommon().vmGuestOSTypeDescription(m_strConfigValue); break; 540 case KVirtualSystemDescriptionType_OS: 541 { 542 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 543 if (pManager) 544 value = pManager->getDescription(m_strConfigValue); 545 break; 546 } 540 547 case KVirtualSystemDescriptionType_Memory: value = m_strConfigValue + " " + UICommon::tr("MB", "size suffix MBytes=1024 KBytes"); break; 541 548 case KVirtualSystemDescriptionType_SoundCard: value = gpConverter->toString(static_cast<KAudioControllerType>(m_strConfigValue.toInt())); break; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.cpp
r101272 r101315 550 550 else if (!pWizard->detectedOSTypeId().isEmpty()) 551 551 { 552 QString strType = uiCommon().vmGuestOSTypeDescription(pWizard->detectedOSTypeId()); 552 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 553 QString strType; 554 if (pManager) 555 strType = pManager->getDescription(pWizard->detectedOSTypeId()); 553 556 if (!pWizard->isUnattendedInstallSupported()) 554 557 strMessage = UIWizardNewVM::tr("Detected OS type: %1. %2")
Note:
See TracChangeset
for help on using the changeset viewer.

