VirtualBox

Ignore:
Timestamp:
Apr 26, 2012 3:57:29 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77627
Message:

FE/Qt: Little VBoxGlobal cleanup.

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

Legend:

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

    r41018 r41062  
    441441}
    442442
    443 
    444 QWidget *VBoxGlobal::vmWindow()
    445 {
    446     if (isVMConsoleProcess())
    447     {
    448         if (m_pVirtualMachine)
    449             return m_pVirtualMachine->mainWindow();
    450     }
    451     return NULL;
    452 }
    453 
    454 bool VBoxGlobal::createVirtualMachine(const CSession &session)
    455 {
    456     if (!m_pVirtualMachine && !session.isNull())
    457     {
    458         UIMachine *pVirtualMachine = new UIMachine(&m_pVirtualMachine, session);
    459         Assert(pVirtualMachine == m_pVirtualMachine);
    460         NOREF(pVirtualMachine);
    461         return true;
    462     }
    463     return false;
     443bool VBoxGlobal::startMachine(const QString &strMachineId)
     444{
     445    /* Some restrictions: */
     446    AssertMsg(mValid, ("VBoxGlobal is invalid"));
     447    AssertMsg(!m_pVirtualMachine, ("Machine already started"));
     448
     449    /* Create session: */
     450    CSession session = vboxGlobal().openSession(strMachineId);
     451    if (session.isNull())
     452        return false;
     453
     454    /* Start virtual machine: */
     455    UIMachine *pVirtualMachine = new UIMachine(&m_pVirtualMachine, session);
     456    Assert(pVirtualMachine == m_pVirtualMachine);
     457    Q_UNUSED(pVirtualMachine);
     458    return true;
    464459}
    465460
     
    467462{
    468463    return m_pVirtualMachine;
     464}
     465
     466QWidget* VBoxGlobal::vmWindow()
     467{
     468    if (isVMConsoleProcess() && m_pVirtualMachine)
     469        return m_pVirtualMachine->mainWindow();
     470    return 0;
    469471}
    470472
     
    22632265
    22642266    return session;
    2265 }
    2266 
    2267 /**
    2268  *  Starts a machine with the given ID.
    2269  */
    2270 bool VBoxGlobal::startMachine(const QString &strId)
    2271 {
    2272     AssertReturn(mValid, false);
    2273 
    2274     CSession session = vboxGlobal().openSession(strId);
    2275     if (session.isNull())
    2276         return false;
    2277 
    2278     return createVirtualMachine(session);
    22792267}
    22802268
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r39968 r41062  
    142142    UISelectorWindow &selectorWnd();
    143143
    144     QWidget *vmWindow();
    145 
    146     bool createVirtualMachine(const CSession &session);
     144    /* VM stuff: */
     145    bool startMachine(const QString &strMachineId);
    147146    UIMachine* virtualMachine();
    148 
    149     /* main window handle storage */
    150     void setMainWindow (QWidget *aMainWindow) { mMainWindow = aMainWindow; }
    151     QWidget *mainWindow() const { return mMainWindow; }
     147    QWidget* vmWindow();
     148
     149    /* Main application window storage: */
     150    void setMainWindow(QWidget *pMainWindow) { mMainWindow = pMainWindow; }
     151    QWidget* mainWindow() const { return mMainWindow; }
    152152
    153153    bool is3DAvailable() const { return m3DAvailable; }
     
    598598    CSession openExistingSession(const QString &aId) { return openSession (aId, true); }
    599599
    600     bool startMachine(const QString &strId);
    601 
    602600    void startEnumeratingMedia();
    603601
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r38476 r41062  
    382382    , m_pVisualState(0)
    383383{
    384     /* Storing self: */
     384    /* Store self pointer: */
    385385    if (m_ppThis)
    386386        *m_ppThis = this;
    387387
    388     /* Create UISession object: */
     388    /* Create UI session: */
    389389    m_pSession = new UISession(this, m_session);
    390390
     
    406406    /* Save machine settings: */
    407407    saveMachineSettings();
    408     /* Erase itself pointer: */
    409     *m_ppThis = 0;
    410     /* Delete uisession children in backward direction: */
     408
     409    /* Delete visual state: */
    411410    delete m_pVisualState;
    412411    m_pVisualState = 0;
     412
     413    /* Delete UI session: */
    413414    delete m_pSession;
    414415    m_pSession = 0;
     416
     417    /* Free session finally: */
    415418    m_session.UnlockMachine();
    416419    m_session.detach();
     420
     421    /* Clear self pointer: */
     422    *m_ppThis = 0;
     423
    417424    /* Quit application: */
    418425    QApplication::quit();
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette