VirtualBox

Changeset 27243 in vbox for trunk/src


Ignore:
Timestamp:
Mar 10, 2010 11:38:45 AM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: New running VM core: restored support for running VM in fullscreen mode initially.

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

Legend:

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

    r27148 r27243  
    260260    : QObject(0)
    261261    , m_ppThis(ppSelf)
     262    , initialStateType(UIVisualStateType_Normal)
    262263    , m_session(session)
    263264    , m_pActionsPool(new UIActionsPool(this))
     
    278279        *m_ppThis = this;
    279280
     281    /* Load machine settings: */
     282    loadMachineSettings();
     283
    280284    /* Enter default (normal) state */
    281     enterBaseVisualState();
     285    enterInitialVisualState();
    282286}
    283287
    284288UIMachine::~UIMachine()
    285289{
     290    /* Save machine settings: */
     291    saveMachineSettings();
    286292    /* Erase itself pointer: */
    287293    *m_ppThis = 0;
     
    308314}
    309315
     316void UIMachine::sltChangeVisualState(UIVisualStateType visualStateType)
     317{
     318    /* Create new state: */
     319    UIVisualState *pNewVisualState = 0;
     320    switch (visualStateType)
     321    {
     322        case UIVisualStateType_Normal:
     323        {
     324            /* Create normal visual state: */
     325            pNewVisualState = new UIVisualStateNormal(this, m_pSession, m_pActionsPool);
     326            break;
     327        }
     328        case UIVisualStateType_Fullscreen:
     329        {
     330            /* Create fullscreen visual state: */
     331            pNewVisualState = new UIVisualStateFullscreen(this, m_pSession, m_pActionsPool);
     332            break;
     333        }
     334        case UIVisualStateType_Seamless:
     335        {
     336            /* Create seamless visual state: */
     337            pNewVisualState = new UIVisualStateSeamless(this, m_pSession, m_pActionsPool);
     338            break;
     339        }
     340        default:
     341            break;
     342    }
     343
     344    UIVisualStateType previousVisualStateType = UIVisualStateType_Normal;
     345    if (m_pVisualState)
     346        previousVisualStateType = m_pVisualState->visualStateType();
     347
     348    /* First we have to check if the selected mode is available at all.
     349     * Only then we delete the old mode and switch to the new mode. */
     350    if (pNewVisualState->prepareChange(previousVisualStateType))
     351    {
     352        /* Delete previous state: */
     353        delete m_pVisualState;
     354
     355        /* Set the new mode as current mode: */
     356        m_pVisualState = pNewVisualState;
     357        m_pVisualState->change();
     358
     359        /* Finish any setup: */
     360        m_pVisualState->finishChange();
     361    }
     362    else
     363        /* Discard the temporary created new state: */
     364        delete pNewVisualState;
     365}
     366
     367void UIMachine::closeVirtualMachine()
     368{
     369    delete this;
     370}
     371
     372void UIMachine::enterInitialVisualState()
     373{
     374    sltChangeVisualState(initialStateType);
     375}
     376
    310377UIMachineLogic* UIMachine::machineLogic() const
    311378{
     
    316383}
    317384
    318 void UIMachine::sltChangeVisualState(UIVisualStateType visualStateType)
    319 {
    320     /* Create new state: */
    321     UIVisualState *pNewVisualState = 0;
    322     switch (visualStateType)
    323     {
    324         case UIVisualStateType_Normal:
    325         {
    326             /* Create normal visual state: */
    327             pNewVisualState = new UIVisualStateNormal(this, m_pSession, m_pActionsPool);
    328             break;
    329         }
    330         case UIVisualStateType_Fullscreen:
    331         {
    332             /* Create fullscreen visual state: */
    333             pNewVisualState = new UIVisualStateFullscreen(this, m_pSession, m_pActionsPool);
    334             break;
    335         }
    336         case UIVisualStateType_Seamless:
    337         {
    338             /* Create seamless visual state: */
    339             pNewVisualState = new UIVisualStateSeamless(this, m_pSession, m_pActionsPool);
    340             break;
    341         }
    342         default:
    343             break;
    344     }
    345 
    346     UIVisualStateType previousVisualStateType = UIVisualStateType_Normal;
    347     if (m_pVisualState)
    348         previousVisualStateType = m_pVisualState->visualStateType();
    349 
    350     /* First we have to check if the selected mode is available at all.
    351      * Only then we delete the old mode and switch to the new mode. */
    352     if (pNewVisualState->prepareChange(previousVisualStateType))
    353     {
    354         /* Delete previous state: */
    355         delete m_pVisualState;
    356 
    357         /* Set the new mode as current mode: */
    358         m_pVisualState = pNewVisualState;
    359         m_pVisualState->change();
    360 
    361         /* Finish any setup: */
    362         m_pVisualState->finishChange();
    363     }
    364     else
    365         /* Discard the temporary created new state: */
    366         delete pNewVisualState;
    367 }
    368 
    369 void UIMachine::closeVirtualMachine()
    370 {
    371     delete this;
    372 }
    373 
    374 void UIMachine::enterBaseVisualState()
    375 {
    376     sltChangeVisualState(UIVisualStateType_Normal);
     385void UIMachine::loadMachineSettings()
     386{
     387    /* Load machine settings: */
     388    CMachine machine = uisession()->session().GetMachine();
     389
     390    /* Load extra-data settings: */
     391    {
     392        /* Get 'fullscreen' attributes: */
     393        QString strFullscreenSettings = machine.GetExtraData(VBoxDefs::GUI_Fullscreen);
     394        if (strFullscreenSettings == "yes")
     395            initialStateType = UIVisualStateType_Fullscreen;
     396    }
     397}
     398
     399void UIMachine::saveMachineSettings()
     400{
     401    /* Save machine settings: */
     402    CMachine machine = uisession()->session().GetMachine();
     403
     404    /* Save extra-data settings: */
     405    {
     406        /* Set 'fullscreen' attributes: */
     407        machine.SetExtraData(VBoxDefs::GUI_Fullscreen, m_pVisualState &&
     408                             m_pVisualState->visualStateType() == UIVisualStateType_Fullscreen ? "yes" : QString());
     409    }
    377410}
    378411
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r27215 r27243  
    6565
    6666    /* Move VM to default (normal) state: */
    67     void enterBaseVisualState();
     67    void enterInitialVisualState();
    6868
    6969    /* Private getters: */
     
    7171    UIActionsPool* actionsPool() const { return m_pActionsPool; }
    7272
     73    /* Prepare helpers: */
     74    void loadMachineSettings();
     75
     76    /* Cleanup helpers: */
     77    void saveMachineSettings();
     78
    7379    /* Private variables: */
    7480    UIMachine **m_ppThis;
     81    UIVisualStateType initialStateType;
    7582    CSession m_session;
    7683    UIActionsPool *m_pActionsPool;
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