VirtualBox

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


Ignore:
Timestamp:
Nov 14, 2016 2:19:26 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7462: Runtime UI: Action Pool: Extend Input menu / Keyboard sub-menu with PrintScreen & Alt + PrintScreen actions.

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

Legend:

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

    r62493 r64659  
    669669    switch (runtimeMenuInputActionType)
    670670    {
    671         case UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard:          strResult = "Keyboard"; break;
    672         case UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings:  strResult = "KeyboardSettings"; break;
    673         case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD:           strResult = "TypeCAD"; break;
     671        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard:           strResult = "Keyboard"; break;
     672        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings:   strResult = "KeyboardSettings"; break;
     673        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD:            strResult = "TypeCAD"; break;
    674674#ifdef VBOX_WS_X11
    675         case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS:          strResult = "TypeCABS"; break;
     675        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS:           strResult = "TypeCABS"; break;
    676676#endif /* VBOX_WS_X11 */
    677         case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak:     strResult = "TypeCtrlBreak"; break;
    678         case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert:        strResult = "TypeInsert"; break;
    679         case UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse:             strResult = "Mouse"; break;
    680         case UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration:  strResult = "MouseIntegration"; break;
    681         case UIExtraDataMetaDefs::RuntimeMenuInputActionType_All:               strResult = "All"; break;
     677        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak:      strResult = "TypeCtrlBreak"; break;
     678        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert:         strResult = "TypeInsert"; break;
     679        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypePrintScreen:    strResult = "TypePrintScreen"; break;
     680        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeAltPrintScreen: strResult = "TypeAltPrintScreen"; break;
     681        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse:              strResult = "Mouse"; break;
     682        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration:   strResult = "MouseIntegration"; break;
     683        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_All:                strResult = "All"; break;
    682684        default:
    683685        {
     
    694696    /* Here we have some fancy stuff allowing us
    695697     * to search through the keys using 'case-insensitive' rule: */
    696     QStringList keys;            QList<UIExtraDataMetaDefs::RuntimeMenuInputActionType> values;
    697     keys << "Keyboard";          values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard;
    698     keys << "KeyboardSettings";  values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings;
    699     keys << "TypeCAD";           values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD;
     698    QStringList keys;             QList<UIExtraDataMetaDefs::RuntimeMenuInputActionType> values;
     699    keys << "Keyboard";           values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard;
     700    keys << "KeyboardSettings";   values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings;
     701    keys << "TypeCAD";            values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD;
    700702#ifdef VBOX_WS_X11
    701     keys << "TypeCABS";          values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS;
     703    keys << "TypeCABS";           values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS;
    702704#endif /* VBOX_WS_X11 */
    703     keys << "TypeCtrlBreak";     values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak;
    704     keys << "TypeInsert";        values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert;
    705     keys << "Mouse";             values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse;
    706     keys << "MouseIntegration";  values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration;
    707     keys << "All";               values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_All;
     705    keys << "TypeCtrlBreak";      values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak;
     706    keys << "TypeInsert";         values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert;
     707    keys << "TypePrintScreen";    values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypePrintScreen;
     708    keys << "TypeAltPrintScreen"; values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeAltPrintScreen;
     709    keys << "Mouse";              values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse;
     710    keys << "MouseIntegration";   values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration;
     711    keys << "All";                values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_All;
    708712    /* Invalid type for unknown words: */
    709713    if (!keys.contains(strRuntimeMenuInputActionType, Qt::CaseInsensitive))
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r62493 r64659  
    426426    enum RuntimeMenuInputActionType
    427427    {
    428         RuntimeMenuInputActionType_Invalid           = 0,
    429         RuntimeMenuInputActionType_Keyboard          = RT_BIT(0),
    430         RuntimeMenuInputActionType_KeyboardSettings  = RT_BIT(1),
    431         RuntimeMenuInputActionType_TypeCAD           = RT_BIT(2),
     428        RuntimeMenuInputActionType_Invalid            = 0,
     429        RuntimeMenuInputActionType_Keyboard           = RT_BIT(0),
     430        RuntimeMenuInputActionType_KeyboardSettings   = RT_BIT(1),
     431        RuntimeMenuInputActionType_TypeCAD            = RT_BIT(2),
    432432#ifdef VBOX_WS_X11
    433         RuntimeMenuInputActionType_TypeCABS          = RT_BIT(3),
     433        RuntimeMenuInputActionType_TypeCABS           = RT_BIT(3),
    434434#endif /* VBOX_WS_X11 */
    435         RuntimeMenuInputActionType_TypeCtrlBreak     = RT_BIT(4),
    436         RuntimeMenuInputActionType_TypeInsert        = RT_BIT(5),
    437         RuntimeMenuInputActionType_Mouse             = RT_BIT(6),
    438         RuntimeMenuInputActionType_MouseIntegration  = RT_BIT(7),
    439         RuntimeMenuInputActionType_All               = 0xFFFF
     435        RuntimeMenuInputActionType_TypeCtrlBreak      = RT_BIT(4),
     436        RuntimeMenuInputActionType_TypeInsert         = RT_BIT(5),
     437        RuntimeMenuInputActionType_TypePrintScreen    = RT_BIT(6),
     438        RuntimeMenuInputActionType_TypeAltPrintScreen = RT_BIT(7),
     439        RuntimeMenuInputActionType_Mouse              = RT_BIT(8),
     440        RuntimeMenuInputActionType_MouseIntegration   = RT_BIT(9),
     441        RuntimeMenuInputActionType_All                = 0xFFFF
    440442    };
    441443
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r62493 r64659  
    11881188        setName(QApplication::translate("UIActionPool", "&Insert %1", "that means send the %1 key sequence to the virtual machine").arg("Insert"));
    11891189        setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Insert"));
     1190    }
     1191};
     1192
     1193class UIActionSimplePerformTypePrintScreen : public UIActionSimple
     1194{
     1195    Q_OBJECT;
     1196
     1197public:
     1198
     1199    UIActionSimplePerformTypePrintScreen(UIActionPool *pParent)
     1200        : UIActionSimple(pParent, ":/hostkey_16px.png", ":/hostkey_disabled_16px.png") {}
     1201
     1202protected:
     1203
     1204    /** Returns action extra-data ID. */
     1205    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypePrintScreen; }
     1206    /** Returns action extra-data key. */
     1207    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypePrintScreen); }
     1208    /** Returns whether action is allowed. */
     1209    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypePrintScreen); }
     1210
     1211    QString shortcutExtraDataID() const
     1212    {
     1213        return QString("TypePrintScreen");
     1214    }
     1215
     1216    void retranslateUi()
     1217    {
     1218        setName(QApplication::translate("UIActionPool", "&Insert %1", "that means send the %1 key sequence to the virtual machine").arg("Print Screen"));
     1219        setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Print Screen"));
     1220    }
     1221};
     1222
     1223class UIActionSimplePerformTypeAltPrintScreen : public UIActionSimple
     1224{
     1225    Q_OBJECT;
     1226
     1227public:
     1228
     1229    UIActionSimplePerformTypeAltPrintScreen(UIActionPool *pParent)
     1230        : UIActionSimple(pParent, ":/hostkey_16px.png", ":/hostkey_disabled_16px.png") {}
     1231
     1232protected:
     1233
     1234    /** Returns action extra-data ID. */
     1235    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeAltPrintScreen; }
     1236    /** Returns action extra-data key. */
     1237    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeAltPrintScreen); }
     1238    /** Returns whether action is allowed. */
     1239    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeAltPrintScreen); }
     1240
     1241    QString shortcutExtraDataID() const
     1242    {
     1243        return QString("TypeAltPrintScreen");
     1244    }
     1245
     1246    void retranslateUi()
     1247    {
     1248        setName(QApplication::translate("UIActionPool", "&Insert %1", "that means send the %1 key sequence to the virtual machine").arg("Alt Print Screen"));
     1249        setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Alt Print Screen"));
    11901250    }
    11911251};
     
    21452205    m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeCtrlBreak] = new UIActionSimplePerformTypeCtrlBreak(this);
    21462206    m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert] = new UIActionSimplePerformTypeInsert(this);
     2207    m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypePrintScreen] = new UIActionSimplePerformTypePrintScreen(this);
     2208    m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeAltPrintScreen] = new UIActionSimplePerformTypeAltPrintScreen(this);
    21472209    m_pool[UIActionIndexRT_M_Input_M_Mouse] = new UIActionMenuMouse(this);
    21482210    m_pool[UIActionIndexRT_M_Input_M_Mouse_T_Integration] = new UIActionToggleMouseIntegration(this);
     
    28682930    /* 'Type Insert' action: */
    28692931    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert)) || fSeparator;
     2932    /* 'Type Print Screen' action: */
     2933    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypePrintScreen)) || fSeparator;
     2934    /* 'Type Alt Print Screen' action: */
     2935    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeAltPrintScreen)) || fSeparator;
    28702936
    28712937    /* Mark menu as valid: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r62493 r64659  
    8888    UIActionIndexRT_M_Input_M_Keyboard_S_TypeCtrlBreak,
    8989    UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert,
     90    UIActionIndexRT_M_Input_M_Keyboard_S_TypePrintScreen,
     91    UIActionIndexRT_M_Input_M_Keyboard_S_TypeAltPrintScreen,
    9092    UIActionIndexRT_M_Input_M_Mouse,
    9193    UIActionIndexRT_M_Input_M_Mouse_T_Integration,
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r63321 r64659  
    10191019    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCtrlBreak));
    10201020    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert));
     1021    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypePrintScreen));
     1022    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeAltPrintScreen));
    10211023
    10221024    /* Move actions into running-n-paused actions group: */
     
    11311133    connect(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert), SIGNAL(triggered()),
    11321134            this, SLOT(sltTypeInsert()));
     1135    connect(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypePrintScreen), SIGNAL(triggered()),
     1136            this, SLOT(sltTypePrintScreen()));
     1137    connect(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeAltPrintScreen), SIGNAL(triggered()),
     1138            this, SLOT(sltTypeAltPrintScreen()));
    11331139    connect(actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration), SIGNAL(toggled(bool)),
    11341140            this, SLOT(sltToggleMouseIntegration(bool)));
     
    15051511}
    15061512
     1513void UIMachineLogic::sltTypePrintScreen()
     1514{
     1515    static QVector<LONG> sequence(8);
     1516    sequence[0] = 0xE0;        /* Extended flag */
     1517    sequence[1] = 0x2A;        /* Print.. down */
     1518    sequence[2] = 0xE0;        /* Extended flag */
     1519    sequence[3] = 0x37;        /* ..Screen down */
     1520    sequence[4] = 0xE0;        /* Extended flag */
     1521    sequence[5] = 0x37 | 0x80; /* ..Screen up */
     1522    sequence[6] = 0xE0;        /* Extended flag */
     1523    sequence[7] = 0x2A | 0x80; /* Print.. up */
     1524    keyboard().PutScancodes(sequence);
     1525    AssertWrapperOk(keyboard());
     1526}
     1527
     1528void UIMachineLogic::sltTypeAltPrintScreen()
     1529{
     1530    static QVector<LONG> sequence(10);
     1531    sequence[0] = 0x38;        /* Alt down */
     1532    sequence[1] = 0xE0;        /* Extended flag */
     1533    sequence[2] = 0x2A;        /* Print.. down */
     1534    sequence[3] = 0xE0;        /* Extended flag */
     1535    sequence[4] = 0x37;        /* ..Screen down */
     1536    sequence[5] = 0xE0;        /* Extended flag */
     1537    sequence[6] = 0x37 | 0x80; /* ..Screen up */
     1538    sequence[7] = 0xE0;        /* Extended flag */
     1539    sequence[8] = 0x2A | 0x80; /* Print.. up */
     1540    sequence[9] = 0x38 | 0x80; /* Alt up */
     1541    keyboard().PutScancodes(sequence);
     1542    AssertWrapperOk(keyboard());
     1543}
     1544
    15071545void UIMachineLogic::sltTakeSnapshot()
    15081546{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r62493 r64659  
    265265    void sltTypeCtrlBreak();
    266266    void sltTypeInsert();
     267    void sltTypePrintScreen();
     268    void sltTypeAltPrintScreen();
    267269    void sltTakeSnapshot();
    268270    void sltShowInformationDialog();
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