VirtualBox

Ignore:
Timestamp:
Nov 28, 2013 11:44:37 AM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Extra-data flags and handling for menus content configuration.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h

    r48826 r49698  
    6161template<> bool canConvert<StorageSlot>();
    6262template<> bool canConvert<RuntimeMenuType>();
     63#ifdef Q_WS_MAC
     64template<> bool canConvert<RuntimeMenuApplicationActionType>();
     65#endif /* Q_WS_MAC */
     66template<> bool canConvert<RuntimeMenuMachineActionType>();
     67template<> bool canConvert<RuntimeMenuViewActionType>();
     68template<> bool canConvert<RuntimeMenuDevicesActionType>();
     69#ifdef VBOX_WITH_DEBUGGER_GUI
     70template<> bool canConvert<RuntimeMenuDebuggerActionType>();
     71#endif /* VBOX_WITH_DEBUGGER_GUI */
     72template<> bool canConvert<RuntimeMenuHelpActionType>();
    6373template<> bool canConvert<UIVisualStateType>();
    6474template<> bool canConvert<DetailsElementType>();
     
    98108template<> QString toInternalString(const RuntimeMenuType &runtimeMenuType);
    99109template<> RuntimeMenuType fromInternalString<RuntimeMenuType>(const QString &strRuntimeMenuType);
     110#ifdef Q_WS_MAC
     111template<> QString toInternalString(const RuntimeMenuApplicationActionType &runtimeMenuApplicationActionType);
     112template<> RuntimeMenuApplicationActionType fromInternalString<RuntimeMenuApplicationActionType>(const QString &strRuntimeMenuApplicationActionType);
     113#endif /* Q_WS_MAC */
     114template<> QString toInternalString(const RuntimeMenuMachineActionType &runtimeMenuMachineActionType);
     115template<> RuntimeMenuMachineActionType fromInternalString<RuntimeMenuMachineActionType>(const QString &strRuntimeMenuMachineActionType);
     116template<> QString toInternalString(const RuntimeMenuViewActionType &runtimeMenuViewActionType);
     117template<> RuntimeMenuViewActionType fromInternalString<RuntimeMenuViewActionType>(const QString &strRuntimeMenuViewActionType);
     118template<> QString toInternalString(const RuntimeMenuDevicesActionType &runtimeMenuDevicesActionType);
     119template<> RuntimeMenuDevicesActionType fromInternalString<RuntimeMenuDevicesActionType>(const QString &strRuntimeMenuDevicesActionType);
     120#ifdef VBOX_WITH_DEBUGGER_GUI
     121template<> QString toInternalString(const RuntimeMenuDebuggerActionType &runtimeMenuDebuggerActionType);
     122template<> RuntimeMenuDebuggerActionType fromInternalString<RuntimeMenuDebuggerActionType>(const QString &strRuntimeMenuDebuggerActionType);
     123#endif /* VBOX_WITH_DEBUGGER_GUI */
     124template<> QString toInternalString(const RuntimeMenuHelpActionType &runtimeMenuHelpActionType);
     125template<> RuntimeMenuHelpActionType fromInternalString<RuntimeMenuHelpActionType>(const QString &strRuntimeMenuHelpActionType);
    100126template<> QString toInternalString(const UIVisualStateType &visualStateType);
    101127template<> UIVisualStateType fromInternalString<UIVisualStateType>(const QString &strVisualStateType);
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r49596 r49698  
    3434template<> bool canConvert<StorageSlot>() { return true; }
    3535template<> bool canConvert<RuntimeMenuType>() { return true; }
     36#ifdef Q_WS_MAC
     37template<> bool canConvert<RuntimeMenuApplicationActionType>() { return true; }
     38#endif /* Q_WS_MAC */
     39template<> bool canConvert<RuntimeMenuMachineActionType>() { return true; }
     40template<> bool canConvert<RuntimeMenuViewActionType>() { return true; }
     41template<> bool canConvert<RuntimeMenuDevicesActionType>() { return true; }
     42#ifdef VBOX_WITH_DEBUGGER_GUI
     43template<> bool canConvert<RuntimeMenuDebuggerActionType>() { return true; }
     44#endif /* VBOX_WITH_DEBUGGER_GUI */
     45template<> bool canConvert<RuntimeMenuHelpActionType>() { return true; }
    3646template<> bool canConvert<UIVisualStateType>() { return true; }
    3747template<> bool canConvert<DetailsElementType>() { return true; }
     
    361371    /* Corresponding type for known words: */
    362372    return values.at(keys.indexOf(QRegExp(strRuntimeMenuType, Qt::CaseInsensitive)));
     373}
     374
     375#ifdef Q_WS_MAC
     376/* QString <= RuntimeMenuApplicationActionType: */
     377template<> QString toInternalString(const RuntimeMenuApplicationActionType &runtimeMenuApplicationActionType)
     378{
     379    QString strResult;
     380    switch (runtimeMenuApplicationActionType)
     381    {
     382        case RuntimeMenuApplicationActionType_About: strResult = "About"; break;
     383        case RuntimeMenuApplicationActionType_All:   strResult = "All"; break;
     384        default:
     385        {
     386            AssertMsgFailed(("No text for action type=%d", runtimeMenuApplicationActionType));
     387            break;
     388        }
     389    }
     390    return strResult;
     391}
     392
     393/* RuntimeMenuApplicationActionType <= QString: */
     394template<> RuntimeMenuApplicationActionType fromInternalString<RuntimeMenuApplicationActionType>(const QString &strRuntimeMenuApplicationActionType)
     395{
     396    /* Here we have some fancy stuff allowing us
     397     * to search through the keys using 'case-insensitive' rule: */
     398    QStringList keys; QList<RuntimeMenuApplicationActionType> values;
     399    keys << "About";  values << RuntimeMenuApplicationActionType_About;
     400    keys << "All";    values << RuntimeMenuApplicationActionType_All;
     401    /* Invalid type for unknown words: */
     402    if (!keys.contains(strRuntimeMenuApplicationActionType, Qt::CaseInsensitive))
     403        return RuntimeMenuApplicationActionType_Invalid;
     404    /* Corresponding type for known words: */
     405    return values.at(keys.indexOf(QRegExp(strRuntimeMenuApplicationActionType, Qt::CaseInsensitive)));
     406}
     407#endif /* Q_WS_MAC */
     408
     409/* QString <= RuntimeMenuMachineActionType: */
     410template<> QString toInternalString(const RuntimeMenuMachineActionType &runtimeMenuMachineActionType)
     411{
     412    QString strResult;
     413    switch (runtimeMenuMachineActionType)
     414    {
     415        case RuntimeMenuMachineActionType_SettingsDialog:    strResult = "SettingsDialog"; break;
     416        case RuntimeMenuMachineActionType_TakeSnapshot:      strResult = "TakeSnapshot"; break;
     417        case RuntimeMenuMachineActionType_TakeScreenshot:    strResult = "TakeScreenshot"; break;
     418        case RuntimeMenuMachineActionType_InformationDialog: strResult = "InformationDialog"; break;
     419        case RuntimeMenuMachineActionType_MouseIntegration:  strResult = "MouseIntegration"; break;
     420        case RuntimeMenuMachineActionType_TypeCAD:           strResult = "TypeCAD"; break;
     421#ifdef Q_WS_X11
     422        case RuntimeMenuMachineActionType_TypeCABS:          strResult = "TypeCABS"; break;
     423#endif /* Q_WS_X11 */
     424        case RuntimeMenuMachineActionType_Pause:             strResult = "Pause"; break;
     425        case RuntimeMenuMachineActionType_Reset:             strResult = "Reset"; break;
     426        case RuntimeMenuMachineActionType_SaveState:         strResult = "SaveState"; break;
     427        case RuntimeMenuMachineActionType_Shutdown:          strResult = "Shutdown"; break;
     428        case RuntimeMenuMachineActionType_PowerOff:          strResult = "PowerOff"; break;
     429#ifndef Q_WS_MAC
     430        case RuntimeMenuMachineActionType_Close:             strResult = "Close"; break;
     431#endif /* !Q_WS_MAC */
     432        case RuntimeMenuMachineActionType_All:               strResult = "All"; break;
     433        default:
     434        {
     435            AssertMsgFailed(("No text for action type=%d", runtimeMenuMachineActionType));
     436            break;
     437        }
     438    }
     439    return strResult;
     440}
     441
     442/* RuntimeMenuMachineActionType <= QString: */
     443template<> RuntimeMenuMachineActionType fromInternalString<RuntimeMenuMachineActionType>(const QString &strRuntimeMenuMachineActionType)
     444{
     445    /* Here we have some fancy stuff allowing us
     446     * to search through the keys using 'case-insensitive' rule: */
     447    QStringList keys;            QList<RuntimeMenuMachineActionType> values;
     448    keys << "SettingsDialog";    values << RuntimeMenuMachineActionType_SettingsDialog;
     449    keys << "TakeSnapshot";      values << RuntimeMenuMachineActionType_TakeSnapshot;
     450    keys << "TakeScreenshot";    values << RuntimeMenuMachineActionType_TakeScreenshot;
     451    keys << "InformationDialog"; values << RuntimeMenuMachineActionType_InformationDialog;
     452    keys << "MouseIntegration";  values << RuntimeMenuMachineActionType_MouseIntegration;
     453    keys << "TypeCAD";           values << RuntimeMenuMachineActionType_TypeCAD;
     454#ifdef Q_WS_X11
     455    keys << "TypeCABS";          values << RuntimeMenuMachineActionType_TypeCABS;
     456#endif /* Q_WS_X11 */
     457    keys << "Pause";             values << RuntimeMenuMachineActionType_Pause;
     458    keys << "Reset";             values << RuntimeMenuMachineActionType_Reset;
     459    keys << "SaveState";         values << RuntimeMenuMachineActionType_SaveState;
     460    keys << "Shutdown";          values << RuntimeMenuMachineActionType_Shutdown;
     461    keys << "PowerOff";          values << RuntimeMenuMachineActionType_PowerOff;
     462#ifndef Q_WS_MAC
     463    keys << "Close";             values << RuntimeMenuMachineActionType_Close;
     464#endif /* !Q_WS_MAC */
     465    keys << "All";               values << RuntimeMenuMachineActionType_All;
     466    /* Invalid type for unknown words: */
     467    if (!keys.contains(strRuntimeMenuMachineActionType, Qt::CaseInsensitive))
     468        return RuntimeMenuMachineActionType_Invalid;
     469    /* Corresponding type for known words: */
     470    return values.at(keys.indexOf(QRegExp(strRuntimeMenuMachineActionType, Qt::CaseInsensitive)));
     471}
     472
     473/* QString <= RuntimeMenuViewActionType: */
     474template<> QString toInternalString(const RuntimeMenuViewActionType &runtimeMenuViewActionType)
     475{
     476    QString strResult;
     477    switch (runtimeMenuViewActionType)
     478    {
     479        case RuntimeMenuViewActionType_Fullscreen:      strResult = "Fullscreen"; break;
     480        case RuntimeMenuViewActionType_Seamless:        strResult = "Seamless"; break;
     481        case RuntimeMenuViewActionType_Scale:           strResult = "Scale"; break;
     482        case RuntimeMenuViewActionType_GuestAutoresize: strResult = "GuestAutoresize"; break;
     483        case RuntimeMenuViewActionType_AdjustWindow:    strResult = "AdjustWindow"; break;
     484        case RuntimeMenuViewActionType_Multiscreen:     strResult = "Multiscreen"; break;
     485        case RuntimeMenuViewActionType_All:             strResult = "All"; break;
     486        default:
     487        {
     488            AssertMsgFailed(("No text for action type=%d", runtimeMenuViewActionType));
     489            break;
     490        }
     491    }
     492    return strResult;
     493}
     494
     495/* RuntimeMenuViewActionType <= QString: */
     496template<> RuntimeMenuViewActionType fromInternalString<RuntimeMenuViewActionType>(const QString &strRuntimeMenuViewActionType)
     497{
     498    /* Here we have some fancy stuff allowing us
     499     * to search through the keys using 'case-insensitive' rule: */
     500    QStringList keys;          QList<RuntimeMenuViewActionType> values;
     501    keys << "Fullscreen";      values << RuntimeMenuViewActionType_Fullscreen;
     502    keys << "Seamless";        values << RuntimeMenuViewActionType_Seamless;
     503    keys << "Scale";           values << RuntimeMenuViewActionType_Scale;
     504    keys << "GuestAutoresize"; values << RuntimeMenuViewActionType_GuestAutoresize;
     505    keys << "AdjustWindow";    values << RuntimeMenuViewActionType_AdjustWindow;
     506    keys << "Multiscreen";     values << RuntimeMenuViewActionType_Multiscreen;
     507    keys << "All";             values << RuntimeMenuViewActionType_All;
     508    /* Invalid type for unknown words: */
     509    if (!keys.contains(strRuntimeMenuViewActionType, Qt::CaseInsensitive))
     510        return RuntimeMenuViewActionType_Invalid;
     511    /* Corresponding type for known words: */
     512    return values.at(keys.indexOf(QRegExp(strRuntimeMenuViewActionType, Qt::CaseInsensitive)));
     513}
     514
     515/* QString <= RuntimeMenuDevicesActionType: */
     516template<> QString toInternalString(const RuntimeMenuDevicesActionType &runtimeMenuDevicesActionType)
     517{
     518    QString strResult;
     519    switch (runtimeMenuDevicesActionType)
     520    {
     521        case RuntimeMenuDevicesActionType_OpticalDevices:        strResult = "OpticalDevices"; break;
     522        case RuntimeMenuDevicesActionType_FloppyDevices:         strResult = "FloppyDevices"; break;
     523        case RuntimeMenuDevicesActionType_USBDevices:            strResult = "USBDevices"; break;
     524        case RuntimeMenuDevicesActionType_WebCams:               strResult = "WebCams"; break;
     525        case RuntimeMenuDevicesActionType_SharedClipboard:       strResult = "SharedClipboard"; break;
     526        case RuntimeMenuDevicesActionType_DragAndDrop:           strResult = "DragAndDrop"; break;
     527        case RuntimeMenuDevicesActionType_NetworkSettings:       strResult = "NetworkSettings"; break;
     528        case RuntimeMenuDevicesActionType_SharedFoldersSettings: strResult = "SharedFoldersSettings"; break;
     529        case RuntimeMenuDevicesActionType_VRDEServer:            strResult = "VRDEServer"; break;
     530        case RuntimeMenuDevicesActionType_VideoCapture:          strResult = "VideoCapture"; break;
     531        case RuntimeMenuDevicesActionType_InstallGuestTools:     strResult = "InstallGuestTools"; break;
     532        case RuntimeMenuDevicesActionType_All:                   strResult = "All"; break;
     533        default:
     534        {
     535            AssertMsgFailed(("No text for action type=%d", runtimeMenuDevicesActionType));
     536            break;
     537        }
     538    }
     539    return strResult;
     540}
     541
     542/* RuntimeMenuDevicesActionType <= QString: */
     543template<> RuntimeMenuDevicesActionType fromInternalString<RuntimeMenuDevicesActionType>(const QString &strRuntimeMenuDevicesActionType)
     544{
     545    /* Here we have some fancy stuff allowing us
     546     * to search through the keys using 'case-insensitive' rule: */
     547    QStringList keys;                QList<RuntimeMenuDevicesActionType> values;
     548    keys << "OpticalDevices";        values << RuntimeMenuDevicesActionType_OpticalDevices;
     549    keys << "FloppyDevices";         values << RuntimeMenuDevicesActionType_FloppyDevices;
     550    keys << "USBDevices";            values << RuntimeMenuDevicesActionType_USBDevices;
     551    keys << "WebCams";               values << RuntimeMenuDevicesActionType_WebCams;
     552    keys << "SharedClipboard";       values << RuntimeMenuDevicesActionType_SharedClipboard;
     553    keys << "DragAndDrop";           values << RuntimeMenuDevicesActionType_DragAndDrop;
     554    keys << "NetworkSettings";       values << RuntimeMenuDevicesActionType_NetworkSettings;
     555    keys << "SharedFoldersSettings"; values << RuntimeMenuDevicesActionType_SharedFoldersSettings;
     556    keys << "VRDEServer";            values << RuntimeMenuDevicesActionType_VRDEServer;
     557    keys << "VideoCapture";          values << RuntimeMenuDevicesActionType_VideoCapture;
     558    keys << "InstallGuestTools";     values << RuntimeMenuDevicesActionType_InstallGuestTools;
     559    keys << "All";                   values << RuntimeMenuDevicesActionType_All;
     560    /* Invalid type for unknown words: */
     561    if (!keys.contains(strRuntimeMenuDevicesActionType, Qt::CaseInsensitive))
     562        return RuntimeMenuDevicesActionType_Invalid;
     563    /* Corresponding type for known words: */
     564    return values.at(keys.indexOf(QRegExp(strRuntimeMenuDevicesActionType, Qt::CaseInsensitive)));
     565}
     566
     567#ifdef VBOX_WITH_DEBUGGER_GUI
     568/* QString <= RuntimeMenuDebuggerActionType: */
     569template<> QString toInternalString(const RuntimeMenuDebuggerActionType &runtimeMenuDebuggerActionType)
     570{
     571    QString strResult;
     572    switch (runtimeMenuDebuggerActionType)
     573    {
     574        case RuntimeMenuDebuggerActionType_Statistics:  strResult = "Statistics"; break;
     575        case RuntimeMenuDebuggerActionType_CommandLine: strResult = "CommandLine"; break;
     576        case RuntimeMenuDebuggerActionType_Logging:     strResult = "Logging"; break;
     577        case RuntimeMenuDebuggerActionType_LogDialog:   strResult = "LogDialog"; break;
     578        case RuntimeMenuDebuggerActionType_All:         strResult = "All"; break;
     579        default:
     580        {
     581            AssertMsgFailed(("No text for action type=%d", runtimeMenuDebuggerActionType));
     582            break;
     583        }
     584    }
     585    return strResult;
     586}
     587
     588/* RuntimeMenuDebuggerActionType <= QString: */
     589template<> RuntimeMenuDebuggerActionType fromInternalString<RuntimeMenuDebuggerActionType>(const QString &strRuntimeMenuDebuggerActionType)
     590{
     591    /* Here we have some fancy stuff allowing us
     592     * to search through the keys using 'case-insensitive' rule: */
     593    QStringList keys;      QList<RuntimeMenuDebuggerActionType> values;
     594    keys << "Statistics";  values << RuntimeMenuDebuggerActionType_Statistics;
     595    keys << "CommandLine"; values << RuntimeMenuDebuggerActionType_CommandLine;
     596    keys << "Logging";     values << RuntimeMenuDebuggerActionType_Logging;
     597    keys << "LogDialog";   values << RuntimeMenuDebuggerActionType_LogDialog;
     598    keys << "All";         values << RuntimeMenuDebuggerActionType_All;
     599    /* Invalid type for unknown words: */
     600    if (!keys.contains(strRuntimeMenuDebuggerActionType, Qt::CaseInsensitive))
     601        return RuntimeMenuDebuggerActionType_Invalid;
     602    /* Corresponding type for known words: */
     603    return values.at(keys.indexOf(QRegExp(strRuntimeMenuDebuggerActionType, Qt::CaseInsensitive)));
     604}
     605#endif /* VBOX_WITH_DEBUGGER_GUI */
     606
     607/* QString <= RuntimeMenuHelpActionType: */
     608template<> QString toInternalString(const RuntimeMenuHelpActionType &runtimeMenuHelpActionType)
     609{
     610    QString strResult;
     611    switch (runtimeMenuHelpActionType)
     612    {
     613        case RuntimeMenuHelpActionType_Contents:             strResult = "Contents"; break;
     614        case RuntimeMenuHelpActionType_WebSite:              strResult = "WebSite"; break;
     615        case RuntimeMenuHelpActionType_ResetWarnings:        strResult = "ResetWarnings"; break;
     616#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
     617        case RuntimeMenuHelpActionType_NetworkAccessManager: strResult = "NetworkAccessManager"; break;
     618#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
     619#ifndef Q_WS_MAC
     620        case RuntimeMenuHelpActionType_About:                strResult = "About"; break;
     621#endif /* !Q_WS_MAC */
     622        case RuntimeMenuHelpActionType_All:                  strResult = "All"; break;
     623        default:
     624        {
     625            AssertMsgFailed(("No text for action type=%d", runtimeMenuHelpActionType));
     626            break;
     627        }
     628    }
     629    return strResult;
     630}
     631
     632/* RuntimeMenuHelpActionType <= QString: */
     633template<> RuntimeMenuHelpActionType fromInternalString<RuntimeMenuHelpActionType>(const QString &strRuntimeMenuHelpActionType)
     634{
     635    /* Here we have some fancy stuff allowing us
     636     * to search through the keys using 'case-insensitive' rule: */
     637    QStringList keys;               QList<RuntimeMenuHelpActionType> values;
     638    keys << "Contents";             values << RuntimeMenuHelpActionType_Contents;
     639    keys << "WebSite";              values << RuntimeMenuHelpActionType_WebSite;
     640    keys << "ResetWarnings";        values << RuntimeMenuHelpActionType_ResetWarnings;
     641#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
     642    keys << "NetworkAccessManager"; values << RuntimeMenuHelpActionType_NetworkAccessManager;
     643#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
     644#ifndef Q_WS_MAC
     645    keys << "About";                values << RuntimeMenuHelpActionType_About;
     646#endif /* !Q_WS_MAC */
     647    keys << "All";                  values << RuntimeMenuHelpActionType_All;
     648    /* Invalid type for unknown words: */
     649    if (!keys.contains(strRuntimeMenuHelpActionType, Qt::CaseInsensitive))
     650        return RuntimeMenuHelpActionType_Invalid;
     651    /* Corresponding type for known words: */
     652    return values.at(keys.indexOf(QRegExp(strRuntimeMenuHelpActionType, Qt::CaseInsensitive)));
    363653}
    364654
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp

    r49596 r49698  
    5252/* Machine-window definitions: */
    5353const char* UIDefs::GUI_RestrictedRuntimeMenus = "GUI/RestrictedRuntimeMenus";
     54#ifdef Q_WS_MAC
     55const char* UIDefs::GUI_RestrictedRuntimeApplicationMenuActions = "GUI/RestrictedRuntimeApplicationMenuActions";
     56#endif /* Q_WS_MAC */
     57const char* UIDefs::GUI_RestrictedRuntimeMachineMenuActions = "GUI/RestrictedRuntimeMachineMenuActions";
     58const char* UIDefs::GUI_RestrictedRuntimeViewMenuActions = "GUI/RestrictedRuntimeViewMenuActions";
     59const char* UIDefs::GUI_RestrictedRuntimeDevicesMenuActions = "GUI/RestrictedRuntimeDevicesMenuActions";
     60#ifdef VBOX_WITH_DEBUGGER_GUI
     61const char* UIDefs::GUI_RestrictedRuntimeDebuggerMenuActions = "GUI/RestrictedRuntimeDebuggerMenuActions";
     62#endif /* VBOX_WITH_DEBUGGER_GUI */
     63const char* UIDefs::GUI_RestrictedRuntimeHelpMenuActions = "GUI/RestrictedRuntimeHelpMenuActions";
    5464const char* UIDefs::GUI_RestrictedVisualStates = "GUI/RestrictedVisualStates";
    5565const char* UIDefs::GUI_Input_MachineShortcuts = "GUI/Input/MachineShortcuts";
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r49596 r49698  
    121121    /* Machine-window declarations: */
    122122    extern const char* GUI_RestrictedRuntimeMenus;
     123#ifdef Q_WS_MAC
     124    extern const char* GUI_RestrictedRuntimeApplicationMenuActions;
     125#endif /* Q_WS_MAC */
     126    extern const char* GUI_RestrictedRuntimeMachineMenuActions;
     127    extern const char* GUI_RestrictedRuntimeViewMenuActions;
     128    extern const char* GUI_RestrictedRuntimeDevicesMenuActions;
     129#ifdef VBOX_WITH_DEBUGGER_GUI
     130    extern const char* GUI_RestrictedRuntimeDebuggerMenuActions;
     131#endif /* VBOX_WITH_DEBUGGER_GUI */
     132    extern const char* GUI_RestrictedRuntimeHelpMenuActions;
    123133    extern const char* GUI_RestrictedVisualStates;
    124134    extern const char* GUI_Input_MachineShortcuts;
     
    264274};
    265275
     276#ifdef Q_WS_MAC
     277/** Runtime UI: Application menu: Action types. */
     278enum RuntimeMenuApplicationActionType
     279{
     280    RuntimeMenuApplicationActionType_Invalid = 0,
     281    RuntimeMenuApplicationActionType_About   = RT_BIT(0),
     282    RuntimeMenuApplicationActionType_All     = 0xFFFF
     283};
     284#endif /* Q_WS_MAC */
     285
     286/** Runtime UI: Machine menu: Action types. */
     287enum RuntimeMenuMachineActionType
     288{
     289    RuntimeMenuMachineActionType_Invalid           = 0,
     290    RuntimeMenuMachineActionType_SettingsDialog    = RT_BIT(0),
     291    RuntimeMenuMachineActionType_TakeSnapshot      = RT_BIT(1),
     292    RuntimeMenuMachineActionType_TakeScreenshot    = RT_BIT(2),
     293    RuntimeMenuMachineActionType_InformationDialog = RT_BIT(3),
     294    RuntimeMenuMachineActionType_MouseIntegration  = RT_BIT(4),
     295    RuntimeMenuMachineActionType_TypeCAD           = RT_BIT(5),
     296#ifdef Q_WS_X11
     297    RuntimeMenuMachineActionType_TypeCABS          = RT_BIT(6),
     298#endif /* Q_WS_X11 */
     299    RuntimeMenuMachineActionType_Pause             = RT_BIT(7),
     300    RuntimeMenuMachineActionType_Reset             = RT_BIT(8),
     301    RuntimeMenuMachineActionType_SaveState         = RT_BIT(9),
     302    RuntimeMenuMachineActionType_Shutdown          = RT_BIT(10),
     303    RuntimeMenuMachineActionType_PowerOff          = RT_BIT(11),
     304#ifndef Q_WS_MAC
     305    RuntimeMenuMachineActionType_Close             = RT_BIT(12),
     306#endif /* !Q_WS_MAC */
     307    RuntimeMenuMachineActionType_All               = 0xFFFF
     308};
     309
     310/** Runtime UI: View menu: Action types. */
     311enum RuntimeMenuViewActionType
     312{
     313    RuntimeMenuViewActionType_Invalid         = 0,
     314    RuntimeMenuViewActionType_Fullscreen      = RT_BIT(0),
     315    RuntimeMenuViewActionType_Seamless        = RT_BIT(1),
     316    RuntimeMenuViewActionType_Scale           = RT_BIT(2),
     317    RuntimeMenuViewActionType_GuestAutoresize = RT_BIT(3),
     318    RuntimeMenuViewActionType_AdjustWindow    = RT_BIT(4),
     319    RuntimeMenuViewActionType_Multiscreen     = RT_BIT(5),
     320    RuntimeMenuViewActionType_All             = 0xFFFF
     321};
     322
     323/** Runtime UI: Devices menu: Action types. */
     324enum RuntimeMenuDevicesActionType
     325{
     326    RuntimeMenuDevicesActionType_Invalid               = 0,
     327    RuntimeMenuDevicesActionType_OpticalDevices        = RT_BIT(0),
     328    RuntimeMenuDevicesActionType_FloppyDevices         = RT_BIT(1),
     329    RuntimeMenuDevicesActionType_USBDevices            = RT_BIT(2),
     330    RuntimeMenuDevicesActionType_WebCams               = RT_BIT(3),
     331    RuntimeMenuDevicesActionType_SharedClipboard       = RT_BIT(4),
     332    RuntimeMenuDevicesActionType_DragAndDrop           = RT_BIT(5),
     333    RuntimeMenuDevicesActionType_NetworkSettings       = RT_BIT(6),
     334    RuntimeMenuDevicesActionType_SharedFoldersSettings = RT_BIT(7),
     335    RuntimeMenuDevicesActionType_VRDEServer            = RT_BIT(8),
     336    RuntimeMenuDevicesActionType_VideoCapture          = RT_BIT(9),
     337    RuntimeMenuDevicesActionType_InstallGuestTools     = RT_BIT(10),
     338    RuntimeMenuDevicesActionType_All                   = 0xFFFF
     339};
     340
     341#ifdef VBOX_WITH_DEBUGGER_GUI
     342/** Runtime UI: Debugger menu: Action types. */
     343enum RuntimeMenuDebuggerActionType
     344{
     345    RuntimeMenuDebuggerActionType_Invalid     = 0,
     346    RuntimeMenuDebuggerActionType_Statistics  = RT_BIT(0),
     347    RuntimeMenuDebuggerActionType_CommandLine = RT_BIT(1),
     348    RuntimeMenuDebuggerActionType_Logging     = RT_BIT(2),
     349    RuntimeMenuDebuggerActionType_LogDialog   = RT_BIT(3),
     350    RuntimeMenuDebuggerActionType_All         = 0xFFFF
     351};
     352#endif /* VBOX_WITH_DEBUGGER_GUI */
     353
     354/** Runtime UI: Help menu: Action types. */
     355enum RuntimeMenuHelpActionType
     356{
     357    RuntimeMenuHelpActionType_Invalid              = 0,
     358    RuntimeMenuHelpActionType_Contents             = RT_BIT(0),
     359    RuntimeMenuHelpActionType_WebSite              = RT_BIT(1),
     360    RuntimeMenuHelpActionType_ResetWarnings        = RT_BIT(2),
     361#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
     362    RuntimeMenuHelpActionType_NetworkAccessManager = RT_BIT(3),
     363#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
     364#ifndef Q_WS_MAC
     365    RuntimeMenuHelpActionType_About                = RT_BIT(4),
     366#endif /* !Q_WS_MAC */
     367    RuntimeMenuHelpActionType_All                  = 0xFFFF
     368};
     369
    266370/* Runtime UI visual-state types: */
    267371enum UIVisualStateType
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r49596 r49698  
    35533553        if (value != RuntimeMenuType_Invalid)
    35543554            result = static_cast<RuntimeMenuType>(result | value);
     3555    }
     3556    /* Return result: */
     3557    return result;
     3558}
     3559
     3560#ifdef Q_WS_MAC
     3561/* static */
     3562RuntimeMenuApplicationActionType VBoxGlobal::restrictedRuntimeMenuApplicationActionTypes(CMachine &machine)
     3563{
     3564    /* Prepare result: */
     3565    RuntimeMenuApplicationActionType result = RuntimeMenuApplicationActionType_Invalid;
     3566    /* Load restricted runtime-application-menu action-types: */
     3567    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeApplicationMenuActions));
     3568    QStringList list = strList.split(',');
     3569    /* Convert list into appropriate values: */
     3570    foreach (const QString &strValue, list)
     3571    {
     3572        RuntimeMenuApplicationActionType value = gpConverter->fromInternalString<RuntimeMenuApplicationActionType>(strValue);
     3573        if (value != RuntimeMenuApplicationActionType_Invalid)
     3574            result = static_cast<RuntimeMenuApplicationActionType>(result | value);
     3575    }
     3576    /* Return result: */
     3577    return result;
     3578}
     3579#endif /* Q_WS_MAC */
     3580
     3581/* static */
     3582RuntimeMenuMachineActionType VBoxGlobal::restrictedRuntimeMenuMachineActionTypes(CMachine &machine)
     3583{
     3584    /* Prepare result: */
     3585    RuntimeMenuMachineActionType result = RuntimeMenuMachineActionType_Invalid;
     3586    /* Load restricted runtime-machine-menu action-types: */
     3587    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeMachineMenuActions));
     3588    QStringList list = strList.split(',');
     3589    /* Convert list into appropriate values: */
     3590    foreach (const QString &strValue, list)
     3591    {
     3592        RuntimeMenuMachineActionType value = gpConverter->fromInternalString<RuntimeMenuMachineActionType>(strValue);
     3593        if (value != RuntimeMenuMachineActionType_Invalid)
     3594            result = static_cast<RuntimeMenuMachineActionType>(result | value);
     3595    }
     3596    /* Return result: */
     3597    return result;
     3598}
     3599
     3600/* static */
     3601RuntimeMenuViewActionType VBoxGlobal::restrictedRuntimeMenuViewActionTypes(CMachine &machine)
     3602{
     3603    /* Prepare result: */
     3604    RuntimeMenuViewActionType result = RuntimeMenuViewActionType_Invalid;
     3605    /* Load restricted runtime-view-menu action-types: */
     3606    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeViewMenuActions));
     3607    QStringList list = strList.split(',');
     3608    /* Convert list into appropriate values: */
     3609    foreach (const QString &strValue, list)
     3610    {
     3611        RuntimeMenuViewActionType value = gpConverter->fromInternalString<RuntimeMenuViewActionType>(strValue);
     3612        if (value != RuntimeMenuViewActionType_Invalid)
     3613            result = static_cast<RuntimeMenuViewActionType>(result | value);
     3614    }
     3615    /* Return result: */
     3616    return result;
     3617}
     3618
     3619/* static */
     3620RuntimeMenuDevicesActionType VBoxGlobal::restrictedRuntimeMenuDevicesActionTypes(CMachine &machine)
     3621{
     3622    /* Prepare result: */
     3623    RuntimeMenuDevicesActionType result = RuntimeMenuDevicesActionType_Invalid;
     3624    /* Load restricted runtime-devices-menu action-types: */
     3625    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeDevicesMenuActions));
     3626    QStringList list = strList.split(',');
     3627    /* Convert list into appropriate values: */
     3628    foreach (const QString &strValue, list)
     3629    {
     3630        RuntimeMenuDevicesActionType value = gpConverter->fromInternalString<RuntimeMenuDevicesActionType>(strValue);
     3631        if (value != RuntimeMenuDevicesActionType_Invalid)
     3632            result = static_cast<RuntimeMenuDevicesActionType>(result | value);
     3633    }
     3634    /* Return result: */
     3635    return result;
     3636}
     3637
     3638#ifdef VBOX_WITH_DEBUGGER_GUI
     3639/* static */
     3640RuntimeMenuDebuggerActionType VBoxGlobal::restrictedRuntimeMenuDebuggerActionTypes(CMachine &machine)
     3641{
     3642    /* Prepare result: */
     3643    RuntimeMenuDebuggerActionType result = RuntimeMenuDebuggerActionType_Invalid;
     3644    /* Load restricted runtime-debugger-menu action-types: */
     3645    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeDebuggerMenuActions));
     3646    QStringList list = strList.split(',');
     3647    /* Convert list into appropriate values: */
     3648    foreach (const QString &strValue, list)
     3649    {
     3650        RuntimeMenuDebuggerActionType value = gpConverter->fromInternalString<RuntimeMenuDebuggerActionType>(strValue);
     3651        if (value != RuntimeMenuDebuggerActionType_Invalid)
     3652            result = static_cast<RuntimeMenuDebuggerActionType>(result | value);
     3653    }
     3654    /* Return result: */
     3655    return result;
     3656}
     3657#endif /* VBOX_WITH_DEBUGGER_GUI */
     3658
     3659/* static */
     3660RuntimeMenuHelpActionType VBoxGlobal::restrictedRuntimeMenuHelpActionTypes(CMachine &machine)
     3661{
     3662    /* Prepare result: */
     3663    RuntimeMenuHelpActionType result = RuntimeMenuHelpActionType_Invalid;
     3664    /* Load restricted runtime-help-menu action-types: */
     3665    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeHelpMenuActions));
     3666    QStringList list = strList.split(',');
     3667    /* Convert list into appropriate values: */
     3668    foreach (const QString &strValue, list)
     3669    {
     3670        RuntimeMenuHelpActionType value = gpConverter->fromInternalString<RuntimeMenuHelpActionType>(strValue);
     3671        if (value != RuntimeMenuHelpActionType_Invalid)
     3672            result = static_cast<RuntimeMenuHelpActionType>(result | value);
    35553673    }
    35563674    /* Return result: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r49596 r49698  
    364364    static MachineCloseAction defaultMachineCloseAction(CMachine &machine);
    365365    static RuntimeMenuType restrictedRuntimeMenuTypes(CMachine &machine);
     366#ifdef Q_WS_MAC
     367    static RuntimeMenuApplicationActionType restrictedRuntimeMenuApplicationActionTypes(CMachine &machine);
     368#endif /* Q_WS_MAC */
     369    static RuntimeMenuMachineActionType restrictedRuntimeMenuMachineActionTypes(CMachine &machine);
     370    static RuntimeMenuViewActionType restrictedRuntimeMenuViewActionTypes(CMachine &machine);
     371    static RuntimeMenuDevicesActionType restrictedRuntimeMenuDevicesActionTypes(CMachine &machine);
     372#ifdef VBOX_WITH_DEBUGGER_GUI
     373    static RuntimeMenuDebuggerActionType restrictedRuntimeMenuDebuggerActionTypes(CMachine &machine);
     374#endif /* VBOX_WITH_DEBUGGER_GUI */
     375    static RuntimeMenuHelpActionType restrictedRuntimeMenuHelpActionTypes(CMachine &machine);
    366376    static UIVisualStateType restrictedVisualStateTypes(CMachine &machine);
    367377    static QList<IndicatorType> restrictedStatusBarIndicators(CMachine &machine);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp

    r49596 r49698  
    204204        return;
    205205
    206     /* Machine submenu: */
    207     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog));
    208     if (m_pSession->isSnapshotOperationsAllowed())
     206
     207    /* Separator #1? */
     208    bool fSeparator1 = false;
     209
     210    /* Settings Dialog action: */
     211    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_SettingsDialog)
     212    {
     213        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog));
     214        fSeparator1 = true;
     215    }
     216    else
     217        gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog)->setEnabled(false);
     218    /* Take Snapshot action: */
     219    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TakeSnapshot &&
     220        m_pSession->isSnapshotOperationsAllowed())
     221    {
    209222        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeSnapshot));
     223        fSeparator1 = true;
     224    }
    210225    else
    211226        gActionPool->action(UIActionIndexRuntime_Simple_TakeSnapshot)->setEnabled(false);
    212     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeScreenshot));
    213     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog));
    214     pMenu->addSeparator();
    215     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration));
    216     pMenu->addSeparator();
    217     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TypeCAD));
     227    /* Take Screenshot action: */
     228    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TakeScreenshot)
     229    {
     230        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeScreenshot));
     231        fSeparator1 = true;
     232    }
     233    else
     234        gActionPool->action(UIActionIndexRuntime_Simple_TakeScreenshot)->setEnabled(false);
     235    /* Information Dialog action: */
     236    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_InformationDialog)
     237    {
     238        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog));
     239        fSeparator1 = true;
     240    }
     241    else
     242        gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog)->setEnabled(false);
     243
     244    /* Separator #1: */
     245    if (fSeparator1)
     246        pMenu->addSeparator();
     247
     248
     249    /* Separator #2? */
     250    bool fSeparator2 = false;
     251
     252    /* Mouse Integration action: */
     253    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_MouseIntegration)
     254    {
     255        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration));
     256        fSeparator2 = true;
     257    }
     258    else
     259        gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration)->setEnabled(false);
     260
     261    /* Separator #2: */
     262    if (fSeparator2)
     263        pMenu->addSeparator();
     264
     265
     266    /* Separator #3? */
     267    bool fSeparator3 = false;
     268
     269    /* Type CAD action: */
     270    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TypeCAD)
     271    {
     272        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TypeCAD));
     273        fSeparator3 = true;
     274    }
     275    else
     276        gActionPool->action(UIActionIndexRuntime_Simple_TypeCAD)->setEnabled(false);
    218277#ifdef Q_WS_X11
    219     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TypeCABS));
     278    /* Type CABS action: */
     279    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TypeCABS)
     280    {
     281        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TypeCABS));
     282        fSeparator3 = true;
     283    }
     284    else
     285        gActionPool->action(UIActionIndexRuntime_Simple_TypeCABS)->setEnabled(false);
    220286#endif /* Q_WS_X11 */
    221     pMenu->addSeparator();
    222     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Pause));
    223     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Reset));
    224     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Shutdown));
     287
     288    /* Separator #3: */
     289    if (fSeparator3)
     290        pMenu->addSeparator();
     291
     292
     293    /* Separator #4? */
     294    bool fSeparator4 = false;
     295
     296    /* Pause action: */
     297    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_Pause)
     298    {
     299        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Pause));
     300        fSeparator4 = true;
     301    }
     302    else
     303        gActionPool->action(UIActionIndexRuntime_Toggle_Pause)->setEnabled(false);
     304    /* Reset action: */
     305    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_Reset)
     306    {
     307        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Reset));
     308        fSeparator4 = true;
     309    }
     310    else
     311        gActionPool->action(UIActionIndexRuntime_Simple_Reset)->setEnabled(false);
     312    /* SaveState action: */
     313    if (!(m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_SaveState))
     314        gActionPool->action(UIActionIndexRuntime_Simple_Save)->setEnabled(false);
     315    /* Shutdown action: */
     316    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_Shutdown)
     317    {
     318        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Shutdown));
     319        fSeparator4 = true;
     320    }
     321    else
     322        gActionPool->action(UIActionIndexRuntime_Simple_Shutdown)->setEnabled(false);
     323    /* PowerOff action: */
     324    if (!(m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_PowerOff))
     325        gActionPool->action(UIActionIndexRuntime_Simple_PowerOff)->setEnabled(false);
     326
    225327#ifndef Q_WS_MAC
    226     pMenu->addSeparator();
     328    /* Separator #3: */
     329    if (fSeparator4)
     330        pMenu->addSeparator();
    227331#endif /* !Q_WS_MAC */
     332
     333
     334    /* Close action: */
    228335    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Close));
    229336    if (m_pSession->isAllCloseActionsRestricted())
     
    237344        return;
    238345
    239     /* View submenu: */
    240     bool fIsAllowedFullscreen = m_pSession->isVisualStateAllowedFullscreen();
    241     bool fIsAllowedSeamless = m_pSession->isVisualStateAllowedSeamless();
    242     bool fIsAllowedScale = m_pSession->isVisualStateAllowedScale();
     346
     347    /* Mode flags: */
     348    bool fIsAllowedFullscreen = m_pSession->isVisualStateAllowedFullscreen() &&
     349                                (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_Fullscreen);
     350    bool fIsAllowedSeamless = m_pSession->isVisualStateAllowedSeamless() &&
     351                              (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_Seamless);
     352    bool fIsAllowedScale = m_pSession->isVisualStateAllowedScale() &&
     353                           (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_Scale);
     354
     355    /* Fullscreen action: */
    243356    gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen)->setEnabled(fIsAllowedFullscreen);
    244357    if (fIsAllowedFullscreen)
    245358        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen));
     359
     360    /* Seamless action: */
    246361    gActionPool->action(UIActionIndexRuntime_Toggle_Seamless)->setEnabled(fIsAllowedSeamless);
    247362    if (fIsAllowedSeamless)
    248363        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless));
     364
     365    /* Scale action: */
    249366    gActionPool->action(UIActionIndexRuntime_Toggle_Scale)->setEnabled(fIsAllowedScale);
    250367    if (fIsAllowedScale)
    251368        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Scale));
     369
     370    /* Mode separator: */
    252371    if (fIsAllowedFullscreen || fIsAllowedSeamless || fIsAllowedScale)
    253372        pMenu->addSeparator();
    254     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize));
    255     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow));
     373
     374
     375    /* Guest Autoresize action: */
     376    if (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_GuestAutoresize)
     377        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize));
     378    else
     379        gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setEnabled(false);
     380
     381    /* Adjust Window action: */
     382    if (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_AdjustWindow)
     383        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow));
     384    else
     385        gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setEnabled(false);
    256386}
    257387
     
    262392        return;
    263393
    264     /* Devices submenu: */
    265     pMenu->addMenu(gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices)->menu());
    266     pMenu->addMenu(gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices)->menu());
    267     pMenu->addMenu(gActionPool->action(UIActionIndexRuntime_Menu_USBDevices)->menu());
    268     pMenu->addMenu(gActionPool->action(UIActionIndexRuntime_Menu_WebCams)->menu());
    269     pMenu->addMenu(gActionPool->action(UIActionIndexRuntime_Menu_SharedClipboard)->menu());
    270     pMenu->addMenu(gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop)->menu());
    271     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings));
    272     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings));
    273     pMenu->addSeparator();
    274     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer));
    275     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture));
    276     pMenu->addSeparator();
    277     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools));
     394
     395    /* Separator #1? */
     396    bool fSeparator1 = false;
     397
     398    /* Optical Devices submenu: */
     399    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_OpticalDevices)
     400    {
     401        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices));
     402        fSeparator1 = true;
     403    }
     404    else
     405        gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices)->setEnabled(false);
     406    /* Floppy Devices submenu: */
     407    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_FloppyDevices)
     408    {
     409        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices));
     410        fSeparator1 = true;
     411    }
     412    else
     413        gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices)->setEnabled(false);
     414    /* USB Devices submenu: */
     415    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_USBDevices)
     416    {
     417        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_USBDevices));
     418        fSeparator1 = true;
     419    }
     420    else
     421        gActionPool->action(UIActionIndexRuntime_Menu_USBDevices)->setEnabled(false);
     422    /* Web Cams submenu: */
     423    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_WebCams)
     424    {
     425        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_WebCams));
     426        fSeparator1 = true;
     427    }
     428    else
     429        gActionPool->action(UIActionIndexRuntime_Menu_WebCams)->setEnabled(false);
     430    /* Shared Clipboard submenu: */
     431    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_SharedClipboard)
     432    {
     433        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_SharedClipboard));
     434        fSeparator1 = true;
     435    }
     436    else
     437        gActionPool->action(UIActionIndexRuntime_Menu_SharedClipboard)->setEnabled(false);
     438    /* Drag&Drop submenu: */
     439    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_DragAndDrop)
     440    {
     441        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop));
     442        fSeparator1 = true;
     443    }
     444    else
     445        gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop)->setEnabled(false);
     446    /* Network Settings action: */
     447    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_NetworkSettings)
     448    {
     449        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings));
     450        fSeparator1 = true;
     451    }
     452    else
     453        gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings)->setEnabled(false);
     454    /* Shared Folders Settings action: */
     455    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_SharedFoldersSettings)
     456    {
     457        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings));
     458        fSeparator1 = true;
     459    }
     460    else
     461        gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings)->setEnabled(false);
     462
     463    /* Separator #1: */
     464    if (fSeparator1)
     465        pMenu->addSeparator();
     466
     467
     468    /* Separator #2? */
     469    bool fSeparator2 = false;
     470
     471    /* VRDE Server action: */
     472    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_VRDEServer)
     473    {
     474        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer));
     475        fSeparator2 = true;
     476    }
     477    else
     478        gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer)->setEnabled(false);
     479    /* Video Capture action: */
     480    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_VideoCapture)
     481    {
     482        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture));
     483        fSeparator2 = true;
     484    }
     485    else
     486        gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture)->setEnabled(false);
     487
     488    /* Separator #2: */
     489    if (fSeparator2)
     490        pMenu->addSeparator();
     491
     492
     493    /* Install Guest Tools action: */
     494    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_InstallGuestTools)
     495        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools));
     496    else
     497        gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools)->setEnabled(false);
    278498}
    279499
     
    285505        return;
    286506
    287     /* Debug submenu: */
    288     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Statistics));
    289     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_CommandLine));
    290     pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Logging));
    291     pMenu->addAction(gActionPool->action(UIActionIndex_Simple_LogDialog));
     507    /* Statistics action: */
     508    if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_Statistics)
     509        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Statistics));
     510    else
     511        gActionPool->action(UIActionIndexRuntime_Simple_Statistics)->setEnabled(false);
     512    /* Command Line action: */
     513    if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_CommandLine)
     514        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_CommandLine));
     515    else
     516        gActionPool->action(UIActionIndexRuntime_Simple_CommandLine)->setEnabled(false);
     517    /* Logging action: */
     518    if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_Logging)
     519        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Logging));
     520    else
     521        gActionPool->action(UIActionIndexRuntime_Toggle_Logging)->setEnabled(false);
     522    /* Log Dialog action: */
     523    if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_LogDialog)
     524        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_LogDialog));
     525    else
     526        gActionPool->action(UIActionIndex_Simple_LogDialog)->setEnabled(false);
    292527}
    293528#endif /* VBOX_WITH_DEBUGGER_GUI */
     
    299534        return;
    300535
    301     /* Help submenu: */
    302     pMenu->addAction(gActionPool->action(UIActionIndex_Simple_Contents));
    303     pMenu->addAction(gActionPool->action(UIActionIndex_Simple_WebSite));
    304     pMenu->addSeparator();
    305     pMenu->addAction(gActionPool->action(UIActionIndex_Simple_ResetWarnings));
    306     pMenu->addSeparator();
     536
     537    /* Separator #1? */
     538    bool fSeparator1 = false;
     539
     540    /* Contents action: */
     541    if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_Contents)
     542    {
     543        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_Contents));
     544        VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_Contents), SIGNAL(triggered()),
     545                            &msgCenter(), SLOT(sltShowHelpHelpDialog()));
     546        fSeparator1 = true;
     547    }
     548    else
     549        gActionPool->action(UIActionIndex_Simple_Contents)->setEnabled(false);
     550    /* Web Site action: */
     551    if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_WebSite)
     552    {
     553        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_WebSite));
     554        VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_WebSite), SIGNAL(triggered()),
     555                            &msgCenter(), SLOT(sltShowHelpWebDialog()));
     556        fSeparator1 = true;
     557    }
     558    else
     559        gActionPool->action(RuntimeMenuHelpActionType_WebSite)->setEnabled(false);
     560
     561    /* Separator #1: */
     562    if (fSeparator1)
     563        pMenu->addSeparator();
     564
     565
     566    /* Separator #2? */
     567    bool fSeparator2 = false;
     568
     569    /* Reset Warnings action: */
     570    if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_ResetWarnings)
     571    {
     572        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_ResetWarnings));
     573        VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_ResetWarnings), SIGNAL(triggered()),
     574                            &msgCenter(), SLOT(sltResetSuppressedMessages()));
     575        fSeparator2 = true;
     576    }
     577    else
     578        gActionPool->action(UIActionIndex_Simple_ResetWarnings)->setEnabled(false);
     579
     580    /* Separator #2: */
     581    if (fSeparator2)
     582        pMenu->addSeparator();
     583
     584
    307585#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    308     pMenu->addAction(gActionPool->action(UIActionIndex_Simple_NetworkAccessManager));
     586# ifndef Q_WS_MAC
     587    /* Separator #3? */
     588    bool fSeparator3 = false;
     589# endif /* !Q_WS_MAC */
     590
     591    /* Reset Warnings action: */
     592    if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_NetworkAccessManager)
     593    {
     594        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_NetworkAccessManager));
     595        VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_NetworkAccessManager), SIGNAL(triggered()),
     596                            gNetworkManager, SLOT(show()));
     597# ifndef Q_WS_MAC
     598        fSeparator3 = true;
     599# endif /* !Q_WS_MAC */
     600    }
     601    else
     602        gActionPool->action(UIActionIndex_Simple_NetworkAccessManager)->setEnabled(false);
     603
     604# ifndef Q_WS_MAC
     605    /* Separator #3: */
     606    if (fSeparator3)
     607        pMenu->addSeparator();
     608# endif /* !Q_WS_MAC */
    309609#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    310 #ifndef Q_WS_MAC
    311     pMenu->addSeparator();
    312 #endif /* !Q_WS_MAC */
    313     pMenu->addAction(gActionPool->action(UIActionIndex_Simple_About));
    314 
    315     /* Prepare connections: */
    316     VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_Contents), SIGNAL(triggered()),
    317                         &msgCenter(), SLOT(sltShowHelpHelpDialog()));
    318     VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_WebSite), SIGNAL(triggered()),
    319                         &msgCenter(), SLOT(sltShowHelpWebDialog()));
    320     VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_ResetWarnings), SIGNAL(triggered()),
    321                         &msgCenter(), SLOT(sltResetSuppressedMessages()));
    322 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    323     VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_NetworkAccessManager), SIGNAL(triggered()),
    324                         gNetworkManager, SLOT(show()));
    325 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    326     VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_About), SIGNAL(triggered()),
    327                         &msgCenter(), SLOT(sltShowHelpAboutDialog()));
     610
     611
     612    /* About action: */
     613#ifdef Q_WS_MAC
     614    if (m_pSession->allowedActionsMenuApplication() & RuntimeMenuApplicationActionType_About)
     615#else /* !Q_WS_MAC */
     616    if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_About)
     617#endif /* Q_WS_MAC */
     618    {
     619        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_About));
     620        VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_About), SIGNAL(triggered()),
     621                            &msgCenter(), SLOT(sltShowHelpAboutDialog()));
     622    }
     623    else
     624        gActionPool->action(UIActionIndex_Simple_About)->setEnabled(false);
    328625}
    329626
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp

    r49306 r49698  
    360360void UIMultiScreenLayout::updateMenuActions(bool fWithSave)
    361361{
     362    /* Make sure view-menu was set: */
     363    if (!m_pViewMenu)
     364        return;
     365
    362366    /* Get the list of all view-menu actions: */
    363367    QList<QAction*> viewMenuActions = gActionPool->action(UIActionIndexRuntime_Menu_View)->menu()->actions();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r49574 r49698  
    11071107    /* Load extra-data settings: */
    11081108    {
     1109        /* Runtime menu settings: */
     1110#ifdef Q_WS_MAC
     1111        m_allowedActionsMenuApplication = (RuntimeMenuApplicationActionType)
     1112                                          (vboxGlobal().restrictedRuntimeMenuApplicationActionTypes(machine) ^
     1113                                           RuntimeMenuApplicationActionType_All);
     1114#endif /* Q_WS_MAC */
     1115        m_allowedActionsMenuMachine     = (RuntimeMenuMachineActionType)
     1116                                          (vboxGlobal().restrictedRuntimeMenuMachineActionTypes(machine) ^
     1117                                           RuntimeMenuMachineActionType_All);
     1118        m_allowedActionsMenuView        = (RuntimeMenuViewActionType)
     1119                                          (vboxGlobal().restrictedRuntimeMenuViewActionTypes(machine) ^
     1120                                           RuntimeMenuViewActionType_All);
     1121        m_allowedActionsMenuDevices     = (RuntimeMenuDevicesActionType)
     1122                                          (vboxGlobal().restrictedRuntimeMenuDevicesActionTypes(machine) ^
     1123                                           RuntimeMenuDevicesActionType_All);
     1124#ifdef VBOX_WITH_DEBUGGER_GUI
     1125        m_allowedActionsMenuDebugger    = (RuntimeMenuDebuggerActionType)
     1126                                          (vboxGlobal().restrictedRuntimeMenuDebuggerActionTypes(machine) ^
     1127                                           RuntimeMenuDebuggerActionType_All);
     1128#endif /* VBOX_WITH_DEBUGGER_GUI */
     1129        m_allowedActionsMenuHelp        = (RuntimeMenuHelpActionType)
     1130                                          (vboxGlobal().restrictedRuntimeMenuHelpActionTypes(machine) ^
     1131                                           RuntimeMenuHelpActionType_All);
     1132
    11091133        /* Temporary: */
    11101134        QString strSettings;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r49574 r49698  
    9494    QCursor cursor() const { return m_cursor; }
    9595
     96    /** @name Runtime menus configuration stuff.
     97     ** @{ */
     98#ifdef Q_WS_MAC
     99    /** Determines Application menu allowed actions. */
     100    RuntimeMenuApplicationActionType allowedActionsMenuApplication() const { return m_allowedActionsMenuApplication; }
     101#endif /* Q_WS_MAC */
     102    /** Determines Machine menu allowed actions. */
     103    RuntimeMenuMachineActionType allowedActionsMenuMachine() const { return m_allowedActionsMenuMachine; }
     104    /** Determines View menu allowed actions. */
     105    RuntimeMenuViewActionType allowedActionsMenuView() const { return m_allowedActionsMenuView; }
     106    /** Determines Devices menu allowed actions. */
     107    RuntimeMenuDevicesActionType allowedActionsMenuDevices() const { return m_allowedActionsMenuDevices; }
     108#ifdef VBOX_WITH_DEBUGGER_GUI
     109    /** Determines Debugger menu allowed actions. */
     110    RuntimeMenuDebuggerActionType allowedActionsMenuDebugger() const { return m_allowedActionsMenuDebugger; }
     111#endif /* VBOX_WITH_DEBUGGER_GUI */
     112    /** Determines Help menu allowed actions. */
     113    RuntimeMenuHelpActionType allowedActionsMenuHelp() const { return m_allowedActionsMenuHelp; }
     114    /** @} */
     115
    96116    /** @name Application Close configuration stuff.
    97117     * @{ */
     
    313333    QCursor m_cursor;
    314334
     335    /** @name Runtime menus configuration variables.
     336     ** @{ */
     337#ifdef Q_WS_MAC
     338    /** Determines Application menu allowed actions. */
     339    RuntimeMenuApplicationActionType m_allowedActionsMenuApplication;
     340#endif /* Q_WS_MAC */
     341    /** Determines Machine menu allowed actions. */
     342    RuntimeMenuMachineActionType m_allowedActionsMenuMachine;
     343    /** Determines View menu allowed actions. */
     344    RuntimeMenuViewActionType m_allowedActionsMenuView;
     345    /** Determines Devices menu allowed actions. */
     346    RuntimeMenuDevicesActionType m_allowedActionsMenuDevices;
     347#ifdef VBOX_WITH_DEBUGGER_GUI
     348    /** Determines Debugger menu allowed actions. */
     349    RuntimeMenuDebuggerActionType m_allowedActionsMenuDebugger;
     350#endif /* VBOX_WITH_DEBUGGER_GUI */
     351    /** Determines Help menu allowed actions. */
     352    RuntimeMenuHelpActionType m_allowedActionsMenuHelp;
     353    /** @} */
     354
    315355    /** @name Visual-state configuration variables.
    316356     ** @{ */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r49505 r49698  
    239239    UIMachineLogic::prepareMenu();
    240240
    241     /* Finally update view-menu: */
    242     m_pScreenLayout->setViewMenu(gActionPool->action(UIActionIndexRuntime_Menu_View)->menu());
     241    /* Finally update view-menu, if necessary: */
     242    if (uisession()->allowedActionsMenuView() & RuntimeMenuViewActionType_Multiscreen)
     243        m_pScreenLayout->setViewMenu(gActionPool->action(UIActionIndexRuntime_Menu_View)->menu());
    243244}
    244245
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r49506 r49698  
    240240    UIMachineLogic::prepareMenu();
    241241
    242     /* Finally update view-menu: */
    243     m_pScreenLayout->setViewMenu(gActionPool->action(UIActionIndexRuntime_Menu_View)->menu());
     242    /* Finally update view-menu, if necessary: */
     243    if (uisession()->allowedActionsMenuView() & RuntimeMenuViewActionType_Multiscreen)
     244        m_pScreenLayout->setViewMenu(gActionPool->action(UIActionIndexRuntime_Menu_View)->menu());
    244245}
    245246
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