VirtualBox

Changeset 101519 in vbox for trunk


Ignore:
Timestamp:
Oct 20, 2023 1:37:34 PM (12 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10523. We call 'variant'/'kind' now 'subtype'.

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

Legend:

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

    r101326 r101519  
    7272}
    7373
    74 QStringList UIGuestOSTypeManager::getVariantListForFamilyId(const QString &strFamilyId) const
    75 {
    76     QStringList variantList;
     74QStringList UIGuestOSTypeManager::getSubtypeListForFamilyId(const QString &strFamilyId) const
     75{
     76    QStringList subtypeList;
    7777    foreach (const UIGuestOSType &type, m_guestOSTypes)
    7878    {
    7979        if (type.getFamilyId() != strFamilyId)
    8080            continue;
    81         const QString &strVariant = type.getVariant();
    82         if (!strVariant.isEmpty() && !variantList.contains(strVariant))
    83             variantList << strVariant;
     81        const QString &strSubtype = type.getSubtype();
     82        if (!strSubtype.isEmpty() && !subtypeList.contains(strSubtype))
     83            subtypeList << strSubtype;
    8484    }
    85     return variantList;
     85    return subtypeList;
    8686}
    8787
     
    101101}
    102102
    103 UIGuestOSTypeManager::UIGuestOSTypeInfo UIGuestOSTypeManager::getTypeListForVariant(const QString &strVariant) const
     103UIGuestOSTypeManager::UIGuestOSTypeInfo UIGuestOSTypeManager::getTypeListForSubtype(const QString &strSubtype) const
    104104{
    105105    UIGuestOSTypeInfo typeInfoList;
    106     if (strVariant.isEmpty())
     106    if (strSubtype.isEmpty())
    107107        return typeInfoList;
    108108
    109109    foreach (const UIGuestOSType &type, m_guestOSTypes)
    110110    {
    111         if (type.getVariant() != strVariant)
     111        if (type.getSubtype() != strSubtype)
    112112            continue;
    113113        QPair<QString, QString> info(type.getId(), type.getDescription());
     
    124124}
    125125
    126 QString UIGuestOSTypeManager::getVariant(const QString  &strTypeId) const
    127 {
    128     return m_guestOSTypes.value(m_typeIdIndexMap.value(strTypeId, -1)).getVariant();
     126QString UIGuestOSTypeManager::getSubtype(const QString  &strTypeId) const
     127{
     128    return m_guestOSTypes.value(m_typeIdIndexMap.value(strTypeId, -1)).getSubtype();
    129129}
    130130
     
    245245}
    246246
    247 const QString &UIGuestOSType::getVariant() const
    248 {
    249     if (m_strVariant.isEmpty() && m_comGuestOSType.isOk())
    250         m_strVariant = m_comGuestOSType.GetVariant();
    251     return m_strVariant;
     247const QString &UIGuestOSType::getSubtype() const
     248{
     249    if (m_strSubtype.isEmpty() && m_comGuestOSType.isOk())
     250        m_strSubtype = m_comGuestOSType.GetVariant();
     251    return m_strSubtype;
    252252}
    253253
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.h

    r101326 r101519  
    5656    const QString &getFamilyDescription() const;
    5757    const QString &getId() const;
    58     const QString &getVariant() const;
     58    const QString &getSubtype() const;
    5959    const QString &getDescription() const;
    6060
     
    8181        mutable QString m_strFamilyDescription;
    8282        mutable QString m_strId;
    83         mutable QString m_strVariant;
     83        mutable QString m_strSubtype;
    8484        mutable QString m_strDescription;
    8585    /** @} */
     
    9090
    9191/** A wrapper and manager class for Guest OS types (IGuestOSType). Logically we structure os types into families
    92   *  e.g. Window, Linux etc. Some families have so-called variants which for Linux corresponds to distros, while some
    93   *  families have no variant. Under variants (and when no variant exists direcly under family) we have guest os
     92  *  e.g. Window, Linux etc. Some families have so-called subtypes which for Linux corresponds to distros, while some
     93  *  families have no subtype. Under subtypes (and when no subtype exists direcly under family) we have guest os
    9494  *  types, e.g. Debian12_x64 etc. */
    9595class SHARED_LIBRARY_STUFF UIGuestOSTypeManager
     
    111111    /** Returns a list of all families (id and description). */
    112112    const UIGuestOSTypeFamilyInfo &getFamilies() const;
    113     /** Returns the list of variants for @p strFamilyId. This may be an empty list. */
    114     QStringList                    getVariantListForFamilyId(const QString &strFamilyId) const;
     113    /** Returns the list of subtypes for @p strFamilyId. This may be an empty list. */
     114    QStringList                    getSubtypeListForFamilyId(const QString &strFamilyId) const;
    115115    /** Returns a list of OS types for the @p strFamilyId. */
    116116    UIGuestOSTypeInfo              getTypeListForFamilyId(const QString &strFamilyId) const;
    117     /** Returns a list of OS types for the @p strVariant. */
    118     UIGuestOSTypeInfo              getTypeListForVariant(const QString &strVariant) const;
     117    /** Returns a list of OS types for the @p strSubtype. */
     118    UIGuestOSTypeInfo              getTypeListForSubtype(const QString &strSubtype) const;
    119119
    120120    static bool isDOSType(const QString &strOSTypeId);
     
    123123      * @{ */
    124124        QString                 getFamilyId(const QString &strTypeId) const;
    125         QString                 getVariant(const QString  &strTypeId) const;
     125        QString                 getSubtype(const QString  &strTypeId) const;
    126126        KGraphicsControllerType getRecommendedGraphicsController(const QString &strTypeId) const;
    127127        ULONG                   getRecommendedRAM(const QString &strTypeId) const;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp

    r101510 r101519  
    7171    , m_pLabelType(0)
    7272    , m_pIconType(0)
    73     , m_pLabelVariant(0)
     73    , m_pLabelSubtype(0)
    7474    , m_pEditorName(0)
    7575    , m_pSelectorPath(0)
     
    7878    , m_pComboFamily(0)
    7979    , m_pComboType(0)
    80     , m_pComboVariant(0)
     80    , m_pComboSubtype(0)
    8181{
    8282    prepare();
     
    175175    if (iFamilyComboIndex == -1)
    176176        return false;
    177     /* Set the family combo's index. This will cause variant combo to be populated accordingly: */
     177    /* Set the family combo's index. This will cause subtype combo to be populated accordingly: */
    178178    m_pComboFamily->setCurrentIndex(iFamilyComboIndex);
    179179
    180     /* If variant is not empty then try to select correct index. This will populate type combo: */
    181     QString strVariant = uiCommon().guestOSTypeManager().getVariant(strTypeId);
    182     if (!strVariant.isEmpty())
     180    /* If subtype is not empty then try to select correct index. This will populate type combo: */
     181    QString strSubtype = uiCommon().guestOSTypeManager().getSubtype(strTypeId);
     182    if (!strSubtype.isEmpty())
    183183    {
    184184        int index = -1;
    185         for (int i = 0; i < m_pComboVariant->count() && index == -1; ++i)
    186         {
    187             if (strVariant == m_pComboVariant->itemText(i))
     185        for (int i = 0; i < m_pComboSubtype->count() && index == -1; ++i)
     186        {
     187            if (strSubtype == m_pComboSubtype->itemText(i))
    188188                index = i;
    189189        }
    190190        if (index != -1)
    191             m_pComboVariant->setCurrentIndex(index);
     191            m_pComboSubtype->setCurrentIndex(index);
    192192        else
    193193            return false;
     
    285285    if (m_pLabelType)
    286286        m_pLabelType->setText(tr("&Version:"));
    287     if (m_pLabelVariant)
    288         m_pLabelVariant->setText(tr("&Kind:"));
     287    if (m_pLabelSubtype)
     288        m_pLabelSubtype->setText(tr("&Subtype:"));
    289289
    290290    if (m_pEditorName)
     
    307307{
    308308    AssertReturnVoid(m_pComboFamily);
    309     AssertReturnVoid(m_pComboVariant);
     309    AssertReturnVoid(m_pComboSubtype);
    310310
    311311    m_strFamilyId = m_pComboFamily->itemData(index, FamilyID).toString();
     
    313313    AssertReturnVoid(!m_strFamilyId.isEmpty());
    314314
    315     m_pComboVariant->blockSignals(true);
    316     m_pLabelVariant->setEnabled(true);
    317 
    318     m_pComboVariant->setEnabled(true);
    319     m_pComboVariant->clear();
    320 
    321     const QStringList variantList = uiCommon().guestOSTypeManager().getVariantListForFamilyId(m_strFamilyId);
    322 
    323     if (variantList.isEmpty())
    324     {
    325         m_pComboVariant->setEnabled(false);
    326         m_pLabelVariant->setEnabled(false);
    327         /* If variant list is empty the all the types of the family are added to typ selection combo: */
     315    m_pComboSubtype->blockSignals(true);
     316    m_pLabelSubtype->setEnabled(true);
     317
     318    m_pComboSubtype->setEnabled(true);
     319    m_pComboSubtype->clear();
     320
     321    const QStringList subtypeList = uiCommon().guestOSTypeManager().getSubtypeListForFamilyId(m_strFamilyId);
     322
     323    if (subtypeList.isEmpty())
     324    {
     325        m_pComboSubtype->setEnabled(false);
     326        m_pLabelSubtype->setEnabled(false);
     327        /* If subtype list is empty the all the types of the family are added to typ selection combo: */
    328328        populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForFamilyId(m_strFamilyId));
    329329    }
    330330    else
    331331    {
    332         /* Populate variant combo: */
    333         /* If family is Linux then select Oracle Linux as variant: */
     332        /* Populate subtype combo: */
     333        /* If family is Linux then select Oracle Linux as subtype: */
    334334        int iOracleIndex = -1;
    335         foreach (const QString &strVariant, variantList)
    336         {
    337             m_pComboVariant->addItem(strVariant);
    338             if (strVariant.contains(QRegularExpression("Oracle.*Linux")))
    339                 iOracleIndex = m_pComboVariant->count() - 1;
     335        foreach (const QString &strSubtype, subtypeList)
     336        {
     337            m_pComboSubtype->addItem(strSubtype);
     338            if (strSubtype.contains(QRegularExpression("Oracle.*Linux")))
     339                iOracleIndex = m_pComboSubtype->count() - 1;
    340340        }
    341341        if (iOracleIndex != -1)
    342             m_pComboVariant->setCurrentIndex(iOracleIndex);
    343 
    344         populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForVariant(m_pComboVariant->currentText()));
    345     }
    346     m_pComboVariant->blockSignals(false);
     342            m_pComboSubtype->setCurrentIndex(iOracleIndex);
     343
     344        populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(m_pComboSubtype->currentText()));
     345    }
     346    m_pComboSubtype->blockSignals(false);
    347347
    348348    /* Notify listeners about this change: */
     
    350350}
    351351
    352 void UINameAndSystemEditor::sltVariantChanged(const QString &strVariant)
    353 {
    354     m_strVariant = strVariant;
    355     populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForVariant(strVariant));
     352void UINameAndSystemEditor::sltSubtypeChanged(const QString &strSubtype)
     353{
     354    m_strSubtype = strSubtype;
     355    populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(strSubtype));
    356356}
    357357
     
    386386    }
    387387    /* Or select Oracle Linux item for Linux family as default: */
    388     if (m_strVariant == "Oracle")
     388    if (m_strSubtype == "Oracle")
    389389    {
    390390        QString strDefaultID = GUEST_OS_ID_STR_X64("Oracle");
     
    565565            ++iRow;
    566566
    567             /* Prepare VM OS variant label: */
    568             m_pLabelVariant = new QLabel(this);
    569             if (m_pLabelVariant)
    570             {
    571                 m_pLabelVariant->setAlignment(Qt::AlignRight);
    572                 m_pLabelVariant->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    573 
    574                 m_pLayout->addWidget(m_pLabelVariant, iRow, 0);
    575             }
    576             /* Prepare VM OS variant combo: */
    577             m_pComboVariant = new QComboBox(this);
    578             if (m_pComboVariant)
    579             {
    580                 m_pLabelVariant->setBuddy(m_pComboVariant);
    581                 m_pLayout->addWidget(m_pComboVariant, iRow, 1);
     567            /* Prepare VM OS subtype label: */
     568            m_pLabelSubtype = new QLabel(this);
     569            if (m_pLabelSubtype)
     570            {
     571                m_pLabelSubtype->setAlignment(Qt::AlignRight);
     572                m_pLabelSubtype->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
     573
     574                m_pLayout->addWidget(m_pLabelSubtype, iRow, 0);
     575            }
     576            /* Prepare VM OS subtype combo: */
     577            m_pComboSubtype = new QComboBox(this);
     578            if (m_pComboSubtype)
     579            {
     580                m_pLabelSubtype->setBuddy(m_pComboSubtype);
     581                m_pLayout->addWidget(m_pComboSubtype, iRow, 1);
    582582            }
    583583            ++iRow;
     
    669669        connect(m_pComboFamily, &QComboBox::currentIndexChanged,
    670670                this, &UINameAndSystemEditor::sltFamilyChanged);
    671     if (m_pComboVariant)
    672         connect(m_pComboVariant, &QComboBox::currentTextChanged,
    673                 this, &UINameAndSystemEditor::sltVariantChanged);
     671    if (m_pComboSubtype)
     672        connect(m_pComboSubtype, &QComboBox::currentTextChanged,
     673                this, &UINameAndSystemEditor::sltSubtypeChanged);
    674674    if (m_pComboType)
    675675        connect(m_pComboType, &QComboBox::currentIndexChanged,
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h

    r101294 r101519  
    143143
    144144    void sltFamilyChanged(int index);
    145     void sltVariantChanged(const QString &strVariant);
     145    void sltSubtypeChanged(const QString &strSubtype);
    146146
    147147    /** Handles VM OS type @a iIndex change. */
     
    189189        /** Holds the VM OS family ID. */
    190190        QString  m_strFamilyId;
    191         QString  m_strVariant;
     191        QString  m_strSubtype;
    192192
    193193        /** Holds the currently chosen OS type IDs on per-family basis. */
     
    214214        /** Holds the VM OS type icon instance. */
    215215        QLabel *m_pIconType;
    216         /** Holds the VM OS variant label instance. */
    217         QLabel *m_pLabelVariant;
     216        /** Holds the VM OS subtype label instance. */
     217        QLabel *m_pLabelSubtype;
    218218
    219219        /** Holds the VM name editor instance. */
     
    229229        /** Holds the VM OS type combo instance. */
    230230        QComboBox          *m_pComboType;
    231         /** Holds the VM OS type variant instance. */
    232         QComboBox          *m_pComboVariant;
     231        /** Holds the VM OS type subtype instance. */
     232        QComboBox          *m_pComboSubtype;
    233233
    234234    /** @} */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIGuestOSTypeSelectionButton.cpp

    r101316 r101519  
    119119        const QPair<QString, QString> &familyInfo = familyList[i];
    120120        QMenu *pSubMenu = m_pMainMenu->addMenu(familyInfo.second);
    121         QStringList variantList = uiCommon().guestOSTypeManager().getVariantListForFamilyId(familyInfo.first);
     121        QStringList subtypeList = uiCommon().guestOSTypeManager().getSubtypeListForFamilyId(familyInfo.first);
    122122
    123         if (variantList.isEmpty())
     123        if (subtypeList.isEmpty())
    124124            createOSTypeMenu(uiCommon().guestOSTypeManager().getTypeListForFamilyId(familyInfo.first), pSubMenu);
    125125        else
    126126        {
    127             foreach (const QString &strVariant, variantList)
    128                 createOSTypeMenu(uiCommon().guestOSTypeManager().getTypeListForVariant(strVariant), pSubMenu->addMenu(strVariant));
     127            foreach (const QString &strSubtype, subtypeList)
     128                createOSTypeMenu(uiCommon().guestOSTypeManager().getTypeListForSubtype(strSubtype), pSubMenu->addMenu(strSubtype));
    129129        }
    130130    }
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