VirtualBox

Changeset 52995 in vbox for trunk


Ignore:
Timestamp:
Oct 8, 2014 1:55:16 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI rework/cleanup for 7115 (part #6): Better encapsulation for UIMachine (part #3).

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r52991 r52995  
    41094109        m_fSeparateProcess = fSeparateProcess;
    41104110
     4111        /* Search for corresponding VM: */
    41114112        QUuid uuid = QUuid(vmNameOrUuid);
     4113        const CMachine machine = mVBox.FindMachine(vmNameOrUuid);
    41124114        if (!uuid.isNull())
    41134115        {
    4114             vmUuid = vmNameOrUuid;
     4116            if (machine.isNull() && showStartVMErrors())
     4117                return msgCenter().cannotFindMachineById(mVBox, vmNameOrUuid);
    41154118        }
    41164119        else
    41174120        {
    4118             CMachine m = mVBox.FindMachine (vmNameOrUuid);
    4119             if (m.isNull())
    4120             {
    4121                 if (showStartVMErrors())
    4122                     msgCenter().cannotFindMachineByName (mVBox, vmNameOrUuid);
    4123                 return;
    4124             }
    4125             vmUuid = m.GetId();
    4126         }
     4121            if (machine.isNull() && showStartVMErrors())
     4122                return msgCenter().cannotFindMachineByName(mVBox, vmNameOrUuid);
     4123        }
     4124        vmUuid = machine.GetId();
    41274125    }
    41284126
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r52991 r52995  
    115115
    116116        /* Which VM we operate on? */
    117         CMachine machine  = session.GetMachine();
     117        CMachine machine = session.GetMachine();
    118118        /* Which snapshot we are restoring? */
    119119        CSnapshot snapshot = machine.GetCurrentSnapshot();
     
    138138    }
    139139
     140    /* For separate process we should launch VM before UI: */
     141    if (vboxGlobal().isSeparateProcess())
     142    {
     143        /* Get corresponding machine: */
     144        CMachine machine = vboxGlobal().virtualBox().FindMachine(vboxGlobal().managedVMUuid());
     145        AssertMsgReturn(!machine.isNull(), ("VBoxGlobal::managedVMUuid() should have filter that case before!\n"), false);
     146
     147        /* Try to launch corresponding machine: */
     148        if (!vboxGlobal().launchMachine(machine, VBoxGlobal::LaunchMode_Separate))
     149            return false;
     150    }
     151
    140152    /* Create machine UI: */
    141153    new UIMachine;
     
    217229bool UIMachine::prepare()
    218230{
    219     KLockType lockType;
    220     if (!vboxGlobal().isSeparateProcess())
    221     {
    222         lockType = KLockType_VM;
    223     }
    224     else
    225     {
    226         /* Try to find corresponding machine: */
    227         CVirtualBox virtualBox = vboxGlobal().virtualBox();
    228         CMachine machine = virtualBox.FindMachine(vboxGlobal().managedVMUuid());
    229         if (machine.isNull())
    230         {
    231             msgCenter().cannotFindMachineById(virtualBox, vboxGlobal().managedVMUuid());
    232             return false;
    233         }
    234 
    235         /* Try to launch corresponding machine: */
    236         if (!vboxGlobal().launchMachine(machine, VBoxGlobal::LaunchMode_Separate))
    237             return false;
    238 
    239         lockType = KLockType_Shared;
    240     }
    241 
    242231    /* Create VM session: */
    243     m_session = vboxGlobal().openSession(vboxGlobal().managedVMUuid(), lockType);
     232    m_session = vboxGlobal().openSession(vboxGlobal().managedVMUuid(),
     233                                         vboxGlobal().isSeparateProcess() ? KLockType_Shared : KLockType_VM);
    244234    if (m_session.isNull())
    245235        return false;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r52991 r52995  
    8585    /** Prepare routine: Loading stuff. */
    8686    void loadSettings();
    87     /** Prepare routine: Saving stuff. */
     87    /** Cleanup routine: Saving stuff. */
    8888    void saveSettings();
    8989    /** Cleanup routine. */
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