- Timestamp:
- Aug 2, 2017 8:35:17 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.cpp
r68212 r68225 23 23 # include <QAction> 24 24 # include <QButtonGroup> 25 # include <QHBoxLayout> 25 26 # include <QLabel> 26 # include <QStackedLayout>27 27 # include <QToolButton> 28 28 … … 43 43 , m_pActionPool(pActionPool) 44 44 , m_pLayoutMain(0) 45 , m_pLayoutStacked(0)46 45 , m_pTabBarMachine(0) 47 46 , m_pTabBarGlobal(0) … … 147 146 void UIToolsToolbar::sltHandleActionToggle() 148 147 { 149 /* Acquire the sender: */150 UIAction *pAction = sender() ? qobject_cast<UIAction*>(sender()) : 0;151 if (!pAction)152 pAction = m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine);153 154 148 /* Handle known actions: */ 155 if (m_pLayoutStacked) 156 { 157 if (pAction == m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)) 158 m_pLayoutStacked->setCurrentWidget(m_pTabBarMachine); 159 160 else 161 162 if (pAction == m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)) 163 m_pLayoutStacked->setCurrentWidget(m_pTabBarGlobal); 164 } 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); 165 155 } 166 156 … … 171 161 /* Prepare widgets: */ 172 162 prepareWidgets(); 163 164 /* Make sure just one tab-bar shown initially: */ 165 sltHandleActionToggle(); 173 166 } 174 167 … … 237 230 m_pLayoutMain->setSpacing(10); 238 231 239 /* Create stacked layout: */240 m_p LayoutStacked = new QStackedLayout(m_pLayoutMain);241 AssertPtrReturnVoid(m_p LayoutStacked);232 /* Create Machine tab-bar: */ 233 m_pTabBarMachine = new UITabBar; 234 AssertPtrReturnVoid(m_pTabBarMachine); 242 235 { 243 /* Create Machine tab-bar: */ 244 m_pTabBarMachine = new UITabBar; 245 AssertPtrReturnVoid(m_pTabBarMachine); 246 { 247 /* Configure tab-bar: */ 248 connect(m_pTabBarMachine, &UITabBar::sigTabRequestForClosing, 249 this, &UIToolsToolbar::sltHandleCloseToolMachine); 250 connect(m_pTabBarMachine, &UITabBar::sigCurrentTabChanged, 251 this, &UIToolsToolbar::sltHandleToolChosenMachine); 252 253 /* Add into layout: */ 254 m_pLayoutStacked->addWidget(m_pTabBarMachine); 255 } 256 257 /* Create Global tab-bar: */ 258 m_pTabBarGlobal = new UITabBar; 259 AssertPtrReturnVoid(m_pTabBarGlobal); 260 { 261 /* Configure tab-bar: */ 262 connect(m_pTabBarGlobal, &UITabBar::sigTabRequestForClosing, 263 this, &UIToolsToolbar::sltHandleCloseToolGlobal); 264 connect(m_pTabBarGlobal, &UITabBar::sigCurrentTabChanged, 265 this, &UIToolsToolbar::sltHandleToolChosenGlobal); 266 267 /* Add into layout: */ 268 m_pLayoutStacked->addWidget(m_pTabBarGlobal); 269 } 236 /* Configure tab-bar: */ 237 connect(m_pTabBarMachine, &UITabBar::sigTabRequestForClosing, 238 this, &UIToolsToolbar::sltHandleCloseToolMachine); 239 connect(m_pTabBarMachine, &UITabBar::sigCurrentTabChanged, 240 this, &UIToolsToolbar::sltHandleToolChosenMachine); 270 241 271 242 /* Add into layout: */ 272 m_pLayoutMain->addLayout(m_pLayoutStacked); 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); 273 258 } 274 259 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.h
r68212 r68225 31 31 class QAction; 32 32 class QHBoxLayout; 33 class QStackedLayout;34 33 class QUuid; 35 34 class QWidget; … … 98 97 99 98 /** Holds the main layout instance. */ 100 QHBoxLayout *m_pLayoutMain; 101 /** Holds the stacked layout instance. */ 102 QStackedLayout *m_pLayoutStacked; 99 QHBoxLayout *m_pLayoutMain; 103 100 104 101 /** Holds the Machine tab-bar instance. */
Note:
See TracChangeset
for help on using the changeset viewer.