VirtualBox

Ignore:
Timestamp:
Oct 10, 2014 12:14:37 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI rework/cleanup for 7115 (part #11): Caching most of important session/console getters in UISession.

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

Legend:

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

    r53001 r53028  
    5858
    5959/* COM includes: */
    60 # include "CConsole.h"
    6160# include "CSystemProperties.h"
    62 # include "CMachineDebugger.h"
    63 # include "CGuest.h"
    6461# include "CStorageController.h"
    6562# include "CMediumAttachment.h"
    66 # include "CDisplay.h"
    67 # include "CMouse.h"
    6863# include "CNetworkAdapter.h"
    6964# include "CHostNetworkInterface.h"
     
    168163        return;
    169164
    170     /* Get current machine/console: */
    171     CMachine machine = session().GetMachine();
    172     CConsole console = session().GetConsole();
    173 
    174165    /* Apply debug settings from the command line. */
    175     CMachineDebugger debugger = console.GetDebugger();
    176     if (debugger.isOk())
     166    if (debugger().isOk())
    177167    {
    178168        if (vboxGlobal().isPatmDisabled())
    179             debugger.SetPATMEnabled(false);
     169            debugger().SetPATMEnabled(false);
    180170        if (vboxGlobal().isCsamDisabled())
    181             debugger.SetCSAMEnabled(false);
     171            debugger().SetCSAMEnabled(false);
    182172        if (vboxGlobal().isSupervisorCodeExecedRecompiled())
    183             debugger.SetRecompileSupervisor(true);
     173            debugger().SetRecompileSupervisor(true);
    184174        if (vboxGlobal().isUserCodeExecedRecompiled())
    185             debugger.SetRecompileUser(true);
     175            debugger().SetRecompileUser(true);
    186176        if (vboxGlobal().areWeToExecuteAllInIem())
    187             debugger.SetExecuteAllInIEM(true);
     177            debugger().SetExecuteAllInIEM(true);
    188178        if (!vboxGlobal().isDefaultWarpPct())
    189             debugger.SetVirtualTimeRate(vboxGlobal().getWarpPct());
     179            debugger().SetVirtualTimeRate(vboxGlobal().getWarpPct());
    190180    }
    191181
     
    195185#ifdef VBOX_WITH_DEBUGGER_GUI
    196186        CProgress progress = vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled() ?
    197                              console.PowerUpPaused() : console.PowerUp();
     187                             console().PowerUpPaused() : console().PowerUp();
    198188#else /* !VBOX_WITH_DEBUGGER_GUI */
    199         CProgress progress = console.PowerUp();
     189        CProgress progress = console().PowerUp();
    200190#endif /* !VBOX_WITH_DEBUGGER_GUI */
    201191
    202192        /* Check for immediate failure: */
    203         if (!console.isOk())
     193        if (!console().isOk())
    204194        {
    205195            if (vboxGlobal().showStartVMErrors())
    206                 msgCenter().cannotStartMachine(console, machine.GetName());
     196                msgCenter().cannotStartMachine(console(), machineName());
    207197            closeRuntimeUI();
    208198            return;
     
    216206        if (isSaved())
    217207        {
    218             msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_state_restore_90px.png", 0, 0);
     208            msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_state_restore_90px.png", 0, 0);
    219209            /* After restoring from 'saved' state, machine-window(s) geometry should be adjusted: */
    220210            machineLogic()->adjustMachineWindowsGeometry();
    221211        }
    222212        else
    223             msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_start_90px.png");
     213            msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_start_90px.png");
    224214
    225215        /* Check for a progress failure: */
     
    227217        {
    228218            if (vboxGlobal().showStartVMErrors())
    229                 msgCenter().cannotStartMachine(progress, machine.GetName());
     219                msgCenter().cannotStartMachine(progress, machineName());
    230220            closeRuntimeUI();
    231221            return;
     
    238228    else
    239229    {
    240         /* Fetch the current state: */
    241         CMouse mouse = console.GetMouse();
    242         m_fIsMouseSupportsAbsolute = mouse.GetAbsoluteSupported();
    243         m_fIsMouseSupportsRelative = mouse.GetRelativeSupported();
    244         m_fIsMouseSupportsMultiTouch = mouse.GetMultiTouchSupported();
    245         m_fIsMouseHostCursorNeeded = mouse.GetNeedsHostCursor();
    246 
     230        /* Fetch the current mouse state: */
     231        m_fIsMouseSupportsAbsolute = mouse().GetAbsoluteSupported();
     232        m_fIsMouseSupportsRelative = mouse().GetRelativeSupported();
     233        m_fIsMouseSupportsMultiTouch = mouse().GetMultiTouchSupported();
     234        m_fIsMouseHostCursorNeeded = mouse().GetNeedsHostCursor();
     235        /* Fetch the current guest additions state: */
    247236        sltAdditionsChange();
    248237    }
     
    255244    }
    256245
    257     /* Check if the required virtualization features are active. We get this
    258      * info only when the session is active. */
    259     bool fIs64BitsGuest = vboxGlobal().virtualBox().GetGuestOSType(console.GetGuest().GetOSTypeId()).GetIs64Bit();
    260     bool fRecommendVirtEx = vboxGlobal().virtualBox().GetGuestOSType(console.GetGuest().GetOSTypeId()).GetRecommendedVirtEx();
     246    /* Check if the required virtualization features are active. We get this info only when the session is active. */
     247    const bool fIs64BitsGuest = vboxGlobal().virtualBox().GetGuestOSType(guest().GetOSTypeId()).GetIs64Bit();
     248    const bool fRecommendVirtEx = vboxGlobal().virtualBox().GetGuestOSType(guest().GetOSTypeId()).GetRecommendedVirtEx();
    261249    AssertMsg(!fIs64BitsGuest || fRecommendVirtEx, ("Virtualization support missed for 64bit guest!\n"));
    262     bool fIsVirtEnabled = console.GetDebugger().GetHWVirtExEnabled();
     250    bool fIsVirtEnabled = debugger().GetHWVirtExEnabled();
    263251    if (fRecommendVirtEx && !fIsVirtEnabled)
    264252    {
     
    277265        if (fShouldWeClose)
    278266        {
    279             /* At this point the console is powered up. So we have to close
    280              * this session again. */
    281             CProgress progress = console.PowerDown();
    282             if (console.isOk())
     267            /* At this point the console is powered up.
     268             * So we have to close this session again. */
     269            CProgress progress = console().PowerDown();
     270            if (console().isOk())
    283271            {
    284272                /* Guard progressbar warnings from auto-closing: */
     
    286274                    uimachine()->machineLogic()->setPreventAutoClose(true);
    287275                /* Show the power down progress dialog */
    288                 msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_poweroff_90px.png");
     276                msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_poweroff_90px.png");
    289277                if (!progress.isOk() || progress.GetResultCode() != 0)
    290                     msgCenter().cannotPowerDownMachine(progress, machine.GetName());
     278                    msgCenter().cannotPowerDownMachine(progress, machineName());
    291279                /* Allow further auto-closing: */
    292280                if (uimachine()->machineLogic())
     
    294282            }
    295283            else
    296                 msgCenter().cannotPowerDownMachine(console);
     284                msgCenter().cannotPowerDownMachine(console());
    297285            closeRuntimeUI();
    298286            return;
     
    304292#ifdef VBOX_WITH_VIDEOHWACCEL
    305293    LogRel(("2D video acceleration is %s.\n",
    306            machine.GetAccelerate2DVideoEnabled() && VBoxGlobal::isAcceleration2DVideoAvailable()
     294           machine().GetAccelerate2DVideoEnabled() && VBoxGlobal::isAcceleration2DVideoAvailable()
    307295                 ? "enabled"
    308296                 : "disabled"));
    309 #endif
     297#endif /* VBOX_WITH_VIDEOHWACCEL */
    310298
    311299/* Check if HID LEDs sync is enabled and add a log message about it. */
     
    330318{
    331319    /* Prepare the saving progress: */
    332     CMachine machine = m_session.GetMachine();
    333     CConsole console = m_session.GetConsole();
    334     CProgress progress = console.SaveState();
    335     if (console.isOk())
     320    CProgress progress = console().SaveState();
     321    if (console().isOk())
    336322    {
    337323        /* Show the saving progress: */
    338         msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_state_save_90px.png");
     324        msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_state_save_90px.png");
    339325        if (!progress.isOk() || progress.GetResultCode() != 0)
    340326        {
    341327            /* Failed in progress: */
    342             msgCenter().cannotSaveMachineState(progress, machine.GetName());
     328            msgCenter().cannotSaveMachineState(progress, machineName());
    343329            return false;
    344330        }
     
    347333    {
    348334        /* Failed in console: */
    349         msgCenter().cannotSaveMachineState(console);
     335        msgCenter().cannotSaveMachineState(console());
    350336        return false;
    351337    }
     
    357343{
    358344    /* Send ACPI shutdown signal if possible: */
    359     CConsole console = m_session.GetConsole();
    360     console.PowerButton();
    361     if (!console.isOk())
     345    console().PowerButton();
     346    if (!console().isOk())
    362347    {
    363348        /* Failed in console: */
    364         msgCenter().cannotACPIShutdownMachine(console);
     349        msgCenter().cannotACPIShutdownMachine(console());
    365350        return false;
    366351    }
     
    372357{
    373358    /* Prepare the power-off progress: */
    374     CMachine machine = m_session.GetMachine();
    375     CConsole console = m_session.GetConsole();
    376     CProgress progress = console.PowerDown();
    377     if (console.isOk())
     359    CProgress progress = console().PowerDown();
     360    if (console().isOk())
    378361    {
    379362        /* Show the power-off progress: */
    380         msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_poweroff_90px.png");
     363        msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_poweroff_90px.png");
    381364        if (progress.isOk() && progress.GetResultCode() == 0)
    382365        {
     
    385368            {
    386369                /* Prepare the snapshot-discard progress: */
    387                 CSnapshot snapshot = machine.GetCurrentSnapshot();
    388                 CProgress progress = console.RestoreSnapshot(snapshot);
    389                 if (!console.isOk())
    390                     return msgCenter().cannotRestoreSnapshot(console, snapshot.GetName(), machine.GetName());
     370                CSnapshot snapshot = machine().GetCurrentSnapshot();
     371                CProgress progress = console().RestoreSnapshot(snapshot);
     372                if (!console().isOk())
     373                    return msgCenter().cannotRestoreSnapshot(console(), snapshot.GetName(), machineName());
    391374
    392375                /* Show the snapshot-discard progress: */
    393                 msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_discard_90px.png");
     376                msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_snapshot_discard_90px.png");
    394377                if (progress.GetResultCode() != 0)
    395                     return msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), machine.GetName());
     378                    return msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), machineName());
    396379            }
    397380        }
     
    399382        {
    400383            /* Failed in progress: */
    401             msgCenter().cannotPowerDownMachine(progress, machine.GetName());
     384            msgCenter().cannotPowerDownMachine(progress, machineName());
    402385            return false;
    403386        }
     
    406389    {
    407390        /* Check the machine state, it might be already gone: */
    408         if (!console.isNull())
     391        if (!console().isNull())
    409392        {
    410393           /* Failed in console: */
    411            COMResult res(console);
     394           COMResult res(console());
    412395           /* This can happen if VBoxSVC is not running: */
    413396           if (FAILED_DEAD_INTERFACE(res.rc()))
    414397               fServerCrashed = true;
    415398           else
    416                msgCenter().cannotPowerDownMachine(console);
     399               msgCenter().cannotPowerDownMachine(console());
    417400           return false;
    418401        }
     
    450433bool UISession::setPause(bool fOn)
    451434{
    452     CConsole console = session().GetConsole();
    453     if (console.isNull())
    454         return true;
    455 
    456435    if (fOn)
    457         console.Pause();
     436        console().Pause();
    458437    else
    459         console.Resume();
    460 
    461     bool ok = console.isOk();
     438        console().Resume();
     439
     440    bool ok = console().isOk();
    462441    if (!ok)
    463442    {
    464443        if (fOn)
    465             msgCenter().cannotPauseMachine(console);
     444            msgCenter().cannotPauseMachine(console());
    466445        else
    467             msgCenter().cannotResumeMachine(console);
     446            msgCenter().cannotResumeMachine(console());
    468447    }
    469448
     
    481460    fDoMount = true;
    482461#else /* VBOX_WITH_ADDITIONS_AUTOUPDATE_UI */
    483     CGuest guest = session().GetConsole().GetGuest();
    484462    QVector<KAdditionsUpdateFlag> aFlagsUpdate;
    485463    QVector<QString> aArgs;
    486     CProgress progressInstall = guest.UpdateGuestAdditions(strSource,
    487                                                            aArgs, aFlagsUpdate);
    488     bool fResult = guest.isOk();
     464    CProgress progressInstall = guest().UpdateGuestAdditions(strSource,
     465                                                             aArgs, aFlagsUpdate);
     466    bool fResult = guest().isOk();
    489467    if (fResult)
    490468    {
     
    535513    AssertReturnVoid(!strMediumID.isNull());
    536514
    537     /* Get machine: */
    538     CMachine machine = session().GetMachine();
    539 
    540515    /* Searching for the first suitable controller/slot: */
    541516    QString strControllerName;
    542517    LONG iCntPort = -1, iCntDevice = -1;
    543     foreach (const CStorageController &controller, machine.GetStorageControllers())
    544     {
    545         foreach (const CMediumAttachment &attachment, machine.GetMediumAttachmentsOfController(controller.GetName()))
     518    foreach (const CStorageController &controller, machine().GetStorageControllers())
     519    {
     520        foreach (const CMediumAttachment &attachment, machine().GetMediumAttachmentsOfController(controller.GetName()))
    546521        {
    547522            if (attachment.GetType() == KDeviceType_DVD)
     
    560535    if (strControllerName.isNull())
    561536    {
    562         msgCenter().cannotMountGuestAdditions(machine.GetName());
     537        msgCenter().cannotMountGuestAdditions(machineName());
    563538        return;
    564539    }
     
    574549
    575550    /* Mount medium to corresponding controller/slot: */
    576     machine.MountMedium(strControllerName, iCntPort, iCntDevice, medium.medium(), false /* force */);
    577     if (!machine.isOk())
     551    machine().MountMedium(strControllerName, iCntPort, iCntDevice, medium.medium(), false /* force */);
     552    if (!machine().isOk())
    578553    {
    579554        /* Ask for force mounting: */
    580         if (msgCenter().cannotRemountMedium(machine, medium, true /* mount? */,
     555        if (msgCenter().cannotRemountMedium(machine(), medium, true /* mount? */,
    581556                                            true /* retry? */, mainMachineWindow()))
    582557        {
    583558            /* Force mount medium to the predefined port/device: */
    584             machine.MountMedium(strControllerName, iCntPort, iCntDevice, medium.medium(), true /* force */);
    585             if (!machine.isOk())
    586                 msgCenter().cannotRemountMedium(machine, medium, true /* mount? */,
     559            machine().MountMedium(strControllerName, iCntPort, iCntDevice, medium.medium(), true /* force */);
     560            if (!machine().isOk())
     561                msgCenter().cannotRemountMedium(machine(), medium, true /* mount? */,
    587562                                                false /* retry? */, mainMachineWindow());
    588563        }
     
    722697void UISession::sltVRDEChange()
    723698{
    724     /* Get machine: */
    725     const CMachine machine = session().GetMachine();
    726699    /* Get VRDE server: */
    727     const CVRDEServer &server = machine.GetVRDEServer();
     700    const CVRDEServer &server = machine().GetVRDEServer();
    728701    bool fIsVRDEServerAvailable = !server.isNull();
    729702    /* Show/Hide VRDE action depending on VRDE server availability status: */
     
    740713void UISession::sltVideoCaptureChange()
    741714{
    742     /* Get machine: */
    743     const CMachine machine = session().GetMachine();
    744715    /* Check/Uncheck Video Capture action depending on feature status: */
    745     actionPool()->action(UIActionIndexRT_M_Devices_M_VideoCapture_T_Start)->setChecked(machine.GetVideoCaptureEnabled());
     716    actionPool()->action(UIActionIndexRT_M_Devices_M_VideoCapture_T_Start)->setChecked(machine().GetVideoCaptureEnabled());
    746717    /* Notify listeners about Video Capture change: */
    747718    emit sigVideoCaptureChange();
     
    870841void UISession::sltAdditionsChange()
    871842{
    872     /* Get our guest: */
    873     CGuest guest = session().GetConsole().GetGuest();
    874 
    875843    /* Variable flags: */
    876     ULONG ulGuestAdditionsRunLevel = guest.GetAdditionsRunLevel();
     844    ULONG ulGuestAdditionsRunLevel = guest().GetAdditionsRunLevel();
    877845    LONG64 lLastUpdatedIgnored;
    878     bool fIsGuestSupportsGraphics = guest.GetFacilityStatus(KAdditionsFacilityType_Graphics, lLastUpdatedIgnored)
     846    bool fIsGuestSupportsGraphics = guest().GetFacilityStatus(KAdditionsFacilityType_Graphics, lLastUpdatedIgnored)
    879847                                    == KAdditionsFacilityStatus_Active;
    880     bool fIsGuestSupportsSeamless = guest.GetFacilityStatus(KAdditionsFacilityType_Seamless, lLastUpdatedIgnored)
     848    bool fIsGuestSupportsSeamless = guest().GetFacilityStatus(KAdditionsFacilityType_Seamless, lLastUpdatedIgnored)
    881849                                    == KAdditionsFacilityStatus_Active;
    882850    /* Check if something had changed: */
     
    998966        return false;
    999967
     968    /* Get machine: */
     969    m_machine = m_session.GetMachine();
     970    if (m_machine.isNull())
     971        return false;
     972
     973    /* Get console: */
     974    m_console = m_session.GetConsole();
     975    if (m_console.isNull())
     976        return false;
     977
     978    /* Get display: */
     979    m_display = m_console.GetDisplay();
     980    if (m_display.isNull())
     981        return false;
     982
     983    /* Get mouse: */
     984    m_mouse = m_console.GetMouse();
     985    if (m_mouse.isNull())
     986        return false;
     987
     988    /* Get guest: */
     989    m_guest = m_console.GetGuest();
     990    if (m_guest.isNull())
     991        return false;
     992
     993    /* Get debugger: */
     994    m_debugger = m_console.GetDebugger();
     995    if (m_debugger.isNull())
     996        return false;
     997
    1000998    /* Update machine-state: */
    1001     m_machineState = m_session.GetMachine().GetState();
     999    m_machineState = machine().GetState();
    10021000
    10031001    /* True by default: */
     
    10141012        actionPool()->toRuntime()->setSession(this);
    10151013
    1016         /* Get host/machine: */
     1014        /* Get host: */
    10171015        const CHost host = vboxGlobal().host();
    1018         const CMachine machine = session().GetConsole().GetMachine();
    10191016        UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restriction = UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid;
    10201017
     
    10241021            int iDevicesCountCD = 0;
    10251022            int iDevicesCountFD = 0;
    1026             foreach (const CMediumAttachment &attachment, machine.GetMediumAttachments())
     1023            foreach (const CMediumAttachment &attachment, machine().GetMediumAttachments())
    10271024            {
    10281025                if (attachment.GetType() == KDeviceType_DVD)
     
    10451042            /* Initialize Network menu: */
    10461043            bool fAtLeastOneAdapterActive = false;
    1047             const KChipsetType chipsetType = machine.GetChipsetType();
     1044            const KChipsetType chipsetType = machine().GetChipsetType();
    10481045            ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(chipsetType);
    10491046            for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot)
    10501047            {
    1051                 const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot);
     1048                const CNetworkAdapter &adapter = machine().GetNetworkAdapter(uSlot);
    10521049                if (adapter.GetEnabled())
    10531050                {
     
    10631060        {
    10641061            /* Check whether there is at least one USB controller with an available proxy. */
    1065             const bool fUSBEnabled =    !machine.GetUSBDeviceFilters().isNull()
    1066                                      && !machine.GetUSBControllers().isEmpty()
    1067                                      && machine.GetUSBProxyAvailable();
     1062            const bool fUSBEnabled =    !machine().GetUSBDeviceFilters().isNull()
     1063                                     && !machine().GetUSBControllers().isEmpty()
     1064                                     && machine().GetUSBProxyAvailable();
    10681065            if (!fUSBEnabled)
    10691066                restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices);
     
    10741071            /* Check whether there is an accessible video input devices pool: */
    10751072            host.GetVideoInputDevices();
    1076             const bool fWebCamsEnabled = host.isOk() && !machine.GetUSBControllers().isEmpty();
     1073            const bool fWebCamsEnabled = host.isOk() && !machine().GetUSBControllers().isEmpty();
    10771074            if (!fWebCamsEnabled)
    10781075                restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams);
     
    11891186#endif /* Q_WS_MAC */
    11901187
    1191     /* Get machine: */
    1192     CMachine machine = m_session.GetMachine();
    1193 
    11941188    /* Prepare initial screen visibility status: */
    1195     m_monitorVisibilityVector.resize(machine.GetMonitorCount());
     1189    m_monitorVisibilityVector.resize(machine().GetMonitorCount());
    11961190    m_monitorVisibilityVector.fill(false);
    11971191    m_monitorVisibilityVector[0] = true;
     
    12051199            BOOL fEnabled = true;
    12061200            ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
    1207             machine.QuerySavedGuestScreenInfo(i, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
     1201            machine().QuerySavedGuestScreenInfo(i, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
    12081202            m_monitorVisibilityVector[i] = fEnabled;
    12091203        }
     
    12171211{
    12181212    /* Each framebuffer will be really prepared on first UIMachineView creation: */
    1219     m_frameBufferVector.resize(m_session.GetMachine().GetMonitorCount());
     1213    m_frameBufferVector.resize(machine().GetMonitorCount());
    12201214}
    12211215
     
    13261320            pFrameBuffer->setMarkAsUnused(true);
    13271321            /* Detach framebuffer from Display: */
    1328             CDisplay display = session().GetConsole().GetDisplay();
    1329             if (!display.isNull())
    1330                 display.DetachFramebuffer(i);
     1322            display().DetachFramebuffer(i);
    13311323            /* Release framebuffer reference: */
    13321324            m_frameBufferVector[i].setNull();
     
    13661358void UISession::cleanupSession()
    13671359{
     1360    /* Detach debugger: */
     1361    if (!m_debugger.isNull())
     1362        m_debugger.detach();
     1363
     1364    /* Detach guest: */
     1365    if (!m_guest.isNull())
     1366        m_guest.detach();
     1367
     1368    /* Detach mouse: */
     1369    if (!m_mouse.isNull())
     1370        m_mouse.detach();
     1371
     1372    /* Detach display: */
     1373    if (!m_display.isNull())
     1374        m_display.detach();
     1375
     1376    /* Detach console: */
     1377    if (!m_console.isNull())
     1378        m_console.detach();
     1379
     1380    /* Detach machine: */
     1381    if (!m_machine.isNull())
     1382        m_machine.detach();
     1383
    13681384    /* Close session: */
    13691385    if (!m_session.isNull())
     
    16631679        popupCenter().remindAboutAutoCapture(machineLogic()->activeMachineWindow());
    16641680
    1665     /* Shows First Run wizard if necessary: */
    1666     const CMachine &machine = session().GetMachine();
    16671681    /* Check if we are in teleportation waiting mode.
    16681682     * In that case no first run wizard is necessary. */
    1669     m_machineState = machine.GetState();
     1683    m_machineState = machine().GetState();
    16701684    if (   isFirstTimeStarted()
    16711685        && !((   m_machineState == KMachineState_PoweredOff
    16721686              || m_machineState == KMachineState_Aborted
    16731687              || m_machineState == KMachineState_Teleported)
    1674              && machine.GetTeleporterEnabled()))
    1675     {
    1676         UISafePointerWizard pWizard = new UIWizardFirstRun(mainMachineWindow(), session().GetMachine());
     1688             && machine().GetTeleporterEnabled()))
     1689    {
     1690        UISafePointerWizard pWizard = new UIWizardFirstRun(mainMachineWindow(), machine());
    16771691        pWizard->prepare();
    16781692        pWizard->exec();
     
    16821696
    16831697#ifdef VBOX_WITH_NETFLT
    1684 
    16851698    /* Skip further checks if VM in saved state */
    16861699    if (isSaved())
     
    17031716    }
    17041717
    1705     ulong cCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(machine.GetChipsetType());
     1718    ulong cCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(machine().GetChipsetType());
    17061719    for (ulong uAdapterIndex = 0; uAdapterIndex < cCount; ++uAdapterIndex)
    17071720    {
    1708         CNetworkAdapter na = machine.GetNetworkAdapter(uAdapterIndex);
     1721        CNetworkAdapter na = machine().GetNetworkAdapter(uAdapterIndex);
    17091722
    17101723        if (na.GetEnabled())
     
    17361749    if (!failedInterfaceNames.isEmpty())
    17371750    {
    1738         if (msgCenter().UIMessageCenter::cannotStartWithoutNetworkIf(machine.GetName(), failedInterfaceNames.join(", ")))
     1751        if (msgCenter().UIMessageCenter::cannotStartWithoutNetworkIf(machineName(), failedInterfaceNames.join(", ")))
    17391752            machineLogic()->openNetworkSettingsDialog();
    17401753        else
     
    17441757        }
    17451758    }
    1746 
    1747 #endif
     1759#endif /* VBOX_WITH_NETFLT */
    17481760
    17491761    return true;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r53000 r53028  
    3030#include "COMEnums.h"
    3131#include "CSession.h"
     32#include "CMachine.h"
     33#include "CConsole.h"
     34#include "CDisplay.h"
     35#include "CMouse.h"
     36#include "CGuest.h"
     37#include "CMachineDebugger.h"
    3238
    3339/* Forward declarations: */
     
    8995    void closeRuntimeUI();
    9096
    91     /* Common getters: */
     97    /** Returns the session instance. */
    9298    CSession& session() { return m_session; }
     99    /** Returns the session's machine instance. */
     100    CMachine& machine() { return m_machine; }
     101    /** Returns the session's console instance. */
     102    CConsole& console() { return m_console; }
     103    /** Returns the console's display instance. */
     104    CDisplay& display() { return m_display; }
     105    /** Returns the console's mouse instance. */
     106    CMouse& mouse() { return m_mouse; }
     107    /** Returns the console's guest instance. */
     108    CGuest& guest() { return m_guest; }
     109    /** Returns the console's debugger instance. */
     110    CMachineDebugger& debugger() { return m_debugger; }
     111
     112    /** Returns the machine name. */
     113    const QString& machineName() const { return m_strMachineName; }
     114
    93115    UIActionPool* actionPool() const { return m_pActionPool; }
    94116    KMachineState machineStatePrevious() const { return m_machineStatePrevious; }
     
    357379    /** Holds the session instance. */
    358380    CSession m_session;
     381    /** Holds the session's machine instance. */
     382    CMachine m_machine;
     383    /** Holds the session's console instance. */
     384    CConsole m_console;
     385    /** Holds the console's display instance. */
     386    CDisplay m_display;
     387    /** Holds the console's mouse instance. */
     388    CMouse m_mouse;
     389    /** Holds the console's guest instance. */
     390    CGuest m_guest;
     391    /** Holds the console's debugger instance. */
     392    CMachineDebugger m_debugger;
     393
     394    /** Holds the machine name. */
     395    QString m_strMachineName;
    359396
    360397    /** Holds the action-pool instance. */
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