VirtualBox

Changeset 101711 in vbox


Ignore:
Timestamp:
Nov 2, 2023 9:42:03 AM (15 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10543: UINameAndSystemEditor cleanup: Renaming subtype to distribution as it's more suitable since the lowest grade called type.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp

    r101710 r101711  
    7171    , m_pLabelEdition(0)
    7272    , m_pComboEdition(0)
    73     // widgets/ family, subtype, type
     73    // widgets/ family, distribution, type
    7474    , m_pLabelFamily(0)
    7575    , m_pComboFamily(0)
    76     , m_pLabelSubtype(0)
    77     , m_pComboSubtype(0)
     76    , m_pLabelDistribution(0)
     77    , m_pComboDistribution(0)
    7878    , m_pLabelType(0)
    7979    , m_pComboType(0)
     
    192192    if (iFamilyComboIndex == -1)
    193193        return false;
    194     /* Set the family combo's index. This will cause subtype combo to be populated accordingly: */
     194    /* Set the family combo's index. This will cause distribution combo to be populated accordingly: */
    195195    m_pComboFamily->setCurrentIndex(iFamilyComboIndex);
    196196
    197     /* If subtype is not empty then try to select correct index. This will populate type combo: */
    198     QString strSubtype = uiCommon().guestOSTypeManager().getSubtype(strTypeId);
    199     if (!strSubtype.isEmpty())
     197    /* If distribution is not empty then try to select correct index. This will populate type combo: */
     198    QString strDistribution = uiCommon().guestOSTypeManager().getSubtype(strTypeId);
     199    if (!strDistribution.isEmpty())
    200200    {
    201201        int index = -1;
    202         for (int i = 0; i < m_pComboSubtype->count() && index == -1; ++i)
    203         {
    204             if (strSubtype == m_pComboSubtype->itemText(i))
     202        for (int i = 0; i < m_pComboDistribution->count() && index == -1; ++i)
     203        {
     204            if (strDistribution == m_pComboDistribution->itemText(i))
    205205                index = i;
    206206        }
    207207        if (index != -1)
    208             m_pComboSubtype->setCurrentIndex(index);
     208            m_pComboDistribution->setCurrentIndex(index);
    209209        else
    210210            return false;
     
    273273    if (m_pLabelFamily)
    274274        m_pLabelFamily->setText(tr("&Type:"));
    275     if (m_pLabelSubtype)
    276         m_pLabelSubtype->setText(tr("&Subtype:"));
     275    if (m_pLabelDistribution)
     276        m_pLabelDistribution->setText(tr("&Subtype:"));
    277277    if (m_pLabelType)
    278278        m_pLabelType->setText(tr("&Version:"));
     
    303303    /* Sanity check: */
    304304    AssertPtrReturnVoid(m_pComboFamily);
    305     AssertPtrReturnVoid(m_pComboSubtype);
     305    AssertPtrReturnVoid(m_pComboDistribution);
    306306
    307307    /* Acquire new family ID: */
     
    309309    AssertReturnVoid(!m_strFamilyId.isEmpty());
    310310
    311     m_pComboSubtype->blockSignals(true);
    312     m_pLabelSubtype->setEnabled(true);
    313 
    314     m_pComboSubtype->setEnabled(true);
    315     m_pComboSubtype->clear();
    316 
    317     const QStringList subtypeList = uiCommon().guestOSTypeManager().getSubtypeListForFamilyId(m_strFamilyId);
    318 
    319     if (subtypeList.isEmpty())
    320     {
    321         m_pComboSubtype->setEnabled(false);
    322         m_pLabelSubtype->setEnabled(false);
     311    m_pComboDistribution->blockSignals(true);
     312    m_pLabelDistribution->setEnabled(true);
     313
     314    m_pComboDistribution->setEnabled(true);
     315    m_pComboDistribution->clear();
     316
     317    const QStringList distributionList = uiCommon().guestOSTypeManager().getSubtypeListForFamilyId(m_strFamilyId);
     318
     319    if (distributionList.isEmpty())
     320    {
     321        m_pComboDistribution->setEnabled(false);
     322        m_pLabelDistribution->setEnabled(false);
    323323        /* If subtype list is empty the all the types of the family are added to typ selection combo: */
    324324        populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForFamilyId(m_strFamilyId));
     
    326326    else
    327327    {
    328         /* Populate subtype combo: */
     328        /* Populate distribution combo: */
    329329        /* If family is Linux then select Oracle Linux as subtype: */
    330330        int iOracleIndex = -1;
    331         foreach (const QString &strSubtype, subtypeList)
    332         {
    333             m_pComboSubtype->addItem(strSubtype);
    334             if (strSubtype.contains(QRegularExpression("Oracle.*Linux")))
    335                 iOracleIndex = m_pComboSubtype->count() - 1;
     331        foreach (const QString &strDistribution, distributionList)
     332        {
     333            m_pComboDistribution->addItem(strDistribution);
     334            if (strDistribution.contains(QRegularExpression("Oracle.*Linux")))
     335                iOracleIndex = m_pComboDistribution->count() - 1;
    336336        }
    337337        if (iOracleIndex != -1)
    338             m_pComboSubtype->setCurrentIndex(iOracleIndex);
    339 
    340         populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(m_pComboSubtype->currentText()));
    341     }
    342     m_pComboSubtype->blockSignals(false);
     338            m_pComboDistribution->setCurrentIndex(iOracleIndex);
     339
     340        populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(m_pComboDistribution->currentText()));
     341    }
     342    m_pComboDistribution->blockSignals(false);
    343343
    344344    /* Notify listeners about this change: */
     
    346346}
    347347
    348 void UINameAndSystemEditor::sltSubtypeChanged(const QString &strSubtype)
    349 {
    350     /* Save new subtype: */
    351     m_strSubtype = strSubtype;
     348void UINameAndSystemEditor::sltDistributionChanged(const QString &strDistribution)
     349{
     350    /* Save new distribution: */
     351    m_strDistribution = strDistribution;
    352352
    353353    /* Populate type combo: */
    354     populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(strSubtype));
     354    populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(strDistribution));
    355355}
    356356
     
    502502            ++iRow;
    503503
    504             /* Prepare VM OS subtype label: */
    505             m_pLabelSubtype = new QLabel(this);
    506             if (m_pLabelSubtype)
    507             {
    508                 m_pLabelSubtype->setAlignment(Qt::AlignRight);
    509                 m_pLabelSubtype->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    510                 m_pLayout->addWidget(m_pLabelSubtype, iRow, 0);
    511             }
    512             /* Prepare VM OS subtype combo: */
    513             m_pComboSubtype = new QComboBox(this);
    514             if (m_pComboSubtype)
    515             {
    516                 m_pLabelSubtype->setBuddy(m_pComboSubtype);
    517                 m_pLayout->addWidget(m_pComboSubtype, iRow, 1);
     504            /* Prepare VM OS distribution label: */
     505            m_pLabelDistribution = new QLabel(this);
     506            if (m_pLabelDistribution)
     507            {
     508                m_pLabelDistribution->setAlignment(Qt::AlignRight);
     509                m_pLabelDistribution->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
     510                m_pLayout->addWidget(m_pLabelDistribution, iRow, 0);
     511            }
     512            /* Prepare VM OS distribution combo: */
     513            m_pComboDistribution = new QComboBox(this);
     514            if (m_pComboDistribution)
     515            {
     516                m_pLabelDistribution->setBuddy(m_pComboDistribution);
     517                m_pLayout->addWidget(m_pComboDistribution, iRow, 1);
    518518            }
    519519            ++iRow;
     
    589589        connect(m_pComboFamily, &QComboBox::currentIndexChanged,
    590590                this, &UINameAndSystemEditor::sltFamilyChanged);
    591     if (m_pComboSubtype)
    592         connect(m_pComboSubtype, &QComboBox::currentTextChanged,
    593                 this, &UINameAndSystemEditor::sltSubtypeChanged);
     591    if (m_pComboDistribution)
     592        connect(m_pComboDistribution, &QComboBox::currentTextChanged,
     593                this, &UINameAndSystemEditor::sltDistributionChanged);
    594594    if (m_pComboType)
    595595        connect(m_pComboType, &QComboBox::currentIndexChanged,
     
    667667        }
    668668    }
    669     /* Oracle Linux for Oracle subtype: */
    670     else if (m_strSubtype == "Oracle")
     669    /* Oracle Linux for Oracle distribution: */
     670    else if (m_strDistribution == "Oracle")
    671671    {
    672672        const QString strDefaultID = GUEST_OS_ID_STR_X64("Oracle");
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h

    r101710 r101711  
    150150    /** Handles VM OS family @a iIndex change. */
    151151    void sltFamilyChanged(int iIndex);
    152     /** Handles VM OS @a strSubtype change. */
    153     void sltSubtypeChanged(const QString &strSubtype);
     152    /** Handles VM OS @a strDistribution change. */
     153    void sltDistributionChanged(const QString &strDistribution);
    154154    /** Handles VM OS type @a iIndex change. */
    155155    void sltTypeChanged(int iIndex);
     
    194194        /** Holds the VM OS family ID. */
    195195        QString  m_strFamilyId;
    196         /** Holds the VM OS subtype. */
    197         QString  m_strSubtype;
     196        /** Holds the VM OS distribution. */
     197        QString  m_strDistribution;
    198198        /** Holds the VM OS type ID. */
    199199        QString  m_strTypeId;
     
    232232        /** Holds the VM OS family combo instance. */
    233233        QComboBox *m_pComboFamily;
    234         /** Holds the VM OS subtype label instance. */
    235         QLabel    *m_pLabelSubtype;
    236         /** Holds the VM OS subtype combo instance. */
    237         QComboBox *m_pComboSubtype;
     234        /** Holds the VM OS distribution label instance. */
     235        QLabel    *m_pLabelDistribution;
     236        /** Holds the VM OS distribution combo instance. */
     237        QComboBox *m_pComboDistribution;
    238238        /** Holds the VM OS type label instance. */
    239239        QLabel    *m_pLabelType;
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