Changeset 94708 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 25, 2022 2:55:57 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r94653 r94708 896 896 src/settings/editors/UIAudioControllerEditor.h \ 897 897 src/settings/editors/UIAudioHostDriverEditor.h \ 898 src/settings/editors/UIAudioSettingsEditor.h \ 898 899 src/settings/editors/UIAutoCaptureKeyboardEditor.h \ 899 900 src/settings/editors/UIBaseMemoryEditor.h \ … … 1464 1465 src/settings/editors/UIAudioControllerEditor.cpp \ 1465 1466 src/settings/editors/UIAudioHostDriverEditor.cpp \ 1467 src/settings/editors/UIAudioSettingsEditor.cpp \ 1466 1468 src/settings/editors/UIAutoCaptureKeyboardEditor.cpp \ 1467 1469 src/settings/editors/UIBaseMemoryEditor.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIAudioSettingsEditor.cpp
r94707 r94708 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI NetworkSettingsEditor class implementation.3 * VBox Qt GUI - UIAudioSettingsEditor class implementation. 4 4 */ 5 5 … … 22 22 23 23 /* GUI includes: */ 24 #include "UINetworkAttachmentEditor.h" 25 #include "UINetworkFeaturesEditor.h" 26 #include "UINetworkSettingsEditor.h" 27 28 29 UINetworkSettingsEditor::UINetworkSettingsEditor(QWidget *pParent /* = 0 */) 24 #include "UIAudioControllerEditor.h" 25 #include "UIAudioHostDriverEditor.h" 26 #include "UIAudioSettingsEditor.h" 27 #include "UIMachineAudioFeaturesEditor.h" 28 29 30 UIAudioSettingsEditor::UIAudioSettingsEditor(QWidget *pParent /* = 0 */) 30 31 : QIWithRetranslateUI<QWidget>(pParent) 31 32 , m_fFeatureEnabled(false) 32 33 , m_pCheckboxFeature(0) 33 34 , m_pWidgetSettings(0) 34 , m_pEditorNetworkAttachment(0) 35 , m_pEditorNetworkFeatures(0) 35 , m_pEditorAudioHostDriver(0) 36 , m_pEditorAudioController(0) 37 , m_pEditorAudioFeatures(0) 36 38 { 37 39 prepare(); 38 40 } 39 41 40 void UI NetworkSettingsEditor::setFeatureEnabled(bool fEnabled)42 void UIAudioSettingsEditor::setFeatureEnabled(bool fEnabled) 41 43 { 42 44 if (m_fFeatureEnabled != fEnabled) … … 48 50 } 49 51 50 bool UI NetworkSettingsEditor::isFeatureEnabled() const52 bool UIAudioSettingsEditor::isFeatureEnabled() const 51 53 { 52 54 return m_pCheckboxFeature ? m_pCheckboxFeature->isChecked() : m_fFeatureEnabled; 53 55 } 54 56 55 void UI NetworkSettingsEditor::setFeatureAvailable(bool fAvailable)57 void UIAudioSettingsEditor::setFeatureAvailable(bool fAvailable) 56 58 { 57 59 if (m_pCheckboxFeature) … … 59 61 } 60 62 61 void UINetworkSettingsEditor::setValueType(KNetworkAttachmentType enmType) 62 { 63 if (m_pEditorNetworkAttachment) 64 m_pEditorNetworkAttachment->setValueType(enmType); 65 } 66 67 KNetworkAttachmentType UINetworkSettingsEditor::valueType() const 68 { 69 return m_pEditorNetworkAttachment ? m_pEditorNetworkAttachment->valueType() : KNetworkAttachmentType_Null; 70 } 71 72 void UINetworkSettingsEditor::setValueNames(KNetworkAttachmentType enmType, const QStringList &names) 73 { 74 if (m_pEditorNetworkAttachment) 75 m_pEditorNetworkAttachment->setValueNames(enmType, names); 76 } 77 78 void UINetworkSettingsEditor::setValueName(KNetworkAttachmentType enmType, const QString &strName) 79 { 80 if (m_pEditorNetworkAttachment) 81 m_pEditorNetworkAttachment->setValueName(enmType, strName); 82 } 83 84 QString UINetworkSettingsEditor::valueName(KNetworkAttachmentType enmType) const 85 { 86 return m_pEditorNetworkAttachment ? m_pEditorNetworkAttachment->valueName(enmType) : QString(); 87 } 88 89 void UINetworkSettingsEditor::setAttachmentOptionsAvailable(bool fAvailable) 90 { 91 if (m_pEditorNetworkAttachment) 92 m_pEditorNetworkAttachment->setEnabled(fAvailable); 93 } 94 95 void UINetworkSettingsEditor::setAdvancedButtonExpanded(bool fExpanded) 96 { 97 if (m_pEditorNetworkFeatures) 98 m_pEditorNetworkFeatures->setAdvancedButtonExpanded(fExpanded); 99 } 100 101 bool UINetworkSettingsEditor::advancedButtonExpanded() const 102 { 103 return m_pEditorNetworkFeatures ? m_pEditorNetworkFeatures->advancedButtonExpanded() : false; 104 } 105 106 void UINetworkSettingsEditor::setAdapterType(const KNetworkAdapterType &enmType) 107 { 108 if (m_pEditorNetworkFeatures) 109 m_pEditorNetworkFeatures->setAdapterType(enmType); 110 } 111 112 KNetworkAdapterType UINetworkSettingsEditor::adapterType() const 113 { 114 return m_pEditorNetworkFeatures ? m_pEditorNetworkFeatures->adapterType() : KNetworkAdapterType_Null; 115 } 116 117 void UINetworkSettingsEditor::setPromiscuousMode(const KNetworkAdapterPromiscModePolicy &enmMode) 118 { 119 if (m_pEditorNetworkFeatures) 120 m_pEditorNetworkFeatures->setPromiscuousMode(enmMode); 121 } 122 123 KNetworkAdapterPromiscModePolicy UINetworkSettingsEditor::promiscuousMode() const 124 { 125 return m_pEditorNetworkFeatures ? m_pEditorNetworkFeatures->promiscuousMode() : KNetworkAdapterPromiscModePolicy_Deny; 126 } 127 128 void UINetworkSettingsEditor::setMACAddress(const QString &strAddress) 129 { 130 if (m_pEditorNetworkFeatures) 131 m_pEditorNetworkFeatures->setMACAddress(strAddress); 132 } 133 134 QString UINetworkSettingsEditor::macAddress() const 135 { 136 return m_pEditorNetworkFeatures ? m_pEditorNetworkFeatures->macAddress() : QString(); 137 } 138 139 void UINetworkSettingsEditor::setGenericProperties(const QString &strProperties) 140 { 141 if (m_pEditorNetworkFeatures) 142 m_pEditorNetworkFeatures->setGenericProperties(strProperties); 143 } 144 145 QString UINetworkSettingsEditor::genericProperties() const 146 { 147 return m_pEditorNetworkFeatures ? m_pEditorNetworkFeatures->genericProperties() : QString(); 148 } 149 150 void UINetworkSettingsEditor::setCableConnected(bool fConnected) 151 { 152 if (m_pEditorNetworkFeatures) 153 m_pEditorNetworkFeatures->setCableConnected(fConnected); 154 } 155 156 bool UINetworkSettingsEditor::cableConnected() const 157 { 158 return m_pEditorNetworkFeatures ? m_pEditorNetworkFeatures->cableConnected() : false; 159 } 160 161 void UINetworkSettingsEditor::setPortForwardingRules(const UIPortForwardingDataList &rules) 162 { 163 if (m_pEditorNetworkFeatures) 164 m_pEditorNetworkFeatures->setPortForwardingRules(rules); 165 } 166 167 UIPortForwardingDataList UINetworkSettingsEditor::portForwardingRules() const 168 { 169 return m_pEditorNetworkFeatures ? m_pEditorNetworkFeatures->portForwardingRules() : UIPortForwardingDataList(); 170 } 171 172 void UINetworkSettingsEditor::setAdvancedOptionsAvailable(bool fAvailable) 173 { 174 if (m_pEditorNetworkFeatures) 175 m_pEditorNetworkFeatures->setAdvancedOptionsAvailable(fAvailable); 176 } 177 178 void UINetworkSettingsEditor::setAdapterOptionsAvailable(bool fAvailable) 179 { 180 if (m_pEditorNetworkFeatures) 181 m_pEditorNetworkFeatures->setAdapterOptionsAvailable(fAvailable); 182 } 183 184 void UINetworkSettingsEditor::setPromiscuousOptionsAvailable(bool fAvailable) 185 { 186 if (m_pEditorNetworkFeatures) 187 m_pEditorNetworkFeatures->setPromiscuousOptionsAvailable(fAvailable); 188 } 189 190 void UINetworkSettingsEditor::setMACOptionsAvailable(bool fAvailable) 191 { 192 if (m_pEditorNetworkFeatures) 193 m_pEditorNetworkFeatures->setMACOptionsAvailable(fAvailable); 194 } 195 196 void UINetworkSettingsEditor::setGenericPropertiesAvailable(bool fAvailable) 197 { 198 if (m_pEditorNetworkFeatures) 199 m_pEditorNetworkFeatures->setGenericPropertiesAvailable(fAvailable); 200 } 201 202 void UINetworkSettingsEditor::setCableOptionsAvailable(bool fAvailable) 203 { 204 if (m_pEditorNetworkFeatures) 205 m_pEditorNetworkFeatures->setCableOptionsAvailable(fAvailable); 206 } 207 208 void UINetworkSettingsEditor::setForwardingOptionsAvailable(bool fAvailable) 209 { 210 if (m_pEditorNetworkFeatures) 211 m_pEditorNetworkFeatures->setForwardingOptionsAvailable(fAvailable); 212 } 213 214 void UINetworkSettingsEditor::retranslateUi() 63 void UIAudioSettingsEditor::setHostDriverType(KAudioDriverType enmType) 64 { 65 if (m_pEditorAudioHostDriver) 66 m_pEditorAudioHostDriver->setValue(enmType); 67 } 68 69 KAudioDriverType UIAudioSettingsEditor::hostDriverType() const 70 { 71 return m_pEditorAudioHostDriver ? m_pEditorAudioHostDriver->value() : KAudioDriverType_Max; 72 } 73 74 void UIAudioSettingsEditor::setHostDriverOptionAvailable(bool fAvailable) 75 { 76 if (m_pEditorAudioHostDriver) 77 m_pEditorAudioHostDriver->setEnabled(fAvailable); 78 } 79 80 void UIAudioSettingsEditor::setControllerType(KAudioControllerType enmType) 81 { 82 if (m_pEditorAudioController) 83 m_pEditorAudioController->setValue(enmType); 84 } 85 86 KAudioControllerType UIAudioSettingsEditor::controllerType() const 87 { 88 return m_pEditorAudioController ? m_pEditorAudioController->value() : KAudioControllerType_Max; 89 } 90 91 void UIAudioSettingsEditor::setControllerOptionAvailable(bool fAvailable) 92 { 93 if (m_pEditorAudioController) 94 m_pEditorAudioController->setEnabled(fAvailable); 95 } 96 97 void UIAudioSettingsEditor::setEnableOutput(bool fConnected) 98 { 99 if (m_pEditorAudioFeatures) 100 m_pEditorAudioFeatures->setEnableOutput(fConnected); 101 } 102 103 bool UIAudioSettingsEditor::outputEnabled() const 104 { 105 return m_pEditorAudioFeatures ? m_pEditorAudioFeatures->outputEnabled() : false; 106 } 107 108 void UIAudioSettingsEditor::setEnableInput(bool fConnected) 109 { 110 if (m_pEditorAudioFeatures) 111 m_pEditorAudioFeatures->setEnableInput(fConnected); 112 } 113 114 bool UIAudioSettingsEditor::inputEnabled() const 115 { 116 return m_pEditorAudioFeatures ? m_pEditorAudioFeatures->inputEnabled() : false; 117 } 118 119 void UIAudioSettingsEditor::setFeatureOptionsAvailable(bool fAvailable) 120 { 121 if (m_pEditorAudioFeatures) 122 m_pEditorAudioFeatures->setEnabled(fAvailable); 123 } 124 125 void UIAudioSettingsEditor::retranslateUi() 215 126 { 216 127 if (m_pCheckboxFeature) 217 128 { 218 m_pCheckboxFeature->setText(tr("&Enable Network Adapter")); 219 m_pCheckboxFeature->setToolTip(tr("When checked, plugs this virtual network adapter into the virtual machine.")); 129 m_pCheckboxFeature->setText(tr("Enable &Audio")); 130 m_pCheckboxFeature->setToolTip(tr("When checked, a virtual PCI audio card will be plugged into the virtual machine " 131 "and will communicate with the host audio system using the specified driver.")); 220 132 } 221 133 222 134 /* These editors have own labels, but we want them to be properly layouted according to each other: */ 223 135 int iMinimumLayoutHint = 0; 224 if (m_pEditorNetworkAttachment) 225 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorNetworkAttachment->minimumLabelHorizontalHint()); 226 if (m_pEditorNetworkFeatures) 227 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorNetworkFeatures->minimumLabelHorizontalHint()); 228 if (m_pEditorNetworkAttachment) 229 m_pEditorNetworkAttachment->setMinimumLayoutIndent(iMinimumLayoutHint); 230 if (m_pEditorNetworkFeatures) 231 m_pEditorNetworkFeatures->setMinimumLayoutIndent(iMinimumLayoutHint); 232 } 233 234 void UINetworkSettingsEditor::sltHandleFeatureToggled() 136 if (m_pEditorAudioHostDriver) 137 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorAudioHostDriver->minimumLabelHorizontalHint()); 138 if (m_pEditorAudioController) 139 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorAudioController->minimumLabelHorizontalHint()); 140 if (m_pEditorAudioFeatures) 141 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorAudioFeatures->minimumLabelHorizontalHint()); 142 if (m_pEditorAudioHostDriver) 143 m_pEditorAudioHostDriver->setMinimumLayoutIndent(iMinimumLayoutHint); 144 if (m_pEditorAudioController) 145 m_pEditorAudioController->setMinimumLayoutIndent(iMinimumLayoutHint); 146 if (m_pEditorAudioFeatures) 147 m_pEditorAudioFeatures->setMinimumLayoutIndent(iMinimumLayoutHint); 148 } 149 150 void UIAudioSettingsEditor::sltHandleFeatureToggled() 235 151 { 236 152 /* Update widget availability: */ 237 153 updateFeatureAvailability(); 238 239 /* Generate a new MAC address in case it's currently empty: */ 240 if ( m_pCheckboxFeature->isChecked() 241 && m_pEditorNetworkFeatures->macAddress().isEmpty()) 242 m_pEditorNetworkFeatures->generateMac(); 243 244 /* Notify listeners: */ 245 emit sigFeatureStateChanged(); 246 } 247 248 void UINetworkSettingsEditor::sltHandleAttachmentTypeChange() 249 { 250 /* Update widget availability: */ 251 const KNetworkAttachmentType enmType = m_pEditorNetworkAttachment->valueType(); 252 m_pEditorNetworkFeatures->setPromiscuousOptionsAvailable( enmType != KNetworkAttachmentType_Null 253 && enmType != KNetworkAttachmentType_Generic 254 && enmType != KNetworkAttachmentType_NAT); 255 m_pEditorNetworkFeatures->setGenericPropertiesAvailable(enmType == KNetworkAttachmentType_Generic); 256 m_pEditorNetworkFeatures->setForwardingOptionsAvailable(enmType == KNetworkAttachmentType_NAT); 257 258 /* Notify listeners: */ 259 emit sigAttachmentTypeChanged(); 260 } 261 262 void UINetworkSettingsEditor::prepare() 154 } 155 156 void UIAudioSettingsEditor::prepare() 263 157 { 264 158 /* Prepare stuff: */ … … 273 167 } 274 168 275 void UI NetworkSettingsEditor::prepareWidgets()169 void UIAudioSettingsEditor::prepareWidgets() 276 170 { 277 171 /* Prepare main layout: */ … … 291 185 pLayout->addItem(pSpacerItem, 1, 0); 292 186 293 /* Prepare adaptersettings widget: */187 /* Prepare settings widget: */ 294 188 m_pWidgetSettings = new QWidget(this); 295 189 if (m_pWidgetSettings) 296 190 { 297 /* Prepare adapter settings widgetlayout: */298 QVBoxLayout *pLayoutA dapterSettings = new QVBoxLayout(m_pWidgetSettings);299 if (pLayoutA dapterSettings)191 /* Prepare settings layout: */ 192 QVBoxLayout *pLayoutAudioSettings = new QVBoxLayout(m_pWidgetSettings); 193 if (pLayoutAudioSettings) 300 194 { 301 pLayoutAdapterSettings->setContentsMargins(0, 0, 0, 0); 302 303 /* Prepare attachment type editor: */ 304 m_pEditorNetworkAttachment = new UINetworkAttachmentEditor(m_pWidgetSettings); 305 if (m_pEditorNetworkAttachment) 306 pLayoutAdapterSettings->addWidget(m_pEditorNetworkAttachment); 307 308 /* Prepare advanced settingseditor: */ 309 m_pEditorNetworkFeatures = new UINetworkFeaturesEditor(m_pWidgetSettings); 310 if (m_pEditorNetworkFeatures) 311 pLayoutAdapterSettings->addWidget(m_pEditorNetworkFeatures); 195 pLayoutAudioSettings->setContentsMargins(0, 0, 0, 0); 196 197 /* Prepare host driver editor: */ 198 m_pEditorAudioHostDriver = new UIAudioHostDriverEditor(m_pWidgetSettings); 199 if (m_pEditorAudioHostDriver) 200 pLayoutAudioSettings->addWidget(m_pEditorAudioHostDriver); 201 202 /* Prepare host controller editor: */ 203 m_pEditorAudioController = new UIAudioControllerEditor(m_pWidgetSettings); 204 if (m_pEditorAudioController) 205 pLayoutAudioSettings->addWidget(m_pEditorAudioController); 206 207 /* Prepare extended features editor: */ 208 m_pEditorAudioFeatures = new UIMachineAudioFeaturesEditor(m_pWidgetSettings); 209 if (m_pEditorAudioFeatures) 210 pLayoutAudioSettings->addWidget(m_pEditorAudioFeatures); 312 211 } 313 212 … … 317 216 } 318 217 319 void UI NetworkSettingsEditor::prepareConnections()218 void UIAudioSettingsEditor::prepareConnections() 320 219 { 321 220 if (m_pCheckboxFeature) 322 221 connect(m_pCheckboxFeature, &QCheckBox::stateChanged, 323 this, &UINetworkSettingsEditor::sltHandleFeatureToggled); 324 if (m_pEditorNetworkAttachment) 325 connect(m_pEditorNetworkAttachment, &UINetworkAttachmentEditor::sigValueTypeChanged, 326 this, &UINetworkSettingsEditor::sltHandleAttachmentTypeChange); 327 if (m_pEditorNetworkAttachment) 328 connect(m_pEditorNetworkAttachment, &UINetworkAttachmentEditor::sigValueNameChanged, 329 this, &UINetworkSettingsEditor::sigAlternativeNameChanged); 330 if (m_pEditorNetworkFeatures) 331 connect(m_pEditorNetworkFeatures, &UINetworkFeaturesEditor::sigAdvancedButtonStateChange, 332 this, &UINetworkSettingsEditor::sigAdvancedButtonStateChange); 333 if (m_pEditorNetworkFeatures) 334 connect(m_pEditorNetworkFeatures, &UINetworkFeaturesEditor::sigMACAddressChanged, 335 this, &UINetworkSettingsEditor::sigMACAddressChanged); 336 } 337 338 void UINetworkSettingsEditor::updateFeatureAvailability() 222 this, &UIAudioSettingsEditor::sltHandleFeatureToggled); 223 } 224 225 void UIAudioSettingsEditor::updateFeatureAvailability() 339 226 { 340 227 m_pWidgetSettings->setEnabled(m_pCheckboxFeature->isChecked()); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIAudioSettingsEditor.h
r94707 r94708 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI NetworkSettingsEditor class declaration.3 * VBox Qt GUI - UIAudioSettingsEditor class declaration. 4 4 */ 5 5 … … 16 16 */ 17 17 18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UI NetworkSettingsEditor_h19 #define FEQT_INCLUDED_SRC_settings_editors_UI NetworkSettingsEditor_h18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UIAudioSettingsEditor_h 19 #define FEQT_INCLUDED_SRC_settings_editors_UIAudioSettingsEditor_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once … … 35 35 /* Forward declarations: */ 36 36 class QCheckBox; 37 class UINetworkAttachmentEditor; 38 class UINetworkFeaturesEditor; 37 class UIAudioControllerEditor; 38 class UIAudioHostDriverEditor; 39 class UIMachineAudioFeaturesEditor; 39 40 40 /** QWidget subclass used as a networksettings editor. */41 class SHARED_LIBRARY_STUFF UI NetworkSettingsEditor : public QIWithRetranslateUI<QWidget>41 /** QWidget subclass used as a audio settings editor. */ 42 class SHARED_LIBRARY_STUFF UIAudioSettingsEditor : public QIWithRetranslateUI<QWidget> 42 43 { 43 44 Q_OBJECT; 44 45 signals:46 47 /** @name Attachment editor stuff48 * @{ */49 /** Notifies about feature state changed. */50 void sigFeatureStateChanged();51 /** Notifies about attachment type changed. */52 void sigAttachmentTypeChanged();53 /** Notifies about alternative name changed. */54 void sigAlternativeNameChanged();55 /** @} */56 57 /** @name Features editor stuff58 * @{ */59 /** Notifies about the advanced button state change to @a fExpanded. */60 void sigAdvancedButtonStateChange(bool fExpanded);61 /** Notifies about MAC address changed. */62 void sigMACAddressChanged();63 /** @} */64 45 65 46 public: 66 47 67 48 /** Constructs editor passing @a pParent to the base-class. */ 68 UI NetworkSettingsEditor(QWidget *pParent = 0);49 UIAudioSettingsEditor(QWidget *pParent = 0); 69 50 70 51 /** @name General stuff … … 79 60 /** @} */ 80 61 81 /** @name Attachmenteditor stuff62 /** @name Host driver editor stuff 82 63 * @{ */ 83 /** Defines value@a enmType. */84 void set ValueType(KNetworkAttachmentType enmType);85 /** Returns valuetype. */86 K NetworkAttachmentType valueType() const;64 /** Defines host driver @a enmType. */ 65 void setHostDriverType(KAudioDriverType enmType); 66 /** Returns host driver type. */ 67 KAudioDriverType hostDriverType() const; 87 68 88 /** Defines value @a names for specified @a enmType. */ 89 void setValueNames(KNetworkAttachmentType enmType, const QStringList &names); 90 /** Defines value @a strName for specified @a enmType. */ 91 void setValueName(KNetworkAttachmentType enmType, const QString &strName); 92 /** Returns current name for specified @a enmType. */ 93 QString valueName(KNetworkAttachmentType enmType) const; 69 /** Defines whether host driver option @a fAvailable. */ 70 void setHostDriverOptionAvailable(bool fAvailable); 71 /** @} */ 94 72 95 /** Defines whether attachment options @a fAvailable. */ 96 void setAttachmentOptionsAvailable(bool fAvailable); 73 /** @name Controller editor stuff 74 * @{ */ 75 /** Defines controller @a enmType. */ 76 void setControllerType(KAudioControllerType enmValue); 77 /** Returns controller type. */ 78 KAudioControllerType controllerType() const; 79 80 /** Defines whether controller option @a fAvailable. */ 81 void setControllerOptionAvailable(bool fAvailable); 97 82 /** @} */ 98 83 99 84 /** @name Features editor stuff 100 85 * @{ */ 101 /** Defines whether advanced button @a fExpanded. */102 void set AdvancedButtonExpanded(bool fExpanded);103 /** Returns whether advanced button expanded. */104 bool advancedButtonExpanded() const;86 /** Defines whether 'enable output' feature in @a fOn. */ 87 void setEnableOutput(bool fOn); 88 /** Returns 'enable output' feature value. */ 89 bool outputEnabled() const; 105 90 106 /** Defines adapter @a enmType. */107 void set AdapterType(const KNetworkAdapterType &enmType);108 /** Returns adapter type. */109 KNetworkAdapterType adapterType() const;91 /** Defines whether 'enable input' feature in @a fOn. */ 92 void setEnableInput(bool fOn); 93 /** Returns 'enable input' feature value. */ 94 bool inputEnabled() const; 110 95 111 /** Defines promiscuous @a enmMode. */ 112 void setPromiscuousMode(const KNetworkAdapterPromiscModePolicy &enmMode); 113 /** Returns promiscuous mode. */ 114 KNetworkAdapterPromiscModePolicy promiscuousMode() const; 115 116 /** Defines MAC @a strAddress. */ 117 void setMACAddress(const QString &strAddress); 118 /** Returns MAC address. */ 119 QString macAddress() const; 120 121 /** Defines generic @a strProperties. */ 122 void setGenericProperties(const QString &strProperties); 123 /** Returns generic properties. */ 124 QString genericProperties() const; 125 126 /** Defines whether cable is @a fConnected. */ 127 void setCableConnected(bool fConnected); 128 /** Returns whether cable is connected. */ 129 bool cableConnected() const; 130 131 /** Defines list of port forwarding @a rules. */ 132 void setPortForwardingRules(const UIPortForwardingDataList &rules); 133 /** Returns list of port forwarding rules. */ 134 UIPortForwardingDataList portForwardingRules() const; 135 136 /** Defines whether advanced options @a fAvailable. */ 137 void setAdvancedOptionsAvailable(bool fAvailable); 138 /** Defines whether adapter options @a fAvailable. */ 139 void setAdapterOptionsAvailable(bool fAvailable); 140 /** Defines whether promiscuous options @a fAvailable. */ 141 void setPromiscuousOptionsAvailable(bool fAvailable); 142 /** Defines whether MAC options @a fAvailable. */ 143 void setMACOptionsAvailable(bool fAvailable); 144 /** Defines whether generic properties @a fAvailable. */ 145 void setGenericPropertiesAvailable(bool fAvailable); 146 /** Defines whether cable options @a fAvailable. */ 147 void setCableOptionsAvailable(bool fAvailable); 148 /** Defines whether forwarding options @a fAvailable. */ 149 void setForwardingOptionsAvailable(bool fAvailable); 96 /** Defines whether feature options @a fAvailable. */ 97 void setFeatureOptionsAvailable(bool fAvailable); 150 98 /** @} */ 151 99 … … 159 107 /** Handles feature toggling. */ 160 108 void sltHandleFeatureToggled(); 161 /** Handles adapter attachment type change. */162 void sltHandleAttachmentTypeChange();163 109 164 110 private: … … 183 129 * @{ */ 184 130 /** Holds the feature check-box instance. */ 185 QCheckBox *m_pCheckboxFeature;131 QCheckBox *m_pCheckboxFeature; 186 132 /** Holds the settings widget instance. */ 187 QWidget *m_pWidgetSettings; 188 /** Holds the network attachment editor instance. */ 189 UINetworkAttachmentEditor *m_pEditorNetworkAttachment; 190 /** Holds the network features editor instance. */ 191 UINetworkFeaturesEditor *m_pEditorNetworkFeatures; 133 QWidget *m_pWidgetSettings; 134 /** Holds the audio host driver editor instance. */ 135 UIAudioHostDriverEditor *m_pEditorAudioHostDriver; 136 /** Holds the audio host controller editor instance. */ 137 UIAudioControllerEditor *m_pEditorAudioController; 138 /** Holds the audio features editor instance. */ 139 UIMachineAudioFeaturesEditor *m_pEditorAudioFeatures; 192 140 /** @} */ 193 141 }; 194 142 195 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UI NetworkSettingsEditor_h */143 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UIAudioSettingsEditor_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
r94667 r94708 17 17 18 18 /* Qt includes: */ 19 #include <QCheckBox>20 #include <QGridLayout>21 19 #include <QVBoxLayout> 22 20 23 21 /* GUI includes: */ 24 #include "UIAudioControllerEditor.h" 25 #include "UIAudioHostDriverEditor.h" 26 #include "UIConverter.h" 22 #include "UIAudioSettingsEditor.h" 27 23 #include "UIErrorString.h" 28 #include "UIMachineAudioFeaturesEditor.h"29 24 #include "UIMachineSettingsAudio.h" 30 25 … … 77 72 UIMachineSettingsAudio::UIMachineSettingsAudio() 78 73 : m_pCache(0) 79 , m_pCheckBoxAudio(0) 80 , m_pWidgetAudioSettings(0) 81 , m_pEditorAudioHostDriver(0) 82 , m_pEditorAudioController(0) 83 , m_pEditorAudioFeatures(0) 74 , m_pEditorAudioSettings(0) 84 75 { 85 76 prepare(); … … 140 131 141 132 /* Load old data from cache: */ 142 m_pCheckBoxAudio->setChecked(oldAudioData.m_fAudioEnabled); 143 if (m_pEditorAudioHostDriver) 144 m_pEditorAudioHostDriver->setValue(oldAudioData.m_audioDriverType); 145 if (m_pEditorAudioController) 146 m_pEditorAudioController->setValue(oldAudioData.m_audioControllerType); 147 if (m_pEditorAudioFeatures) 148 { 149 m_pEditorAudioFeatures->setEnableOutput(oldAudioData.m_fAudioOutputEnabled); 150 m_pEditorAudioFeatures->setEnableInput(oldAudioData.m_fAudioInputEnabled); 133 if (m_pEditorAudioSettings) 134 { 135 m_pEditorAudioSettings->setFeatureEnabled(oldAudioData.m_fAudioEnabled); 136 m_pEditorAudioSettings->setHostDriverType(oldAudioData.m_audioDriverType); 137 m_pEditorAudioSettings->setControllerType(oldAudioData.m_audioControllerType); 138 m_pEditorAudioSettings->setEnableOutput(oldAudioData.m_fAudioOutputEnabled); 139 m_pEditorAudioSettings->setEnableInput(oldAudioData.m_fAudioInputEnabled); 151 140 } 152 141 … … 165 154 166 155 /* Cache new data: */ 167 if (m_pCheckBoxAudio) 168 newAudioData.m_fAudioEnabled = m_pCheckBoxAudio->isChecked(); 169 if (m_pEditorAudioHostDriver) 170 newAudioData.m_audioDriverType = m_pEditorAudioHostDriver->value(); 171 if (m_pEditorAudioController) 172 newAudioData.m_audioControllerType = m_pEditorAudioController->value(); 173 if (m_pEditorAudioFeatures) 174 { 175 newAudioData.m_fAudioOutputEnabled = m_pEditorAudioFeatures->outputEnabled(); 176 newAudioData.m_fAudioInputEnabled = m_pEditorAudioFeatures->inputEnabled(); 156 if (m_pEditorAudioSettings) 157 { 158 newAudioData.m_fAudioEnabled = m_pEditorAudioSettings->isFeatureEnabled(); 159 newAudioData.m_audioDriverType = m_pEditorAudioSettings->hostDriverType(); 160 newAudioData.m_audioControllerType = m_pEditorAudioSettings->controllerType(); 161 newAudioData.m_fAudioOutputEnabled = m_pEditorAudioSettings->outputEnabled(); 162 newAudioData.m_fAudioInputEnabled = m_pEditorAudioSettings->inputEnabled(); 177 163 } 178 164 m_pCache->cacheCurrentData(newAudioData); … … 193 179 void UIMachineSettingsAudio::retranslateUi() 194 180 { 195 m_pCheckBoxAudio->setText(tr("Enable &Audio"));196 m_pCheckBoxAudio->setToolTip(tr("When checked, a virtual PCI audio card will be plugged into the virtual machine "197 "and will communicate with the host audio system using the specified driver."));198 199 /* These editors have own labels, but we want them to be properly layouted according to each other: */200 int iMinimumLayoutHint = 0;201 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorAudioHostDriver->minimumLabelHorizontalHint());202 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorAudioController->minimumLabelHorizontalHint());203 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorAudioFeatures->minimumLabelHorizontalHint());204 m_pEditorAudioHostDriver->setMinimumLayoutIndent(iMinimumLayoutHint);205 m_pEditorAudioController->setMinimumLayoutIndent(iMinimumLayoutHint);206 m_pEditorAudioFeatures->setMinimumLayoutIndent(iMinimumLayoutHint);207 181 } 208 182 … … 210 184 { 211 185 /* Polish audio page availability: */ 212 m_pCheckBoxAudio->setEnabled(isMachineOffline()); 213 m_pEditorAudioHostDriver->setEnabled(isMachineOffline() || isMachineSaved()); 214 m_pEditorAudioController->setEnabled(isMachineOffline()); 215 m_pEditorAudioFeatures->setEnabled(isMachineInValidMode()); 216 m_pWidgetAudioSettings->setEnabled(m_pCheckBoxAudio->isChecked()); 186 if (m_pEditorAudioSettings) 187 { 188 m_pEditorAudioSettings->setFeatureAvailable(isMachineOffline()); 189 m_pEditorAudioSettings->setHostDriverOptionAvailable(isMachineOffline() || isMachineSaved()); 190 m_pEditorAudioSettings->setControllerOptionAvailable(isMachineOffline()); 191 m_pEditorAudioSettings->setFeatureOptionsAvailable(isMachineInValidMode()); 192 } 217 193 } 218 194 … … 234 210 { 235 211 /* Prepare main layout: */ 236 Q GridLayout *pLayout = new QGridLayout(this);212 QVBoxLayout *pLayout = new QVBoxLayout(this); 237 213 if (pLayout) 238 214 { 239 pLayout->setRowStretch(2, 1); 240 241 /* Prepare audio check-box: */ 242 m_pCheckBoxAudio = new QCheckBox(this); 243 if (m_pCheckBoxAudio) 244 pLayout->addWidget(m_pCheckBoxAudio, 0, 0, 1, 2); 245 246 /* Prepare 20-px shifting spacer: */ 247 QSpacerItem *pSpacerItem = new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum); 248 if (pSpacerItem) 249 pLayout->addItem(pSpacerItem, 1, 0); 250 251 /* Prepare audio settings widget: */ 252 m_pWidgetAudioSettings = new QWidget(this); 253 if (m_pWidgetAudioSettings) 254 { 255 /* Prepare audio settings widget layout: */ 256 QVBoxLayout *pLayoutAudioSettings = new QVBoxLayout(m_pWidgetAudioSettings); 257 if (pLayoutAudioSettings) 258 { 259 pLayoutAudioSettings->setContentsMargins(0, 0, 0, 0); 260 261 /* Prepare audio host driver editor: */ 262 m_pEditorAudioHostDriver = new UIAudioHostDriverEditor(m_pWidgetAudioSettings); 263 if (m_pEditorAudioHostDriver) 264 pLayoutAudioSettings->addWidget(m_pEditorAudioHostDriver); 265 266 /* Prepare audio host controller editor: */ 267 m_pEditorAudioController = new UIAudioControllerEditor(m_pWidgetAudioSettings); 268 if (m_pEditorAudioController) 269 pLayoutAudioSettings->addWidget(m_pEditorAudioController); 270 271 /* Prepare audio extended features editor: */ 272 m_pEditorAudioFeatures = new UIMachineAudioFeaturesEditor(m_pWidgetAudioSettings); 273 if (m_pEditorAudioFeatures) 274 pLayoutAudioSettings->addWidget(m_pEditorAudioFeatures); 275 } 276 277 pLayout->addWidget(m_pWidgetAudioSettings, 1, 1); 278 } 215 /* Prepare settings editor: */ 216 m_pEditorAudioSettings = new UIAudioSettingsEditor(this); 217 if (m_pEditorAudioSettings) 218 pLayout->addWidget(m_pEditorAudioSettings); 219 220 pLayout->addStretch(); 279 221 } 280 222 } … … 282 224 void UIMachineSettingsAudio::prepareConnections() 283 225 { 284 connect(m_pCheckBoxAudio, &QCheckBox::toggled, m_pWidgetAudioSettings, &QWidget::setEnabled);285 226 } 286 227 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h
r94333 r94708 26 26 27 27 /* Forward declarations: */ 28 class QCheckBox; 29 class UIAudioControllerEditor; 30 class UIAudioHostDriverEditor; 31 class UIMachineAudioFeaturesEditor; 28 class UIAudioSettingsEditor; 32 29 struct UIDataSettingsMachineAudio; 33 30 typedef UISettingsCache<UIDataSettingsMachineAudio> UISettingsCacheMachineAudio; … … 89 86 /** @name Widgets 90 87 * @{ */ 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 audio host driver editor instance. */ 96 UIAudioHostDriverEditor *m_pEditorAudioHostDriver; 97 /** Holds the audio host controller editor instance. */ 98 UIAudioControllerEditor *m_pEditorAudioController; 99 /** Holds the audio features editor instance. */ 100 UIMachineAudioFeaturesEditor *m_pEditorAudioFeatures; 88 /** Holds the audio settings editor instance. */ 89 UIAudioSettingsEditor *m_pEditorAudioSettings; 101 90 /** @} */ 102 91 };
Note:
See TracChangeset
for help on using the changeset viewer.