Changeset 73119 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 13, 2018 12:44:55 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r73017 r73119 2143 2143 } 2144 2144 2145 QList<CGuestOSType> VBoxGlobal::vmGuestOSFamilyList() const 2146 { 2147 QList<CGuestOSType> result; 2148 for (int i = 0; i < m_guestOSFamilyIDs.size(); ++i) 2149 result << m_guestOSTypes[i][0]; 2150 return result; 2145 QString VBoxGlobal::vmGuestOSFamilyDescription(const QString &strFamilyId) const 2146 { 2147 AssertMsg(m_guestOSFamilyDescriptions.contains(strFamilyId), 2148 ("Family ID incorrect: '%s'.", strFamilyId.toLatin1().constData())); 2149 return m_guestOSFamilyDescriptions.value(strFamilyId); 2151 2150 } 2152 2151 2153 2152 QList<CGuestOSType> VBoxGlobal::vmGuestOSTypeList(const QString &strFamilyId) const 2154 2153 { 2155 AssertMsg(m_guestOSFamilyIDs.contains(strFamilyId), ("Family ID incorrect: '%s'.", strFamilyId.toLatin1().constData())); 2154 AssertMsg(m_guestOSFamilyIDs.contains(strFamilyId), 2155 ("Family ID incorrect: '%s'.", strFamilyId.toLatin1().constData())); 2156 2156 return m_guestOSFamilyIDs.contains(strFamilyId) ? 2157 2157 m_guestOSTypes[m_guestOSFamilyIDs.indexOf(strFamilyId)] : QList<CGuestOSType>(); … … 4385 4385 const CGuestOSType os = guestOSTypes.at(i); 4386 4386 const QString strFamilyID = os.GetFamilyId(); 4387 const QString strFamilyDescription = os.GetFamilyDescription(); 4387 4388 if (!m_guestOSFamilyIDs.contains(strFamilyID)) 4388 4389 { 4389 4390 m_guestOSFamilyIDs << strFamilyID; 4391 m_guestOSFamilyDescriptions[strFamilyID] = strFamilyDescription; 4390 4392 m_guestOSTypes << QList<CGuestOSType>(); 4391 4393 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r73017 r73119 21 21 /* Qt includes: */ 22 22 #include <QFileIconProvider> 23 #include <QMap> 23 24 #include <QReadWriteLock> 24 25 … … 442 443 /** @name COM: Guest OS Type. 443 444 * @{ */ 444 /** Returns the list of few guest OS types, queried from 445 * IVirtualBox corresponding to every family id. */ 446 QList<CGuestOSType> vmGuestOSFamilyList() const; 447 /** Returns the list of all guest OS types, queried from 448 * IVirtualBox corresponding to passed family id. */ 445 /** Returns the list of family IDs. */ 446 QList<QString> vmGuestOSFamilyIDs() const { return m_guestOSFamilyIDs; } 447 448 /** Returns a family description with passed @a strFamilyId. */ 449 QString vmGuestOSFamilyDescription(const QString &strFamilyId) const; 450 /** Returns a list of all guest OS types with passed @a strFamilyId. */ 449 451 QList<CGuestOSType> vmGuestOSTypeList(const QString &strFamilyId) const; 450 452 451 /** Returns the guest OS type object corresponding to the given type id of list 452 * containing OS types related to OS family determined by family id attribute. 453 * If the index is invalid a null object is returned. */ 453 /** Returns the guest OS type for passed @a strTypeId. 454 * It is being serached through the list of family with passed @a strFamilyId if specified. */ 454 455 CGuestOSType vmGuestOSType(const QString &strTypeId, const QString &strFamilyId = QString()) const; 455 /** Returns the description corresponding to the given guest OS type id. */456 /** Returns a type description with passed @a strTypeId. */ 456 457 QString vmGuestOSTypeDescription(const QString &strTypeId) const; 457 458 … … 833 834 /** Holds the guest OS family IDs. */ 834 835 QList<QString> m_guestOSFamilyIDs; 836 /** Holds the guest OS family descriptions. */ 837 QMap<QString, QString> m_guestOSFamilyDescriptions; 835 838 /** Holds the guest OS types for each family ID. */ 836 839 QList<QList<CGuestOSType> > m_guestOSTypes; -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIGuestOSTypeSelectionButton.cpp
r73118 r73119 84 84 void UIGuestOSTypeSelectionButton::populateMenu() 85 85 { 86 /* Clea initially: */ 86 87 m_pMainMenu->clear(); 87 88 88 /* Create a list of all possible OS types */ 89 QList<CGuestOSType> families = vboxGlobal().vmGuestOSFamilyList(); 90 foreach(const CGuestOSType &comFamily, families) 89 /* Create a list of all possible OS types: */ 90 foreach(const QString &strFamilyId, vboxGlobal().vmGuestOSFamilyIDs()) 91 91 { 92 QMenu *pSubMenu = m_pMainMenu->addMenu(comFamily.GetFamilyDescription()); 93 QList<CGuestOSType> types = vboxGlobal().vmGuestOSTypeList(comFamily.GetFamilyId()); 94 foreach (const CGuestOSType &comType, types) 92 QMenu *pSubMenu = m_pMainMenu->addMenu(vboxGlobal().vmGuestOSFamilyDescription(strFamilyId)); 93 foreach (const CGuestOSType &comType, vboxGlobal().vmGuestOSTypeList(strFamilyId)) 95 94 { 96 95 QAction *pAction = pSubMenu->addAction(vboxGlobal().vmGuestOSTypePixmapDefault(comType.GetId()), -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
r72603 r73119 338 338 { 339 339 /* Populate VM OS family combo: */ 340 const QList< CGuestOSType> families = vboxGlobal().vmGuestOSFamilyList();341 for (int i = 0; i < famil ies.size(); ++i)342 { 343 const QString strFamilyName = families.at(i).GetFamilyDescription();344 m_pComboFamily->insertItem(i, strFamilyName);345 m_pComboFamily->setItemData(i, families.at(i).GetFamilyId(), TypeID);340 const QList<QString> &familyIDs = vboxGlobal().vmGuestOSFamilyIDs(); 341 for (int i = 0; i < familyIDs.size(); ++i) 342 { 343 const QString &strFamilyId = familyIDs.at(i); 344 m_pComboFamily->insertItem(i, vboxGlobal().vmGuestOSFamilyDescription(strFamilyId)); 345 m_pComboFamily->setItemData(i, strFamilyId, TypeID); 346 346 } 347 347
Note:
See TracChangeset
for help on using the changeset viewer.