VirtualBox

Changeset 88633 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 21, 2021 12:43:05 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161: A bit of rework for Runtime UI; Move requested visual-state stuff from UISession to UIMachine; Save it instantly instead of power off sequence.

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

Legend:

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

    r84990 r88633  
    137137}
    138138
     139void UIMachine::setRequestedVisualState(UIVisualStateType visualStateType)
     140{
     141    /* Remember requested visual state: */
     142    m_enmRequestedVisualState = visualStateType;
     143
     144    /* Save only if it's different from Invalid and from current one: */
     145    if (   m_enmRequestedVisualState != UIVisualStateType_Invalid
     146        && gEDataManager->requestedVisualState(uiCommon().managedVMUuid()) != m_enmRequestedVisualState)
     147        gEDataManager->setRequestedVisualState(m_enmRequestedVisualState, uiCommon().managedVMUuid());
     148}
     149
     150UIVisualStateType UIMachine::requestedVisualState() const
     151{
     152    return m_enmRequestedVisualState;
     153}
     154
    139155void UIMachine::closeRuntimeUI()
    140156{
     
    193209    , m_initialVisualState(UIVisualStateType_Normal)
    194210    , m_visualState(UIVisualStateType_Invalid)
     211    , m_enmRequestedVisualState(UIVisualStateType_Invalid)
    195212    , m_pMachineLogic(0)
    196213{
     
    250267    m_allowedVisualStates = static_cast<UIVisualStateType>(UIVisualStateType_All ^ restrictedVisualStates);
    251268
    252     /* Load requested visual state: */
    253     UIVisualStateType requestedVisualState = gEDataManager->requestedVisualState(uiCommon().managedVMUuid());
     269    /* Load requested visual state, it can override initial one: */
     270    m_enmRequestedVisualState = gEDataManager->requestedVisualState(uiCommon().managedVMUuid());
    254271    /* Check if requested visual state is allowed: */
    255     if (isVisualStateAllowed(requestedVisualState))
    256     {
    257         switch (requestedVisualState)
     272    if (isVisualStateAllowed(m_enmRequestedVisualState))
     273    {
     274        switch (m_enmRequestedVisualState)
    258275        {
    259             /* Direct transition to scale/fullscreen mode allowed: */
     276            /* Direct transition allowed to scale/fullscreen modes only: */
    260277            case UIVisualStateType_Scale:      m_initialVisualState = UIVisualStateType_Scale; break;
    261278            case UIVisualStateType_Fullscreen: m_initialVisualState = UIVisualStateType_Fullscreen; break;
    262             /* While to seamless is not, so we have to make request to do transition later: */
    263             case UIVisualStateType_Seamless:   uisession()->setRequestedVisualState(UIVisualStateType_Seamless); break;
    264279            default: break;
    265280        }
     
    272287void UIMachine::cleanupMachineLogic()
    273288{
    274     /* Session UI can have requested visual state: */
    275     if (uisession())
    276     {
    277         /* Get requested visual state: */
    278         UIVisualStateType requestedVisualState = uisession()->requestedVisualState();
    279         /* Or current visual state if requested is invalid: */
    280         if (requestedVisualState == UIVisualStateType_Invalid)
    281             requestedVisualState = m_visualState;
    282 
    283         /* Save requested visual state: */
    284         gEDataManager->setRequestedVisualState(requestedVisualState, uiCommon().managedVMUuid());
    285     }
    286 
    287289    /* Destroy machine-logic if exists: */
    288290    if (m_pMachineLogic)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r82968 r88633  
    7373    void asyncChangeVisualState(UIVisualStateType visualStateType);
    7474
     75    /** Requests visual-state to be entered when possible. */
     76    void setRequestedVisualState(UIVisualStateType visualStateType);
     77    /** Returns requested visual-state to be entered when possible. */
     78    UIVisualStateType requestedVisualState() const;
     79
    7580    /** Close Runtime UI. */
    7681    void closeRuntimeUI();
     
    117122    /** Holds current visual state. */
    118123    UIVisualStateType m_visualState;
     124    /** Holds visual state which should be entered when possible. */
     125    UIVisualStateType m_enmRequestedVisualState;
    119126    /** Holds current machine-logic. */
    120127    UIMachineLogic *m_pMachineLogic;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r85772 r88633  
    508508}
    509509
     510void UISession::setRequestedVisualState(UIVisualStateType visualStateType)
     511{
     512    m_pMachine->setRequestedVisualState(visualStateType);
     513}
     514
     515UIVisualStateType UISession::requestedVisualState() const
     516{
     517    return m_pMachine->requestedVisualState();
     518}
     519
    510520bool UISession::setPause(bool fOn)
    511521{
     
    942952    , m_machineState(KMachineState_Null)
    943953    , m_pMachineWindowIcon(0)
    944     , m_requestedVisualStateType(UIVisualStateType_Invalid)
    945954#ifdef VBOX_WS_WIN
    946955    , m_alphaCursor(0)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r82968 r88633  
    179179    void changeVisualState(UIVisualStateType visualStateType);
    180180    /** Requests visual-state to be entered when possible. */
    181     void setRequestedVisualState(UIVisualStateType visualStateType) { m_requestedVisualStateType = visualStateType; }
     181    void setRequestedVisualState(UIVisualStateType visualStateType);
    182182    /** Returns requested visual-state to be entered when possible. */
    183     UIVisualStateType requestedVisualState() const { return m_requestedVisualStateType; }
     183    UIVisualStateType requestedVisualState() const;
    184184
    185185    bool isSaved() const { return machineState() == KMachineState_Saved; }
     
    529529    /** @} */
    530530
    531     /** @name Visual-state configuration variables.
    532      ** @{ */
    533     /** Determines which visual-state should be entered when possible. */
    534     UIVisualStateType m_requestedVisualStateType;
    535     /** @} */
    536 
    537531#if defined(VBOX_WS_WIN)
    538532    HCURSOR m_alphaCursor;
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