Changeset 52991 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 8, 2014 12:24:10 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r52977 r52991 221 221 : mValid (false) 222 222 , mSelectorWnd (NULL) 223 , m_pVirtualMachine(0)224 223 , m_fSeparateProcess(false) 225 224 , m_pMediumEnumerator(0) … … 374 373 } 375 374 376 QWidget* VBoxGlobal::activeMachineWindow() 377 { 378 /* Null if that is NOT console-process or machine not yet created: */ 379 if (!isVMConsoleProcess() || !m_pVirtualMachine) 380 return 0; 381 /* Active machine-window otherwise: */ 382 return m_pVirtualMachine->activeWindow(); 383 } 384 375 UIMachine* VBoxGlobal::virtualMachine() const 376 { 377 return gpMachine; 378 } 379 380 QWidget* VBoxGlobal::activeMachineWindow() const 381 { 382 if (isVMConsoleProcess() && gpMachine && gpMachine->activeWindow()) 383 return gpMachine->activeWindow(); 384 return 0; 385 } 385 386 386 387 /** … … 4246 4247 mSelectorWnd = NULL; 4247 4248 } 4248 4249 if (m_pVirtualMachine) 4250 { 4251 delete m_pVirtualMachine; 4252 m_pVirtualMachine = NULL; 4253 } 4249 if (gpMachine) 4250 UIMachine::destroy(); 4254 4251 4255 4252 /* Cleanup medium-enumerator: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r52977 r52991 111 111 112 112 /** Returns current virtual machine. */ 113 UIMachine* virtualMachine() const { return m_pVirtualMachine; } 114 /** Defines current virtual @a pMachine. */ 115 void setVirtualMachine(UIMachine *pMachine) { m_pVirtualMachine = pMachine; } 116 117 QWidget* activeMachineWindow(); 113 UIMachine* virtualMachine() const; 114 /** Returns currently active virtual machine window. */ 115 QWidget* activeMachineWindow() const; 118 116 119 117 bool is3DAvailableWorker() const; … … 437 435 438 436 UISelectorWindow *mSelectorWnd; 439 UIMachine *m_pVirtualMachine;440 437 441 438 /** Holds whether GUI is separate (from VM) process. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r52989 r52991 97 97 98 98 /* static */ 99 UIMachine* UIMachine::m_spInstance = 0; 100 101 /* static */ 99 102 bool UIMachine::startMachine(const QString &strID) 100 103 { … … 136 139 137 140 /* Create machine UI: */ 138 UIMachine *pMachine = new UIMachine; 139 141 new UIMachine; 140 142 /* Prepare machine UI: */ 141 return pMachine->prepare(); 143 return m_spInstance->prepare(); 144 } 145 146 /* static */ 147 void UIMachine::destroy() 148 { 149 /* Cleanup machine UI: */ 150 m_spInstance->cleanup(); 151 /* Destroy machine UI: */ 152 delete m_spInstance; 153 m_spInstance = 0; 142 154 } 143 155 … … 195 207 , m_pVisualState(0) 196 208 { 197 /* Make sure VBoxGlobal is aware of VM creation: */ 198 vboxGlobal().setVirtualMachine(this); 209 m_spInstance = this; 199 210 } 200 211 201 212 UIMachine::~UIMachine() 202 213 { 203 /* Make sure VBoxGlobal is aware of VM destruction: */ 204 vboxGlobal().setVirtualMachine(0); 205 206 /* Cleanup machine UI: */ 207 cleanup(); 214 m_spInstance = 0; 208 215 } 209 216 … … 335 342 m_session.detach(); 336 343 337 /* Make sure VBoxGlobal is aware of VM destruction: */338 vboxGlobal().setVirtualMachine(0);339 340 344 /* Quit application: */ 341 345 QApplication::quit(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r52989 r52991 51 51 * @return true if machine was started, false otherwise. */ 52 52 static bool startMachine(const QString &strID); 53 /** Static destructor. */ 54 static void destroy(); 55 /** Static instance. */ 56 static UIMachine* instance() { return m_spInstance; } 53 57 54 58 /** Returns UI session instance. */ … … 89 93 void enterInitialVisualState(); 90 94 95 /** Static instance. */ 96 static UIMachine* m_spInstance; 97 91 98 /** Holds the session instance. */ 92 99 CSession m_session; … … 101 108 /** Holds current visual state. */ 102 109 UIVisualState *m_pVisualState; 103 104 /* Temporary access: */105 friend class VBoxGlobal;106 110 }; 107 111 112 #define gpMachine UIMachine::instance() 113 108 114 #endif /* !___UIMachine_h___ */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r52902 r52991 678 678 if (!pWidget->isHidden()) 679 679 pWidget->hide(); 680 /* Restart this slot asynchronously: */680 /* Restart this slot: */ 681 681 emit sigCloseRuntimeUI(); 682 682 return; … … 684 684 685 685 /* Finally close the Runtime UI: */ 686 m_pMachine->deleteLater();686 UIMachine::destroy(); 687 687 } 688 688
Note:
See TracChangeset
for help on using the changeset viewer.