summaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-08-09 00:26:35 +0200
committerPetr Mrázek <peterix@gmail.com>2013-08-09 00:26:35 +0200
commitbf5f5091ef6daeaf7067f4fc8973eb068ddc52fc (patch)
tree647f77c1d7f8c8e0e7bdf90fb7f3b0eac9aa5f6c /main.cpp
parentc8925e0f667b0c94028345586d99008066358200 (diff)
downloadMultiMC-bf5f5091ef6daeaf7067f4fc8973eb068ddc52fc.tar
MultiMC-bf5f5091ef6daeaf7067f4fc8973eb068ddc52fc.tar.gz
MultiMC-bf5f5091ef6daeaf7067f4fc8973eb068ddc52fc.tar.lz
MultiMC-bf5f5091ef6daeaf7067f4fc8973eb068ddc52fc.tar.xz
MultiMC-bf5f5091ef6daeaf7067f4fc8973eb068ddc52fc.zip
Various task related improvements.
* Errors are reported back to task users via Failure signals. * Lwjgl doesn't download on each legacy instance start anymore. * Tasks were unified when it comes to success/failure. * Task dialogs don't get spawned after short tasks finish anymore.
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/main.cpp b/main.cpp
index 50fed27f..51516a81 100644
--- a/main.cpp
+++ b/main.cpp
@@ -61,9 +61,11 @@ private slots:
QApplication::instance()->quit();
}
- void onLoginComplete(QString instId, LoginResponse response)
+ void onLoginComplete()
{
- proc = instance->prepareForLaunch(response.username, response.sessionID);
+ LoginTask * task = (LoginTask *) QObject::sender();
+ auto result = task->getResult();
+ proc = instance->prepareForLaunch(result.username, result.sessionID);
if(!proc)
{
//FIXME: report error
@@ -78,7 +80,7 @@ private slots:
proc->launch();
}
- void doLogin(QString instId, const QString &errorMsg)
+ void doLogin(const QString &errorMsg)
{
LoginDialog* loginDlg = new LoginDialog(nullptr, errorMsg);
if (loginDlg->exec())
@@ -87,10 +89,8 @@ private slots:
TaskDialog* tDialog = new TaskDialog(nullptr);
LoginTask* loginTask = new LoginTask(uInfo, tDialog);
- connect(loginTask, SIGNAL(loginComplete(QString, LoginResponse)),
- SLOT(onLoginComplete(QString, LoginResponse)), Qt::QueuedConnection);
- connect(loginTask, SIGNAL(loginFailed(QString, QString)),
- SLOT(doLogin(QString, QString)), Qt::QueuedConnection);
+ connect(loginTask, SIGNAL(succeeded()),SLOT(onLoginComplete()), Qt::QueuedConnection);
+ connect(loginTask, SIGNAL(failed(QString)),SLOT(doLogin(QString)), Qt::QueuedConnection);
tDialog->exec(loginTask);
}
//onLoginComplete(LoginResponse("Offline","Offline", 1));
@@ -111,7 +111,7 @@ public:
}
std::cout << "Logging in..." << std::endl;
- doLogin(instance->id(),"");
+ doLogin("");
return QApplication::instance()->exec();
}