Changeset 103688 in vbox
- Timestamp:
- Mar 5, 2024 6:10:09 PM (9 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.cpp
r103686 r103688 110 110 111 111 /* Cache or update subtype info: */ 112 UISubtypeInfo si(strSubtype); 112 113 if (!m_guestOSSubtypes.contains(strFamilyId)) 113 m_guestOSSubtypes[strFamilyId] << s trSubtype;114 m_guestOSSubtypes[strFamilyId] << si; 114 115 else 115 116 { 116 QStringList&subtypes = m_guestOSSubtypes[strFamilyId];117 if (!subtypes.contains(s trSubtype))118 subtypes << s trSubtype;117 UIGuestOSSubtypeInfo &subtypes = m_guestOSSubtypes[strFamilyId]; 118 if (!subtypes.contains(si)) 119 subtypes << si; 119 120 } 120 121 … … 146 147 } 147 148 148 QStringList 149 UIGuestOSTypeManager::UIGuestOSSubtypeInfo 149 150 UIGuestOSTypeManager::getSubtypesForFamilyId(const QString &strFamilyId, 150 151 KPlatformArchitecture enmArch /* = KPlatformArchitecture_None */) const … … 155 156 156 157 /* Otherwise we'll have to prepare list by arch type: */ 157 QStringListsubtypes;158 foreach (const QString &strSubtype, m_guestOSSubtypes.value(strFamilyId))159 { 160 const KPlatformArchitecture enmCurrentArch = m_guestOSSubtypeArch.value(s trSubtype, KPlatformArchitecture_Max);158 UIGuestOSSubtypeInfo subtypes; 159 foreach (const UISubtypeInfo &subtype, m_guestOSSubtypes.value(strFamilyId)) 160 { 161 const KPlatformArchitecture enmCurrentArch = m_guestOSSubtypeArch.value(subtype.m_strName, KPlatformArchitecture_Max); 161 162 if (enmCurrentArch == enmArch || enmCurrentArch == KPlatformArchitecture_None) 162 subtypes << s trSubtype;163 subtypes << subtype; 163 164 } 164 165 return subtypes; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.h
r103687 r103688 79 79 /** Holds whether family is supported. */ 80 80 bool m_fSupported; 81 }; 82 83 /** Represents guest OS subtype info. */ 84 struct UISubtypeInfo 85 { 86 /** Constructs empty subtype info. */ 87 UISubtypeInfo() 88 {} 89 90 /** Constructs subtype info. 91 * @param strName Brings the name. */ 92 UISubtypeInfo(const QString &strName) 93 : m_strName(strName) 94 {} 95 96 /** Returns whether this subtype info has the same name as @a other. */ 97 bool operator==(const UISubtypeInfo &other) const 98 { 99 return m_strName == other.m_strName; 100 } 101 102 /** Holds the name. */ 103 QString m_strName; 81 104 }; 82 105 … … 139 162 /** A list of all OS families. */ 140 163 typedef QVector<UIFamilyInfo> UIGuestOSFamilyInfo; 164 /** A list of all OS subtypes. */ 165 typedef QVector<UISubtypeInfo> UIGuestOSSubtypeInfo; 141 166 /** A list of all OS type pairs. */ 142 167 typedef QVector<UIGuestInfoPair> UIGuestOSTypeInfo; … … 154 179 KPlatformArchitecture enmArch = KPlatformArchitecture_None) const; 155 180 /** Returns the list of subtypes for @p strFamilyId. This may be an empty list. */ 156 QStringListgetSubtypesForFamilyId(const QString &strFamilyId,157 KPlatformArchitecture enmArch = KPlatformArchitecture_None) const;181 UIGuestOSSubtypeInfo getSubtypesForFamilyId(const QString &strFamilyId, 182 KPlatformArchitecture enmArch = KPlatformArchitecture_None) const; 158 183 /** Returns a list of OS types for the @p strFamilyId. */ 159 184 UIGuestOSTypeInfo getTypesForFamilyId(const QString &strFamilyId, … … 204 229 UIGuestOSFamilyInfo m_guestOSFamilies; 205 230 /** Hold the list of guest OS subtype info. */ 206 QMap<QString, QStringList> m_guestOSSubtypes;231 QMap<QString, UIGuestOSSubtypeInfo> m_guestOSSubtypes; 207 232 208 233 /** Caches arch types on per-subtype basis. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp
r103687 r103688 652 652 653 653 /* Acquire a list of suitable sub-types: */ 654 const QStringList distributions = uiCommon().guestOSTypeManager().getSubtypesForFamilyId(m_strFamilyId, enmArch); 654 const UIGuestOSTypeManager::UIGuestOSSubtypeInfo distributions 655 = uiCommon().guestOSTypeManager().getSubtypesForFamilyId(m_strFamilyId, enmArch); 655 656 m_pLabelDistribution->setEnabled(!distributions.isEmpty()); 656 657 m_pComboDistribution->setEnabled(!distributions.isEmpty()); … … 661 662 662 663 /* Populate distribution combo: */ 663 m_pComboDistribution->addItems(distributions); 664 foreach (const UISubtypeInfo &distribution, distributions) 665 m_pComboDistribution->addItem(distribution.m_strName); 664 666 665 667 /* Unblock signals finally: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIGuestOSTypeSelectionButton.cpp
r103687 r103688 114 114 const UIFamilyInfo &fi = familyies.at(i); 115 115 QMenu *pSubMenu = m_pMainMenu->addMenu(fi.m_strDescription); 116 const QStringListdistributions = uiCommon().guestOSTypeManager().getSubtypesForFamilyId(fi.m_strId);116 const UIGuestOSTypeManager::UIGuestOSSubtypeInfo distributions = uiCommon().guestOSTypeManager().getSubtypesForFamilyId(fi.m_strId); 117 117 118 118 if (distributions.isEmpty()) … … 120 120 else 121 121 { 122 foreach (const QString &strDistribution, distributions)123 createOSTypeMenu(uiCommon().guestOSTypeManager().getTypesForSubtype( strDistribution),124 pSubMenu->addMenu( strDistribution));122 foreach (const UISubtypeInfo &distribution, distributions) 123 createOSTypeMenu(uiCommon().guestOSTypeManager().getTypesForSubtype(distribution.m_strName), 124 pSubMenu->addMenu(distribution.m_strName)); 125 125 } 126 126 }
Note:
See TracChangeset
for help on using the changeset viewer.