VirtualBox

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


Ignore:
Timestamp:
May 26, 2014 2:04:39 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Extending action-pool with Keyboard Settings action which can be called from Keyboard Status-bar Indicator's context-menu.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r51214 r51398  
    437437        case RuntimeMenuMachineActionType_TakeScreenshot:    strResult = "TakeScreenshot"; break;
    438438        case RuntimeMenuMachineActionType_InformationDialog: strResult = "InformationDialog"; break;
     439        case RuntimeMenuMachineActionType_KeyboardSettings:  strResult = "KeyboardSettings"; break;
    439440        case RuntimeMenuMachineActionType_MouseIntegration:  strResult = "MouseIntegration"; break;
    440441        case RuntimeMenuMachineActionType_TypeCAD:           strResult = "TypeCAD"; break;
     
    470471    keys << "TakeScreenshot";    values << RuntimeMenuMachineActionType_TakeScreenshot;
    471472    keys << "InformationDialog"; values << RuntimeMenuMachineActionType_InformationDialog;
     473    keys << "KeyboardSettings";  values << RuntimeMenuMachineActionType_KeyboardSettings;
    472474    keys << "MouseIntegration";  values << RuntimeMenuMachineActionType_MouseIntegration;
    473475    keys << "TypeCAD";           values << RuntimeMenuMachineActionType_TypeCAD;
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r51392 r51398  
    264264    RuntimeMenuMachineActionType_TakeScreenshot    = RT_BIT(2),
    265265    RuntimeMenuMachineActionType_InformationDialog = RT_BIT(3),
    266     RuntimeMenuMachineActionType_MouseIntegration  = RT_BIT(4),
    267     RuntimeMenuMachineActionType_TypeCAD           = RT_BIT(5),
     266    RuntimeMenuMachineActionType_KeyboardSettings  = RT_BIT(4),
     267    RuntimeMenuMachineActionType_MouseIntegration  = RT_BIT(5),
     268    RuntimeMenuMachineActionType_TypeCAD           = RT_BIT(6),
    268269#ifdef Q_WS_X11
    269     RuntimeMenuMachineActionType_TypeCABS          = RT_BIT(6),
     270    RuntimeMenuMachineActionType_TypeCABS          = RT_BIT(7),
    270271#endif /* Q_WS_X11 */
    271     RuntimeMenuMachineActionType_Pause             = RT_BIT(7),
    272     RuntimeMenuMachineActionType_Reset             = RT_BIT(8),
    273     RuntimeMenuMachineActionType_SaveState         = RT_BIT(9),
    274     RuntimeMenuMachineActionType_Shutdown          = RT_BIT(10),
    275     RuntimeMenuMachineActionType_PowerOff          = RT_BIT(11),
     272    RuntimeMenuMachineActionType_Pause             = RT_BIT(8),
     273    RuntimeMenuMachineActionType_Reset             = RT_BIT(9),
     274    RuntimeMenuMachineActionType_SaveState         = RT_BIT(10),
     275    RuntimeMenuMachineActionType_Shutdown          = RT_BIT(11),
     276    RuntimeMenuMachineActionType_PowerOff          = RT_BIT(12),
    276277#ifndef Q_WS_MAC
    277     RuntimeMenuMachineActionType_Close             = RT_BIT(12),
     278    RuntimeMenuMachineActionType_Close             = RT_BIT(13),
    278279#endif /* !Q_WS_MAC */
    279280    RuntimeMenuMachineActionType_All               = 0xFFFF
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r51379 r51398  
    167167};
    168168
     169class UIActionMenuKeyboard : public UIActionMenu
     170{
     171    Q_OBJECT;
     172
     173public:
     174
     175    UIActionMenuKeyboard(UIActionPool *pParent)
     176        : UIActionMenu(pParent)
     177    {
     178        retranslateUi();
     179    }
     180
     181protected:
     182
     183    void retranslateUi() {}
     184};
     185
     186class UIActionSimpleKeyboardSettings : public UIActionSimple
     187{
     188    Q_OBJECT;
     189
     190public:
     191
     192    UIActionSimpleKeyboardSettings(UIActionPool *pParent)
     193        : UIActionSimple(pParent, ":/hostkey_16px.png")
     194    {
     195        retranslateUi();
     196    }
     197
     198protected:
     199
     200    QString shortcutExtraDataID() const
     201    {
     202        return QString("KeyboardSettings");
     203    }
     204
     205    void retranslateUi()
     206    {
     207        setName(QApplication::translate("UIActionPool", "Configure &Shortcuts"));
     208        setStatusTip(QApplication::translate("UIActionPool", "Display the global settings window to configure shortcuts"));
     209    }
     210};
     211
    169212class UIActionMenuMouseIntegration : public UIActionMenu
    170213{
     
    12741317    m_pool[UIActionIndexRuntime_Simple_TakeScreenshot] = new UIActionSimplePerformTakeScreenshot(this);
    12751318    m_pool[UIActionIndexRuntime_Simple_InformationDialog] = new UIActionSimpleShowInformationDialog(this);
     1319    m_pool[UIActionIndexRuntime_Simple_KeyboardSettings] = new UIActionSimpleKeyboardSettings(this);
    12761320    m_pool[UIActionIndexRuntime_Toggle_MouseIntegration] = new UIActionToggleMouseIntegration(this);
    12771321    m_pool[UIActionIndexRuntime_Simple_TypeCAD] = new UIActionSimplePerformTypeCAD(this);
     
    13351379        delete m_pool[UIActionIndexRuntime_Menu_Machine];
    13361380    m_pool[UIActionIndexRuntime_Menu_Machine] = new UIActionMenuMachineRuntime(this);
     1381    if (m_pool[UIActionIndexRuntime_Menu_Keyboard])
     1382        delete m_pool[UIActionIndexRuntime_Menu_Keyboard];
     1383    m_pool[UIActionIndexRuntime_Menu_Keyboard] = new UIActionMenuKeyboard(this);
    13371384    if (m_pool[UIActionIndexRuntime_Menu_MouseIntegration])
    13381385        delete m_pool[UIActionIndexRuntime_Menu_MouseIntegration];
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r51375 r51398  
    3232    UIActionIndexRuntime_Simple_TakeScreenshot,
    3333    UIActionIndexRuntime_Simple_InformationDialog,
     34    UIActionIndexRuntime_Menu_Keyboard,
     35    UIActionIndexRuntime_Simple_KeyboardSettings,
    3436    UIActionIndexRuntime_Menu_MouseIntegration,
    3537    UIActionIndexRuntime_Toggle_MouseIntegration,
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r51395 r51398  
    855855    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeScreenshot));
    856856    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog));
     857    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_Keyboard));
     858    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_KeyboardSettings));
    857859    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_MouseIntegration));
    858860    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration));
     
    891893    connect(gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog), SIGNAL(triggered()),
    892894            this, SLOT(sltShowInformationDialog()));
     895    connect(gActionPool->action(UIActionIndexRuntime_Simple_KeyboardSettings), SIGNAL(triggered()),
     896            this, SLOT(sltShowKeyboardSettings()));
    893897    connect(gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration), SIGNAL(toggled(bool)),
    894898            this, SLOT(sltToggleMouseIntegration(bool)));
     
    11981202}
    11991203
     1204void UIMachineLogic::sltShowKeyboardSettings()
     1205{
     1206    /* Do not process if window(s) missed! */
     1207    if (!isMachineWindowsCreated())
     1208        return;
     1209
     1210    /* Open Global Preferences: Input page: */
     1211    showGlobalPreferences("#input", "m_pMachineTable");
     1212}
     1213
    12001214void UIMachineLogic::sltToggleMouseIntegration(bool fOff)
    12011215{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r51395 r51398  
    191191    void sltToggleGuestAutoresize(bool fEnabled);
    192192    void sltAdjustWindow();
     193    void sltShowKeyboardSettings();
    193194    void sltToggleMouseIntegration(bool fDisabled);
    194195    void sltTypeCAD();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp

    r51397 r51398  
    251251    bool fSeparator2 = false;
    252252
     253    /* Keyboard Settings action: */
     254    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_KeyboardSettings)
     255    {
     256//        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_KeyboardSettings));
     257//        fSeparator2 = true;
     258    }
     259    else
     260        gActionPool->action(UIActionIndexRuntime_Simple_KeyboardSettings)->setEnabled(false);
     261
    253262    /* Mouse Integration action: */
    254263    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_MouseIntegration)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r51249 r51398  
    9393}
    9494
     95void UIMachineLogicNormal::sltPrepareKeyboardMenu()
     96{
     97    QMenu *pMenu = qobject_cast<QMenu*>(sender());
     98    AssertMsg(pMenu, ("This slot should be called only on Keyboard menu show!\n"));
     99    pMenu->clear();
     100    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_KeyboardSettings));
     101}
     102
    95103void UIMachineLogicNormal::sltPrepareMouseIntegrationMenu()
    96104{
     
    121129    connect(gActionPool->action(UIActionIndexRuntime_Menu_VideoCapture)->menu(), SIGNAL(aboutToShow()),
    122130            this, SLOT(sltPrepareVideoCaptureMenu()));
     131    connect(gActionPool->action(UIActionIndexRuntime_Menu_Keyboard)->menu(), SIGNAL(aboutToShow()),
     132            this, SLOT(sltPrepareKeyboardMenu()));
    123133    connect(gActionPool->action(UIActionIndexRuntime_Menu_MouseIntegration)->menu(), SIGNAL(aboutToShow()),
    124134            this, SLOT(sltPrepareMouseIntegrationMenu()));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h

    r50309 r51398  
    4343    void sltPrepareSharedFoldersMenu();
    4444    void sltPrepareVideoCaptureMenu();
     45    void sltPrepareKeyboardMenu();
    4546    void sltPrepareMouseIntegrationMenu();
    4647
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r51322 r51398  
    182182            gActionPool->action(UIActionIndexRuntime_Menu_MouseIntegration)->menu()->exec(pEvent->globalPos());
    183183    }
     184    /* Show keyboard LED context menu: */
     185    else if (pIndicator == indicatorsPool()->indicator(IndicatorType_Keyboard))
     186    {
     187        if (gActionPool->action(UIActionIndexRuntime_Menu_Keyboard)->isEnabled())
     188            gActionPool->action(UIActionIndexRuntime_Menu_Keyboard)->menu()->exec(pEvent->globalPos());
     189    }
    184190}
    185191
     
    352358            pIndicatorBoxHLayout->addWidget(pContainerWidgetHostkey);
    353359        }
     360        connect(pLedKeyboard, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
     361                this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
    354362    }
    355363
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