VirtualBox

Changeset 74950 in vbox


Ignore:
Timestamp:
Oct 19, 2018 4:41:15 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9261: VirtualBox Manager: Add/New actions for Machine menu in Global Tools case, we wanted to have them in toolbar anyway.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.cpp

    r74933 r74950  
    25572557#endif
    25582558    m_pool[UIActionIndexST_M_File_S_Close] = new UIActionSimpleSelectorFilePerformExit(this);
     2559
     2560    /* 'Welcome' actions: */
     2561    m_pool[UIActionIndexST_M_Welcome] = new UIActionMenuSelectorMachine(this);
     2562    m_pool[UIActionIndexST_M_Welcome_S_New] = new UIActionSimpleSelectorMachinePerformCreate(this);
     2563    m_pool[UIActionIndexST_M_Welcome_S_Add] = new UIActionSimpleSelectorMachinePerformAdd(this);
    25592564
    25602565    /* 'Group' actions: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.h

    r74923 r74950  
    4444#endif /* VBOX_GUI_WITH_EXTRADATA_MANAGER_UI */
    4545    UIActionIndexST_M_File_S_Close,
     46
     47    /* 'Welcome' menu actions: */
     48    UIActionIndexST_M_Welcome,
     49    UIActionIndexST_M_Welcome_S_New,
     50    UIActionIndexST_M_Welcome_S_Add,
    4651
    4752    /* 'Group' menu actions: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r74948 r74950  
    112112    , m_fFirstMediumEnumerationHandled(false)
    113113    , m_pActionPool(0)
     114    , m_pWelcomeMenuAction(0)
    114115    , m_pGroupMenuAction(0)
    115116    , m_pMachineMenuAction(0)
     
    12471248    prepareMenuFile(actionPool()->action(UIActionIndexST_M_File)->menu());
    12481249    menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_File)->menu());
     1250
     1251    /* Prepare 'Welcome' menu: */
     1252    prepareMenuWelcome(actionPool()->action(UIActionIndexST_M_Welcome)->menu());
     1253    m_pWelcomeMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Welcome)->menu());
    12491254
    12501255    /* Prepare 'Group' / 'Start or Show' menu: */
     
    14081413}
    14091414
     1415void UIVirtualBoxManager::prepareMenuWelcome(QMenu *pMenu)
     1416{
     1417#ifdef VBOX_WS_X11
     1418    // WORKAROUND:
     1419    // There is an issue under Ubuntu which uses special kind of QPA
     1420    // plugin (appmenu-qt5) which redirects actions added to Qt menu-bar
     1421    // directly to Ubuntu Application menu-bar. In that case action
     1422    // shortcuts are not being handled by the Qt and that way ignored.
     1423    // As a workaround we can add those actions into QMainWindow as well.
     1424    addAction(actionPool()->action(UIActionIndexST_M_Welcome_S_New));
     1425    addAction(actionPool()->action(UIActionIndexST_M_Welcome_S_Add));
     1426#endif /* VBOX_WS_X11 */
     1427
     1428    /* Populate Machine-menu: */
     1429    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Welcome_S_New));
     1430    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Welcome_S_Add));
     1431
     1432    /* Remember action list: */
     1433    m_welcomeActions << actionPool()->action(UIActionIndexST_M_Welcome_S_New)
     1434                     << actionPool()->action(UIActionIndexST_M_Welcome_S_Add);
     1435}
     1436
    14101437void UIVirtualBoxManager::prepareMenuGroup(QMenu *pMenu)
    14111438{
     
    18391866            this, &UIVirtualBoxManager::sltPerformExit);
    18401867
     1868    /* 'Welcome' menu connections: */
     1869    connect(actionPool()->action(UIActionIndexST_M_Welcome_S_Add), &UIAction::triggered,
     1870            this, &UIVirtualBoxManager::sltOpenAddMachineDialogDefault);
     1871
    18411872    /* 'Group' menu connections: */
    18421873    connect(actionPool()->action(UIActionIndexST_M_Group_S_Add), &UIAction::triggered,
     
    20622093    const bool fMachineMenuShown = m_pWidget->isMachineItemSelected() && !isSingleGroupSelected();
    20632094    const bool fGroupMenuShown   = m_pWidget->isGroupItemSelected()   &&  isSingleGroupSelected();
     2095    m_pWelcomeMenuAction->setVisible(fGlobalMenuShown);
    20642096    m_pMachineMenuAction->setVisible(fMachineMenuShown);
    20652097    m_pGroupMenuAction->setVisible(fGroupMenuShown);
     
    20882120
    20892121    /* Hide action shortcuts: */
     2122    if (!fGlobalMenuShown)
     2123        foreach (UIAction *pAction, m_welcomeActions)
     2124            pAction->hideShortcut();
    20902125    if (!fMachineMenuShown)
    20912126        foreach (UIAction *pAction, m_machineActions)
    20922127            pAction->hideShortcut();
    2093     else
     2128    if (!fGroupMenuShown)
    20942129        foreach (UIAction *pAction, m_groupActions)
    20952130            pAction->hideShortcut();
    20962131
    20972132    /* Show action shortcuts: */
     2133    if (fGlobalMenuShown)
     2134        foreach (UIAction *pAction, m_welcomeActions)
     2135            pAction->showShortcut();
    20982136    if (fMachineMenuShown)
    20992137        foreach (UIAction *pAction, m_machineActions)
    21002138            pAction->showShortcut();
    2101     else
     2139    if (fGroupMenuShown)
    21022140        foreach (UIAction *pAction, m_groupActions)
    21032141            pAction->showShortcut();
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r74942 r74950  
    241241        /** Prepares @a pMenu File. */
    242242        void prepareMenuFile(QMenu *pMenu);
     243        /** Prepares @a pMenu Welcome. */
     244        void prepareMenuWelcome(QMenu *pMenu);
    243245        /** Prepares @a pMenu Group. */
    244246        void prepareMenuGroup(QMenu *pMenu);
     
    353355    UIActionPool *m_pActionPool;
    354356
     357    /** Holds the list of Welcome menu actions. */
     358    QList<UIAction*>  m_welcomeActions;
     359    /** Holds the Welcome menu parent action. */
     360    QAction          *m_pWelcomeMenuAction;
     361
    355362    /** Holds the list of Group menu actions. */
    356363    QList<UIAction*>  m_groupActions;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r74923 r74950  
    615615                    m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_File_S_ExportAppliance));
    616616                    m_pToolBar->addSeparator();
    617                     m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_New));
    618                     m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Add));
     617                    m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Welcome_S_New));
     618                    m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Welcome_S_Add));
    619619                    break;
    620620                }
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r74942 r74950  
    989989
    990990    /* Lock the action preventing cascade calls: */
     991    actionPool()->action(UIActionIndexST_M_Welcome_S_New)->setEnabled(false);
    991992    actionPool()->action(UIActionIndexST_M_Machine_S_New)->setEnabled(false);
    992993    actionPool()->action(UIActionIndexST_M_Group_S_New)->setEnabled(false);
     
    10071008
    10081009    /* Unlock the action allowing further calls: */
     1010    actionPool()->action(UIActionIndexST_M_Welcome_S_New)->setEnabled(true);
    10091011    actionPool()->action(UIActionIndexST_M_Machine_S_New)->setEnabled(true);
    10101012    actionPool()->action(UIActionIndexST_M_Group_S_New)->setEnabled(true);
     
    14581460
    14591461    /* Setup action connections: */
     1462    connect(actionPool()->action(UIActionIndexST_M_Welcome_S_New), SIGNAL(triggered()),
     1463            this, SLOT(sltCreateNewMachine()));
    14601464    connect(actionPool()->action(UIActionIndexST_M_Group_S_New), SIGNAL(triggered()),
    14611465            this, SLOT(sltCreateNewMachine()));
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