VirtualBox

Changeset 103686 in vbox


Ignore:
Timestamp:
Mar 5, 2024 4:07:36 PM (11 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10384: UIGuestOSType: Cache subtype info same way as family info.

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

Legend:

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

    r103680 r103686  
    5858    m_guestOSTypes.clear();
    5959    m_guestOSFamilies.clear();
     60    m_guestOSSubtypes.clear();
    6061    m_guestOSSubtypeArch.clear();
    6162
     
    108109    }
    109110
     111    /* Cache or update subtype info: */
     112    if (!m_guestOSSubtypes.contains(strFamilyId))
     113        m_guestOSSubtypes[strFamilyId] << strSubtype;
     114    else
     115    {
     116        QStringList &subtypes = m_guestOSSubtypes[strFamilyId];
     117        if (!subtypes.contains(strSubtype))
     118            subtypes << strSubtype;
     119    }
     120
    110121    /* Cache subtype arch type; That will be x86, ARM or None (for *any*): */
    111122    if (!m_guestOSSubtypeArch.contains(strSubtype))
     
    139150                                             KPlatformArchitecture enmArch /* = KPlatformArchitecture_None */) const
    140151{
    141     /* Prepare list by arch type: */
     152    /* Return all subtypes by default: */
     153    if (enmArch == KPlatformArchitecture_None)
     154        return m_guestOSSubtypes.value(strFamilyId);
     155
     156    /* Otherwise we'll have to prepare list by arch type: */
    142157    QStringList subtypes;
    143     foreach (const UIGuestOSType &type, m_guestOSTypes)
    144     {
    145         if (type.getFamilyId() != strFamilyId)
    146             continue;
    147         const QString strSubtype = type.getSubtype();
    148         if (strSubtype.isEmpty() || subtypes.contains(strSubtype))
    149             continue;
     158    foreach (const QString &strSubtype, m_guestOSSubtypes.value(strFamilyId))
     159    {
    150160        const KPlatformArchitecture enmCurrentArch = m_guestOSSubtypeArch.value(strSubtype, KPlatformArchitecture_Max);
    151         if (   enmCurrentArch == enmArch
    152             || enmArch == KPlatformArchitecture_None
    153             || enmCurrentArch == KPlatformArchitecture_None)
     161        if (enmCurrentArch == enmArch || enmCurrentArch == KPlatformArchitecture_None)
    154162            subtypes << strSubtype;
    155163    }
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.h

    r103680 r103686  
    200200      * is index to m_guestOSTypes list. */
    201201    QMap<QString, int> m_typeIdIndexMap;
    202     /** First item of the pair is family id and the 2nd is family description. */
     202
     203    /** Hold the list of guest OS family info. */
    203204    UIGuestOSFamilyInfo m_guestOSFamilies;
     205    /** Hold the list of guest OS subtype info. */
     206    QMap<QString, QStringList> m_guestOSSubtypes;
    204207
    205208    /** Caches arch types on per-subtype basis. */
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