VirtualBox

Changeset 80081 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 31, 2019 4:19:53 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7720: VM settings / Audio page: Replace heavily distributed across audio page widgets related to controller editing functionality with single UIAudioControllerEditor.

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

Legend:

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

    r80079 r80081  
    888888        src/settings/machine/UIMachineSettingsUSBFilterDetails.h \
    889889        src/widgets/UIAddDiskEncryptionPasswordDialog.h \
     890        src/widgets/UIAudioControllerEditor.h \
    890891        src/widgets/UIAudioHostDriverEditor.h \
    891892        src/widgets/UIBaseMemoryEditor.h \
     
    13831384        src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp \
    13841385        src/widgets/UIAddDiskEncryptionPasswordDialog.cpp \
     1386        src/widgets/UIAudioControllerEditor.cpp \
    13851387        src/widgets/UIAudioHostDriverEditor.cpp \
    13861388        src/widgets/UIBaseMemoryEditor.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp

    r80079 r80081  
    123123    m_pCheckBoxAudio->setChecked(oldAudioData.m_fAudioEnabled);
    124124    m_pAudioHostDriverEditor->setValue(oldAudioData.m_audioDriverType);
    125     m_pComboAudioController->setCurrentIndex(m_pComboAudioController->findData((int)oldAudioData.m_audioControllerType));
     125    m_pAudioControllerEditor->setValue(oldAudioData.m_audioControllerType);
    126126    m_pCheckBoxAudioOutput->setChecked(oldAudioData.m_fAudioOutputEnabled);
    127127    m_pCheckBoxAudioInput->setChecked(oldAudioData.m_fAudioInputEnabled);
     
    139139    newAudioData.m_fAudioEnabled = m_pCheckBoxAudio->isChecked();
    140140    newAudioData.m_audioDriverType = m_pAudioHostDriverEditor->value();
    141     newAudioData.m_audioControllerType = static_cast<KAudioControllerType>(m_pComboAudioController->itemData(m_pComboAudioController->currentIndex()).toInt());
     141    newAudioData.m_audioControllerType = m_pAudioControllerEditor->value();
    142142    newAudioData.m_fAudioOutputEnabled = m_pCheckBoxAudioOutput->isChecked();
    143143    newAudioData.m_fAudioInputEnabled = m_pCheckBoxAudioInput->isChecked();
     
    163163    /* Translate generated strings: */
    164164    Ui::UIMachineSettingsAudio::retranslateUi(this);
    165 
    166     /* Translate audio-controller combo.
    167      * Make sure this order corresponds the same in prepare(): */
    168     int iIndex = -1;
    169     m_pComboAudioController->setItemText(++iIndex, gpConverter->toString(KAudioControllerType_HDA));
    170     m_pComboAudioController->setItemText(++iIndex, gpConverter->toString(KAudioControllerType_AC97));
    171     m_pComboAudioController->setItemText(++iIndex, gpConverter->toString(KAudioControllerType_SB16));
    172165}
    173166
     
    178171    m_pAudioHostDriverLabel->setEnabled(isMachineOffline());
    179172    m_pAudioHostDriverEditor->setEnabled(isMachineOffline());
    180     m_pLabelAudioController->setEnabled(isMachineOffline());
    181     m_pComboAudioController->setEnabled(isMachineOffline());
     173    m_pAudioControllerLabel->setEnabled(isMachineOffline());
     174    m_pAudioControllerEditor->setEnabled(isMachineOffline());
    182175    m_pLabelAudioExtended->setEnabled(isMachineInValidMode());
    183176    m_pCheckBoxAudioOutput->setEnabled(isMachineInValidMode());
     
    205198        }
    206199
    207         /* Audio-controller combo-box created in the .ui file. */
    208         AssertPtrReturnVoid(m_pComboAudioController);
     200        /* Audio controller label & editor created in the .ui file. */
     201        AssertPtrReturnVoid(m_pAudioControllerLabel);
     202        AssertPtrReturnVoid(m_pAudioControllerEditor);
    209203        {
    210             /* Configure combo-box.
    211              * Make sure this order corresponds the same in retranslateUi(): */
    212             int iIndex = -1;
    213             m_pComboAudioController->insertItem(++iIndex, "", KAudioControllerType_HDA);
    214             m_pComboAudioController->insertItem(++iIndex, "", KAudioControllerType_AC97);
    215             m_pComboAudioController->insertItem(++iIndex, "", KAudioControllerType_SB16);
     204            /* Configure label & editor: */
     205            m_pAudioControllerLabel->setBuddy(m_pAudioControllerEditor->focusProxy());
    216206        }
    217207    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.ui

    r80079 r80081  
    6363         <item row="0" column="1">
    6464          <widget class="UIAudioHostDriverEditor" name="m_pAudioHostDriverEditor">
    65            <property name="sizePolicy">
    66             <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
    67              <horstretch>1</horstretch>
    68              <verstretch>0</verstretch>
    69             </sizepolicy>
    70            </property>
    7165           <property name="whatsThis">
    7266            <string>Selects the audio output driver. The &lt;b>Null Audio Driver&lt;/b> makes the guest see an audio card, however every access to it will be ignored.</string>
     
    7569         </item>
    7670         <item row="1" column="0">
    77           <widget class="QLabel" name="m_pLabelAudioController">
     71          <widget class="QLabel" name="m_pAudioControllerLabel">
    7872           <property name="text">
    7973            <string>Audio &amp;Controller:</string>
     
    8276            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    8377           </property>
    84            <property name="buddy">
    85             <cstring>m_pComboAudioController</cstring>
    86            </property>
    8778          </widget>
    8879         </item>
    8980         <item row="1" column="1">
    90           <widget class="QComboBox" name="m_pComboAudioController">
    91            <property name="sizePolicy">
    92             <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
    93              <horstretch>1</horstretch>
    94              <verstretch>0</verstretch>
    95             </sizepolicy>
    96            </property>
     81          <widget class="UIAudioControllerEditor" name="m_pAudioControllerEditor">
    9782           <property name="whatsThis">
    9883            <string>Selects the type of the virtual sound card. Depending on this value, VirtualBox will provide different audio hardware to the virtual machine.</string>
     
    166151 <customwidgets>
    167152  <customwidget>
     153   <class>UIAudioControllerEditor</class>
     154   <extends>QWidget</extends>
     155   <header>UIAudioControllerEditor.h</header>
     156  </customwidget>
     157  <customwidget>
    168158   <class>UIAudioHostDriverEditor</class>
    169159   <extends>QWidget</extends>
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIAudioControllerEditor.cpp

    r80079 r80081  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIAudioHostDriverEditor class implementation.
     3 * VBox Qt GUI - UIAudioControllerEditor class implementation.
    44 */
    55
     
    2424#include "QIComboBox.h"
    2525#include "UIConverter.h"
    26 #include "UIAudioHostDriverEditor.h"
     26#include "UIAudioControllerEditor.h"
    2727
    2828
    29 UIAudioHostDriverEditor::UIAudioHostDriverEditor(QWidget *pParent /* = 0 */, bool fWithLabel /* = false */)
     29UIAudioControllerEditor::UIAudioControllerEditor(QWidget *pParent /* = 0 */, bool fWithLabel /* = false */)
    3030    : QIWithRetranslateUI<QWidget>(pParent)
    3131    , m_fWithLabel(fWithLabel)
     
    3636}
    3737
    38 void UIAudioHostDriverEditor::setValue(KAudioDriverType enmValue)
     38void UIAudioControllerEditor::setValue(KAudioControllerType enmValue)
    3939{
    4040    if (m_pCombo)
     
    4646}
    4747
    48 KAudioDriverType UIAudioHostDriverEditor::value() const
     48KAudioControllerType UIAudioControllerEditor::value() const
    4949{
    50     return m_pCombo ? m_pCombo->itemData(m_pCombo->currentIndex()).value<KAudioDriverType>() : KAudioDriverType_Null;
     50    return m_pCombo ? m_pCombo->itemData(m_pCombo->currentIndex()).value<KAudioControllerType>() : KAudioControllerType_AC97;
    5151}
    5252
    53 void UIAudioHostDriverEditor::retranslateUi()
     53void UIAudioControllerEditor::retranslateUi()
    5454{
    5555    if (m_pLabel)
    56         m_pLabel->setText(tr("Host Audio &Driver:"));
     56        m_pLabel->setText(tr("Audio &Controller:"));
    5757    if (m_pCombo)
    5858    {
    5959        for (int i = 0; i < m_pCombo->count(); ++i)
    6060        {
    61             const KAudioDriverType enmType = m_pCombo->itemData(i).value<KAudioDriverType>();
     61            const KAudioControllerType enmType = m_pCombo->itemData(i).value<KAudioControllerType>();
    6262            m_pCombo->setItemText(i, gpConverter->toString(enmType));
    6363        }
     
    6565}
    6666
    67 void UIAudioHostDriverEditor::sltHandleCurrentIndexChanged()
     67void UIAudioControllerEditor::sltHandleCurrentIndexChanged()
    6868{
    6969    if (m_pCombo)
    70         emit sigValueChanged(m_pCombo->itemData(m_pCombo->currentIndex()).value<KAudioDriverType>());
     70        emit sigValueChanged(m_pCombo->itemData(m_pCombo->currentIndex()).value<KAudioControllerType>());
    7171}
    7272
    73 void UIAudioHostDriverEditor::prepare()
     73void UIAudioControllerEditor::prepare()
    7474{
    7575    /* Create main layout: */
     
    9898                    m_pLabel->setBuddy(m_pCombo->focusProxy());
    9999                connect(m_pCombo, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged),
    100                         this, &UIAudioHostDriverEditor::sltHandleCurrentIndexChanged);
     100                        this, &UIAudioControllerEditor::sltHandleCurrentIndexChanged);
    101101                pComboLayout->addWidget(m_pCombo);
    102102            }
     
    117117}
    118118
    119 void UIAudioHostDriverEditor::populateCombo()
     119void UIAudioControllerEditor::populateCombo()
    120120{
    121121    /* Fill combo manually: */
    122     m_pCombo->addItem(QString(), QVariant::fromValue(KAudioDriverType_Null));
    123 #ifdef Q_OS_WIN
    124     m_pCombo->addItem(QString(), QVariant::fromValue(KAudioDriverType_DirectSound));
    125 # ifdef VBOX_WITH_WINMM
    126     m_pCombo->addItem(QString(), QVariant::fromValue(KAudioDriverType_WinMM));
    127 # endif
    128 #endif
    129 #ifdef VBOX_WITH_AUDIO_OSS
    130     m_pCombo->addItem(QString(), QVariant::fromValue(KAudioDriverType_OSS));
    131 #endif
    132 #ifdef VBOX_WITH_AUDIO_ALSA
    133     m_pCombo->addItem(QString(), QVariant::fromValue(KAudioDriverType_ALSA));
    134 #endif
    135 #ifdef VBOX_WITH_AUDIO_PULSE
    136     m_pCombo->addItem(QString(), QVariant::fromValue(KAudioDriverType_Pulse));
    137 #endif
    138 #ifdef Q_OS_MACX
    139     m_pCombo->addItem(QString(), QVariant::fromValue(KAudioDriverType_CoreAudio));
    140 #endif
     122    m_pCombo->addItem(QString(), QVariant::fromValue(KAudioControllerType_HDA));
     123    m_pCombo->addItem(QString(), QVariant::fromValue(KAudioControllerType_AC97));
     124    m_pCombo->addItem(QString(), QVariant::fromValue(KAudioControllerType_SB16));
    141125}
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIAudioControllerEditor.h

    r80079 r80081  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIAudioHostDriverEditor class declaration.
     3 * VBox Qt GUI - UIAudioControllerEditor class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_widgets_UIAudioHostDriverEditor_h
    19 #define FEQT_INCLUDED_SRC_widgets_UIAudioHostDriverEditor_h
     18#ifndef FEQT_INCLUDED_SRC_widgets_UIAudioControllerEditor_h
     19#define FEQT_INCLUDED_SRC_widgets_UIAudioControllerEditor_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    3636class QIComboBox;
    3737
    38 /** QWidget subclass used as a audio host driver editor. */
    39 class SHARED_LIBRARY_STUFF UIAudioHostDriverEditor : public QIWithRetranslateUI<QWidget>
     38/** QWidget subclass used as an audio controller editor. */
     39class SHARED_LIBRARY_STUFF UIAudioControllerEditor : public QIWithRetranslateUI<QWidget>
    4040{
    4141    Q_OBJECT;
     
    4444
    4545    /** Notifies listeners about @a enmValue change. */
    46     void sigValueChanged(KAudioDriverType enmValue);
     46    void sigValueChanged(KAudioControllerType enmValue);
    4747
    4848public:
    4949
    50     /** Constructs audio host driver editor passing @a pParent to the base-class.
     50    /** Constructs audio controller editor passing @a pParent to the base-class.
    5151      * @param  fWithLabel  Brings whether we should add label ourselves. */
    52     UIAudioHostDriverEditor(QWidget *pParent = 0, bool fWithLabel = false);
     52    UIAudioControllerEditor(QWidget *pParent = 0, bool fWithLabel = false);
    5353
    5454    /** Defines editor @a enmValue. */
    55     void setValue(KAudioDriverType enmValue);
     55    void setValue(KAudioControllerType enmValue);
    5656    /** Returns editor value. */
    57     KAudioDriverType value() const;
     57    KAudioControllerType value() const;
    5858
    5959protected:
     
    8383};
    8484
    85 #endif /* !FEQT_INCLUDED_SRC_widgets_UIAudioHostDriverEditor_h */
     85#endif /* !FEQT_INCLUDED_SRC_widgets_UIAudioControllerEditor_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIAudioHostDriverEditor.h

    r80079 r80081  
    3636class QIComboBox;
    3737
    38 /** QWidget subclass used as a audio host driver editor. */
     38/** QWidget subclass used as an audio host driver editor. */
    3939class SHARED_LIBRARY_STUFF UIAudioHostDriverEditor : public QIWithRetranslateUI<QWidget>
    4040{
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