Changeset 73676 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Aug 14, 2018 7:02:08 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp
r73671 r73676 134 134 { 135 135 /* Create Snapshots pane: */ 136 m_pPaneSnapshots = new UISnapshotPane(m_pActionPool );136 m_pPaneSnapshots = new UISnapshotPane(m_pActionPool, false /* show toolbar? */); 137 137 AssertPtrReturnVoid(m_pPaneSnapshots); 138 138 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r73674 r73676 112 112 , m_pGroupMenuAction(0) 113 113 , m_pMachineMenuAction(0) 114 , m_pSnapshotMenuAction(0) 114 115 , m_pManagerVirtualMedia(0) 115 116 , m_pManagerHostNetwork(0) … … 1227 1228 m_pMachineMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Machine)->menu()); 1228 1229 1230 /* Prepare Snapshot-menu: */ 1231 prepareMenuSnapshot(actionPool()->action(UIActionIndexST_M_Snapshot)->menu()); 1232 m_pSnapshotMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Snapshot)->menu()); 1233 1229 1234 #ifdef VBOX_WS_MAC 1230 1235 /* Prepare 'Window' menu: */ … … 1599 1604 } 1600 1605 1606 void UIVirtualBoxManager::prepareMenuSnapshot(QMenu *pMenu) 1607 { 1608 /* Do not touch if filled already: */ 1609 if (!pMenu->isEmpty()) 1610 return; 1611 1612 #ifdef VBOX_WS_X11 1613 // WORKAROUND: 1614 // There is an issue under Ubuntu which uses special kind of QPA 1615 // plugin (appmenu-qt5) which redirects actions added to Qt menu-bar 1616 // directly to Ubuntu Application menu-bar. In that case action 1617 // shortcuts are not being handled by the Qt and that way ignored. 1618 // As a workaround we can add those actions into QMainWindow as well. 1619 addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Take)); 1620 addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Delete)); 1621 addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Restore)); 1622 addAction(actionPool()->action(UIActionIndexST_M_Snapshot_T_Properties)); 1623 addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Clone)); 1624 #endif /* VBOX_WS_X11 */ 1625 1626 /* Populate Snapshot-menu: */ 1627 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Take)); 1628 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Delete)); 1629 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Restore)); 1630 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_T_Properties)); 1631 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Clone)); 1632 1633 /* Remember action list: */ 1634 m_snapshotActions << actionPool()->action(UIActionIndexST_M_Snapshot_S_Take) 1635 << actionPool()->action(UIActionIndexST_M_Snapshot_S_Delete) 1636 << actionPool()->action(UIActionIndexST_M_Snapshot_S_Restore) 1637 << actionPool()->action(UIActionIndexST_M_Snapshot_T_Properties) 1638 << actionPool()->action(UIActionIndexST_M_Snapshot_S_Clone); 1639 } 1640 1601 1641 void UIVirtualBoxManager::prepareStatusBar() 1602 1642 { … … 1888 1928 m_pGroupMenuAction->setVisible(fMachineOrGroupMenuShown && !fMachineMenuShown); 1889 1929 1930 /* Determine whether Snapshot actions should be visible: */ 1931 const bool fSnapshotMenuShown = fMachineOrGroupMenuShown && m_pWidget->currentMachineTool() == ToolTypeMachine_Snapshots; 1932 m_pSnapshotMenuAction->setVisible(fSnapshotMenuShown); 1933 actionPool()->action(UIActionIndexST_M_Snapshot_S_Take)->setVisible(fSnapshotMenuShown); 1934 actionPool()->action(UIActionIndexST_M_Snapshot_S_Delete)->setVisible(fSnapshotMenuShown); 1935 actionPool()->action(UIActionIndexST_M_Snapshot_S_Restore)->setVisible(fSnapshotMenuShown); 1936 actionPool()->action(UIActionIndexST_M_Snapshot_T_Properties)->setVisible(fSnapshotMenuShown); 1937 actionPool()->action(UIActionIndexST_M_Snapshot_S_Clone)->setVisible(fSnapshotMenuShown); 1938 1890 1939 /* Hide action shortcuts: */ 1891 1940 if (!fMachineMenuShown) -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r73673 r73676 248 248 /** Prepares @a pMenu Machine => Close. */ 249 249 void prepareMenuMachineClose(QMenu *pMenu); 250 /** Prepares @a pMenu Snapshot. */ 251 void prepareMenuSnapshot(QMenu *pMenu); 250 252 /** Prepares status-bar. */ 251 253 void prepareStatusBar(); … … 348 350 QAction *m_pMachineMenuAction; 349 351 352 /** Holds the list of Snapshot menu actions. */ 353 QList<UIAction*> m_snapshotActions; 354 /** Holds the Snapshot menu parent action. */ 355 QAction *m_pSnapshotMenuAction; 356 350 357 /** Holds the Virtual Media Manager window instance. */ 351 358 QIManagerDialog *m_pManagerVirtualMedia; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r73673 r73676 104 104 } 105 105 106 ToolTypeMachine UIVirtualBoxManagerWidget::currentMachineTool() const 107 { 108 return m_pPaneToolsMachine->currentTool(); 109 } 110 111 ToolTypeGlobal UIVirtualBoxManagerWidget::currentGlobalTool() const 112 { 113 return m_pPaneToolsGlobal->currentTool(); 114 } 115 106 116 bool UIVirtualBoxManagerWidget::isToolOpened(ToolTypeMachine enmType) const 107 117 { … … 393 403 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Discard)); 394 404 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow)); 405 406 /* Add Snapshot actions block: */ 407 m_pToolBar->addSeparator(); 408 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Take)); 409 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Delete)); 410 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Restore)); 411 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_T_Properties)); 412 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Clone)); 413 395 414 #ifdef VBOX_WS_MAC 396 415 // WORKAROUND: 397 416 // Actually Qt should do that itself but by some unknown reason it sometimes 398 // forget to update toolbar after changing its actions on cocoa platform.417 // forget to update toolbar after changing its actions on Cocoa platform. 399 418 connect(actionPool()->action(UIActionIndexST_M_Machine_S_New), &UIAction::changed, 400 419 m_pToolBar, static_cast<void(UIToolBar::*)(void)>(&UIToolBar::update)); … … 405 424 connect(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow), &UIAction::changed, 406 425 m_pToolBar, static_cast<void(UIToolBar::*)(void)>(&UIToolBar::update)); 407 #endif /* VBOX_WS_MAC */ 408 409 #ifdef VBOX_WS_MAC 426 410 427 // WORKAROUND: 411 428 // There is a bug in Qt Cocoa which result in showing a "more arrow" when … … 414 431 // after changing the text. 415 432 m_pToolBar->updateLayout(); 416 #endif 433 #endif /* VBOX_WS_MAC */ 417 434 } 418 435 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r73673 r73676 86 86 bool isSingleGroupSelected() const; 87 87 88 /** Returns a type of curent Machine tool. */ 89 ToolTypeMachine currentMachineTool() const; 90 /** Returns a type of curent Global tool. */ 91 ToolTypeGlobal currentGlobalTool() const; 88 92 /** Returns whether Machine tool of passed @a enmType is opened. */ 89 93 bool isToolOpened(ToolTypeMachine enmType) const; -
trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotPane.cpp
r73671 r73676 452 452 *********************************************************************************************************************************/ 453 453 454 UISnapshotPane::UISnapshotPane(UIActionPool *pActionPool, QWidget *pParent /* = 0 */)454 UISnapshotPane::UISnapshotPane(UIActionPool *pActionPool, bool fShowToolbar /* = true */, QWidget *pParent /* = 0 */) 455 455 : QIWithRetranslateUI<QWidget>(pParent) 456 456 , m_pActionPool(pActionPool) 457 , m_fShowToolbar(fShowToolbar) 457 458 , m_enmSessionState(KSessionState_Null) 458 459 , m_fShapshotOperationsAllowed(false) … … 1220 1221 #endif 1221 1222 1222 /* Prepare toolbar: */ 1223 prepareToolbar(); 1223 /* Prepare toolbar, if requested: */ 1224 if (m_fShowToolbar) 1225 prepareToolbar(); 1224 1226 /* Prepare snapshot tree: */ 1225 1227 prepareTreeWidget(); … … 1233 1235 /* Create snapshot toolbar: */ 1234 1236 m_pToolBar = new UIToolBar(this); 1235 AssertPtrReturnVoid(m_pToolBar);1237 if (m_pToolBar) 1236 1238 { 1237 1239 /* Configure toolbar: */ -
trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotPane.h
r73671 r73676 58 58 59 59 /** Constructs snapshot pane passing @a pParent to the base-class. */ 60 UISnapshotPane(UIActionPool *pActionPool, QWidget *pParent = 0);60 UISnapshotPane(UIActionPool *pActionPool, bool fShowToolbar = true, QWidget *pParent = 0); 61 61 /** Destructs snapshot pane. */ 62 62 virtual ~UISnapshotPane() /* override */; … … 198 198 /** Holds the action-pool reference. */ 199 199 UIActionPool *m_pActionPool; 200 /** Holds whether we should show toolbar. */ 201 bool m_fShowToolbar; 200 202 /** Holds the COM machine object. */ 201 203 CMachine m_comMachine;
Note:
See TracChangeset
for help on using the changeset viewer.