Changeset 57844 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 21, 2015 4:26:00 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.cpp
r52730 r57844 100 100 { 101 101 /* It will be the selector window if visible: */ 102 if (vboxGlobal().selectorWnd().isVisible()) 103 return &vboxGlobal().selectorWnd(); 102 if (gpSelectorWindow && 103 gpSelectorWindow->isVisible()) 104 return gpSelectorWindow; 104 105 } 105 106 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r57842 r57844 233 233 : mValid (false) 234 234 , m_fVBoxSVCAvailable(true) 235 , mSelectorWnd (NULL)236 235 , m_fSeparateProcess(false) 237 236 , m_pMediumEnumerator(0) … … 428 427 429 428 return true; 430 }431 432 /**433 * Returns a reference to the main VBox VM Selector window.434 * The reference is valid until application termination.435 *436 * There is only one such a window per VirtualBox application.437 */438 UISelectorWindow &VBoxGlobal::selectorWnd()439 {440 AssertMsg (!vboxGlobal().isVMConsoleProcess(),441 ("Must NOT be a VM console process"));442 Assert (mValid);443 444 if (!mSelectorWnd)445 {446 /*447 * We pass the address of mSelectorWnd to the constructor to let it be448 * initialized right after the constructor is called. It is necessary449 * to avoid recursion, since this method may be (and will be) called450 * from the below constructor or from constructors/methods it calls.451 */452 UISelectorWindow *w = new UISelectorWindow (&mSelectorWnd);453 Assert (w == mSelectorWnd);454 NOREF(w);455 }456 457 return *mSelectorWnd;458 429 } 459 430 … … 3997 3968 { 3998 3969 m_ArgUrlList = list; 3999 QTimer::singleShot(0, &vboxGlobal().selectorWnd(), SLOT(sltOpenUrls())); 3970 UISelectorWindow::create(); 3971 QTimer::singleShot(0, gpSelectorWindow, SLOT(sltOpenUrls())); 4000 3972 } 4001 3973 return fResult; … … 4432 4404 /* Destroy the GUI root windows _BEFORE_ the media-mess, because there is 4433 4405 code in the GUI that's using the media code an will be racing us! */ 4434 if (mSelectorWnd) 4435 { 4436 delete mSelectorWnd; 4437 mSelectorWnd = NULL; 4438 } 4406 if (gpSelectorWindow) 4407 UISelectorWindow::destroy(); 4439 4408 if (gpMachine) 4440 4409 UIMachine::destroy(); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r57805 r57844 73 73 //////////////////////////////////////////////////////////////////////////////// 74 74 75 class UISelectorWindow;76 75 class VBoxUpdateDlg; 77 76 … … 174 173 VBoxGlobalSettings &settings() { return gset; } 175 174 bool setSettings (VBoxGlobalSettings &gs); 176 177 UISelectorWindow &selectorWnd();178 175 179 176 /** Returns currently active virtual machine window. */ … … 536 533 537 534 VBoxGlobalSettings gset; 538 539 UISelectorWindow *mSelectorWnd;540 535 541 536 /** Holds whether GUI is separate (from VM) process. */ -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r57780 r57844 511 511 512 512 /* Create/show selector window: */ 513 vboxGlobal().selectorWnd().show();513 UISelectorWindow::create(); 514 514 515 515 /* Start application: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r57842 r57844 78 78 79 79 80 UISelectorWindow::UISelectorWindow(UISelectorWindow **ppSelf) 80 /* static */ 81 UISelectorWindow* UISelectorWindow::m_spInstance = 0; 82 83 /* static */ 84 void UISelectorWindow::create() 85 { 86 /* Make sure selector-window is not created: */ 87 AssertReturnVoid(!m_spInstance); 88 89 /* Create selector-window: */ 90 new UISelectorWindow; 91 /* Prepare selector-window: */ 92 m_spInstance->prepare(); 93 /* Show selector-window: */ 94 m_spInstance->show(); 95 } 96 97 /* static */ 98 void UISelectorWindow::destroy() 99 { 100 /* Make sure selector-window is created: */ 101 AssertPtrReturnVoid(m_spInstance); 102 103 /* Cleanup selector-window: */ 104 m_spInstance->cleanup(); 105 /* Destroy machine UI: */ 106 delete m_spInstance; 107 } 108 109 UISelectorWindow::UISelectorWindow() 81 110 : m_fPolished(false) 82 111 , m_fWarningAboutInaccessibleMediaShown(false) … … 94 123 , m_pMachineMenuAction(0) 95 124 { 96 /* Remember self: */ 97 if (ppSelf) 98 *ppSelf = this; 99 100 /* Prepare: */ 101 prepare(); 125 m_spInstance = this; 102 126 } 103 127 104 128 UISelectorWindow::~UISelectorWindow() 105 129 { 106 /* Cleanup: */ 107 cleanup(); 130 m_spInstance = 0; 108 131 } 109 132 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r57842 r57844 40 40 class QStackedWidget; 41 41 42 /** QMainWindow extension42 /** Singleton QMainWindow extension 43 43 * used as VirtualBox Manager (selector-window) instance. */ 44 44 class UISelectorWindow : public QIWithRetranslateUI<QMainWindow> … … 48 48 public: 49 49 50 /** Constructs selector-window passing @a pParent to the QMainWindow base-class. 50 /** Static constructor. */ 51 static void create(); 52 /** Static destructor. */ 53 static void destroy(); 54 /** Static instance. */ 55 static UISelectorWindow* instance() { return m_spInstance; } 56 57 /** Returns the action-pool instance. */ 58 UIActionPool* actionPool() const { return m_pActionPool; } 59 60 protected: 61 62 /** Constructs selector-window. 51 63 * @param ppSelf brings the pointer to pointer to this window instance used by the external caller. 52 64 * @param flags brings the selector-window flags dialogs should have. */ 53 UISelectorWindow( UISelectorWindow **ppSelf);65 UISelectorWindow(); 54 66 /** Destructs selector-window. */ 55 67 ~UISelectorWindow(); 56 57 /** Returns the action-pool instance. */58 UIActionPool* actionPool() const { return m_pActionPool; }59 68 60 69 private slots: … … 250 259 /** @} */ 251 260 261 /** Static instance. */ 262 static UISelectorWindow *m_spInstance; 263 252 264 /** Holds whether the dialog is polished. */ 253 265 bool m_fPolished : 1; … … 292 304 }; 293 305 306 #define gpSelectorWindow UISelectorWindow::instance() 307 294 308 #endif /* !___UISelectorWindow_h___ */ 295 309 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r57039 r57844 883 883 884 884 /* Prepare the new VM wizard: */ 885 UISafePointerWizardNewVM pWizard = new UIWizardNewVM( &vboxGlobal().selectorWnd(), strGroupName);885 UISafePointerWizardNewVM pWizard = new UIWizardNewVM(m_pChooser->selector(), strGroupName); 886 886 pWizard->prepare(); 887 887
Note:
See TracChangeset
for help on using the changeset viewer.