VirtualBox

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


Ignore:
Timestamp:
Jul 31, 2019 3:57:55 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132519
Message:

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

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

Legend:

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

    r80068 r80079  
    888888        src/settings/machine/UIMachineSettingsUSBFilterDetails.h \
    889889        src/widgets/UIAddDiskEncryptionPasswordDialog.h \
     890        src/widgets/UIAudioHostDriverEditor.h \
    890891        src/widgets/UIBaseMemoryEditor.h \
    891892        src/widgets/UIBaseMemorySlider.h \
     
    13821383        src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp \
    13831384        src/widgets/UIAddDiskEncryptionPasswordDialog.cpp \
     1385        src/widgets/UIAudioHostDriverEditor.cpp \
    13841386        src/widgets/UIBaseMemoryEditor.cpp \
    13851387        src/widgets/UIBaseMemorySlider.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp

    r76606 r80079  
    122122    /* Load old audio data from the cache: */
    123123    m_pCheckBoxAudio->setChecked(oldAudioData.m_fAudioEnabled);
    124     m_pComboAudioDriver->setCurrentIndex(m_pComboAudioDriver->findData((int)oldAudioData.m_audioDriverType));
     124    m_pAudioHostDriverEditor->setValue(oldAudioData.m_audioDriverType);
    125125    m_pComboAudioController->setCurrentIndex(m_pComboAudioController->findData((int)oldAudioData.m_audioControllerType));
    126126    m_pCheckBoxAudioOutput->setChecked(oldAudioData.m_fAudioOutputEnabled);
     
    138138    /* Gather new audio data: */
    139139    newAudioData.m_fAudioEnabled = m_pCheckBoxAudio->isChecked();
    140     newAudioData.m_audioDriverType = static_cast<KAudioDriverType>(m_pComboAudioDriver->itemData(m_pComboAudioDriver->currentIndex()).toInt());
     140    newAudioData.m_audioDriverType = m_pAudioHostDriverEditor->value();
    141141    newAudioData.m_audioControllerType = static_cast<KAudioControllerType>(m_pComboAudioController->itemData(m_pComboAudioController->currentIndex()).toInt());
    142142    newAudioData.m_fAudioOutputEnabled = m_pCheckBoxAudioOutput->isChecked();
     
    164164    Ui::UIMachineSettingsAudio::retranslateUi(this);
    165165
    166     /* Translate audio-driver combo.
     166    /* Translate audio-controller combo.
    167167     * Make sure this order corresponds the same in prepare(): */
    168168    int iIndex = -1;
    169     m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_Null));
    170 #ifdef Q_OS_WIN
    171     m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_DirectSound));
    172 # ifdef VBOX_WITH_WINMM
    173     m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_WinMM));
    174 # endif
    175 #endif
    176 #ifdef VBOX_WITH_AUDIO_OSS
    177     m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_OSS));
    178 #endif
    179 #ifdef VBOX_WITH_AUDIO_ALSA
    180     m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_ALSA));
    181 #endif
    182 #ifdef VBOX_WITH_AUDIO_PULSE
    183     m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_Pulse));
    184 #endif
    185 #ifdef Q_OS_MACX
    186     m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_CoreAudio));
    187 #endif
    188 
    189     /* Translate audio-controller combo.
    190      * Make sure this order corresponds the same in prepare(): */
    191     iIndex = -1;
    192169    m_pComboAudioController->setItemText(++iIndex, gpConverter->toString(KAudioControllerType_HDA));
    193170    m_pComboAudioController->setItemText(++iIndex, gpConverter->toString(KAudioControllerType_AC97));
     
    199176    /* Polish audio page availability: */
    200177    m_pCheckBoxAudio->setEnabled(isMachineOffline());
    201     m_pLabelAudioDriver->setEnabled(isMachineOffline());
    202     m_pComboAudioDriver->setEnabled(isMachineOffline());
     178    m_pAudioHostDriverLabel->setEnabled(isMachineOffline());
     179    m_pAudioHostDriverEditor->setEnabled(isMachineOffline());
    203180    m_pLabelAudioController->setEnabled(isMachineOffline());
    204181    m_pComboAudioController->setEnabled(isMachineOffline());
     
    220197    /* Layout created in the .ui file. */
    221198    {
    222         /* Audio-driver combo-box created in the .ui file. */
    223         AssertPtrReturnVoid(m_pComboAudioDriver);
     199        /* Audio host-driver label & editor created in the .ui file. */
     200        AssertPtrReturnVoid(m_pAudioHostDriverLabel);
     201        AssertPtrReturnVoid(m_pAudioHostDriverEditor);
    224202        {
    225             /* Configure combo-box.
    226              * Make sure this order corresponds the same in retranslateUi(): */
    227             int iIndex = -1;
    228             m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_Null);
    229 #ifdef Q_OS_WIN
    230             m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_DirectSound);
    231 # ifdef VBOX_WITH_WINMM
    232             m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_WinMM);
    233 # endif
    234 #endif
    235 #ifdef VBOX_WITH_AUDIO_OSS
    236             m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_OSS);
    237 #endif
    238 #ifdef VBOX_WITH_AUDIO_ALSA
    239             m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_ALSA);
    240 #endif
    241 #ifdef VBOX_WITH_AUDIO_PULSE
    242             m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_Pulse);
    243 #endif
    244 #ifdef Q_OS_MACX
    245             m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_CoreAudio);
    246 #endif
     203            /* Configure label & editor: */
     204            m_pAudioHostDriverLabel->setBuddy(m_pAudioHostDriverEditor->focusProxy());
    247205        }
    248206
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.ui

    r71027 r80079  
    5252         </property>
    5353         <item row="0" column="0">
    54           <widget class="QLabel" name="m_pLabelAudioDriver">
     54          <widget class="QLabel" name="m_pAudioHostDriverLabel">
    5555           <property name="text">
    5656            <string>Host Audio &amp;Driver:</string>
     
    5959            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    6060           </property>
    61            <property name="buddy">
    62             <cstring>m_pComboAudioDriver</cstring>
    63            </property>
    6461          </widget>
    6562         </item>
    6663         <item row="0" column="1">
    67           <widget class="QComboBox" name="m_pComboAudioDriver">
     64          <widget class="UIAudioHostDriverEditor" name="m_pAudioHostDriverEditor">
    6865           <property name="sizePolicy">
    6966            <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
     
    167164 </widget>
    168165 <resources/>
     166 <customwidgets>
     167  <customwidget>
     168   <class>UIAudioHostDriverEditor</class>
     169   <extends>QWidget</extends>
     170   <header>UIAudioHostDriverEditor.h</header>
     171  </customwidget>
     172 </customwidgets>
    169173 <connections>
    170174  <connection>
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIAudioHostDriverEditor.cpp

    r80072 r80079  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIGraphicsControllerEditor class implementation.
     3 * VBox Qt GUI - UIAudioHostDriverEditor class implementation.
    44 */
    55
     
    2424#include "QIComboBox.h"
    2525#include "UIConverter.h"
    26 #include "UIGraphicsControllerEditor.h"
     26#include "UIAudioHostDriverEditor.h"
    2727
    2828
    29 UIGraphicsControllerEditor::UIGraphicsControllerEditor(QWidget *pParent /* = 0 */, bool fWithLabel /* = false */)
     29UIAudioHostDriverEditor::UIAudioHostDriverEditor(QWidget *pParent /* = 0 */, bool fWithLabel /* = false */)
    3030    : QIWithRetranslateUI<QWidget>(pParent)
    3131    , m_fWithLabel(fWithLabel)
     
    3636}
    3737
    38 void UIGraphicsControllerEditor::setValue(KGraphicsControllerType enmValue)
     38void UIAudioHostDriverEditor::setValue(KAudioDriverType enmValue)
    3939{
    4040    if (m_pCombo)
     
    4646}
    4747
    48 KGraphicsControllerType UIGraphicsControllerEditor::value() const
     48KAudioDriverType UIAudioHostDriverEditor::value() const
    4949{
    50     return m_pCombo ? m_pCombo->itemData(m_pCombo->currentIndex()).value<KGraphicsControllerType>() : KGraphicsControllerType_Null;
     50    return m_pCombo ? m_pCombo->itemData(m_pCombo->currentIndex()).value<KAudioDriverType>() : KAudioDriverType_Null;
    5151}
    5252
    53 void UIGraphicsControllerEditor::retranslateUi()
     53void UIAudioHostDriverEditor::retranslateUi()
    5454{
    5555    if (m_pLabel)
    56         m_pLabel->setText(tr("&Graphics Controller:"));
     56        m_pLabel->setText(tr("Host Audio &Driver:"));
    5757    if (m_pCombo)
    5858    {
    5959        for (int i = 0; i < m_pCombo->count(); ++i)
    6060        {
    61             const KGraphicsControllerType enmType = m_pCombo->itemData(i).value<KGraphicsControllerType>();
     61            const KAudioDriverType enmType = m_pCombo->itemData(i).value<KAudioDriverType>();
    6262            m_pCombo->setItemText(i, gpConverter->toString(enmType));
    6363        }
     
    6565}
    6666
    67 void UIGraphicsControllerEditor::sltHandleCurrentIndexChanged()
     67void UIAudioHostDriverEditor::sltHandleCurrentIndexChanged()
    6868{
    6969    if (m_pCombo)
    70         emit sigValueChanged(m_pCombo->itemData(m_pCombo->currentIndex()).value<KGraphicsControllerType>());
     70        emit sigValueChanged(m_pCombo->itemData(m_pCombo->currentIndex()).value<KAudioDriverType>());
    7171}
    7272
    73 void UIGraphicsControllerEditor::prepare()
     73void UIAudioHostDriverEditor::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, &UIGraphicsControllerEditor::sltHandleCurrentIndexChanged);
     100                        this, &UIAudioHostDriverEditor::sltHandleCurrentIndexChanged);
    101101                pComboLayout->addWidget(m_pCombo);
    102102            }
     
    117117}
    118118
    119 void UIGraphicsControllerEditor::populateCombo()
     119void UIAudioHostDriverEditor::populateCombo()
    120120{
    121     for (int i = 0; i < KGraphicsControllerType_Max; ++i)
    122         m_pCombo->addItem(QString(), QVariant::fromValue(static_cast<KGraphicsControllerType>(i)));
     121    /* 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
    123141}
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIAudioHostDriverEditor.h

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