VirtualBox

Changeset 103674 in vbox


Ignore:
Timestamp:
Mar 4, 2024 6:28:21 PM (7 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10384: UIGuestOSType: Cache whether OS family is supported; That allows to exclude unwanted families 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

    r103673 r103674  
    3838void UIGuestOSTypeManager::reCacheGuestOSTypes()
    3939{
     40    /* Acquire CVirtualBox: */
     41    CVirtualBox comVBox = uiCommon().virtualBox();
     42
     43    /* Acquire a total list of guest OS types, supported or not: */
     44    CGuestOSTypeVector guestOSTypes = comVBox.GetGuestOSTypes();
     45
    4046    /* Acquire a list of guest OS types supported by this host: */
    41     CGuestOSTypeVector guestOSTypes;
    42     CSystemProperties comSysProps = uiCommon().virtualBox().GetSystemProperties();
    43     foreach (const KPlatformArchitecture &enmArch, comSysProps.GetSupportedPlatformArchitectures())
    44     {
    45         CPlatformProperties comPlatProps = uiCommon().virtualBox().GetPlatformProperties(enmArch);
    46         guestOSTypes += comPlatProps.GetSupportedGuestOSTypes();
     47    m_supportedGuestOSTypeIDs.clear();
     48    CSystemProperties comSystemProps = comVBox.GetSystemProperties();
     49    foreach (const KPlatformArchitecture &enmArch, comSystemProps.GetSupportedPlatformArchitectures())
     50    {
     51        CPlatformProperties comPlatformProps = comVBox.GetPlatformProperties(enmArch);
     52        foreach (const CGuestOSType &comType, comPlatformProps.GetSupportedGuestOSTypes())
     53            m_supportedGuestOSTypeIDs << comType.GetId();
    4754    }
    4855
     
    7582    /* Append guest OS type to a list of cached wrappers: */
    7683    m_guestOSTypes.append(UIGuestOSType(comType));
    77     m_typeIdIndexMap[m_guestOSTypes.last().getId()] = m_guestOSTypes.size() - 1;
    7884
    7985    /* Acquire a bit of attributes: */
     86    const QString strId = m_guestOSTypes.last().getId();
    8087    const QString strFamilyId = m_guestOSTypes.last().getFamilyId();
    8188    const QString strFamilyDesc = m_guestOSTypes.last().getFamilyDescription();
    8289    const QString strSubtype = m_guestOSTypes.last().getSubtype();
    8390    const KPlatformArchitecture enmArch = m_guestOSTypes.last().getPlatformArchitecture();
     91    const bool fSupported = m_supportedGuestOSTypeIDs.contains(strId);
     92
     93    /* Remember guest OS type index as well: */
     94    m_typeIdIndexMap[strId] = m_guestOSTypes.size() - 1;
    8495
    8596    /* Cache or update family info: */
    86     UIFamilyInfo fi(strFamilyId, strFamilyDesc, enmArch);
     97    UIFamilyInfo fi(strFamilyId, strFamilyDesc, enmArch, fSupported);
    8798    if (!m_guestOSFamilies.contains(fi))
    8899        m_guestOSFamilies << fi;
     
    93104        if (m_guestOSFamilies.at(iIndex).m_enmArch != enmArch)
    94105            m_guestOSFamilies[iIndex].m_enmArch = KPlatformArchitecture_None; // means any
     106        if (m_guestOSFamilies.at(iIndex).m_fSupported != fSupported)
     107            m_guestOSFamilies[iIndex].m_fSupported = true; // cause at least one is supported
    95108    }
    96109
     
    103116
    104117UIGuestOSTypeManager::UIGuestOSFamilyInfo
    105 UIGuestOSTypeManager::getFamilies(KPlatformArchitecture enmArch /* = KPlatformArchitecture_None */) const
     118UIGuestOSTypeManager::getFamilies(bool fListAll, KPlatformArchitecture enmArch /* = KPlatformArchitecture_None */) const
    106119{
    107120    /* Return all families by default: */
     
    114127    {
    115128        const KPlatformArchitecture enmCurrentArch = fi.m_enmArch;
    116         if (   enmCurrentArch == enmArch
    117             || enmCurrentArch == KPlatformArchitecture_None)
     129        if (   (enmCurrentArch == enmArch || enmCurrentArch == KPlatformArchitecture_None)
     130            && (fListAll || fi.m_fSupported))
    118131            families << fi;
    119132    }
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.h

    r103673 r103674  
    4747    UIFamilyInfo()
    4848        : m_enmArch(KPlatformArchitecture_None)
     49        , m_fSupported(false)
    4950    {}
    5051
     
    5253      * @param  strId           Brings the family ID.
    5354      * @param  strDescription  Brings the family description.
    54       * @param  enmArch         Brings the family architecture. */
     55      * @param  enmArch         Brings the family architecture.
     56      * @param  fSupported      Brings whether family is supported. */
    5557    UIFamilyInfo(const QString &strId,
    5658                 const QString &strDescription,
    57                  KPlatformArchitecture enmArch)
     59                 KPlatformArchitecture enmArch,
     60                 bool fSupported)
    5861        : m_strId(strId)
    5962        , m_strDescription(strDescription)
    6063        , m_enmArch(enmArch)
     64        , m_fSupported(fSupported)
    6165    {}
    6266
     
    7377    /** Holds family architecture. */
    7478    KPlatformArchitecture  m_enmArch;
     79    /** Holds whether family is supported. */
     80    bool                   m_fSupported;
    7581};
    7682
     
    145151
    146152    /** Returns a list of all families (id and description). */
    147     UIGuestOSFamilyInfo getFamilies(KPlatformArchitecture enmArch = KPlatformArchitecture_None) const;
     153    UIGuestOSFamilyInfo getFamilies(bool fListAll, KPlatformArchitecture enmArch = KPlatformArchitecture_None) const;
    148154    /** Returns the list of subtypes for @p strFamilyId. This may be an empty list. */
    149155    QStringList         getSubtypeListForFamilyId(const QString &strFamilyId,
     
    185191    void addGuestOSType(const CGuestOSType &comType);
    186192
     193    /** Holds the list of supported guest OS type IDs. */
     194    QStringList  m_supportedGuestOSTypeIDs;
     195
    187196    /** The type list. Here it is a pointer to QVector to delay definition of UIGuestOSType. */
    188197    QVector<UIGuestOSType> m_guestOSTypes;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp

    r103672 r103674  
    616616
    617617    /* Acquire family IDs: */
    618     const UIGuestOSTypeManager::UIGuestOSFamilyInfo families = uiCommon().guestOSTypeManager().getFamilies(enmArch);
     618    const UIGuestOSTypeManager::UIGuestOSFamilyInfo families = uiCommon().guestOSTypeManager().getFamilies(false, enmArch);
    619619
    620620    /* Block signals initially and clear the combo: */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIGuestOSTypeSelectionButton.cpp

    r103672 r103674  
    108108    m_pMainMenu->clear();
    109109
    110     UIGuestOSTypeManager::UIGuestOSFamilyInfo familyList = uiCommon().guestOSTypeManager().getFamilies();
     110    UIGuestOSTypeManager::UIGuestOSFamilyInfo familyList = uiCommon().guestOSTypeManager().getFamilies(true);
    111111
    112112    for (int i = 0; i < familyList.size(); ++i)
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