VirtualBox

Changeset 49506 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 15, 2013 2:38:02 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Make sure last visual-state type chosen by user persist through GUI restart.

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

Legend:

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

    r49505 r49506  
    249249    /* Load extra-data settings: */
    250250    {
    251         /* Machine while saving own settings will save "yes" only for current
     251        /* Machine while saving own settings will save "on" only for current
    252252         * visual representation mode if its differs from normal mode of course.
    253253         * But user can alter extra data manually in machine xml file and set there
     
    278278                /* We can't enter seamless mode initially,
    279279                 * so we should ask ui-session for that: */
    280                 uisession()->setSeamlessModeRequested(true);
     280                uisession()->setRequestedVisualState(UIVisualStateType_Seamless);
    281281            }
    282282        }
     
    303303    /* Save extra-data settings: */
    304304    {
    305         /* Set 'scale' flag: */
    306         machine.SetExtraData(GUI_Scale, m_pVisualState &&
    307                              m_pVisualState->visualStateType() == UIVisualStateType_Scale ? "on" : QString());
    308 
    309         /* Set 'seamless' flag: */
    310         machine.SetExtraData(GUI_Seamless, m_pVisualState &&
    311                              m_pVisualState->visualStateType() == UIVisualStateType_Seamless ? "on" : QString());
    312 
    313         /* Set 'fullscreen' flag: */
    314         machine.SetExtraData(GUI_Fullscreen, m_pVisualState &&
    315                              m_pVisualState->visualStateType() == UIVisualStateType_Fullscreen ? "on" : QString());
     305        /* Prepare extra-data values: */
     306        QString strFullscreenRequested;
     307        QString strSeamlessRequested;
     308        QString strScaleRequested;
     309        /* Check if some state was requested: */
     310        if (uisession()->requestedVisualState() != UIVisualStateType_Invalid)
     311        {
     312            switch (uisession()->requestedVisualState())
     313            {
     314                case UIVisualStateType_Fullscreen: strFullscreenRequested = "on"; break;
     315                case UIVisualStateType_Seamless: strSeamlessRequested = "on"; break;
     316                case UIVisualStateType_Scale: strScaleRequested = "on"; break;
     317                default: break;
     318            }
     319        }
     320        /* Check if some state still exists: */
     321        else if (m_pVisualState)
     322        {
     323            switch (m_pVisualState->visualStateType())
     324            {
     325                case UIVisualStateType_Fullscreen: strFullscreenRequested = "on"; break;
     326                case UIVisualStateType_Seamless: strSeamlessRequested = "on"; break;
     327                case UIVisualStateType_Scale: strScaleRequested = "on"; break;
     328                default: break;
     329            }
     330        }
     331        /* Rewrite extra-data values: */
     332        machine.SetExtraData(GUI_Fullscreen, strFullscreenRequested);
     333        machine.SetExtraData(GUI_Seamless, strSeamlessRequested);
     334        machine.SetExtraData(GUI_Scale, strScaleRequested);
    316335    }
    317336}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r49505 r49506  
    709709{
    710710    /* We should check for entering/exiting requested modes: */
    711     connect(uisession(), SIGNAL(sigMachineStarted()), this, SLOT(sltCheckRequestedModes()));
    712     connect(uisession(), SIGNAL(sigAdditionsStateChange()), this, SLOT(sltCheckRequestedModes()));
     711    connect(uisession(), SIGNAL(sigMachineStarted()), this, SLOT(sltCheckForRequestedVisualStateType()));
     712    connect(uisession(), SIGNAL(sigAdditionsStateChange()), this, SLOT(sltCheckForRequestedVisualStateType()));
    713713
    714714    /* Machine state-change updater: */
     
    10901090    /* Call to base-class: */
    10911091    return QIWithRetranslateUI3<QObject>::eventFilter(pWatched, pEvent);
    1092 }
    1093 
    1094 void UIMachineLogic::sltCheckRequestedModes()
    1095 {
    1096     /* Do not try to enter extended mode if machine was not started yet: */
    1097     if (!uisession()->isRunning() && !uisession()->isPaused())
    1098         return;
    1099 
    1100     /* If seamless mode is requested, supported and we are NOT currently in seamless mode: */
    1101     if (uisession()->isSeamlessModeRequested() &&
    1102         uisession()->isGuestSupportsSeamless() &&
    1103         visualStateType() != UIVisualStateType_Seamless)
    1104     {
    1105         uisession()->setSeamlessModeRequested(false);
    1106         QAction *pSeamlessModeAction = gActionPool->action(UIActionIndexRuntime_Toggle_Seamless);
    1107         AssertMsg(!pSeamlessModeAction->isChecked(), ("Seamless action should not be triggered before us!\n"));
    1108         QTimer::singleShot(0, pSeamlessModeAction, SLOT(trigger()));
    1109     }
    1110     /* If seamless mode is NOT requested, NOT supported and we are currently in seamless mode: */
    1111     else if (!uisession()->isSeamlessModeRequested() &&
    1112              !uisession()->isGuestSupportsSeamless() &&
    1113              visualStateType() == UIVisualStateType_Seamless)
    1114     {
    1115         uisession()->setSeamlessModeRequested(true);
    1116         QAction *pSeamlessModeAction = gActionPool->action(UIActionIndexRuntime_Toggle_Seamless);
    1117         AssertMsg(pSeamlessModeAction->isChecked(), ("Seamless action should not be triggered before us!\n"));
    1118         QTimer::singleShot(0, pSeamlessModeAction, SLOT(trigger()));
    1119     }
    11201092}
    11211093
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r49505 r49506  
    100100protected slots:
    101101
     102    /** Checks if some visual-state type was requested. */
     103    virtual void sltCheckForRequestedVisualStateType() {}
     104
    102105    /* Console callback handlers: */
    103106    virtual void sltMachineStateChanged();
     
    172175
    173176private slots:
    174 
    175     /* Mode request watch dog: */
    176     void sltCheckRequestedModes();
    177177
    178178    /* "Machine" menu functionality: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r49505 r49506  
    124124    , m_machineStatePrevious(KMachineState_Null)
    125125    , m_machineState(session().GetMachine().GetState())
     126    , m_requestedVisualStateType(UIVisualStateType_Invalid)
    126127#ifdef Q_WS_WIN
    127128    , m_alphaCursor(0)
     
    138139    , m_fIsIgnoreRuntimeMediumsChanging(false)
    139140    , m_fIsGuestResizeIgnored(false)
    140     , m_fIsSeamlessModeRequested(false)
    141141    , m_fIsAutoCaptureDisabled(false)
    142142    , m_fReconfigurable(false)
     
    651651{
    652652    /* Reset requests: */
    653     setSeamlessModeRequested(false);
     653    setRequestedVisualState(UIVisualStateType_Invalid);
    654654    /* Request change: */
    655655    m_pMachine->asyncChangeVisualState(UIVisualStateType_Normal);
     
    659659{
    660660    /* Reset requests: */
    661     setSeamlessModeRequested(false);
     661    setRequestedVisualState(UIVisualStateType_Invalid);
    662662    /* Request change: */
    663663    m_pMachine->asyncChangeVisualState(UIVisualStateType_Fullscreen);
     
    667667{
    668668    /* Reset requests: */
    669     setSeamlessModeRequested(false);
     669    setRequestedVisualState(UIVisualStateType_Invalid);
    670670    /* Request change: */
    671671    m_pMachine->asyncChangeVisualState(UIVisualStateType_Seamless);
     
    675675{
    676676    /* Reset requests: */
    677     setSeamlessModeRequested(false);
     677    setRequestedVisualState(UIVisualStateType_Invalid);
    678678    /* Request change: */
    679679    m_pMachine->asyncChangeVisualState(UIVisualStateType_Scale);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r49505 r49506  
    125125    /** Requests visual-state change. */
    126126    void changeVisualState(UIVisualStateType visualStateType);
     127    /** Requests visual-state to be entered when possible. */
     128    void setRequestedVisualState(UIVisualStateType visualStateType) { m_requestedVisualStateType = visualStateType; }
     129    /** Returns requested visual-state to be entered when possible. */
     130    UIVisualStateType requestedVisualState() const { return m_requestedVisualStateType; }
    127131
    128132    bool isSaved() const { return machineState() == KMachineState_Saved; }
     
    142146    bool isIgnoreRuntimeMediumsChanging() const { return m_fIsIgnoreRuntimeMediumsChanging; }
    143147    bool isGuestResizeIgnored() const { return m_fIsGuestResizeIgnored; }
    144     bool isSeamlessModeRequested() const { return m_fIsSeamlessModeRequested; }
    145148    bool isAutoCaptureDisabled() const { return m_fIsAutoCaptureDisabled; }
    146149
     
    172175    bool setPause(bool fOn);
    173176    void setGuestResizeIgnored(bool fIsGuestResizeIgnored) { m_fIsGuestResizeIgnored = fIsGuestResizeIgnored; }
    174     void setSeamlessModeRequested(bool fIsSeamlessModeRequested) { m_fIsSeamlessModeRequested = fIsSeamlessModeRequested; }
    175177    void setAutoCaptureDisabled(bool fIsAutoCaptureDisabled) { m_fIsAutoCaptureDisabled = fIsAutoCaptureDisabled; }
    176178    void forgetPreviousMachineState() { m_machineStatePrevious = m_machineState; }
     
    324326    QCursor m_cursor;
    325327
     328    /** @name Visual-state configuration variables.
     329     ** @{ */
     330    /** Determines which visual-state should be entered when possible. */
     331    UIVisualStateType m_requestedVisualStateType;
     332    /** @} */
     333
    326334#if defined(Q_WS_WIN)
    327335    HCURSOR m_alphaCursor;
     
    358366    bool m_fIsIgnoreRuntimeMediumsChanging : 1;
    359367    bool m_fIsGuestResizeIgnored : 1;
    360     bool m_fIsSeamlessModeRequested : 1;
    361368    bool m_fIsAutoCaptureDisabled : 1;
    362369    bool m_fReconfigurable : 1;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r49505 r49506  
    4242    /* Normal mode is always available: */
    4343    return true;
     44}
     45
     46void UIMachineLogicNormal::sltCheckForRequestedVisualStateType()
     47{
     48    /* Do not try to change visual-state type if machine was not started yet: */
     49    if (!uisession()->isRunning() && !uisession()->isPaused())
     50        return;
     51
     52    /* Check requested visual-state types: */
     53    switch (uisession()->requestedVisualState())
     54    {
     55        /* If 'seamless' visual-state type is requested: */
     56        case UIVisualStateType_Seamless:
     57        {
     58            /* And supported: */
     59            if (uisession()->isGuestSupportsSeamless())
     60            {
     61                LogRel(("UIMachineLogicNormal: Going 'seamless' as requested...\n"));
     62                uisession()->setRequestedVisualState(UIVisualStateType_Invalid);
     63                uisession()->changeVisualState(UIVisualStateType_Seamless);
     64            }
     65            break;
     66        }
     67        default:
     68            break;
     69    }
    4470}
    4571
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h

    r49505 r49506  
    3636private slots:
    3737
     38    /** Checks if some visual-state type was requested. */
     39    void sltCheckForRequestedVisualStateType();
     40
    3841    /* Windowed mode functionality: */
    3942    void sltPrepareNetworkAdaptersMenu();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r49505 r49506  
    109109}
    110110
     111void UIMachineLogicSeamless::sltCheckForRequestedVisualStateType()
     112{
     113    /* Do not try to change visual-state type if machine was not started yet: */
     114    if (!uisession()->isRunning() && !uisession()->isPaused())
     115        return;
     116
     117    /* If 'seamless' visual-state type is no more supported: */
     118    if (!uisession()->isGuestSupportsSeamless())
     119    {
     120        LogRel(("UIMachineLogicSeamless: Leaving 'seamless' as it is no more supported...\n"));
     121        uisession()->setRequestedVisualState(UIVisualStateType_Seamless);
     122        uisession()->changeVisualState(UIVisualStateType_Normal);
     123    }
     124}
     125
    111126void UIMachineLogicSeamless::sltMachineStateChanged()
    112127{
     
    245260void UIMachineLogicSeamless::cleanupActionConnections()
    246261{
    247     /* "View" actions connections: */
     262    /* "View" actions disconnections: */
    248263    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
    249264               uisession(), SLOT(sltChangeVisualStateToNormal()));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h

    r49505 r49506  
    4848private slots:
    4949
     50    /** Checks if some visual-state type was requested. */
     51    void sltCheckForRequestedVisualStateType();
     52
    5053    /* Handler: Console callback stuff: */
    5154    void sltMachineStateChanged();
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