VirtualBox

Ignore:
Timestamp:
Aug 16, 2018 6:09:07 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: VirtualBox Manager UI: Integrating Media Manager toolbar into Main application toolbar.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.cpp

    r73717 r73721  
    111111            {
    112112                /* Create Virtual Media Manager: */
    113                 m_pPaneMedia = new UIMediumManagerWidget(EmbedTo_Stack, m_pActionPool);
     113                m_pPaneMedia = new UIMediumManagerWidget(EmbedTo_Stack, m_pActionPool, false /* show toolbar */);
    114114                AssertPtrReturnVoid(m_pPaneMedia);
    115115                {
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r73717 r73721  
    114114    , m_pSnapshotMenuAction(0)
    115115    , m_pLogViewerMenuAction(0)
     116    , m_pVirtualMediaManagerMenuAction(0)
    116117    , m_pManagerVirtualMedia(0)
    117118    , m_pManagerHostNetwork(0)
     
    12371238    m_pLogViewerMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndex_M_LogViewer)->menu());
    12381239
     1240    /* Prepare 'Medium' menu: */
     1241    prepareMenuMedium(actionPool()->action(UIActionIndexST_M_Medium)->menu());
     1242    m_pVirtualMediaManagerMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Medium)->menu());
     1243
    12391244#ifdef VBOX_WS_MAC
    12401245    /* Prepare 'Window' menu: */
     
    16551660    /* Remember action list: */
    16561661    m_logViewerActions << actionPool()->action(UIActionIndex_M_LogViewer_T_Find)
    1657                  << actionPool()->action(UIActionIndex_M_LogViewer_T_Filter)
    1658                  << actionPool()->action(UIActionIndex_M_LogViewer_T_Bookmark)
    1659                  << actionPool()->action(UIActionIndex_M_LogViewer_T_Settings)
    1660                  << actionPool()->action(UIActionIndex_M_LogViewer_S_Refresh)
    1661                  << actionPool()->action(UIActionIndex_M_LogViewer_S_Save);
     1662                       << actionPool()->action(UIActionIndex_M_LogViewer_T_Filter)
     1663                       << actionPool()->action(UIActionIndex_M_LogViewer_T_Bookmark)
     1664                       << actionPool()->action(UIActionIndex_M_LogViewer_T_Settings)
     1665                       << actionPool()->action(UIActionIndex_M_LogViewer_S_Refresh)
     1666                       << actionPool()->action(UIActionIndex_M_LogViewer_S_Save);
     1667}
     1668
     1669void UIVirtualBoxManager::prepareMenuMedium(QMenu *pMenu)
     1670{
     1671    /* We are doing it inside the UIActionPoolSelector. */
     1672    Q_UNUSED(pMenu);
     1673
     1674    /* Do not touch if filled already: */
     1675    if (!m_virtualMediaManagerActions.isEmpty())
     1676        return;
     1677
     1678    /* Remember action list: */
     1679    m_virtualMediaManagerActions << actionPool()->action(UIActionIndexST_M_Medium_S_Add)
     1680                                 << actionPool()->action(UIActionIndexST_M_Medium_S_Copy)
     1681                                 << actionPool()->action(UIActionIndexST_M_Medium_S_Move)
     1682                                 << actionPool()->action(UIActionIndexST_M_Medium_S_Remove)
     1683                                 << actionPool()->action(UIActionIndexST_M_Medium_S_Release)
     1684                                 << actionPool()->action(UIActionIndexST_M_Medium_T_Details)
     1685                                 << actionPool()->action(UIActionIndexST_M_Medium_S_Refresh);
    16621686}
    16631687
     
    19461970{
    19471971    /* Determine whether Machine or Group menu should be shown at all: */
     1972    const bool fGlobalMenuShown = m_pWidget->isGlobalItemSelected();
    19481973    const bool fMachineOrGroupMenuShown = m_pWidget->isMachineItemSelected() || m_pWidget->isGroupItemSelected();
    19491974    const bool fMachineMenuShown = !isSingleGroupSelected();
     
    19581983    const bool fLogViewerMenuShown = fMachineOrGroupMenuShown && m_pWidget->currentMachineTool() == ToolTypeMachine_LogViewer;
    19591984    m_pLogViewerMenuAction->setVisible(fLogViewerMenuShown);
     1985
     1986    /* Determine whether VirtualMediaManager actions should be visible: */
     1987    const bool fMediumMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == ToolTypeGlobal_VirtualMedia;
     1988    m_pVirtualMediaManagerMenuAction->setVisible(fMediumMenuShown);
    19601989
    19611990    /* Hide action shortcuts: */
     
    19762005    foreach (UIAction *pAction, m_logViewerActions)
    19772006        pAction->setVisible(fLogViewerMenuShown);
     2007    foreach (UIAction *pAction, m_virtualMediaManagerActions)
     2008        pAction->setVisible(fMediumMenuShown);
    19782009
    19792010    /* Show action shortcuts: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r73697 r73721  
    252252        /** Prepares @a pMenu Log Viewer. */
    253253        void prepareMenuLogViewer(QMenu *pMenu);
     254        /** Prepares @a pMenu Medium. */
     255        void prepareMenuMedium(QMenu *pMenu);
    254256        /** Prepares status-bar. */
    255257        void prepareStatusBar();
     
    359361    /** Holds the list of Log Viewer menu actions. */
    360362    QList<UIAction*>  m_logViewerActions;
    361     /** Holds the Log menu parent action. */
     363    /** Holds the Log Viewer menu parent action. */
    362364    QAction          *m_pLogViewerMenuAction;
     365
     366    /** Holds the list of Virtual Media Manager menu actions. */
     367    QList<UIAction*>  m_virtualMediaManagerActions;
     368    /** Holds the Virtual Media Manager menu parent action. */
     369    QAction          *m_pVirtualMediaManagerMenuAction;
    363370
    364371    /** Holds the Virtual Media Manager window instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r73697 r73721  
    422422        m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_LogViewer_S_Refresh));
    423423
     424        /* Add 'Medium' actions block: */
     425        m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Medium_S_Add));
     426        m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Medium_S_Copy));
     427        m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Medium_S_Move));
     428        m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Medium_S_Remove));
     429        m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Medium_S_Release));
     430        m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Medium_T_Details));
     431        m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Medium_S_Refresh));
     432
    424433#ifdef VBOX_WS_MAC
    425434        // WORKAROUND:
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r73717 r73721  
    149149*********************************************************************************************************************************/
    150150
    151 UIMediumManagerWidget::UIMediumManagerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool, QWidget *pParent /* = 0 */)
     151UIMediumManagerWidget::UIMediumManagerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
     152                                             bool fShowToolbar /* = true */, QWidget *pParent /* = 0 */)
    152153    : QIWithRetranslateUI<QWidget>(pParent)
    153154    , m_enmEmbedding(enmEmbedding)
    154155    , m_pActionPool(pActionPool)
     156    , m_fShowToolbar(fShowToolbar)
    155157    , m_fPreventChangeCurrentItem(false)
    156158    , m_pTabWidget(0)
     
    769771
    770772        /* Prepare toolbar: */
    771         prepareToolBar();
     773        if (m_fShowToolbar)
     774            prepareToolBar();
    772775        /* Prepare tab-widget: */
    773776        prepareTabWidget();
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h

    r73717 r73721  
    105105public:
    106106
    107     /** Constructs Virtual Media Manager widget. */
    108     UIMediumManagerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool, QWidget *pParent = 0);
     107    /** Constructs Virtual Media Manager widget.
     108      * @param  enmEmbedding  Brings the type of widget embedding.
     109      * @param  pActionPool   Brings the action-pool reference.
     110      * @param  fShowToolbar  Brings whether we should create/show toolbar. */
     111    UIMediumManagerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool, bool fShowToolbar = true, QWidget *pParent = 0);
    109112
    110113    /** Returns the menu. */
     
    298301        /** Holds the widget embedding type. */
    299302        const EmbedTo m_enmEmbedding;
    300 
    301303        /** Holds the action-pool reference. */
    302304        UIActionPool *m_pActionPool;
     305        /** Holds whether we should create/show toolbar. */
     306        const bool    m_fShowToolbar;
    303307
    304308        /** Holds whether Virtual Media Manager should preserve current item change. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette