diff options
-rw-r--r-- | api/logic/InstanceList.cpp | 1 | ||||
-rw-r--r-- | application/InstanceWindow.cpp | 5 | ||||
-rw-r--r-- | application/InstanceWindow.h | 7 | ||||
-rw-r--r-- | application/LaunchInteraction.cpp | 2 | ||||
-rw-r--r-- | application/MultiMC.cpp | 4 | ||||
-rw-r--r-- | application/main.cpp | 4 |
6 files changed, 17 insertions, 6 deletions
diff --git a/api/logic/InstanceList.cpp b/api/logic/InstanceList.cpp index 783df660..d89b8ea7 100644 --- a/api/logic/InstanceList.cpp +++ b/api/logic/InstanceList.cpp @@ -344,7 +344,6 @@ InstanceList::InstListError InstanceList::loadList() m_instances.clear(); for(auto inst: tempList) { - inst->setParent(this); connect(inst.get(), SIGNAL(propertiesChanged(BaseInstance *)), this, SLOT(propertiesChanged(BaseInstance *))); connect(inst.get(), SIGNAL(groupChanged()), this, SLOT(groupChanged())); diff --git a/application/InstanceWindow.cpp b/application/InstanceWindow.cpp index dfc7b815..0b9d7019 100644 --- a/application/InstanceWindow.cpp +++ b/application/InstanceWindow.cpp @@ -157,6 +157,11 @@ void InstanceWindow::closeEvent(QCloseEvent *event) { emit isClosing(); event->accept(); + if(m_shouldQuit) + { + // this needs to be delayed so we don't do horrible things + QMetaObject::invokeMethod(MMC, "quit", Qt::QueuedConnection); + } } } diff --git a/application/InstanceWindow.h b/application/InstanceWindow.h index 7ffc4142..db84b9be 100644 --- a/application/InstanceWindow.h +++ b/application/InstanceWindow.h @@ -36,6 +36,11 @@ public: QString instanceId(); + void setQuitOnClose(bool shouldQuit = false) + { + m_shouldQuit = shouldQuit; + } + signals: void isClosing(); @@ -61,7 +66,7 @@ private: std::shared_ptr<LaunchTask> m_proc; unique_qobject_ptr<LaunchController> m_launchController; InstancePtr m_instance; - bool m_mayclose = true; + bool m_shouldQuit = false; PageContainer *m_container = nullptr; QPushButton *m_closeButton = nullptr; QPushButton *m_killButton = nullptr; diff --git a/application/LaunchInteraction.cpp b/application/LaunchInteraction.cpp index 80a3368d..0b601d49 100644 --- a/application/LaunchInteraction.cpp +++ b/application/LaunchInteraction.cpp @@ -217,7 +217,9 @@ void LaunchController::launchInstance() } else { + // this is used when launching directly from command line m_console = new InstanceWindow(m_instance); + m_console->setQuitOnClose(true); } connect(m_launcher.get(), &LaunchTask::readyForLaunch, this, &LaunchController::readyForLaunch); diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp index 4b1447d9..f53d05e1 100644 --- a/application/MultiMC.cpp +++ b/application/MultiMC.cpp @@ -219,6 +219,10 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar } qDebug() << "Binary path : " << binPath; qDebug() << "Application root path : " << rootPath; + if(!launchId.isEmpty()) + { + qDebug() << "ID of instance to launch : " << launchId; + } // load settings initGlobalSettings(test_mode); diff --git a/application/main.cpp b/application/main.cpp index a8951d33..6b0c361b 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -22,10 +22,6 @@ int launchInstance(MultiMC &app, InstancePtr inst) launchController.setInstance(inst); launchController.setOnline(true); QMetaObject::invokeMethod(&launchController, "start", Qt::QueuedConnection); - app.connect(&launchController, &Task::finished, [&app]() - { - app.quit(); - }); return app.exec(); } |