Changeset 68230 in vbox
- Timestamp:
- Aug 2, 2017 9:40:44 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r68221 r68230 46 46 # include "UISlidingWidget.h" 47 47 # include "UISpacerWidgets.h" 48 # include "UITabBar.h" 48 49 # include "UIToolBar.h" 49 50 # include "UIVMLogViewer.h" … … 118 119 #endif 119 120 , m_pToolBar(0) 121 , m_pTabBarMachine(0) 122 , m_pTabBarGlobal(0) 123 , m_pActionTabBarMachine(0) 124 , m_pActionTabBarGlobal(0) 120 125 , m_pToolbarTools(0) 121 126 , m_pPaneChooser(0) … … 152 157 } 153 158 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 159 160 void UISelectorWindow::sltHandleShowTabBarMachine() 161 { 162 m_pActionTabBarGlobal->setVisible(false); 163 m_pActionTabBarMachine->setVisible(true); 164 } 165 166 void UISelectorWindow::sltHandleShowTabBarGlobal() 167 { 168 m_pActionTabBarMachine->setVisible(false); 169 m_pActionTabBarGlobal->setVisible(true); 170 } 154 171 155 172 void UISelectorWindow::sltShowSelectorWindowContextMenu(const QPoint &position) … … 1800 1817 m_pToolBar->addWidget(new UIHorizontalSpacerWidget); 1801 1818 1819 /* Create Machine tab-bar: */ 1820 m_pTabBarMachine = new UITabBar; 1821 AssertPtrReturnVoid(m_pTabBarMachine); 1822 { 1823 /* Configure tab-bar: */ 1824 m_pTabBarMachine->setContentsMargins(0, 0, 10, 0); 1825 1826 /* Add into toolbar: */ 1827 m_pActionTabBarMachine = m_pToolBar->addWidget(m_pTabBarMachine); 1828 } 1829 1830 /* Create Global tab-bar: */ 1831 m_pTabBarGlobal = new UITabBar; 1832 AssertPtrReturnVoid(m_pTabBarGlobal); 1833 { 1834 /* Configure tab-bar: */ 1835 m_pTabBarGlobal->setContentsMargins(0, 0, 10, 0); 1836 1837 /* Add into toolbar: */ 1838 m_pActionTabBarGlobal = m_pToolBar->addWidget(m_pTabBarGlobal); 1839 } 1840 1802 1841 /* Create Tools toolbar: */ 1803 1842 m_pToolbarTools = new UIToolsToolbar(actionPool()); … … 1806 1845 /* Configure toolbar: */ 1807 1846 m_pToolbarTools->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); 1847 connect(m_pToolbarTools, &UIToolsToolbar::sigShowTabBarMachine, 1848 this, &UISelectorWindow::sltHandleShowTabBarMachine); 1849 connect(m_pToolbarTools, &UIToolsToolbar::sigShowTabBarGlobal, 1850 this, &UISelectorWindow::sltHandleShowTabBarGlobal); 1851 m_pToolbarTools->setTabBars(m_pTabBarMachine, m_pTabBarGlobal); 1808 1852 1809 1853 /* Create exclusive action-group: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r68200 r68230 40 40 #endif 41 41 class UISlidingWidget; 42 class UITabBar; 42 43 class UIToolBar; 43 44 class UIToolsToolbar; … … 82 83 void QT_VERSION_NOT_DEFINED 83 84 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 85 86 /** Handles request to show Machine tab-bar. */ 87 void sltHandleShowTabBarMachine(); 88 /** Handles request to show Global tab-bar. */ 89 void sltHandleShowTabBarGlobal(); 84 90 85 91 /** Handles selector-window context-menu call for passed @a position. */ … … 333 339 #ifndef VBOX_WS_MAC 334 340 /** Holds the main bar instance. */ 335 UIMainBar 341 UIMainBar *m_pBar; 336 342 #endif 337 343 /** Holds the main toolbar instance. */ 338 UIToolBar *m_pToolBar; 344 UIToolBar *m_pToolBar; 345 346 /** Holds the Machine tab-bar instance. */ 347 UITabBar *m_pTabBarMachine; 348 /** Holds the Global tab-bar instance. */ 349 UITabBar *m_pTabBarGlobal; 350 /** Holds the Machine tab-bar action reference. */ 351 QAction *m_pActionTabBarMachine; 352 /** Holds the Global tab-bar action reference. */ 353 QAction *m_pActionTabBarGlobal; 354 339 355 /** Holds the Tools-toolbar instance. */ 340 356 UIToolsToolbar *m_pToolbarTools; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.cpp
r68225 r68230 42 42 : QWidget(pParent) 43 43 , m_pActionPool(pActionPool) 44 , m_pLayoutMain(0)45 44 , m_pTabBarMachine(0) 46 45 , m_pTabBarGlobal(0) 46 , m_pLayoutMain(0) 47 47 , m_pToolBar(0) 48 48 { 49 49 /* Prepare: */ 50 50 prepare(); 51 } 52 53 void UIToolsToolbar::setTabBars(UITabBar *pTabBarMachine, UITabBar *pTabBarGlobal) 54 { 55 /* Remember the new tab-bars: */ 56 m_pTabBarMachine = pTabBarMachine; 57 m_pTabBarGlobal = pTabBarGlobal; 58 59 /* Configure tab-bar connections: */ 60 connect(m_pTabBarMachine, &UITabBar::sigTabRequestForClosing, 61 this, &UIToolsToolbar::sltHandleCloseToolMachine); 62 connect(m_pTabBarMachine, &UITabBar::sigCurrentTabChanged, 63 this, &UIToolsToolbar::sltHandleToolChosenMachine); 64 connect(m_pTabBarGlobal, &UITabBar::sigTabRequestForClosing, 65 this, &UIToolsToolbar::sltHandleCloseToolGlobal); 66 connect(m_pTabBarGlobal, &UITabBar::sigCurrentTabChanged, 67 this, &UIToolsToolbar::sltHandleToolChosenGlobal); 68 69 /* Let the tab-bars know our opinion: */ 70 sltHandleActionToggle(); 51 71 } 52 72 … … 147 167 { 148 168 /* Handle known actions: */ 149 const bool fShowMachine = m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)->isChecked(); 150 const bool fShowGlobal = m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)->isChecked(); 151 if (m_pTabBarMachine) 152 m_pTabBarMachine->setHidden(!fShowMachine); 153 if (m_pTabBarGlobal) 154 m_pTabBarGlobal->setHidden(!fShowGlobal); 169 if (m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)->isChecked()) 170 emit sigShowTabBarMachine(); 171 else if (m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)->isChecked()) 172 emit sigShowTabBarGlobal(); 155 173 } 156 174 … … 228 246 /* Configure layout: */ 229 247 m_pLayoutMain->setContentsMargins(0, 0, 0, 0); 230 m_pLayoutMain->setSpacing(10);231 232 /* Create Machine tab-bar: */233 m_pTabBarMachine = new UITabBar;234 AssertPtrReturnVoid(m_pTabBarMachine);235 {236 /* Configure tab-bar: */237 connect(m_pTabBarMachine, &UITabBar::sigTabRequestForClosing,238 this, &UIToolsToolbar::sltHandleCloseToolMachine);239 connect(m_pTabBarMachine, &UITabBar::sigCurrentTabChanged,240 this, &UIToolsToolbar::sltHandleToolChosenMachine);241 242 /* Add into layout: */243 m_pLayoutMain->addWidget(m_pTabBarMachine);244 }245 246 /* Create Global tab-bar: */247 m_pTabBarGlobal = new UITabBar;248 AssertPtrReturnVoid(m_pTabBarGlobal);249 {250 /* Configure tab-bar: */251 connect(m_pTabBarGlobal, &UITabBar::sigTabRequestForClosing,252 this, &UIToolsToolbar::sltHandleCloseToolGlobal);253 connect(m_pTabBarGlobal, &UITabBar::sigCurrentTabChanged,254 this, &UIToolsToolbar::sltHandleToolChosenGlobal);255 256 /* Add into layout: */257 m_pLayoutMain->addWidget(m_pTabBarGlobal);258 }259 248 260 249 /* Create toolbar: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.h
r68225 r68230 45 45 signals: 46 46 47 /** Notify listeners about Machine tool of particular @a enmType opened. */ 47 /** Notifies listeners about Machine tab-bar should be shown. */ 48 void sigShowTabBarMachine(); 49 /** Notifies listeners about Global tab-bar should be shown. */ 50 void sigShowTabBarGlobal(); 51 52 /** Notifies listeners about Machine tool of particular @a enmType opened. */ 48 53 void sigToolOpenedMachine(const ToolTypeMachine enmType); 49 /** Notif ylisteners about Global tool of particular @a enmType opened. */54 /** Notifies listeners about Global tool of particular @a enmType opened. */ 50 55 void sigToolOpenedGlobal(const ToolTypeGlobal enmType); 51 56 52 /** Notif ylisteners about Machine tool of particular @a enmType closed. */57 /** Notifies listeners about Machine tool of particular @a enmType closed. */ 53 58 void sigToolClosedMachine(const ToolTypeMachine enmType); 54 /** Notif ylisteners about Global tool of particular @a enmType closed. */59 /** Notifies listeners about Global tool of particular @a enmType closed. */ 55 60 void sigToolClosedGlobal(const ToolTypeGlobal enmType); 56 61 … … 60 65 * @param pActionPool Brings the action-pool to take corresponding actions from. */ 61 66 UIToolsToolbar(UIActionPool *pActionPool, QWidget *pParent = 0); 67 68 /** Defines the tab-bars to control. */ 69 void setTabBars(UITabBar *pTabBarMachine, UITabBar *pTabBarGlobal); 62 70 63 71 /** Defines toolbar tool button @a enmStyle. */ … … 96 104 UIActionPool *m_pActionPool; 97 105 98 /** Holds the main layout instance. */99 QHBoxLayout *m_pLayoutMain;100 101 106 /** Holds the Machine tab-bar instance. */ 102 107 UITabBar *m_pTabBarMachine; … … 104 109 UITabBar *m_pTabBarGlobal; 105 110 111 /** Holds the main layout instance. */ 112 QHBoxLayout *m_pLayoutMain; 106 113 /** Holds the toolbar instance. */ 107 UIToolBar *m_pToolBar;114 UIToolBar *m_pToolBar; 108 115 109 116 /** Holds the map of opened Machine tool IDs. */
Note:
See TracChangeset
for help on using the changeset viewer.