Changeset 89299 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 26, 2021 3:43:54 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144645
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r89093 r89299 5 5 6 6 # 7 # Copyright (C) 2006-202 0Oracle Corporation7 # Copyright (C) 2006-2021 Oracle Corporation 8 8 # 9 9 # This file is part of VirtualBox Open Source Edition (OSE), as … … 848 848 src/settings/editors/UIBaseMemoryEditor.h \ 849 849 src/settings/editors/UIBootOrderEditor.h \ 850 src/settings/editors/UIColorThemeEditor.h \ 850 851 src/settings/editors/UIDefaultMachineFolderEditor.h \ 851 852 src/settings/editors/UIGraphicsControllerEditor.h \ … … 1388 1389 src/settings/editors/UIBaseMemoryEditor.cpp \ 1389 1390 src/settings/editors/UIBootOrderEditor.cpp \ 1391 src/settings/editors/UIColorThemeEditor.cpp \ 1390 1392 src/settings/editors/UIDefaultMachineFolderEditor.cpp \ 1391 1393 src/settings/editors/UIGraphicsControllerEditor.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIColorThemeEditor.cpp
r89263 r89299 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI VisualStateEditor class implementation.3 * VBox Qt GUI - UIColorThemeEditor class implementation. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2019-202 0Oracle Corporation7 * Copyright (C) 2019-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 23 23 /* GUI includes: */ 24 24 #include "QIComboBox.h" 25 #include "UICo mmon.h"25 #include "UIColorThemeEditor.h" 26 26 #include "UIConverter.h" 27 #include "UIExtraDataManager.h"28 #include "UIVisualStateEditor.h"29 27 30 28 31 UI VisualStateEditor::UIVisualStateEditor(QWidget *pParent /* = 0 */, bool fWithLabel /* = false */)29 UIColorThemeEditor::UIColorThemeEditor(QWidget *pParent /* = 0 */, bool fWithLabel /* = false */) 32 30 : QIWithRetranslateUI<QWidget>(pParent) 33 31 , m_fWithLabel(fWithLabel) 34 , m_enmValue(UI VisualStateType_Invalid)32 , m_enmValue(UIColorThemeType_Auto) 35 33 , m_pLabel(0) 36 34 , m_pCombo(0) … … 39 37 } 40 38 41 void UIVisualStateEditor::setMachineId(const QUuid &uMachineId) 42 { 43 m_uMachineId = uMachineId; 44 } 45 46 void UIVisualStateEditor::setValue(UIVisualStateType enmValue) 39 void UIColorThemeEditor::setValue(UIColorThemeType enmValue) 47 40 { 48 41 if (m_pCombo) … … 63 56 } 64 57 65 UI VisualStateType UIVisualStateEditor::value() const58 UIColorThemeType UIColorThemeEditor::value() const 66 59 { 67 return m_pCombo ? m_pCombo->currentData().value<UI VisualStateType>() : m_enmValue;60 return m_pCombo ? m_pCombo->currentData().value<UIColorThemeType>() : m_enmValue; 68 61 } 69 62 70 void UI VisualStateEditor::retranslateUi()63 void UIColorThemeEditor::retranslateUi() 71 64 { 72 65 if (m_pLabel) 73 m_pLabel->setText(tr(" Visual &State:"));66 m_pLabel->setText(tr("Color &Theme:")); 74 67 if (m_pCombo) 75 68 { 76 69 for (int i = 0; i < m_pCombo->count(); ++i) 77 70 { 78 const UI VisualStateType enmType = m_pCombo->itemData(i).value<UIVisualStateType>();71 const UIColorThemeType enmType = m_pCombo->itemData(i).value<UIColorThemeType>(); 79 72 m_pCombo->setItemText(i, gpConverter->toString(enmType)); 80 73 } … … 82 75 } 83 76 84 void UI VisualStateEditor::sltHandleCurrentIndexChanged()77 void UIColorThemeEditor::sltHandleCurrentIndexChanged() 85 78 { 86 79 if (m_pCombo) 87 emit sigValueChanged(m_pCombo->itemData(m_pCombo->currentIndex()).value<UI VisualStateType>());80 emit sigValueChanged(m_pCombo->itemData(m_pCombo->currentIndex()).value<UIColorThemeType>()); 88 81 } 89 82 90 void UI VisualStateEditor::prepare()83 void UIColorThemeEditor::prepare() 91 84 { 92 85 /* Create main layout: */ … … 117 110 m_pLabel->setBuddy(m_pCombo->focusProxy()); 118 111 connect(m_pCombo, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged), 119 this, &UI VisualStateEditor::sltHandleCurrentIndexChanged);112 this, &UIColorThemeEditor::sltHandleCurrentIndexChanged); 120 113 pComboLayout->addWidget(m_pCombo); 121 114 } … … 136 129 } 137 130 138 void UI VisualStateEditor::populateCombo()131 void UIColorThemeEditor::populateCombo() 139 132 { 140 133 if (m_pCombo) 141 134 { 142 135 /* Clear combo first of all: */ 143 m_supportedValues.clear();144 136 m_pCombo->clear(); 145 137 146 138 /* Get possible values: */ 147 QList<UIVisualStateType> possibleValues; 148 possibleValues << UIVisualStateType_Normal 149 << UIVisualStateType_Fullscreen 150 << UIVisualStateType_Seamless 151 << UIVisualStateType_Scale; 139 QList<UIColorThemeType> possibleValues; 140 possibleValues << UIColorThemeType_Auto 141 << UIColorThemeType_Light 142 << UIColorThemeType_Dark; 152 143 153 /* Load currently supported visual state types: */ 154 const UIVisualStateType enmRestrictedTypes = m_uMachineId.isNull() 155 ? UIVisualStateType_Invalid 156 : gEDataManager->restrictedVisualStates(m_uMachineId); 157 foreach (const UIVisualStateType &enmPossibleValue, possibleValues) 158 if (!(enmPossibleValue & enmRestrictedTypes)) 159 m_supportedValues << enmPossibleValue; 160 161 /* Make sure requested value if sane is present as well: */ 162 if ( possibleValues.contains(m_enmValue) 163 && !m_supportedValues.contains(m_enmValue)) 164 m_supportedValues.prepend(m_enmValue); 165 166 /* Update combo with all the supported values: */ 167 foreach (const UIVisualStateType &enmType, m_supportedValues) 144 /* Update combo with all the possible values: */ 145 foreach (const UIColorThemeType &enmType, possibleValues) 168 146 m_pCombo->addItem(QString(), QVariant::fromValue(enmType)); 169 147 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIColorThemeEditor.h
r89263 r89299 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI VisualStateEditor class declaration.3 * VBox Qt GUI - UIColorThemeEditor class declaration. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2019-202 0Oracle Corporation7 * Copyright (C) 2019-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UI VisualStateEditor_h19 #define FEQT_INCLUDED_SRC_settings_editors_UI VisualStateEditor_h18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UIColorThemeEditor_h 19 #define FEQT_INCLUDED_SRC_settings_editors_UIColorThemeEditor_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once … … 23 23 24 24 /* Qt includes: */ 25 #include <QUuid>26 25 #include <QWidget> 27 26 … … 35 34 class QIComboBox; 36 35 37 /** QWidget subclass used as a visual state editor. */38 class SHARED_LIBRARY_STUFF UI VisualStateEditor : public QIWithRetranslateUI<QWidget>36 /** QWidget subclass used as a color theme editor. */ 37 class SHARED_LIBRARY_STUFF UIColorThemeEditor : public QIWithRetranslateUI<QWidget> 39 38 { 40 39 Q_OBJECT; … … 43 42 44 43 /** Notifies listeners about @a enmValue change. */ 45 void sigValueChanged(UI VisualStateType enmValue);44 void sigValueChanged(UIColorThemeType enmValue); 46 45 47 46 public: 48 47 49 /** Constructs visual state editor passing @a pParent to the base-class.48 /** Constructs color theme editor passing @a pParent to the base-class. 50 49 * @param fWithLabel Brings whether we should add label ourselves. */ 51 UIVisualStateEditor(QWidget *pParent = 0, bool fWithLabel = false); 52 53 /** Defines editor @a uMachineId. */ 54 void setMachineId(const QUuid &uMachineId); 50 UIColorThemeEditor(QWidget *pParent = 0, bool fWithLabel = false); 55 51 56 52 /** Defines editor @a enmValue. */ 57 void setValue(UI VisualStateType enmValue);53 void setValue(UIColorThemeType enmValue); 58 54 /** Returns editor value. */ 59 UIVisualStateType value() const; 60 61 /** Returns the vector of supported values. */ 62 QVector<UIVisualStateType> supportedValues() const { return m_supportedValues; } 55 UIColorThemeType value() const; 63 56 64 57 protected: … … 79 72 void populateCombo(); 80 73 81 /** Holds the machine id. */82 QUuid m_uMachineId;83 84 74 /** Holds whether descriptive label should be created. */ 85 75 bool m_fWithLabel; 86 76 87 77 /** Holds the value to be selected. */ 88 UIVisualStateType m_enmValue; 89 90 /** Holds the vector of supported values. */ 91 QVector<UIVisualStateType> m_supportedValues; 78 UIColorThemeType m_enmValue; 92 79 93 80 /** Holds the label instance. */ … … 97 84 }; 98 85 99 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UI VisualStateEditor_h */86 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UIColorThemeEditor_h */
Note:
See TracChangeset
for help on using the changeset viewer.