Changeset 85883 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Aug 25, 2020 11:35:49 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
r85710 r85883 76 76 UIMachineSettingsAudio::UIMachineSettingsAudio() 77 77 : m_pCache(0) 78 , m_pCheckBoxAudio(0) 79 , m_pWidgetAudioSettings(0) 78 80 , m_pAudioHostDriverLabel(0) 81 , m_pAudioHostDriverEditor(0) 79 82 , m_pAudioControllerLabel(0) 83 , m_pAudioControllerEditor(0) 80 84 , m_pLabelAudioExtended(0) 81 , m_pContainerAudioSubOptions(0) 82 , m_pAudioHostDriverEditor(0) 83 , m_pAudioControllerEditor(0) 85 , m_pCheckBoxAudioOutput(0) 86 , m_pCheckBoxAudioInput(0) 84 87 { 85 88 /* Prepare: */ … … 208 211 m_pCheckBoxAudioOutput->setEnabled(isMachineInValidMode()); 209 212 m_pCheckBoxAudioInput->setEnabled(isMachineInValidMode()); 210 m_p ContainerAudioSubOptions->setEnabled(m_pCheckBoxAudio->isChecked());213 m_pWidgetAudioSettings->setEnabled(m_pCheckBoxAudio->isChecked()); 211 214 } 212 215 213 216 void UIMachineSettingsAudio::prepare() 214 217 { 215 prepareWidgets();216 217 218 /* Prepare cache: */ 218 219 m_pCache = new UISettingsCacheMachineAudio; 219 220 AssertPtrReturnVoid(m_pCache); 220 221 221 /* Layout created in the .ui file. */ 222 /* Prepare everything: */ 223 prepareWidgets(); 224 prepareConnections(); 225 226 /* Apply language settings: */ 227 retranslateUi(); 228 } 229 230 void UIMachineSettingsAudio::prepareWidgets() 231 { 232 /* Prepare main layout: */ 233 QGridLayout *pMainLayout = new QGridLayout(this); 234 if (pMainLayout) 222 235 { 223 /* Audio host-driver label & editor created in the .ui file. */ 224 AssertPtrReturnVoid(m_pAudioHostDriverLabel); 225 AssertPtrReturnVoid(m_pAudioHostDriverEditor); 236 pMainLayout->setRowStretch(2, 1); 237 238 /* Prepare audio check-box: */ 239 m_pCheckBoxAudio = new QCheckBox(this); 240 if (m_pCheckBoxAudio) 241 pMainLayout->addWidget(m_pCheckBoxAudio, 0, 0, 1, 2); 242 243 /* Prepare 20-px shifting spacer: */ 244 QSpacerItem *pSpacerItem = new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum); 245 if (pSpacerItem) 246 pMainLayout->addItem(pSpacerItem, 1, 0); 247 248 /* Prepare audio settings widget: */ 249 m_pWidgetAudioSettings = new QWidget(this); 250 if (m_pWidgetAudioSettings) 226 251 { 227 /* Configure label & editor: */ 228 m_pAudioHostDriverLabel->setBuddy(m_pAudioHostDriverEditor->focusProxy()); 229 } 230 231 /* Audio controller label & editor created in the .ui file. */ 232 AssertPtrReturnVoid(m_pAudioControllerLabel); 233 AssertPtrReturnVoid(m_pAudioControllerEditor); 234 { 235 /* Configure label & editor: */ 236 m_pAudioControllerLabel->setBuddy(m_pAudioControllerEditor->focusProxy()); 252 /* Prepare audio settings widget layout: */ 253 QGridLayout *pLayoutAudioSettings = new QGridLayout(m_pWidgetAudioSettings); 254 if (pLayoutAudioSettings) 255 { 256 pLayoutAudioSettings->setContentsMargins(0, 0, 0, 0); 257 258 /* Prepare host driver label: */ 259 m_pAudioHostDriverLabel = new QLabel(m_pWidgetAudioSettings); 260 if (m_pAudioHostDriverLabel) 261 { 262 m_pAudioHostDriverLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 263 pLayoutAudioSettings->addWidget(m_pAudioHostDriverLabel, 0, 0); 264 } 265 /* Prepare host driver editor: */ 266 m_pAudioHostDriverEditor = new UIAudioHostDriverEditor(m_pWidgetAudioSettings); 267 if (m_pAudioHostDriverEditor) 268 { 269 m_pAudioHostDriverLabel->setBuddy(m_pAudioHostDriverEditor->focusProxy()); 270 pLayoutAudioSettings->addWidget(m_pAudioHostDriverEditor, 0, 1); 271 } 272 273 /* Prepare host controller label: */ 274 m_pAudioControllerLabel = new QLabel(m_pWidgetAudioSettings); 275 if (m_pAudioControllerLabel) 276 { 277 m_pAudioControllerLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 278 pLayoutAudioSettings->addWidget(m_pAudioControllerLabel, 1, 0); 279 } 280 /* Prepare host controller editor: */ 281 m_pAudioControllerEditor = new UIAudioControllerEditor(m_pWidgetAudioSettings); 282 if (m_pAudioControllerEditor) 283 { 284 m_pAudioControllerLabel->setBuddy(m_pAudioControllerEditor->focusProxy()); 285 pLayoutAudioSettings->addWidget(m_pAudioControllerEditor, 1, 1); 286 } 287 288 /* Prepare extended label: */ 289 m_pLabelAudioExtended = new QLabel(m_pWidgetAudioSettings); 290 if (m_pLabelAudioExtended) 291 { 292 m_pLabelAudioExtended->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 293 pLayoutAudioSettings->addWidget(m_pLabelAudioExtended, 2, 0); 294 } 295 /* Prepare output check-box: */ 296 m_pCheckBoxAudioOutput = new QCheckBox(m_pWidgetAudioSettings); 297 if (m_pCheckBoxAudioOutput) 298 pLayoutAudioSettings->addWidget(m_pCheckBoxAudioOutput, 2, 1); 299 /* Prepare input check-box: */ 300 m_pCheckBoxAudioInput = new QCheckBox(m_pWidgetAudioSettings); 301 if (m_pCheckBoxAudioInput) 302 pLayoutAudioSettings->addWidget(m_pCheckBoxAudioInput, 3, 1); 303 304 pMainLayout->addWidget(m_pWidgetAudioSettings, 1, 1, 1, 1); 305 } 237 306 } 238 307 } 239 240 /* Apply language settings: */ 241 retranslateUi(); 242 } 243 244 void UIMachineSettingsAudio::prepareWidgets() 245 { 246 if (objectName().isEmpty()) 247 setObjectName(QStringLiteral("UIMachineSettingsAudio")); 248 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 249 pMainLayout->setObjectName(QStringLiteral("pMainLayout")); 250 QWidget *pContainerAudioOptions = new QWidget(); 251 pContainerAudioOptions->setObjectName(QStringLiteral("pContainerAudioOptions")); 252 QGridLayout *pContainerLayoutAudioOptions = new QGridLayout(pContainerAudioOptions); 253 pContainerLayoutAudioOptions->setObjectName(QStringLiteral("pContainerLayoutAudioOptions")); 254 pContainerLayoutAudioOptions->setContentsMargins(0, 0, 0, 0); 255 m_pCheckBoxAudio = new QCheckBox(pContainerAudioOptions); 256 m_pCheckBoxAudio->setObjectName(QStringLiteral("m_pCheckBoxAudio")); 257 pContainerLayoutAudioOptions->addWidget(m_pCheckBoxAudio, 0, 0, 1, 2); 258 259 QSpacerItem *pSpacerItem = new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum); 260 pContainerLayoutAudioOptions->addItem(pSpacerItem, 1, 0, 1, 1); 261 262 m_pContainerAudioSubOptions = new QWidget(pContainerAudioOptions); 263 m_pContainerAudioSubOptions->setObjectName(QStringLiteral("m_pContainerAudioSubOptions")); 264 QGridLayout *pContainerLayoutAudioSubOptions = new QGridLayout(m_pContainerAudioSubOptions); 265 pContainerLayoutAudioSubOptions->setContentsMargins(0, 0, 0, 0); 266 pContainerLayoutAudioSubOptions->setObjectName(QStringLiteral("pContainerLayoutAudioSubOptions")); 267 pContainerLayoutAudioSubOptions->setContentsMargins(0, 0, 0, 0); 268 m_pAudioHostDriverLabel = new QLabel(m_pContainerAudioSubOptions); 269 m_pAudioHostDriverLabel->setObjectName(QStringLiteral("m_pAudioHostDriverLabel")); 270 m_pAudioHostDriverLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 271 pContainerLayoutAudioSubOptions->addWidget(m_pAudioHostDriverLabel, 0, 0, 1, 1); 272 273 m_pAudioHostDriverEditor = new UIAudioHostDriverEditor(m_pContainerAudioSubOptions); 274 m_pAudioHostDriverEditor->setObjectName(QStringLiteral("m_pAudioHostDriverEditor")); 275 pContainerLayoutAudioSubOptions->addWidget(m_pAudioHostDriverEditor, 0, 1, 1, 1); 276 277 m_pAudioControllerLabel = new QLabel(m_pContainerAudioSubOptions); 278 m_pAudioControllerLabel->setObjectName(QStringLiteral("m_pAudioControllerLabel")); 279 m_pAudioControllerLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 280 pContainerLayoutAudioSubOptions->addWidget(m_pAudioControllerLabel, 1, 0, 1, 1); 281 282 m_pAudioControllerEditor = new UIAudioControllerEditor(m_pContainerAudioSubOptions); 283 m_pAudioControllerEditor->setObjectName(QStringLiteral("m_pAudioControllerEditor")); 284 pContainerLayoutAudioSubOptions->addWidget(m_pAudioControllerEditor, 1, 1, 1, 1); 285 286 m_pLabelAudioExtended = new QLabel(m_pContainerAudioSubOptions); 287 m_pLabelAudioExtended->setObjectName(QStringLiteral("m_pLabelAudioExtended")); 288 m_pLabelAudioExtended->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 289 pContainerLayoutAudioSubOptions->addWidget(m_pLabelAudioExtended, 2, 0, 1, 1); 290 291 m_pCheckBoxAudioOutput = new QCheckBox(m_pContainerAudioSubOptions); 292 m_pCheckBoxAudioOutput->setObjectName(QStringLiteral("m_pCheckBoxAudioOutput")); 293 QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 294 sizePolicy.setHorizontalStretch(1); 295 sizePolicy.setVerticalStretch(0); 296 sizePolicy.setHeightForWidth(m_pCheckBoxAudioOutput->sizePolicy().hasHeightForWidth()); 297 m_pCheckBoxAudioOutput->setSizePolicy(sizePolicy); 298 pContainerLayoutAudioSubOptions->addWidget(m_pCheckBoxAudioOutput, 2, 1, 1, 1); 299 300 m_pCheckBoxAudioInput = new QCheckBox(m_pContainerAudioSubOptions); 301 m_pCheckBoxAudioInput->setObjectName(QStringLiteral("m_pCheckBoxAudioInput")); 302 sizePolicy.setHeightForWidth(m_pCheckBoxAudioInput->sizePolicy().hasHeightForWidth()); 303 m_pCheckBoxAudioInput->setSizePolicy(sizePolicy); 304 pContainerLayoutAudioSubOptions->addWidget(m_pCheckBoxAudioInput, 3, 1, 1, 1); 305 306 pContainerLayoutAudioOptions->addWidget(m_pContainerAudioSubOptions, 1, 1, 1, 1); 307 pMainLayout->addWidget(pContainerAudioOptions); 308 309 QSpacerItem *pSpacerItem1 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 310 pMainLayout->addItem(pSpacerItem1); 311 312 QObject::connect(m_pCheckBoxAudio, &QCheckBox::toggled, m_pContainerAudioSubOptions, &QWidget::setEnabled); 308 } 309 310 void UIMachineSettingsAudio::prepareConnections() 311 { 312 QObject::connect(m_pCheckBoxAudio, &QCheckBox::toggled, m_pWidgetAudioSettings, &QWidget::setEnabled); 313 313 } 314 314 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h
r85680 r85883 76 76 /** Prepares widgets. */ 77 77 void prepareWidgets(); 78 /** Prepares connections. */ 79 void prepareConnections(); 78 80 /** Cleanups all. */ 79 81 void cleanup(); … … 85 87 UISettingsCacheMachineAudio *m_pCache; 86 88 87 QCheckBox *m_pCheckBoxAudio;88 QCheckBox *m_pCheckBoxAudioOutput;89 QCheckBox *m_pCheckBoxAudioInput;90 91 89 /** @name Widgets 92 90 * @{ */ 93 QLabel *m_pAudioHostDriverLabel; 94 QLabel *m_pAudioControllerLabel; 95 QLabel *m_pLabelAudioExtended; 96 QWidget *m_pContainerAudioSubOptions; 91 /** Holds the audio check-box instance. */ 92 QCheckBox *m_pCheckBoxAudio; 93 /** Holds the audio settings widget instance. */ 94 QWidget *m_pWidgetAudioSettings; 95 /** Holds the host audio driver label instance. */ 96 QLabel *m_pAudioHostDriverLabel; 97 /** Holds the host audio driver editor instance. */ 97 98 UIAudioHostDriverEditor *m_pAudioHostDriverEditor; 99 /** Holds the host audio controller label instance. */ 100 QLabel *m_pAudioControllerLabel; 101 /** Holds the host audio controller instance instance. */ 98 102 UIAudioControllerEditor *m_pAudioControllerEditor; 103 /** Holds the audio extended label instance. */ 104 QLabel *m_pLabelAudioExtended; 105 /** Holds the audio output check-box instance. */ 106 QCheckBox *m_pCheckBoxAudioOutput; 107 /** Holds the audio input check-box instance. */ 108 QCheckBox *m_pCheckBoxAudioInput; 99 109 /** @} */ 100 110 };
Note:
See TracChangeset
for help on using the changeset viewer.