VirtualBox

Changeset 103672 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Mar 4, 2024 4:10:46 PM (9 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10384: UIGuestOSType: Extend family info from simple QString pair to UIFamilyInfo struct accumulating all the required family information.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.cpp

    r102282 r103672  
    7979    const QString strFamilyDesc = m_guestOSTypes.last().getFamilyDescription();
    8080    const QString strSubtype = m_guestOSTypes.last().getSubtype();
    81     QPair<QString, QString> family = QPair<QString, QString>(strFamilyId, strFamilyDesc);
    82     if (!m_guestOSFamilies.contains(family))
    83         m_guestOSFamilies << family;
     81    UIFamilyInfo fi(strFamilyId, strFamilyDesc);
     82    if (!m_guestOSFamilies.contains(fi))
     83        m_guestOSFamilies << fi;
    8484
    8585    /* Acquire arch type: */
     
    106106    /* Otherwise we'll have to prepare list by arch type: */
    107107    UIGuestOSTypeManager::UIGuestOSFamilyInfo families;
    108     foreach (const UIGuestInfoPair &family, m_guestOSFamilies)
    109     {
    110         const KPlatformArchitecture enmCurrentArch = m_guestOSFamilyArch.value(family.first, KPlatformArchitecture_Max);
     108    foreach (const UIFamilyInfo &fi, m_guestOSFamilies)
     109    {
     110        const KPlatformArchitecture enmCurrentArch = m_guestOSFamilyArch.value(fi.m_strId, KPlatformArchitecture_Max);
    111111        if (   enmCurrentArch == enmArch
    112112            || enmCurrentArch == KPlatformArchitecture_None)
    113             families << family;
     113            families << fi;
    114114    }
    115115    return families;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.h

    r102282 r103672  
    4040#include "COMEnums.h"
    4141#include "CGuestOSType.h"
     42
     43/** Represents guest OS family info. */
     44struct UIFamilyInfo
     45{
     46    /** Constructs empty family info. */
     47    UIFamilyInfo()
     48    {}
     49
     50    /** Constructs family info with predefined @a strId and @a strDescription. */
     51    UIFamilyInfo(const QString &strId, const QString &strDescription)
     52        : m_strId(strId)
     53        , m_strDescription(strDescription)
     54    {}
     55
     56    /** Returns whether this family info has the same id as @a other. */
     57    bool operator==(const UIFamilyInfo &other) const
     58    {
     59        return m_strId == other.m_strId;
     60    }
     61
     62    /** Holds family id. */
     63    QString  m_strId;
     64    /** Holds family description. */
     65    QString  m_strDescription;
     66};
    4267
    4368/** A wrapper around CGuestOSType. Some of the properties are cached here for performance. */
     
    87112};
    88113
    89 
    90114/** A wrapper and manager class for Guest OS types (IGuestOSType). Logically we structure os types into families
    91115  *  e.g. Window, Linux etc. Some families have so-called subtypes which for Linux corresponds to distros, while some
     
    99123    typedef QPair<QString, QString> UIGuestInfoPair;
    100124    /** A list of all OS family pairs. */
    101     typedef QVector<UIGuestInfoPair> UIGuestOSFamilyInfo;
     125    typedef QVector<UIFamilyInfo> UIGuestOSFamilyInfo;
    102126    /** A list of all OS type pairs. */
    103127    typedef QVector<UIGuestInfoPair> UIGuestOSTypeInfo;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp

    r102162 r103672  
    625625    for (int i = 0; i < families.size(); ++i)
    626626    {
    627         m_pComboFamily->addItem(families[i].second);
    628         m_pComboFamily->setItemData(i, families[i].first);
     627        const UIFamilyInfo fi = families.at(i);
     628        m_pComboFamily->addItem(fi.m_strDescription);
     629        m_pComboFamily->setItemData(i, fi.m_strId);
    629630    }
    630631
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIGuestOSTypeSelectionButton.cpp

    r102152 r103672  
    112112    for (int i = 0; i < familyList.size(); ++i)
    113113    {
    114         const QPair<QString, QString> &familyInfo = familyList[i];
    115         QMenu *pSubMenu = m_pMainMenu->addMenu(familyInfo.second);
    116         QStringList subtypeList = uiCommon().guestOSTypeManager().getSubtypeListForFamilyId(familyInfo.first);
     114        const UIFamilyInfo &fi = familyList.at(i);
     115        QMenu *pSubMenu = m_pMainMenu->addMenu(fi.m_strDescription);
     116        QStringList subtypeList = uiCommon().guestOSTypeManager().getSubtypeListForFamilyId(fi.m_strId);
    117117
    118118        if (subtypeList.isEmpty())
    119             createOSTypeMenu(uiCommon().guestOSTypeManager().getTypeListForFamilyId(familyInfo.first), pSubMenu);
     119            createOSTypeMenu(uiCommon().guestOSTypeManager().getTypeListForFamilyId(fi.m_strId), pSubMenu);
    120120        else
    121121        {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette