Changeset 68200 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 31, 2017 12:41:10 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 117297
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 9 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r68175 r68200 380 380 src/selector/UISnapshotDetailsWidget.h \ 381 381 src/selector/UISnapshotPane.h \ 382 src/selector/UIToolsPaneGlobal.h \ 382 383 src/selector/UIToolsPaneMachine.h \ 383 384 src/selector/UIToolsToolbar.h \ … … 697 698 src/selector/UISnapshotDetailsWidget.cpp \ 698 699 src/selector/UISnapshotPane.cpp \ 700 src/selector/UIToolsPaneGlobal.cpp \ 699 701 src/selector/UIToolsPaneMachine.cpp \ 700 702 src/selector/UIToolsToolbar.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc
r68175 r68200 186 186 <file alias="statusbar_settings_16px.png">images/statusbar_settings_16px.png</file> 187 187 <file alias="statusbar_settings_disabled_16px.png">images/statusbar_settings_disabled_16px.png</file> 188 <file alias="tools_global_32px.png">images/tools_global_32px.png</file> 188 189 <file alias="tools_machine_32px.png">images/tools_machine_32px.png</file> 189 190 <file alias="tpixel.png">images/tpixel.png</file> -
trunk/src/VBox/Frontends/VirtualBox/VirtualBox2_hidpi.qrc
r68175 r68200 195 195 <file alias="statusbar_settings_16px_hidpi.png">images/hidpi/statusbar_settings_16px_hidpi.png</file> 196 196 <file alias="statusbar_settings_disabled_16px_hidpi.png">images/hidpi/statusbar_settings_disabled_16px_hidpi.png</file> 197 <file alias="tools_global_32px_hidpi.png">images/hidpi/tools_global_32px_hidpi.png</file> 197 198 <file alias="tools_machine_32px_hidpi.png">images/hidpi/tools_machine_32px_hidpi.png</file> 198 199 <file alias="usb_16px_hidpi.png">images/hidpi/usb_16px_hidpi.png</file> -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp
r68197 r68200 1021 1021 setName(QApplication::translate("UIActionPool", "&Snapshots")); 1022 1022 setStatusTip(QApplication::translate("UIActionPool", "Open machine snapshots pane")); 1023 } 1024 }; 1025 1026 1027 class UIActionToggleToolsGlobal : public UIActionToggle 1028 { 1029 Q_OBJECT; 1030 1031 public: 1032 1033 UIActionToggleToolsGlobal(UIActionPool *pParent) 1034 : UIActionToggle(pParent, ":/tools_global_32px.png") {} 1035 1036 protected: 1037 1038 QString shortcutExtraDataID() const 1039 { 1040 return QString("ToolsGlobal"); 1041 } 1042 1043 void retranslateUi() 1044 { 1045 setName(QApplication::translate("UIActionPool", "&Global Tools")); 1046 setStatusTip(QApplication::translate("UIActionPool", "Switch to global tools")); 1047 } 1048 }; 1049 1050 class UIActionMenuToolsGlobal : public UIActionMenu 1051 { 1052 Q_OBJECT; 1053 1054 public: 1055 1056 UIActionMenuToolsGlobal(UIActionPool *pParent) 1057 : UIActionMenu(pParent) {} 1058 1059 protected: 1060 1061 QString shortcutExtraDataID() const 1062 { 1063 return QString("ToolsGlobalMenu"); 1064 } 1065 1066 void retranslateUi() 1067 { 1068 setName(QApplication::translate("UIActionPool", "&Global Tools Menu")); 1069 setStatusTip(QApplication::translate("UIActionPool", "Open global tools menu")); 1070 } 1071 }; 1072 1073 class UIActionSimpleToolsGlobalVirtualMediaManager : public UIActionSimple 1074 { 1075 Q_OBJECT; 1076 1077 public: 1078 1079 UIActionSimpleToolsGlobalVirtualMediaManager(UIActionPool *pParent) 1080 : UIActionSimple(pParent, 1081 ":/diskimage_22px.png", ":/diskimage_16px.png", 1082 ":/diskimage_22px.png", ":/diskimage_16px.png") {} 1083 1084 protected: 1085 1086 QString shortcutExtraDataID() const 1087 { 1088 return QString("ToolsGlobalVirtualMediaManager"); 1089 } 1090 1091 void retranslateUi() 1092 { 1093 setName(QApplication::translate("UIActionPool", "&Virtual Media Manager")); 1094 setStatusTip(QApplication::translate("UIActionPool", "Open Virtual Media Manager")); 1095 } 1096 }; 1097 1098 class UIActionSimpleToolsGlobalHostNetworkManager : public UIActionSimple 1099 { 1100 Q_OBJECT; 1101 1102 public: 1103 1104 UIActionSimpleToolsGlobalHostNetworkManager(UIActionPool *pParent) 1105 : UIActionSimple(pParent, 1106 ":/host_iface_manager_22px.png", ":/host_iface_manager_16px.png", 1107 ":/host_iface_manager_22px.png", ":/host_iface_manager_16px.png") {} 1108 1109 protected: 1110 1111 QString shortcutExtraDataID() const 1112 { 1113 return QString("ToolsGlobalHostNetworkManager"); 1114 } 1115 1116 void retranslateUi() 1117 { 1118 setName(QApplication::translate("UIActionPool", "&Host Network Manager")); 1119 setStatusTip(QApplication::translate("UIActionPool", "Open Host Network Manager")); 1023 1120 } 1024 1121 }; … … 1224 1321 m_pool[UIActionIndexST_M_Tools_M_Machine_Snapshots] = new UIActionSimpleToolsMachineSnapshots(this); 1225 1322 1323 /* Global Tools actions: */ 1324 m_pool[UIActionIndexST_M_Tools_T_Global] = new UIActionToggleToolsGlobal(this); 1325 m_pool[UIActionIndexST_M_Tools_M_Global] = new UIActionMenuToolsGlobal(this); 1326 m_pool[UIActionIndexST_M_Tools_M_Global_VirtualMediaManager] = new UIActionSimpleToolsGlobalVirtualMediaManager(this); 1327 m_pool[UIActionIndexST_M_Tools_M_Global_HostNetworkManager] = new UIActionSimpleToolsGlobalHostNetworkManager(this); 1328 1226 1329 /* Call to base-class: */ 1227 1330 UIActionPool::preparePool(); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.h
r68168 r68200 98 98 UIActionIndexST_M_Tools_M_Machine_Snapshots, 99 99 100 /* Global Tools actions: */ 101 UIActionIndexST_M_Tools_T_Global, 102 UIActionIndexST_M_Tools_M_Global, 103 UIActionIndexST_M_Tools_M_Global_VirtualMediaManager, 104 UIActionIndexST_M_Tools_M_Global_HostNetworkManager, 105 100 106 /* Maximum index: */ 101 107 UIActionIndexST_Max -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r68199 r68200 44 44 # include "UISelectorWindow.h" 45 45 # include "UISettingsDialogSpecific.h" 46 # include "UISlidingWidget.h" 46 47 # include "UISpacerWidgets.h" 47 48 # include "UIToolBar.h" … … 111 112 , m_fWarningAboutInaccessibleMediaShown(false) 112 113 , m_pActionPool(0) 114 , m_pSlidingWidget(0) 113 115 , m_pSplitter(0) 114 116 #ifndef VBOX_WS_MAC … … 119 121 , m_pPaneChooser(0) 120 122 , m_pPaneToolsMachine(0) 123 , m_pPaneToolsGlobal(0) 121 124 , m_pGroupMenuAction(0) 122 125 , m_pMachineMenuAction(0) … … 279 282 280 283 /* Make sure MM window is not opened: */ 281 if (m_pManagerVirtualMedia) 284 if ( m_pManagerVirtualMedia 285 || m_pPaneToolsGlobal->isToolOpened(ToolTypeGlobal_VirtualMedia)) 282 286 return; 283 287 … … 384 388 void UISelectorWindow::sltOpenVirtualMediumManagerWindow() 385 389 { 390 /* First check if instance of widget opened embedded: */ 391 if (m_pPaneToolsGlobal->isToolOpened(ToolTypeGlobal_VirtualMedia)) 392 { 393 m_pPaneToolsGlobal->openTool(ToolTypeGlobal_VirtualMedia); 394 return; 395 } 396 386 397 /* Create instance if not yet created: */ 387 398 if (!m_pManagerVirtualMedia) … … 410 421 void UISelectorWindow::sltOpenHostNetworkManagerWindow() 411 422 { 423 /* First check if instance of widget opened embedded: */ 424 if (m_pPaneToolsGlobal->isToolOpened(ToolTypeGlobal_HostNetwork)) 425 { 426 m_pPaneToolsGlobal->openTool(ToolTypeGlobal_HostNetwork); 427 return; 428 } 429 412 430 /* Create instance if not yet created: */ 413 431 if (!m_pManagerHostNetwork) … … 1009 1027 } 1010 1028 1029 void UISelectorWindow::sltHandleToolsTypeSwitch() 1030 { 1031 /* If Machine tool button is checked => go backward: */ 1032 if (actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->isChecked()) 1033 m_pSlidingWidget->moveBackward(); 1034 1035 else 1036 1037 /* If Global tool button is checked => go forward: */ 1038 if (actionPool()->action(UIActionIndexST_M_Tools_T_Global)->isChecked()) 1039 m_pSlidingWidget->moveForward(); 1040 1041 /* Update action visibility: */ 1042 updateActionsVisibility(); 1043 } 1044 1011 1045 void UISelectorWindow::sltHandleToolOpenedMachine(ToolTypeMachine enmType) 1012 1046 { … … 1026 1060 } 1027 1061 1062 void UISelectorWindow::sltHandleToolOpenedGlobal(ToolTypeGlobal enmType) 1063 { 1064 /* Open corresponding tool: */ 1065 m_pPaneToolsGlobal->openTool(enmType); 1066 } 1067 1028 1068 void UISelectorWindow::sltHandleToolClosedMachine(ToolTypeMachine enmType) 1029 1069 { 1030 1070 /* Close corresponding tool: */ 1031 1071 m_pPaneToolsMachine->closeTool(enmType); 1072 } 1073 1074 void UISelectorWindow::sltHandleToolClosedGlobal(ToolTypeGlobal enmType) 1075 { 1076 /* Close corresponding tool: */ 1077 m_pPaneToolsGlobal->closeTool(enmType); 1032 1078 } 1033 1079 … … 1064 1110 "<p>The right part of this window represents a set of tools " 1065 1111 "you have opened for the currently chosen machine. " 1112 "For more tools check the corresponding menu at the right side " 1113 "of the main tool bar located at the top of the window.</p>" 1114 "<p>You can press the <b>%1</b> key to get instant help, " 1115 "or visit " 1116 "<a href=https://www.virtualbox.org>www.virtualbox.org</a> " 1117 "for the latest information and news.</p>") 1118 .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText))); 1119 1120 /* Translate Global Tools welcome screen: */ 1121 m_pPaneToolsGlobal->setDetailsText( 1122 tr("<h3>Welcome to VirtualBox!</h3>" 1123 "<p>This window represents a set of global tools " 1124 "you have opened. They are not related to any particular machine " 1125 "but to whole VirtualBox instead. This list will be extended with " 1126 "new tools in the future releases. " 1127 "<img src=:/welcome.png align=right/></p>" 1066 1128 "For more tools check the corresponding menu at the right side " 1067 1129 "of the main tool bar located at the top of the window.</p>" … … 1713 1775 /* Add 'Tools' actions into action-group: */ 1714 1776 pActionGroupTools->addAction(actionPool()->action(UIActionIndexST_M_Tools_T_Machine)); 1777 pActionGroupTools->addAction(actionPool()->action(UIActionIndexST_M_Tools_T_Global)); 1715 1778 } 1716 1779 … … 1779 1842 #endif /* !VBOX_WS_MAC */ 1780 1843 1781 /* Create s plitter: */1782 m_pS plitter = new QISplitter;1783 AssertPtrReturnVoid(m_pS plitter);1844 /* Create sliding-widget: */ 1845 m_pSlidingWidget = new UISlidingWidget; 1846 AssertPtrReturnVoid(m_pSlidingWidget); 1784 1847 { 1785 /* Configure splitter: */ 1848 /* Create splitter: */ 1849 m_pSplitter = new QISplitter; 1850 AssertPtrReturnVoid(m_pSplitter); 1851 { 1852 /* Configure splitter: */ 1786 1853 #ifdef VBOX_WS_X11 1787 m_pSplitter->setHandleType(QISplitter::Native);1854 m_pSplitter->setHandleType(QISplitter::Native); 1788 1855 #endif 1789 1856 1790 /* Prepare Chooser-pane: */ 1791 m_pPaneChooser = new UIGChooser(this); 1792 AssertPtrReturnVoid(m_pPaneChooser); 1793 { 1794 /* Add into splitter: */ 1795 m_pSplitter->addWidget(m_pPaneChooser); 1857 /* Prepare Chooser-pane: */ 1858 m_pPaneChooser = new UIGChooser(this); 1859 AssertPtrReturnVoid(m_pPaneChooser); 1860 { 1861 /* Add into splitter: */ 1862 m_pSplitter->addWidget(m_pPaneChooser); 1863 } 1864 1865 /* Prepare Machine Tools-pane: */ 1866 m_pPaneToolsMachine = new UIToolsPaneMachine(actionPool()); 1867 AssertPtrReturnVoid(m_pPaneToolsMachine); 1868 { 1869 /* Add into splitter: */ 1870 m_pSplitter->addWidget(m_pPaneToolsMachine); 1871 } 1872 1873 /* Adjust splitter colors according to main widgets it splits: */ 1874 m_pSplitter->configureColors(m_pPaneChooser->palette().color(QPalette::Active, QPalette::Window), 1875 m_pPaneToolsMachine->palette().color(QPalette::Active, QPalette::Window)); 1876 /* Set the initial distribution. The right site is bigger. */ 1877 m_pSplitter->setStretchFactor(0, 2); 1878 m_pSplitter->setStretchFactor(1, 3); 1796 1879 } 1797 1880 1798 /* Prepare Machine Tools-pane: */ 1799 m_pPaneToolsMachine = new UIToolsPaneMachine(actionPool()); 1800 AssertPtrReturnVoid(m_pPaneToolsMachine); 1801 { 1802 /* Add into splitter: */ 1803 m_pSplitter->addWidget(m_pPaneToolsMachine); 1804 } 1805 1806 /* Adjust splitter colors according to main widgets it splits: */ 1807 m_pSplitter->configureColors(m_pPaneChooser->palette().color(QPalette::Active, QPalette::Window), 1808 m_pPaneToolsMachine->palette().color(QPalette::Active, QPalette::Window)); 1809 /* Set the initial distribution. The right site is bigger. */ 1810 m_pSplitter->setStretchFactor(0, 2); 1811 m_pSplitter->setStretchFactor(1, 3); 1881 /* Prepare Global Tools-pane: */ 1882 m_pPaneToolsGlobal = new UIToolsPaneGlobal(actionPool()); 1883 AssertPtrReturnVoid(m_pPaneToolsGlobal); 1884 1885 /* Add left/right widgets into sliding widget: */ 1886 m_pSlidingWidget->setWidgets(m_pSplitter, m_pPaneToolsGlobal); 1812 1887 1813 1888 /* Add into layout: */ 1814 pLayout->addWidget(m_pS plitter);1889 pLayout->addWidget(m_pSlidingWidget); 1815 1890 } 1816 1891 } … … 1891 1966 connect(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_PowerOff), SIGNAL(triggered()), this, SLOT(sltPerformPowerOffMachine())); 1892 1967 1968 /* 'Tools' actions connections: */ 1969 connect(actionPool()->action(UIActionIndexST_M_Tools_T_Machine), &UIAction::toggled, 1970 this, &UISelectorWindow::sltHandleToolsTypeSwitch); 1971 connect(actionPool()->action(UIActionIndexST_M_Tools_T_Global), &UIAction::toggled, 1972 this, &UISelectorWindow::sltHandleToolsTypeSwitch); 1973 1893 1974 /* Status-bar connections: */ 1894 1975 connect(statusBar(), SIGNAL(customContextMenuRequested(const QPoint&)), … … 1910 1991 #endif /* VBOX_WS_MAC */ 1911 1992 connect(m_pToolbarTools, &UIToolsToolbar::sigToolOpenedMachine, this, &UISelectorWindow::sltHandleToolOpenedMachine); 1993 connect(m_pToolbarTools, &UIToolsToolbar::sigToolOpenedGlobal, this, &UISelectorWindow::sltHandleToolOpenedGlobal); 1912 1994 connect(m_pToolbarTools, &UIToolsToolbar::sigToolClosedMachine, this, &UISelectorWindow::sltHandleToolClosedMachine); 1995 connect(m_pToolbarTools, &UIToolsToolbar::sigToolClosedGlobal, this, &UISelectorWindow::sltHandleToolClosedGlobal); 1913 1996 1914 1997 /* VM desktop connections: */ … … 2073 2156 { 2074 2157 /* Determine whether Machine or Group menu should be shown at all: */ 2158 const bool fMachineOrGroupMenuShown = actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->isChecked(); 2075 2159 const bool fMachineMenuShown = !m_pPaneChooser->isSingleGroupSelected(); 2076 m_pMachineMenuAction->setVisible(fMachine MenuShown);2077 m_pGroupMenuAction->setVisible( !fMachineMenuShown);2160 m_pMachineMenuAction->setVisible(fMachineOrGroupMenuShown && fMachineMenuShown); 2161 m_pGroupMenuAction->setVisible(fMachineOrGroupMenuShown && !fMachineMenuShown); 2078 2162 2079 2163 /* Hide action shortcuts: */ … … 2084 2168 foreach (UIAction *pAction, m_groupActions) 2085 2169 pAction->hideShortcut(); 2170 2171 /* Update actions visibility: */ 2172 foreach (UIAction *pAction, m_machineActions) 2173 pAction->setVisible(fMachineOrGroupMenuShown); 2086 2174 2087 2175 /* Show what should be shown: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r68199 r68200 25 25 #include "QIMainWindow.h" 26 26 #include "QIWithRetranslateUI.h" 27 #include "UIToolsPaneGlobal.h" 27 28 #include "UIToolsPaneMachine.h" 28 29 #include "VBoxGlobal.h" … … 38 39 class UIMainBar; 39 40 #endif 41 class UISlidingWidget; 40 42 class UIToolBar; 41 43 class UIToolsToolbar; … … 183 185 /** @} */ 184 186 187 /** @name Tools-toolbar stuff. 188 * @{ */ 189 /** Handles tools type switch. */ 190 void sltHandleToolsTypeSwitch(); 191 /** @} */ 192 185 193 /** @name Tools-pane stuff. 186 194 * @{ */ 187 195 /** Handles rquest to open Machine tool of passed @a enmType. */ 188 196 void sltHandleToolOpenedMachine(ToolTypeMachine enmType); 197 /** Handles rquest to open Global tool of passed @a enmType. */ 198 void sltHandleToolOpenedGlobal(ToolTypeGlobal enmType); 189 199 190 200 /** Handles rquest to close Machine tool of passed @a enmType. */ 191 201 void sltHandleToolClosedMachine(ToolTypeMachine enmType); 202 /** Handles rquest to close Global tool of passed @a enmType. */ 203 void sltHandleToolClosedGlobal(ToolTypeGlobal enmType); 192 204 /** @} */ 193 205 … … 313 325 UIActionPool *m_pActionPool; 314 326 327 /** Holds the sliding-widget isntance. */ 328 UISlidingWidget *m_pSlidingWidget; 329 315 330 /** Holds the central splitter instance. */ 316 331 QISplitter *m_pSplitter; … … 329 344 /** Holds the Machine Tools-pane instance. */ 330 345 UIToolsPaneMachine *m_pPaneToolsMachine; 346 /** Holds the Global Tools-pane instance. */ 347 UIToolsPaneGlobal *m_pPaneToolsGlobal; 331 348 332 349 /** Holds the list of Group menu actions. */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneGlobal.cpp
r68175 r68200 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UIToolsPane Machineclass implementation.3 * VBox Qt GUI - UIToolsPaneGlobal class implementation. 4 4 */ 5 5 … … 26 26 # include "UIActionPoolSelector.h" 27 27 # include "UIDesktopPane.h" 28 # include "UI GDetails.h"29 # include "UI SnapshotPane.h"30 # include "UIToolsPane Machine.h"28 # include "UIMediumManager.h" 29 # include "UIHostNetworkManager.h" 30 # include "UIToolsPaneGlobal.h" 31 31 32 32 /* Other VBox includes: */ … … 36 36 37 37 38 UIToolsPane Machine::UIToolsPaneMachine(UIActionPool *pActionPool, QWidget *pParent /* = 0 */)38 UIToolsPaneGlobal::UIToolsPaneGlobal(UIActionPool *pActionPool, QWidget *pParent /* = 0 */) 39 39 : QWidget(pParent) 40 40 , m_pActionPool(pActionPool) 41 41 , m_pLayout(0) 42 42 , m_pPaneDesktop(0) 43 , m_pPane Details(0)44 , m_pPane Snapshots(0)43 , m_pPaneMedia(0) 44 , m_pPaneNetwork(0) 45 45 { 46 46 /* Prepare: */ … … 48 48 } 49 49 50 UIToolsPane Machine::~UIToolsPaneMachine()50 UIToolsPaneGlobal::~UIToolsPaneGlobal() 51 51 { 52 52 /* Cleanup: */ … … 54 54 } 55 55 56 bool UIToolsPane Machine::isToolOpened(ToolTypeMachineenmType) const56 bool UIToolsPaneGlobal::isToolOpened(ToolTypeGlobal enmType) const 57 57 { 58 58 /* Search through the stacked widgets: */ 59 59 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 60 if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolType Machine>() == enmType)60 if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeGlobal>() == enmType) 61 61 return true; 62 62 return false; 63 63 } 64 64 65 void UIToolsPane Machine::openTool(ToolTypeMachineenmType)65 void UIToolsPaneGlobal::openTool(ToolTypeGlobal enmType) 66 66 { 67 67 /* Search through the stacked widgets: */ 68 68 int iActualIndex = -1; 69 69 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 70 if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolType Machine>() == enmType)70 if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeGlobal>() == enmType) 71 71 iActualIndex = iIndex; 72 72 … … 83 83 switch (enmType) 84 84 { 85 case ToolType Machine_Desktop:85 case ToolTypeGlobal_Desktop: 86 86 { 87 87 /* Create Desktop pane: */ 88 m_pPaneDesktop = new UIDesktopPane (m_pActionPool->action(UIActionIndexST_M_Group_S_Refresh));88 m_pPaneDesktop = new UIDesktopPane; 89 89 AssertPtrReturnVoid(m_pPaneDesktop); 90 90 { 91 91 /* Configure pane: */ 92 m_pPaneDesktop->setProperty("ToolType", QVariant::fromValue(ToolType Machine_Desktop));92 m_pPaneDesktop->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_Desktop)); 93 93 94 94 /* Add into layout: */ … … 98 98 break; 99 99 } 100 case ToolType Machine_Details:100 case ToolTypeGlobal_VirtualMedia: 101 101 { 102 /* Create Details pane: */103 m_pPane Details = new UIGDetails;104 AssertPtrReturnVoid(m_pPane Details);102 /* Create Virtual Media Manager: */ 103 m_pPaneMedia = new UIMediumManagerWidget(EmbedTo_Stack); 104 AssertPtrReturnVoid(m_pPaneMedia); 105 105 { 106 106 /* Configure pane: */ 107 m_pPaneDetails->setProperty("ToolType", QVariant::fromValue(ToolTypeMachine_Details)); 108 connect(this, &UIToolsPaneMachine::sigSlidingStarted, m_pPaneDetails, &UIGDetails::sigSlidingStarted); 109 connect(this, &UIToolsPaneMachine::sigToggleStarted, m_pPaneDetails, &UIGDetails::sigToggleStarted); 110 connect(this, &UIToolsPaneMachine::sigToggleFinished, m_pPaneDetails, &UIGDetails::sigToggleFinished); 111 connect(m_pPaneDetails, &UIGDetails::sigLinkClicked, this, &UIToolsPaneMachine::sigLinkClicked); 107 m_pPaneMedia->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_VirtualMedia)); 112 108 113 109 /* Add into layout: */ 114 m_pLayout->addWidget(m_pPane Details);115 m_pLayout->setCurrentWidget(m_pPane Details);110 m_pLayout->addWidget(m_pPaneMedia); 111 m_pLayout->setCurrentWidget(m_pPaneMedia); 116 112 } 117 113 break; 118 114 } 119 case ToolType Machine_Snapshots:115 case ToolTypeGlobal_HostNetwork: 120 116 { 121 /* Create Snapshots pane: */122 m_pPane Snapshots = new UISnapshotPane;123 AssertPtrReturnVoid(m_pPane Snapshots);117 /* Create Host Network Manager: */ 118 m_pPaneNetwork = new UIHostNetworkManagerWidget(EmbedTo_Stack); 119 AssertPtrReturnVoid(m_pPaneNetwork); 124 120 { 125 121 /* Configure pane: */ 126 m_pPane Snapshots->setProperty("ToolType", QVariant::fromValue(ToolTypeMachine_Snapshots));122 m_pPaneNetwork->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_HostNetwork)); 127 123 128 124 /* Add into layout: */ 129 m_pLayout->addWidget(m_pPane Snapshots);130 m_pLayout->setCurrentWidget(m_pPane Snapshots);125 m_pLayout->addWidget(m_pPaneNetwork); 126 m_pLayout->setCurrentWidget(m_pPaneNetwork); 131 127 } 132 128 break; … … 138 134 } 139 135 140 void UIToolsPane Machine::closeTool(ToolTypeMachineenmType)136 void UIToolsPaneGlobal::closeTool(ToolTypeGlobal enmType) 141 137 { 142 138 /* Search through the stacked widgets: */ 143 139 int iActualIndex = -1; 144 140 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 145 if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolType Machine>() == enmType)141 if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeGlobal>() == enmType) 146 142 iActualIndex = iIndex; 147 143 … … 152 148 switch (enmType) 153 149 { 154 case ToolType Machine_Desktop:m_pPaneDesktop = 0; break;155 case ToolType Machine_Details: m_pPaneDetails= 0; break;156 case ToolType Machine_Snapshots: m_pPaneSnapshots= 0; break;150 case ToolTypeGlobal_Desktop: m_pPaneDesktop = 0; break; 151 case ToolTypeGlobal_VirtualMedia: m_pPaneMedia = 0; break; 152 case ToolTypeGlobal_HostNetwork: m_pPaneNetwork = 0; break; 157 153 default: break; 158 154 } … … 164 160 } 165 161 166 void UIToolsPane Machine::setDetailsText(const QString &strText)162 void UIToolsPaneGlobal::setDetailsText(const QString &strText) 167 163 { 168 164 /* Update desktop pane: */ … … 171 167 } 172 168 173 void UIToolsPane Machine::setDetailsError(const QString &strError)169 void UIToolsPaneGlobal::setDetailsError(const QString &strError) 174 170 { 175 171 /* Update desktop pane: */ … … 178 174 } 179 175 180 void UIToolsPaneMachine::setItems(const QList<UIVMItem*> &items) 181 { 182 /* Update details pane: */ 183 AssertPtrReturnVoid(m_pPaneDetails); 184 m_pPaneDetails->setItems(items); 185 } 186 187 void UIToolsPaneMachine::setMachine(const CMachine &comMachine) 188 { 189 /* Update snapshots pane: */ 190 AssertPtrReturnVoid(m_pPaneSnapshots); 191 m_pPaneSnapshots->setMachine(comMachine); 192 } 193 194 void UIToolsPaneMachine::prepare() 176 void UIToolsPaneGlobal::prepare() 195 177 { 196 178 /* Create stacked-layout: */ … … 204 186 205 187 /* Create desktop pane: */ 206 openTool(ToolType Machine_Desktop);207 } 208 209 void UIToolsPane Machine::cleanup()188 openTool(ToolTypeGlobal_Desktop); 189 } 190 191 void UIToolsPaneGlobal::cleanup() 210 192 { 211 193 /* Remove all widgets prematurelly: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneGlobal.h
r68175 r68200 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UIToolsPane Machineclass declaration.3 * VBox Qt GUI - UIToolsPaneGlobal class declaration. 4 4 */ 5 5 … … 16 16 */ 17 17 18 #ifndef ___UIToolsPane Machine_h___19 #define ___UIToolsPane Machine_h___18 #ifndef ___UIToolsPaneGlobal_h___ 19 #define ___UIToolsPaneGlobal_h___ 20 20 21 21 /* Qt includes: */ … … 28 28 class UIActionPool; 29 29 class UIDesktopPane; 30 class UI GDetails;31 class UI SnapshotPane;30 class UIHostNetworkManagerWidget; 31 class UIMediumManagerWidget; 32 32 class UIVMItem; 33 33 class CMachine; 34 34 35 35 36 /** Machinetool types. */37 enum ToolType Machine36 /** Global tool types. */ 37 enum ToolTypeGlobal 38 38 { 39 ToolType Machine_Invalid,40 ToolType Machine_Desktop,41 ToolType Machine_Details,42 ToolType Machine_Snapshots,39 ToolTypeGlobal_Invalid, 40 ToolTypeGlobal_Desktop, 41 ToolTypeGlobal_VirtualMedia, 42 ToolTypeGlobal_HostNetwork, 43 43 }; 44 44 45 /* Make sure QVariant can eat ToolType Machine: */46 Q_DECLARE_METATYPE(ToolType Machine);45 /* Make sure QVariant can eat ToolTypeGlobal: */ 46 Q_DECLARE_METATYPE(ToolTypeGlobal); 47 47 48 48 49 49 /** QWidget subclass representing container for tool panes. */ 50 class UIToolsPane Machine: public QWidget50 class UIToolsPaneGlobal : public QWidget 51 51 { 52 52 Q_OBJECT; 53 54 signals:55 56 /** Redirects signal from UISelectorWindow to UIGDetails. */57 void sigSlidingStarted();58 /** Redirects signal from UISelectorWindow to UIGDetails. */59 void sigToggleStarted();60 /** Redirects signal from UISelectorWindow to UIGDetails. */61 void sigToggleFinished();62 /** Redirects signal from UIGDetails to UISelectorWindow. */63 void sigLinkClicked(const QString &strCategory, const QString &strControl, const QString &strId);64 53 65 54 public: 66 55 67 56 /** Constructs tools pane passing @a pParent to the base-class. */ 68 UIToolsPane Machine(UIActionPool *pActionPool, QWidget *pParent = 0);57 UIToolsPaneGlobal(UIActionPool *pActionPool, QWidget *pParent = 0); 69 58 /** Destructs tools pane. */ 70 virtual ~UIToolsPane Machine() /* override */;59 virtual ~UIToolsPaneGlobal() /* override */; 71 60 72 61 /** Returns whether tool of particular @a enmType is opened. */ 73 bool isToolOpened(ToolType MachineenmType) const;62 bool isToolOpened(ToolTypeGlobal enmType) const; 74 63 /** Activates tool of passed @a enmType, creates new one if necessary. */ 75 void openTool(ToolType MachineenmType);64 void openTool(ToolTypeGlobal enmType); 76 65 /** Closes tool of passed @a enmType, deletes one if exists. */ 77 void closeTool(ToolType MachineenmType);66 void closeTool(ToolTypeGlobal enmType); 78 67 79 68 /** Defines @a strText and switches to text details pane. */ … … 81 70 /** Defines @a strError and switches to error details pane. */ 82 71 void setDetailsError(const QString &strError); 83 84 /** Defines the machine @a items. */85 void setItems(const QList<UIVMItem*> &items);86 87 /** Defines the @a comMachine object. */88 void setMachine(const CMachine &comMachine);89 72 90 73 private: … … 101 84 102 85 /** Holds the stacked-layout instance. */ 103 QStackedLayout *m_pLayout;86 QStackedLayout *m_pLayout; 104 87 /** Holds the Desktop pane instance. */ 105 UIDesktopPane *m_pPaneDesktop;106 /** Holds the Details paneinstance. */107 UI GDetails *m_pPaneDetails;108 /** Holds the Snapshots paneinstance. */109 UI SnapshotPane *m_pPaneSnapshots;88 UIDesktopPane *m_pPaneDesktop; 89 /** Holds the Virtual Media Manager instance. */ 90 UIMediumManagerWidget *m_pPaneMedia; 91 /** Holds the Host Network Manager instance. */ 92 UIHostNetworkManagerWidget *m_pPaneNetwork; 110 93 }; 111 94 112 #endif /* !___UIToolsPane Machine_h___ */95 #endif /* !___UIToolsPaneGlobal_h___ */ 113 96 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.cpp
r68196 r68200 45 45 , m_pLayoutStacked(0) 46 46 , m_pTabBarMachine(0) 47 , m_pTabBarGlobal(0) 47 48 , m_pToolBar(0) 48 49 { … … 74 75 } 75 76 77 void UIToolsToolbar::sltHandleOpenToolGlobal() 78 { 79 /* Acquire sender action: */ 80 const QAction *pAction = sender() ? qobject_cast<const QAction*>(sender()) : 0; 81 /* Acquire action type: */ 82 const ToolTypeGlobal enmType = pAction->property("ToolTypeGlobal").value<ToolTypeGlobal>(); 83 84 /* Get corresponding tab id: */ 85 QUuid idTab; 86 if (m_mapTabIdsGlobal.contains(enmType)) 87 idTab = m_mapTabIdsGlobal.value(enmType); 88 else 89 { 90 idTab = m_pTabBarGlobal->addTab(pAction->icon(), pAction->text().remove('&')); 91 m_mapTabIdsGlobal[enmType] = idTab; 92 } 93 /* And make it active: */ 94 m_pTabBarGlobal->setCurrent(idTab); 95 96 /* Notify listeners: */ 97 emit sigToolOpenedGlobal(enmType); 98 } 99 76 100 void UIToolsToolbar::sltHandleCloseToolMachine(const QUuid &uuid) 77 101 { … … 88 112 } 89 113 114 void UIToolsToolbar::sltHandleCloseToolGlobal(const QUuid &uuid) 115 { 116 /* If the ID is registered: */ 117 if (m_mapTabIdsGlobal.values().contains(uuid)) 118 { 119 /* Notify listeners: */ 120 emit sigToolClosedGlobal(m_mapTabIdsGlobal.key(uuid)); 121 122 /* And remove the tab: */ 123 m_pTabBarGlobal->removeTab(uuid); 124 m_mapTabIdsGlobal.remove(m_mapTabIdsGlobal.key(uuid)); 125 } 126 } 127 90 128 void UIToolsToolbar::sltHandleToolChosenMachine(const QUuid &uuid) 91 129 { … … 93 131 if (m_mapTabIdsMachine.values().contains(uuid)) 94 132 emit sigToolOpenedMachine(m_mapTabIdsMachine.key(uuid)); 133 } 134 135 void UIToolsToolbar::sltHandleToolChosenGlobal(const QUuid &uuid) 136 { 137 /* If the ID is registered => Notify listeners: */ 138 if (m_mapTabIdsGlobal.values().contains(uuid)) 139 emit sigToolOpenedGlobal(m_mapTabIdsGlobal.key(uuid)); 95 140 } 96 141 … … 107 152 if (pAction == m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)) 108 153 m_pLayoutStacked->setCurrentWidget(m_pTabBarMachine); 154 155 else 156 157 if (pAction == m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)) 158 m_pLayoutStacked->setCurrentWidget(m_pTabBarGlobal); 109 159 } 110 160 } … … 143 193 connect(m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine), &UIAction::toggled, 144 194 this, &UIToolsToolbar::sltHandleActionToggle); 195 196 /* Configure 'Global' menu: */ 197 UIMenu *pMenuGlobal = m_pActionPool->action(UIActionIndexST_M_Tools_M_Global)->menu(); 198 AssertPtrReturnVoid(pMenuGlobal); 199 { 200 /* Add 'Virtual Media Manager' action: */ 201 pMenuGlobal->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_VirtualMediaManager)); 202 connect(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_VirtualMediaManager), &UIAction::triggered, 203 this, &UIToolsToolbar::sltHandleOpenToolGlobal); 204 m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_VirtualMediaManager) 205 ->setProperty("ToolTypeGlobal", QVariant::fromValue(ToolTypeGlobal_VirtualMedia)); 206 207 /* Add 'Host Network Manager' action: */ 208 pMenuGlobal->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_HostNetworkManager)); 209 connect(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_HostNetworkManager), &UIAction::triggered, 210 this, &UIToolsToolbar::sltHandleOpenToolGlobal); 211 m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_HostNetworkManager) 212 ->setProperty("ToolTypeGlobal", QVariant::fromValue(ToolTypeGlobal_HostNetwork)); 213 } 214 215 /* Configure 'Global' toggle action: */ 216 m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)->setMenu(pMenuGlobal); 217 connect(m_pActionPool->action(UIActionIndexST_M_Tools_T_Global), &UIAction::toggled, 218 this, &UIToolsToolbar::sltHandleActionToggle); 219 220 /* By default 'Machine' toggle action is toggled: */ 221 m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)->setChecked(true); 145 222 } 146 223 … … 173 250 } 174 251 252 /* Create Global tab-bar: */ 253 m_pTabBarGlobal = new UITabBar; 254 AssertPtrReturnVoid(m_pTabBarGlobal); 255 { 256 /* Configure tab-bar: */ 257 connect(m_pTabBarGlobal, &UITabBar::sigTabRequestForClosing, 258 this, &UIToolsToolbar::sltHandleCloseToolGlobal); 259 connect(m_pTabBarGlobal, &UITabBar::sigCurrentTabChanged, 260 this, &UIToolsToolbar::sltHandleToolChosenGlobal); 261 262 /* Add into layout: */ 263 m_pLayoutStacked->addWidget(m_pTabBarGlobal); 264 } 265 175 266 /* Add into layout: */ 176 267 m_pLayoutMain->addLayout(m_pLayoutStacked); … … 189 280 190 281 /* Add actions: */ 191 UIAction *pActionMachine = m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine); 192 m_pToolBar->addAction(pActionMachine); 193 QToolButton *pNamedMenuToolButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(pActionMachine)); 194 pNamedMenuToolButton->setPopupMode(QToolButton::InstantPopup); 282 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)); 283 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)); 195 284 196 285 /* Add into layout: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.h
r68196 r68200 25 25 26 26 /* GUI includes: */ 27 #include "UIToolsPaneGlobal.h" 27 28 #include "UIToolsPaneMachine.h" 28 29 … … 47 48 /** Notify listeners about Machine tool of particular @a enmType opened. */ 48 49 void sigToolOpenedMachine(const ToolTypeMachine enmType); 50 /** Notify listeners about Global tool of particular @a enmType opened. */ 51 void sigToolOpenedGlobal(const ToolTypeGlobal enmType); 49 52 50 53 /** Notify listeners about Machine tool of particular @a enmType closed. */ 51 54 void sigToolClosedMachine(const ToolTypeMachine enmType); 55 /** Notify listeners about Global tool of particular @a enmType closed. */ 56 void sigToolClosedGlobal(const ToolTypeGlobal enmType); 52 57 53 58 public: … … 61 66 /** Handles request to open Machine tool. */ 62 67 void sltHandleOpenToolMachine(); 68 /** Handles request to open Global tool. */ 69 void sltHandleOpenToolGlobal(); 63 70 64 71 /** Handles request to close Machine tool with passed @a uuid. */ 65 72 void sltHandleCloseToolMachine(const QUuid &uuid); 73 /** Handles request to close Global tool with passed @a uuid. */ 74 void sltHandleCloseToolGlobal(const QUuid &uuid); 66 75 67 76 /** Handles request to make Machine tool with passed @a uuid current one. */ 68 77 void sltHandleToolChosenMachine(const QUuid &uuid); 78 /** Handles request to make Global tool with passed @a uuid current one. */ 79 void sltHandleToolChosenGlobal(const QUuid &uuid); 69 80 70 81 /** Handles action toggle. */ … … 90 101 /** Holds the Machine tab-bar instance. */ 91 102 UITabBar *m_pTabBarMachine; 103 /** Holds the Global tab-bar instance. */ 104 UITabBar *m_pTabBarGlobal; 92 105 93 106 /** Holds the toolbar instance. */ … … 96 109 /** Holds the map of opened Machine tool IDs. */ 97 110 QMap<ToolTypeMachine, QUuid> m_mapTabIdsMachine; 111 /** Holds the map of opened Global tool IDs. */ 112 QMap<ToolTypeGlobal, QUuid> m_mapTabIdsGlobal; 98 113 }; 99 114
Note:
See TracChangeset
for help on using the changeset viewer.