VirtualBox

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


Ignore:
Timestamp:
Aug 11, 2014 3:29:06 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95469
Message:

FE/Qt: 6840: Runtime UI: View menu: Virtual Screen #N sub-menu: Action to enable/disable non-primary guest-screens for multi-monitor case.

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

Legend:

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

    r52343 r52344  
    13901390    /* Call to corresponding handler: */
    13911391    updateMenuViewMultiscreen(pMenu);
     1392}
     1393
     1394void UIActionPoolRuntime::sltHandleActionTriggerViewScreenToggle()
     1395{
     1396    /* Make sure sender is valid: */
     1397    QAction *pAction = qobject_cast<QAction*>(sender());
     1398    AssertPtrReturnVoid(pAction);
     1399
     1400    /* Send request to enable/disable guest-screen: */
     1401    const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
     1402    const bool fScreenEnabled = pAction->isChecked();
     1403    emit sigNotifyAboutTriggeringViewScreenToggle(iGuestScreenIndex, fScreenEnabled);
    13921404}
    13931405
     
    21102122    const UIFrameBuffer* pFrameBuffer = session()->frameBuffer(iGuestScreenIndex);
    21112123    const QSize screenSize = QSize(pFrameBuffer->width(), pFrameBuffer->height());
     2124    const bool fScreenEnabled = session()->isScreenVisible(iGuestScreenIndex);
     2125
     2126    /* For non-primary screens: */
     2127    if (iGuestScreenIndex > 0)
     2128    {
     2129        /* Create 'toggle' action: */
     2130        QAction *pToggleAction = pMenu->addAction(UIActionPoolRuntime::tr("Enable", "Virtual Screen"),
     2131                                                  this, SLOT(sltHandleActionTriggerViewScreenToggle()));
     2132        AssertPtrReturnVoid(pToggleAction);
     2133        {
     2134            /* Configure 'toggle' action: */
     2135            pToggleAction->setEnabled(session()->isGuestSupportsGraphics());
     2136            pToggleAction->setProperty("Guest Screen Index", iGuestScreenIndex);
     2137            pToggleAction->setCheckable(true);
     2138            pToggleAction->setChecked(fScreenEnabled);
     2139            /* Add separator: */
     2140            pMenu->addSeparator();
     2141        }
     2142    }
    21122143
    21132144    /* Create exclusive 'resize' action-group: */
     
    21262157            {
    21272158                /* Configure exclusive 'resize' action: */
    2128                 pAction->setEnabled(session()->isGuestSupportsGraphics());
     2159                pAction->setEnabled(session()->isGuestSupportsGraphics() && fScreenEnabled);
    21292160                pAction->setProperty("Guest Screen Index", iGuestScreenIndex);
    21302161                pAction->setProperty("Requested Size", size);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r52343 r52344  
    121121signals:
    122122
     123    /** Notifies about 'View' : 'Virtual Screen #' menu : 'Toggle' action trigger. */
     124    void sigNotifyAboutTriggeringViewScreenToggle(int iGuestScreenIndex, bool fEnabled);
    123125    /** Notifies about 'View' : 'Virtual Screen #' menu : 'Resize' action trigger. */
    124126    void sigNotifyAboutTriggeringViewScreenResize(int iGuestScreenIndex, const QSize &size);
     
    174176    void sltPrepareMenuViewMultiscreen();
    175177
     178    /** Handles 'View' : 'Virtual Screen #' menu : 'Toggle' action trigger. */
     179    void sltHandleActionTriggerViewScreenToggle();
    176180    /** Handles 'View' : 'Virtual Screen #' menu : 'Resize' @a pAction trigger. */
    177181    void sltHandleActionTriggerViewScreenResize(QAction *pAction);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r52343 r52344  
    124124}
    125125
     126void UIMachineLogicNormal::sltHandleActionTriggerViewScreenToggle(int iIndex, bool fEnabled)
     127{
     128    /* Enable/disable guest keeping current size: */
     129    ULONG uWidth, uHeight, uBitsPerPixel;
     130    LONG uOriginX, uOriginY;
     131    CDisplay display = session().GetConsole().GetDisplay();
     132    display.GetScreenResolution(iIndex, uWidth, uHeight, uBitsPerPixel, uOriginX, uOriginY);
     133    if (!fEnabled)
     134        display.SetVideoModeHint(iIndex, false, false, 0, 0, 0, 0, 0);
     135    else
     136    {
     137        /* Defaults: */
     138        if (!uWidth)
     139            uWidth = 800;
     140        if (!uHeight)
     141            uHeight = 600;
     142        display.SetVideoModeHint(iIndex, true, false, 0, 0, uWidth, uHeight, 32);
     143    }
     144}
     145
    126146void UIMachineLogicNormal::sltHandleActionTriggerViewScreenResize(int iIndex, const QSize &size)
    127147{
     
    148168    connect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility), SIGNAL(triggered(bool)),
    149169            this, SLOT(sltToggleStatusBar()));
     170    connect(actionPool(), SIGNAL(sigNotifyAboutTriggeringViewScreenToggle(int, bool)),
     171            this, SLOT(sltHandleActionTriggerViewScreenToggle(int, bool)));
    150172    connect(actionPool(), SIGNAL(sigNotifyAboutTriggeringViewScreenResize(int, const QSize&)),
    151173            this, SLOT(sltHandleActionTriggerViewScreenResize(int, const QSize&)));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h

    r52343 r52344  
    4646    void sltStatusBarSettingsClosed();
    4747    void sltToggleStatusBar();
     48    void sltHandleActionTriggerViewScreenToggle(int iIndex, bool fEnabled);
    4849    void sltHandleActionTriggerViewScreenResize(int iIndex, const QSize &size);
    4950
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette