VirtualBox

Changeset 75339 in vbox for trunk


Ignore:
Timestamp:
Nov 9, 2018 7:02:36 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9254. Add scale-factor to the machine window menu in fullscreen/seamless

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

Legend:

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

    r75319 r75339  
    32303230    AssertPtrReturnVoid(pMenu);
    32313231
    3232     /* Call to corresponding handler: */
    3233     updateMenuViewScreen(pMenu);
    3234 }
    3235 
    3236 void UIActionPoolRuntime::sltPrepareMenuViewMultiscreen()
    3237 {
    3238     /* Make sure sender is valid: */
    3239     QMenu *pMenu = qobject_cast<QMenu*>(sender());
    3240     AssertPtrReturnVoid(pMenu);
    3241 
    3242     /* Call to corresponding handler: */
    3243     updateMenuViewMultiscreen(pMenu);
     3232    const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
     3233    const bool fAllowToShowActionScaleFactor = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor);
     3234    const bool fAllowToShowActionMultiscreen = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen);
     3235
     3236    /* Clear contents: */
     3237    pMenu->clear();
     3238
     3239    /* Resize, scale factor, and multiscreen menu items are inserted into the same sub-menu: */
     3240    if (fAllowToShowActionResize)
     3241        updateMenuViewScreen(pMenu);
     3242    if (fAllowToShowActionScaleFactor)
     3243        updateMenuViewScaleFactor(pMenu);
     3244    if (fAllowToShowActionMultiscreen && m_cHostScreens > 1)
     3245        updateMenuViewMultiscreen(pMenu);
    32443246}
    32453247
     
    36873689    }
    36883690
    3689     /* Do we have to show resize or multiscreen menu? */
     3691    /* Do we have to show resize, scale factor, or multiscreen menu? */
    36903692    const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
     3693    const bool fAllowToShowActionScaleFactor = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor);
    36913694    const bool fAllowToShowActionMultiscreen = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen);
    3692     if (fAllowToShowActionResize)
     3695
     3696    if (fAllowToShowActionResize || fAllowToShowActionScaleFactor || fAllowToShowActionMultiscreen)
    36933697    {
    36943698        for (int iGuestScreenIndex = 0; iGuestScreenIndex < m_cGuestScreens; ++iGuestScreenIndex)
     
    37023706        }
    37033707    }
    3704     else if (fAllowToShowActionMultiscreen)
    3705     {
    3706         /* Only for multi-screen host case: */
    3707         if (m_cHostScreens > 1)
    3708         {
    3709             for (int iGuestScreenIndex = 0; iGuestScreenIndex < m_cGuestScreens; ++iGuestScreenIndex)
    3710             {
    3711                 /* Add 'Virtual Screen %1' menu: */
    3712                 QMenu *pSubMenu = pMenu->addMenu(UIIconPool::iconSet(":/virtual_screen_16px.png",
    3713                                                                      ":/virtual_screen_disabled_16px.png"),
    3714                                                  QApplication::translate("UIMultiScreenLayout", "Virtual Screen %1").arg(iGuestScreenIndex + 1));
    3715                 pSubMenu->setProperty("Guest Screen Index", iGuestScreenIndex);
    3716                 connect(pSubMenu, SIGNAL(aboutToShow()), this, SLOT(sltPrepareMenuViewMultiscreen()));
    3717             }
    3718         }
    3719     }
    37203708
    37213709    /* Mark menu as valid: */
     
    37483736    /* Do we have to show resize menu? */
    37493737    const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
    3750     if (fAllowToShowActionResize)
     3738    const bool fAllowToShowActionScaleFactor = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor);
     3739    if (fAllowToShowActionResize || fAllowToShowActionScaleFactor)
    37513740    {
    37523741        for (int iGuestScreenIndex = 0; iGuestScreenIndex < m_cGuestScreens; ++iGuestScreenIndex)
     
    37603749        }
    37613750    }
    3762 
    37633751    /* Mark menu as valid: */
    37643752    m_invalidations.remove(UIActionIndexRT_M_ViewPopup);
     
    39133901void UIActionPoolRuntime::updateMenuViewScreen(QMenu *pMenu)
    39143902{
    3915     /* Clear contents: */
    3916     pMenu->clear();
    3917 
     3903    AssertPtrReturnVoid(pMenu);
    39183904    /* Prepare new contents: */
    39193905    const QList<QSize> sizes = QList<QSize>()
     
    39843970                this, SLOT(sltHandleActionTriggerViewScreenResize(QAction*)));
    39853971    }
    3986     updateMenuViewScaleFactor(pMenu);
    39873972}
    39883973
    39893974void UIActionPoolRuntime::updateMenuViewMultiscreen(QMenu *pMenu)
    39903975{
    3991     /* Clear contents: */
    3992     pMenu->clear();
    3993 
     3976    AssertPtrReturnVoid(pMenu);
    39943977    /* Get corresponding screen index and size: */
    39953978    const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt();
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.h

    r75291 r75339  
    206206    /** Prepares 'View' : 'Virtual Screen #' menu (Normal, Scale). */
    207207    void sltPrepareMenuViewScreen();
    208     /** Prepares 'View' : 'Virtual Screen #' menu (Fullscreen, Seamless). */
    209     void sltPrepareMenuViewMultiscreen();
    210208
    211209    /** Handles 'View' : 'Virtual Screen #' menu : 'Toggle' action trigger. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r70201 r75339  
    351351#endif /* !VBOX_WS_MAC */
    352352
     353void UIMachineLogicNormal::prepareActionGroups()
     354{
     355    /* Call to base-class: */
     356    UIMachineLogic::prepareActionGroups();
     357
     358    /* Restrict 'Adjust Window', 'Guest Autoresize', 'Status Bar' and 'Resize' actions for 'View' menu: */
     359    actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Logic,
     360                                                         (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
     361                                                         (UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen));
     362}
     363
    353364void UIMachineLogicNormal::cleanupMachineWindows()
    354365{
     
    388399    UIMachineLogic::cleanupActionConnections();
    389400}
    390 
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h

    r69500 r75339  
    7575
    7676    /* Prepare helpers: */
     77    virtual void prepareActionGroups() /* override */;
    7778    void prepareActionConnections();
    7879    void prepareMachineWindows();
     
    9899
    99100#endif /* !___UIMachineLogicNormal_h___ */
    100 
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