VirtualBox

Changeset 42767 in vbox for trunk


Ignore:
Timestamp:
Aug 10, 2012 10:34:00 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: VM Selector: Action pool refactoring/cleanup (part 3): Mac-host
update for group/machine 'Close' sub-menu.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector
Files:
5 edited

Legend:

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

    r42760 r42767  
    630630
    631631
    632 class UIActionMenuMachineClose : public UIActionMenu
    633 {
    634     Q_OBJECT;
    635 
    636 public:
    637 
    638     UIActionMenuMachineClose(QObject *pParent)
     632class UIActionMenuClose : public UIActionMenu
     633{
     634    Q_OBJECT;
     635
     636public:
     637
     638    UIActionMenuClose(QObject *pParent)
    639639        : UIActionMenu(pParent, ":/exit_16px.png")
    640640    {
     
    759759    m_pool[UIActionIndexSelector_Simple_Group_Remove] = new UIActionSimpleGroupRemove(this);
    760760    m_pool[UIActionIndexSelector_Simple_Group_Sort] = new UIActionSimpleGroupSort(this);
     761    m_pool[UIActionIndexSelector_Simple_Group_Close_Save] = new UIActionSimpleSave(this);
     762    m_pool[UIActionIndexSelector_Simple_Group_Close_ACPIShutdown] = new UIActionSimpleACPIShutdown(this);
     763    m_pool[UIActionIndexSelector_Simple_Group_Close_PowerOff] = new UIActionSimplePowerOff(this);
    761764
    762765    /* 'Machine' actions: */
     
    765768    m_pool[UIActionIndexSelector_Simple_Machine_Remove] = new UIActionSimpleMachineRemove(this);
    766769    m_pool[UIActionIndexSelector_Simple_Machine_AddGroup] = new UIActionSimpleMachineAddGroup(this);
     770    m_pool[UIActionIndexSelector_Simple_Machine_Close_Save] = new UIActionSimpleSave(this);
     771    m_pool[UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown] = new UIActionSimpleACPIShutdown(this);
     772    m_pool[UIActionIndexSelector_Simple_Machine_Close_PowerOff] = new UIActionSimplePowerOff(this);
    767773
    768774    /* Common actions: */
     
    777783    m_pool[UIActionIndexSelector_Simple_Common_CreateShortcut] = new UIActionSimpleCommonCreateShortcut(this);
    778784    m_pool[UIActionIndexSelector_Simple_Common_SortParent] = new UIActionSimpleCommonSortParent(this);
    779 
    780     /* 'Machine/Close' actions: */
    781     m_pool[UIActionIndexSelector_Simple_Machine_Close_Save] = new UIActionSimpleSave(this);
    782     m_pool[UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown] = new UIActionSimpleACPIShutdown(this);
    783     m_pool[UIActionIndexSelector_Simple_Machine_Close_PowerOff] = new UIActionSimplePowerOff(this);
    784785}
    785786
     
    794795    /* 'Group' menu: */
    795796    m_pool[UIActionIndexSelector_Menu_Group] = new UIActionMenuGroup(this);
     797    m_pool[UIActionIndexSelector_Menu_Group_Close] = new UIActionMenuClose(this);
    796798
    797799    /* 'Machine' menu: */
    798800    m_pool[UIActionIndexSelector_Menu_Machine] = new UIActionMenuMachine(this);
    799 
    800     /* 'Machine/Close' menu: */
    801     m_pool[UIActionIndexSelector_Menu_Machine_Close] = new UIActionMenuMachineClose(this);
     801    m_pool[UIActionIndexSelector_Menu_Machine_Close] = new UIActionMenuClose(this);
    802802}
    803803
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.h

    r42760 r42767  
    3939    UIActionIndexSelector_Simple_Group_Remove,
    4040    UIActionIndexSelector_Simple_Group_Sort,
     41    UIActionIndexSelector_Menu_Group_Close,
     42    UIActionIndexSelector_Simple_Group_Close_Save,
     43    UIActionIndexSelector_Simple_Group_Close_ACPIShutdown,
     44    UIActionIndexSelector_Simple_Group_Close_PowerOff,
    4145
    4246    /* 'Machine' menu actions: */
     
    4650    UIActionIndexSelector_Simple_Machine_Remove,
    4751    UIActionIndexSelector_Simple_Machine_AddGroup,
     52    UIActionIndexSelector_Menu_Machine_Close,
     53    UIActionIndexSelector_Simple_Machine_Close_Save,
     54    UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown,
     55    UIActionIndexSelector_Simple_Machine_Close_PowerOff,
    4856
    4957    /* Common 'Group' / 'Machine' menu actions: */
     
    5866    UIActionIndexSelector_Simple_Common_CreateShortcut,
    5967    UIActionIndexSelector_Simple_Common_SortParent,
    60 
    61     /* 'Machine/Close' menu actions: */
    62     UIActionIndexSelector_Menu_Machine_Close,
    63     UIActionIndexSelector_Simple_Machine_Close_Save,
    64     UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown,
    65     UIActionIndexSelector_Simple_Machine_Close_PowerOff,
    6668
    6769    /* Maximum index: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r42766 r42767  
    776776}
    777777
    778 void UISelectorWindow::sltMachineCloseMenuAboutToShow()
     778void UISelectorWindow::sltGroupCloseMenuAboutToShow()
    779779{
    780780    /* Get selected items: */
     
    782782    AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));
    783783
    784     m_pACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items));
     784    m_pGroupACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_ACPIShutdown, items));
     785}
     786void UISelectorWindow::sltMachineCloseMenuAboutToShow()
     787{
     788    /* Get selected items: */
     789    QList<UIVMItem*> items = currentItems();
     790    AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));
     791
     792    m_pMachineACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items));
    785793}
    786794
     
    10711079    menuBar()->addMenu(m_pFileMenu);
    10721080
    1073     /* Prepare 'Close' menu: */
     1081    /* Prepare 'Group' / 'Close' menu: */
     1082    m_pGroupCloseMenuAction = gActionPool->action(UIActionIndexSelector_Menu_Group_Close);
     1083    m_pGroupCloseMenu = m_pGroupCloseMenuAction->menu();
     1084    prepareMenuGroupClose(m_pGroupCloseMenu);
     1085
     1086    /* Prepare 'Machine' / 'Close' menu: */
    10741087    m_pMachineCloseMenuAction = gActionPool->action(UIActionIndexSelector_Menu_Machine_Close);
    10751088    m_pMachineCloseMenu = m_pMachineCloseMenuAction->menu();
     
    11751188    pMenu->addAction(m_pAction_Common_PauseAndResume);
    11761189    pMenu->addAction(m_pAction_Common_Reset);
    1177     pMenu->addMenu(m_pMachineCloseMenu);
     1190    pMenu->addMenu(m_pGroupCloseMenu);
    11781191    pMenu->addSeparator();
    11791192    pMenu->addAction(m_pAction_Common_Discard);
     
    12281241}
    12291242
    1230 void UISelectorWindow::prepareMenuMachineClose(QMenu *pMenu)
     1243void UISelectorWindow::prepareMenuGroupClose(QMenu *pMenu)
    12311244{
    12321245    /* Do not touch if filled already: */
     
    12341247        return;
    12351248
    1236     /* Populate Machine/Close-menu: */
    1237     m_pSaveAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_Save);
    1238     pMenu->addAction(m_pSaveAction);
    1239     m_pACPIShutdownAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown);
    1240     pMenu->addAction(m_pACPIShutdownAction);
    1241     m_pPowerOffAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_PowerOff);
    1242     pMenu->addAction(m_pPowerOffAction);
     1249    /* Populate 'Group' / 'Close' menu: */
     1250    m_pGroupSaveAction = gActionPool->action(UIActionIndexSelector_Simple_Group_Close_Save);
     1251    pMenu->addAction(m_pGroupSaveAction);
     1252    m_pGroupACPIShutdownAction = gActionPool->action(UIActionIndexSelector_Simple_Group_Close_ACPIShutdown);
     1253    pMenu->addAction(m_pGroupACPIShutdownAction);
     1254    m_pGroupPowerOffAction = gActionPool->action(UIActionIndexSelector_Simple_Group_Close_PowerOff);
     1255    pMenu->addAction(m_pGroupPowerOffAction);
     1256}
     1257
     1258void UISelectorWindow::prepareMenuMachineClose(QMenu *pMenu)
     1259{
     1260    /* Do not touch if filled already: */
     1261    if (!pMenu->isEmpty())
     1262        return;
     1263
     1264    /* Populate 'Machine' / 'Close' menu: */
     1265    m_pMachineSaveAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_Save);
     1266    pMenu->addAction(m_pMachineSaveAction);
     1267    m_pMachineACPIShutdownAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown);
     1268    pMenu->addAction(m_pMachineACPIShutdownAction);
     1269    m_pMachinePowerOffAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_PowerOff);
     1270    pMenu->addAction(m_pMachinePowerOffAction);
    12431271}
    12441272
     
    13751403    connect(m_pAction_Machine_Clone, SIGNAL(triggered()), this, SLOT(sltShowCloneMachineWizard()));
    13761404
     1405    /* 'Group/Close' menu connections: */
     1406    connect(m_pGroupCloseMenu, SIGNAL(aboutToShow()), this, SLOT(sltGroupCloseMenuAboutToShow()));
     1407    connect(m_pGroupSaveAction, SIGNAL(triggered()), this, SLOT(sltPerformSaveAction()));
     1408    connect(m_pGroupACPIShutdownAction, SIGNAL(triggered()), this, SLOT(sltPerformACPIShutdownAction()));
     1409    connect(m_pGroupPowerOffAction, SIGNAL(triggered()), this, SLOT(sltPerformPowerOffAction()));
     1410
    13771411    /* 'Machine/Close' menu connections: */
    13781412    connect(m_pMachineCloseMenu, SIGNAL(aboutToShow()), this, SLOT(sltMachineCloseMenuAboutToShow()));
    1379     connect(m_pSaveAction, SIGNAL(triggered()), this, SLOT(sltPerformSaveAction()));
    1380     connect(m_pACPIShutdownAction, SIGNAL(triggered()), this, SLOT(sltPerformACPIShutdownAction()));
    1381     connect(m_pPowerOffAction, SIGNAL(triggered()), this, SLOT(sltPerformPowerOffAction()));
     1413    connect(m_pMachineSaveAction, SIGNAL(triggered()), this, SLOT(sltPerformSaveAction()));
     1414    connect(m_pMachineACPIShutdownAction, SIGNAL(triggered()), this, SLOT(sltPerformACPIShutdownAction()));
     1415    connect(m_pMachinePowerOffAction, SIGNAL(triggered()), this, SLOT(sltPerformPowerOffAction()));
    13821416
    13831417    /* 'Help' menu connections: */
     
    15751609    m_pAction_Common_SortParent->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Common_SortParent, items));
    15761610
     1611    /* Enable/disable group-close actions: */
     1612    m_pGroupCloseMenuAction->setEnabled(isActionEnabled(UIActionIndexSelector_Menu_Group_Close, items));
     1613    m_pGroupSaveAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_Save, items));
     1614    m_pGroupACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_ACPIShutdown, items));
     1615    m_pGroupPowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_PowerOff, items));
     1616
    15771617    /* Enable/disable machine-close actions: */
    15781618    m_pMachineCloseMenuAction->setEnabled(isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, items));
    1579     m_pSaveAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_Save, items));
    1580     m_pACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items));
    1581     m_pPowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, items));
     1619    m_pMachineSaveAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_Save, items));
     1620    m_pMachineACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items));
     1621    m_pMachinePowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, items));
    15821622
    15831623    /* Start/Show action is deremined by 1st item: */
     
    16881728            return isAtLeastOneItemSupportsShortcuts(items);
    16891729        }
     1730        case UIActionIndexSelector_Menu_Group_Close:
    16901731        case UIActionIndexSelector_Menu_Machine_Close:
    16911732        {
    16921733            return isAtLeastOneItemStarted(items);
    16931734        }
     1735        case UIActionIndexSelector_Simple_Group_Close_Save:
    16941736        case UIActionIndexSelector_Simple_Machine_Close_Save:
    16951737        {
    16961738            return isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, items);
    16971739        }
     1740        case UIActionIndexSelector_Simple_Group_Close_ACPIShutdown:
    16981741        case UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown:
    16991742        {
     
    17011744                   isAtLeastOneItemAbleToShutdown(items);
    17021745        }
     1746        case UIActionIndexSelector_Simple_Group_Close_PowerOff:
    17031747        case UIActionIndexSelector_Simple_Machine_Close_PowerOff:
    17041748        {
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h

    r42766 r42767  
    100100    void sltShowMachineInFileManager();
    101101    void sltPerformCreateShortcutAction();
     102    void sltGroupCloseMenuAboutToShow();
    102103    void sltMachineCloseMenuAboutToShow();
    103104
     
    130131    void prepareMenuGroup(QMenu *pMenu);
    131132    void prepareMenuMachine(QMenu *pMenu);
     133    void prepareMenuGroupClose(QMenu *pMenu);
    132134    void prepareMenuMachineClose(QMenu *pMenu);
    133135    void prepareMenuHelp(QMenu *pMenu);
     
    212214    UIAction *m_pAction_Group_Remove;
    213215    UIAction *m_pAction_Group_Sort;
     216    /* 'Group / Close' menu action pointers: */
     217    UIAction *m_pGroupCloseMenuAction;
     218    QMenu *m_pGroupCloseMenu;
     219    UIAction *m_pGroupSaveAction;
     220    UIAction *m_pGroupACPIShutdownAction;
     221    UIAction *m_pGroupPowerOffAction;
    214222
    215223    /* 'Machine' menu action pointers: */
     
    221229    UIAction *m_pAction_Machine_Remove;
    222230    UIAction *m_pAction_Machine_AddGroup;
    223 
    224231    /* 'Machine / Close' menu action pointers: */
    225232    UIAction *m_pMachineCloseMenuAction;
    226233    QMenu *m_pMachineCloseMenu;
    227     UIAction *m_pSaveAction;
    228     UIAction *m_pACPIShutdownAction;
    229     UIAction *m_pPowerOffAction;
     234    UIAction *m_pMachineSaveAction;
     235    UIAction *m_pMachineACPIShutdownAction;
     236    UIAction *m_pMachinePowerOffAction;
    230237
    231238    /* 'Help' menu action pointers: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp

    r42760 r42767  
    906906    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Toggle_Common_PauseAndResume));
    907907    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_Reset));
    908     m_pContextMenuGroup->addMenu(gActionPool->action(UIActionIndexSelector_Menu_Machine_Close)->menu());
     908    m_pContextMenuGroup->addMenu(gActionPool->action(UIActionIndexSelector_Menu_Group_Close)->menu());
    909909    m_pContextMenuGroup->addSeparator();
    910910    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_Discard));
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