VirtualBox

Changeset 84435 in vbox


Ignore:
Timestamp:
May 21, 2020 3:39:16 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9743: VirtualBox Manager: Initial step of Move to Group functionality implementation; Adding Move to Group menu and moving existing Group action to this sub-menu.

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

Legend:

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

    r84305 r84435  
    623623};
    624624
    625 /** Simple action extension, used as 'Perform Group Machines' action class. */
    626 class UIActionSimpleSelectorMachinePerformGroup : public UIActionSimple
    627 {
    628     Q_OBJECT;
    629 
    630 public:
    631 
    632     /** Constructs action passing @a pParent to the base-class. */
    633     UIActionSimpleSelectorMachinePerformGroup(UIActionPool *pParent)
     625/** Menu action extension, used as 'Move to Group' menu class. */
     626class UIActionMenuSelectorMachineMoveToGroup : public UIActionMenu
     627{
     628    Q_OBJECT;
     629
     630public:
     631
     632    /** Constructs action passing @a pParent to the base-class. */
     633    UIActionMenuSelectorMachineMoveToGroup(UIActionPool *pParent)
     634        : UIActionMenu(pParent, ":/vm_group_create_16px.png", ":/vm_group_create_disabled_16px.png")
     635    {}
     636
     637protected:
     638
     639    /** Handles translation event. */
     640    virtual void retranslateUi() /* override */
     641    {
     642        setName(QApplication::translate("UIActionPool", "Move to Gro&up"));
     643    }
     644};
     645
     646/** Simple action extension, used as 'Move to Group => New' action class. */
     647class UIActionSimpleSelectorMachineMoveToGroupNew : public UIActionSimple
     648{
     649    Q_OBJECT;
     650
     651public:
     652
     653    /** Constructs action passing @a pParent to the base-class. */
     654    UIActionSimpleSelectorMachineMoveToGroupNew(UIActionPool *pParent)
    634655        : UIActionSimple(pParent, ":/vm_group_create_16px.png", ":/vm_group_create_disabled_16px.png")
    635656    {}
     
    646667    virtual void retranslateUi() /* override */
    647668    {
    648         setName(QApplication::translate("UIActionPool", "Gro&up"));
     669        setName(QApplication::translate("UIActionPool", "&New"));
    649670        setStatusTip(QApplication::translate("UIActionPool", "Add new group based on selected virtual machines"));
    650671    }
     
    29422963    m_pool[UIActionIndexST_M_Machine_S_ExportToOCI] = new UIActionSimpleSelectorMachinePerformExportToOCI(this);
    29432964    m_pool[UIActionIndexST_M_Machine_S_Remove] = new UIActionSimpleSelectorMachinePerformRemove(this);
    2944     m_pool[UIActionIndexST_M_Machine_S_AddGroup] = new UIActionSimpleSelectorMachinePerformGroup(this);
     2965    m_pool[UIActionIndexST_M_Machine_M_MoveToGroup] = new UIActionMenuSelectorMachineMoveToGroup(this);
     2966    m_pool[UIActionIndexST_M_Machine_M_MoveToGroup_S_New] = new UIActionSimpleSelectorMachineMoveToGroupNew(this);
    29452967    m_pool[UIActionIndexST_M_Machine_M_StartOrShow] = new UIActionStateSelectorCommonStartOrShow(this);
    29462968    m_pool[UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal] = new UIActionSimpleSelectorCommonPerformStartNormal(this);
     
    30333055    m_menuUpdateHandlers[UIActionIndexST_M_Group].ptfm =                 &UIActionPoolManager::updateMenuGroup;
    30343056    m_menuUpdateHandlers[UIActionIndexST_M_Machine].ptfm =               &UIActionPoolManager::updateMenuMachine;
     3057    m_menuUpdateHandlers[UIActionIndexST_M_Machine_M_MoveToGroup].ptfm = &UIActionPoolManager::updateMenuMachineMoveToGroup;
    30353058    m_menuUpdateHandlers[UIActionIndexST_M_Group_M_StartOrShow].ptfm =   &UIActionPoolManager::updateMenuGroupStartOrShow;
    30363059    m_menuUpdateHandlers[UIActionIndexST_M_Machine_M_StartOrShow].ptfm = &UIActionPoolManager::updateMenuMachineStartOrShow;
     
    30953118    updateMenuMachine();
    30963119
     3120    /* 'Machine' / 'Move to Group' menu: */
     3121    updateMenuMachineMoveToGroup();
    30973122    /* 'Group' / 'Start or Show' menu: */
    30983123    updateMenuGroupStartOrShow();
     
    33033328    pMenu->addAction(action(UIActionIndexST_M_Machine_S_ExportToOCI));
    33043329    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Remove));
    3305     pMenu->addAction(action(UIActionIndexST_M_Machine_S_AddGroup));
     3330    pMenu->addAction(action(UIActionIndexST_M_Machine_M_MoveToGroup));
    33063331    pMenu->addSeparator();
    33073332    pMenu->addAction(action(UIActionIndexST_M_Machine_M_StartOrShow));
     
    33243349    /* Mark menu as valid: */
    33253350    m_invalidations.remove(UIActionIndexST_M_Machine);
     3351}
     3352
     3353void UIActionPoolManager::updateMenuMachineMoveToGroup()
     3354{
     3355    /* Get corresponding menu: */
     3356    UIMenu *pMenu = action(UIActionIndexST_M_Machine_M_MoveToGroup)->menu();
     3357    AssertPtrReturnVoid(pMenu);
     3358    /* Clear contents: */
     3359    pMenu->clear();
     3360
     3361    /* Populate 'Machine' / 'Move to Group' menu: */
     3362    pMenu->addAction(action(UIActionIndexST_M_Machine_M_MoveToGroup_S_New));
     3363
     3364    /* Mark menu as valid (for now): */
     3365    m_invalidations.remove(UIActionIndexST_M_Machine_M_MoveToGroup);
    33263366}
    33273367
     
    36933733                    << action(UIActionIndexST_M_Machine_S_ExportToOCI)
    36943734                    << action(UIActionIndexST_M_Machine_S_Remove)
    3695                     << action(UIActionIndexST_M_Machine_S_AddGroup)
     3735                    << action(UIActionIndexST_M_Machine_M_MoveToGroup)
    36963736                    << action(UIActionIndexST_M_Machine_M_StartOrShow)
    36973737                    << action(UIActionIndexST_M_Machine_T_Pause)
     
    37033743                    << action(UIActionIndexST_M_Machine_S_CreateShortcut)
    37043744                    << action(UIActionIndexST_M_Machine_S_SortParent)
     3745                    << action(UIActionIndexST_M_Machine_M_MoveToGroup_S_New)
    37053746                    << action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal)
    37063747                    << action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h

    r83616 r84435  
    9494    UIActionIndexST_M_Machine_S_ExportToOCI,
    9595    UIActionIndexST_M_Machine_S_Remove,
    96     UIActionIndexST_M_Machine_S_AddGroup,
     96    UIActionIndexST_M_Machine_M_MoveToGroup,
     97    UIActionIndexST_M_Machine_M_MoveToGroup_S_New,
    9798    UIActionIndexST_M_Machine_M_StartOrShow,
    9899    UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal,
     
    204205    /** Updates 'Machine' menu. */
    205206    void updateMenuMachine();
     207    /** Updates 'Machine' / 'Move to Group' menu. */
     208    void updateMenuMachineMoveToGroup();
    206209    /** Updates 'Group' / 'Start or Show' menu. */
    207210    void updateMenuGroupStartOrShow();
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r84337 r84435  
    18891889    actionPool()->action(UIActionIndexST_M_Machine_S_ExportToOCI)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_ExportToOCI, items));
    18901890    actionPool()->action(UIActionIndexST_M_Machine_S_Remove)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Remove, items));
    1891     actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_AddGroup, items));
     1891    actionPool()->action(UIActionIndexST_M_Machine_M_MoveToGroup)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_MoveToGroup, items));
     1892    actionPool()->action(UIActionIndexST_M_Machine_M_MoveToGroup_S_New)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_MoveToGroup_S_New, items));
    18921893    actionPool()->action(UIActionIndexST_M_Machine_T_Pause)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_T_Pause, items));
    18931894    actionPool()->action(UIActionIndexST_M_Machine_S_Reset)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Reset, items));
     
    20972098                   isAtLeastOneItemRemovable(items);
    20982099        }
    2099         case UIActionIndexST_M_Machine_S_AddGroup:
     2100        case UIActionIndexST_M_Machine_M_MoveToGroup:
     2101        case UIActionIndexST_M_Machine_M_MoveToGroup_S_New:
    21002102        {
    21012103            return !isGroupSavingInProgress() &&
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r84420 r84435  
    976976{
    977977    /* Check if action is enabled: */
    978     if (!actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup)->isEnabled())
     978    if (!actionPool()->action(UIActionIndexST_M_Machine_M_MoveToGroup_S_New)->isEnabled())
    979979        return;
    980980
     
    13551355        m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_ExportToOCI));
    13561356        m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Remove));
    1357         m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup));
     1357        m_pContextMenuMachine->addMenu(actionPool()->action(UIActionIndexST_M_Machine_M_MoveToGroup)->menu());
    13581358        m_pContextMenuMachine->addSeparator();
    13591359        m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow));
     
    13951395    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Remove), &UIAction::triggered,
    13961396            this, &UIChooserModel::sltRemoveSelectedMachine);
    1397     connect(actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup), &UIAction::triggered,
     1397    connect(actionPool()->action(UIActionIndexST_M_Machine_M_MoveToGroup_S_New), &UIAction::triggered,
    13981398            this, &UIChooserModel::sltGroupSelectedMachines);
    13991399    connect(actionPool()->action(UIActionIndexST_M_Group_S_Refresh), &UIAction::triggered,
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