VirtualBox

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


Ignore:
Timestamp:
Mar 5, 2024 6:57:38 PM (9 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10384: UIGuestOSType: Cache platform type directly inside UISubtypeInfo 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

    r103688 r103689  
    5959    m_guestOSFamilies.clear();
    6060    m_guestOSSubtypes.clear();
    61     m_guestOSSubtypeArch.clear();
    6261
    6362    /* Enumerate guest OS types: */
     
    110109
    111110    /* Cache or update subtype info: */
    112     UISubtypeInfo si(strSubtype);
     111    UISubtypeInfo si(strSubtype, enmArch);
    113112    if (!m_guestOSSubtypes.contains(strFamilyId))
    114113        m_guestOSSubtypes[strFamilyId] << si;
     
    118117        if (!subtypes.contains(si))
    119118            subtypes << si;
    120     }
    121 
    122     /* Cache subtype arch type; That will be x86, ARM or None (for *any*): */
    123     if (!m_guestOSSubtypeArch.contains(strSubtype))
    124         m_guestOSSubtypeArch[strSubtype] = enmArch;
    125     else if (m_guestOSSubtypeArch.value(strSubtype) != enmArch)
    126         m_guestOSSubtypeArch[strSubtype] = KPlatformArchitecture_None;
     119        else
     120        {
     121            const int iIndex = subtypes.indexOf(si);
     122            AssertReturnVoid(iIndex >= 0);
     123            if (subtypes.at(iIndex).m_enmArch != enmArch)
     124                subtypes[iIndex].m_enmArch = KPlatformArchitecture_None; // means any
     125        }
     126    }
    127127}
    128128
     
    157157    /* Otherwise we'll have to prepare list by arch type: */
    158158    UIGuestOSSubtypeInfo subtypes;
    159     foreach (const UISubtypeInfo &subtype, m_guestOSSubtypes.value(strFamilyId))
    160     {
    161         const KPlatformArchitecture enmCurrentArch = m_guestOSSubtypeArch.value(subtype.m_strName, KPlatformArchitecture_Max);
     159    foreach (const UISubtypeInfo &si, m_guestOSSubtypes.value(strFamilyId))
     160    {
     161        const KPlatformArchitecture enmCurrentArch = si.m_enmArch;
    162162        if (enmCurrentArch == enmArch || enmCurrentArch == KPlatformArchitecture_None)
    163             subtypes << subtype;
     163            subtypes << si;
    164164    }
    165165    return subtypes;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.h

    r103688 r103689  
    8686    /** Constructs empty subtype info. */
    8787    UISubtypeInfo()
     88        : m_enmArch(KPlatformArchitecture_None)
    8889    {}
    8990
    9091    /** Constructs subtype info.
    91       * @param  strName  Brings the name. */
    92     UISubtypeInfo(const QString &strName)
     92      * @param  strName  Brings the name.
     93      * @param  enmArch  Brings the architecture type. */
     94    UISubtypeInfo(const QString &strName,
     95                  KPlatformArchitecture enmArch)
    9396        : m_strName(strName)
     97        , m_enmArch(enmArch)
    9498    {}
    9599
     
    101105
    102106    /** Holds the name. */
    103     QString  m_strName;
     107    QString                m_strName;
     108    /** Holds the architecture. */
     109    KPlatformArchitecture  m_enmArch;
    104110};
    105111
     
    230236    /** Hold the list of guest OS subtype info. */
    231237    QMap<QString, UIGuestOSSubtypeInfo> m_guestOSSubtypes;
    232 
    233     /** Caches arch types on per-subtype basis. */
    234     QMap<QString, KPlatformArchitecture>  m_guestOSSubtypeArch;
    235238};
    236239
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