summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-01-06 06:08:45 +0100
committerPetr Mrázek <peterix@gmail.com>2017-01-06 06:08:45 +0100
commit6f17183bf0594f6b22ee7d2bc47150f611ee3ee2 (patch)
treee451b8027a43afa63535c812d8c9382ce16026a8
parent0249bd9eea450026c002481dadf945cb0268143f (diff)
downloadMultiMC-6f17183bf0594f6b22ee7d2bc47150f611ee3ee2.tar
MultiMC-6f17183bf0594f6b22ee7d2bc47150f611ee3ee2.tar.gz
MultiMC-6f17183bf0594f6b22ee7d2bc47150f611ee3ee2.tar.lz
MultiMC-6f17183bf0594f6b22ee7d2bc47150f611ee3ee2.tar.xz
MultiMC-6f17183bf0594f6b22ee7d2bc47150f611ee3ee2.zip
NOISSUE make the setup wizard use the main event loop
This should fix any issues with receiving events over IPC.
-rw-r--r--application/MultiMC.cpp23
-rw-r--r--application/MultiMC.h8
-rw-r--r--application/main.cpp1
3 files changed, 24 insertions, 8 deletions
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index 03ee2e5a..13e93842 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -312,8 +312,6 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
connect(this, SIGNAL(aboutToQuit()), SLOT(onExit()));
- m_status = MultiMC::Initialized;
-
setIconTheme(settings()->get("IconTheme").toString());
setApplicationTheme(settings()->get("ApplicationTheme").toString());
@@ -322,10 +320,22 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
if(SetupWizard::isRequired())
{
m_setupWizard = new SetupWizard(nullptr);
- int result = m_setupWizard->exec();
- qDebug() << "Wizard result =" << result;
+ connect(m_setupWizard, &QDialog::finished, this, &MultiMC::setupWizardFinished);
+ m_setupWizard->show();
+ return;
}
+ performMainStartupAction();
+}
+
+void MultiMC::setupWizardFinished(int status)
+{
+ qDebug() << "Wizard result =" << status;
+ performMainStartupAction();
+}
+void MultiMC::performMainStartupAction()
+{
+ m_status = MultiMC::Initialized;
if(!m_instanceIdToLaunch.isEmpty())
{
auto inst = instances()->getInstanceById(m_instanceIdToLaunch);
@@ -361,6 +371,11 @@ MultiMC::~MultiMC()
void MultiMC::messageReceived(const QString& message)
{
+ if(status() != Initialized)
+ {
+ qDebug() << "Received message" << message << "while still initializing. It will be ignored.";
+ return;
+ }
if(message == "activate")
{
showMainWindow();
diff --git a/application/MultiMC.h b/application/MultiMC.h
index 50074136..846bb152 100644
--- a/application/MultiMC.h
+++ b/application/MultiMC.h
@@ -49,6 +49,7 @@ class MultiMC : public QApplication
public:
enum Status
{
+ StartingUp,
Failed,
Succeeded,
Initialized
@@ -163,14 +164,12 @@ private slots:
* Do all the things that should be done before we exit
*/
void onExit();
-
void on_windowClose();
-
void messageReceived(const QString & message);
-
void controllerSucceeded();
void controllerFailed(const QString & error);
void analyticsSettingChanged(const Setting &setting, QVariant value);
+ void setupWizardFinished(int status);
private:
void initLogger();
@@ -185,6 +184,7 @@ private:
void initMCEdit();
void initAnalytics();
void shutdownAnalytics();
+ void performMainStartupAction();
private:
QDateTime startTime;
@@ -208,7 +208,7 @@ private:
QMap<QString, std::shared_ptr<BaseProfilerFactory>> m_profilers;
QString m_rootPath;
- Status m_status = MultiMC::Failed;
+ Status m_status = MultiMC::StartingUp;
// used on Windows to attach the standard IO streams
bool consoleAttached = false;
diff --git a/application/main.cpp b/application/main.cpp
index 0fd9f089..fde9e10d 100644
--- a/application/main.cpp
+++ b/application/main.cpp
@@ -33,6 +33,7 @@ int main(int argc, char *argv[])
switch (app.status())
{
+ case MultiMC::StartingUp:
case MultiMC::Initialized:
{
Q_INIT_RESOURCE(multimc);