Changeset 73601 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 9, 2018 6:04:22 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolbarTools.cpp
r73552 r73601 47 47 } 48 48 49 void UIToolbarTools::switchToTabBar(TabBarType enmType) 50 { 51 /* Handle known types: */ 52 switch (enmType) 53 { 54 case TabBarType_Machine: 55 { 56 if (m_pTabBarGlobal) 57 m_pTabBarGlobal->setVisible(false); 58 if (m_pTabBarMachine) 59 m_pTabBarMachine->setVisible(true); 60 break; 61 } 62 case TabBarType_Global: 63 { 64 if (m_pTabBarMachine) 65 m_pTabBarMachine->setVisible(false); 66 if (m_pTabBarGlobal) 67 m_pTabBarGlobal->setVisible(true); 68 break; 69 } 70 } 71 } 72 49 73 void UIToolbarTools::setTabBarEnabledMachine(bool fEnabled) 50 74 { … … 163 187 } 164 188 165 void UIToolbarTools::sltHandleActionToggle()166 {167 /* Handle known actions: */168 if (m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)->isChecked())169 {170 if (m_pTabBarGlobal)171 m_pTabBarGlobal->setVisible(false);172 if (m_pTabBarMachine)173 m_pTabBarMachine->setVisible(true);174 }175 else if (m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)->isChecked())176 {177 if (m_pTabBarMachine)178 m_pTabBarMachine->setVisible(false);179 if (m_pTabBarGlobal)180 m_pTabBarGlobal->setVisible(true);181 }182 }183 184 189 void UIToolbarTools::prepare() 185 190 { … … 188 193 /* Prepare widgets: */ 189 194 prepareWidgets(); 190 191 /* Make sure just one tab-bar shown initially: */192 sltHandleActionToggle();193 195 } 194 196 … … 223 225 /* Configure 'Machine' toggle action: */ 224 226 m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)->setMenu(pMenuMachine); 225 connect(m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine), &UIAction::toggled,226 this, &UIToolbarTools::sltHandleActionToggle);227 227 228 228 /* Configure 'Global' menu: */ … … 247 247 /* Configure 'Global' toggle action: */ 248 248 m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)->setMenu(pMenuGlobal); 249 connect(m_pActionPool->action(UIActionIndexST_M_Tools_T_Global), &UIAction::toggled,250 this, &UIToolbarTools::sltHandleActionToggle);251 252 /* By default 'Machine' toggle action is toggled: */253 m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)->setChecked(true);254 249 } 255 250 … … 280 275 if (m_pTabBarGlobal) 281 276 { 282 /* Configure tab-bar connections: */283 277 connect(m_pTabBarGlobal, &UITabBar::sigTabRequestForClosing, 284 278 this, &UIToolbarTools::sltHandleCloseToolGlobal); … … 291 285 292 286 /* Let the tab-bars know our opinion: */ 293 s ltHandleActionToggle();294 } 295 } 287 switchToTabBar(TabBarType_Machine); 288 } 289 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolbarTools.h
r73552 r73601 57 57 public: 58 58 59 /** Tab-bar types. */ 60 enum TabBarType { TabBarType_Machine, TabBarType_Global }; 61 59 62 /** Constructs Tools toolbar passing @a pParent to the base-class. 60 63 * @param pActionPool Brings the action-pool to take corresponding actions from. */ 61 64 UIToolbarTools(UIActionPool *pActionPool, QWidget *pParent = 0); 65 66 /** Switches to tab-bar of certain @a enmType. */ 67 void switchToTabBar(TabBarType enmType); 62 68 63 69 /** Defines whether Machine tab-bar is @a fEnabled. */ … … 88 94 void sltHandleToolChosenGlobal(const QUuid &uuid); 89 95 90 /** Handles action toggle. */91 void sltHandleActionToggle();92 93 96 private: 94 97
Note:
See TracChangeset
for help on using the changeset viewer.