Changeset 98890 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 9, 2023 12:01:30 PM (2 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIStarter.cpp
r98859 r98890 42 42 43 43 44 /* static */45 UIStarter *UIStarter::s_pInstance = 0;46 47 /* static */48 void UIStarter::create()49 {50 /* Pretect versus double 'new': */51 if (s_pInstance)52 return;53 54 /* Create instance: */55 new UIStarter;56 }57 58 /* static */59 void UIStarter::destroy()60 {61 /* Pretect versus double 'delete': */62 if (!s_pInstance)63 return;64 65 /* Destroy instance: */66 delete s_pInstance;67 }68 69 44 UIStarter::UIStarter() 70 {71 /* Assign instance: */72 s_pInstance = this;73 }74 75 UIStarter::~UIStarter()76 {77 /* Unassign instance: */78 s_pInstance = 0;79 }80 81 void UIStarter::init()82 45 { 83 46 /* Listen for UICommon signals: */ … … 88 51 } 89 52 90 void UIStarter::deinit()53 UIStarter::~UIStarter() 91 54 { 92 55 /* Listen for UICommon signals no more: */ … … 105 68 #ifndef VBOX_RUNTIME_UI 106 69 107 /* Make sure Selector UI is permitted, quit if not: */70 /* Make sure Manager UI is permitted, quit if not: */ 108 71 if (gEDataManager->guiFeatureEnabled(GUIFeatureType_NoSelector)) 109 72 { … … 130 93 #else /* VBOX_RUNTIME_UI */ 131 94 132 /* Make sure Runtime UI is even possible, quit if not: */95 /* Make sure Runtime UI is possible at all, quit if not: */ 133 96 if (uiCommon().managedVMUuid().isNull()) 134 97 { … … 137 100 } 138 101 139 /* Make sure machine is started, quit if not: */102 /* Try to start virtual machine, quit if failed: */ 140 103 if (!UIMachine::startMachine(uiCommon().managedVMUuid())) 141 104 return QApplication::quit(); … … 157 120 #ifndef VBOX_RUNTIME_UI 158 121 /* Destroy Manager UI: */ 159 if (gpManager) 160 UIVirtualBoxManager::destroy(); 122 UIVirtualBoxManager::destroy(); 161 123 #else 162 124 /* Destroy Runtime UI: */ 163 if (gpMachine) 164 UIMachine::destroy(); 125 UIMachine::destroy(); 165 126 #endif 166 127 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIStarter.h
r98103 r98890 35 35 #include <QObject> 36 36 37 /** QObject subclass allowing to control GUI part37 /** QObject subclass allowing to start/close GUI parts 38 38 * of VirtualBox application in sync/async modes. */ 39 39 class UIStarter : public QObject … … 41 41 Q_OBJECT; 42 42 43 public: 44 43 45 /** Constructs UI starter. */ 44 46 UIStarter(); 45 47 /** Destructs UI starter. */ 46 48 virtual ~UIStarter(); 47 48 public:49 50 /** Returns the singleton UI starter instance. */51 static UIStarter *instance() { return s_pInstance; }52 53 /** Create the singleton UI starter instance. */54 static void create();55 /** Create the singleton UI starter instance. */56 static void destroy();57 58 /** Init UICommon connections. */59 void init();60 /** Deinit UICommon connections. */61 void deinit();62 49 63 50 private slots: … … 69 56 /** Closes corresponding part of the UI. */ 70 57 void sltCloseUI(); 71 72 private:73 74 /** Holds the singleton UI starter instance. */75 static UIStarter *s_pInstance;76 58 }; 77 59 78 /** Singleton UI starter 'official' name. */79 #define gStarter UIStarter::instance()80 81 60 #endif /* !FEQT_INCLUDED_SRC_globals_UIStarter_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r98885 r98890 521 521 UIModalWindowManager::create(); 522 522 523 /* Create UI starter: */524 UIStarter::create();525 523 #ifndef VBOX_RUNTIME_UI 526 524 /* Create global app instance for Selector UI: */ … … 540 538 if (uiCommon().processArgs()) 541 539 break; 542 543 /* Init link between UI starter and global app instance: */544 gStarter->init();545 540 546 541 // WORKAROUND: … … 555 550 a.setQuitOnLastWindowClosed(false); 556 551 552 /* Create UI starter: */ 553 UIStarter uiStarter; 557 554 /* Request to Start UI _after_ QApplication executed: */ 558 QMetaObject::invokeMethod( gStarter, "sltStartUI", Qt::QueuedConnection);555 QMetaObject::invokeMethod(&uiStarter, "sltStartUI", Qt::QueuedConnection); 559 556 560 557 /* Start application: */ 561 558 iResultCode = a.exec(); 562 563 /* Break link between UI starter and global app instance: */564 gStarter->deinit();565 559 } 566 560 while (0); … … 568 562 /* Destroy global app instance: */ 569 563 UICommon::destroy(); 570 /* Destroy UI starter: */571 UIStarter::destroy();572 564 573 565 /* Destroy modal-window manager: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r98335 r98890 452 452 { 453 453 /* Make sure VirtualBox Manager is created: */ 454 AssertPtrReturnVoid(s_pInstance); 454 if (!s_pInstance) 455 return; 455 456 456 457 /* Unregister in the modal window manager: */
Note:
See TracChangeset
for help on using the changeset viewer.