Changeset 82436 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Dec 5, 2019 5:48:54 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r82008 r82436 350 350 #endif /* VBOX_WITH_VIDEOHWACCEL */ 351 351 352 KGraphicsControllerType UIMachineSettingsDisplay::graphicsControllerTypeRecommended() const 353 { 354 return m_pGraphicsControllerEditor->supportedValues().contains(m_enmGraphicsControllerTypeRecommended) 355 ? m_enmGraphicsControllerTypeRecommended 356 : graphicsControllerTypeCurrent(); 357 } 358 352 359 KGraphicsControllerType UIMachineSettingsDisplay::graphicsControllerTypeCurrent() const 353 360 { … … 662 669 if (!m_comGuestOSType.isNull()) 663 670 { 664 if ( m_pGraphicsControllerEditor->value() != m_enmGraphicsControllerTypeRecommended)671 if (graphicsControllerTypeCurrent() != graphicsControllerTypeRecommended()) 665 672 { 666 673 #ifdef VBOX_WITH_3D_ACCELERATION -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r81457 r82436 60 60 61 61 /** Returns recommended graphics controller type. */ 62 KGraphicsControllerType graphicsControllerTypeRecommended() const { return m_enmGraphicsControllerTypeRecommended; }62 KGraphicsControllerType graphicsControllerTypeRecommended() const; 63 63 /** Returns current graphics controller type. */ 64 64 KGraphicsControllerType graphicsControllerTypeCurrent() const; -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIGraphicsControllerEditor.cpp
r82430 r82436 23 23 /* GUI includes: */ 24 24 #include "QIComboBox.h" 25 #include "UICommon.h" 25 26 #include "UIConverter.h" 26 27 #include "UIGraphicsControllerEditor.h" 28 29 /* COM includes: */ 30 #include "CSystemProperties.h" 27 31 28 32 … … 41 45 if (m_pCombo) 42 46 { 43 /* Update cached value: */ 44 m_enmValue = enmValue; 47 /* Update cached value and 48 * combo if value has changed: */ 49 if (m_enmValue != enmValue) 50 { 51 m_enmValue = enmValue; 52 populateCombo(); 53 } 45 54 46 55 /* Look for proper index to choose: */ … … 100 109 { 101 110 setFocusProxy(m_pCombo->focusProxy()); 111 /* This is necessary since contents is dynamical now: */ 112 m_pCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents); 102 113 if (m_pLabel) 103 114 m_pLabel->setBuddy(m_pCombo->focusProxy()); … … 124 135 void UIGraphicsControllerEditor::populateCombo() 125 136 { 126 for (int i = 0; i < KGraphicsControllerType_Max; ++i) 127 m_pCombo->addItem(QString(), QVariant::fromValue(static_cast<KGraphicsControllerType>(i))); 137 if (m_pCombo) 138 { 139 /* Clear combo first of all: */ 140 m_pCombo->clear(); 141 142 /* Load currently supported graphics controller types: */ 143 CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties(); 144 m_supportedValues = comProperties.GetSupportedGraphicsControllerTypes(); 145 146 /* Make sure requested value if sane is present as well: */ 147 if ( m_enmValue != KGraphicsControllerType_Max 148 && !m_supportedValues.contains(m_enmValue)) 149 m_supportedValues.prepend(m_enmValue); 150 151 /* Update combo with all the supported values: */ 152 foreach (const KGraphicsControllerType &enmType, m_supportedValues) 153 m_pCombo->addItem(QString(), QVariant::fromValue(enmType)); 154 155 /* Retranslate finally: */ 156 retranslateUi(); 157 } 128 158 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIGraphicsControllerEditor.h
r82430 r82436 57 57 KGraphicsControllerType value() const; 58 58 59 /** Returns the vector of supported values. */ 60 QVector<KGraphicsControllerType> supportedValues() const { return m_supportedValues; } 61 59 62 protected: 60 63 … … 80 83 KGraphicsControllerType m_enmValue; 81 84 85 /** Holds the vector of supported values. */ 86 QVector<KGraphicsControllerType> m_supportedValues; 87 82 88 /** Holds the label instance. */ 83 89 QLabel *m_pLabel;
Note:
See TracChangeset
for help on using the changeset viewer.