VirtualBox

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


Ignore:
Timestamp:
Mar 6, 2024 2:33:12 PM (9 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10384: UIGuestOSType: Cache whether OS subtype is supported; That allows to exclude unwanted subtypes in OS type editor while still keeping them cached.

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

Legend:

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

    r103689 r103703  
    109109
    110110    /* Cache or update subtype info: */
    111     UISubtypeInfo si(strSubtype, enmArch);
     111    UISubtypeInfo si(strSubtype, enmArch, fSupported);
    112112    if (!m_guestOSSubtypes.contains(strFamilyId))
    113113        m_guestOSSubtypes[strFamilyId] << si;
     
    123123            if (subtypes.at(iIndex).m_enmArch != enmArch)
    124124                subtypes[iIndex].m_enmArch = KPlatformArchitecture_None; // means any
     125            if (subtypes.at(iIndex).m_fSupported != fSupported)
     126                subtypes[iIndex].m_fSupported = true; // cause at least one is supported
    125127        }
    126128    }
     
    149151UIGuestOSTypeManager::UIGuestOSSubtypeInfo
    150152UIGuestOSTypeManager::getSubtypesForFamilyId(const QString &strFamilyId,
     153                                             bool fListAll,
    151154                                             KPlatformArchitecture enmArch /* = KPlatformArchitecture_None */) const
    152155{
     
    160163    {
    161164        const KPlatformArchitecture enmCurrentArch = si.m_enmArch;
    162         if (enmCurrentArch == enmArch || enmCurrentArch == KPlatformArchitecture_None)
     165        if (   (enmCurrentArch == enmArch || enmCurrentArch == KPlatformArchitecture_None)
     166            && (fListAll || si.m_fSupported))
    163167            subtypes << si;
    164168    }
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.h

    r103689 r103703  
    8787    UISubtypeInfo()
    8888        : m_enmArch(KPlatformArchitecture_None)
     89        , m_fSupported(false)
    8990    {}
    9091
    9192    /** Constructs subtype info.
    92       * @param  strName  Brings the name.
    93       * @param  enmArch  Brings the architecture type. */
     93      * @param  strName     Brings the name.
     94      * @param  enmArch     Brings the architecture type.
     95      * @param  fSupported  Brings whether subtype is supported. */
    9496    UISubtypeInfo(const QString &strName,
    95                   KPlatformArchitecture enmArch)
     97                  KPlatformArchitecture enmArch,
     98                  bool fSupported)
    9699        : m_strName(strName)
    97100        , m_enmArch(enmArch)
     101        , m_fSupported(fSupported)
    98102    {}
    99103
     
    108112    /** Holds the architecture. */
    109113    KPlatformArchitecture  m_enmArch;
     114    /** Holds whether subtype is supported. */
     115    bool                   m_fSupported;
    110116};
    111117
     
    181187    void reCacheGuestOSTypes();
    182188
    183     /** Returns a list of all families. */
     189    /** Returns a list of all families.
     190      * @param  fListAll  Brings whether a list of all families is requested, supported otherwise. */
    184191    UIGuestOSFamilyInfo getFamilies(bool fListAll,
    185192                                    KPlatformArchitecture enmArch = KPlatformArchitecture_None) const;
    186     /** Returns the list of subtypes for @p strFamilyId. This may be an empty list. */
     193    /** Returns the list of subtypes for @p strFamilyId. This may be an empty list.
     194      * @param  fListAll  Brings whether a list of all subtypes is requested, supported otherwise. */
    187195    UIGuestOSSubtypeInfo getSubtypesForFamilyId(const QString &strFamilyId,
     196                                                bool fListAll,
    188197                                                KPlatformArchitecture enmArch = KPlatformArchitecture_None) const;
    189198    /** Returns a list of OS types for the @p strFamilyId. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp

    r103688 r103703  
    653653    /* Acquire a list of suitable sub-types: */
    654654    const UIGuestOSTypeManager::UIGuestOSSubtypeInfo distributions
    655         = uiCommon().guestOSTypeManager().getSubtypesForFamilyId(m_strFamilyId, enmArch);
     655        = uiCommon().guestOSTypeManager().getSubtypesForFamilyId(m_strFamilyId, false, enmArch);
    656656    m_pLabelDistribution->setEnabled(!distributions.isEmpty());
    657657    m_pComboDistribution->setEnabled(!distributions.isEmpty());
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIGuestOSTypeSelectionButton.cpp

    r103688 r103703  
    108108    m_pMainMenu->clear();
    109109
    110     const UIGuestOSTypeManager::UIGuestOSFamilyInfo familyies = uiCommon().guestOSTypeManager().getFamilies(true);
     110    const UIGuestOSTypeManager::UIGuestOSFamilyInfo families
     111        = uiCommon().guestOSTypeManager().getFamilies(true);
    111112
    112     for (int i = 0; i < familyies.size(); ++i)
     113    for (int i = 0; i < families.size(); ++i)
    113114    {
    114         const UIFamilyInfo &fi = familyies.at(i);
     115        const UIFamilyInfo &fi = families.at(i);
    115116        QMenu *pSubMenu = m_pMainMenu->addMenu(fi.m_strDescription);
    116         const UIGuestOSTypeManager::UIGuestOSSubtypeInfo distributions = uiCommon().guestOSTypeManager().getSubtypesForFamilyId(fi.m_strId);
     117        const UIGuestOSTypeManager::UIGuestOSSubtypeInfo distributions
     118            = uiCommon().guestOSTypeManager().getSubtypesForFamilyId(fi.m_strId, true);
    117119
    118120        if (distributions.isEmpty())
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