Changeset 72099 in vbox for trunk/src/VBox
- Timestamp:
- May 3, 2018 5:00:18 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r72092 r72099 520 520 src/selector/graphics/details/UIGDetailsElements.h \ 521 521 src/selector/graphics/details/UIGMachinePreview.h \ 522 src/settings/UISettingsPage.h \523 522 src/settings/UISettingsSelector.h \ 524 523 src/settings/UISettingsSerializer.h \ … … 664 663 src/settings/UISettingsDialog.h \ 665 664 src/settings/UISettingsDialogSpecific.h \ 665 src/settings/UISettingsPage.h \ 666 666 src/widgets/UIAddDiskEncryptionPasswordDialog.h \ 667 667 src/widgets/UIBootTable.h \ … … 779 779 src/settings/UISettingsDialog.h \ 780 780 src/settings/UISettingsDialogSpecific.h \ 781 src/settings/UISettingsPage.h \ 781 782 src/widgets/UIAddDiskEncryptionPasswordDialog.h \ 782 783 src/widgets/UIBootTable.h \ … … 1036 1037 src/selector/graphics/details/UIGDetailsElements.cpp \ 1037 1038 src/selector/graphics/details/UIGMachinePreview.cpp \ 1038 src/settings/UISettingsPage.cpp \1039 1039 src/settings/UISettingsSelector.cpp \ 1040 1040 src/settings/UISettingsSerializer.cpp \ … … 1221 1221 src/settings/UISettingsDialog.cpp \ 1222 1222 src/settings/UISettingsDialogSpecific.cpp \ 1223 src/settings/UISettingsPage.cpp \ 1223 1224 src/widgets/UIAddDiskEncryptionPasswordDialog.cpp \ 1224 1225 src/widgets/UIBootTable.cpp \ … … 1363 1364 src/settings/UISettingsDialog.cpp \ 1364 1365 src/settings/UISettingsDialogSpecific.cpp \ 1366 src/settings/UISettingsPage.cpp \ 1365 1367 src/widgets/UIAddDiskEncryptionPasswordDialog.cpp \ 1366 1368 src/widgets/UIBootTable.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp
r71027 r72099 5 5 6 6 /* 7 * Copyright (C) 2006-201 7Oracle Corporation7 * Copyright (C) 2006-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 28 28 29 29 30 /* Settings page constructor, hidden: */ 31 UISettingsPage::UISettingsPage(UISettingsPageType pageType) 32 : m_pageType(pageType) 33 , m_configurationAccessLevel(ConfigurationAccessLevel_Null) 30 /********************************************************************************************************************************* 31 * Class UISettingsPage implementation. * 32 *********************************************************************************************************************************/ 33 34 UISettingsPage::UISettingsPage() 35 : m_enmConfigurationAccessLevel(ConfigurationAccessLevel_Null) 34 36 , m_cId(-1) 35 , m_fProcessed(false)36 , m_fFailed(false)37 37 , m_pFirstWidget(0) 38 38 , m_pValidator(0) 39 39 , m_fIsValidatorBlocked(true) 40 , m_fProcessed(false) 41 , m_fFailed(false) 40 42 { 41 43 } … … 60 62 } 61 63 64 void UISettingsPage::setConfigurationAccessLevel(ConfigurationAccessLevel enmConfigurationAccessLevel) 65 { 66 m_enmConfigurationAccessLevel = enmConfigurationAccessLevel; 67 polishPage(); 68 } 69 62 70 void UISettingsPage::revalidate() 63 71 { … … 67 75 } 68 76 69 /* Global settings page constructor, hidden: */ 77 78 /********************************************************************************************************************************* 79 * Class UISettingsPageGlobal implementation. * 80 *********************************************************************************************************************************/ 81 70 82 UISettingsPageGlobal::UISettingsPageGlobal() 71 : UISettingsPage(UISettingsPageType_Global)72 83 { 73 84 } … … 88 99 } 89 100 90 /* Fetch data to m_properties: */91 101 void UISettingsPageGlobal::fetchData(const QVariant &data) 92 102 { 103 /* Fetch data to m_properties: */ 93 104 m_properties = data.value<UISettingsDataGlobal>().m_properties; 94 105 } 95 106 96 /* Upload m_properties to data: */97 107 void UISettingsPageGlobal::uploadData(QVariant &data) const 98 108 { 109 /* Upload m_properties to data: */ 99 110 data = QVariant::fromValue(UISettingsDataGlobal(m_properties)); 100 111 } 101 112 102 /* Machine settings page constructor, hidden: */ 113 114 /********************************************************************************************************************************* 115 * Class UISettingsPageMachine implementation. * 116 *********************************************************************************************************************************/ 117 103 118 UISettingsPageMachine::UISettingsPageMachine() 104 : UISettingsPage(UISettingsPageType_Machine)105 119 { 106 120 } … … 121 135 } 122 136 123 /* Fetch data to m_machine & m_console: */124 137 void UISettingsPageMachine::fetchData(const QVariant &data) 125 138 { 139 /* Fetch data to m_machine & m_console: */ 126 140 m_machine = data.value<UISettingsDataMachine>().m_machine; 127 141 m_console = data.value<UISettingsDataMachine>().m_console; 128 142 } 129 143 130 /* Upload m_machine & m_console to data: */131 144 void UISettingsPageMachine::uploadData(QVariant &data) const 132 145 { 146 /* Upload m_machine & m_console to data: */ 133 147 data = QVariant::fromValue(UISettingsDataMachine(m_machine, m_console)); 134 148 } 135 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
r71027 r72099 5 5 6 6 /* 7 * Copyright (C) 2006-201 7Oracle Corporation7 * Copyright (C) 2006-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef __ UISettingsPage_h__19 #define __ UISettingsPage_h__18 #ifndef ___UISettingsPage_h___ 19 #define ___UISettingsPage_h___ 20 20 21 21 /* Qt includes: */ 22 #include <QVariant> 22 23 #include <QWidget> 23 #include <QVariant>24 24 25 25 /* GUI includes: */ 26 26 #include "QIWithRetranslateUI.h" 27 #include "UIExtraDataDefs.h" 27 28 #include "UISettingsDefs.h" 28 #include "UIExtraDataDefs.h"29 29 30 30 /* COM includes: */ 31 31 #include "COMEnums.h" 32 #include "CConsole.h" 32 33 #include "CMachine.h" 33 #include "CConsole.h"34 34 #include "CSystemProperties.h" 35 35 36 36 /* Forward declarations: */ 37 class QShowEvent; 38 class QString; 39 class QVariant; 40 class QWidget; 37 41 class UIPageValidator; 38 class QShowEvent;39 42 40 43 /* Using declarations: */ 41 44 using namespace UISettingsDefs; 42 45 43 /* Settings page types: */ 44 enum UISettingsPageType 45 { 46 UISettingsPageType_Global, 47 UISettingsPageType_Machine 48 }; 49 50 /* Global settings data wrapper: */ 46 47 /** Global settings data wrapper. */ 51 48 struct UISettingsDataGlobal 52 49 { 50 /** Constructs NULL global settings data struct. */ 53 51 UISettingsDataGlobal() {} 54 UISettingsDataGlobal(const CSystemProperties &properties) 55 : m_properties(properties) {} 52 /** Constructs global settings data struct on the basis of @a comProperties. */ 53 UISettingsDataGlobal(const CSystemProperties &comProperties) 54 : m_properties(comProperties) {} 55 /** Holds the global VirtualBox properties. */ 56 56 CSystemProperties m_properties; 57 57 }; 58 58 Q_DECLARE_METATYPE(UISettingsDataGlobal); 59 59 60 /* Machine settings data wrapper: */ 60 61 /** Machine settings data wrapper. */ 61 62 struct UISettingsDataMachine 62 63 { 64 /** Constructs NULL machine settings data struct. */ 63 65 UISettingsDataMachine() {} 64 UISettingsDataMachine(const CMachine &machine, const CConsole &console) 65 : m_machine(machine), m_console(console) {} 66 /** Constructs machine settings data struct on the basis of @a comMachine and @a comConsole. */ 67 UISettingsDataMachine(const CMachine &comMachine, const CConsole &comConsole) 68 : m_machine(comMachine), m_console(comConsole) {} 69 /** Holds the machine reference. */ 66 70 CMachine m_machine; 71 /** Holds the console reference. */ 67 72 CConsole m_console; 68 73 }; 69 74 Q_DECLARE_METATYPE(UISettingsDataMachine); 70 75 71 /* Validation message type: */ 76 77 /** Validation message. */ 72 78 typedef QPair<QString, QStringList> UIValidationMessage; 73 79 74 /* Settings page base class: */ 75 class UISettingsPage : public QIWithRetranslateUI<QWidget> 80 81 /** QWidget subclass used as settings page interface. */ 82 class SHARED_LIBRARY_STUFF UISettingsPage : public QIWithRetranslateUI<QWidget> 76 83 { 77 84 Q_OBJECT; … … 111 118 void notifyOperationProgressError(const QString &strErrorInfo); 112 119 113 /* Validation stuff:*/120 /** Defines @a pValidator. */ 114 121 void setValidator(UIPageValidator *pValidator); 122 /** Defines whether @a fIsValidatorBlocked which means not used at all. */ 115 123 void setValidatorBlocked(bool fIsValidatorBlocked) { m_fIsValidatorBlocked = fIsValidatorBlocked; } 116 virtual bool validate(QList<UIValidationMessage>& /* messages */) { return true; } 117 118 /* Navigation stuff: */ 119 QWidget* firstWidget() const { return m_pFirstWidget; } 124 /** Performs page validation composing a list of @a messages. */ 125 virtual bool validate(QList<UIValidationMessage> &messages) { Q_UNUSED(messages); return true; } 126 127 /** Returns first navigation widget. */ 128 QWidget *firstWidget() const { return m_pFirstWidget; } 129 /** Defines the first navigation widget for TAB-order. */ 120 130 virtual void setOrderAfter(QWidget *pWidget) { m_pFirstWidget = pWidget; } 121 131 122 /* Settings page type stuff: */ 123 UISettingsPageType pageType() const { return m_pageType; } 124 125 /* Configuration access level stuff: */ 126 ConfigurationAccessLevel configurationAccessLevel() const { return m_configurationAccessLevel; } 127 virtual void setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel) { m_configurationAccessLevel = newConfigurationAccessLevel; polishPage(); } 132 /** Defines @a enmConfigurationAccessLevel. */ 133 virtual void setConfigurationAccessLevel(ConfigurationAccessLevel enmConfigurationAccessLevel); 134 /** Returns configuration access level. */ 135 ConfigurationAccessLevel configurationAccessLevel() const { return m_enmConfigurationAccessLevel; } 136 /** Returns whether configuration access level is Full. */ 128 137 bool isMachineOffline() const { return configurationAccessLevel() == ConfigurationAccessLevel_Full; } 138 /** Returns whether configuration access level corresponds to machine in Powered Off state. */ 129 139 bool isMachinePoweredOff() const { return configurationAccessLevel() == ConfigurationAccessLevel_Partial_PoweredOff; } 140 /** Returns whether configuration access level corresponds to machine in Saved state. */ 130 141 bool isMachineSaved() const { return configurationAccessLevel() == ConfigurationAccessLevel_Partial_Saved; } 142 /** Returns whether configuration access level corresponds to machine in one of Running states. */ 131 143 bool isMachineOnline() const { return configurationAccessLevel() == ConfigurationAccessLevel_Partial_Running; } 144 /** Returns whether configuration access level corresponds to machine in one of allowed states. */ 132 145 bool isMachineInValidMode() const { return isMachineOffline() || isMachinePoweredOff() || isMachineSaved() || isMachineOnline(); } 133 146 … … 135 148 virtual bool changed() const = 0; 136 149 137 /* Page 'ID' stuff: */ 150 /** Defines page @a cId. */ 151 void setId(int cId) { m_cId = cId; } 152 /** Returns page ID. */ 138 153 int id() const { return m_cId; } 139 void setId(int cId) { m_cId = cId; } 140 141 /* Page 'name' stuff: */ 154 155 /** Returns page internal name. */ 142 156 virtual QString internalName() const = 0; 143 157 144 /* Page 'warning pixmap' stuff:*/158 /** Returns page warning pixmap. */ 145 159 virtual QPixmap warningPixmap() const = 0; 146 160 147 /* Page 'processed' stuff: */ 161 /** Defines whether page is @a fProcessed. */ 162 void setProcessed(bool fProcessed) { m_fProcessed = fProcessed; } 163 /** Returns whether page is processed. */ 148 164 bool processed() const { return m_fProcessed; } 149 void setProcessed(bool fProcessed) { m_fProcessed = fProcessed; } 150 151 /* Page 'failed' stuff: */ 165 166 /** Defines whether page processing is @a fFailed. */ 167 void setFailed(bool fFailed) { m_fFailed = fFailed; } 168 /** Returns whether page processing is failed. */ 152 169 bool failed() const { return m_fFailed; } 153 void setFailed(bool fFailed) { m_fFailed = fFailed; } 154 155 /* Virtual function to polish page content: */ 170 171 /** Performs page polishing. */ 156 172 virtual void polishPage() {} 157 173 158 174 public slots: 159 175 160 /* Handler: Validation stuff:*/176 /** Performs validation. */ 161 177 void revalidate(); 162 178 163 179 protected: 164 180 165 /* Settings page constructor, hidden:*/166 UISettingsPage( UISettingsPageType type);181 /** Constructs settings page. */ 182 UISettingsPage(); 167 183 168 184 private: 169 185 170 /* Variables: */ 171 UISettingsPageType m_pageType; 172 ConfigurationAccessLevel m_configurationAccessLevel; 173 int m_cId; 174 bool m_fProcessed; 175 bool m_fFailed; 176 QWidget *m_pFirstWidget; 186 /** Holds the configuration access level. */ 187 ConfigurationAccessLevel m_enmConfigurationAccessLevel; 188 189 /** Holds the page ID. */ 190 int m_cId; 191 192 /** Holds the first TAB-orer widget reference. */ 193 QWidget *m_pFirstWidget; 194 /** Holds the page validator. */ 177 195 UIPageValidator *m_pValidator; 178 bool m_fIsValidatorBlocked; 179 }; 180 181 /* Global settings page class: */ 182 class UISettingsPageGlobal : public UISettingsPage 196 197 /** Holds whether page validation is blocked. */ 198 bool m_fIsValidatorBlocked : 1; 199 /** Holds whether page is processed. */ 200 bool m_fProcessed : 1; 201 /** Holds whether page processing is failed. */ 202 bool m_fFailed : 1; 203 }; 204 205 206 /** UISettingsPage extension used as Global Preferences page interface. */ 207 class SHARED_LIBRARY_STUFF UISettingsPageGlobal : public UISettingsPage 183 208 { 184 209 Q_OBJECT; … … 186 211 protected: 187 212 188 /* Global settings page constructor, hidden:*/213 /** Constructs global preferences page. */ 189 214 UISettingsPageGlobal(); 190 215 191 /* Page 'ID' stuff:*/216 /** Returns internal page ID. */ 192 217 GlobalSettingsPageType internalID() const; 193 218 194 /* Page 'name' stuff: */ 195 QString internalName() const; 196 197 /* Page 'warning pixmap' stuff: */ 198 QPixmap warningPixmap() const; 199 200 /* Fetch data to m_properties & m_settings: */ 219 /** Returns page internal name. */ 220 virtual QString internalName() const /* override */; 221 222 /** Returns page warning pixmap. */ 223 virtual QPixmap warningPixmap() const /* override */; 224 225 /** Returns whether the page content was changed. */ 226 virtual bool changed() const /* override */ { return false; } 227 228 /** Fetches data to m_properties & m_settings. */ 201 229 void fetchData(const QVariant &data); 202 203 /* Upload m_properties & m_settings to data: */ 230 /** Uploads m_properties & m_settings to data. */ 204 231 void uploadData(QVariant &data) const; 205 232 206 /** Returns whether the page content was changed. */ 207 bool changed() const { return false; } 208 209 /* Global data source: */ 233 /** Holds the source of global preferences. */ 210 234 CSystemProperties m_properties; 211 235 }; 212 236 213 /* Machine settings page class: */ 214 class UISettingsPageMachine : public UISettingsPage 237 238 /** UISettingsPage extension used as Machine Settings page interface. */ 239 class SHARED_LIBRARY_STUFF UISettingsPageMachine : public UISettingsPage 215 240 { 216 241 Q_OBJECT; … … 218 243 protected: 219 244 220 /* Machine settings page constructor, hidden:*/245 /** Constructs machine settings page. */ 221 246 UISettingsPageMachine(); 222 247 223 /* Page 'ID' stuff:*/248 /** Returns internal page ID. */ 224 249 MachineSettingsPageType internalID() const; 225 250 226 /* Page 'name' stuff:*/227 QString internalName() const;228 229 /* Page 'warning pixmap' stuff:*/230 QPixmap warningPixmap() const;231 232 /* Fetch data to m_machine:*/251 /** Returns page internal name. */ 252 virtual QString internalName() const /* override */; 253 254 /** Returns page warning pixmap. */ 255 virtual QPixmap warningPixmap() const /* override */; 256 257 /** Fetches data to m_machine & m_console. */ 233 258 void fetchData(const QVariant &data); 234 235 /* Upload m_machine to data: */ 259 /** Uploads m_machine & m_console to data. */ 236 260 void uploadData(QVariant &data) const; 237 261 238 /* Machine data source:*/262 /** Holds the source of machine settings. */ 239 263 CMachine m_machine; 264 /** Holds the source of console settings. */ 240 265 CConsole m_console; 241 266 }; 242 267 243 #endif // __UISettingsPage_h__ 244 268 269 #endif /* !___UISettingsPage_h___ */
Note:
See TracChangeset
for help on using the changeset viewer.