VirtualBox

Changeset 75207 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Oct 31, 2018 4:12:27 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9241: Move corresponding functionality from VirtualBox Manager to action pools where this functionality belongs to.

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

Legend:

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

    r75202 r75207  
    25552555#ifndef VBOX_WS_MAC
    25562556    /* 'About' action: */
    2557     fSeparator = addAction(pMenu, action(UIActionIndex_Simple_About)) || fSeparator;;
     2557    fSeparator = addAction(pMenu, action(UIActionIndex_Simple_About)) || fSeparator;
    25582558#endif
    25592559
     
    26152615
    26162616    /* 'Refresh' action: */
    2617     fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_S_Refresh)) || fSeparator;;
     2617    fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_S_Refresh)) || fSeparator;
    26182618}
    26192619
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r75196 r75207  
    520520    QList<UIAction*> actions() const { return m_pool.values(); }
    521521
     522    /** Returns the list of main menus. */
     523    QList<QMenu*> menus() const { return m_mainMenus; }
     524
    522525    /** Returns whether the menu with passed @a type is allowed in menu-bar. */
    523526    bool isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType type) const;
     
    545548    bool processHotKey(const QKeySequence &key);
    546549
     550    /** Defines whether shortcuts of menu actions with specified @a iIndex should be visible. */
     551    virtual void setShortcutsVisible(int iIndex, bool fVisible) { Q_UNUSED(iIndex); Q_UNUSED(fVisible); }
     552
    547553    /** Returns extra-data ID to save keyboard shortcuts under. */
    548554    virtual QString shortcutsExtraDataID() const = 0;
    549 
    550     /** Returns the list of main menus. */
    551     virtual QList<QMenu*> menus() const = 0;
    552555
    553556public slots:
     
    637640    QSet<int>                     m_invalidations;
    638641
     642    /** Holds the list of main menus. */
     643    QList<QMenu*>  m_mainMenus;
     644
    639645    /** Holds restricted menu types. */
    640646    QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::MenuType>                   m_restrictedMenus;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.h

    r75087 r75207  
    2727#include "UIExtraDataDefs.h"
    2828#include "UILibraryDefs.h"
    29 
    30 /* Forward declarations: */
    31 class QSize;
    3229
    3330
     
    286283    virtual QString shortcutsExtraDataID() const /* override */;
    287284
    288     /** Returns the list of Runtime UI main menus. */
    289     virtual QList<QMenu*> menus() const /* override */ { return m_mainMenus; }
    290 
    291285private:
    292286
     
    306300    /** Holds the host-to-guest mapping scheme. */
    307301    QMap<int, int>  m_mapHostScreenForGuestScreen;
    308 
    309     /** Holds the list of Runtime UI main menus. */
    310     QList<QMenu*>  m_mainMenus;
    311302
    312303    /** Holds restricted action types of the Machine menu. */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.cpp

    r75198 r75207  
    2121
    2222/* GUI includes: */
     23# include "VBoxGlobal.h"
    2324# include "UIActionPoolSelector.h"
    24 # include "UIExtraDataDefs.h"
     25# include "UIExtraDataManager.h"
    2526# include "UIIconPool.h"
    2627# include "UIShortcutPool.h"
    2728# include "UIDefs.h"
     29
     30/* COM includes: */
     31# include "CExtPack.h"
     32# include "CExtPackManager.h"
    2833
    2934#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    26172622
    26182623    /* Prepare update-handlers for known menus: */
    2619     m_menuUpdateHandlers[UIActionIndexST_M_MediumWindow].ptfs = &UIActionPoolSelector::updateMenuMediumWindow;
    2620     m_menuUpdateHandlers[UIActionIndexST_M_Medium].ptfs = &UIActionPoolSelector::updateMenuMedium;
    2621     m_menuUpdateHandlers[UIActionIndexST_M_NetworkWindow].ptfs = &UIActionPoolSelector::updateMenuNetworkWindow;
    2622     m_menuUpdateHandlers[UIActionIndexST_M_Network].ptfs = &UIActionPoolSelector::updateMenuNetwork;
    2623     m_menuUpdateHandlers[UIActionIndexST_M_CloudWindow].ptfs = &UIActionPoolSelector::updateMenuCloudWindow;
    2624     m_menuUpdateHandlers[UIActionIndexST_M_Cloud].ptfs = &UIActionPoolSelector::updateMenuCloud;
     2624    m_menuUpdateHandlers[UIActionIndexST_M_File].ptfs =                  &UIActionPoolSelector::updateMenuFile;
     2625    m_menuUpdateHandlers[UIActionIndexST_M_Welcome].ptfs =               &UIActionPoolSelector::updateMenuWelcome;
     2626    m_menuUpdateHandlers[UIActionIndexST_M_Group].ptfs =                 &UIActionPoolSelector::updateMenuGroup;
     2627    m_menuUpdateHandlers[UIActionIndexST_M_Machine].ptfs =               &UIActionPoolSelector::updateMenuMachine;
     2628    m_menuUpdateHandlers[UIActionIndexST_M_Group_M_StartOrShow].ptfs =   &UIActionPoolSelector::updateMenuGroupStartOrShow;
     2629    m_menuUpdateHandlers[UIActionIndexST_M_Machine_M_StartOrShow].ptfs = &UIActionPoolSelector::updateMenuMachineStartOrShow;
     2630    m_menuUpdateHandlers[UIActionIndexST_M_Group_M_Close].ptfs =         &UIActionPoolSelector::updateMenuGroupClose;
     2631    m_menuUpdateHandlers[UIActionIndexST_M_Machine_M_Close].ptfs =       &UIActionPoolSelector::updateMenuMachineClose;
     2632    m_menuUpdateHandlers[UIActionIndexST_M_MediumWindow].ptfs =          &UIActionPoolSelector::updateMenuMediumWindow;
     2633    m_menuUpdateHandlers[UIActionIndexST_M_Medium].ptfs =                &UIActionPoolSelector::updateMenuMedium;
     2634    m_menuUpdateHandlers[UIActionIndexST_M_NetworkWindow].ptfs =         &UIActionPoolSelector::updateMenuNetworkWindow;
     2635    m_menuUpdateHandlers[UIActionIndexST_M_Network].ptfs =               &UIActionPoolSelector::updateMenuNetwork;
     2636    m_menuUpdateHandlers[UIActionIndexST_M_CloudWindow].ptfs =           &UIActionPoolSelector::updateMenuCloudWindow;
     2637    m_menuUpdateHandlers[UIActionIndexST_M_Cloud].ptfs =                 &UIActionPoolSelector::updateMenuCloud;
     2638    m_menuUpdateHandlers[UIActionIndexST_M_Snapshot].ptfs =              &UIActionPoolSelector::updateMenuSnapshot;
    26252639
    26262640    /* Call to base-class: */
     
    26382652}
    26392653
     2654void UIActionPoolSelector::updateMenu(int iIndex)
     2655{
     2656    /* If index belongs to base-class => delegate to base-class: */
     2657    if (iIndex < UIActionIndex_Max)
     2658        UIActionPool::updateMenu(iIndex);
     2659    /* Otherwise,
     2660     * if menu with such index is invalidated
     2661     * and there is update-handler => handle it here: */
     2662    else if (   iIndex > UIActionIndex_Max
     2663             && m_invalidations.contains(iIndex)
     2664             && m_menuUpdateHandlers.contains(iIndex))
     2665             (this->*(m_menuUpdateHandlers.value(iIndex).ptfs))();
     2666}
     2667
    26402668void UIActionPoolSelector::updateMenus()
    26412669{
    2642     /* 'Help' menu: */
    2643     updateMenuHelp();
    2644 
    2645     /* 'Log Viewer' menu: */
    2646     updateMenuLogViewerWindow();
    2647     updateMenuLogViewer();
     2670    /* Clear menu list: */
     2671    m_mainMenus.clear();
     2672
     2673    /* 'File' menu: */
     2674    addMenu(m_mainMenus, action(UIActionIndexST_M_File));
     2675    updateMenuFile();
     2676
     2677    /* 'Welcome' menu: */
     2678    addMenu(m_mainMenus, action(UIActionIndexST_M_Welcome));
     2679    updateMenuWelcome();
     2680    /* 'Group' menu: */
     2681    addMenu(m_mainMenus, action(UIActionIndexST_M_Group));
     2682    updateMenuGroup();
     2683    /* 'Machine' menu: */
     2684    addMenu(m_mainMenus, action(UIActionIndexST_M_Machine));
     2685    updateMenuMachine();
     2686
     2687    /* 'Group' / 'Start or Show' menu: */
     2688    updateMenuGroupStartOrShow();
     2689    /* 'Machine' / 'Start or Show' menu: */
     2690    updateMenuMachineStartOrShow();
     2691    /* 'Group' / 'Close' menu: */
     2692    updateMenuGroupClose();
     2693    /* 'Machine' / 'Close' menu: */
     2694    updateMenuMachineClose();
    26482695
    26492696    /* 'Virtual Media Manager' menu: */
     2697    addMenu(m_mainMenus, action(UIActionIndexST_M_Medium));
    26502698    updateMenuMediumWindow();
    26512699    updateMenuMedium();
    26522700    /* 'Host Network Manager' menu: */
     2701    addMenu(m_mainMenus, action(UIActionIndexST_M_Network));
    26532702    updateMenuNetworkWindow();
    26542703    updateMenuNetwork();
    26552704    /* 'Cloud Profile Manager' menu: */
     2705    addMenu(m_mainMenus, action(UIActionIndexST_M_Cloud));
    26562706    updateMenuCloudWindow();
    26572707    updateMenuCloud();
     2708
     2709    /* 'Snapshot' menu: */
     2710    addMenu(m_mainMenus, action(UIActionIndexST_M_Snapshot));
     2711    updateMenuSnapshot();
     2712    /* 'Log' menu: */
     2713    addMenu(m_mainMenus, action(UIActionIndex_M_Log));
     2714    updateMenuLogViewerWindow();
     2715    updateMenuLogViewer();
     2716
     2717    /* 'Help' menu: */
     2718    addMenu(m_mainMenus, action(UIActionIndex_Menu_Help));
     2719    updateMenuHelp();
     2720}
     2721
     2722void UIActionPoolSelector::updateMenuFile()
     2723{
     2724    /* Get corresponding menu: */
     2725    UIMenu *pMenu = action(UIActionIndexST_M_File)->menu();
     2726    AssertPtrReturnVoid(pMenu);
     2727    /* Clear contents: */
     2728    pMenu->clear();
     2729
     2730    /* Check if Ext Pack is ready, some of actions my depend on it: */
     2731    CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName);
     2732    const bool fExtPackAccessible = !extPack.isNull() && extPack.GetUsable();
     2733
     2734    /* The Application / 'File' menu contents is very different depending on host type. */
     2735
     2736#ifdef VBOX_WS_MAC
     2737
     2738    /* 'About' action goes to Application menu: */
     2739    pMenu->addAction(action(UIActionIndex_M_Application_S_About));
     2740# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
     2741    /* 'Check for Updates' action goes to Application menu: */
     2742    if (gEDataManager->applicationUpdateEnabled())
     2743        pMenu->addAction(action(UIActionIndex_M_Application_S_CheckForUpdates));
     2744    /* 'Network Access Manager' action goes to Application menu: */
     2745    pMenu->addAction(action(UIActionIndex_M_Application_S_NetworkAccessManager));
     2746# endif
     2747    /* 'Reset Warnings' action goes to Application menu: */
     2748    pMenu->addAction(action(UIActionIndex_M_Application_S_ResetWarnings));
     2749    /* 'Preferences' action goes to Application menu: */
     2750    pMenu->addAction(action(UIActionIndex_M_Application_S_Preferences));
     2751    /* 'Close' action goes to Application menu: */
     2752    pMenu->addAction(action(UIActionIndexST_M_File_S_Close));
     2753
     2754    /* 'Import Appliance' action goes to 'File' menu: */
     2755    pMenu->addAction(action(UIActionIndexST_M_File_S_ImportAppliance));
     2756    /* 'Export Appliance' action goes to 'File' menu: */
     2757    pMenu->addAction(action(UIActionIndexST_M_File_S_ExportAppliance));
     2758# ifdef VBOX_GUI_WITH_EXTRADATA_MANAGER_UI
     2759    /* 'Show Extra-data Manager' action goes to 'File' menu for Debug build: */
     2760    pMenu->addAction(action(UIActionIndexST_M_File_S_ShowExtraDataManager));
     2761# endif
     2762    /* 'Show Virtual Medium Manager' action goes to 'File' menu: */
     2763    pMenu->addAction(action(UIActionIndexST_M_File_S_ShowVirtualMediumManager));
     2764    /* 'Show Host Network Manager' action goes to 'File' menu: */
     2765    pMenu->addAction(action(UIActionIndexST_M_File_S_ShowHostNetworkManager));
     2766    /* 'Show Cloud Profile Manager' action goes to 'File' menu: */
     2767    if (fExtPackAccessible)
     2768        pMenu->addAction(action(UIActionIndexST_M_File_S_ShowCloudProfileManager));
     2769
     2770#else /* !VBOX_WS_MAC */
     2771
     2772    /* 'Preferences' action goes to 'File' menu: */
     2773    pMenu->addAction(action(UIActionIndex_M_Application_S_Preferences));
     2774    /* Separator after 'Preferences' action of the 'File' menu: */
     2775    pMenu->addSeparator();
     2776    /* 'Import Appliance' action goes to 'File' menu: */
     2777    pMenu->addAction(action(UIActionIndexST_M_File_S_ImportAppliance));
     2778    /* 'Export Appliance' action goes to 'File' menu: */
     2779    pMenu->addAction(action(UIActionIndexST_M_File_S_ExportAppliance));
     2780    /* Separator after 'Export Appliance' action of the 'File' menu: */
     2781    pMenu->addSeparator();
     2782# ifdef VBOX_GUI_WITH_EXTRADATA_MANAGER_UI
     2783    /* 'Extra-data Manager' action goes to 'File' menu for Debug build: */
     2784    pMenu->addAction(action(UIActionIndexST_M_File_S_ShowExtraDataManager));
     2785# endif
     2786    /* 'Show Virtual Medium Manager' action goes to 'File' menu: */
     2787    pMenu->addAction(action(UIActionIndexST_M_File_S_ShowVirtualMediumManager));
     2788    /* 'Show Host Network Manager' action goes to 'File' menu: */
     2789    pMenu->addAction(action(UIActionIndexST_M_File_S_ShowHostNetworkManager));
     2790    /* 'Show Cloud Profile Manager' action goes to 'File' menu: */
     2791    if (fExtPackAccessible)
     2792        pMenu->addAction(action(UIActionIndexST_M_File_S_ShowCloudProfileManager));
     2793# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
     2794    /* 'Network Access Manager' action goes to 'File' menu: */
     2795    pMenu->addAction(action(UIActionIndex_M_Application_S_NetworkAccessManager));
     2796    /* 'Check for Updates' action goes to 'File' menu: */
     2797    if (gEDataManager->applicationUpdateEnabled())
     2798        pMenu->addAction(action(UIActionIndex_M_Application_S_CheckForUpdates));
     2799# endif
     2800    /* Separator after tool actions of the 'File' menu: */
     2801    pMenu->addSeparator();
     2802    /* 'Reset Warnings' action goes 'File' menu: */
     2803    pMenu->addAction(action(UIActionIndex_M_Application_S_ResetWarnings));
     2804    /* Separator after 'Reset Warnings' action of the 'File' menu: */
     2805    pMenu->addSeparator();
     2806    /* 'Close' action goes to 'File' menu: */
     2807    pMenu->addAction(action(UIActionIndexST_M_File_S_Close));
     2808
     2809#endif /* !VBOX_WS_MAC */
     2810
     2811    /* Mark menu as valid: */
     2812    m_invalidations.remove(UIActionIndexST_M_File);
     2813}
     2814
     2815void UIActionPoolSelector::updateMenuWelcome()
     2816{
     2817    /* Get corresponding menu: */
     2818    UIMenu *pMenu = action(UIActionIndexST_M_Welcome)->menu();
     2819    AssertPtrReturnVoid(pMenu);
     2820    /* Clear contents: */
     2821    pMenu->clear();
     2822
     2823    /* Populate Welcome menu: */
     2824    pMenu->addAction(action(UIActionIndexST_M_Welcome_S_New));
     2825    pMenu->addAction(action(UIActionIndexST_M_Welcome_S_Add));
     2826
     2827    /* Mark menu as valid: */
     2828    m_invalidations.remove(UIActionIndexST_M_Welcome);
     2829}
     2830
     2831void UIActionPoolSelector::updateMenuGroup()
     2832{
     2833    /* Get corresponding menu: */
     2834    UIMenu *pMenu = action(UIActionIndexST_M_Group)->menu();
     2835    AssertPtrReturnVoid(pMenu);
     2836    /* Clear contents: */
     2837    pMenu->clear();
     2838
     2839    /* Populate Machine-menu: */
     2840    pMenu->addAction(action(UIActionIndexST_M_Group_S_New));
     2841    pMenu->addAction(action(UIActionIndexST_M_Group_S_Add));
     2842    pMenu->addSeparator();
     2843    pMenu->addAction(action(UIActionIndexST_M_Group_S_Rename));
     2844    pMenu->addAction(action(UIActionIndexST_M_Group_S_Remove));
     2845    pMenu->addSeparator();
     2846    pMenu->addAction(action(UIActionIndexST_M_Group_M_StartOrShow));
     2847    pMenu->addAction(action(UIActionIndexST_M_Group_T_Pause));
     2848    pMenu->addAction(action(UIActionIndexST_M_Group_S_Reset));
     2849    pMenu->addMenu(action(UIActionIndexST_M_Group_M_Close)->menu());
     2850    pMenu->addSeparator();
     2851    pMenu->addAction(action(UIActionIndexST_M_Group_S_Discard));
     2852    pMenu->addAction(action(UIActionIndexST_M_Group_S_ShowLogDialog));
     2853    pMenu->addAction(action(UIActionIndexST_M_Group_S_Refresh));
     2854    pMenu->addSeparator();
     2855    pMenu->addAction(action(UIActionIndexST_M_Group_S_ShowInFileManager));
     2856    pMenu->addAction(action(UIActionIndexST_M_Group_S_CreateShortcut));
     2857    pMenu->addSeparator();
     2858    pMenu->addAction(action(UIActionIndexST_M_Group_S_Sort));
     2859
     2860    /* Mark menu as valid: */
     2861    m_invalidations.remove(UIActionIndexST_M_Group);
     2862}
     2863
     2864void UIActionPoolSelector::updateMenuMachine()
     2865{
     2866    /* Get corresponding menu: */
     2867    UIMenu *pMenu = action(UIActionIndexST_M_Machine)->menu();
     2868    AssertPtrReturnVoid(pMenu);
     2869    /* Clear contents: */
     2870    pMenu->clear();
     2871
     2872    /* Populate Machine-menu: */
     2873    pMenu->addAction(action(UIActionIndexST_M_Machine_S_New));
     2874    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Add));
     2875    pMenu->addSeparator();
     2876    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Settings));
     2877    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Clone));
     2878    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Move));
     2879    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Remove));
     2880    pMenu->addAction(action(UIActionIndexST_M_Machine_S_AddGroup));
     2881    pMenu->addSeparator();
     2882    pMenu->addAction(action(UIActionIndexST_M_Machine_M_StartOrShow));
     2883    pMenu->addAction(action(UIActionIndexST_M_Machine_T_Pause));
     2884    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Reset));
     2885    pMenu->addMenu(action(UIActionIndexST_M_Machine_M_Close)->menu());
     2886    pMenu->addSeparator();
     2887    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Discard));
     2888    pMenu->addAction(action(UIActionIndexST_M_Machine_S_ShowLogDialog));
     2889    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Refresh));
     2890    pMenu->addSeparator();
     2891    pMenu->addAction(action(UIActionIndexST_M_Machine_S_ShowInFileManager));
     2892    pMenu->addAction(action(UIActionIndexST_M_Machine_S_CreateShortcut));
     2893    pMenu->addSeparator();
     2894    pMenu->addAction(action(UIActionIndexST_M_Machine_S_SortParent));
     2895
     2896    /* Mark menu as valid: */
     2897    m_invalidations.remove(UIActionIndexST_M_Machine);
     2898}
     2899
     2900void UIActionPoolSelector::updateMenuGroupStartOrShow()
     2901{
     2902    /* Get corresponding menu: */
     2903    UIMenu *pMenu = action(UIActionIndexST_M_Group_M_StartOrShow)->menu();
     2904    AssertPtrReturnVoid(pMenu);
     2905    /* Clear contents: */
     2906    pMenu->clear();
     2907
     2908    /* Populate 'Group' / 'Start or Show' menu: */
     2909    pMenu->addAction(action(UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal));
     2910    pMenu->addAction(action(UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless));
     2911    pMenu->addAction(action(UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable));
     2912
     2913    /* Mark menu as valid: */
     2914    m_invalidations.remove(UIActionIndexST_M_Group_M_StartOrShow);
     2915}
     2916
     2917void UIActionPoolSelector::updateMenuMachineStartOrShow()
     2918{
     2919    /* Get corresponding menu: */
     2920    UIMenu *pMenu = action(UIActionIndexST_M_Machine_M_StartOrShow)->menu();
     2921    AssertPtrReturnVoid(pMenu);
     2922    /* Clear contents: */
     2923    pMenu->clear();
     2924
     2925    /* Populate 'Machine' / 'Start or Show' menu: */
     2926    pMenu->addAction(action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal));
     2927    pMenu->addAction(action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless));
     2928    pMenu->addAction(action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable));
     2929
     2930    /* Mark menu as valid: */
     2931    m_invalidations.remove(UIActionIndexST_M_Machine_M_StartOrShow);
     2932}
     2933
     2934void UIActionPoolSelector::updateMenuGroupClose()
     2935{
     2936    /* Get corresponding menu: */
     2937    UIMenu *pMenu = action(UIActionIndexST_M_Group_M_Close)->menu();
     2938    AssertPtrReturnVoid(pMenu);
     2939    /* Clear contents: */
     2940    pMenu->clear();
     2941
     2942    /* Populate 'Group' / 'Close' menu: */
     2943    // pMenu->addAction(action(UIActionIndexST_M_Group_M_Close_S_Detach));
     2944    pMenu->addAction(action(UIActionIndexST_M_Group_M_Close_S_SaveState));
     2945    pMenu->addAction(action(UIActionIndexST_M_Group_M_Close_S_Shutdown));
     2946    pMenu->addAction(action(UIActionIndexST_M_Group_M_Close_S_PowerOff));
     2947
     2948    /* Mark menu as valid: */
     2949    m_invalidations.remove(UIActionIndexST_M_Group_M_Close);
     2950}
     2951
     2952void UIActionPoolSelector::updateMenuMachineClose()
     2953{
     2954    /* Get corresponding menu: */
     2955    UIMenu *pMenu = action(UIActionIndexST_M_Machine_M_Close)->menu();
     2956    AssertPtrReturnVoid(pMenu);
     2957    /* Clear contents: */
     2958    pMenu->clear();
     2959
     2960    /* Populate 'Machine' / 'Close' menu: */
     2961    // pMenu->addAction(action(UIActionIndexST_M_Machine_M_Close_S_Detach));
     2962    pMenu->addAction(action(UIActionIndexST_M_Machine_M_Close_S_SaveState));
     2963    pMenu->addAction(action(UIActionIndexST_M_Machine_M_Close_S_Shutdown));
     2964    pMenu->addAction(action(UIActionIndexST_M_Machine_M_Close_S_PowerOff));
     2965
     2966    /* Mark menu as valid: */
     2967    m_invalidations.remove(UIActionIndexST_M_Machine_M_Close);
    26582968}
    26592969
     
    28223132}
    28233133
     3134void UIActionPoolSelector::updateMenuSnapshot()
     3135{
     3136    /* Get corresponding menu: */
     3137    UIMenu *pMenu = action(UIActionIndexST_M_Snapshot)->menu();
     3138    AssertPtrReturnVoid(pMenu);
     3139    /* Clear contents: */
     3140    pMenu->clear();
     3141
     3142    /* Populate Snapshot-menu: */
     3143    pMenu->addAction(action(UIActionIndexST_M_Snapshot_S_Take));
     3144    pMenu->addAction(action(UIActionIndexST_M_Snapshot_S_Delete));
     3145    pMenu->addAction(action(UIActionIndexST_M_Snapshot_S_Restore));
     3146    pMenu->addAction(action(UIActionIndexST_M_Snapshot_T_Properties));
     3147    pMenu->addAction(action(UIActionIndexST_M_Snapshot_S_Clone));
     3148
     3149    /* Mark menu as valid: */
     3150    m_invalidations.remove(UIActionIndexST_M_Snapshot);
     3151}
     3152
    28243153void UIActionPoolSelector::updateShortcuts()
    28253154{
     
    28313160}
    28323161
     3162void UIActionPoolSelector::setShortcutsVisible(int iIndex, bool fVisible)
     3163{
     3164    /* Prepare a list of actions: */
     3165    QList<UIAction*> actions;
     3166
     3167    /* Handle known menus: */
     3168    switch (iIndex)
     3169    {
     3170        case UIActionIndexST_M_Welcome:
     3171        {
     3172            actions << action(UIActionIndexST_M_Welcome_S_New)
     3173                    << action(UIActionIndexST_M_Welcome_S_Add);
     3174            break;
     3175        }
     3176        case UIActionIndexST_M_Group:
     3177        {
     3178            actions << action(UIActionIndexST_M_Group_S_New)
     3179                    << action(UIActionIndexST_M_Group_S_Add)
     3180                    << action(UIActionIndexST_M_Group_S_Rename)
     3181                    << action(UIActionIndexST_M_Group_S_Remove)
     3182                    << action(UIActionIndexST_M_Group_M_StartOrShow)
     3183                    << action(UIActionIndexST_M_Group_T_Pause)
     3184                    << action(UIActionIndexST_M_Group_S_Reset)
     3185                    << action(UIActionIndexST_M_Group_S_Discard)
     3186                    << action(UIActionIndexST_M_Group_S_ShowLogDialog)
     3187                    << action(UIActionIndexST_M_Group_S_Refresh)
     3188                    << action(UIActionIndexST_M_Group_S_ShowInFileManager)
     3189                    << action(UIActionIndexST_M_Group_S_CreateShortcut)
     3190                    << action(UIActionIndexST_M_Group_S_Sort)
     3191                    << action(UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal)
     3192                    << action(UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless)
     3193                    << action(UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable)
     3194                    // << action(UIActionIndexST_M_Group_M_Close_S_Detach)
     3195                    << action(UIActionIndexST_M_Group_M_Close_S_SaveState)
     3196                    << action(UIActionIndexST_M_Group_M_Close_S_Shutdown)
     3197                    << action(UIActionIndexST_M_Group_M_Close_S_PowerOff);
     3198            break;
     3199        }
     3200        case UIActionIndexST_M_Machine:
     3201        {
     3202
     3203            actions << action(UIActionIndexST_M_Machine_S_New)
     3204                    << action(UIActionIndexST_M_Machine_S_Add)
     3205                    << action(UIActionIndexST_M_Machine_S_Settings)
     3206                    << action(UIActionIndexST_M_Machine_S_Clone)
     3207                    << action(UIActionIndexST_M_Machine_S_Move)
     3208                    << action(UIActionIndexST_M_Machine_S_Remove)
     3209                    << action(UIActionIndexST_M_Machine_S_AddGroup)
     3210                    << action(UIActionIndexST_M_Machine_M_StartOrShow)
     3211                    << action(UIActionIndexST_M_Machine_T_Pause)
     3212                    << action(UIActionIndexST_M_Machine_S_Reset)
     3213                    << action(UIActionIndexST_M_Machine_S_Discard)
     3214                    << action(UIActionIndexST_M_Machine_S_ShowLogDialog)
     3215                    << action(UIActionIndexST_M_Machine_S_Refresh)
     3216                    << action(UIActionIndexST_M_Machine_S_ShowInFileManager)
     3217                    << action(UIActionIndexST_M_Machine_S_CreateShortcut)
     3218                    << action(UIActionIndexST_M_Machine_S_SortParent)
     3219                    << action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal)
     3220                    << action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless)
     3221                    << action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable)
     3222                    // << action(UIActionIndexST_M_Machine_M_Close_S_Detach)
     3223                    << action(UIActionIndexST_M_Machine_M_Close_S_SaveState)
     3224                    << action(UIActionIndexST_M_Machine_M_Close_S_Shutdown)
     3225                    << action(UIActionIndexST_M_Machine_M_Close_S_PowerOff);
     3226            break;
     3227        }
     3228        default:
     3229            break;
     3230    }
     3231
     3232    /* Update shortcut visibility: */
     3233    foreach (UIAction *pAction, actions)
     3234        fVisible ? pAction->showShortcut() : pAction->hideShortcut();
     3235}
     3236
    28333237QString UIActionPoolSelector::shortcutsExtraDataID() const
    28343238{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.h

    r75198 r75207  
    1818#ifndef ___UIActionPoolSelector_h___
    1919#define ___UIActionPoolSelector_h___
     20
     21/* Qt includes: */
     22#include <QList>
    2023
    2124/* GUI includes: */
     
    172175    virtual void prepareConnections() /* override */;
    173176
     177    /** Updates menu. */
     178    virtual void updateMenu(int iIndex) /* override */;
    174179    /** Updates menus. */
    175180    virtual void updateMenus() /* override */;
     181
     182    /** Updates 'File' menu. */
     183    void updateMenuFile();
     184    /** Updates 'Welcome' menu. */
     185    void updateMenuWelcome();
     186    /** Updates 'Group' menu. */
     187    void updateMenuGroup();
     188    /** Updates 'Machine' menu. */
     189    void updateMenuMachine();
     190    /** Updates 'Group' / 'Start or Show' menu. */
     191    void updateMenuGroupStartOrShow();
     192    /** Updates 'Machine' / 'Start or Show' menu. */
     193    void updateMenuMachineStartOrShow();
     194    /** Updates 'Group' / 'Close' menu. */
     195    void updateMenuGroupClose();
     196    /** Updates 'Machine' / 'Close' menu. */
     197    void updateMenuMachineClose();
    176198
    177199    /** Updates 'Medium' window menu. */
     
    196218    void updateMenuCloudWrapper(UIMenu *pMenu);
    197219
     220    /** Updates 'Snapshot' menu. */
     221    void updateMenuSnapshot();
     222
    198223    /** Updates shortcuts. */
    199224    virtual void updateShortcuts() /* override */;
    200225
     226    /** Defines whether shortcuts of menu actions with specified @a iIndex should be visible. */
     227    virtual void setShortcutsVisible(int iIndex, bool fVisible) /* override */;
     228
    201229    /** Returns extra-data ID to save keyboard shortcuts under. */
    202230    virtual QString shortcutsExtraDataID() const /* override */;
    203 
    204     /** Returns the list of Selector UI main menus. */
    205     virtual QList<QMenu*> menus() const /* override */ { return QList<QMenu*>(); }
    206231
    207232private:
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r75197 r75207  
    6363
    6464/* COM includes: */
    65 # include "CExtPack.h"
    66 # include "CExtPackManager.h"
    6765# include "CSystemProperties.h"
    6866
     
    114112    , m_fFirstMediumEnumerationHandled(false)
    115113    , m_pActionPool(0)
    116     , m_pWelcomeMenuAction(0)
    117     , m_pGroupMenuAction(0)
    118     , m_pMachineMenuAction(0)
    119     , m_pSnapshotMenuAction(0)
    120     , m_pLogViewerMenuAction(0)
    121     , m_pVirtualMediaManagerMenuAction(0)
    122     , m_pHostNetworkManagerMenuAction(0)
    123     , m_pCloudProfileManagerMenuAction(0)
    124114    , m_pManagerVirtualMedia(0)
    125115    , m_pManagerHostNetwork(0)
     
    12701260    /* Create menu-bar: */
    12711261    setMenuBar(new UIMenuBar);
    1272 
    1273     /* Make sure menu-bar fills own solid background: */
    1274     menuBar()->setAutoFillBackground(true);
    1275     QPalette pal = menuBar()->palette();
    1276     const QColor color = pal.color(QPalette::Active, QPalette::Mid).lighter(160);
    1277     pal.setColor(QPalette::Active, QPalette::Button, color);
    1278     menuBar()->setPalette(pal);
     1262    if (menuBar())
     1263    {
     1264        /* Make sure menu-bar fills own solid background: */
     1265        menuBar()->setAutoFillBackground(true);
     1266        QPalette pal = menuBar()->palette();
     1267        const QColor color = pal.color(QPalette::Active, QPalette::Mid).lighter(160);
     1268        pal.setColor(QPalette::Active, QPalette::Button, color);
     1269        menuBar()->setPalette(pal);
     1270    }
    12791271#endif
    12801272
     
    12821274    m_pActionPool = UIActionPool::create(UIActionPoolType_Selector);
    12831275
    1284     /* Prepare File-menu: */
    1285     prepareMenuFile(actionPool()->action(UIActionIndexST_M_File)->menu());
    1286     menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_File)->menu());
    1287 
    1288     /* Prepare 'Welcome' menu: */
    1289     prepareMenuWelcome(actionPool()->action(UIActionIndexST_M_Welcome)->menu());
    1290     m_pWelcomeMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Welcome)->menu());
    1291 
    1292     /* Prepare 'Group' / 'Start or Show' menu: */
    1293     prepareMenuGroupStartOrShow(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow)->menu());
    1294 
    1295     /* Prepare 'Machine' / 'Start or Show' menu: */
    1296     prepareMenuMachineStartOrShow(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow)->menu());
    1297 
    1298     /* Prepare 'Group' / 'Close' menu: */
    1299     prepareMenuGroupClose(actionPool()->action(UIActionIndexST_M_Group_M_Close)->menu());
    1300 
    1301     /* Prepare 'Machine' / 'Close' menu: */
    1302     prepareMenuMachineClose(actionPool()->action(UIActionIndexST_M_Machine_M_Close)->menu());
    1303 
    1304     /* Prepare 'Group' menu: */
    1305     prepareMenuGroup(actionPool()->action(UIActionIndexST_M_Group)->menu());
    1306     m_pGroupMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Group)->menu());
    1307 
    1308     /* Prepare 'Machine' menu: */
    1309     prepareMenuMachine(actionPool()->action(UIActionIndexST_M_Machine)->menu());
    1310     m_pMachineMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Machine)->menu());
    1311 
    1312     /* Prepare 'Snapshot' menu: */
    1313     prepareMenuSnapshot(actionPool()->action(UIActionIndexST_M_Snapshot)->menu());
    1314     m_pSnapshotMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Snapshot)->menu());
    1315 
    1316     /* Prepare 'Log Viewer' menu: */
    1317     prepareMenuLogViewer(actionPool()->action(UIActionIndex_M_Log)->menu());
    1318     m_pLogViewerMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndex_M_Log)->menu());
    1319 
    1320     /* Prepare 'Medium' menu: */
    1321     prepareMenuMedium(actionPool()->action(UIActionIndexST_M_Medium)->menu());
    1322     m_pVirtualMediaManagerMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Medium)->menu());
    1323 
    1324     /* Prepare 'Network' menu: */
    1325     prepareMenuNetwork(actionPool()->action(UIActionIndexST_M_Network)->menu());
    1326     m_pHostNetworkManagerMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Network)->menu());
    1327 
    1328     /* Prepare 'Cloud' menu: */
    1329     prepareMenuCloud(actionPool()->action(UIActionIndexST_M_Cloud)->menu());
    1330     m_pCloudProfileManagerMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Cloud)->menu());
    1331 
     1276    /* Build menu-bar: */
     1277    foreach (QMenu *pMenu, actionPool()->menus())
     1278    {
    13321279#ifdef VBOX_WS_MAC
    1333     /* Prepare 'Window' menu: */
    1334     UIWindowMenuManager::create();
    1335     menuBar()->addMenu(gpWindowMenuManager->createMenu(this));
    1336     gpWindowMenuManager->addWindow(this);
     1280        /* Before 'Help' menu we should: */
     1281        if (pMenu == actionPool()->action(UIActionIndex_Menu_Help)->menu())
     1282        {
     1283            /* Insert 'Window' menu: */
     1284            UIWindowMenuManager::create();
     1285            menuBar()->addMenu(gpWindowMenuManager->createMenu(this));
     1286            gpWindowMenuManager->addWindow(this);
     1287        }
    13371288#endif
    1338 
    1339     /* Prepare 'Help' menu: */
    1340     menuBar()->addMenu(actionPool()->action(UIActionIndex_Menu_Help)->menu());
    1341 
    1342     /* Setup menubar policy: */
     1289        menuBar()->addMenu(pMenu);
     1290    }
     1291
     1292    /* Setup menu-bar policy: */
    13431293    menuBar()->setContextMenuPolicy(Qt::CustomContextMenu);
    1344 }
    1345 
    1346 void UIVirtualBoxManager::prepareMenuFile(QMenu *pMenu)
    1347 {
    1348     /* Do not touch if filled already: */
    1349     if (!pMenu->isEmpty())
    1350         return;
    1351 
    1352     /* Check if Ext Pack is ready, some of actions my depend on it: */
    1353     CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName);
    1354     const bool fExtPackAccessible = !extPack.isNull() && extPack.GetUsable();
    1355 
    1356     /* The Application / 'File' menu contents is very different depending on host type. */
    1357 
    1358 #ifdef VBOX_WS_MAC
    1359 
    1360     /* 'About' action goes to Application menu: */
    1361     pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_About));
    1362 # ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    1363     /* 'Check for Updates' action goes to Application menu: */
    1364     if (gEDataManager->applicationUpdateEnabled())
    1365         pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_CheckForUpdates));
    1366     /* 'Network Access Manager' action goes to Application menu: */
    1367     pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_NetworkAccessManager));
    1368 # endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    1369     /* 'Reset Warnings' action goes to Application menu: */
    1370     pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_ResetWarnings));
    1371     /* 'Preferences' action goes to Application menu: */
    1372     pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_Preferences));
    1373     /* 'Close' action goes to Application menu: */
    1374     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_Close));
    1375 
    1376     /* 'Import Appliance' action goes to 'File' menu: */
    1377     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ImportAppliance));
    1378     /* 'Export Appliance' action goes to 'File' menu: */
    1379     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ExportAppliance));
    1380 # ifdef VBOX_GUI_WITH_EXTRADATA_MANAGER_UI
    1381     /* 'Show Extra-data Manager' action goes to 'File' menu for Debug build: */
    1382     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowExtraDataManager));
    1383 # endif /* VBOX_GUI_WITH_EXTRADATA_MANAGER_UI */
    1384     /* 'Show Virtual Medium Manager' action goes to 'File' menu: */
    1385     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowVirtualMediumManager));
    1386     /* 'Show Host Network Manager' action goes to 'File' menu: */
    1387     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowHostNetworkManager));
    1388     /* 'Show Cloud Profile Manager' action goes to 'File' menu: */
    1389     if (fExtPackAccessible)
    1390         pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowCloudProfileManager));
    1391 
    1392 #else /* !VBOX_WS_MAC */
    1393 
    1394 # ifdef VBOX_WS_X11
    1395     // WORKAROUND:
    1396     // There is an issue under Ubuntu which uses special kind of QPA
    1397     // plugin (appmenu-qt5) which redirects actions added to Qt menu-bar
    1398     // directly to Ubuntu Application menu-bar. In that case action
    1399     // shortcuts are not being handled by the Qt and that way ignored.
    1400     // As a workaround we can add those actions into QMainWindow as well.
    1401     addAction(actionPool()->action(UIActionIndex_M_Application_S_Preferences));
    1402     addAction(actionPool()->action(UIActionIndexST_M_File_S_ImportAppliance));
    1403     addAction(actionPool()->action(UIActionIndexST_M_File_S_ExportAppliance));
    1404 #  ifdef VBOX_GUI_WITH_EXTRADATA_MANAGER_UI
    1405     addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowExtraDataManager));
    1406 #  endif /* VBOX_GUI_WITH_EXTRADATA_MANAGER_UI */
    1407     addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowVirtualMediumManager));
    1408     addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowHostNetworkManager));
    1409     if (fExtPackAccessible)
    1410         addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowCloudProfileManager));
    1411 #  ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    1412     addAction(actionPool()->action(UIActionIndex_M_Application_S_NetworkAccessManager));
    1413     addAction(actionPool()->action(UIActionIndex_M_Application_S_CheckForUpdates));
    1414 #  endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    1415     addAction(actionPool()->action(UIActionIndex_M_Application_S_ResetWarnings));
    1416     addAction(actionPool()->action(UIActionIndexST_M_File_S_Close));
    1417 # endif /* VBOX_WS_X11 */
    1418 
    1419     /* 'Preferences' action goes to 'File' menu: */
    1420     pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_Preferences));
    1421     /* Separator after 'Preferences' action of the 'File' menu: */
    1422     pMenu->addSeparator();
    1423     /* 'Import Appliance' action goes to 'File' menu: */
    1424     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ImportAppliance));
    1425     /* 'Export Appliance' action goes to 'File' menu: */
    1426     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ExportAppliance));
    1427     /* Separator after 'Export Appliance' action of the 'File' menu: */
    1428     pMenu->addSeparator();
    1429 # ifdef VBOX_GUI_WITH_EXTRADATA_MANAGER_UI
    1430     /* 'Extra-data Manager' action goes to 'File' menu for Debug build: */
    1431     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowExtraDataManager));
    1432 # endif /* VBOX_GUI_WITH_EXTRADATA_MANAGER_UI */
    1433     /* 'Show Virtual Medium Manager' action goes to 'File' menu: */
    1434     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowVirtualMediumManager));
    1435     /* 'Show Host Network Manager' action goes to 'File' menu: */
    1436     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowHostNetworkManager));
    1437     /* 'Show Cloud Profile Manager' action goes to 'File' menu: */
    1438     if (fExtPackAccessible)
    1439         pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowCloudProfileManager));
    1440 # ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    1441     /* 'Network Access Manager' action goes to 'File' menu: */
    1442     pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_NetworkAccessManager));
    1443     /* 'Check for Updates' action goes to 'File' menu: */
    1444     if (gEDataManager->applicationUpdateEnabled())
    1445         pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_CheckForUpdates));
    1446 # endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    1447     /* Separator after tool actions of the 'File' menu: */
    1448     pMenu->addSeparator();
    1449     /* 'Reset Warnings' action goes 'File' menu: */
    1450     pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_ResetWarnings));
    1451     /* Separator after 'Reset Warnings' action of the 'File' menu: */
    1452     pMenu->addSeparator();
    1453     /* 'Close' action goes to 'File' menu: */
    1454     pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_Close));
    1455 
    1456 #endif /* !VBOX_WS_MAC */
    1457 }
    1458 
    1459 void UIVirtualBoxManager::prepareMenuWelcome(QMenu *pMenu)
    1460 {
    1461 #ifdef VBOX_WS_X11
    1462     // WORKAROUND:
    1463     // There is an issue under Ubuntu which uses special kind of QPA
    1464     // plugin (appmenu-qt5) which redirects actions added to Qt menu-bar
    1465     // directly to Ubuntu Application menu-bar. In that case action
    1466     // shortcuts are not being handled by the Qt and that way ignored.
    1467     // As a workaround we can add those actions into QMainWindow as well.
    1468     addAction(actionPool()->action(UIActionIndexST_M_Welcome_S_New));
    1469     addAction(actionPool()->action(UIActionIndexST_M_Welcome_S_Add));
    1470 #endif /* VBOX_WS_X11 */
    1471 
    1472     /* Populate Machine-menu: */
    1473     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Welcome_S_New));
    1474     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Welcome_S_Add));
    1475 
    1476     /* Remember action list: */
    1477     m_welcomeActions << actionPool()->action(UIActionIndexST_M_Welcome_S_New)
    1478                      << actionPool()->action(UIActionIndexST_M_Welcome_S_Add);
    1479 }
    1480 
    1481 void UIVirtualBoxManager::prepareMenuGroup(QMenu *pMenu)
    1482 {
    1483     /* Do not touch if filled already: */
    1484     if (!pMenu->isEmpty())
    1485         return;
    1486 
    1487 #ifdef VBOX_WS_X11
    1488     // WORKAROUND:
    1489     // There is an issue under Ubuntu which uses special kind of QPA
    1490     // plugin (appmenu-qt5) which redirects actions added to Qt menu-bar
    1491     // directly to Ubuntu Application menu-bar. In that case action
    1492     // shortcuts are not being handled by the Qt and that way ignored.
    1493     // As a workaround we can add those actions into QMainWindow as well.
    1494     addAction(actionPool()->action(UIActionIndexST_M_Group_S_New));
    1495     addAction(actionPool()->action(UIActionIndexST_M_Group_S_Add));
    1496     addAction(actionPool()->action(UIActionIndexST_M_Group_S_Rename));
    1497     addAction(actionPool()->action(UIActionIndexST_M_Group_S_Remove));
    1498     addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow));
    1499     addAction(actionPool()->action(UIActionIndexST_M_Group_T_Pause));
    1500     addAction(actionPool()->action(UIActionIndexST_M_Group_S_Reset));
    1501     addAction(actionPool()->action(UIActionIndexST_M_Group_S_Discard));
    1502     addAction(actionPool()->action(UIActionIndexST_M_Group_S_ShowLogDialog));
    1503     addAction(actionPool()->action(UIActionIndexST_M_Group_S_Refresh));
    1504     addAction(actionPool()->action(UIActionIndexST_M_Group_S_ShowInFileManager));
    1505     addAction(actionPool()->action(UIActionIndexST_M_Group_S_CreateShortcut));
    1506     addAction(actionPool()->action(UIActionIndexST_M_Group_S_Sort));
    1507 #endif /* VBOX_WS_X11 */
    1508 
    1509     /* Populate Machine-menu: */
    1510     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_New));
    1511     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Add));
    1512     pMenu->addSeparator();
    1513     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Rename));
    1514     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Remove));
    1515     pMenu->addSeparator();
    1516     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow));
    1517     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_T_Pause));
    1518     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Reset));
    1519     pMenu->addMenu(actionPool()->action(UIActionIndexST_M_Group_M_Close)->menu());
    1520     pMenu->addSeparator();
    1521     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Discard));
    1522     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_ShowLogDialog));
    1523     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Refresh));
    1524     pMenu->addSeparator();
    1525     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_ShowInFileManager));
    1526     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_CreateShortcut));
    1527     pMenu->addSeparator();
    1528     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Sort));
    1529 
    1530     /* Remember action list: */
    1531     m_groupActions << actionPool()->action(UIActionIndexST_M_Group_S_New)
    1532                    << actionPool()->action(UIActionIndexST_M_Group_S_Add)
    1533                    << actionPool()->action(UIActionIndexST_M_Group_S_Rename)
    1534                    << actionPool()->action(UIActionIndexST_M_Group_S_Remove)
    1535                    << actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow)
    1536                    << actionPool()->action(UIActionIndexST_M_Group_T_Pause)
    1537                    << actionPool()->action(UIActionIndexST_M_Group_S_Reset)
    1538                    << actionPool()->action(UIActionIndexST_M_Group_S_Discard)
    1539                    << actionPool()->action(UIActionIndexST_M_Group_S_ShowLogDialog)
    1540                    << actionPool()->action(UIActionIndexST_M_Group_S_Refresh)
    1541                    << actionPool()->action(UIActionIndexST_M_Group_S_ShowInFileManager)
    1542                    << actionPool()->action(UIActionIndexST_M_Group_S_CreateShortcut)
    1543                    << actionPool()->action(UIActionIndexST_M_Group_S_Sort);
    1544 }
    1545 
    1546 void UIVirtualBoxManager::prepareMenuMachine(QMenu *pMenu)
    1547 {
    1548     /* Do not touch if filled already: */
    1549     if (!pMenu->isEmpty())
    1550         return;
    1551 
    1552 #ifdef VBOX_WS_X11
    1553     // WORKAROUND:
    1554     // There is an issue under Ubuntu which uses special kind of QPA
    1555     // plugin (appmenu-qt5) which redirects actions added to Qt menu-bar
    1556     // directly to Ubuntu Application menu-bar. In that case action
    1557     // shortcuts are not being handled by the Qt and that way ignored.
    1558     // As a workaround we can add those actions into QMainWindow as well.
    1559     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_New));
    1560     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Add));
    1561     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Settings));
    1562     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Clone));
    1563     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Move));
    1564     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Remove));
    1565     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup));
    1566     addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow));
    1567     addAction(actionPool()->action(UIActionIndexST_M_Machine_T_Pause));
    1568     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Reset));
    1569     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Discard));
    1570     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_ShowLogDialog));
    1571     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Refresh));
    1572     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_ShowInFileManager));
    1573     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_CreateShortcut));
    1574     addAction(actionPool()->action(UIActionIndexST_M_Machine_S_SortParent));
    1575 #endif /* VBOX_WS_X11 */
    1576 
    1577     /* Populate Machine-menu: */
    1578     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_New));
    1579     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Add));
    1580     pMenu->addSeparator();
    1581     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Settings));
    1582     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Clone));
    1583     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Move));
    1584     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Remove));
    1585     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup));
    1586     pMenu->addSeparator();
    1587     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow));
    1588     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_T_Pause));
    1589     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Reset));
    1590     pMenu->addMenu(actionPool()->action(UIActionIndexST_M_Machine_M_Close)->menu());
    1591     pMenu->addSeparator();
    1592     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Discard));
    1593     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_ShowLogDialog));
    1594     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Refresh));
    1595     pMenu->addSeparator();
    1596     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_ShowInFileManager));
    1597     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_CreateShortcut));
    1598     pMenu->addSeparator();
    1599     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_SortParent));
    1600 
    1601     /* Remember action list: */
    1602     m_machineActions << actionPool()->action(UIActionIndexST_M_Machine_S_New)
    1603                      << actionPool()->action(UIActionIndexST_M_Machine_S_Add)
    1604                      << actionPool()->action(UIActionIndexST_M_Machine_S_Settings)
    1605                      << actionPool()->action(UIActionIndexST_M_Machine_S_Clone)
    1606                      << actionPool()->action(UIActionIndexST_M_Machine_S_Move)
    1607                      << actionPool()->action(UIActionIndexST_M_Machine_S_Remove)
    1608                      << actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup)
    1609                      << actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow)
    1610                      << actionPool()->action(UIActionIndexST_M_Machine_T_Pause)
    1611                      << actionPool()->action(UIActionIndexST_M_Machine_S_Reset)
    1612                      << actionPool()->action(UIActionIndexST_M_Machine_S_Discard)
    1613                      << actionPool()->action(UIActionIndexST_M_Machine_S_ShowLogDialog)
    1614                      << actionPool()->action(UIActionIndexST_M_Machine_S_Refresh)
    1615                      << actionPool()->action(UIActionIndexST_M_Machine_S_ShowInFileManager)
    1616                      << actionPool()->action(UIActionIndexST_M_Machine_S_CreateShortcut)
    1617                      << actionPool()->action(UIActionIndexST_M_Machine_S_SortParent);
    1618 }
    1619 
    1620 void UIVirtualBoxManager::prepareMenuGroupStartOrShow(QMenu *pMenu)
    1621 {
    1622     /* Do not touch if filled already: */
    1623     if (!pMenu->isEmpty())
    1624         return;
    1625 
    1626 #ifdef VBOX_WS_X11
    1627     // WORKAROUND:
    1628     // There is an issue under Ubuntu which uses special kind of QPA
    1629     // plugin (appmenu-qt5) which redirects actions added to Qt menu-bar
    1630     // directly to Ubuntu Application menu-bar. In that case action
    1631     // shortcuts are not being handled by the Qt and that way ignored.
    1632     // As a workaround we can add those actions into QMainWindow as well.
    1633     addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal));
    1634     addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless));
    1635     addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable));
    1636 #endif /* VBOX_WS_X11 */
    1637 
    1638     /* Populate 'Group' / 'Start or Show' menu: */
    1639     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal));
    1640     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless));
    1641     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable));
    1642 
    1643     /* Remember action list: */
    1644     m_groupActions << actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal)
    1645                    << actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless)
    1646                    << actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable);
    1647 }
    1648 
    1649 void UIVirtualBoxManager::prepareMenuMachineStartOrShow(QMenu *pMenu)
    1650 {
    1651     /* Do not touch if filled already: */
    1652     if (!pMenu->isEmpty())
    1653         return;
    1654 
    1655 #ifdef VBOX_WS_X11
    1656     // WORKAROUND:
    1657     // There is an issue under Ubuntu which uses special kind of QPA
    1658     // plugin (appmenu-qt5) which redirects actions added to Qt menu-bar
    1659     // directly to Ubuntu Application menu-bar. In that case action
    1660     // shortcuts are not being handled by the Qt and that way ignored.
    1661     // As a workaround we can add those actions into QMainWindow as well.
    1662     addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal));
    1663     addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless));
    1664     addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable));
    1665 #endif /* VBOX_WS_X11 */
    1666 
    1667     /* Populate 'Machine' / 'Start or Show' menu: */
    1668     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal));
    1669     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless));
    1670     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable));
    1671 
    1672     /* Remember action list: */
    1673     m_machineActions << actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal)
    1674                      << actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless)
    1675                      << actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable);
    1676 }
    1677 
    1678 void UIVirtualBoxManager::prepareMenuGroupClose(QMenu *pMenu)
    1679 {
    1680     /* Do not touch if filled already: */
    1681     if (!pMenu->isEmpty())
    1682         return;
    1683 
    1684 #ifdef VBOX_WS_X11
    1685     // WORKAROUND:
    1686     // There is an issue under Ubuntu which uses special kind of QPA
    1687     // plugin (appmenu-qt5) which redirects actions added to Qt menu-bar
    1688     // directly to Ubuntu Application menu-bar. In that case action
    1689     // shortcuts are not being handled by the Qt and that way ignored.
    1690     // As a workaround we can add those actions into QMainWindow as well.
    1691     // addAction(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_Detach));
    1692     addAction(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_SaveState));
    1693     addAction(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_Shutdown));
    1694     addAction(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_PowerOff));
    1695 #endif /* VBOX_WS_X11 */
    1696 
    1697     /* Populate 'Group' / 'Close' menu: */
    1698     // pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_Detach));
    1699     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_SaveState));
    1700     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_Shutdown));
    1701     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_PowerOff));
    1702 
    1703     /* Remember action list: */
    1704     m_groupActions // << actionPool()->action(UIActionIndexST_M_Group_M_Close_S_Detach)
    1705                    << actionPool()->action(UIActionIndexST_M_Group_M_Close_S_SaveState)
    1706                    << actionPool()->action(UIActionIndexST_M_Group_M_Close_S_Shutdown)
    1707                    << actionPool()->action(UIActionIndexST_M_Group_M_Close_S_PowerOff);
    1708 }
    1709 
    1710 void UIVirtualBoxManager::prepareMenuMachineClose(QMenu *pMenu)
    1711 {
    1712     /* Do not touch if filled already: */
    1713     if (!pMenu->isEmpty())
    1714         return;
    1715 
    1716 #ifdef VBOX_WS_X11
    1717     // WORKAROUND:
    1718     // There is an issue under Ubuntu which uses special kind of QPA
    1719     // plugin (appmenu-qt5) which redirects actions added to Qt menu-bar
    1720     // directly to Ubuntu Application menu-bar. In that case action
    1721     // shortcuts are not being handled by the Qt and that way ignored.
    1722     // As a workaround we can add those actions into QMainWindow as well.
    1723     // addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_Detach));
    1724     addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_SaveState));
    1725     addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_Shutdown));
    1726     addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_PowerOff));
    1727 #endif /* VBOX_WS_X11 */
    1728 
    1729     /* Populate 'Machine' / 'Close' menu: */
    1730     // pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_Detach));
    1731     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_SaveState));
    1732     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_Shutdown));
    1733     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_PowerOff));
    1734 
    1735     /* Remember action list: */
    1736     m_machineActions // << actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_Detach)
    1737                      << actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_SaveState)
    1738                      << actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_Shutdown)
    1739                      << actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_PowerOff);
    1740 }
    1741 
    1742 void UIVirtualBoxManager::prepareMenuSnapshot(QMenu *pMenu)
    1743 {
    1744     /* Do not touch if filled already: */
    1745     if (!pMenu->isEmpty())
    1746         return;
    1747 
    1748 #ifdef VBOX_WS_X11
    1749     // WORKAROUND:
    1750     // There is an issue under Ubuntu which uses special kind of QPA
    1751     // plugin (appmenu-qt5) which redirects actions added to Qt menu-bar
    1752     // directly to Ubuntu Application menu-bar. In that case action
    1753     // shortcuts are not being handled by the Qt and that way ignored.
    1754     // As a workaround we can add those actions into QMainWindow as well.
    1755     addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Take));
    1756     addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Delete));
    1757     addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Restore));
    1758     addAction(actionPool()->action(UIActionIndexST_M_Snapshot_T_Properties));
    1759     addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Clone));
    1760 #endif /* VBOX_WS_X11 */
    1761 
    1762     /* Populate Snapshot-menu: */
    1763     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Take));
    1764     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Delete));
    1765     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Restore));
    1766     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_T_Properties));
    1767     pMenu->addAction(actionPool()->action(UIActionIndexST_M_Snapshot_S_Clone));
    1768 
    1769     /* Remember action list: */
    1770     m_snapshotActions << actionPool()->action(UIActionIndexST_M_Snapshot_S_Take)
    1771                       << actionPool()->action(UIActionIndexST_M_Snapshot_S_Delete)
    1772                       << actionPool()->action(UIActionIndexST_M_Snapshot_S_Restore)
    1773                       << actionPool()->action(UIActionIndexST_M_Snapshot_T_Properties)
    1774                       << actionPool()->action(UIActionIndexST_M_Snapshot_S_Clone);
    1775 }
    1776 
    1777 void UIVirtualBoxManager::prepareMenuLogViewer(QMenu *pMenu)
    1778 {
    1779     /* We are doing it inside the UIActionPool. */
    1780     Q_UNUSED(pMenu);
    1781 
    1782     /* Do not touch if filled already: */
    1783     if (!m_logViewerActions.isEmpty())
    1784         return;
    1785 
    1786     /* Remember action list: */
    1787     m_logViewerActions << actionPool()->action(UIActionIndex_M_Log_T_Find)
    1788                        << actionPool()->action(UIActionIndex_M_Log_T_Filter)
    1789                        << actionPool()->action(UIActionIndex_M_Log_T_Bookmark)
    1790                        << actionPool()->action(UIActionIndex_M_Log_T_Settings)
    1791                        << actionPool()->action(UIActionIndex_M_Log_S_Refresh)
    1792                        << actionPool()->action(UIActionIndex_M_Log_S_Save);
    1793 }
    1794 
    1795 void UIVirtualBoxManager::prepareMenuMedium(QMenu *pMenu)
    1796 {
    1797     /* We are doing it inside the UIActionPoolSelector. */
    1798     Q_UNUSED(pMenu);
    1799 
    1800     /* Do not touch if filled already: */
    1801     if (!m_virtualMediaManagerActions.isEmpty())
    1802         return;
    1803 
    1804     /* Remember action list: */
    1805     m_virtualMediaManagerActions << actionPool()->action(UIActionIndexST_M_Medium_S_Add)
    1806                                  << actionPool()->action(UIActionIndexST_M_Medium_S_Copy)
    1807                                  << actionPool()->action(UIActionIndexST_M_Medium_S_Move)
    1808                                  << actionPool()->action(UIActionIndexST_M_Medium_S_Remove)
    1809                                  << actionPool()->action(UIActionIndexST_M_Medium_S_Release)
    1810                                  << actionPool()->action(UIActionIndexST_M_Medium_T_Details)
    1811                                  << actionPool()->action(UIActionIndexST_M_Medium_S_Refresh);
    1812 }
    1813 
    1814 void UIVirtualBoxManager::prepareMenuNetwork(QMenu *pMenu)
    1815 {
    1816     /* We are doing it inside the UIActionPoolSelector. */
    1817     Q_UNUSED(pMenu);
    1818 
    1819     /* Do not touch if filled already: */
    1820     if (!m_hostNetworkManagerActions.isEmpty())
    1821         return;
    1822 
    1823     /* Remember action list: */
    1824     m_hostNetworkManagerActions << actionPool()->action(UIActionIndexST_M_Network_S_Create)
    1825                                 << actionPool()->action(UIActionIndexST_M_Network_S_Remove)
    1826                                 << actionPool()->action(UIActionIndexST_M_Network_T_Details)
    1827                                 << actionPool()->action(UIActionIndexST_M_Network_S_Refresh);
    1828 }
    1829 
    1830 void UIVirtualBoxManager::prepareMenuCloud(QMenu *pMenu)
    1831 {
    1832     /* We are doing it inside the UIActionPoolSelector. */
    1833     Q_UNUSED(pMenu);
    1834 
    1835     /* Do not touch if filled already: */
    1836     if (!m_cloudProfileManagerActions.isEmpty())
    1837         return;
    1838 
    1839     /* Remember action list: */
    1840     m_cloudProfileManagerActions << actionPool()->action(UIActionIndexST_M_Cloud_S_Add)
    1841                                  << actionPool()->action(UIActionIndexST_M_Cloud_S_Import)
    1842                                  << actionPool()->action(UIActionIndexST_M_Cloud_S_Remove)
    1843                                  << actionPool()->action(UIActionIndexST_M_Cloud_T_Details)
    1844                                  << actionPool()->action(UIActionIndexST_M_Cloud_S_Help);
    18451294}
    18461295
     
    21411590    /* Determine whether Machine or Group menu should be shown at all: */
    21421591    const bool fGlobalMenuShown  = m_pWidget->isGlobalItemSelected();
     1592    const bool fGroupMenuShown   = m_pWidget->isGroupItemSelected()   &&  isSingleGroupSelected();
    21431593    const bool fMachineMenuShown = m_pWidget->isMachineItemSelected() && !isSingleGroupSelected();
    2144     const bool fGroupMenuShown   = m_pWidget->isGroupItemSelected()   &&  isSingleGroupSelected();
    2145     m_pWelcomeMenuAction->setVisible(fGlobalMenuShown);
    2146     m_pMachineMenuAction->setVisible(fMachineMenuShown);
    2147     m_pGroupMenuAction->setVisible(fGroupMenuShown);
     1594    actionPool()->action(UIActionIndexST_M_Welcome)->setVisible(fGlobalMenuShown);
     1595    actionPool()->action(UIActionIndexST_M_Group)->setVisible(fGroupMenuShown);
     1596    actionPool()->action(UIActionIndexST_M_Machine)->setVisible(fMachineMenuShown);
    21481597
    21491598    /* Determine whether Media menu should be visible: */
    21501599    const bool fMediumMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == UIToolType_Media;
    2151     m_pVirtualMediaManagerMenuAction->setVisible(fMediumMenuShown);
    2152 
     1600    actionPool()->action(UIActionIndexST_M_Medium)->setVisible(fMediumMenuShown);
    21531601    /* Determine whether Network menu should be visible: */
    21541602    const bool fNetworkMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == UIToolType_Network;
    2155     m_pHostNetworkManagerMenuAction->setVisible(fNetworkMenuShown);
    2156 
     1603    actionPool()->action(UIActionIndexST_M_Network)->setVisible(fNetworkMenuShown);
    21571604    /* Determine whether Cloud menu should be visible: */
    21581605    const bool fCloudMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == UIToolType_Cloud;
    2159     m_pCloudProfileManagerMenuAction->setVisible(fCloudMenuShown);
     1606    actionPool()->action(UIActionIndexST_M_Cloud)->setVisible(fCloudMenuShown);
    21601607
    21611608    /* Determine whether Snapshots menu should be visible: */
    21621609    const bool fSnapshotMenuShown = (fMachineMenuShown || fGroupMenuShown) &&
    21631610                                    m_pWidget->currentMachineTool() == UIToolType_Snapshots;
    2164     m_pSnapshotMenuAction->setVisible(fSnapshotMenuShown);
    2165 
     1611    actionPool()->action(UIActionIndexST_M_Snapshot)->setVisible(fSnapshotMenuShown);
    21661612    /* Determine whether Logs menu should be visible: */
    21671613    const bool fLogViewerMenuShown = (fMachineMenuShown || fGroupMenuShown) &&
    21681614                                     m_pWidget->currentMachineTool() == UIToolType_Logs;
    2169     m_pLogViewerMenuAction->setVisible(fLogViewerMenuShown);
     1615    actionPool()->action(UIActionIndex_M_Log)->setVisible(fLogViewerMenuShown);
    21701616
    21711617    /* Hide action shortcuts: */
    21721618    if (!fGlobalMenuShown)
    2173         foreach (UIAction *pAction, m_welcomeActions)
    2174             pAction->hideShortcut();
     1619        actionPool()->setShortcutsVisible(UIActionIndexST_M_Welcome, false);
     1620    if (!fGroupMenuShown)
     1621        actionPool()->setShortcutsVisible(UIActionIndexST_M_Group, false);
    21751622    if (!fMachineMenuShown)
    2176         foreach (UIAction *pAction, m_machineActions)
    2177             pAction->hideShortcut();
    2178     if (!fGroupMenuShown)
    2179         foreach (UIAction *pAction, m_groupActions)
    2180             pAction->hideShortcut();
     1623        actionPool()->setShortcutsVisible(UIActionIndexST_M_Machine, false);
    21811624
    21821625    /* Show action shortcuts: */
    21831626    if (fGlobalMenuShown)
    2184         foreach (UIAction *pAction, m_welcomeActions)
    2185             pAction->showShortcut();
     1627        actionPool()->setShortcutsVisible(UIActionIndexST_M_Welcome, true);
     1628    if (fGroupMenuShown)
     1629        actionPool()->setShortcutsVisible(UIActionIndexST_M_Group, true);
    21861630    if (fMachineMenuShown)
    2187         foreach (UIAction *pAction, m_machineActions)
    2188             pAction->showShortcut();
    2189     if (fGroupMenuShown)
    2190         foreach (UIAction *pAction, m_groupActions)
    2191             pAction->showShortcut();
     1631        actionPool()->setShortcutsVisible(UIActionIndexST_M_Machine, true);
    21921632}
    21931633
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r75093 r75207  
    247247        /** Prepares menu-bar. */
    248248        void prepareMenuBar();
    249         /** Prepares @a pMenu File. */
    250         void prepareMenuFile(QMenu *pMenu);
    251         /** Prepares @a pMenu Welcome. */
    252         void prepareMenuWelcome(QMenu *pMenu);
    253         /** Prepares @a pMenu Group. */
    254         void prepareMenuGroup(QMenu *pMenu);
    255         /** Prepares @a pMenu Machine. */
    256         void prepareMenuMachine(QMenu *pMenu);
    257         /** Prepares @a pMenu Group => Start or Show. */
    258         void prepareMenuGroupStartOrShow(QMenu *pMenu);
    259         /** Prepares @a pMenu Machine => Start or Show. */
    260         void prepareMenuMachineStartOrShow(QMenu *pMenu);
    261         /** Prepares @a pMenu Group => Close. */
    262         void prepareMenuGroupClose(QMenu *pMenu);
    263         /** Prepares @a pMenu Machine => Close. */
    264         void prepareMenuMachineClose(QMenu *pMenu);
    265         /** Prepares @a pMenu Snapshot. */
    266         void prepareMenuSnapshot(QMenu *pMenu);
    267         /** Prepares @a pMenu Log Viewer. */
    268         void prepareMenuLogViewer(QMenu *pMenu);
    269         /** Prepares @a pMenu Medium. */
    270         void prepareMenuMedium(QMenu *pMenu);
    271         /** Prepares @a pMenu Network. */
    272         void prepareMenuNetwork(QMenu *pMenu);
    273         /** Prepares @a pMenu Cloud. */
    274         void prepareMenuCloud(QMenu *pMenu);
    275249        /** Prepares status-bar. */
    276250        void prepareStatusBar();
     
    363337    UIActionPool *m_pActionPool;
    364338
    365     /** Holds the list of Welcome menu actions. */
    366     QList<UIAction*>  m_welcomeActions;
    367     /** Holds the Welcome menu parent action. */
    368     QAction          *m_pWelcomeMenuAction;
    369 
    370     /** Holds the list of Group menu actions. */
    371     QList<UIAction*>  m_groupActions;
    372     /** Holds the Group menu parent action. */
    373     QAction          *m_pGroupMenuAction;
    374 
    375     /** Holds the list of Machine menu actions. */
    376     QList<UIAction*>  m_machineActions;
    377     /** Holds the Machine menu parent action. */
    378     QAction          *m_pMachineMenuAction;
    379 
    380     /** Holds the list of Snapshot menu actions. */
    381     QList<UIAction*>  m_snapshotActions;
    382     /** Holds the Snapshot menu parent action. */
    383     QAction          *m_pSnapshotMenuAction;
    384 
    385     /** Holds the list of Log Viewer menu actions. */
    386     QList<UIAction*>  m_logViewerActions;
    387     /** Holds the Log Viewer menu parent action. */
    388     QAction          *m_pLogViewerMenuAction;
    389 
    390     /** Holds the list of Virtual Media Manager menu actions. */
    391     QList<UIAction*>  m_virtualMediaManagerActions;
    392     /** Holds the Virtual Media Manager menu parent action. */
    393     QAction          *m_pVirtualMediaManagerMenuAction;
    394 
    395     /** Holds the list of Host Network Manager menu actions. */
    396     QList<UIAction*>  m_hostNetworkManagerActions;
    397     /** Holds the Host Network Manager menu parent action. */
    398     QAction          *m_pHostNetworkManagerMenuAction;
    399 
    400     /** Holds the list of Cloud Profile Manager menu actions. */
    401     QList<UIAction*>  m_cloudProfileManagerActions;
    402     /** Holds the Cloud Profile Manager menu parent action. */
    403     QAction          *m_pCloudProfileManagerMenuAction;
    404 
    405339    /** Holds the Virtual Media Manager window instance. */
    406340    QIManagerDialog *m_pManagerVirtualMedia;
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