Changeset 73846 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 22, 2018 6:27:21 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/UIVirtualBoxManagerWidget.cpp
r73799 r73846 22 22 /* Qt includes: */ 23 23 # include <QHBoxLayout> 24 # include <QStackedWidget> 24 25 # include <QStyle> 25 26 # include <QVBoxLayout> … … 33 34 # include "UIVirtualBoxManager.h" 34 35 # include "UIVirtualBoxManagerWidget.h" 35 # include "UISlidingWidget.h"36 36 # include "UITabBar.h" 37 37 # include "UIToolBar.h" … … 48 48 : m_fPolished(false) 49 49 , m_pActionPool(pParent->actionPool()) 50 , m_pSlidingWidget(0)51 50 , m_pSplitter(0) 52 51 , m_pToolBar(0) 53 52 , m_pToolbarTools(0) 54 53 , m_pPaneChooser(0) 54 , m_pStackedWidget(0) 55 , m_pPaneToolsGlobal(0) 55 56 , m_pPaneToolsMachine(0) 56 , m_p PaneToolsGlobal(0)57 , m_pSlidingAnimation(0) 57 58 { 58 59 prepare(); … … 237 238 /* If global item is selected and we are on machine tools pane => switch to global tools pane: */ 238 239 if ( isGlobalItemSelected() 239 && m_pSlidingWidget->state() == UISlidingWidget::State_Start) 240 { 241 m_pSlidingWidget->moveForward(); 242 m_pToolbarTools->switchToTabBar(UIToolbarTools::TabBarType_Global); 240 && m_pStackedWidget->currentWidget() != m_pPaneToolsGlobal) 241 { 242 m_pStackedWidget->setCurrentWidget(m_pPaneToolsGlobal); // rendering w/a 243 m_pStackedWidget->setCurrentWidget(m_pSlidingAnimation); 244 m_pSlidingAnimation->animate(SlidingDirection_Reverse); 243 245 } 244 246 … … 247 249 /* If machine or group item is selected and we are on global tools pane => switch to machine tools pane: */ 248 250 if ( (isMachineItemSelected() || isGroupItemSelected()) 249 && m_pSlidingWidget->state() == UISlidingWidget::State_Final) 250 { 251 m_pSlidingWidget->moveBackward(); 252 m_pToolbarTools->switchToTabBar(UIToolbarTools::TabBarType_Machine); 251 && m_pStackedWidget->currentWidget() != m_pPaneToolsMachine) 252 { 253 m_pStackedWidget->setCurrentWidget(m_pPaneToolsMachine); // rendering w/a 254 m_pStackedWidget->setCurrentWidget(m_pSlidingAnimation); 255 m_pSlidingAnimation->animate(SlidingDirection_Forward); 253 256 } 254 257 … … 312 315 } 313 316 317 void UIVirtualBoxManagerWidget::sltHandleSlidingAnimationComplete(SlidingDirection enmDirection) 318 { 319 switch (enmDirection) 320 { 321 case SlidingDirection_Forward: 322 { 323 m_pToolbarTools->switchToTabBar(UIToolbarTools::TabBarType_Machine); 324 m_pStackedWidget->setCurrentWidget(m_pPaneToolsMachine); 325 break; 326 } 327 case SlidingDirection_Reverse: 328 { 329 m_pToolbarTools->switchToTabBar(UIToolbarTools::TabBarType_Global); 330 m_pStackedWidget->setCurrentWidget(m_pPaneToolsGlobal); 331 break; 332 } 333 } 334 } 335 314 336 void UIVirtualBoxManagerWidget::sltHandleToolOpenedMachine(ToolTypeMachine enmType) 315 337 { … … 467 489 } 468 490 469 /* Create s liding-widget: */470 m_pS lidingWidget = new UISlidingWidget(Qt::Vertical);471 if (m_pS lidingWidget)491 /* Create stacked-widget: */ 492 m_pStackedWidget = new QStackedWidget; 493 if (m_pStackedWidget) 472 494 { 495 /* Create Global Tools-pane: */ 496 m_pPaneToolsGlobal = new UIToolPaneGlobal(actionPool()); 497 if (m_pPaneToolsGlobal) 498 { 499 /* Add into stack: */ 500 m_pStackedWidget->addWidget(m_pPaneToolsGlobal); 501 } 502 473 503 /* Create Machine Tools-pane: */ 474 504 m_pPaneToolsMachine = new UIToolPaneMachine(actionPool()); 475 /* Create Global Tools-pane: */ 476 m_pPaneToolsGlobal = new UIToolPaneGlobal(actionPool()); 477 478 /* Add left/right widgets into sliding widget: */ 479 m_pSlidingWidget->setWidgets(m_pPaneToolsMachine, m_pPaneToolsGlobal); 505 if (m_pPaneToolsMachine) 506 { 507 /* Add into stack: */ 508 m_pStackedWidget->addWidget(m_pPaneToolsMachine); 509 } 510 511 /* Create sliding-widget: */ 512 m_pSlidingAnimation = new UISlidingAnimation(Qt::Vertical, true); 513 if (m_pSlidingAnimation) 514 { 515 /* Add first/second widgets into sliding animation: */ 516 m_pSlidingAnimation->setWidgets(m_pPaneToolsGlobal, m_pPaneToolsMachine); 517 connect(m_pSlidingAnimation, &UISlidingAnimation::sigAnimationComplete, 518 this, &UIVirtualBoxManagerWidget::sltHandleSlidingAnimationComplete); 519 520 /* Add into stack: */ 521 m_pStackedWidget->addWidget(m_pSlidingAnimation); 522 } 523 524 /* Make Machine Tools pane active initially: */ 525 m_pStackedWidget->setCurrentWidget(m_pPaneToolsMachine); 480 526 481 527 /* Add into layout: */ 482 pLayoutRight->addWidget(m_pS lidingWidget, 1);528 pLayoutRight->addWidget(m_pStackedWidget, 1); 483 529 } 484 530 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r73780 r73846 24 24 /* GUI includes: */ 25 25 #include "QIWithRetranslateUI.h" 26 #include "UISlidingAnimation.h" 26 27 #include "UIToolPaneGlobal.h" 27 28 #include "UIToolPaneMachine.h" 28 29 29 30 /* Forward declarations: */ 31 class QStackedWidget; 30 32 class QISplitter; 31 33 class UIActionPool; 32 34 class UIChooser; 33 class UISlidingWidget;34 35 class UITabBar; 35 36 class UIToolBar; … … 137 138 /** Handles signal about Chooser-pane index change the default way. */ 138 139 void sltHandleChooserPaneIndexChangeDefault() { sltHandleChooserPaneIndexChange(); } 140 141 /** Handles sliding animation complete signal. 142 * @param enmDirection Brings which direction was animation finished for. */ 143 void sltHandleSlidingAnimationComplete(SlidingDirection enmDirection); 139 144 /** @} */ 140 145 … … 182 187 UIActionPool *m_pActionPool; 183 188 184 /** Holds the sliding-widget isntance. */185 UISlidingWidget *m_pSlidingWidget;186 187 189 /** Holds the central splitter instance. */ 188 190 QISplitter *m_pSplitter; … … 200 202 201 203 /** Holds the Chooser-pane instance. */ 202 UIChooser *m_pPaneChooser; 204 UIChooser *m_pPaneChooser; 205 /** Holds the stacked-widget. */ 206 QStackedWidget *m_pStackedWidget; 207 /** Holds the Global Tools-pane instance. */ 208 UIToolPaneGlobal *m_pPaneToolsGlobal; 203 209 /** Holds the Machine Tools-pane instance. */ 204 UIToolPaneMachine *m_pPaneToolsMachine;205 /** Holds the Global Tools-paneinstance. */206 UI ToolPaneGlobal *m_pPaneToolsGlobal;210 UIToolPaneMachine *m_pPaneToolsMachine; 211 /** Holds the sliding-animation widget instance. */ 212 UISlidingAnimation *m_pSlidingAnimation; 207 213 }; 208 214
Note:
See TracChangeset
for help on using the changeset viewer.