VirtualBox

Changeset 95159 in vbox


Ignore:
Timestamp:
Jun 1, 2022 11:06:35 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151655
Message:

FE/Qt/Ds: bugref:6899: Machine settings: System page accessibility improvements (part 1); Moving Chipset editor related stuff into separate UIChipsetEditor widget.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
3 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r95129 r95159  
    900900        src/settings/editors/UIBaseMemoryEditor.h \
    901901        src/settings/editors/UIBootOrderEditor.h \
     902        src/settings/editors/UIChipsetEditor.h \
    902903        src/settings/editors/UIColorThemeEditor.h \
    903904        src/settings/editors/UIDefaultMachineFolderEditor.h \
     
    14701471        src/settings/editors/UIBaseMemoryEditor.cpp \
    14711472        src/settings/editors/UIBootOrderEditor.cpp \
     1473        src/settings/editors/UIChipsetEditor.cpp \
    14721474        src/settings/editors/UIColorThemeEditor.cpp \
    14731475        src/settings/editors/UIDefaultMachineFolderEditor.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIChipsetEditor.cpp

    r95156 r95159  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UISharedClipboardEditor class implementation.
     3 * VBox Qt GUI - UIChipsetEditor class implementation.
    44 */
    55
     
    2525#include "UICommon.h"
    2626#include "UIConverter.h"
    27 #include "UISharedClipboardEditor.h"
     27#include "UIChipsetEditor.h"
    2828
    2929/* COM includes: */
     
    3131
    3232
    33 UISharedClipboardEditor::UISharedClipboardEditor(QWidget *pParent /* = 0 */)
     33UIChipsetEditor::UIChipsetEditor(QWidget *pParent /* = 0 */)
    3434    : QIWithRetranslateUI<QWidget>(pParent)
    35     , m_enmValue(KClipboardMode_Max)
     35    , m_enmValue(KChipsetType_Max)
    3636    , m_pLabel(0)
    3737    , m_pCombo(0)
     
    4040}
    4141
    42 void UISharedClipboardEditor::setValue(KClipboardMode enmValue)
     42void UIChipsetEditor::setValue(KChipsetType enmValue)
    4343{
    4444    /* Update cached value and
     
    5151}
    5252
    53 KClipboardMode UISharedClipboardEditor::value() const
     53KChipsetType UIChipsetEditor::value() const
    5454{
    55     return m_pCombo ? m_pCombo->currentData().value<KClipboardMode>() : m_enmValue;
     55    return m_pCombo ? m_pCombo->currentData().value<KChipsetType>() : m_enmValue;
    5656}
    5757
    58 int UISharedClipboardEditor::minimumLabelHorizontalHint() const
     58int UIChipsetEditor::minimumLabelHorizontalHint() const
    5959{
    6060    return m_pLabel ? m_pLabel->minimumSizeHint().width() : 0;
    6161}
    6262
    63 void UISharedClipboardEditor::setMinimumLayoutIndent(int iIndent)
     63void UIChipsetEditor::setMinimumLayoutIndent(int iIndent)
    6464{
    6565    if (m_pLayout)
     
    6767}
    6868
    69 void UISharedClipboardEditor::retranslateUi()
     69void UIChipsetEditor::retranslateUi()
    7070{
    7171    if (m_pLabel)
    72         m_pLabel->setText(tr("&Shared Clipboard:"));
     72        m_pLabel->setText(tr("&Chipset:"));
    7373    if (m_pCombo)
    7474    {
    7575        for (int i = 0; i < m_pCombo->count(); ++i)
    7676        {
    77             const KClipboardMode enmType = m_pCombo->itemData(i).value<KClipboardMode>();
     77            const KChipsetType enmType = m_pCombo->itemData(i).value<KChipsetType>();
    7878            m_pCombo->setItemText(i, gpConverter->toString(enmType));
    7979        }
    80         m_pCombo->setToolTip(tr("Holds which clipboard data will be copied between the guest and the host OS. "
    81                                 "This feature requires Guest Additions to be installed in the guest OS."));
     80        m_pCombo->setToolTip(tr("Selects the chipset to be emulated in this virtual machine. Note that the ICH9 chipset "
     81                                "emulation is experimental and not recommended except for guest systems (such as Mac OS X) "
     82                                "which require it."));
    8283    }
    8384}
    8485
    85 void UISharedClipboardEditor::prepare()
     86void UIChipsetEditor::prepare()
    8687{
    8788    /* Create main layout: */
     
    111112                if (m_pLabel)
    112113                    m_pLabel->setBuddy(m_pCombo);
     114                connect(m_pCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
     115                        this, &UIChipsetEditor::sigValueChanged);
    113116                pComboLayout->addWidget(m_pCombo);
    114117            }
     
    129132}
    130133
    131 void UISharedClipboardEditor::populateCombo()
     134void UIChipsetEditor::populateCombo()
    132135{
    133136    if (m_pCombo)
     
    136139        m_pCombo->clear();
    137140
    138         /* Load currently supported audio driver types: */
     141        /* Load currently supported values: */
    139142        CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties();
    140         m_supportedValues = comProperties.GetSupportedClipboardModes();
     143        m_supportedValues = comProperties.GetSupportedChipsetTypes();
    141144
    142145        /* Make sure requested value if sane is present as well: */
    143         if (   m_enmValue != KClipboardMode_Max
     146        if (   m_enmValue != KChipsetType_Max
    144147            && !m_supportedValues.contains(m_enmValue))
    145148            m_supportedValues.prepend(m_enmValue);
    146149
    147150        /* Update combo with all the supported values: */
    148         foreach (const KClipboardMode &enmType, m_supportedValues)
     151        foreach (const KChipsetType &enmType, m_supportedValues)
    149152            m_pCombo->addItem(QString(), QVariant::fromValue(enmType));
    150153
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIChipsetEditor.h

    r95156 r95159  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UISharedClipboardEditor class declaration.
     3 * VBox Qt GUI - UIChipsetEditor class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UISharedClipboardEditor_h
    19 #define FEQT_INCLUDED_SRC_settings_editors_UISharedClipboardEditor_h
     18#ifndef FEQT_INCLUDED_SRC_settings_editors_UIChipsetEditor_h
     19#define FEQT_INCLUDED_SRC_settings_editors_UIChipsetEditor_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    3737class QLabel;
    3838
    39 /** QWidget subclass used as a shared clipboard editor. */
    40 class SHARED_LIBRARY_STUFF UISharedClipboardEditor : public QIWithRetranslateUI<QWidget>
     39/** QWidget subclass used as a chipset editor. */
     40class SHARED_LIBRARY_STUFF UIChipsetEditor : public QIWithRetranslateUI<QWidget>
    4141{
    4242    Q_OBJECT;
     43
     44signals:
     45
     46    /** Notifies listeners about value change. */
     47    void sigValueChanged();
    4348
    4449public:
    4550
    4651    /** Constructs editor passing @a pParent to the base-class. */
    47     UISharedClipboardEditor(QWidget *pParent = 0);
     52    UIChipsetEditor(QWidget *pParent = 0);
    4853
    4954    /** Defines editor @a enmValue. */
    50     void setValue(KClipboardMode enmValue);
     55    void setValue(KChipsetType enmValue);
    5156    /** Returns editor value. */
    52     KClipboardMode value() const;
     57    KChipsetType value() const;
    5358
    5459    /** Returns the vector of supported values. */
    55     QVector<KClipboardMode> supportedValues() const { return m_supportedValues; }
     60    QVector<KChipsetType> supportedValues() const { return m_supportedValues; }
    5661
    5762    /** Returns minimum layout hint. */
     
    7378
    7479    /** Holds the value to be selected. */
    75     KClipboardMode  m_enmValue;
     80    KChipsetType  m_enmValue;
    7681
    7782    /** Holds the vector of supported values. */
    78     QVector<KClipboardMode>  m_supportedValues;
     83    QVector<KChipsetType>  m_supportedValues;
    7984
    8085    /** Holds the main layout instance. */
     
    8691};
    8792
    88 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UISharedClipboardEditor_h */
     93#endif /* !FEQT_INCLUDED_SRC_settings_editors_UIChipsetEditor_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r94667 r95159  
    3030#include "UIBaseMemoryEditor.h"
    3131#include "UIBootOrderEditor.h"
     32#include "UIChipsetEditor.h"
    3233#include "UICommon.h"
    3334#include "UIConverter.h"
     
    160161    , m_pLabelBootOrder(0)
    161162    , m_pEditorBootOrder(0)
    162     , m_pLabelChipset(0)
    163     , m_pComboChipset(0)
     163    , m_pEditorChipset(0)
    164164    , m_pLabelPointingHID(0)
    165165    , m_pComboPointingHID(0)
     
    239239KChipsetType UIMachineSettingsSystem::chipsetType() const
    240240{
    241     return m_pComboChipset->currentData().value<KChipsetType>();
     241    return m_pEditorChipset->value();
    242242}
    243243
     
    319319    /* We are doing that *now* because these combos have
    320320     * dynamical content which depends on cashed value: */
    321     repopulateComboChipsetType();
    322321    repopulateComboPointingHIDType();
    323322    repopulateComboParavirtProviderType();
     
    328327    if (m_pEditorBootOrder)
    329328        m_pEditorBootOrder->setValue(oldSystemData.m_bootItems);
    330     if (m_pComboChipset)
    331     {
    332         const int iChipsetTypePosition = m_pComboChipset->findData(oldSystemData.m_chipsetType);
    333         m_pComboChipset->setCurrentIndex(iChipsetTypePosition == -1 ? 0 : iChipsetTypePosition);
    334     }
     329    if (m_pEditorChipset)
     330        m_pEditorChipset->setValue(oldSystemData.m_chipsetType);
    335331    if (m_pComboPointingHID)
    336332    {
     
    393389    if (m_pEditorBootOrder)
    394390        newSystemData.m_bootItems = m_pEditorBootOrder->value();
    395     if (m_pComboChipset)
    396         newSystemData.m_chipsetType = m_pComboChipset->currentData().value<KChipsetType>();
     391    if (m_pEditorChipset)
     392        newSystemData.m_chipsetType = m_pEditorChipset->value();
    397393    if (m_pComboPointingHID)
    398394        newSystemData.m_pointingHIDType = m_pComboPointingHID->currentData().value<KPointingHIDType>();
    399395    if (   m_pCheckBoxAPIC
    400396        && m_pSliderProcessorCount
    401         && m_pComboChipset)
     397        && m_pEditorChipset)
    402398        newSystemData.m_fEnabledIoApic =    m_pCheckBoxAPIC->isChecked()
    403399                                         || m_pSliderProcessorCount->value() > 1
    404                                          || m_pComboChipset->currentData().value<KChipsetType>() == KChipsetType_ICH9;
     400                                         || m_pEditorChipset->value() == KChipsetType_ICH9;
    405401    if (m_pCheckBoxEFI)
    406402        newSystemData.m_fEnabledEFI = m_pCheckBoxEFI->isChecked();
     
    482478
    483479        /* Chipset type vs IO-APIC test: */
    484         if (m_pComboChipset->currentData().value<KChipsetType>() == KChipsetType_ICH9 && !m_pCheckBoxAPIC->isChecked())
     480        if (m_pEditorChipset->value() == KChipsetType_ICH9 && !m_pCheckBoxAPIC->isChecked())
    485481        {
    486482            message.second << tr(
     
    632628    setTabOrder(m_pTabWidget->focusProxy(), m_pEditorBaseMemory);
    633629    setTabOrder(m_pEditorBaseMemory, m_pEditorBootOrder);
    634     setTabOrder(m_pEditorBootOrder, m_pComboChipset);
    635     setTabOrder(m_pComboChipset, m_pComboPointingHID);
     630    setTabOrder(m_pEditorBootOrder, m_pEditorChipset);
     631    setTabOrder(m_pEditorChipset, m_pComboPointingHID);
    636632    setTabOrder(m_pComboPointingHID, m_pCheckBoxAPIC);
    637633    setTabOrder(m_pCheckBoxAPIC, m_pCheckBoxEFI);
     
    661657                                        "checkboxes on the left to enable or disable individual boot devices. "
    662658                                        "Move items up and down to change the device order."));
    663     m_pLabelChipset->setText(tr("&Chipset:"));
    664     m_pComboChipset->setToolTip(tr("Selects the chipset to be emulated in this virtual machine. Note that the ICH9 chipset "
    665                                    "emulation is experimental and not recommended except for guest systems (such as Mac OS X) "
    666                                    "which require it."));
    667659    m_pLabelPointingHID->setText(tr("&Pointing Device:"));
    668660    m_pComboPointingHID->setToolTip(tr("Determines whether the emulated pointing device is a standard PS/2 mouse, "
     
    725717
    726718    /* Retranslate combo-boxes: */
    727     retranslateComboChipsetType();
    728719    retranslateComboPointingHIDType();
    729720    retranslateComboParavirtProvider();
     721
     722    /* These editors have own labels, but we want them to be properly layouted according to each other: */
     723    int iMinimumLayoutHint = 0;
     724    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelBaseMemory->minimumSizeHint().width());
     725    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelBootOrder->minimumSizeHint().width());
     726    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorChipset->minimumLabelHorizontalHint());
     727    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelPointingHID->minimumSizeHint().width());
     728    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelExtendedMotherboard->minimumSizeHint().width());
     729    m_pEditorChipset->setMinimumLayoutIndent(iMinimumLayoutHint);
    730730}
    731731
     
    740740    m_pLabelBootOrder->setEnabled(isMachineOffline());
    741741    m_pEditorBootOrder->setEnabled(isMachineOffline());
    742     m_pLabelChipset->setEnabled(isMachineOffline());
    743     m_pComboChipset->setEnabled(isMachineOffline());
     742    m_pEditorChipset->setEnabled(isMachineOffline());
    744743    m_pLabelPointingHID->setEnabled(isMachineOffline());
    745744    m_pComboPointingHID->setEnabled(isMachineOffline());
     
    915914            }
    916915
    917             /* Prepare chipset label: */
    918             m_pLabelChipset = new QLabel(m_pTabMotherboard);
    919             if (m_pLabelChipset)
    920             {
    921                 m_pLabelChipset->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    922                 pLayoutMotherboard->addWidget(m_pLabelChipset, 4, 0);
    923             }
    924             /* Prepare chipset combo: */
    925             m_pComboChipset = new QComboBox(m_pTabMotherboard);
    926             if (m_pComboChipset)
    927             {
    928                 if (m_pLabelChipset)
    929                     m_pLabelChipset->setBuddy(m_pComboChipset);
    930                 m_pComboChipset->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    931                 m_pComboChipset->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    932 
    933                 pLayoutMotherboard->addWidget(m_pComboChipset, 4, 1);
    934             }
     916            /* Prepare chipset editor: */
     917            m_pEditorChipset = new UIChipsetEditor(m_pTabMotherboard);
     918            if (m_pEditorChipset)
     919                pLayoutMotherboard->addWidget(m_pEditorChipset, 4, 0, 1, 2);
    935920
    936921            /* Prepare pointing HID label: */
     
    12381223{
    12391224    /* Configure 'Motherboard' connections: */
    1240     connect(m_pComboChipset, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
     1225    connect(m_pEditorChipset, &UIChipsetEditor::sigValueChanged,
    12411226            this, &UIMachineSettingsSystem::revalidate);
    12421227    connect(m_pComboPointingHID, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
     
    12681253}
    12691254
    1270 void UIMachineSettingsSystem::repopulateComboChipsetType()
    1271 {
    1272     AssertPtrReturnVoid(m_pComboChipset);
    1273     {
    1274         /* Clear combo first of all: */
    1275         m_pComboChipset->clear();
    1276 
    1277         /* Load currently supported chipset types: */
    1278         CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties();
    1279         QVector<KChipsetType> chipsetTypes = comProperties.GetSupportedChipsetTypes();
    1280         /* Take into account currently cached value: */
    1281         const KChipsetType enmCachedValue = m_pCache->base().m_chipsetType;
    1282         if (!chipsetTypes.contains(enmCachedValue))
    1283             chipsetTypes.prepend(enmCachedValue);
    1284 
    1285         /* Populate combo finally: */
    1286         foreach (const KChipsetType &enmType, chipsetTypes)
    1287             m_pComboChipset->addItem(gpConverter->toString(enmType), QVariant::fromValue(enmType));
    1288     }
    1289 }
    1290 
    12911255void UIMachineSettingsSystem::repopulateComboPointingHIDType()
    12921256{
     
    13281292        foreach (const KParavirtProvider &enmProvider, supportedProviderTypes)
    13291293            m_pComboParavirtProvider->addItem(gpConverter->toString(enmProvider), QVariant::fromValue(enmProvider));
    1330     }
    1331 }
    1332 
    1333 void UIMachineSettingsSystem::retranslateComboChipsetType()
    1334 {
    1335     /* For each the element in m_pComboChipset: */
    1336     for (int iIndex = 0; iIndex < m_pComboChipset->count(); ++iIndex)
    1337     {
    1338         /* Apply retranslated text: */
    1339         const KChipsetType enmType = m_pComboChipset->currentData().value<KChipsetType>();
    1340         m_pComboChipset->setItemText(iIndex, gpConverter->toString(enmType));
    13411294    }
    13421295}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r94333 r95159  
    3737class UIBaseMemoryEditor;
    3838class UIBootOrderEditor;
     39class UIChipsetEditor;
    3940
    4041/** Machine settings: System page. */
     
    136137    void cleanup();
    137138
    138     /** Repopulates Chipset type combo-box. */
    139     void repopulateComboChipsetType();
    140139    /** Repopulates Pointing HID type combo-box. */
    141140    void repopulateComboPointingHIDType();
     
    143142    void repopulateComboParavirtProviderType();
    144143
    145     /** Retranslates Chipset type combo-box. */
    146     void retranslateComboChipsetType();
    147144    /** Retranslates Pointing HID type combo-box. */
    148145    void retranslateComboPointingHIDType();
     
    191188        /** Holds the boot order editor instance. */
    192189        UIBootOrderEditor  *m_pEditorBootOrder;
    193         /** Holds the chipset label instance. */
    194         QLabel             *m_pLabelChipset;
    195         /** Holds the chipset combo instance. */
    196         QComboBox          *m_pComboChipset;
     190        /** Holds the chipset editor instance. */
     191        UIChipsetEditor    *m_pEditorChipset;
    197192        /** Holds the pointing HID label instance. */
    198193        QLabel             *m_pLabelPointingHID;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette