VirtualBox

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


Ignore:
Timestamp:
Nov 27, 2014 2:49:33 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 6278: Support for scaled video-output: Corresponding actions for the Runtime UI action-pool; added to View menu and Display status-bar indicator's context-menu.

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

Legend:

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

    r53086 r53406  
    578578        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings: strResult = "StatusBarSettings"; break;
    579579        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar:   strResult = "ToggleStatusBar"; break;
     580        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor:       strResult = "ScaleFactor"; break;
    580581        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize:            strResult = "Resize"; break;
    581582        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen:       strResult = "Multiscreen"; break;
     
    607608    keys << "StatusBarSettings"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings;
    608609    keys << "ToggleStatusBar";   values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar;
     610    keys << "ScaleFactor";       values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor;
    609611    keys << "Resize";            values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize;
    610612    keys << "Multiscreen";       values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen;
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r53372 r53406  
    382382        RuntimeMenuViewActionType_StatusBarSettings = RT_BIT(9),
    383383        RuntimeMenuViewActionType_ToggleStatusBar   = RT_BIT(10),
    384         RuntimeMenuViewActionType_Resize            = RT_BIT(11),
    385         RuntimeMenuViewActionType_Multiscreen       = RT_BIT(12),
     384        RuntimeMenuViewActionType_ScaleFactor       = RT_BIT(11),
     385        RuntimeMenuViewActionType_Resize            = RT_BIT(12),
     386        RuntimeMenuViewActionType_Multiscreen       = RT_BIT(13),
    386387        RuntimeMenuViewActionType_All               = 0xFFFF
    387388    };
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r53320 r53406  
    814814};
    815815
     816class UIActionMenuScaleFactor : public UIActionMenu
     817{
     818    Q_OBJECT;
     819
     820public:
     821
     822    UIActionMenuScaleFactor(UIActionPool *pParent)
     823        : UIActionMenu(pParent) {}
     824
     825protected:
     826
     827    /** Returns action extra-data ID. */
     828    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor; }
     829    /** Returns action extra-data key. */
     830    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor); }
     831    /** Returns whether action is allowed. */
     832    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor); }
     833
     834    void retranslateUi()
     835    {
     836        setName(QApplication::translate("UIActionPool", "S&cale Factor"));
     837    }
     838};
     839
    816840class UIActionMenuInput : public UIActionMenu
    817841{
     
    18931917    /* Update configuration: */
    18941918    updateConfiguration();
     1919}
     1920
     1921void UIActionPoolRuntime::sltHandleActionTriggerViewScaleFactor(QAction *pAction)
     1922{
     1923    /* Make sure sender is valid: */
     1924    AssertPtrReturnVoid(pAction);
     1925
     1926    /* Change scale-factor directly: */
     1927    const double dScaleFactor = pAction->property("Requested Scale Factor").toDouble();
     1928    gEDataManager->setScaleFactor(dScaleFactor, vboxGlobal().managedVMUuid());
    18951929}
    18961930
     
    19862020    m_pool[UIActionIndexRT_M_View_M_StatusBar_S_Settings] = new UIActionSimpleShowStatusBarSettingsWindow(this);
    19872021    m_pool[UIActionIndexRT_M_View_M_StatusBar_T_Visibility] = new UIActionToggleStatusBar(this);
     2022    m_pool[UIActionIndexRT_M_View_M_ScaleFactor] = new UIActionMenuScaleFactor(this);
    19882023
    19892024    /* 'Input' actions: */
     
    20422077    m_menuUpdateHandlers[UIActionIndexRT_M_View_M_MenuBar].ptfr =          &UIActionPoolRuntime::updateMenuViewMenuBar;
    20432078    m_menuUpdateHandlers[UIActionIndexRT_M_View_M_StatusBar].ptfr =        &UIActionPoolRuntime::updateMenuViewStatusBar;
     2079    m_menuUpdateHandlers[UIActionIndexRT_M_View_M_ScaleFactor].ptfr =      &UIActionPoolRuntime::updateMenuViewScaleFactor;
    20442080    m_menuUpdateHandlers[UIActionIndexRT_M_Input].ptfr =                   &UIActionPoolRuntime::updateMenuInput;
    20452081    m_menuUpdateHandlers[UIActionIndexRT_M_Input_M_Keyboard].ptfr =        &UIActionPoolRuntime::updateMenuInputKeyboard;
     
    23222358    }
    23232359
     2360    /* 'Scale Factor' submenu: */
     2361    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_ScaleFactor)) || fSeparator;
     2362    updateMenuViewScaleFactor();
     2363
    23242364    /* Do we have to show resize or multiscreen menu? */
    23252365    const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
     
    23792419    }
    23802420
     2421    /* 'Scale Factor' submenu: */
     2422    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_ScaleFactor)) || fSeparator;
     2423    updateMenuViewScaleFactor();
     2424
    23812425    /* Do we have to show resize menu? */
    23822426    const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
     
    24292473    /* Mark menu as valid: */
    24302474    m_invalidations.remove(UIActionIndexRT_M_View_M_StatusBar);
     2475}
     2476
     2477void UIActionPoolRuntime::updateMenuViewScaleFactor()
     2478{
     2479    /* Get corresponding menu: */
     2480    UIMenu *pMenu = action(UIActionIndexRT_M_View_M_ScaleFactor)->menu();
     2481    AssertPtrReturnVoid(pMenu);
     2482    /* Clear contents: */
     2483    pMenu->clear();
     2484
     2485    /* Get corresponding scale-factor: */
     2486    const double dCurrentScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
     2487
     2488    /* Prepare new contents: */
     2489    const QList<double> factors = QList<double>()
     2490                                  << 1.0
     2491                                  << 1.1
     2492                                  << 1.25
     2493                                  << 1.5
     2494                                  << 1.75
     2495                                  << 2.0;
     2496
     2497    /* Create exclusive 'scale-factor' action-group: */
     2498    QActionGroup *pActionGroup = new QActionGroup(pMenu);
     2499    AssertPtrReturnVoid(pActionGroup);
     2500    {
     2501        /* Configure exclusive 'scale-factor' action-group: */
     2502        pActionGroup->setExclusive(true);
     2503        /* For every available scale-factor: */
     2504        foreach (const double &dScaleFactor, factors)
     2505        {
     2506            /* Create exclusive 'scale-factor' action: */
     2507            QAction *pAction = pActionGroup->addAction(tr("%1%", "scale-factor")
     2508                                                          .arg(dScaleFactor * 100));
     2509            AssertPtrReturnVoid(pAction);
     2510            {
     2511                /* Configure exclusive 'scale-factor' action: */
     2512                pAction->setProperty("Requested Scale Factor", dScaleFactor);
     2513                pAction->setCheckable(true);
     2514                if (dScaleFactor == dCurrentScaleFactor)
     2515                    pAction->setChecked(true);
     2516            }
     2517        }
     2518        /* Insert group actions into menu: */
     2519        pMenu->addActions(pActionGroup->actions());
     2520        /* Install listener for exclusive action-group: */
     2521        connect(pActionGroup, SIGNAL(triggered(QAction*)),
     2522                this, SLOT(sltHandleActionTriggerViewScaleFactor(QAction*)));
     2523    }
    24312524}
    24322525
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r53320 r53406  
    6868    UIActionIndexRT_M_View_M_StatusBar_S_Settings,
    6969    UIActionIndexRT_M_View_M_StatusBar_T_Visibility,
     70    UIActionIndexRT_M_View_M_ScaleFactor,
    7071
    7172    /* 'Input' menu actions: */
     
    183184    void sltHandleConfigurationChange(const QString &strMachineID);
    184185
     186    /** Handles 'View' : 'Scale Factor' menu : @a pAction trigger. */
     187    void sltHandleActionTriggerViewScaleFactor(QAction *pAction);
     188
    185189    /** Prepare 'View' : 'Virtual Screen #' menu routine (Normal, Scale). */
    186190    void sltPrepareMenuViewScreen();
     
    227231    /** Update 'View' : 'Status Bar' menu routine. */
    228232    void updateMenuViewStatusBar();
     233    /** Update 'View' : 'Scale Factor' menu routine. */
     234    void updateMenuViewScaleFactor();
    229235    /** Update 'View' : 'Virtual Screen #' @a pMenu routine (Normal, Scale). */
    230236    void updateMenuViewScreen(QMenu *pMenu);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r53062 r53406  
    898898    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize));
    899899    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_View_S_AdjustWindow));
     900    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_ScaleFactor));
    900901    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_S_TypeCAD));
    901902#ifdef Q_WS_X11
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp

    r53321 r53406  
    483483        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_StatusBar));
    484484        pMenu->addSeparator();
     485        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_ScaleFactor));
    485486        prepareNamedAction(pMenu, tr("Virtual Screen Resize"),
    486487                           UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize,
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