- Timestamp:
- Sep 8, 2014 11:42:02 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95941
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r52583 r52645 582 582 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar: strResult = "MenuBar"; break; 583 583 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings: strResult = "MenuBarSettings"; break; 584 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar: strResult = "ToggleMenuBar"; break; 584 585 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar: strResult = "StatusBar"; break; 585 586 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings: strResult = "StatusBarSettings"; break; … … 610 611 keys << "MenuBar"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar; 611 612 keys << "MenuBarSettings"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings; 613 keys << "ToggleMenuBar"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar; 612 614 keys << "StatusBar"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar; 613 615 keys << "StatusBarSettings"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r52190 r52645 78 78 const char* UIExtraDataDefs::GUI_LastScaleWindowPosition = "GUI/LastScaleWindowPosition"; 79 79 const char* UIExtraDataDefs::GUI_Geometry_State_Max = "max"; 80 const char* UIExtraDataDefs::GUI_MenuBar_Enabled = "GUI/MenuBar/Enabled"; 80 81 const char* UIExtraDataDefs::GUI_RestrictedRuntimeMenus = "GUI/RestrictedRuntimeMenus"; 81 82 #ifdef Q_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r52583 r52645 142 142 /** Holds machine-window geometry maximized state flag. */ 143 143 extern const char* GUI_Geometry_State_Max; 144 /** Holds Runtime UI menu-bar availability status. */ 145 extern const char* GUI_MenuBar_Enabled; 144 146 /** Holds restricted Runtime UI menu types. */ 145 147 extern const char* GUI_RestrictedRuntimeMenus; … … 368 370 RuntimeMenuViewActionType_MenuBar = RT_BIT(5), 369 371 RuntimeMenuViewActionType_MenuBarSettings = RT_BIT(6), 370 RuntimeMenuViewActionType_StatusBar = RT_BIT(7), 371 RuntimeMenuViewActionType_StatusBarSettings = RT_BIT(8), 372 RuntimeMenuViewActionType_ToggleStatusBar = RT_BIT(9), 373 RuntimeMenuViewActionType_Resize = RT_BIT(10), 374 RuntimeMenuViewActionType_Multiscreen = RT_BIT(11), 372 RuntimeMenuViewActionType_ToggleMenuBar = RT_BIT(7), 373 RuntimeMenuViewActionType_StatusBar = RT_BIT(8), 374 RuntimeMenuViewActionType_StatusBarSettings = RT_BIT(9), 375 RuntimeMenuViewActionType_ToggleStatusBar = RT_BIT(10), 376 RuntimeMenuViewActionType_Resize = RT_BIT(11), 377 RuntimeMenuViewActionType_Multiscreen = RT_BIT(12), 375 378 RuntimeMenuViewActionType_All = 0xFFFF 376 379 }; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r52583 r52645 2489 2489 } 2490 2490 2491 bool UIExtraDataManager::menuBarEnabled(const QString &strID) 2492 { 2493 /* 'True' unless feature restricted: */ 2494 return !isFeatureRestricted(GUI_MenuBar_Enabled, strID); 2495 } 2496 2497 void UIExtraDataManager::setMenuBarEnabled(bool fEnabled, const QString &strID) 2498 { 2499 /* 'False' if feature restricted, null-string otherwise: */ 2500 setExtraDataString(GUI_MenuBar_Enabled, toFeatureRestricted(!fEnabled), strID); 2501 } 2502 2491 2503 UIExtraDataMetaDefs::MenuType UIExtraDataManager::restrictedRuntimeMenuTypes(const QString &strID) 2492 2504 { … … 3441 3453 { 3442 3454 /* Status-bar configuration change: */ 3443 if (strKey == GUI_RestrictedRuntimeMenus || 3455 if (strKey == GUI_MenuBar_Enabled || 3456 strKey == GUI_RestrictedRuntimeMenus || 3444 3457 #ifdef Q_WS_MAC 3445 3458 strKey == GUI_RestrictedRuntimeApplicationMenuActions || -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r52583 r52645 286 286 void setMachineWindowGeometry(UIVisualStateType visualStateType, ulong uScreenIndex, const QRect &geometry, bool fMaximized, const QString &strID); 287 287 288 /** Returns whether Runtime UI menu-bar is enabled. */ 289 bool menuBarEnabled(const QString &strID); 290 /** Defines whether Runtime UI menu-bar is @a fEnabled. */ 291 void setMenuBarEnabled(bool fEnabled, const QString &strID); 292 288 293 /** Returns restricted Runtime UI menu types. */ 289 294 UIExtraDataMetaDefs::MenuType restrictedRuntimeMenuTypes(const QString &strID); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
r52589 r52645 875 875 setName(QApplication::translate("UIActionPool", "&Menu Bar Settings...")); 876 876 setStatusTip(QApplication::translate("UIActionPool", "Opens window to configure menu-bar")); 877 } 878 }; 879 880 class UIActionToggleMenuBar : public UIActionToggle 881 { 882 Q_OBJECT; 883 884 public: 885 886 UIActionToggleMenuBar(UIActionPool *pParent) 887 : UIActionToggle(pParent, ":/menubar_on_16px.png", ":/menubar_16px.png", 888 ":/menubar_on_disabled_16px.png", ":/menubar_disabled_16px.png") {} 889 890 protected: 891 892 /** Returns action extra-data ID. */ 893 virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar; } 894 /** Returns action extra-data key. */ 895 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar); } 896 /** Returns whether action is allowed. */ 897 virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar); } 898 899 QString shortcutExtraDataID() const 900 { 901 return QString("ToggleMenuBar"); 902 } 903 904 void retranslateUi() 905 { 906 setName(QApplication::translate("UIActionPool", "Show Menu &Bar")); 907 setStatusTip(QApplication::translate("UIActionPool", "Toggle menu-bar visibility for this machine")); 877 908 } 878 909 }; … … 1910 1941 m_pool[UIActionIndexRT_M_View_M_MenuBar] = new UIActionMenuMenuBar(this); 1911 1942 m_pool[UIActionIndexRT_M_View_M_MenuBar_S_Settings] = new UIActionSimpleShowMenuBarSettingsWindow(this); 1943 m_pool[UIActionIndexRT_M_View_M_MenuBar_T_Visibility] = new UIActionToggleMenuBar(this); 1912 1944 m_pool[UIActionIndexRT_M_View_M_StatusBar] = new UIActionMenuStatusBar(this); 1913 1945 m_pool[UIActionIndexRT_M_View_M_StatusBar_S_Settings] = new UIActionSimpleShowStatusBarSettingsWindow(this); … … 2377 2409 /* 'Menu Bar Settings' action: */ 2378 2410 addAction(pMenu, action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)); 2411 /* 'Toggle Menu Bar' action: */ 2412 addAction(pMenu, action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)); 2379 2413 2380 2414 /* Mark menu as valid: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h
r52583 r52645 72 72 UIActionIndexRT_M_View_M_MenuBar, 73 73 UIActionIndexRT_M_View_M_MenuBar_S_Settings, 74 UIActionIndexRT_M_View_M_MenuBar_T_Visibility, 74 75 UIActionIndexRT_M_View_M_StatusBar, 75 76 UIActionIndexRT_M_View_M_StatusBar_S_Settings, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r52579 r52645 868 868 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar)); 869 869 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)); 870 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)); 870 871 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar)); 871 872 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings)); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r52558 r52645 1189 1189 pGuestAutoresizeSwitch->setChecked(gEDataManager->guestScreenAutoResizeEnabled(strMachineID)); 1190 1190 1191 /* Menu-bar options: */ 1192 { 1193 const bool fEnabledGlobally = !vboxGlobal().settings().isFeatureActive("noMenuBar"); 1194 const bool fEnabledForMachine = gEDataManager->menuBarEnabled(strMachineID); 1195 const bool fEnabled = fEnabledGlobally && fEnabledForMachine; 1196 QAction *pActionMenuBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings); 1197 pActionMenuBarSettings->setEnabled(fEnabled); 1198 QAction *pActionMenuBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility); 1199 pActionMenuBarSwitch->blockSignals(true); 1200 pActionMenuBarSwitch->setChecked(fEnabled); 1201 pActionMenuBarSwitch->blockSignals(false); 1202 } 1203 1191 1204 /* Status-bar options: */ 1192 const bool fEnabledGlobally = !vboxGlobal().settings().isFeatureActive("noStatusBar"); 1193 const bool fEnabledForMachine = gEDataManager->statusBarEnabled(strMachineID); 1194 const bool fEnabled = fEnabledGlobally && fEnabledForMachine; 1195 QAction *pActionStatusBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings); 1196 pActionStatusBarSettings->setEnabled(fEnabled); 1197 QAction *pActionStatusBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility); 1198 pActionStatusBarSwitch->blockSignals(true); 1199 pActionStatusBarSwitch->setChecked(fEnabled); 1200 pActionStatusBarSwitch->blockSignals(false); 1205 { 1206 const bool fEnabledGlobally = !vboxGlobal().settings().isFeatureActive("noStatusBar"); 1207 const bool fEnabledForMachine = gEDataManager->statusBarEnabled(strMachineID); 1208 const bool fEnabled = fEnabledGlobally && fEnabledForMachine; 1209 QAction *pActionStatusBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings); 1210 pActionStatusBarSettings->setEnabled(fEnabled); 1211 QAction *pActionStatusBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility); 1212 pActionStatusBarSwitch->blockSignals(true); 1213 pActionStatusBarSwitch->setChecked(fEnabled); 1214 pActionStatusBarSwitch->blockSignals(false); 1215 } 1201 1216 1202 1217 /* What is the default close action and the restricted are? */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
r52478 r52645 81 81 AssertReturnVoid(isMachineWindowsCreated()); 82 82 83 /* Prevent user from opening another one editor: */ 83 /* Make sure menu-bar is enabled: */ 84 const bool fEnabled = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->isChecked(); 85 AssertReturnVoid(fEnabled); 86 87 /* Prevent user from opening another one editor or toggle menu-bar: */ 84 88 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)->setEnabled(false); 89 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->setEnabled(false); 85 90 /* Create menu-bar editor: */ 86 91 UIMenuBarEditorWindow *pMenuBarEditor = new UIMenuBarEditorWindow(activeMachineWindow(), actionPool()); … … 101 106 void UIMachineLogicNormal::sltMenuBarSettingsClosed() 102 107 { 103 /* Allow user to open editor again: */ 108 /* Make sure menu-bar is enabled: */ 109 const bool fEnabled = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->isChecked(); 110 AssertReturnVoid(fEnabled); 111 112 /* Allow user to open editor and toggle menu-bar again: */ 104 113 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)->setEnabled(true); 114 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->setEnabled(true); 115 } 116 117 void UIMachineLogicNormal::sltToggleMenuBar() 118 { 119 /* Do not process if window(s) missed! */ 120 AssertReturnVoid(isMachineWindowsCreated()); 121 122 /* Invert menu-bar availability option: */ 123 const bool fEnabled = gEDataManager->menuBarEnabled(vboxGlobal().managedVMUuid()); 124 gEDataManager->setMenuBarEnabled(!fEnabled, vboxGlobal().managedVMUuid()); 105 125 } 106 126 … … 196 216 connect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings), SIGNAL(triggered(bool)), 197 217 this, SLOT(sltOpenMenuBarSettings())); 218 connect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility), SIGNAL(triggered(bool)), 219 this, SLOT(sltToggleMenuBar())); 198 220 connect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings), SIGNAL(triggered(bool)), 199 221 this, SLOT(sltOpenStatusBarSettings())); … … 262 284 disconnect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings), SIGNAL(triggered(bool)), 263 285 this, SLOT(sltOpenMenuBarSettings())); 286 disconnect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility), SIGNAL(triggered(bool)), 287 this, SLOT(sltToggleMenuBar())); 264 288 disconnect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings), SIGNAL(triggered(bool)), 265 289 this, SLOT(sltOpenStatusBarSettings())); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h
r52478 r52645 42 42 void sltCheckForRequestedVisualStateType(); 43 43 44 /* View menu functionality:*/44 /** Opens menu-bar editor.*/ 45 45 void sltOpenMenuBarSettings(); 46 /** Handles menu-bar editor closing.*/ 46 47 void sltMenuBarSettingsClosed(); 48 /** Toggles menu-bar presence.*/ 49 void sltToggleMenuBar(); 50 51 /** Opens status-bar editor.*/ 47 52 void sltOpenStatusBarSettings(); 53 /** Handles status-bar editor closing.*/ 48 54 void sltStatusBarSettingsClosed(); 55 /** Toggles status-bar presence.*/ 49 56 void sltToggleStatusBar(); 57 58 /** Handles guest-screen toggle requests. */ 50 59 void sltHandleActionTriggerViewScreenToggle(int iIndex, bool fEnabled); 60 /** Handles guest-screen resize requests. */ 51 61 void sltHandleActionTriggerViewScreenResize(int iIndex, const QSize &size); 52 62 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r52638 r52645 118 118 void UIMachineWindowNormal::sltHandleMenuBarConfigurationChange() 119 119 { 120 /* Check whether menu-bar is enabled: */ 121 const bool fEnabled = gEDataManager->menuBarEnabled(vboxGlobal().managedVMUuid()); 122 /* Update settings action 'enable' state: */ 123 QAction *pActionMenuBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings); 124 pActionMenuBarSettings->setEnabled(fEnabled); 125 /* Update switch action 'checked' state: */ 126 QAction *pActionMenuBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility); 127 pActionMenuBarSwitch->blockSignals(true); 128 pActionMenuBarSwitch->setChecked(fEnabled); 129 pActionMenuBarSwitch->blockSignals(false); 130 131 /* Update menu-bar visibility: */ 132 menuBar()->setVisible(pActionMenuBarSwitch->isChecked()); 120 133 /* Update menu-bar: */ 121 134 updateMenu(); 135 136 /* Normalize geometry without moving: */ 137 normalizeGeometry(false /* adjust position */); 138 } 139 140 void UIMachineWindowNormal::sltHandleMenuBarContextMenuRequest(const QPoint &position) 141 { 142 /* Raise action's context-menu: */ 143 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar)->menu()->exec(menuBar()->mapToGlobal(position)); 122 144 } 123 145 #endif /* !RT_OS_DARWIN */ … … 138 160 /* Update status-bar visibility: */ 139 161 statusBar()->setVisible(pActionStatusBarSwitch->isChecked()); 162 /* Update status-bar indicators-pool: */ 140 163 m_pIndicatorsPool->setAutoUpdateIndicatorStates(statusBar()->isVisible()); 141 164 … … 214 237 AssertPtrReturnVoid(menuBar()); 215 238 { 216 /* Post-configure menu-bar: */ 239 /* Configure menu-bar: */ 240 menuBar()->setContextMenuPolicy(Qt::CustomContextMenu); 241 connect(menuBar(), SIGNAL(customContextMenuRequested(const QPoint&)), 242 this, SLOT(sltHandleMenuBarContextMenuRequest(const QPoint&))); 217 243 connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange()), 218 244 this, SLOT(sltHandleMenuBarConfigurationChange())); … … 284 310 #ifndef Q_WS_MAC 285 311 /* Update menu-bar visibility: */ 286 menuBar()->set Hidden(vboxGlobal().settings().isFeatureActive("noMenuBar"));312 menuBar()->setVisible(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->isChecked()); 287 313 #endif /* !Q_WS_MAC */ 288 314 /* Update status-bar visibility: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
r52516 r52645 62 62 /** Handles menu-bar configuration-change. */ 63 63 void sltHandleMenuBarConfigurationChange(); 64 /** Handles menu-bar context-menu-request. */ 65 void sltHandleMenuBarContextMenuRequest(const QPoint &position); 64 66 #endif /* !RT_OS_DARWIN */ 65 67
Note:
See TracChangeset
for help on using the changeset viewer.