VirtualBox

Changeset 95213 in vbox


Ignore:
Timestamp:
Jun 7, 2022 11:52:15 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151723
Message:

FE/Qt/Ds: bugref:6899: Machine settings: System page accessibility improvements (part 8); Moving paravirt provider stuff into separate UIParavirtProviderEditor widget.

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

Legend:

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

    r95175 r95213  
    922922        src/settings/editors/UINetworkFeaturesEditor.h \
    923923        src/settings/editors/UINetworkSettingsEditor.h \
     924        src/settings/editors/UIParavirtProviderEditor.h \
    924925        src/settings/editors/UIPointingHIDEditor.h \
    925926        src/settings/editors/UIProcessorFeaturesEditor.h \
     
    14971498        src/settings/editors/UINetworkFeaturesEditor.cpp \
    14981499        src/settings/editors/UINetworkSettingsEditor.cpp \
     1500        src/settings/editors/UIParavirtProviderEditor.cpp \
    14991501        src/settings/editors/UIPointingHIDEditor.cpp \
    15001502        src/settings/editors/UIProcessorFeaturesEditor.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIParavirtProviderEditor.cpp

    r95212 r95213  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIAudioControllerEditor class implementation.
     3 * VBox Qt GUI - UIParavirtProviderEditor class implementation.
    44 */
    55
     
    2525#include "UICommon.h"
    2626#include "UIConverter.h"
    27 #include "UIAudioControllerEditor.h"
     27#include "UIParavirtProviderEditor.h"
    2828
    2929/* COM includes: */
     
    3131
    3232
    33 UIAudioControllerEditor::UIAudioControllerEditor(QWidget *pParent /* = 0 */)
     33UIParavirtProviderEditor::UIParavirtProviderEditor(QWidget *pParent /* = 0 */)
    3434    : QIWithRetranslateUI<QWidget>(pParent)
    35     , m_enmValue(KAudioControllerType_Max)
     35    , m_enmValue(KParavirtProvider_Max)
    3636    , m_pLabel(0)
    3737    , m_pCombo(0)
     
    4040}
    4141
    42 void UIAudioControllerEditor::setValue(KAudioControllerType enmValue)
     42void UIParavirtProviderEditor::setValue(KParavirtProvider enmValue)
    4343{
    4444    /* Update cached value and
     
    5151}
    5252
    53 KAudioControllerType UIAudioControllerEditor::value() const
     53KParavirtProvider UIParavirtProviderEditor::value() const
    5454{
    55     return m_pCombo ? m_pCombo->currentData().value<KAudioControllerType>() : m_enmValue;
     55    return m_pCombo ? m_pCombo->currentData().value<KParavirtProvider>() : m_enmValue;
    5656}
    5757
    58 int UIAudioControllerEditor::minimumLabelHorizontalHint() const
     58int UIParavirtProviderEditor::minimumLabelHorizontalHint() const
    5959{
    6060    return m_pLabel ? m_pLabel->minimumSizeHint().width() : 0;
    6161}
    6262
    63 void UIAudioControllerEditor::setMinimumLayoutIndent(int iIndent)
     63void UIParavirtProviderEditor::setMinimumLayoutIndent(int iIndent)
    6464{
    6565    if (m_pLayout)
     
    6767}
    6868
    69 void UIAudioControllerEditor::retranslateUi()
     69void UIParavirtProviderEditor::retranslateUi()
    7070{
    7171    if (m_pLabel)
    72         m_pLabel->setText(tr("Audio &Controller:"));
     72        m_pLabel->setText(tr("&Paravirtualization Interface:"));
    7373    if (m_pCombo)
    7474    {
    7575        for (int i = 0; i < m_pCombo->count(); ++i)
    7676        {
    77             const KAudioControllerType enmType = m_pCombo->itemData(i).value<KAudioControllerType>();
     77            const KParavirtProvider enmType = m_pCombo->itemData(i).value<KParavirtProvider>();
    7878            m_pCombo->setItemText(i, gpConverter->toString(enmType));
    7979        }
    80         m_pCombo->setToolTip(tr("Selects the type of the virtual sound card. Depending on this value, "
    81                                 "VirtualBox will provide different audio hardware to the virtual machine."));
     80        m_pCombo->setToolTip(tr("Selects the paravirtualization guest interface "
     81                                "provider to be used by this virtual machine."));
    8282    }
    8383}
    8484
    85 void UIAudioControllerEditor::prepare()
     85void UIParavirtProviderEditor::prepare()
    8686{
    8787    /* Create main layout: */
     
    129129}
    130130
    131 void UIAudioControllerEditor::populateCombo()
     131void UIParavirtProviderEditor::populateCombo()
    132132{
    133133    if (m_pCombo)
     
    136136        m_pCombo->clear();
    137137
    138         /* Load currently supported audio driver types: */
     138        /* Load currently supported paravirt provider types: */
    139139        CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties();
    140         m_supportedValues = comProperties.GetSupportedAudioControllerTypes();
     140        m_supportedValues = comProperties.GetSupportedParavirtProviders();
    141141
    142142        /* Make sure requested value if sane is present as well: */
    143         if (   m_enmValue != KAudioControllerType_Max
     143        if (   m_enmValue != KParavirtProvider_Max
    144144            && !m_supportedValues.contains(m_enmValue))
    145145            m_supportedValues.prepend(m_enmValue);
    146146
    147147        /* Update combo with all the supported values: */
    148         foreach (const KAudioControllerType &enmType, m_supportedValues)
     148        foreach (const KParavirtProvider &enmType, m_supportedValues)
    149149            m_pCombo->addItem(QString(), QVariant::fromValue(enmType));
    150150
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIParavirtProviderEditor.h

    r95212 r95213  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIAudioControllerEditor class declaration.
     3 * VBox Qt GUI - UIParavirtProviderEditor class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UIAudioControllerEditor_h
    19 #define FEQT_INCLUDED_SRC_settings_editors_UIAudioControllerEditor_h
     18#ifndef FEQT_INCLUDED_SRC_settings_editors_UIParavirtProviderEditor_h
     19#define FEQT_INCLUDED_SRC_settings_editors_UIParavirtProviderEditor_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    3737class QLabel;
    3838
    39 /** QWidget subclass used as an audio controller editor. */
    40 class SHARED_LIBRARY_STUFF UIAudioControllerEditor : public QIWithRetranslateUI<QWidget>
     39/** QWidget subclass used as an paravirtualization provider editor. */
     40class SHARED_LIBRARY_STUFF UIParavirtProviderEditor : public QIWithRetranslateUI<QWidget>
    4141{
    4242    Q_OBJECT;
     
    4545
    4646    /** Constructs editor passing @a pParent to the base-class. */
    47     UIAudioControllerEditor(QWidget *pParent = 0);
     47    UIParavirtProviderEditor(QWidget *pParent = 0);
    4848
    4949    /** Defines editor @a enmValue. */
    50     void setValue(KAudioControllerType enmValue);
     50    void setValue(KParavirtProvider enmValue);
    5151    /** Returns editor value. */
    52     KAudioControllerType value() const;
     52    KParavirtProvider value() const;
    5353
    5454    /** Returns the vector of supported values. */
    55     QVector<KAudioControllerType> supportedValues() const { return m_supportedValues; }
     55    QVector<KParavirtProvider> supportedValues() const { return m_supportedValues; }
    5656
    5757    /** Returns minimum layout hint. */
     
    7373
    7474    /** Holds the value to be selected. */
    75     KAudioControllerType  m_enmValue;
     75    KParavirtProvider  m_enmValue;
    7676
    7777    /** Holds the vector of supported values. */
    78     QVector<KAudioControllerType>  m_supportedValues;
     78    QVector<KParavirtProvider>  m_supportedValues;
    7979
    8080    /** Holds the main layout instance. */
     
    8686};
    8787
    88 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UIAudioControllerEditor_h */
     88#endif /* !FEQT_INCLUDED_SRC_settings_editors_UIParavirtProviderEditor_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r95175 r95213  
    3333#include "UIMachineSettingsSystem.h"
    3434#include "UIMotherboardFeaturesEditor.h"
     35#include "UIParavirtProviderEditor.h"
    3536#include "UIPointingHIDEditor.h"
    3637#include "UIProcessorFeaturesEditor.h"
     
    162163    , m_pEditorProcessorFeatures(0)
    163164    , m_pTabAcceleration(0)
    164     , m_pLabelParavirtProvider(0)
    165     , m_pComboParavirtProvider(0)
     165    , m_pEditorParavirtProvider(0)
    166166    , m_pLabelVirtualization(0)
    167167    , m_pCheckBoxVirtualization(0)
     
    295295    /* Get old data from cache: */
    296296    const UIDataSettingsMachineSystem &oldSystemData = m_pCache->base();
    297 
    298     /* We are doing that *now* because these combos have
    299      * dynamical content which depends on cashed value: */
    300     repopulateComboParavirtProviderType();
    301297
    302298    /* Load old 'Motherboard' data from cache: */
     
    328324
    329325    /* Load old 'Acceleration' data from cache: */
    330     if (m_pComboParavirtProvider)
    331     {
    332         const int iParavirtProviderPosition = m_pComboParavirtProvider->findData(oldSystemData.m_paravirtProvider);
    333         m_pComboParavirtProvider->setCurrentIndex(iParavirtProviderPosition == -1 ? 0 : iParavirtProviderPosition);
    334     }
     326    if (m_pEditorParavirtProvider)
     327        m_pEditorParavirtProvider->setValue(oldSystemData.m_paravirtProvider);
    335328    if (m_pCheckBoxVirtualization)
    336329        m_pCheckBoxVirtualization->setChecked(oldSystemData.m_fEnabledHwVirtEx);
     
    390383
    391384    /* Gather 'Acceleration' data: */
    392     if (m_pComboParavirtProvider)
    393         newSystemData.m_paravirtProvider = m_pComboParavirtProvider->currentData().value<KParavirtProvider>();
     385    if (m_pEditorParavirtProvider)
     386        newSystemData.m_paravirtProvider = m_pEditorParavirtProvider->value();
    394387    /* Enable HW Virt Ex automatically if it's supported and
    395388     * 1. multiple CPUs, 2. Nested Paging or 3. Nested HW Virt Ex is requested. */
     
    612605    setTabOrder(m_pEditorVCPU, m_pEditorExecCap);
    613606    setTabOrder(m_pEditorExecCap, m_pEditorProcessorFeatures);
    614     setTabOrder(m_pEditorProcessorFeatures, m_pComboParavirtProvider);
     607    setTabOrder(m_pEditorProcessorFeatures, m_pEditorParavirtProvider);
    615608
    616609    /* Configure navigation for 'acceleration' tab: */
    617     setTabOrder(m_pComboParavirtProvider, m_pCheckBoxVirtualization);
     610    setTabOrder(m_pEditorParavirtProvider, m_pCheckBoxVirtualization);
    618611    setTabOrder(m_pCheckBoxVirtualization, m_pCheckBoxNestedPaging);
    619612}
     
    628621    m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabMotherboard), tr("&Motherboard"));
    629622    m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabProcessor), tr("&Processor"));
    630     m_pLabelParavirtProvider->setText(tr("&Paravirtualization Interface:"));
    631     m_pComboParavirtProvider->setToolTip(tr("Selects the paravirtualization guest interface provider to be used by this "
    632                                             "virtual machine."));
    633623    m_pLabelVirtualization->setText(tr("Hardware Virtualization:"));
    634624    m_pCheckBoxVirtualization->setToolTip(tr("When checked, the virtual machine will try to make use of the host CPU's hardware "
     
    639629    m_pCheckBoxNestedPaging->setText(tr("Enable Nested Pa&ging"));
    640630    m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabAcceleration), tr("Acce&leration"));
    641 
    642     /* Retranslate combo-boxes: */
    643     retranslateComboParavirtProvider();
    644631
    645632    /* These editors have own labels, but we want them to be properly layouted according to each other: */
     
    685672
    686673    /* Polish 'Acceleration' availability: */
     674    m_pEditorParavirtProvider->setEnabled(isMachineOffline());
     675    m_pLabelVirtualization->setEnabled(isMachineOffline());
    687676    m_pCheckBoxVirtualization->setEnabled(   (systemData.m_fSupportedHwVirtEx && isMachineOffline())
    688677                                          || (systemData.m_fEnabledHwVirtEx && isMachineOffline()));
     
    690679                                        && (   (systemData.m_fSupportedNestedPaging && isMachineOffline())
    691680                                            || (systemData.m_fEnabledNestedPaging && isMachineOffline())));
    692     m_pLabelParavirtProvider->setEnabled(isMachineOffline());
    693     m_pComboParavirtProvider->setEnabled(isMachineOffline());
    694     m_pLabelVirtualization->setEnabled(isMachineOffline());
    695681}
    696682
     
    830816            pLayoutAcceleration->setRowStretch(3, 1);
    831817
    832             /* Prepare paravirtualization provider label: */
    833             m_pLabelParavirtProvider = new QLabel(m_pTabAcceleration);
    834             if (m_pLabelParavirtProvider)
    835             {
    836                 m_pLabelParavirtProvider->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    837                 pLayoutAcceleration->addWidget(m_pLabelParavirtProvider, 0, 0);
    838             }
    839             /* Prepare paravirtualization provider combo: */
    840             m_pComboParavirtProvider = new QComboBox(m_pTabAcceleration);
    841             if (m_pComboParavirtProvider)
    842             {
    843                 if (m_pLabelParavirtProvider)
    844                     m_pLabelParavirtProvider->setBuddy(m_pComboParavirtProvider);
    845                 m_pComboParavirtProvider->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    846                 m_pComboParavirtProvider->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    847 
    848                 pLayoutAcceleration->addWidget(m_pComboParavirtProvider, 0, 1, 1, 2);
    849             }
     818            /* Prepare paravirtualization provider editor: */
     819            m_pEditorParavirtProvider = new UIParavirtProviderEditor(m_pTabAcceleration);
     820            if (m_pEditorParavirtProvider)
     821                pLayoutAcceleration->addWidget(m_pEditorParavirtProvider, 0, 0, 1, 3);
    850822
    851823            /* Prepare virtualization label layout: */
     
    936908}
    937909
    938 void UIMachineSettingsSystem::repopulateComboParavirtProviderType()
    939 {
    940     AssertPtrReturnVoid(m_pComboParavirtProvider);
    941     {
    942         /* Clear combo first of all: */
    943         m_pComboParavirtProvider->clear();
    944 
    945         /* Load currently supported paravirtualization provider types: */
    946         CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties();
    947         QVector<KParavirtProvider> supportedProviderTypes = comProperties.GetSupportedParavirtProviders();
    948         /* Take into account currently cached value: */
    949         const KParavirtProvider enmCachedValue = m_pCache->base().m_paravirtProvider;
    950         if (!supportedProviderTypes.contains(enmCachedValue))
    951             supportedProviderTypes.prepend(enmCachedValue);
    952 
    953         /* Populate combo finally: */
    954         foreach (const KParavirtProvider &enmProvider, supportedProviderTypes)
    955             m_pComboParavirtProvider->addItem(gpConverter->toString(enmProvider), QVariant::fromValue(enmProvider));
    956     }
    957 }
    958 
    959 void UIMachineSettingsSystem::retranslateComboParavirtProvider()
    960 {
    961     /* For each the element in m_pComboParavirtProvider: */
    962     for (int iIndex = 0; iIndex < m_pComboParavirtProvider->count(); ++iIndex)
    963     {
    964         /* Apply retranslated text: */
    965         const KParavirtProvider enmType = m_pComboParavirtProvider->currentData().value<KParavirtProvider>();
    966         m_pComboParavirtProvider->setItemText(iIndex, gpConverter->toString(enmType));
    967     }
    968 }
    969 
    970910bool UIMachineSettingsSystem::saveData()
    971911{
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r95175 r95213  
    3737class UIExecutionCapEditor;
    3838class UIMotherboardFeaturesEditor;
     39class UIParavirtProviderEditor;
    3940class UIPointingHIDEditor;
    4041class UIProcessorFeaturesEditor;
     
    130131    void cleanup();
    131132
    132     /** Repopulates Paravirtualization Provider type combo-box. */
    133     void repopulateComboParavirtProviderType();
    134 
    135     /** Retranslates Paravirtualization providers combo-box. */
    136     void retranslateComboParavirtProvider();
    137 
    138133    /** Saves existing data from cache. */
    139134    bool saveData();
     
    179174
    180175        /** Holds the 'Acceleration' tab instance. */
    181         QWidget   *m_pTabAcceleration;
    182         /** Holds the paravirtualization provider label instance. */
    183         QLabel    *m_pLabelParavirtProvider;
    184         /** Holds the paravirtualization provider combo instance. */
    185         QComboBox *m_pComboParavirtProvider;
     176        QWidget                  *m_pTabAcceleration;
     177        /** Holds the paravirtualization provider editor instance. */
     178        UIParavirtProviderEditor *m_pEditorParavirtProvider;
    186179        /** Holds the virtualization label instance. */
    187         QLabel    *m_pLabelVirtualization;
     180        QLabel                   *m_pLabelVirtualization;
    188181        /** Holds the virtualization check-box instance. */
    189         QCheckBox *m_pCheckBoxVirtualization;
     182        QCheckBox                *m_pCheckBoxVirtualization;
    190183        /** Holds the nested paging check-box instance. */
    191         QCheckBox *m_pCheckBoxNestedPaging;
     184        QCheckBox                *m_pCheckBoxNestedPaging;
    192185   /** @} */
    193186};
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