Changeset 89324 in vbox for trunk/src/VBox
- Timestamp:
- May 27, 2021 2:28:17 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r89299 r89324 867 867 src/settings/global/UIGlobalSettingsLanguage.h \ 868 868 src/settings/global/UIGlobalSettingsDisplay.h \ 869 src/settings/global/UIGlobalSettingsInterface.h \ 869 870 src/settings/machine/UIMachineSettingsAudio.h \ 870 871 src/settings/machine/UIMachineSettingsDisplay.h \ … … 1408 1409 src/settings/global/UIGlobalSettingsLanguage.cpp \ 1409 1410 src/settings/global/UIGlobalSettingsDisplay.cpp \ 1411 src/settings/global/UIGlobalSettingsInterface.cpp \ 1410 1412 src/settings/machine/UIMachineSettingsAudio.cpp \ 1411 1413 src/settings/machine/UIMachineSettingsDisplay.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r89295 r89324 1926 1926 case GlobalSettingsPageType_Proxy: strResult = "Proxy"; break; 1927 1927 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 1928 case GlobalSettingsPageType_Interface: strResult = "Interface"; break; 1928 1929 default: 1929 1930 { … … 1951 1952 keys << "Proxy"; values << GlobalSettingsPageType_Proxy; 1952 1953 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 1954 keys << "Interface"; values << GlobalSettingsPageType_Interface; 1953 1955 /* Invalid type for unknown words: */ 1954 1956 if (!keys.contains(strGlobalSettingsPageType, Qt::CaseInsensitive)) … … 1973 1975 case GlobalSettingsPageType_Proxy: return UIIconPool::pixmap(":/proxy_warning_16px.png"); 1974 1976 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 1977 case GlobalSettingsPageType_Interface: return UIIconPool::pixmap(":/interface_warning_16px.png"); 1975 1978 default: AssertMsgFailed(("No pixmap for %d", type)); break; 1976 1979 } -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r89295 r89324 832 832 GlobalSettingsPageType_Proxy, 833 833 #endif 834 GlobalSettingsPageType_Interface, 834 835 GlobalSettingsPageType_Max 835 836 }; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r87418 r89324 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 … … 35 35 #include "UIGlobalSettingsInput.h" 36 36 #include "UIGlobalSettingsLanguage.h" 37 #ifdef VBOX_WS_WIN 38 # include "UIGlobalSettingsInterface.h" 39 #endif 37 40 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 38 41 # include "UIGlobalSettingsProxy.h" … … 104 107 #endif 105 108 109 #ifdef VBOX_WS_WIN 110 /* Interface page: */ 111 m_pSelector->setItemText(GlobalSettingsPageType_Interface, tr("Interface")); 112 #endif 113 106 114 /* Polish the selector: */ 107 115 m_pSelector->polish(); … … 242 250 } 243 251 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 252 #ifdef VBOX_WS_WIN 253 /* Interface page: */ 254 case GlobalSettingsPageType_Interface: 255 { 256 pSettingsPage = new UIGlobalSettingsInterface; 257 addItem(":/interface_32px.png", ":/interface_24px.png", ":/interface_16px.png", 258 iPageIndex, "#userInterface", pSettingsPage); 259 addPageHelpKeyword(iPageIndex, "globalsettings"); 260 break; 261 } 262 #endif /* VBOX_WS_WIN */ 244 263 default: 245 264 break; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInterface.cpp
r89263 r89324 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI MachineSettingsInterface class implementation.3 * VBox Qt GUI - UIGlobalSettingsInterface class implementation. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2008-202 0Oracle Corporation7 * Copyright (C) 2008-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 17 17 18 18 /* Qt includes: */ 19 #include <QCheckBox>20 19 #include <QGridLayout> 21 20 #include <QLabel> 22 21 23 22 /* GUI includes: */ 24 #include "UI ActionPool.h"23 #include "UIColorThemeEditor.h" 25 24 #include "UIExtraDataManager.h" 26 #include "UIMachineSettingsInterface.h" 27 #include "UIStatusBarEditorWindow.h" 28 #include "UIMenuBarEditorWindow.h" 29 #include "UIVisualStateEditor.h" 25 #include "UIGlobalSettingsInterface.h" 30 26 31 /** Machinesettings: User Interface page data structure. */32 struct UIDataSettings MachineInterface27 /** Global settings: User Interface page data structure. */ 28 struct UIDataSettingsGlobalInterface 33 29 { 34 30 /** Constructs data. */ 35 UIDataSettingsMachineInterface() 36 : m_fStatusBarEnabled(false) 37 #ifndef VBOX_WS_MAC 38 , m_fMenuBarEnabled(false) 39 #endif /* !VBOX_WS_MAC */ 40 , m_restrictionsOfMenuBar(UIExtraDataMetaDefs::MenuType_Invalid) 41 , m_restrictionsOfMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Invalid) 42 , m_restrictionsOfMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid) 43 , m_restrictionsOfMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid) 44 , m_restrictionsOfMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid) 45 , m_restrictionsOfMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid) 46 #ifdef VBOX_WITH_DEBUGGER_GUI 47 , m_restrictionsOfMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid) 48 #endif /* VBOX_WITH_DEBUGGER_GUI */ 49 #ifdef VBOX_WS_MAC 50 , m_restrictionsOfMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType_Invalid) 51 #endif /* VBOX_WS_MAC */ 52 , m_restrictionsOfMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Invalid) 53 #ifndef VBOX_WS_MAC 54 , m_fShowMiniToolBar(false) 55 , m_fMiniToolBarAtTop(false) 56 #endif /* !VBOX_WS_MAC */ 57 , m_enmVisualState(UIVisualStateType_Invalid) 31 UIDataSettingsGlobalInterface() 32 : m_enmColorTheme(UIColorThemeType_Auto) 58 33 {} 59 34 60 35 /** Returns whether the @a other passed data is equal to this one. */ 61 bool equal(const UIDataSettings MachineInterface &other) const36 bool equal(const UIDataSettingsGlobalInterface &other) const 62 37 { 63 return true 64 && (m_fStatusBarEnabled == other.m_fStatusBarEnabled) 65 && (m_statusBarRestrictions == other.m_statusBarRestrictions) 66 && (m_statusBarOrder == other.m_statusBarOrder) 67 #ifndef VBOX_WS_MAC 68 && (m_fMenuBarEnabled == other.m_fMenuBarEnabled) 69 #endif /* !VBOX_WS_MAC */ 70 && (m_restrictionsOfMenuBar == other.m_restrictionsOfMenuBar) 71 && (m_restrictionsOfMenuApplication == other.m_restrictionsOfMenuApplication) 72 && (m_restrictionsOfMenuMachine == other.m_restrictionsOfMenuMachine) 73 && (m_restrictionsOfMenuView == other.m_restrictionsOfMenuView) 74 && (m_restrictionsOfMenuInput == other.m_restrictionsOfMenuInput) 75 && (m_restrictionsOfMenuDevices == other.m_restrictionsOfMenuDevices) 76 #ifdef VBOX_WITH_DEBUGGER_GUI 77 && (m_restrictionsOfMenuDebug == other.m_restrictionsOfMenuDebug) 78 #endif /* VBOX_WITH_DEBUGGER_GUI */ 79 #ifdef VBOX_WS_MAC 80 && (m_restrictionsOfMenuWindow == other.m_restrictionsOfMenuWindow) 81 #endif /* VBOX_WS_MAC */ 82 && (m_restrictionsOfMenuHelp == other.m_restrictionsOfMenuHelp) 83 #ifndef VBOX_WS_MAC 84 && (m_fShowMiniToolBar == other.m_fShowMiniToolBar) 85 && (m_fMiniToolBarAtTop == other.m_fMiniToolBarAtTop) 86 #endif /* !VBOX_WS_MAC */ 87 && (m_enmVisualState == other.m_enmVisualState) 88 ; 38 return true 39 && (m_enmColorTheme == other.m_enmColorTheme) 40 ; 89 41 } 90 42 91 43 /** Returns whether the @a other passed data is equal to this one. */ 92 bool operator==(const UIDataSettings MachineInterface &other) const { return equal(other); }44 bool operator==(const UIDataSettingsGlobalInterface &other) const { return equal(other); } 93 45 /** Returns whether the @a other passed data is different from this one. */ 94 bool operator!=(const UIDataSettings MachineInterface &other) const { return !equal(other); }46 bool operator!=(const UIDataSettingsGlobalInterface &other) const { return !equal(other); } 95 47 96 /** Holds whether the status-bar is enabled. */ 97 bool m_fStatusBarEnabled; 98 /** Holds the status-bar indicator restrictions. */ 99 QList<IndicatorType> m_statusBarRestrictions; 100 /** Holds the status-bar indicator order. */ 101 QList<IndicatorType> m_statusBarOrder; 102 103 #ifndef VBOX_WS_MAC 104 /** Holds whether the menu-bar is enabled. */ 105 bool m_fMenuBarEnabled; 106 #endif /* !VBOX_WS_MAC */ 107 /** Holds the menu-bar menu restrictions. */ 108 UIExtraDataMetaDefs::MenuType m_restrictionsOfMenuBar; 109 /** Holds the Application menu restrictions. */ 110 UIExtraDataMetaDefs::MenuApplicationActionType m_restrictionsOfMenuApplication; 111 /** Holds the Machine menu restrictions. */ 112 UIExtraDataMetaDefs::RuntimeMenuMachineActionType m_restrictionsOfMenuMachine; 113 /** Holds the View menu restrictions. */ 114 UIExtraDataMetaDefs::RuntimeMenuViewActionType m_restrictionsOfMenuView; 115 /** Holds the Input menu restrictions. */ 116 UIExtraDataMetaDefs::RuntimeMenuInputActionType m_restrictionsOfMenuInput; 117 /** Holds the Devices menu restrictions. */ 118 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType m_restrictionsOfMenuDevices; 119 #ifdef VBOX_WITH_DEBUGGER_GUI 120 /** Holds the Debug menu restrictions. */ 121 UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType m_restrictionsOfMenuDebug; 122 #endif /* VBOX_WITH_DEBUGGER_GUI */ 123 #ifdef VBOX_WS_MAC 124 /** Holds the Window menu restrictions. */ 125 UIExtraDataMetaDefs::MenuWindowActionType m_restrictionsOfMenuWindow; 126 #endif /* VBOX_WS_MAC */ 127 /** Holds the Help menu restrictions. */ 128 UIExtraDataMetaDefs::MenuHelpActionType m_restrictionsOfMenuHelp; 129 130 #ifndef VBOX_WS_MAC 131 /** Holds whether the mini-toolbar is enabled. */ 132 bool m_fShowMiniToolBar; 133 /** Holds whether the mini-toolbar should be aligned at top of screen. */ 134 bool m_fMiniToolBarAtTop; 135 #endif /* !VBOX_WS_MAC */ 136 137 /** Holds the visual state. */ 138 UIVisualStateType m_enmVisualState; 48 /** Holds the color-theme. */ 49 UIColorThemeType m_enmColorTheme; 139 50 }; 140 51 141 52 142 UIMachineSettingsInterface::UIMachineSettingsInterface(const QUuid &uMachineId) 143 : m_uMachineId(uMachineId) 144 , m_pActionPool(0) 145 , m_pCache(0) 146 , m_pEditorMenuBar(0) 147 , m_pLabelVisualState(0) 148 , m_pEditorVisualState(0) 149 , m_pLabelMiniToolBar(0) 150 , m_pCheckBoxShowMiniToolBar(0) 151 , m_pCheckBoxMiniToolBarAlignment(0) 152 , m_pEditorStatusBar(0) 53 /********************************************************************************************************************************* 54 * Class UIGlobalSettingsInterface implementation. * 55 *********************************************************************************************************************************/ 56 57 UIGlobalSettingsInterface::UIGlobalSettingsInterface() 58 : m_pCache(0) 59 , m_pLabelColorTheme(0) 60 , m_pEditorColorTheme(0) 153 61 { 154 /* Prepare: */155 62 prepare(); 156 63 } 157 64 158 UI MachineSettingsInterface::~UIMachineSettingsInterface()65 UIGlobalSettingsInterface::~UIGlobalSettingsInterface() 159 66 { 160 /* Cleanup: */161 67 cleanup(); 162 68 } 163 69 164 bool UIMachineSettingsInterface::changed() const 70 void UIGlobalSettingsInterface::loadToCacheFrom(QVariant &data) 165 71 { 166 return m_pCache->wasChanged(); 167 } 168 169 void UIMachineSettingsInterface::loadToCacheFrom(QVariant &data) 170 { 171 /* Fetch data to machine: */ 172 UISettingsPageMachine::fetchData(data); 72 /* Fetch data to properties: */ 73 UISettingsPageGlobal::fetchData(data); 173 74 174 75 /* Clear cache initially: */ 175 76 m_pCache->clear(); 176 77 177 /* Prepare old interface data: */ 178 UIDataSettingsMachineInterface oldInterfaceData; 78 /* Cache old data: */ 79 UIDataSettingsGlobalInterface oldData; 80 oldData.m_enmColorTheme = gEDataManager->colorTheme(); 81 m_pCache->cacheInitialData(oldData); 179 82 180 /* Gather old interface data: */ 181 oldInterfaceData.m_fStatusBarEnabled = gEDataManager->statusBarEnabled(m_machine.GetId()); 182 oldInterfaceData.m_statusBarRestrictions = gEDataManager->restrictedStatusBarIndicators(m_machine.GetId()); 183 oldInterfaceData.m_statusBarOrder = gEDataManager->statusBarIndicatorOrder(m_machine.GetId()); 184 #ifndef VBOX_WS_MAC 185 oldInterfaceData.m_fMenuBarEnabled = gEDataManager->menuBarEnabled(m_machine.GetId()); 186 #endif 187 oldInterfaceData.m_restrictionsOfMenuBar = gEDataManager->restrictedRuntimeMenuTypes(m_machine.GetId()); 188 oldInterfaceData.m_restrictionsOfMenuApplication = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(m_machine.GetId()); 189 oldInterfaceData.m_restrictionsOfMenuMachine = gEDataManager->restrictedRuntimeMenuMachineActionTypes(m_machine.GetId()); 190 oldInterfaceData.m_restrictionsOfMenuView = gEDataManager->restrictedRuntimeMenuViewActionTypes(m_machine.GetId()); 191 oldInterfaceData.m_restrictionsOfMenuInput = gEDataManager->restrictedRuntimeMenuInputActionTypes(m_machine.GetId()); 192 oldInterfaceData.m_restrictionsOfMenuDevices = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(m_machine.GetId()); 193 #ifdef VBOX_WITH_DEBUGGER_GUI 194 oldInterfaceData.m_restrictionsOfMenuDebug = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(m_machine.GetId()); 195 #endif 196 #ifdef VBOX_WS_MAC 197 oldInterfaceData.m_restrictionsOfMenuWindow = gEDataManager->restrictedRuntimeMenuWindowActionTypes(m_machine.GetId()); 198 #endif 199 oldInterfaceData.m_restrictionsOfMenuHelp = gEDataManager->restrictedRuntimeMenuHelpActionTypes(m_machine.GetId()); 200 #ifndef VBOX_WS_MAC 201 oldInterfaceData.m_fShowMiniToolBar = gEDataManager->miniToolbarEnabled(m_machine.GetId()); 202 oldInterfaceData.m_fMiniToolBarAtTop = gEDataManager->miniToolbarAlignment(m_machine.GetId()) == Qt::AlignTop; 203 #endif 204 oldInterfaceData.m_enmVisualState = gEDataManager->requestedVisualState(m_machine.GetId()); 205 206 /* Cache old interface data: */ 207 m_pCache->cacheInitialData(oldInterfaceData); 208 209 /* Upload machine to data: */ 210 UISettingsPageMachine::uploadData(data); 83 /* Upload properties to data: */ 84 UISettingsPageGlobal::uploadData(data); 211 85 } 212 86 213 void UI MachineSettingsInterface::getFromCache()87 void UIGlobalSettingsInterface::getFromCache() 214 88 { 215 /* Get old interface data from the cache: */ 216 const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base(); 217 218 /* Load old interface data from the cache: */ 219 m_pEditorStatusBar->setStatusBarEnabled(oldInterfaceData.m_fStatusBarEnabled); 220 m_pEditorStatusBar->setStatusBarConfiguration(oldInterfaceData.m_statusBarRestrictions, 221 oldInterfaceData.m_statusBarOrder); 222 #ifndef VBOX_WS_MAC 223 m_pEditorMenuBar->setMenuBarEnabled(oldInterfaceData.m_fMenuBarEnabled); 224 #endif 225 m_pEditorMenuBar->setRestrictionsOfMenuBar(oldInterfaceData.m_restrictionsOfMenuBar); 226 m_pEditorMenuBar->setRestrictionsOfMenuApplication(oldInterfaceData.m_restrictionsOfMenuApplication); 227 m_pEditorMenuBar->setRestrictionsOfMenuMachine(oldInterfaceData.m_restrictionsOfMenuMachine); 228 m_pEditorMenuBar->setRestrictionsOfMenuView(oldInterfaceData.m_restrictionsOfMenuView); 229 m_pEditorMenuBar->setRestrictionsOfMenuInput(oldInterfaceData.m_restrictionsOfMenuInput); 230 m_pEditorMenuBar->setRestrictionsOfMenuDevices(oldInterfaceData.m_restrictionsOfMenuDevices); 231 #ifdef VBOX_WITH_DEBUGGER_GUI 232 m_pEditorMenuBar->setRestrictionsOfMenuDebug(oldInterfaceData.m_restrictionsOfMenuDebug); 233 #endif 234 #ifdef VBOX_WS_MAC 235 m_pEditorMenuBar->setRestrictionsOfMenuWindow(oldInterfaceData.m_restrictionsOfMenuWindow); 236 #endif 237 m_pEditorMenuBar->setRestrictionsOfMenuHelp(oldInterfaceData.m_restrictionsOfMenuHelp); 238 #ifndef VBOX_WS_MAC 239 m_pCheckBoxShowMiniToolBar->setChecked(oldInterfaceData.m_fShowMiniToolBar); 240 m_pCheckBoxMiniToolBarAlignment->setChecked(oldInterfaceData.m_fMiniToolBarAtTop); 241 #endif 242 m_pEditorVisualState->setMachineId(m_machine.GetId()); 243 m_pEditorVisualState->setValue(oldInterfaceData.m_enmVisualState); 244 245 /* Polish page finally: */ 246 polishPage(); 89 /* Load old data from the cache: */ 90 const UIDataSettingsGlobalInterface &oldData = m_pCache->base(); 91 m_pEditorColorTheme->setValue(oldData.m_enmColorTheme); 247 92 248 93 /* Revalidate: */ … … 250 95 } 251 96 252 void UI MachineSettingsInterface::putToCache()97 void UIGlobalSettingsInterface::putToCache() 253 98 { 254 /* Prepare new interfacedata: */255 UIDataSettings MachineInterface newInterfaceData;99 /* Prepare new data: */ 100 UIDataSettingsGlobalInterface newData; 256 101 257 /* Gather new interface data: */ 258 newInterfaceData.m_fStatusBarEnabled = m_pEditorStatusBar->isStatusBarEnabled(); 259 newInterfaceData.m_statusBarRestrictions = m_pEditorStatusBar->statusBarIndicatorRestrictions(); 260 newInterfaceData.m_statusBarOrder = m_pEditorStatusBar->statusBarIndicatorOrder(); 261 #ifndef VBOX_WS_MAC 262 newInterfaceData.m_fMenuBarEnabled = m_pEditorMenuBar->isMenuBarEnabled(); 263 #endif 264 newInterfaceData.m_restrictionsOfMenuBar = m_pEditorMenuBar->restrictionsOfMenuBar(); 265 newInterfaceData.m_restrictionsOfMenuApplication = m_pEditorMenuBar->restrictionsOfMenuApplication(); 266 newInterfaceData.m_restrictionsOfMenuMachine = m_pEditorMenuBar->restrictionsOfMenuMachine(); 267 newInterfaceData.m_restrictionsOfMenuView = m_pEditorMenuBar->restrictionsOfMenuView(); 268 newInterfaceData.m_restrictionsOfMenuInput = m_pEditorMenuBar->restrictionsOfMenuInput(); 269 newInterfaceData.m_restrictionsOfMenuDevices = m_pEditorMenuBar->restrictionsOfMenuDevices(); 270 #ifdef VBOX_WITH_DEBUGGER_GUI 271 newInterfaceData.m_restrictionsOfMenuDebug = m_pEditorMenuBar->restrictionsOfMenuDebug(); 272 #endif 273 #ifdef VBOX_WS_MAC 274 newInterfaceData.m_restrictionsOfMenuWindow = m_pEditorMenuBar->restrictionsOfMenuWindow(); 275 #endif 276 newInterfaceData.m_restrictionsOfMenuHelp = m_pEditorMenuBar->restrictionsOfMenuHelp(); 277 #ifndef VBOX_WS_MAC 278 newInterfaceData.m_fShowMiniToolBar = m_pCheckBoxShowMiniToolBar->isChecked(); 279 newInterfaceData.m_fMiniToolBarAtTop = m_pCheckBoxMiniToolBarAlignment->isChecked(); 280 #endif 281 newInterfaceData.m_enmVisualState = m_pEditorVisualState->value(); 282 283 /* Cache new interface data: */ 284 m_pCache->cacheCurrentData(newInterfaceData); 102 /* Cache new data: */ 103 newData.m_enmColorTheme = m_pEditorColorTheme->value(); 104 m_pCache->cacheCurrentData(newData); 285 105 } 286 106 287 void UI MachineSettingsInterface::saveFromCacheTo(QVariant &data)107 void UIGlobalSettingsInterface::saveFromCacheTo(QVariant &data) 288 108 { 289 /* Fetch data to machine: */290 UISettingsPage Machine::fetchData(data);109 /* Fetch data to properties: */ 110 UISettingsPageGlobal::fetchData(data); 291 111 292 /* Update interfacedata and failing state: */293 setFailed(!save InterfaceData());112 /* Update data and failing state: */ 113 setFailed(!saveData()); 294 114 295 /* Upload machineto data: */296 UISettingsPage Machine::uploadData(data);115 /* Upload properties to data: */ 116 UISettingsPageGlobal::uploadData(data); 297 117 } 298 118 299 void UI MachineSettingsInterface::retranslateUi()119 void UIGlobalSettingsInterface::retranslateUi() 300 120 { 301 m_pEditorMenuBar->setWhatsThis(tr("Allows to modify VM menu-bar contents.")); 302 m_pLabelVisualState->setText(tr("Visual State:")); 303 m_pEditorVisualState->setWhatsThis(tr("Selects the visual state. If machine is running it will be applied as soon as possible," 304 "otherwise desired one will be defined.")); 305 m_pLabelMiniToolBar->setText(tr("Mini ToolBar:")); 306 m_pCheckBoxShowMiniToolBar->setWhatsThis(tr("When checked, show the Mini ToolBar in full-screen and seamless modes.")); 307 m_pCheckBoxShowMiniToolBar->setText(tr("Show in &Full-screen/Seamless")); 308 m_pCheckBoxMiniToolBarAlignment->setWhatsThis(tr("When checked, show the Mini ToolBar at the top of the screen, rather than in its" 309 "default position at the bottom of the screen.")); 310 m_pCheckBoxMiniToolBarAlignment->setText(tr("Show at &Top of Screen")); 311 m_pEditorStatusBar->setWhatsThis(tr("Allows to modify VM status-bar contents.")); 121 m_pLabelColorTheme->setText(tr("Color &Theme:")); 122 m_pEditorColorTheme->setWhatsThis(tr("Selects the color theme. It can be Light, Dark or automatically detected (default).")); 312 123 } 313 124 314 void UI MachineSettingsInterface::polishPage()125 void UIGlobalSettingsInterface::prepare() 315 126 { 316 /* Polish interface page availability: */317 m_pEditorMenuBar->setEnabled(isMachineInValidMode());318 #ifdef VBOX_WS_MAC319 m_pLabelMiniToolBar->hide();320 m_pCheckBoxShowMiniToolBar->hide();321 m_pCheckBoxMiniToolBarAlignment->hide();322 #else /* !VBOX_WS_MAC */323 m_pLabelMiniToolBar->setEnabled(isMachineInValidMode());324 m_pCheckBoxShowMiniToolBar->setEnabled(isMachineInValidMode());325 m_pCheckBoxMiniToolBarAlignment->setEnabled(isMachineInValidMode() && m_pCheckBoxShowMiniToolBar->isChecked());326 #endif /* !VBOX_WS_MAC */327 m_pEditorStatusBar->setEnabled(isMachineInValidMode());328 }329 330 void UIMachineSettingsInterface::prepare()331 {332 /* Prepare action-pool: */333 m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime);334 335 127 /* Prepare cache: */ 336 m_pCache = new UISettingsCache MachineInterface;128 m_pCache = new UISettingsCacheGlobalInterface; 337 129 AssertPtrReturnVoid(m_pCache); 338 130 339 131 /* Prepare everything: */ 340 132 prepareWidgets(); 341 prepareConnections();342 133 343 134 /* Apply language settings: */ … … 345 136 } 346 137 347 void UI MachineSettingsInterface::prepareWidgets()138 void UIGlobalSettingsInterface::prepareWidgets() 348 139 { 349 140 /* Prepare main layout: */ … … 352 143 { 353 144 pLayoutMain->setColumnStretch(1, 1); 354 pLayoutMain->setRowStretch( 4, 1);145 pLayoutMain->setRowStretch(1, 1); 355 146 356 /* Prepare menu-bar editor: */357 m_p EditorMenuBar = new UIMenuBarEditorWidget(this);358 if (m_p EditorMenuBar)147 /* Prepare color-theme label: */ 148 m_pLabelColorTheme = new QLabel(this); 149 if (m_pLabelColorTheme) 359 150 { 360 m_pEditorMenuBar->setActionPool(m_pActionPool); 361 m_pEditorMenuBar->setMachineID(m_uMachineId); 362 363 pLayoutMain->addWidget(m_pEditorMenuBar, 0, 0, 1, 3); 151 m_pLabelColorTheme->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 152 pLayoutMain->addWidget(m_pLabelColorTheme, 0, 0); 364 153 } 365 366 /* Prepare visual-state label: */ 367 m_pLabelVisualState = new QLabel(this); 368 if (m_pLabelVisualState) 154 /* Prepare color-theme editor: */ 155 m_pEditorColorTheme = new UIColorThemeEditor(this); 156 if (m_pEditorColorTheme) 369 157 { 370 m_pLabelVisualState->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 371 pLayoutMain->addWidget(m_pLabelVisualState, 1, 0); 372 } 373 /* Prepare visual-state editor: */ 374 m_pEditorVisualState = new UIVisualStateEditor(this); 375 if (m_pEditorVisualState) 376 pLayoutMain->addWidget(m_pEditorVisualState, 1, 1); 377 378 /* Prepare mini-toolbar label: */ 379 m_pLabelMiniToolBar = new QLabel(this); 380 if (m_pLabelMiniToolBar) 381 { 382 m_pLabelMiniToolBar->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 383 pLayoutMain->addWidget(m_pLabelMiniToolBar, 2, 0); 384 } 385 /* Prepare 'show mini-toolbar' check-box: */ 386 m_pCheckBoxShowMiniToolBar = new QCheckBox(this); 387 if (m_pCheckBoxShowMiniToolBar) 388 pLayoutMain->addWidget(m_pCheckBoxShowMiniToolBar, 2, 1); 389 /* Prepare 'mini-toolbar alignment' check-box: */ 390 m_pCheckBoxMiniToolBarAlignment = new QCheckBox(this); 391 if (m_pCheckBoxMiniToolBarAlignment) 392 pLayoutMain->addWidget(m_pCheckBoxMiniToolBarAlignment, 3, 1); 393 394 /* Prepare status-bar editor: */ 395 m_pEditorStatusBar = new UIStatusBarEditorWidget(this); 396 if (m_pEditorStatusBar) 397 { 398 m_pEditorStatusBar->setMachineID(m_uMachineId); 399 pLayoutMain->addWidget(m_pEditorStatusBar, 5, 0, 1, 3); 158 m_pLabelColorTheme->setBuddy(m_pEditorColorTheme->focusProxy()); 159 pLayoutMain->addWidget(m_pEditorColorTheme, 0, 1); 400 160 } 401 161 } 402 162 } 403 163 404 void UI MachineSettingsInterface::prepareConnections()164 void UIGlobalSettingsInterface::cleanup() 405 165 { 406 connect(m_pCheckBoxShowMiniToolBar, &QCheckBox::toggled,407 m_pCheckBoxMiniToolBarAlignment, &UIMachineSettingsInterface::setEnabled);408 }409 410 void UIMachineSettingsInterface::cleanup()411 {412 /* Cleanup action-pool: */413 UIActionPool::destroy(m_pActionPool);414 415 166 /* Cleanup cache: */ 416 167 delete m_pCache; … … 418 169 } 419 170 420 bool UI MachineSettingsInterface::saveInterfaceData()171 bool UIGlobalSettingsInterface::saveData() 421 172 { 422 173 /* Prepare result: */ 423 174 bool fSuccess = true; 424 /* Save display settings from the cache: */ 425 if (fSuccess && isMachineInValidMode() && m_pCache->wasChanged()) 175 /* Save settings from cache: */ 176 if ( fSuccess 177 && m_pCache->wasChanged()) 426 178 { 427 /* Save 'Menu-bar' data from the cache: */ 428 if (fSuccess) 429 fSuccess = saveMenuBarData(); 430 /* Save 'Status-bar' data from the cache: */ 431 if (fSuccess) 432 fSuccess = saveStatusBarData(); 433 /* Save 'Mini-toolbar' data from the cache: */ 434 if (fSuccess) 435 fSuccess = saveMiniToolbarData(); 436 /* Save 'Visual State' data from the cache: */ 437 if (fSuccess) 438 fSuccess = saveVisualStateData(); 179 /* Get old data from cache: */ 180 const UIDataSettingsGlobalInterface &oldData = m_pCache->base(); 181 /* Get new data from cache: */ 182 const UIDataSettingsGlobalInterface &newData = m_pCache->data(); 183 184 /* Save 'color-theme': */ 185 if ( fSuccess 186 && newData.m_enmColorTheme != oldData.m_enmColorTheme) 187 /* fSuccess = */ gEDataManager->setColorTheme(newData.m_enmColorTheme); 439 188 } 440 189 /* Return result: */ 441 190 return fSuccess; 442 191 } 443 444 bool UIMachineSettingsInterface::saveMenuBarData()445 {446 /* Prepare result: */447 bool fSuccess = true;448 /* Save 'Menu-bar' data from the cache: */449 if (fSuccess)450 {451 /* Get old interface data from the cache: */452 const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base();453 /* Get new interface data from the cache: */454 const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data();455 456 #ifndef VBOX_WS_MAC457 /* Save whether menu-bar is enabled: */458 if (fSuccess && newInterfaceData.m_fMenuBarEnabled != oldInterfaceData.m_fMenuBarEnabled)459 /* fSuccess = */ gEDataManager->setMenuBarEnabled(newInterfaceData.m_fMenuBarEnabled, m_machine.GetId());460 #endif461 /* Save menu-bar restrictions: */462 if (fSuccess && newInterfaceData.m_restrictionsOfMenuBar != oldInterfaceData.m_restrictionsOfMenuBar)463 /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuTypes(newInterfaceData.m_restrictionsOfMenuBar, m_machine.GetId());464 /* Save menu-bar Application menu restrictions: */465 if (fSuccess && newInterfaceData.m_restrictionsOfMenuApplication != oldInterfaceData.m_restrictionsOfMenuApplication)466 /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuApplicationActionTypes(newInterfaceData.m_restrictionsOfMenuApplication, m_machine.GetId());467 /* Save menu-bar Machine menu restrictions: */468 if (fSuccess && newInterfaceData.m_restrictionsOfMenuMachine != oldInterfaceData.m_restrictionsOfMenuMachine)469 /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuMachineActionTypes(newInterfaceData.m_restrictionsOfMenuMachine, m_machine.GetId());470 /* Save menu-bar View menu restrictions: */471 if (fSuccess && newInterfaceData.m_restrictionsOfMenuView != oldInterfaceData.m_restrictionsOfMenuView)472 /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuViewActionTypes(newInterfaceData.m_restrictionsOfMenuView, m_machine.GetId());473 /* Save menu-bar Input menu restrictions: */474 if (fSuccess && newInterfaceData.m_restrictionsOfMenuInput != oldInterfaceData.m_restrictionsOfMenuInput)475 /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuInputActionTypes(newInterfaceData.m_restrictionsOfMenuInput, m_machine.GetId());476 /* Save menu-bar Devices menu restrictions: */477 if (fSuccess && newInterfaceData.m_restrictionsOfMenuDevices != oldInterfaceData.m_restrictionsOfMenuDevices)478 /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuDevicesActionTypes(newInterfaceData.m_restrictionsOfMenuDevices, m_machine.GetId());479 #ifdef VBOX_WITH_DEBUGGER_GUI480 /* Save menu-bar Debug menu restrictions: */481 if (fSuccess && newInterfaceData.m_restrictionsOfMenuDebug != oldInterfaceData.m_restrictionsOfMenuDebug)482 /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuDebuggerActionTypes(newInterfaceData.m_restrictionsOfMenuDebug, m_machine.GetId());483 #endif484 #ifdef VBOX_WS_MAC485 /* Save menu-bar Window menu restrictions: */486 if (fSuccess && newInterfaceData.m_restrictionsOfMenuWindow != oldInterfaceData.m_restrictionsOfMenuWindow)487 /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuWindowActionTypes(newInterfaceData.m_restrictionsOfMenuWindow, m_machine.GetId());488 #endif489 /* Save menu-bar Help menu restrictions: */490 if (fSuccess && newInterfaceData.m_restrictionsOfMenuHelp != oldInterfaceData.m_restrictionsOfMenuHelp)491 /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuHelpActionTypes(newInterfaceData.m_restrictionsOfMenuHelp, m_machine.GetId());492 }493 /* Return result: */494 return fSuccess;495 }496 497 bool UIMachineSettingsInterface::saveStatusBarData()498 {499 /* Prepare result: */500 bool fSuccess = true;501 /* Save 'Status-bar' data from the cache: */502 if (fSuccess)503 {504 /* Get old interface data from the cache: */505 const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base();506 /* Get new interface data from the cache: */507 const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data();508 509 /* Save whether status-bar is enabled: */510 if (fSuccess && newInterfaceData.m_fStatusBarEnabled != oldInterfaceData.m_fStatusBarEnabled)511 /* fSuccess = */ gEDataManager->setStatusBarEnabled(newInterfaceData.m_fStatusBarEnabled, m_machine.GetId());512 /* Save status-bar restrictions: */513 if (fSuccess && newInterfaceData.m_statusBarRestrictions != oldInterfaceData.m_statusBarRestrictions)514 /* fSuccess = */ gEDataManager->setRestrictedStatusBarIndicators(newInterfaceData.m_statusBarRestrictions, m_machine.GetId());515 /* Save status-bar order: */516 if (fSuccess && newInterfaceData.m_statusBarOrder != oldInterfaceData.m_statusBarOrder)517 /* fSuccess = */ gEDataManager->setStatusBarIndicatorOrder(newInterfaceData.m_statusBarOrder, m_machine.GetId());518 }519 /* Return result: */520 return fSuccess;521 }522 523 bool UIMachineSettingsInterface::saveMiniToolbarData()524 {525 /* Prepare result: */526 bool fSuccess = true;527 /* Save 'Mini-toolbar' data from the cache: */528 if (fSuccess)529 {530 /* Get old interface data from the cache: */531 const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base(); Q_UNUSED(oldInterfaceData);532 /* Get new interface data from the cache: */533 const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data(); Q_UNUSED(newInterfaceData);534 535 #ifndef VBOX_WS_MAC536 /* Save whether mini-toolbar is enabled: */537 if (fSuccess && newInterfaceData.m_fShowMiniToolBar != oldInterfaceData.m_fShowMiniToolBar)538 /* fSuccess = */ gEDataManager->setMiniToolbarEnabled(newInterfaceData.m_fShowMiniToolBar, m_machine.GetId());539 /* Save whether mini-toolbar should be location at top of screen: */540 if (fSuccess && newInterfaceData.m_fMiniToolBarAtTop != oldInterfaceData.m_fMiniToolBarAtTop)541 /* fSuccess = */ gEDataManager->setMiniToolbarAlignment(newInterfaceData.m_fMiniToolBarAtTop ? Qt::AlignTop : Qt::AlignBottom, m_machine.GetId());542 #endif543 }544 /* Return result: */545 return fSuccess;546 }547 548 bool UIMachineSettingsInterface::saveVisualStateData()549 {550 /* Prepare result: */551 bool fSuccess = true;552 /* Save 'Visual State' data from the cache: */553 if (fSuccess)554 {555 /* Get old interface data from the cache: */556 const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base();557 /* Get new interface data from the cache: */558 const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data();559 560 /* Save desired visual state: */561 if (fSuccess && newInterfaceData.m_enmVisualState != oldInterfaceData.m_enmVisualState)562 /* fSuccess = */ gEDataManager->setRequestedVisualState(newInterfaceData.m_enmVisualState, m_machine.GetId());563 }564 /* Return result: */565 return fSuccess;566 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInterface.h
r89263 r89324 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI MachineSettingsInterface class declaration.3 * VBox Qt GUI - UIGlobalSettingsInterface class declaration. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2008-202 0Oracle Corporation7 * Copyright (C) 2008-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_ machine_UIMachineSettingsInterface_h19 #define FEQT_INCLUDED_SRC_settings_ machine_UIMachineSettingsInterface_h18 #ifndef FEQT_INCLUDED_SRC_settings_global_UIGlobalSettingsInterface_h 19 #define FEQT_INCLUDED_SRC_settings_global_UIGlobalSettingsInterface_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once … … 26 26 27 27 /* Forward declarations: */ 28 class QCheckBox;29 28 class QLabel; 30 class UIActionPool; 31 class UIMenuBarEditorWidget; 32 class UIStatusBarEditorWidget; 33 class UIVisualStateEditor; 34 struct UIDataSettingsMachineInterface; 35 typedef UISettingsCache<UIDataSettingsMachineInterface> UISettingsCacheMachineInterface; 29 class UIColorThemeEditor; 30 struct UIDataSettingsGlobalInterface; 31 typedef UISettingsCache<UIDataSettingsGlobalInterface> UISettingsCacheGlobalInterface; 36 32 37 /** Machinesettings: User Interface page. */38 class SHARED_LIBRARY_STUFF UI MachineSettingsInterface : public UISettingsPageMachine33 /** Global settings: User Interface page. */ 34 class SHARED_LIBRARY_STUFF UIGlobalSettingsInterface : public UISettingsPageGlobal 39 35 { 40 36 Q_OBJECT; … … 43 39 44 40 /** Constructs User Interface settings page. */ 45 UI MachineSettingsInterface(const QUuid &uMachineId);41 UIGlobalSettingsInterface(); 46 42 /** Destructs User Interface settings page. */ 47 ~UIMachineSettingsInterface();43 virtual ~UIGlobalSettingsInterface() /* override */; 48 44 49 45 protected: 50 51 /** Returns whether the page content was changed. */52 virtual bool changed() const /* override */;53 46 54 47 /** Loads settings from external object(s) packed inside @a data to cache. … … 69 62 virtual void retranslateUi() /* override */; 70 63 71 /** Performs final page polishing. */72 virtual void polishPage() /* override */;73 74 64 private: 75 65 … … 78 68 /** Prepares widgets. */ 79 69 void prepareWidgets(); 80 /** Prepares connections. */81 void prepareConnections();82 70 /** Cleanups all. */ 83 71 void cleanup(); 84 72 85 /** Saves existing interface data from the cache. */ 86 bool saveInterfaceData(); 87 /** Saves existing 'Menu-bar' data from the cache. */ 88 bool saveMenuBarData(); 89 /** Saves existing 'Status-bar' data from the cache. */ 90 bool saveStatusBarData(); 91 /** Saves existing 'Mini-toolbar' data from the cache. */ 92 bool saveMiniToolbarData(); 93 /** Saves existing 'Visual State' data from the cache. */ 94 bool saveVisualStateData(); 95 96 /** Holds the machine ID copy. */ 97 const QUuid m_uMachineId; 98 /** Holds the action-pool instance. */ 99 UIActionPool *m_pActionPool; 73 /** Saves existing data from cache. */ 74 bool saveData(); 100 75 101 76 /** Holds the page data cache instance. */ 102 UISettingsCache MachineInterface *m_pCache;77 UISettingsCacheGlobalInterface *m_pCache; 103 78 104 79 /** @name Widgets 105 80 * @{ */ 106 /** Holds the menu-bar editor instance. */ 107 UIMenuBarEditorWidget *m_pEditorMenuBar; 108 /** Holds the visual state label instance. */ 109 QLabel *m_pLabelVisualState; 110 /** Holds the visual state label instance. */ 111 UIVisualStateEditor *m_pEditorVisualState; 112 /** Holds the mini-toolbar label instance. */ 113 QLabel *m_pLabelMiniToolBar; 114 /** Holds the 'show mini-toolbar' check-box instance. */ 115 QCheckBox *m_pCheckBoxShowMiniToolBar; 116 /** Holds the 'mini-toolbar alignment' check-box instance. */ 117 QCheckBox *m_pCheckBoxMiniToolBarAlignment; 118 /** Holds the status-bar editor instance. */ 119 UIStatusBarEditorWidget *m_pEditorStatusBar; 81 /** Holds the color theme label instance. */ 82 QLabel *m_pLabelColorTheme; 83 /** Holds the color theme label instance. */ 84 UIColorThemeEditor *m_pEditorColorTheme; 120 85 /** @} */ 121 86 }; 122 87 123 #endif /* !FEQT_INCLUDED_SRC_settings_ machine_UIMachineSettingsInterface_h */88 #endif /* !FEQT_INCLUDED_SRC_settings_global_UIGlobalSettingsInterface_h */
Note:
See TracChangeset
for help on using the changeset viewer.