VirtualBox

Changeset 76006 in vbox


Ignore:
Timestamp:
Dec 6, 2018 9:49:09 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8694: UIActionPoolRuntime: Few more refactoring bits for rescale actions code (s.a. r127226).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

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

    r76005 r76006  
    32133213}
    32143214
    3215 void UIActionPoolRuntime::sltHandleActionTriggerViewScaleFactor(QAction *pAction)
     3215void UIActionPoolRuntime::sltPrepareMenuViewScreen()
     3216{
     3217    /* Make sure sender is valid: */
     3218    QMenu *pMenu = qobject_cast<QMenu*>(sender());
     3219    AssertPtrReturnVoid(pMenu);
     3220
     3221    /* Do we have to show resize, remap or rescale actions? */
     3222    const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
     3223    const bool fAllowToShowActionRemap = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Remap);
     3224    const bool fAllowToShowActionRescale = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Rescale);
     3225
     3226    /* Clear contents: */
     3227    pMenu->clear();
     3228
     3229    /* Separator: */
     3230    bool fSeparator = false;
     3231
     3232    /* Resize actions: */
     3233    if (fAllowToShowActionResize)
     3234    {
     3235        updateMenuViewResize(pMenu);
     3236        fSeparator = true;
     3237    }
     3238
     3239    /* Separator: */
     3240    if (fSeparator)
     3241    {
     3242        pMenu->addSeparator();
     3243        fSeparator = false;
     3244    }
     3245
     3246    /* Remap actions: */
     3247    if (fAllowToShowActionRemap && (m_cHostScreens > 1 || m_cGuestScreens > 1))
     3248    {
     3249        updateMenuViewRemap(pMenu);
     3250        fSeparator = true;
     3251    }
     3252
     3253    /* Separator: */
     3254    if (fSeparator)
     3255    {
     3256        pMenu->addSeparator();
     3257        fSeparator = false;
     3258    }
     3259
     3260    /* Rescale actions: */
     3261    if (fAllowToShowActionRescale)
     3262    {
     3263        updateMenuViewRescale(pMenu);
     3264        fSeparator = true;
     3265    }
     3266}
     3267
     3268void UIActionPoolRuntime::sltHandleActionTriggerViewScreenToggle()
     3269{
     3270    /* Make sure sender is valid: */
     3271    QAction *pAction = qobject_cast<QAction*>(sender());
     3272    AssertPtrReturnVoid(pAction);
     3273
     3274    /* Send request to enable/disable guest-screen: */
     3275    const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
     3276    const bool fScreenEnabled = pAction->isChecked();
     3277    emit sigNotifyAboutTriggeringViewScreenToggle(iGuestScreenIndex, fScreenEnabled);
     3278}
     3279
     3280void UIActionPoolRuntime::sltHandleActionTriggerViewScreenResize(QAction *pAction)
     3281{
     3282    /* Make sure sender is valid: */
     3283    AssertPtrReturnVoid(pAction);
     3284
     3285    /* Send request to resize guest-screen to required size: */
     3286    const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
     3287    const QSize size = pAction->property("Requested Size").toSize();
     3288    emit sigNotifyAboutTriggeringViewScreenResize(iGuestScreenIndex, size);
     3289}
     3290
     3291void UIActionPoolRuntime::sltHandleActionTriggerViewScreenRemap(QAction *pAction)
     3292{
     3293    /* Make sure sender is valid: */
     3294    AssertPtrReturnVoid(pAction);
     3295
     3296    /* Send request to remap guest-screen to required host-screen: */
     3297    const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
     3298    const int iHostScreenIndex = pAction->property("Host Screen Index").toInt();
     3299    emit sigNotifyAboutTriggeringViewScreenRemap(iGuestScreenIndex, iHostScreenIndex);
     3300}
     3301
     3302void UIActionPoolRuntime::sltHandleActionTriggerViewRescale(QAction *pAction)
    32163303{
    32173304    /* Make sure sender is valid: */
     
    32223309    const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
    32233310    gEDataManager->setScaleFactor(dScaleFactor, vboxGlobal().managedVMUuid(), iGuestScreenIndex);
    3224 }
    3225 
    3226 void UIActionPoolRuntime::sltPrepareMenuViewScreen()
    3227 {
    3228     /* Make sure sender is valid: */
    3229     QMenu *pMenu = qobject_cast<QMenu*>(sender());
    3230     AssertPtrReturnVoid(pMenu);
    3231 
    3232     /* Do we have to show resize, remap or rescale actions? */
    3233     const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
    3234     const bool fAllowToShowActionRemap = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Remap);
    3235     const bool fAllowToShowActionRescale = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Rescale);
    3236 
    3237     /* Clear contents: */
    3238     pMenu->clear();
    3239 
    3240     /* Separator: */
    3241     bool fSeparator = false;
    3242 
    3243     /* Resize actions: */
    3244     if (fAllowToShowActionResize)
    3245     {
    3246         updateMenuViewResize(pMenu);
    3247         fSeparator = true;
    3248     }
    3249 
    3250     /* Separator: */
    3251     if (fSeparator)
    3252     {
    3253         pMenu->addSeparator();
    3254         fSeparator = false;
    3255     }
    3256 
    3257     /* Remap actions: */
    3258     if (fAllowToShowActionRemap && (m_cHostScreens > 1 || m_cGuestScreens > 1))
    3259     {
    3260         updateMenuViewRemap(pMenu);
    3261         fSeparator = true;
    3262     }
    3263 
    3264     /* Separator: */
    3265     if (fSeparator)
    3266     {
    3267         pMenu->addSeparator();
    3268         fSeparator = false;
    3269     }
    3270 
    3271     /* Rescale actions: */
    3272     if (fAllowToShowActionRescale)
    3273     {
    3274         updateMenuViewRescale(pMenu);
    3275         fSeparator = true;
    3276     }
    3277 }
    3278 
    3279 void UIActionPoolRuntime::sltHandleActionTriggerViewScreenToggle()
    3280 {
    3281     /* Make sure sender is valid: */
    3282     QAction *pAction = qobject_cast<QAction*>(sender());
    3283     AssertPtrReturnVoid(pAction);
    3284 
    3285     /* Send request to enable/disable guest-screen: */
    3286     const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
    3287     const bool fScreenEnabled = pAction->isChecked();
    3288     emit sigNotifyAboutTriggeringViewScreenToggle(iGuestScreenIndex, fScreenEnabled);
    3289 }
    3290 
    3291 void UIActionPoolRuntime::sltHandleActionTriggerViewScreenResize(QAction *pAction)
    3292 {
    3293     /* Make sure sender is valid: */
    3294     AssertPtrReturnVoid(pAction);
    3295 
    3296     /* Send request to resize guest-screen to required size: */
    3297     const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
    3298     const QSize size = pAction->property("Requested Size").toSize();
    3299     emit sigNotifyAboutTriggeringViewScreenResize(iGuestScreenIndex, size);
    3300 }
    3301 
    3302 void UIActionPoolRuntime::sltHandleActionTriggerViewScreenRemap(QAction *pAction)
    3303 {
    3304     /* Make sure sender is valid: */
    3305     AssertPtrReturnVoid(pAction);
    3306 
    3307     /* Send request to remap guest-screen to required host-screen: */
    3308     const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
    3309     const int iHostScreenIndex = pAction->property("Host Screen Index").toInt();
    3310     emit sigNotifyAboutTriggeringViewScreenRemap(iGuestScreenIndex, iHostScreenIndex);
    33113311}
    33123312
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.h

    r76005 r76006  
    201201    void sltHandleConfigurationChange(const QUuid &uMachineID);
    202202
    203     /** Handles 'View' : 'Scale Factor' menu : @a pAction trigger. */
    204     void sltHandleActionTriggerViewScaleFactor(QAction *pAction);
    205 
    206203    /** Prepares 'View' : 'Virtual Screen #' menu (Normal, Scale). */
    207204    void sltPrepareMenuViewScreen();
     
    213210    /** Handles 'View' : 'Virtual Screen #' menu : 'Remap' @a pAction trigger. */
    214211    void sltHandleActionTriggerViewScreenRemap(QAction *pAction);
     212    /** Handles 'View' : 'Virtual Screen #' menu : 'Rescale' @a pAction trigger. */
     213    void sltHandleActionTriggerViewRescale(QAction *pAction);
    215214
    216215protected:
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