Changeset 73552 in vbox
- Timestamp:
- Aug 7, 2018 4:59:30 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolbarTools.cpp
r73424 r73552 34 34 # include "UIToolbarTools.h" 35 35 36 /* Other VBox includes: */37 # include "iprt/assert.h"38 39 36 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 40 37 … … 46 43 , m_pTabBarGlobal(0) 47 44 , m_pLayoutMain(0) 48 , m_pToolBar(0) 49 { 50 /* Prepare: */ 45 { 51 46 prepare(); 52 47 } 53 48 54 void UIToolbarTools::setTabBars(UITabBar *pTabBarMachine, UITabBar *pTabBarGlobal) 55 { 56 /* Remember the new tab-bars: */ 57 m_pTabBarMachine = pTabBarMachine; 58 m_pTabBarGlobal = pTabBarGlobal; 59 60 /* Configure tab-bar connections: */ 61 connect(m_pTabBarMachine, &UITabBar::sigTabRequestForClosing, 62 this, &UIToolbarTools::sltHandleCloseToolMachine); 63 connect(m_pTabBarMachine, &UITabBar::sigCurrentTabChanged, 64 this, &UIToolbarTools::sltHandleToolChosenMachine); 65 connect(m_pTabBarGlobal, &UITabBar::sigTabRequestForClosing, 66 this, &UIToolbarTools::sltHandleCloseToolGlobal); 67 connect(m_pTabBarGlobal, &UITabBar::sigCurrentTabChanged, 68 this, &UIToolbarTools::sltHandleToolChosenGlobal); 69 70 /* Let the tab-bars know our opinion: */ 71 sltHandleActionToggle(); 72 } 73 74 void UIToolbarTools::setToolButtonStyle(Qt::ToolButtonStyle enmStyle) 75 { 76 m_pToolBar->setToolButtonStyle(enmStyle); 49 void UIToolbarTools::setTabBarEnabledMachine(bool fEnabled) 50 { 51 /* Update Machine tab-bar availability: */ 52 m_pTabBarMachine->setEnabled(fEnabled); 53 } 54 55 void UIToolbarTools::setTabBarEnabledGlobal(bool fEnabled) 56 { 57 /* Update Global tab-bar availability: */ 58 m_pTabBarGlobal->setEnabled(fEnabled); 77 59 } 78 60 … … 185 167 /* Handle known actions: */ 186 168 if (m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)->isChecked()) 187 emit sigShowTabBarMachine(); 169 { 170 if (m_pTabBarGlobal) 171 m_pTabBarGlobal->setVisible(false); 172 if (m_pTabBarMachine) 173 m_pTabBarMachine->setVisible(true); 174 } 188 175 else if (m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)->isChecked()) 189 emit sigShowTabBarGlobal(); 176 { 177 if (m_pTabBarMachine) 178 m_pTabBarMachine->setVisible(false); 179 if (m_pTabBarGlobal) 180 m_pTabBarGlobal->setVisible(true); 181 } 190 182 } 191 183 … … 205 197 /* Configure 'Machine' menu: */ 206 198 UIMenu *pMenuMachine = m_pActionPool->action(UIActionIndexST_M_Tools_M_Machine)->menu(); 207 AssertPtrReturnVoid(pMenuMachine);199 if (pMenuMachine) 208 200 { 209 201 /* Add 'Details' action: */ … … 236 228 /* Configure 'Global' menu: */ 237 229 UIMenu *pMenuGlobal = m_pActionPool->action(UIActionIndexST_M_Tools_M_Global)->menu(); 238 AssertPtrReturnVoid(pMenuGlobal);230 if (pMenuGlobal) 239 231 { 240 232 /* Add 'Virtual Media Manager' action: */ … … 266 258 /* Create main layout: */ 267 259 m_pLayoutMain = new QHBoxLayout(this); 268 AssertPtrReturnVoid(m_pLayoutMain);260 if (m_pLayoutMain) 269 261 { 270 262 /* Configure layout: */ 271 263 m_pLayoutMain->setContentsMargins(0, 0, 0, 0); 272 264 273 /* Create toolbar: */274 m_pT oolBar = new UIToolBar;275 AssertPtrReturnVoid(m_pToolBar);265 /* Create Machine tab-bar: */ 266 m_pTabBarMachine = new UITabBar(UITabBar::Align_Left); 267 if (m_pTabBarMachine) 276 268 { 277 /* Configure toolbar: */ 278 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize); 279 m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric)); 280 m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 281 282 /* Add actions: */ 283 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)); 284 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)); 269 connect(m_pTabBarMachine, &UITabBar::sigTabRequestForClosing, 270 this, &UIToolbarTools::sltHandleCloseToolMachine); 271 connect(m_pTabBarMachine, &UITabBar::sigCurrentTabChanged, 272 this, &UIToolbarTools::sltHandleToolChosenMachine); 285 273 286 274 /* Add into layout: */ 287 m_pLayoutMain->addWidget(m_pT oolBar);275 m_pLayoutMain->addWidget(m_pTabBarMachine); 288 276 } 289 } 290 } 291 277 278 /* Create Global tab-bar: */ 279 m_pTabBarGlobal = new UITabBar(UITabBar::Align_Left); 280 if (m_pTabBarGlobal) 281 { 282 /* Configure tab-bar connections: */ 283 connect(m_pTabBarGlobal, &UITabBar::sigTabRequestForClosing, 284 this, &UIToolbarTools::sltHandleCloseToolGlobal); 285 connect(m_pTabBarGlobal, &UITabBar::sigCurrentTabChanged, 286 this, &UIToolbarTools::sltHandleToolChosenGlobal); 287 288 /* Add into layout: */ 289 m_pLayoutMain->addWidget(m_pTabBarGlobal); 290 } 291 292 /* Let the tab-bars know our opinion: */ 293 sltHandleActionToggle(); 294 } 295 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolbarTools.h
r73424 r73552 45 45 signals: 46 46 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 47 /** Notifies listeners about Machine tool of particular @a enmType opened. */ 53 48 void sigToolOpenedMachine(const ToolTypeMachine enmType); … … 66 61 UIToolbarTools(UIActionPool *pActionPool, QWidget *pParent = 0); 67 62 68 /** Defines the tab-bars to control. */ 69 void setTabBars(UITabBar *pTabBarMachine, UITabBar *pTabBarGlobal); 70 71 /** Defines toolbar tool button @a enmStyle. */ 72 void setToolButtonStyle(Qt::ToolButtonStyle enmStyle); 63 /** Defines whether Machine tab-bar is @a fEnabled. */ 64 void setTabBarEnabledMachine(bool fEnabled); 65 /** Defines whether Global tab-bar is @a fEnabled. */ 66 void setTabBarEnabledGlobal(bool fEnabled); 73 67 74 68 /** Returns Machine tab-bar order. */ … … 109 103 UIActionPool *m_pActionPool; 110 104 111 /** Holds the Machine tab-bar instance. */112 UITabBar *m_pTabBarMachine;113 /** Holds the Global tab-bar instance. */114 UITabBar *m_pTabBarGlobal;115 116 105 /** Holds the main layout instance. */ 117 106 QHBoxLayout *m_pLayoutMain; 118 /** Holds the toolbar instance. */ 119 UIToolBar *m_pToolBar; 107 /** Holds the Machine tab-bar instance. */ 108 UITabBar *m_pTabBarMachine; 109 /** Holds the Global tab-bar instance. */ 110 UITabBar *m_pTabBarGlobal; 120 111 121 112 /** Holds the map of opened Machine tool IDs. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r73534 r73552 51 51 , m_pSplitter(0) 52 52 , m_pToolBar(0) 53 , m_pTabBarMachine(0)54 , m_pTabBarGlobal(0)55 53 , m_pToolbarTools(0) 56 54 , m_pPaneChooser(0) … … 142 140 ? Qt::ToolButtonTextUnderIcon 143 141 : Qt::ToolButtonIconOnly); 144 m_pToolbarTools->setToolButtonStyle( pResult->isChecked()145 ? Qt::ToolButtonTextUnderIcon146 : Qt::ToolButtonIconOnly);147 142 } 148 143 } … … 221 216 m_pPaneToolsMachine->setCurrentItem(pItem); 222 217 223 /* Update Machine tab-bar visibility*/224 m_pT abBarMachine->setEnabled(pItem && pItem->accessible());218 /* Update Machine tab-bar availability: */ 219 m_pToolbarTools->setTabBarEnabledMachine(pItem && pItem->accessible()); 225 220 226 221 /* If current item exists & accessible: */ … … 287 282 /* Make sure chosen item fetched: */ 288 283 sltHandleChooserPaneIndexChange(false /* update details? */, false /* update snapshots? */, false /* update the logviewer? */); 289 }290 291 void UIVirtualBoxManagerWidget::sltHandleShowTabBarMachine()292 {293 m_pTabBarGlobal->setVisible(false);294 m_pTabBarMachine->setVisible(true);295 }296 297 void UIVirtualBoxManagerWidget::sltHandleShowTabBarGlobal()298 {299 m_pTabBarMachine->setVisible(false);300 m_pTabBarGlobal->setVisible(true);301 284 } 302 285 … … 446 429 pLayoutRight->addWidget(m_pToolBar); 447 430 448 /* Create Machine tab-bar: */449 m_pTabBarMachine = new UITabBar(UITabBar::Align_Left);450 if (m_pTabBarMachine)451 {452 /* Add into toolbar: */453 pLayoutRight->addWidget(m_pTabBarMachine);454 }455 456 /* Create Global tab-bar: */457 m_pTabBarGlobal = new UITabBar(UITabBar::Align_Left);458 if (m_pTabBarGlobal)459 {460 /* Add into toolbar: */461 pLayoutRight->addWidget(m_pTabBarGlobal);462 }463 464 431 /* Create Tools toolbar: */ 465 432 m_pToolbarTools = new UIToolbarTools(actionPool()); … … 468 435 /* Configure toolbar: */ 469 436 m_pToolbarTools->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); 470 connect(m_pToolbarTools, &UIToolbarTools::sigShowTabBarMachine, 471 this, &UIVirtualBoxManagerWidget::sltHandleShowTabBarMachine); 472 connect(m_pToolbarTools, &UIToolbarTools::sigShowTabBarGlobal, 473 this, &UIVirtualBoxManagerWidget::sltHandleShowTabBarGlobal); 474 m_pToolbarTools->setTabBars(m_pTabBarMachine, m_pTabBarGlobal); 475 476 /* Create exclusive action-group: */ 477 QActionGroup *pActionGroupTools = new QActionGroup(m_pToolbarTools); 478 if (pActionGroupTools) 479 { 480 /* Configure action-group: */ 481 pActionGroupTools->setExclusive(true); 482 483 /* Add 'Tools' actions into action-group: */ 484 pActionGroupTools->addAction(actionPool()->action(UIActionIndexST_M_Tools_T_Machine)); 485 pActionGroupTools->addAction(actionPool()->action(UIActionIndexST_M_Tools_T_Global)); 486 } 487 488 /* Add into toolbar: */ 489 m_pToolBar->addWidget(m_pToolbarTools); 437 438 /* Add into layout: */ 439 pLayoutRight->addWidget(m_pToolbarTools); 490 440 } 491 441 … … 583 533 /* Restore toolbar settings: */ 584 534 { 585 m_pToolBar->setToolButtonStyle(gEDataManager->selectorWindowToolBarTextVisible() 586 ? Qt::ToolButtonTextUnderIcon : Qt::ToolButtonIconOnly); 587 m_pToolbarTools->setToolButtonStyle(gEDataManager->selectorWindowToolBarTextVisible() 588 ? Qt::ToolButtonTextUnderIcon : Qt::ToolButtonIconOnly); 535 m_pToolBar->setToolButtonStyle( gEDataManager->selectorWindowToolBarTextVisible() 536 ? Qt::ToolButtonTextUnderIcon 537 : Qt::ToolButtonIconOnly); 589 538 } 590 539 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r73534 r73552 134 134 void sltHandleToolsTypeSwitch(); 135 135 136 /** Handles request to show Machine tab-bar. */137 void sltHandleShowTabBarMachine();138 /** Handles request to show Global tab-bar. */139 void sltHandleShowTabBarGlobal();140 141 136 /** Handles rquest to open Machine tool of passed @a enmType. */ 142 137 void sltHandleToolOpenedMachine(ToolTypeMachine enmType); … … 186 181 UIToolBar *m_pToolBar; 187 182 188 /** Holds the Machine tab-bar instance. */189 UITabBar *m_pTabBarMachine;190 /** Holds the Global tab-bar instance. */191 UITabBar *m_pTabBarGlobal;192 193 183 /** Holds the Tools-toolbar instance. */ 194 184 UIToolbarTools *m_pToolbarTools;
Note:
See TracChangeset
for help on using the changeset viewer.