- Timestamp:
- Jul 29, 2017 2:41:24 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 117267
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 7 edited
- 2 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r68167 r68175 380 380 src/selector/UISnapshotDetailsWidget.h \ 381 381 src/selector/UISnapshotPane.h \ 382 src/selector/UIToolsPane .h \382 src/selector/UIToolsPaneMachine.h \ 383 383 src/selector/UIToolsToolbar.h \ 384 384 src/selector/graphics/chooser/UIGChooser.h \ … … 697 697 src/selector/UISnapshotDetailsWidget.cpp \ 698 698 src/selector/UISnapshotPane.cpp \ 699 src/selector/UIToolsPane .cpp \699 src/selector/UIToolsPaneMachine.cpp \ 700 700 src/selector/UIToolsToolbar.cpp \ 701 701 src/selector/graphics/chooser/UIGChooser.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc
r67923 r68175 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_machine_32px.png">images/tools_machine_32px.png</file> 188 189 <file alias="tpixel.png">images/tpixel.png</file> 189 190 <file alias="usb_16px.png">images/usb_16px.png</file> -
trunk/src/VBox/Frontends/VirtualBox/VirtualBox2_hidpi.qrc
r67923 r68175 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_machine_32px_hidpi.png">images/hidpi/tools_machine_32px_hidpi.png</file> 197 198 <file alias="usb_16px_hidpi.png">images/hidpi/usb_16px_hidpi.png</file> 198 199 <file alias="usb_24px_hidpi.png">images/hidpi/usb_24px_hidpi.png</file> -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r68172 r68175 22 22 /* Qt includes: */ 23 23 # include <QMenuBar> 24 # include <QResizeEvent> 25 # include <QStandardPaths> 24 26 # include <QStatusBar> 25 # include <QResizeEvent>26 # include <QStackedWidget>27 27 # include <QToolButton> 28 28 # include <QTimer> 29 # if QT_VERSION >= 0x05000030 # include <QStandardPaths>31 # else /* QT_VERSION < 0x050000 */32 # include <QDesktopServices>33 # endif /* QT_VERSION < 0x050000 */34 29 35 30 /* GUI includes: */ 31 # include "QIFileDialog.h" 36 32 # include "QISplitter.h" 37 # include " QIFileDialog.h"33 # include "UIActionPoolSelector.h" 38 34 # include "UIBar.h" 35 # include "UIDesktopServices.h" 36 # include "UIExtraDataManager.h" 37 # include "UIGChooser.h" 38 # include "UIGlobalSettingsExtension.h" 39 # include "UIHostNetworkManager.h" 40 # include "UIMedium.h" 41 # include "UIMediumManager.h" 42 # include "UIMessageCenter.h" 43 # include "UIModalWindowManager.h" 44 # include "UISelectorWindow.h" 45 # include "UISettingsDialogSpecific.h" 46 # include "UISpacerWidgets.h" 47 # include "UIToolBar.h" 48 # include "UIVMLogViewer.h" 49 # include "UIVMItem.h" 50 # include "UIToolsPaneMachine.h" 51 # include "UIToolsToolbar.h" 52 # include "UIVirtualBoxEventHandler.h" 53 # include "UIWizardCloneVM.h" 54 # include "UIWizardExportApp.h" 55 # include "UIWizardImportApp.h" 39 56 # ifdef VBOX_GUI_WITH_NETWORK_MANAGER 40 57 # include "UINetworkManager.h" 41 58 # include "UINetworkManagerIndicator.h" 42 # include "UIUpdateManager.h"43 # include "UIDownloaderUserManual.h"44 # include "UIDownloaderExtensionPack.h"45 59 # endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 46 # include "UIIconPool.h"47 # include "UIWizardCloneVM.h"48 # include "UIWizardExportApp.h"49 # include "UIWizardImportApp.h"50 # include "UIDesktopPane.h"51 # include "UIVirtualBoxEventHandler.h"52 # include "UIHostNetworkManager.h"53 # include "UIMediumManager.h"54 # include "UIMedium.h"55 # include "UIMessageCenter.h"56 # include "UISelectorWindow.h"57 # include "UISettingsDialogSpecific.h"58 # include "UISpacerWidgets.h"59 # include "UISpecialControls.h"60 # include "UIToolBar.h"61 # include "UIVMLogViewer.h"62 # include "UIDesktopServices.h"63 # include "UIGlobalSettingsExtension.h"64 # include "UIActionPoolSelector.h"65 # include "UIGChooser.h"66 # include "UIGDetails.h"67 # include "UIVMItem.h"68 # include "UIExtraDataManager.h"69 # include "UIDesktopWidgetWatchdog.h"70 # include "UIModalWindowManager.h"71 60 # ifdef VBOX_WS_MAC 61 # include "UIImageTools.h" 62 # include "UIWindowMenuManager.h" 72 63 # include "VBoxUtils.h" 73 # include "UIWindowMenuManager.h"74 # include "UIImageTools.h"75 64 # endif /* VBOX_WS_MAC */ 65 # ifdef VBOX_WS_X11 66 # include "UIDesktopWidgetWatchdog.h" 67 # endif 76 68 77 69 /* Other VBox stuff: */ … … 122 114 #ifndef VBOX_WS_MAC 123 115 , m_pBar(0) 124 #endif /* !VBOX_WS_MAC */116 #endif 125 117 , m_pToolBar(0) 126 , m_pSegmentedButton(0) 127 , m_pContainerDetails(0) 118 , m_pToolbarTools(0) 128 119 , m_pPaneChooser(0) 129 , m_pPaneDetails(0) 130 , m_pPaneDesktop(0) 131 , m_pPaneTools(0) 120 , m_pPaneToolsMachine(0) 132 121 , m_pGroupMenuAction(0) 133 122 , m_pMachineMenuAction(0) … … 239 228 240 229 /* Update Details-pane: */ 241 if (fUpdateDetails) 242 m_pPaneDetails->setItems(currentItems()); 230 if ( fUpdateDetails 231 && m_pPaneToolsMachine->isToolOpened(ToolTypeMachine_Details)) 232 m_pPaneToolsMachine->setItems(currentItems()); 243 233 244 234 /* If current item exists & accessible: */ 245 235 if (pItem && pItem->accessible()) 246 236 { 247 /* Make sure at least Details-pane raised: */ 248 if (m_pContainerDetails->currentWidget() == m_pPaneDesktop) 249 sltPerformSegmentedButtonSwitch(SegmentType_Details); 250 251 /* Refresh Tools-pane if requested: */ 252 if (fUpdateTools) 253 m_pPaneTools->setMachine(pItem->machine()); 237 /* Make sure Machine Tools-pane raised: */ 238 if (m_pPaneToolsMachine->isToolOpened(ToolTypeMachine_Details)) 239 m_pPaneToolsMachine->openTool(ToolTypeMachine_Details); 240 else 241 if (m_pPaneToolsMachine->isToolOpened(ToolTypeMachine_Snapshots)) 242 m_pPaneToolsMachine->openTool(ToolTypeMachine_Snapshots); 243 244 /* Refresh Machine Tools-pane if requested: */ 245 if ( fUpdateTools 246 && m_pPaneToolsMachine->isToolOpened(ToolTypeMachine_Snapshots)) 247 m_pPaneToolsMachine->setMachine(pItem->machine()); 254 248 } 255 249 else 256 250 { 257 251 /* Make sure Desktop-pane raised: */ 258 if (m_pContainerDetails->currentWidget() != m_pPaneDesktop) 259 sltPerformSegmentedButtonSwitch(SegmentType_None); 252 m_pPaneToolsMachine->openTool(ToolTypeMachine_Desktop); 260 253 261 254 /* Note that the machine becomes inaccessible (or if the last VM gets … … 264 257 { 265 258 /* The VM is inaccessible: */ 266 m_pPane Desktop->updateDetailsError(UIMessageCenter::formatErrorInfo(pItem->accessError()));259 m_pPaneToolsMachine->setDetailsError(UIMessageCenter::formatErrorInfo(pItem->accessError())); 267 260 } 268 261 else 269 262 { 270 263 /* Default HTML support in Qt is terrible so just try to get something really simple: */ 271 m_pPane Desktop->updateDetailsText(264 m_pPaneToolsMachine->setDetailsText( 272 265 tr("<h3>Welcome to VirtualBox!</h3>" 273 266 "<p>The left part of this window is " … … 287 280 288 281 /* Refresh Tools-pane in any case: */ 289 m_pPaneTools->setMachine(CMachine()); 282 if (m_pPaneToolsMachine->isToolOpened(ToolTypeMachine_Snapshots)) 283 m_pPaneToolsMachine->setMachine(CMachine()); 290 284 } 291 285 } … … 301 295 302 296 /* Make sure MM window is not opened: */ 303 if ( m_pManagerVirtualMedia 304 || m_pPaneTools->isToolOpened(ToolType_VirtualMediaManager)) 297 if (m_pManagerVirtualMedia) 305 298 return; 306 299 … … 407 400 void UISelectorWindow::sltOpenVirtualMediumManagerWindow() 408 401 { 409 /* First check if instance of widget opened embedded: */410 if (m_pPaneTools->isToolOpened(ToolType_VirtualMediaManager))411 {412 sltPerformSegmentedButtonSwitch(SegmentType_Tools);413 m_pPaneTools->setCurrentTool(ToolType_VirtualMediaManager);414 return;415 }416 417 402 /* Create instance if not yet created: */ 418 403 if (!m_pManagerVirtualMedia) … … 441 426 void UISelectorWindow::sltOpenHostNetworkManagerWindow() 442 427 { 443 /* First check if instance of widget opened embedded: */444 if (m_pPaneTools->isToolOpened(ToolType_HostNetworkManager))445 {446 sltPerformSegmentedButtonSwitch(SegmentType_Tools);447 m_pPaneTools->setCurrentTool(ToolType_HostNetworkManager);448 return;449 }450 451 428 /* Create instance if not yet created: */ 452 429 if (!m_pManagerHostNetwork) … … 1048 1025 } 1049 1026 1050 void UISelectorWindow::sltHandleSegmentedButtonSwitch(int iSegment) 1051 { 1052 /* Get current item: */ 1053 const UIVMItem *pItem = currentItem(); 1054 1055 /* If current item exists & accessible: */ 1056 if (pItem && pItem->accessible()) 1057 { 1058 /* Raise the required widget: */ 1059 switch (iSegment) 1060 { 1061 case SegmentType_Details: m_pContainerDetails->setCurrentWidget(m_pPaneDetails); break; 1062 case SegmentType_Tools: m_pContainerDetails->setCurrentWidget(m_pPaneTools); break; 1063 default: break; 1064 } 1065 } 1066 else 1067 { 1068 /* Raise the Desktop-pane with welcome text or error details: */ 1069 m_pContainerDetails->setCurrentWidget(m_pPaneDesktop); 1070 } 1071 1072 #ifdef VBOX_WS_MAC 1073 // WORKAROUND: 1074 // Qt 5.6.x has weird bug: 1075 // When some cocoa widget being focused for a first time 1076 // previously focused Qt widget being erased unless 1077 // someone calls for it's update directly or 1078 // indirectly (like with mouse hovering). 1079 // Doing that directly for Chooser pane. 1080 m_pPaneChooser->update(); 1081 #endif 1082 } 1083 1084 void UISelectorWindow::sltPerformSegmentedButtonSwitch(int iSegment) 1085 { 1086 /* Perform silent segmented-button switch: */ 1087 if (iSegment >= 0 && iSegment < m_pSegmentedButton->count()) 1088 m_pSegmentedButton->setSelected(iSegment); 1089 /* Manually handle that switch as well: */ 1090 sltHandleSegmentedButtonSwitch(iSegment); 1091 } 1092 1093 void UISelectorWindow::sltHandleToolsPaneToolOpened(ToolType enmType) 1094 { 1095 switch (enmType) 1096 { 1097 case ToolType_VirtualMediaManager: sltCloseVirtualMediumManagerWindow(); break; 1098 case ToolType_HostNetworkManager: sltCloseHostNetworkManagerWindow(); break; 1099 default: break; 1100 } 1027 void UISelectorWindow::sltHandleToolOpenedMachine(ToolTypeMachine enmType) 1028 { 1029 /* Open corresponding tool: */ 1030 m_pPaneToolsMachine->openTool(enmType); 1031 /* If that was 'Details' => pass there current items: */ 1032 if ( enmType == ToolTypeMachine_Details 1033 && m_pPaneToolsMachine->isToolOpened(ToolTypeMachine_Details)) 1034 m_pPaneToolsMachine->setItems(currentItems()); 1035 /* If that was 'Snapshot' => pass there current or null machine: */ 1036 if ( enmType == ToolTypeMachine_Snapshots 1037 && m_pPaneToolsMachine->isToolOpened(ToolTypeMachine_Snapshots)) 1038 { 1039 UIVMItem *pItem = currentItem(); 1040 m_pPaneToolsMachine->setMachine(pItem ? pItem->machine() : CMachine()); 1041 } 1042 } 1043 1044 void UISelectorWindow::sltHandleToolClosedMachine(ToolTypeMachine enmType) 1045 { 1046 /* Close corresponding tool: */ 1047 m_pPaneToolsMachine->closeTool(enmType); 1101 1048 } 1102 1049 … … 1125 1072 setWindowTitle(strTitle); 1126 1073 1127 /* Translate segmented-button: */ 1128 // TODO: Move that NLS from UIDesktopPane to UISelectorWindow context. 1129 m_pSegmentedButton->setTitle(SegmentType_Details, QApplication::translate("UIDesktopPane", "&Details")); 1130 m_pSegmentedButton->setTitle(SegmentType_Tools, QApplication::translate("UIDesktopPane", "&Tools")); 1074 /* Translate Machine Tools welcome screen: */ 1075 m_pPaneToolsMachine->setDetailsText( 1076 tr("<h3>Welcome to VirtualBox!</h3>" 1077 "<p>The left part of this window is a list of all virtual machines " 1078 "and virtual machine groups on your computer. " 1079 "<img src=:/welcome.png align=right/></p>" 1080 "<p>The right part of this window represents a set of tools " 1081 "you have opened for the currently chosen machine. " 1082 "For more tools check the corresponding menu at the right side " 1083 "of the main tool bar located at the top of the window.</p>" 1084 "<p>You can press the <b>%1</b> key to get instant help, " 1085 "or visit " 1086 "<a href=https://www.virtualbox.org>www.virtualbox.org</a> " 1087 "for the latest information and news.</p>") 1088 .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText))); 1131 1089 1132 1090 /* Make sure details and snapshot panes are updated: */ … … 1275 1233 prepareConnections(); 1276 1234 1235 /* Make sure at least 'Details' Machine tool is opened at startup: */ 1236 actionPool()->action(UIActionIndexST_M_Tools_M_Machine_Details)->trigger(); 1237 1277 1238 /* Load settings: */ 1278 1239 loadSettings(); … … 1295 1256 qApp->installEventFilter(this); 1296 1257 #endif /* VBOX_WS_MAC */ 1297 1298 /* Switch segmented-button to Details-pane: */1299 sltPerformSegmentedButtonSwitchToDetails();1300 1258 1301 1259 /* Make sure current Chooser-pane index fetched: */ … … 1755 1713 m_pToolBar->addWidget(new UIHorizontalSpacerWidget); 1756 1714 1757 /* Create/add segmented-button: */ 1758 m_pSegmentedButton = new UITexturedSegmentedButton(this, 2); 1759 m_pSegmentedButton->setIcon(SegmentType_Details, UIIconPool::iconSet(":/edataman_16px.png", 1760 ":/edataman_16px.png")); 1761 m_pSegmentedButton->setIcon(SegmentType_Tools, UIIconPool::iconSet(":/guesttools_16px.png", 1762 ":/guesttools_disabled_16px.png")); 1763 m_pToolBar->addWidget(m_pSegmentedButton); 1715 /* Create Tools toolbar: */ 1716 m_pToolbarTools = new UIToolsToolbar(actionPool()); 1717 if (m_pToolbarTools) 1718 { 1719 /* Configure toolbar: */ 1720 m_pToolbarTools->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); 1721 1722 /* Create exclusive action-group: */ 1723 QActionGroup *pActionGroupTools = new QActionGroup(m_pToolbarTools); 1724 AssertPtrReturnVoid(pActionGroupTools); 1725 { 1726 /* Configure action-group: */ 1727 pActionGroupTools->setExclusive(true); 1728 1729 /* Add 'Tools' actions into action-group: */ 1730 pActionGroupTools->addAction(actionPool()->action(UIActionIndexST_M_Tools_T_Machine)); 1731 } 1732 1733 /* Add into toolbar: */ 1734 m_pToolBar->addWidget(m_pToolbarTools); 1735 } 1764 1736 1765 1737 /* Create/add horizontal spacer widget of fixed size for the beta label: */ … … 1770 1742 pSpace->setFixedSize(28, 1); 1771 1743 else 1772 pSpace->setFixedSize(1 0, 1);1744 pSpace->setFixedSize(1, 1); 1773 1745 m_pToolBar->addWidget(pSpace); 1774 1746 } … … 1840 1812 } 1841 1813 1842 /* Create container: */1843 m_p ContainerDetails = new QStackedWidget;1844 AssertPtrReturnVoid(m_p ContainerDetails);1814 /* Prepare Machine Tools-pane: */ 1815 m_pPaneToolsMachine = new UIToolsPaneMachine(actionPool()); 1816 AssertPtrReturnVoid(m_pPaneToolsMachine); 1845 1817 { 1846 /* Prepare Details-pane: */1847 m_pPaneDetails = new UIGDetails(this);1848 AssertPtrReturnVoid(m_pPaneDetails);1849 {1850 /* Add into container: */1851 m_pContainerDetails->addWidget(m_pPaneDetails);1852 }1853 1854 /* Prepare Desktop-pane: */1855 m_pPaneDesktop = new UIDesktopPane(actionPool()->action(UIActionIndexST_M_Group_S_Refresh));1856 AssertPtrReturnVoid(m_pPaneDesktop);1857 {1858 /* Add into container: */1859 m_pContainerDetails->addWidget(m_pPaneDesktop);1860 }1861 1862 /* Prepare Tools-pane: */1863 m_pPaneTools = new UIToolsPane;1864 AssertPtrReturnVoid(m_pPaneTools);1865 {1866 /* Add into container: */1867 m_pContainerDetails->addWidget(m_pPaneTools);1868 }1869 1870 1818 /* Add into splitter: */ 1871 m_pSplitter->addWidget(m_p ContainerDetails);1819 m_pSplitter->addWidget(m_pPaneToolsMachine); 1872 1820 } 1873 1821 1874 1822 /* Adjust splitter colors according to main widgets it splits: */ 1875 1823 m_pSplitter->configureColors(m_pPaneChooser->palette().color(QPalette::Active, QPalette::Window), 1876 m_pPane Details->palette().color(QPalette::Active, QPalette::Window));1824 m_pPaneToolsMachine->palette().color(QPalette::Active, QPalette::Window)); 1877 1825 /* Set the initial distribution. The right site is bigger. */ 1878 1826 m_pSplitter->setStretchFactor(0, 2); … … 1965 1913 /* Graphics VM chooser connections: */ 1966 1914 connect(m_pPaneChooser, SIGNAL(sigSelectionChanged()), this, SLOT(sltHandleChooserPaneIndexChange())); 1967 connect(m_pPaneChooser, SIGNAL(sigSlidingStarted()), m_pPane Details, SIGNAL(sigSlidingStarted()));1968 connect(m_pPaneChooser, SIGNAL(sigToggleStarted()), m_pPane Details, SIGNAL(sigToggleStarted()));1969 connect(m_pPaneChooser, SIGNAL(sigToggleFinished()), m_pPane Details, SIGNAL(sigToggleFinished()));1915 connect(m_pPaneChooser, SIGNAL(sigSlidingStarted()), m_pPaneToolsMachine, SIGNAL(sigSlidingStarted())); 1916 connect(m_pPaneChooser, SIGNAL(sigToggleStarted()), m_pPaneToolsMachine, SIGNAL(sigToggleStarted())); 1917 connect(m_pPaneChooser, SIGNAL(sigToggleFinished()), m_pPaneToolsMachine, SIGNAL(sigToggleFinished())); 1970 1918 connect(m_pPaneChooser, SIGNAL(sigGroupSavingStateChanged()), this, SLOT(sltHandleGroupSavingProgressChange())); 1971 1919 … … 1977 1925 ::darwinRegisterForUnifiedToolbarContextMenuEvents(this); 1978 1926 #endif /* VBOX_WS_MAC */ 1979 1980 /* Segmented-button connections: */ 1981 connect(m_pSegmentedButton, SIGNAL(clicked(int)), this, SLOT(sltHandleSegmentedButtonSwitch(int))); 1927 connect(m_pToolbarTools, &UIToolsToolbar::sigToolOpenedMachine, this, &UISelectorWindow::sltHandleToolOpenedMachine); 1928 connect(m_pToolbarTools, &UIToolsToolbar::sigToolClosedMachine, this, &UISelectorWindow::sltHandleToolClosedMachine); 1982 1929 1983 1930 /* VM desktop connections: */ 1984 connect(m_pPane Details, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)),1931 connect(m_pPaneToolsMachine, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)), 1985 1932 this, SLOT(sltOpenMachineSettingsDialog(const QString&, const QString&, const QString&))); 1986 connect(m_pPaneTools, &UIToolsPane::sigToolOpened, this, &UISelectorWindow::sltHandleToolsPaneToolOpened); 1933 1987 1934 1988 1935 /* Global event handlers: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r68172 r68175 25 25 #include "QIMainWindow.h" 26 26 #include "QIWithRetranslateUI.h" 27 #include "UIToolsPane .h"27 #include "UIToolsPaneMachine.h" 28 28 #include "VBoxGlobal.h" 29 29 30 30 /* Forward declarations: */ 31 31 class QMenu; 32 class QStackedWidget;33 32 class QIManagerDialog; 34 33 class QISplitter; 35 34 class UIAction; 36 35 class UIActionPool; 37 class UIDesktopPane;38 36 class UIGChooser; 39 class UIGDetails;40 37 #ifndef VBOX_WS_MAC 41 38 class UIMainBar; 42 39 #endif 43 class UITexturedSegmentedButton;44 40 class UIToolBar; 41 class UIToolsToolbar; 45 42 class UIVMItem; 46 43 … … 51 48 { 52 49 Q_OBJECT; 53 54 /** Segmented-button segment types. */55 enum SegmentType56 {57 SegmentType_Details,58 SegmentType_Tools,59 SegmentType_None,60 };61 50 62 51 public: … … 194 183 /** @} */ 195 184 196 /** @name Segmented-button stuff.197 * @{ */198 /** Handles segmented-button switch. */199 void sltHandleSegmentedButtonSwitch(int iSegment);200 /** Performs segmented-button switch. */201 void sltPerformSegmentedButtonSwitch(int iSegment);202 /** Performs segmented-button switch to details pane. */203 void sltPerformSegmentedButtonSwitchToDetails() { sltPerformSegmentedButtonSwitch(SegmentType_Details); }204 /** @} */205 206 185 /** @name Tools-pane stuff. 207 186 * @{ */ 208 void sltHandleToolsPaneToolOpened(ToolType enmType); 187 /** Handles rquest to open Machine tool of passed @a enmType. */ 188 void sltHandleToolOpenedMachine(ToolTypeMachine enmType); 189 190 /** Handles rquest to close Machine tool of passed @a enmType. */ 191 void sltHandleToolClosedMachine(ToolTypeMachine enmType); 209 192 /** @} */ 210 193 … … 333 316 #ifndef VBOX_WS_MAC 334 317 /** Holds the main bar instance. */ 335 UIMainBar *m_pBar;336 #endif /* !VBOX_WS_MAC */318 UIMainBar *m_pBar; 319 #endif 337 320 /** Holds the main toolbar instance. */ 338 UIToolBar *m_pToolBar; 339 340 /** Holds the segmented-button instance. */ 341 UITexturedSegmentedButton *m_pSegmentedButton; 342 343 /** Holds the Details-container instance. */ 344 QStackedWidget *m_pContainerDetails; 321 UIToolBar *m_pToolBar; 322 /** Holds the Tools-toolbar instance. */ 323 UIToolsToolbar *m_pToolbarTools; 345 324 346 325 /** Holds the Chooser-pane instance. */ 347 UIGChooser *m_pPaneChooser; 348 /** Holds the Details-pane instance. */ 349 UIGDetails *m_pPaneDetails; 350 /** Holds the Desktop-pane instance. */ 351 UIDesktopPane *m_pPaneDesktop; 326 UIGChooser *m_pPaneChooser; 352 327 /** Holds the Tools-pane instance. */ 353 UIToolsPane *m_pPaneTools;328 UIToolsPaneMachine *m_pPaneToolsMachine; 354 329 355 330 /** Holds the list of Group menu actions. */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneMachine.cpp
r68155 r68175 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UIToolsPane class implementation.3 * VBox Qt GUI - UIToolsPaneMachine class implementation. 4 4 */ 5 5 … … 22 22 /* Qt includes: */ 23 23 # include <QStackedLayout> 24 # include <QTabBar>25 24 26 25 /* GUI includes */ 27 # include "QIToolButton.h" 28 # include "UIHostNetworkManager.h" 29 # include "UIIconPool.h" 30 # include "UIMediumManager.h" 31 # include "UIMenuToolBar.h" 26 # include "UIActionPoolSelector.h" 27 # include "UIDesktopPane.h" 28 # include "UIGDetails.h" 32 29 # include "UISnapshotPane.h" 33 # include "UIToolsPane .h"30 # include "UIToolsPaneMachine.h" 34 31 35 32 /* Other VBox includes: */ … … 39 36 40 37 41 UIToolsPane::UIToolsPane(QWidget *pParent /* = 0 */) 42 : QIWithRetranslateUI<QWidget>(pParent) 43 , m_pLayoutMain(0) 44 , m_pStackedLayout(0) 38 UIToolsPaneMachine::UIToolsPaneMachine(UIActionPool *pActionPool, QWidget *pParent /* = 0 */) 39 : QWidget(pParent) 40 , m_pActionPool(pActionPool) 41 , m_pLayout(0) 42 , m_pPaneDesktop(0) 43 , m_pPaneDetails(0) 45 44 , m_pPaneSnapshots(0) 46 , m_pLayoutControls(0)47 , m_pTabBar(0)48 , m_pMenuToolbar(0)49 , m_pMenu(0)50 45 { 51 46 /* Prepare: */ … … 53 48 } 54 49 55 UIToolsPane ::~UIToolsPane()50 UIToolsPaneMachine::~UIToolsPaneMachine() 56 51 { 57 52 /* Cleanup: */ … … 59 54 } 60 55 61 bool UIToolsPane::isToolOpened(ToolType enmType) const 62 { 63 for (int iTabIndex = 0; iTabIndex < m_pTabBar->count(); ++iTabIndex) 64 if (m_pTabBar->tabData(iTabIndex).value<ToolType>() == enmType) 56 bool UIToolsPaneMachine::isToolOpened(ToolTypeMachine enmType) const 57 { 58 /* Search through the stacked widgets: */ 59 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 60 if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeMachine>() == enmType) 65 61 return true; 66 62 return false; 67 63 } 68 64 69 void UIToolsPane::setCurrentTool(ToolType enmType) 70 { 71 activateTabBarTab(enmType, true); 72 } 73 74 void UIToolsPane::setMachine(const CMachine &comMachine) 65 void UIToolsPaneMachine::openTool(ToolTypeMachine enmType) 66 { 67 /* Search through the stacked widgets: */ 68 int iActualIndex = -1; 69 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 70 if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeMachine>() == enmType) 71 iActualIndex = iIndex; 72 73 /* If widget with such type exists: */ 74 if (iActualIndex != -1) 75 { 76 /* Activate corresponding index: */ 77 m_pLayout->setCurrentIndex(iActualIndex); 78 } 79 /* Otherwise: */ 80 else 81 { 82 /* Create, remember, append corresponding stacked widget: */ 83 switch (enmType) 84 { 85 case ToolTypeMachine_Desktop: 86 { 87 /* Create Desktop pane: */ 88 m_pPaneDesktop = new UIDesktopPane(m_pActionPool->action(UIActionIndexST_M_Group_S_Refresh)); 89 AssertPtrReturnVoid(m_pPaneDesktop); 90 { 91 /* Configure pane: */ 92 m_pPaneDesktop->setProperty("ToolType", QVariant::fromValue(ToolTypeMachine_Desktop)); 93 94 /* Add into layout: */ 95 m_pLayout->addWidget(m_pPaneDesktop); 96 m_pLayout->setCurrentWidget(m_pPaneDesktop); 97 } 98 break; 99 } 100 case ToolTypeMachine_Details: 101 { 102 /* Create Details pane: */ 103 m_pPaneDetails = new UIGDetails; 104 AssertPtrReturnVoid(m_pPaneDetails); 105 { 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); 112 113 /* Add into layout: */ 114 m_pLayout->addWidget(m_pPaneDetails); 115 m_pLayout->setCurrentWidget(m_pPaneDetails); 116 } 117 break; 118 } 119 case ToolTypeMachine_Snapshots: 120 { 121 /* Create Snapshots pane: */ 122 m_pPaneSnapshots = new UISnapshotPane; 123 AssertPtrReturnVoid(m_pPaneSnapshots); 124 { 125 /* Configure pane: */ 126 m_pPaneSnapshots->setProperty("ToolType", QVariant::fromValue(ToolTypeMachine_Snapshots)); 127 128 /* Add into layout: */ 129 m_pLayout->addWidget(m_pPaneSnapshots); 130 m_pLayout->setCurrentWidget(m_pPaneSnapshots); 131 } 132 break; 133 } 134 default: 135 AssertFailedReturnVoid(); 136 } 137 } 138 } 139 140 void UIToolsPaneMachine::closeTool(ToolTypeMachine enmType) 141 { 142 /* Search through the stacked widgets: */ 143 int iActualIndex = -1; 144 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 145 if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeMachine>() == enmType) 146 iActualIndex = iIndex; 147 148 /* If widget with such type doesn't exist: */ 149 if (iActualIndex != -1) 150 { 151 /* Forget corresponding widget: */ 152 switch (enmType) 153 { 154 case ToolTypeMachine_Desktop: m_pPaneDesktop = 0; break; 155 case ToolTypeMachine_Details: m_pPaneDetails = 0; break; 156 case ToolTypeMachine_Snapshots: m_pPaneSnapshots = 0; break; 157 default: break; 158 } 159 /* Delete corresponding widget: */ 160 QWidget *pWidget = m_pLayout->widget(iActualIndex); 161 m_pLayout->removeWidget(pWidget); 162 delete pWidget; 163 } 164 } 165 166 void UIToolsPaneMachine::setDetailsText(const QString &strText) 167 { 168 /* Update desktop pane: */ 169 AssertPtrReturnVoid(m_pPaneDesktop); 170 m_pPaneDesktop->updateDetailsText(strText); 171 } 172 173 void UIToolsPaneMachine::setDetailsError(const QString &strError) 174 { 175 /* Update desktop pane: */ 176 AssertPtrReturnVoid(m_pPaneDesktop); 177 m_pPaneDesktop->updateDetailsError(strError); 178 } 179 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) 75 188 { 76 189 /* Update snapshots pane: */ … … 79 192 } 80 193 81 void UIToolsPane::retranslateUi() 82 { 83 /* Translate menu: */ 84 m_pMenu->setTitle(tr("More Tools")); 85 m_pMenu->setToolTip(tr("Holds a list of tools")); 86 87 /* Translate actions: */ 88 m_actions[ToolType_SnapshotManager]->setText(tr("Snapshot Manager")); 89 m_actions[ToolType_VirtualMediaManager]->setText(tr("Virtual Media Manager")); 90 m_actions[ToolType_HostNetworkManager]->setText(tr("Host Network Manager")); 91 92 /* Translate tab-bar: */ 93 for (int iTabIndex = 0; iTabIndex < m_pTabBar->count(); ++iTabIndex) 94 { 95 const ToolType enmType = m_pTabBar->tabData(iTabIndex).value<ToolType>(); 96 m_pTabBar->setTabText(iTabIndex, m_actions.value(enmType)->text()); 97 } 98 } 99 100 void UIToolsPane::sltHandleMenuToolbarTrigger() 101 { 102 /* Get the sender: */ 103 QAction *pAction = sender() ? qobject_cast<QAction*>(sender()) : 0; 104 AssertPtrReturnVoid(pAction); 105 106 /* Acquire sender's type: */ 107 const ToolType enmType = pAction->property("ToolType").value<ToolType>(); 108 AssertReturnVoid(enmType != ToolType_Invalid); 109 110 /* Activate corresponding tab: */ 111 activateTabBarTab(enmType, true); 112 } 113 114 void UIToolsPane::sltHandleTabBarTabMoved(int iFrom, int iTo) 115 { 116 /* Swap stack-widget pages as well: */ 117 QWidget *pWidget = m_pStackedLayout->widget(iFrom); 118 m_pStackedLayout->removeWidget(pWidget); 119 m_pStackedLayout->insertWidget(iTo, pWidget); 120 } 121 122 void UIToolsPane::sltHandleTabBarCurrentChange(int iIndex) 123 { 124 /* Activate corresponding indexes: */ 125 m_pStackedLayout->setCurrentIndex(iIndex); 126 } 127 128 void UIToolsPane::sltHandleTabBarButtonClick() 129 { 130 /* Get the sender: */ 131 QIToolButton *pButton = sender() ? qobject_cast<QIToolButton*>(sender()) : 0; 132 AssertPtrReturnVoid(pButton); 133 134 /* Acquire sender's type: */ 135 const ToolType enmType = pButton->property("ToolType").value<ToolType>(); 136 AssertReturnVoid(enmType != ToolType_Invalid); 137 138 /* Search for the tab with such type: */ 139 int iActualTabIndex = -1; 140 for (int iTabIndex = 0; iTabIndex < m_pTabBar->count(); ++iTabIndex) 141 if (m_pTabBar->tabData(iTabIndex).value<ToolType>() == enmType) 142 iActualTabIndex = iTabIndex; 143 AssertReturnVoid(iActualTabIndex != -1); 144 145 /* Delete the tab and corresponding widget: */ 146 m_pTabBar->removeTab(iActualTabIndex); 147 QWidget *pWidget = m_pStackedLayout->widget(iActualTabIndex); 148 m_pStackedLayout->removeWidget(pWidget); 149 delete pWidget; 150 151 /* Make sure action is unchecked: */ 152 m_actions[enmType]->blockSignals(true); 153 m_actions[enmType]->setChecked(false); 154 m_actions[enmType]->blockSignals(false); 155 } 156 157 void UIToolsPane::prepare() 158 { 159 /* Create main layout: */ 160 m_pLayoutMain = new QVBoxLayout(this); 161 AssertPtrReturnVoid(m_pLayoutMain); 194 void UIToolsPaneMachine::prepare() 195 { 196 /* Create stacked-layout: */ 197 m_pLayout = new QStackedLayout(this); 198 AssertPtrReturnVoid(m_pLayout); 162 199 { 163 200 /* Configure layout: */ 164 m_pLayoutMain->setSpacing(0); 165 m_pLayoutMain->setContentsMargins(3, 4, 5, 0); 166 167 /* Prepare stacked-layout: */ 168 prepareStackedLayout(); 169 170 /* Create controls layout: */ 171 m_pLayoutControls = new QHBoxLayout; 172 AssertPtrReturnVoid(m_pLayoutControls); 173 { 174 /* Configure layout: */ 175 m_pLayoutControls->setSpacing(0); 176 m_pLayoutControls->setContentsMargins(0, 0, 0, 0); 177 178 /* Prepare tab-bar: */ 179 prepareTabBar(); 180 181 /* Add stretch: */ 182 m_pLayoutControls->addStretch(); 183 184 /* Prepare menu-toolbar: */ 185 prepareMenuToolbar(); 186 187 /* Add and activate snapshots pane: */ 188 activateTabBarTab(ToolType_SnapshotManager, false); 189 190 /* Add into layout: */ 191 m_pLayoutMain->addLayout(m_pLayoutControls); 192 } 193 } 194 195 /* Apply language settings: */ 196 retranslateUi(); 197 } 198 199 void UIToolsPane::prepareStackedLayout() 200 { 201 /* Create stacked-layout: */ 202 m_pStackedLayout = new QStackedLayout; 203 AssertPtrReturnVoid(m_pStackedLayout); 204 { 205 /* Add into layout: */ 206 m_pLayoutMain->addLayout(m_pStackedLayout); 207 } 208 } 209 210 void UIToolsPane::prepareTabBar() 211 { 212 /* Create tab-bar: */ 213 m_pTabBar = new QTabBar; 214 AssertPtrReturnVoid(m_pTabBar); 215 { 216 /* Configure tab-bar: */ 217 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) * 1.375; 218 m_pTabBar->setIconSize(QSize(iIconMetric, iIconMetric)); 219 m_pTabBar->setMovable(true); 220 #ifdef VBOX_WS_MAC 221 /* Snapshots pane tab looks quite alone under macOS: */ 222 m_pTabBar->setAutoHide(true); 223 #endif 224 m_pTabBar->setDrawBase(false); 225 m_pTabBar->setExpanding(false); 226 m_pTabBar->setShape(QTabBar::RoundedSouth); 227 m_pTabBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); 228 connect(m_pTabBar, &QTabBar::tabMoved, this, &UIToolsPane::sltHandleTabBarTabMoved); 229 connect(m_pTabBar, &QTabBar::currentChanged, this, &UIToolsPane::sltHandleTabBarCurrentChange); 230 231 /* Add into layout: */ 232 m_pLayoutControls->addWidget(m_pTabBar); 233 } 234 } 235 236 void UIToolsPane::prepareMenuToolbar() 237 { 238 /* Create menu-toolbar: */ 239 m_pMenuToolbar = new UIMenuToolBar; 240 AssertPtrReturnVoid(m_pMenuToolbar); 241 { 242 /* Configure menu-toolbar: */ 243 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); 244 m_pMenuToolbar->setIconSize(QSize(iIconMetric, iIconMetric)); 245 m_pMenuToolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 246 m_pMenuToolbar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); 247 m_pMenuToolbar->setAlignmentType(UIMenuToolBar::AlignmentType_BottomRight); 248 249 /* Prepare menu: */ 250 prepareMenu(); 251 252 /* Add into layout: */ 253 m_pLayoutControls->addWidget(m_pMenuToolbar); 254 } 255 } 256 257 void UIToolsPane::prepareMenu() 258 { 259 /* Create menu: */ 260 m_pMenu = new QMenu(m_pMenuToolbar); 261 AssertPtrReturnVoid(m_pMenu); 262 { 263 /* Configure menus: */ 264 m_pMenu->setIcon(UIIconPool::iconSet(":/guesttools_16px.png")); 265 266 /* Create SnapShot manager action: */ 267 m_actions[ToolType_SnapshotManager] = m_pMenu->addAction(UIIconPool::iconSetFull(":/snapshot_manager_22px.png", 268 ":/snapshot_manager_16px.png"), 269 QString(), this, &UIToolsPane::sltHandleMenuToolbarTrigger); 270 { 271 m_actions[ToolType_SnapshotManager]->setCheckable(true); 272 m_actions[ToolType_SnapshotManager]-> 273 setProperty("ToolType", QVariant::fromValue(ToolType_SnapshotManager)); 274 } 275 276 /* Create Virtual Media manager action: */ 277 m_actions[ToolType_VirtualMediaManager] = m_pMenu->addAction(UIIconPool::iconSetFull(":/diskimage_22px.png", 278 ":/diskimage_16px.png"), 279 QString(), this, &UIToolsPane::sltHandleMenuToolbarTrigger); 280 { 281 m_actions[ToolType_VirtualMediaManager]->setCheckable(true); 282 m_actions[ToolType_VirtualMediaManager]-> 283 setProperty("ToolType", QVariant::fromValue(ToolType_VirtualMediaManager)); 284 } 285 286 /* Create Host Network manager action: */ 287 m_actions[ToolType_HostNetworkManager] = m_pMenu->addAction(UIIconPool::iconSetFull(":/host_iface_manager_22px.png", 288 ":/host_iface_manager_16px.png"), 289 QString(), this, &UIToolsPane::sltHandleMenuToolbarTrigger); 290 { 291 m_actions[ToolType_HostNetworkManager]->setCheckable(true); 292 m_actions[ToolType_HostNetworkManager]-> 293 setProperty("ToolType", QVariant::fromValue(ToolType_HostNetworkManager)); 294 } 295 296 /* Add as tool-button into tool-bar: */ 297 m_pMenuToolbar->setMenuAction(m_pMenu->menuAction()); 298 } 299 } 300 301 void UIToolsPane::cleanup() 302 { 303 /* Remove all tab prematurelly: */ 304 while (m_pTabBar->count()) 305 { 306 m_pTabBar->removeTab(0); 307 QWidget *pWidget = m_pStackedLayout->widget(0); 308 m_pStackedLayout->removeWidget(pWidget); 201 m_pLayout->setSpacing(0); 202 m_pLayout->setContentsMargins(3, 4, 5, 0); 203 } 204 205 /* Create desktop pane: */ 206 openTool(ToolTypeMachine_Desktop); 207 } 208 209 void UIToolsPaneMachine::cleanup() 210 { 211 /* Remove all widgets prematurelly: */ 212 while (m_pLayout->count()) 213 { 214 QWidget *pWidget = m_pLayout->widget(0); 215 m_pLayout->removeWidget(pWidget); 309 216 delete pWidget; 310 217 } 311 218 } 312 219 313 void UIToolsPane::activateTabBarTab(ToolType enmType, bool fCloseable)314 {315 /* Search for a tab with such type: */316 int iActualTabIndex = -1;317 for (int iTabIndex = 0; iTabIndex < m_pTabBar->count(); ++iTabIndex)318 if (m_pTabBar->tabData(iTabIndex).value<ToolType>() == enmType)319 iActualTabIndex = iTabIndex;320 321 /* If tab with such type doesn't exist: */322 m_pTabBar->blockSignals(true);323 if (iActualTabIndex == -1)324 {325 /* Append stack-widget with corresponding page: */326 switch (enmType)327 {328 case ToolType_SnapshotManager:329 m_pPaneSnapshots = new UISnapshotPane;330 m_pStackedLayout->addWidget(m_pPaneSnapshots);331 break;332 case ToolType_VirtualMediaManager:333 m_pStackedLayout->addWidget(new UIMediumManagerWidget(EmbedTo_Stack));334 break;335 case ToolType_HostNetworkManager:336 m_pStackedLayout->addWidget(new UIHostNetworkManagerWidget(EmbedTo_Stack));337 break;338 default:339 AssertFailedReturnVoid();340 }341 342 /* Append tab-bar with corresponding tab: */343 iActualTabIndex = m_pTabBar->addTab(m_actions.value(enmType)->icon(), m_actions.value(enmType)->text());344 {345 /* Create close button if requested: */346 if (fCloseable)347 {348 QIToolButton *pButtonClose = new QIToolButton;349 AssertPtrReturnVoid(pButtonClose);350 {351 /* Configure button: */352 #ifdef VBOX_WS_MAC353 /* Close buttons should be a bit smaller on macOS: */354 pButtonClose->setIconSize(QSize(12, 12));355 #endif356 pButtonClose->setIcon(UIIconPool::iconSet(":/close_16px.png"));357 pButtonClose->setProperty("ToolType", QVariant::fromValue(enmType));358 connect(pButtonClose, &QIToolButton::clicked, this, &UIToolsPane::sltHandleTabBarButtonClick);359 /* Add into tab-bar: */360 m_pTabBar->setTabButton(iActualTabIndex, QTabBar::RightSide, pButtonClose);361 }362 }363 #ifdef VBOX_WS_MAC364 /* Create placeholder of the same height if on macOS: */365 else366 {367 QWidget *pWidget = new QWidget;368 pWidget->setFixedSize(1, 26);369 m_pTabBar->setTabButton(iActualTabIndex, QTabBar::RightSide, pWidget);370 }371 #endif372 /* Store the data: */373 m_pTabBar->setTabData(iActualTabIndex, QVariant::fromValue(enmType));374 }375 376 /* Notify listeners: */377 emit sigToolOpened(enmType);378 }379 380 /* Activate corresponding indexes: */381 m_pStackedLayout->setCurrentIndex(iActualTabIndex);382 m_pTabBar->setCurrentIndex(iActualTabIndex);383 m_pTabBar->blockSignals(false);384 385 /* Make sure action is checked: */386 m_actions[enmType]->blockSignals(true);387 m_actions[enmType]->setChecked(true);388 m_actions[enmType]->blockSignals(false);389 }390 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneMachine.h
r68055 r68175 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UIToolsPane class declaration.3 * VBox Qt GUI - UIToolsPaneMachine class declaration. 4 4 */ 5 5 … … 16 16 */ 17 17 18 #ifndef ___UIToolsPane _h___19 #define ___UIToolsPane _h___18 #ifndef ___UIToolsPaneMachine_h___ 19 #define ___UIToolsPaneMachine_h___ 20 20 21 21 /* Qt includes: */ 22 22 #include <QWidget> 23 23 24 /* GUI includes: */25 #include "QIWithRetranslateUI.h"26 27 24 /* Forward declarations: */ 28 class QAction;29 25 class QHBoxLayout; 30 class QMenu;31 26 class QStackedLayout; 32 class QTabBar;33 27 class QVBoxLayout; 34 class UIMenuToolBar; 28 class UIActionPool; 29 class UIDesktopPane; 30 class UIGDetails; 35 31 class UISnapshotPane; 32 class UIVMItem; 36 33 class CMachine; 37 34 38 35 39 /** Tool types. */40 enum ToolType 36 /** Machine tool types. */ 37 enum ToolTypeMachine 41 38 { 42 ToolType _Invalid,43 ToolType _SnapshotManager,44 ToolType _VirtualMediaManager,45 ToolType _HostNetworkManager,39 ToolTypeMachine_Invalid, 40 ToolTypeMachine_Desktop, 41 ToolTypeMachine_Details, 42 ToolTypeMachine_Snapshots, 46 43 }; 47 44 48 /* Make sure QVariant can eat ToolType : */49 Q_DECLARE_METATYPE(ToolType );45 /* Make sure QVariant can eat ToolTypeMachine: */ 46 Q_DECLARE_METATYPE(ToolTypeMachine); 50 47 51 48 52 49 /** QWidget subclass representing container for tool panes. */ 53 class UIToolsPane : public QIWithRetranslateUI<QWidget>50 class UIToolsPaneMachine : public QWidget 54 51 { 55 52 Q_OBJECT; … … 57 54 signals: 58 55 59 /** Notifies listeners about tool of particular @a enmType is opened. */ 60 void sigToolOpened(ToolType enmType); 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); 61 64 62 65 public: 63 66 64 67 /** Constructs tools pane passing @a pParent to the base-class. */ 65 UIToolsPane (QWidget *pParent = 0);68 UIToolsPaneMachine(UIActionPool *pActionPool, QWidget *pParent = 0); 66 69 /** Destructs tools pane. */ 67 virtual ~UIToolsPane () /* override */;70 virtual ~UIToolsPaneMachine() /* override */; 68 71 69 72 /** Returns whether tool of particular @a enmType is opened. */ 70 bool isToolOpened(ToolType enmType) const; 71 /** Activates tool of particular @a enmType, creates new one if necessary. */ 72 void setCurrentTool(ToolType enmType); 73 bool isToolOpened(ToolTypeMachine enmType) const; 74 /** Activates tool of passed @a enmType, creates new one if necessary. */ 75 void openTool(ToolTypeMachine enmType); 76 /** Closes tool of passed @a enmType, deletes one if exists. */ 77 void closeTool(ToolTypeMachine enmType); 78 79 /** Defines @a strText and switches to text details pane. */ 80 void setDetailsText(const QString &strText); 81 /** Defines @a strError and switches to error details pane. */ 82 void setDetailsError(const QString &strError); 83 84 /** Defines the machine @a items. */ 85 void setItems(const QList<UIVMItem*> &items); 73 86 74 87 /** Defines the @a comMachine object. */ 75 88 void setMachine(const CMachine &comMachine); 76 77 protected:78 79 /** Handles translation event. */80 virtual void retranslateUi() /* override */;81 82 private slots:83 84 /** Handles menu-toolbar trigger. */85 void sltHandleMenuToolbarTrigger();86 87 /** Handles Tools tab-bar tab movement. */88 void sltHandleTabBarTabMoved(int iFrom, int iTo);89 /** Handles Tools tab-bar current tab change. */90 void sltHandleTabBarCurrentChange(int iIndex);91 /** Handles Tools tab-bar button click. */92 void sltHandleTabBarButtonClick();93 89 94 90 private: … … 98 94 /** Prepares stacked-layout. */ 99 95 void prepareStackedLayout(); 100 /** Prepares tab-bar. */101 void prepareTabBar();102 /** Prepares menu-toolbar. */103 void prepareMenuToolbar();104 /** Prepares menu. */105 void prepareMenu();106 96 /** Cleanups all. */ 107 97 void cleanup(); 108 98 109 /** Activates corresponding tab-bar tab, adds new if necessary. */110 void activateTabBarTab(ToolType enmType, bool fCloseable);99 /** Holds the action pool reference. */ 100 UIActionPool *m_pActionPool; 111 101 112 /** Holds the main layout isntance. */113 QVBoxLayout *m_pLayoutMain;114 102 /** Holds the stacked-layout instance. */ 115 QStackedLayout *m_pStackedLayout; 116 /** Holds the snapshot pane. */ 117 UISnapshotPane *m_pPaneSnapshots; 118 /** Holds the controls layout instance. */ 119 QHBoxLayout *m_pLayoutControls; 120 /** Holds the tab-bar instance. */ 121 QTabBar *m_pTabBar; 122 /** Holds the menu-toolbar instance. */ 123 UIMenuToolBar *m_pMenuToolbar; 124 /** Holds the menu instance. */ 125 QMenu *m_pMenu; 126 /** Holds the menu action instances. */ 127 QMap<ToolType, QAction*> m_actions; 103 QStackedLayout *m_pLayout; 104 /** Holds the Desktop pane instance. */ 105 UIDesktopPane *m_pPaneDesktop; 106 /** Holds the Details pane instance. */ 107 UIGDetails *m_pPaneDetails; 108 /** Holds the Snapshots pane instance. */ 109 UISnapshotPane *m_pPaneSnapshots; 128 110 }; 129 111 130 #endif /* !___UIToolsPane _h___ */112 #endif /* !___UIToolsPaneMachine_h___ */ 131 113 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.cpp
r68171 r68175 161 161 162 162 /* Create stacked layout: */ 163 m_pLayoutStacked = new QStackedLayout ;163 m_pLayoutStacked = new QStackedLayout(m_pLayoutMain); 164 164 AssertPtrReturnVoid(m_pLayoutStacked); 165 165 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.h
r68169 r68175 24 24 #include <QWidget> 25 25 26 /* GUI includes: */ 27 #include "UIToolsPaneMachine.h" 28 26 29 /* Forward declarations: */ 27 30 class QAction; … … 35 38 class UIActionPool; 36 39 class UITabBar; 37 38 39 /** Machine tool types. */40 enum ToolTypeMachine41 {42 ToolTypeMachine_Invalid,43 ToolTypeMachine_Desktop,44 ToolTypeMachine_Details,45 ToolTypeMachine_Snapshots,46 };47 48 /* Make sure QVariant can eat ToolTypeMachine: */49 Q_DECLARE_METATYPE(ToolTypeMachine);50 40 51 41
Note:
See TracChangeset
for help on using the changeset viewer.