Changeset 52100 in vbox
- Timestamp:
- Jul 18, 2014 12:58:30 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95112
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r52035 r52100 109 109 const char* UIExtraDataDefs::GUI_MiniToolBarAutoHide = "GUI/MiniToolBarAutoHide"; 110 110 const char* UIExtraDataDefs::GUI_MiniToolBarAlignment = "GUI/MiniToolBarAlignment"; 111 const char* UIExtraDataDefs::GUI_StatusBar_Enabled = "GUI/StatusBar/Enabled"; 111 112 const char* UIExtraDataDefs::GUI_RestrictedStatusBarIndicators = "GUI/RestrictedStatusBarIndicators"; 112 113 const char* UIExtraDataDefs::GUI_StatusBar_IndicatorOrder = "GUI/StatusBar/IndicatorOrder"; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r52097 r52100 201 201 /** Holds mini-toolbar alignment. */ 202 202 extern const char* GUI_MiniToolBarAlignment; 203 /** Holds Runtime UI status-bar availability status. */ 204 extern const char* GUI_StatusBar_Enabled; 203 205 /** Holds restricted Runtime UI status-bar indicators. */ 204 206 extern const char* GUI_RestrictedStatusBarIndicators; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r52035 r52100 1783 1783 << GUI_HiDPI_Optimization 1784 1784 << GUI_ShowMiniToolBar << GUI_MiniToolBarAutoHide << GUI_MiniToolBarAlignment 1785 << GUI_ RestrictedStatusBarIndicators << GUI_StatusBar_IndicatorOrder1785 << GUI_StatusBar_Enabled << GUI_RestrictedStatusBarIndicators << GUI_StatusBar_IndicatorOrder 1786 1786 #ifdef Q_WS_MAC 1787 1787 << GUI_PresentationModeEnabled … … 2804 2804 } 2805 2805 setExtraDataString(GUI_MiniToolBarAlignment, QString(), strID); 2806 } 2807 2808 bool UIExtraDataManager::statusBarEnabled(const QString &strID) 2809 { 2810 /* 'True' unless feature restricted: */ 2811 return !isFeatureRestricted(GUI_StatusBar_Enabled, strID); 2812 } 2813 2814 void UIExtraDataManager::setStatusBarEnabled(bool fEnabled, const QString &strID) 2815 { 2816 /* 'False' if feature restricted, null-string otherwise: */ 2817 setExtraDataString(GUI_StatusBar_Enabled, toFeatureRestricted(!fEnabled), strID); 2806 2818 } 2807 2819 … … 3165 3177 { 3166 3178 /* Status-bar configuration change: */ 3167 if (strKey == GUI_RestrictedStatusBarIndicators || 3179 if (strKey == GUI_StatusBar_Enabled || 3180 strKey == GUI_RestrictedStatusBarIndicators || 3168 3181 strKey == GUI_StatusBar_IndicatorOrder) 3169 3182 emit sigStatusBarConfigurationChange(); -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r52035 r52100 364 364 void setMiniToolbarAlignment(Qt::AlignmentFlag alignment, const QString &strID); 365 365 366 /** Returns whether Runtime UI status-bar is enabled. */ 367 bool statusBarEnabled(const QString &strID); 368 /** Defines whether Runtime UI status-bar is @a fEnabled. */ 369 void setStatusBarEnabled(bool fEnabled, const QString &strID); 370 366 371 /** Returns restricted Runtime UI status-bar indicator list. */ 367 372 QList<IndicatorType> restrictedStatusBarIndicators(const QString &strID); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
r52097 r52100 738 738 setName(QApplication::translate("UIActionPool", "&Status Bar Settings...")); 739 739 setStatusTip(QApplication::translate("UIActionPool", "Opens window to configure status-bar")); 740 } 741 }; 742 743 class UIActionToggleStatusBar : public UIActionToggle 744 { 745 Q_OBJECT; 746 747 public: 748 749 UIActionToggleStatusBar(UIActionPool *pParent) 750 : UIActionToggle(pParent) 751 { 752 retranslateUi(); 753 } 754 755 protected: 756 757 QString shortcutExtraDataID() const 758 { 759 return QString("ToggleStatusBar"); 760 } 761 762 void retranslateUi() 763 { 764 setName(QApplication::translate("UIActionPool", "Show Status &Bar")); 765 setStatusTip(QApplication::translate("UIActionPool", "Toggle status-bar visibility for this machine")); 740 766 } 741 767 }; … … 1388 1414 m_pool[UIActionIndexRuntime_Simple_AdjustWindow] = new UIActionSimplePerformWindowAdjust(this); 1389 1415 m_pool[UIActionIndexRuntime_Simple_StatusBarSettings] = new UIActionSimpleShowStatusBarSettingsWindow(this); 1416 m_pool[UIActionIndexRuntime_Toggle_StatusBar] = new UIActionToggleStatusBar(this); 1390 1417 1391 1418 /* 'Devices' actions: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h
r52097 r52100 56 56 UIActionIndexRuntime_Menu_StatusBar, 57 57 UIActionIndexRuntime_Simple_StatusBarSettings, 58 UIActionIndexRuntime_Toggle_StatusBar, 58 59 59 60 /* 'Devices' menu actions: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r52035 r52100 917 917 , m_pSession(pSession) 918 918 , m_session(m_pSession->session()) 919 , m_fEnabled(false) 919 920 , m_pTimerAutoUpdate(0) 920 921 { … … 1040 1041 void UIIndicatorsPool::updatePool() 1041 1042 { 1042 /* Recache status-bar configuration: */ 1043 /* Acquire status-bar availability: */ 1044 m_fEnabled = gEDataManager->statusBarEnabled(vboxGlobal().managedVMUuid()); 1045 /* If status-bar is not enabled: */ 1046 if (!m_fEnabled) 1047 { 1048 /* Remove all indicators: */ 1049 while (!m_pool.isEmpty()) 1050 { 1051 const IndicatorType firstType = m_pool.keys().first(); 1052 delete m_pool.value(firstType); 1053 m_pool.remove(firstType); 1054 } 1055 /* And return: */ 1056 return; 1057 } 1058 1059 /* Acquire status-bar restrictions: */ 1043 1060 m_restrictions = gEDataManager->restrictedStatusBarIndicators(vboxGlobal().managedVMUuid()); 1061 /* Remove restricted indicators: */ 1062 foreach (const IndicatorType &indicatorType, m_restrictions) 1063 { 1064 if (m_pool.contains(indicatorType)) 1065 { 1066 delete m_pool.value(indicatorType); 1067 m_pool.remove(indicatorType); 1068 } 1069 } 1070 1071 /* Acquire status-bar order: */ 1044 1072 m_order = gEDataManager->statusBarIndicatorOrder(vboxGlobal().managedVMUuid()); 1045 1046 1073 /* Make sure the order is complete taking restrictions into account: */ 1047 1074 for (int iType = IndicatorType_Invalid; iType < IndicatorType_Max; ++iType) … … 1060 1087 m_order << type; 1061 1088 } 1062 1063 /* Remove restricted indicators: */1064 foreach (const IndicatorType &indicatorType, m_restrictions)1065 if (m_pool.contains(indicatorType))1066 {1067 delete m_pool.value(indicatorType);1068 m_pool.remove(indicatorType);1069 }1070 1089 1071 1090 /* Add/Update allowed indicators: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.h
r52035 r52100 105 105 /** Holds the session reference. */ 106 106 CSession &m_session; 107 /** Holds whether status-bar is enabled. */ 108 bool m_fEnabled; 107 109 /** Holds the cached restrictions. */ 108 110 QList<IndicatorType> m_restrictions; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r52097 r52100 859 859 m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)); 860 860 m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings)); 861 m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar)); 861 862 m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_HardDisks)); 862 863 m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_StorageSettings)); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r52097 r52100 413 413 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)); 414 414 gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->menu()->addAction(gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings)); 415 gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->menu()->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar)); 415 416 } 416 417 else … … 418 419 gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->setEnabled(false); 419 420 gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings)->setEnabled(false); 421 gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar)->setEnabled(false); 420 422 } 421 423 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r52086 r52100 1073 1073 void UISession::loadSessionSettings() 1074 1074 { 1075 /* Get uisession machine: */1076 CMachine machine = session().GetConsole().GetMachine();1077 1078 1075 /* Load extra-data settings: */ 1079 1076 { … … 1106 1103 RuntimeMenuHelpActionType_All); 1107 1104 1108 /* Temporary: */1109 QString strSettings;1110 1111 1105 #ifndef Q_WS_MAC 1112 1106 /* Load/prepare user's machine-window icon: */ … … 1139 1133 /* Should we allow snapshot operations? */ 1140 1134 m_fSnapshotOperationsAllowed = gEDataManager->machineSnapshotOperationsEnabled(vboxGlobal().managedVMUuid()); 1135 1136 /* Status-bar options: */ 1137 const bool fEnabledGlobally = !vboxGlobal().settings().isFeatureActive("noStatusBar"); 1138 const bool fEnabledForMachine = gEDataManager->statusBarEnabled(vboxGlobal().managedVMUuid()); 1139 const bool fEnabled = fEnabledGlobally && fEnabledForMachine; 1140 QAction *pActionStatusBarSettings = gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings); 1141 pActionStatusBarSettings->setEnabled(fEnabled); 1142 QAction *pActionStatusBarSwitch = gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar); 1143 pActionStatusBarSwitch->blockSignals(true); 1144 pActionStatusBarSwitch->setChecked(fEnabled); 1145 pActionStatusBarSwitch->blockSignals(false); 1141 1146 1142 1147 /* What is the default close action and the restricted are? */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
r52097 r52100 75 75 AssertReturnVoid(isMachineWindowsCreated()); 76 76 77 /* Prevent user from opening another one editor: */ 77 /* Make sure status-bar is enabled: */ 78 const bool fEnabled = gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar)->isChecked(); 79 AssertReturnVoid(fEnabled); 80 81 /* Prevent user from opening another one editor or toggle status-bar: */ 78 82 gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings)->setEnabled(false); 83 gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar)->setEnabled(false); 79 84 /* Create status-bar editor: */ 80 85 UIStatusBarEditorWindow *pStatusBarEditor = new UIStatusBarEditorWindow(activeMachineWindow()); … … 95 100 void UIMachineLogicNormal::sltStatusBarSettingsClosed() 96 101 { 97 /* Allow user to open editor again: */ 102 /* Make sure status-bar is enabled: */ 103 const bool fEnabled = gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar)->isChecked(); 104 AssertReturnVoid(fEnabled); 105 106 /* Allow user to open editor and toggle status-bar again: */ 98 107 gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings)->setEnabled(true); 108 gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar)->setEnabled(true); 109 } 110 111 void UIMachineLogicNormal::sltToggleStatusBar() 112 { 113 /* Do not process if window(s) missed! */ 114 AssertReturnVoid(isMachineWindowsCreated()); 115 116 /* Invert status-bar availability option: */ 117 const bool fEnabled = gEDataManager->statusBarEnabled(vboxGlobal().managedVMUuid()); 118 gEDataManager->setStatusBarEnabled(!fEnabled, vboxGlobal().managedVMUuid()); 99 119 } 100 120 … … 154 174 connect(gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings), SIGNAL(triggered(bool)), 155 175 this, SLOT(sltOpenStatusBarSettings())); 176 connect(gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar), SIGNAL(triggered(bool)), 177 this, SLOT(sltToggleStatusBar())); 156 178 157 179 /* "Device" actions connections: */ … … 218 240 disconnect(gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings), SIGNAL(triggered(bool)), 219 241 this, SLOT(sltOpenStatusBarSettings())); 242 disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar), SIGNAL(triggered(bool)), 243 this, SLOT(sltToggleStatusBar())); 220 244 221 245 /* Call to base-class: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h
r52097 r52100 42 42 void sltOpenStatusBarSettings(); 43 43 void sltStatusBarSettingsClosed(); 44 void sltToggleStatusBar(); 44 45 45 46 /* Devices menu functionality: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r52097 r52100 113 113 } 114 114 115 void UIMachineWindowNormal::sltHandleStatusBarConfigurationChange() 116 { 117 /* Check whether status-bar is enabled: */ 118 const bool fEnabled = gEDataManager->statusBarEnabled(vboxGlobal().managedVMUuid()); 119 /* Update settings action 'enable' state: */ 120 QAction *pActionStatusBarSettings = gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings); 121 pActionStatusBarSettings->setEnabled(fEnabled); 122 /* Update switch action 'checked' state: */ 123 QAction *pActionStatusBarSwitch = gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar); 124 pActionStatusBarSwitch->blockSignals(true); 125 pActionStatusBarSwitch->setChecked(fEnabled); 126 pActionStatusBarSwitch->blockSignals(false); 127 128 /* Update status-bar visibility: */ 129 statusBar()->setVisible(pActionStatusBarSwitch->isChecked()); 130 m_pIndicatorsPool->setAutoUpdateIndicatorStates(statusBar()->isVisible()); 131 132 /* Normalize geometry without moving: */ 133 normalizeGeometry(false); 134 } 135 115 136 void UIMachineWindowNormal::sltHandleStatusBarContextMenuRequest(const QPoint &position) 116 137 { … … 211 232 statusBar()->addPermanentWidget(m_pIndicatorsPool, 0); 212 233 } 234 /* Post-configure status-bar: */ 235 connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange()), 236 this, SLOT(sltHandleStatusBarConfigurationChange())); 213 237 } 214 238 … … 253 277 /* Load GUI customizations: */ 254 278 { 255 VBoxGlobalSettings settings = vboxGlobal().settings();256 279 #ifndef Q_WS_MAC 257 menuBar()->setHidden(settings.isFeatureActive("noMenuBar")); 280 /* Update menu-bar visibility: */ 281 menuBar()->setHidden(vboxGlobal().settings().isFeatureActive("noMenuBar")); 258 282 #endif /* !Q_WS_MAC */ 259 statusBar()->setHidden(settings.isFeatureActive("noStatusBar"));260 if (statusBar()->isHidden())261 m_pIndicatorsPool->setAutoUpdateIndicatorStates(false);283 /* Update status-bar visibility: */ 284 statusBar()->setVisible(gActionPool->action(UIActionIndexRuntime_Toggle_StatusBar)->isChecked()); 285 m_pIndicatorsPool->setAutoUpdateIndicatorStates(statusBar()->isVisible()); 262 286 } 263 287 … … 449 473 m_pIndicatorsPool->setAutoUpdateIndicatorStates(false); 450 474 else if (uisession()->isRunning()) 451 m_pIndicatorsPool->setAutoUpdateIndicatorStates( true);475 m_pIndicatorsPool->setAutoUpdateIndicatorStates(statusBar()->isVisible()); 452 476 } 453 477 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
r52097 r52100 59 59 void sltCPUExecutionCapChange(); 60 60 61 /** Handles status-bar configuration-change: */ 62 void sltHandleStatusBarConfigurationChange(); 61 63 /** Handles status-bar context-menu-request: */ 62 64 void sltHandleStatusBarContextMenuRequest(const QPoint &position);
Note:
See TracChangeset
for help on using the changeset viewer.