Changeset 94039 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 1, 2022 1:10:19 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp
r93998 r94039 1081 1081 { 1082 1082 /* Prepare editor: */ 1083 UIAudioHostDriverEditor *pEditor = new UIAudioHostDriverEditor(pPopup , true /* with label */);1083 UIAudioHostDriverEditor *pEditor = new UIAudioHostDriverEditor(pPopup); 1084 1084 if (pEditor) 1085 1085 { … … 1113 1113 { 1114 1114 /* Prepare editor: */ 1115 UIAudioControllerEditor *pEditor = new UIAudioControllerEditor(pPopup , true /* with label */);1115 UIAudioControllerEditor *pEditor = new UIAudioControllerEditor(pPopup); 1116 1116 if (pEditor) 1117 1117 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIAudioControllerEditor.cpp
r93115 r94039 17 17 18 18 /* Qt includes: */ 19 #include <QComboBox> 19 20 #include <QGridLayout> 20 21 #include <QHBoxLayout> … … 22 23 23 24 /* GUI includes: */ 24 #include "QIComboBox.h"25 25 #include "UICommon.h" 26 26 #include "UIConverter.h" … … 31 31 32 32 33 UIAudioControllerEditor::UIAudioControllerEditor(QWidget *pParent /* = 0 */ , bool fWithLabel /* = false */)33 UIAudioControllerEditor::UIAudioControllerEditor(QWidget *pParent /* = 0 */) 34 34 : QIWithRetranslateUI<QWidget>(pParent) 35 , m_fWithLabel(fWithLabel)36 35 , m_enmValue(KAudioControllerType_Max) 37 36 , m_pLabel(0) … … 65 64 } 66 65 66 int UIAudioControllerEditor::minimumLabelHorizontalHint() const 67 { 68 return m_pLabel->minimumSizeHint().width(); 69 } 70 71 void UIAudioControllerEditor::setMinimumLayoutIndent(int iIndent) 72 { 73 if (m_pLayout) 74 m_pLayout->setColumnMinimumWidth(0, iIndent); 75 } 76 67 77 void UIAudioControllerEditor::retranslateUi() 68 78 { … … 76 86 m_pCombo->setItemText(i, gpConverter->toString(enmType)); 77 87 } 88 m_pCombo->setToolTip(tr("Selects the type of the virtual sound card. Depending on this value, " 89 "VirtualBox will provide different audio hardware to the virtual machine.")); 78 90 } 79 91 } … … 88 100 { 89 101 /* Create main layout: */ 90 QGridLayout *pMainLayout = new QGridLayout(this);91 if ( pMainLayout)102 m_pLayout = new QGridLayout(this); 103 if (m_pLayout) 92 104 { 93 pMainLayout->setContentsMargins(0, 0, 0, 0); 94 int iRow = 0; 105 m_pLayout->setContentsMargins(0, 0, 0, 0); 95 106 96 107 /* Create label: */ 97 if (m_fWithLabel) 98 m_pLabel = new QLabel(this); 108 m_pLabel = new QLabel(this); 99 109 if (m_pLabel) 100 pMainLayout->addWidget(m_pLabel, 0, iRow++, 1, 1); 110 { 111 m_pLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 112 m_pLayout->addWidget(m_pLabel, 0, 0); 113 } 101 114 102 115 /* Create combo layout: */ … … 105 118 { 106 119 /* Create combo: */ 107 m_pCombo = new Q IComboBox(this);120 m_pCombo = new QComboBox(this); 108 121 if (m_pCombo) 109 122 { 110 setFocusProxy(m_pCombo->focusProxy());111 123 /* This is necessary since contents is dynamical now: */ 112 124 m_pCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents); 113 125 if (m_pLabel) 114 m_pLabel->setBuddy(m_pCombo ->focusProxy());115 connect(m_pCombo, static_cast<void(Q IComboBox::*)(int)>(&QIComboBox::currentIndexChanged),126 m_pLabel->setBuddy(m_pCombo); 127 connect(m_pCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 116 128 this, &UIAudioControllerEditor::sltHandleCurrentIndexChanged); 117 129 pComboLayout->addWidget(m_pCombo); … … 122 134 123 135 /* Add combo-layout into main-layout: */ 124 pMainLayout->addLayout(pComboLayout, 0, iRow++, 1, 1);136 m_pLayout->addLayout(pComboLayout, 0, 1); 125 137 } 126 138 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIAudioControllerEditor.h
r93990 r94039 33 33 34 34 /* Forward declarations: */ 35 class QComboBox; 36 class QGridLayout; 35 37 class QLabel; 36 class QIComboBox;37 38 38 39 /** QWidget subclass used as an audio controller editor. */ … … 48 49 public: 49 50 50 /** Constructs audio controller editor passing @a pParent to the base-class. 51 * @param fWithLabel Brings whether we should add label ourselves. */ 52 UIAudioControllerEditor(QWidget *pParent = 0, bool fWithLabel = false); 51 /** Constructs audio controller editor passing @a pParent to the base-class. */ 52 UIAudioControllerEditor(QWidget *pParent = 0); 53 53 54 54 /** Defines editor @a enmValue. */ … … 59 59 /** Returns the vector of supported values. */ 60 60 QVector<KAudioControllerType> supportedValues() const { return m_supportedValues; } 61 62 /** Returns minimum layout hint. */ 63 int minimumLabelHorizontalHint() const; 64 /** Defines minimum layout @a iIndent. */ 65 void setMinimumLayoutIndent(int iIndent); 61 66 62 67 protected: … … 77 82 void populateCombo(); 78 83 79 /** Holds whether descriptive label should be created. */80 bool m_fWithLabel;81 82 84 /** Holds the value to be selected. */ 83 85 KAudioControllerType m_enmValue; … … 86 88 QVector<KAudioControllerType> m_supportedValues; 87 89 90 /** Holds the main layout instance. */ 91 QGridLayout *m_pLayout; 88 92 /** Holds the label instance. */ 89 QLabel *m_pLabel;93 QLabel *m_pLabel; 90 94 /** Holds the combo instance. */ 91 Q IComboBox*m_pCombo;95 QComboBox *m_pCombo; 92 96 }; 93 97 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIAudioHostDriverEditor.cpp
r93115 r94039 17 17 18 18 /* Qt includes: */ 19 #include <QComboBox> 19 20 #include <QGridLayout> 20 21 #include <QHBoxLayout> … … 22 23 23 24 /* GUI includes: */ 24 #include "QIComboBox.h"25 25 #include "UICommon.h" 26 26 #include "UIConverter.h" … … 31 31 32 32 33 UIAudioHostDriverEditor::UIAudioHostDriverEditor(QWidget *pParent /* = 0 */ , bool fWithLabel /* = false */)33 UIAudioHostDriverEditor::UIAudioHostDriverEditor(QWidget *pParent /* = 0 */) 34 34 : QIWithRetranslateUI<QWidget>(pParent) 35 , m_fWithLabel(fWithLabel)36 35 , m_enmValue(KAudioDriverType_Max) 37 36 , m_pLabel(0) … … 65 64 } 66 65 66 int UIAudioHostDriverEditor::minimumLabelHorizontalHint() const 67 { 68 return m_pLabel->minimumSizeHint().width(); 69 } 70 71 void UIAudioHostDriverEditor::setMinimumLayoutIndent(int iIndent) 72 { 73 if (m_pLayout) 74 m_pLayout->setColumnMinimumWidth(0, iIndent); 75 } 76 67 77 void UIAudioHostDriverEditor::retranslateUi() 68 78 { … … 76 86 m_pCombo->setItemText(i, gpConverter->toString(enmType)); 77 87 } 88 m_pCombo->setToolTip(tr("Selects the audio output driver. The <b>Null Audio Driver</b> makes the guest " 89 "see an audio card, however every access to it will be ignored.")); 78 90 } 79 91 } … … 88 100 { 89 101 /* Create main layout: */ 90 QGridLayout *pMainLayout = new QGridLayout(this);91 if ( pMainLayout)102 m_pLayout = new QGridLayout(this); 103 if (m_pLayout) 92 104 { 93 pMainLayout->setContentsMargins(0, 0, 0, 0); 94 int iRow = 0; 105 m_pLayout->setContentsMargins(0, 0, 0, 0); 95 106 96 107 /* Create label: */ 97 if (m_fWithLabel) 98 m_pLabel = new QLabel(this); 108 m_pLabel = new QLabel(this); 99 109 if (m_pLabel) 100 pMainLayout->addWidget(m_pLabel, 0, iRow++, 1, 1); 110 { 111 m_pLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 112 m_pLayout->addWidget(m_pLabel, 0, 0); 113 } 101 114 102 115 /* Create combo layout: */ … … 105 118 { 106 119 /* Create combo: */ 107 m_pCombo = new Q IComboBox(this);120 m_pCombo = new QComboBox(this); 108 121 if (m_pCombo) 109 122 { 110 setFocusProxy(m_pCombo->focusProxy());111 123 /* This is necessary since contents is dynamical now: */ 112 124 m_pCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents); 113 125 if (m_pLabel) 114 m_pLabel->setBuddy(m_pCombo ->focusProxy());115 connect(m_pCombo, static_cast<void(Q IComboBox::*)(int)>(&QIComboBox::currentIndexChanged),126 m_pLabel->setBuddy(m_pCombo); 127 connect(m_pCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 116 128 this, &UIAudioHostDriverEditor::sltHandleCurrentIndexChanged); 117 129 pComboLayout->addWidget(m_pCombo); … … 122 134 123 135 /* Add combo-layout into main-layout: */ 124 pMainLayout->addLayout(pComboLayout, 0, iRow++, 1, 1);136 m_pLayout->addLayout(pComboLayout, 0, 1); 125 137 } 126 138 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIAudioHostDriverEditor.h
r93990 r94039 33 33 34 34 /* Forward declarations: */ 35 class QComboBox; 36 class QGridLayout; 35 37 class QLabel; 36 class QIComboBox;37 38 38 39 /** QWidget subclass used as an audio host driver editor. */ … … 48 49 public: 49 50 50 /** Constructs audio host driver editor passing @a pParent to the base-class. 51 * @param fWithLabel Brings whether we should add label ourselves. */ 52 UIAudioHostDriverEditor(QWidget *pParent = 0, bool fWithLabel = false); 51 /** Constructs audio host driver editor passing @a pParent to the base-class. */ 52 UIAudioHostDriverEditor(QWidget *pParent = 0); 53 53 54 54 /** Defines editor @a enmValue. */ … … 59 59 /** Returns the vector of supported values. */ 60 60 QVector<KAudioDriverType> supportedValues() const { return m_supportedValues; } 61 62 /** Returns minimum layout hint. */ 63 int minimumLabelHorizontalHint() const; 64 /** Defines minimum layout @a iIndent. */ 65 void setMinimumLayoutIndent(int iIndent); 61 66 62 67 protected: … … 77 82 void populateCombo(); 78 83 79 /** Holds whether descriptive label should be created. */80 bool m_fWithLabel;81 82 84 /** Holds the value to be selected. */ 83 85 KAudioDriverType m_enmValue; … … 86 88 QVector<KAudioDriverType> m_supportedValues; 87 89 90 /** Holds the main layout instance. */ 91 QGridLayout *m_pLayout; 88 92 /** Holds the label instance. */ 89 QLabel *m_pLabel;93 QLabel *m_pLabel; 90 94 /** Holds the combo instance. */ 91 Q IComboBox*m_pCombo;95 QComboBox *m_pCombo; 92 96 }; 93 97 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
r93829 r94039 78 78 , m_pCheckBoxAudio(0) 79 79 , m_pWidgetAudioSettings(0) 80 , m_pLa belAudioHostDriver(0)80 , m_pLayoutAudioSettings(0) 81 81 , m_pEditorAudioHostDriver(0) 82 , m_pLabelAudioController(0)83 82 , m_pEditorAudioController(0) 84 83 , m_pLabelAudioExtended(0) … … 86 85 , m_pCheckBoxAudioInput(0) 87 86 { 88 /* Prepare: */89 87 prepare(); 90 88 } … … 92 90 UIMachineSettingsAudio::~UIMachineSettingsAudio() 93 91 { 94 /* Cleanup: */95 92 cleanup(); 96 93 } … … 177 174 void UIMachineSettingsAudio::retranslateUi() 178 175 { 176 m_pCheckBoxAudio->setText(tr("Enable &Audio")); 179 177 m_pCheckBoxAudio->setToolTip(tr("When checked, a virtual PCI audio card will be plugged into the virtual machine " 180 178 "and will communicate with the host audio system using the specified driver.")); 181 m_pCheckBoxAudio->setText(tr("Enable &Audio"));182 m_pLabelAudioHostDriver->setText(tr("Host Audio &Driver:"));183 m_pEditorAudioHostDriver->setToolTip(tr("Selects the audio output driver. The <b>Null Audio Driver</b> makes the guest "184 "see an audio card, however every access to it will be ignored."));185 m_pLabelAudioController->setText(tr("Audio &Controller:"));186 m_pEditorAudioController->setToolTip(tr("Selects the type of the virtual sound card. Depending on this value, "187 "VirtualBox will provide different audio hardware to the virtual machine."));188 179 m_pLabelAudioExtended->setText(tr("Extended Features:")); 180 m_pCheckBoxAudioOutput->setText(tr("Enable Audio &Output")); 189 181 m_pCheckBoxAudioOutput->setToolTip(tr("When checked, output to the virtual audio device will reach the host. " 190 182 "Otherwise the guest is muted.")); 191 m_pCheckBoxAudio Output->setText(tr("Enable Audio &Output"));183 m_pCheckBoxAudioInput->setText(tr("Enable Audio &Input")); 192 184 m_pCheckBoxAudioInput->setToolTip(tr("When checked, the guest will be able to capture audio input from the host. " 193 185 "Otherwise the guest will capture only silence.")); 194 m_pCheckBoxAudioInput->setText(tr("Enable Audio &Input")); 186 187 /* These editors have own labels, but we want them to be properly layouted according to each other: */ 188 int iMinimumLayoutHint = 0; 189 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorAudioHostDriver->minimumLabelHorizontalHint()); 190 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorAudioController->minimumLabelHorizontalHint()); 191 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelAudioExtended->minimumSizeHint().width()); 192 m_pEditorAudioHostDriver->setMinimumLayoutIndent(iMinimumLayoutHint); 193 m_pEditorAudioController->setMinimumLayoutIndent(iMinimumLayoutHint); 194 m_pLayoutAudioSettings->setColumnMinimumWidth(0, iMinimumLayoutHint); 195 195 } 196 196 … … 199 199 /* Polish audio page availability: */ 200 200 m_pCheckBoxAudio->setEnabled(isMachineOffline()); 201 m_pLabelAudioHostDriver->setEnabled(isMachineOffline() || isMachineSaved());202 201 m_pEditorAudioHostDriver->setEnabled(isMachineOffline() || isMachineSaved()); 203 m_pLabelAudioController->setEnabled(isMachineOffline());204 202 m_pEditorAudioController->setEnabled(isMachineOffline()); 205 203 m_pLabelAudioExtended->setEnabled(isMachineInValidMode()); … … 246 244 { 247 245 /* Prepare audio settings widget layout: */ 248 QGridLayout *pLayoutAudioSettings = new QGridLayout(m_pWidgetAudioSettings); 249 if (pLayoutAudioSettings) 250 { 251 pLayoutAudioSettings->setContentsMargins(0, 0, 0, 0); 252 pLayoutAudioSettings->setColumnStretch(1, 1); 253 254 /* Prepare audio host driver label: */ 255 m_pLabelAudioHostDriver = new QLabel(m_pWidgetAudioSettings); 256 if (m_pLabelAudioHostDriver) 257 { 258 m_pLabelAudioHostDriver->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 259 pLayoutAudioSettings->addWidget(m_pLabelAudioHostDriver, 0, 0); 260 } 246 m_pLayoutAudioSettings = new QGridLayout(m_pWidgetAudioSettings); 247 if (m_pLayoutAudioSettings) 248 { 249 m_pLayoutAudioSettings->setContentsMargins(0, 0, 0, 0); 250 m_pLayoutAudioSettings->setColumnStretch(1, 1); 251 261 252 /* Prepare audio host driver editor: */ 262 253 m_pEditorAudioHostDriver = new UIAudioHostDriverEditor(m_pWidgetAudioSettings); 263 254 if (m_pEditorAudioHostDriver) 264 { 265 if (m_pLabelAudioHostDriver) 266 m_pLabelAudioHostDriver->setBuddy(m_pEditorAudioHostDriver->focusProxy()); 267 pLayoutAudioSettings->addWidget(m_pEditorAudioHostDriver, 0, 1, 1, 2); 268 } 269 270 /* Prepare audio host controller label: */ 271 m_pLabelAudioController = new QLabel(m_pWidgetAudioSettings); 272 if (m_pLabelAudioController) 273 { 274 m_pLabelAudioController->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 275 pLayoutAudioSettings->addWidget(m_pLabelAudioController, 1, 0); 276 } 255 m_pLayoutAudioSettings->addWidget(m_pEditorAudioHostDriver, 0, 0, 1, 3); 256 277 257 /* Prepare audio host controller editor: */ 278 258 m_pEditorAudioController = new UIAudioControllerEditor(m_pWidgetAudioSettings); 279 259 if (m_pEditorAudioController) 280 { 281 if (m_pLabelAudioController) 282 m_pLabelAudioController->setBuddy(m_pEditorAudioController->focusProxy()); 283 pLayoutAudioSettings->addWidget(m_pEditorAudioController, 1, 1, 1, 2); 284 } 260 m_pLayoutAudioSettings->addWidget(m_pEditorAudioController, 1, 0, 1, 3); 285 261 286 262 /* Prepare audio extended label: */ … … 289 265 { 290 266 m_pLabelAudioExtended->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 291 pLayoutAudioSettings->addWidget(m_pLabelAudioExtended, 2, 0);267 m_pLayoutAudioSettings->addWidget(m_pLabelAudioExtended, 2, 0); 292 268 } 293 269 /* Prepare audio output check-box: */ 294 270 m_pCheckBoxAudioOutput = new QCheckBox(m_pWidgetAudioSettings); 295 271 if (m_pCheckBoxAudioOutput) 296 pLayoutAudioSettings->addWidget(m_pCheckBoxAudioOutput, 2, 1);272 m_pLayoutAudioSettings->addWidget(m_pCheckBoxAudioOutput, 2, 1); 297 273 /* Prepare audio input check-box: */ 298 274 m_pCheckBoxAudioInput = new QCheckBox(m_pWidgetAudioSettings); 299 275 if (m_pCheckBoxAudioInput) 300 pLayoutAudioSettings->addWidget(m_pCheckBoxAudioInput, 3, 1);276 m_pLayoutAudioSettings->addWidget(m_pCheckBoxAudioInput, 3, 1); 301 277 } 302 278 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h
r93990 r94039 27 27 /* Forward declarations: */ 28 28 class QCheckBox; 29 class QGridLayout; 29 30 class QLabel; 30 31 class UIAudioControllerEditor; … … 93 94 /** Holds the audio settings widget instance. */ 94 95 QWidget *m_pWidgetAudioSettings; 95 /** Holds the audio host driver labelinstance. */96 Q Label *m_pLabelAudioHostDriver;96 /** Holds the audio settings layout instance. */ 97 QGridLayout *m_pLayoutAudioSettings; 97 98 /** Holds the audio host driver editor instance. */ 98 99 UIAudioHostDriverEditor *m_pEditorAudioHostDriver; 99 /** Holds the audio host controller label instance. */100 QLabel *m_pLabelAudioController;101 100 /** Holds the audio host controller instance instance. */ 102 101 UIAudioControllerEditor *m_pEditorAudioController;
Note:
See TracChangeset
for help on using the changeset viewer.