VirtualBox

Changeset 103673 in vbox


Ignore:
Timestamp:
Mar 4, 2024 4:52:41 PM (13 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
162033
Message:

FE/Qt: bugref:10384: UIGuestOSType: Cache platform type directly inside UIFamilyInfo struct.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

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

    r103672 r103673  
    5151    m_guestOSTypes.clear();
    5252    m_guestOSFamilies.clear();
    53     m_guestOSFamilyArch.clear();
    5453    m_guestOSSubtypeArch.clear();
    5554
     
    7473void UIGuestOSTypeManager::addGuestOSType(const CGuestOSType &comType)
    7574{
     75    /* Append guest OS type to a list of cached wrappers: */
    7676    m_guestOSTypes.append(UIGuestOSType(comType));
    7777    m_typeIdIndexMap[m_guestOSTypes.last().getId()] = m_guestOSTypes.size() - 1;
     78
     79    /* Acquire a bit of attributes: */
    7880    const QString strFamilyId = m_guestOSTypes.last().getFamilyId();
    7981    const QString strFamilyDesc = m_guestOSTypes.last().getFamilyDescription();
    8082    const QString strSubtype = m_guestOSTypes.last().getSubtype();
    81     UIFamilyInfo fi(strFamilyId, strFamilyDesc);
     83    const KPlatformArchitecture enmArch = m_guestOSTypes.last().getPlatformArchitecture();
     84
     85    /* Cache or update family info: */
     86    UIFamilyInfo fi(strFamilyId, strFamilyDesc, enmArch);
    8287    if (!m_guestOSFamilies.contains(fi))
    8388        m_guestOSFamilies << fi;
    84 
    85     /* Acquire arch type: */
    86     const KPlatformArchitecture enmArch = m_guestOSTypes.last().getPlatformArchitecture();
    87     /* Cache family arch type; That will be x86, ARM or None (for *any*): */
    88     if (!m_guestOSFamilyArch.contains(strFamilyId))
    89         m_guestOSFamilyArch[strFamilyId] = enmArch;
    90     else if (m_guestOSFamilyArch.value(strFamilyId) != enmArch)
    91         m_guestOSFamilyArch[strFamilyId] = KPlatformArchitecture_None;
     89    else
     90    {
     91        const int iIndex = m_guestOSFamilies.indexOf(fi);
     92        AssertReturnVoid(iIndex >= 0);
     93        if (m_guestOSFamilies.at(iIndex).m_enmArch != enmArch)
     94            m_guestOSFamilies[iIndex].m_enmArch = KPlatformArchitecture_None; // means any
     95    }
     96
    9297    /* Cache subtype arch type; That will be x86, ARM or None (for *any*): */
    9398    if (!m_guestOSSubtypeArch.contains(strSubtype))
     
    108113    foreach (const UIFamilyInfo &fi, m_guestOSFamilies)
    109114    {
    110         const KPlatformArchitecture enmCurrentArch = m_guestOSFamilyArch.value(fi.m_strId, KPlatformArchitecture_Max);
     115        const KPlatformArchitecture enmCurrentArch = fi.m_enmArch;
    111116        if (   enmCurrentArch == enmArch
    112117            || enmCurrentArch == KPlatformArchitecture_None)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.h

    r103672 r103673  
    4646    /** Constructs empty family info. */
    4747    UIFamilyInfo()
     48        : m_enmArch(KPlatformArchitecture_None)
    4849    {}
    4950
    50     /** Constructs family info with predefined @a strId and @a strDescription. */
    51     UIFamilyInfo(const QString &strId, const QString &strDescription)
     51    /** Constructs family info.
     52      * @param  strId           Brings the family ID.
     53      * @param  strDescription  Brings the family description.
     54      * @param  enmArch         Brings the family architecture. */
     55    UIFamilyInfo(const QString &strId,
     56                 const QString &strDescription,
     57                 KPlatformArchitecture enmArch)
    5258        : m_strId(strId)
    5359        , m_strDescription(strDescription)
     60        , m_enmArch(enmArch)
    5461    {}
    5562
     
    6168
    6269    /** Holds family id. */
    63     QString  m_strId;
     70    QString                m_strId;
    6471    /** Holds family description. */
    65     QString  m_strDescription;
     72    QString                m_strDescription;
     73    /** Holds family architecture. */
     74    KPlatformArchitecture  m_enmArch;
    6675};
    6776
     
    184193    UIGuestOSFamilyInfo m_guestOSFamilies;
    185194
    186     /** Caches arch types on per-family basis. */
    187     QMap<QString, KPlatformArchitecture>  m_guestOSFamilyArch;
    188195    /** Caches arch types on per-subtype basis. */
    189196    QMap<QString, KPlatformArchitecture>  m_guestOSSubtypeArch;
Note: See TracChangeset for help on using the changeset viewer.

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