diff options
Diffstat (limited to 'gui/mainwindow.cpp')
-rw-r--r-- | gui/mainwindow.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 1ff633b2..c2f0c390 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -26,10 +26,14 @@ #include "gui/settingsdialog.h" #include "gui/newinstancedialog.h" +#include "gui/logindialog.h" +#include "gui/taskdialog.h" #include "data/appsettings.h" #include "data/version.h" +#include "tasks/logintask.h" + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) @@ -121,3 +125,31 @@ void MainWindow::on_instanceView_customContextMenuRequested(const QPoint &pos) instContextMenu->exec(ui->instanceView->mapToGlobal(pos)); } + + +void MainWindow::on_actionLaunchInstance_triggered() +{ + doLogin(); +} + +void MainWindow::doLogin(const QString &errorMsg) +{ + LoginDialog* loginDlg = new LoginDialog(this, errorMsg); + if (loginDlg->exec()) + { + UserInfo uInfo(loginDlg->getUsername(), loginDlg->getPassword()); + + TaskDialog* tDialog = new TaskDialog(this); + LoginTask* loginTask = new LoginTask(uInfo, tDialog); + connect(loginTask, SIGNAL(loginComplete(LoginResponse)), + SLOT(onLoginComplete(LoginResponse))); + connect(loginTask, SIGNAL(loginFailed(QString)), + SLOT(doLogin(QString))); + tDialog->exec(loginTask); + } +} + +void MainWindow::onLoginComplete(LoginResponse response) +{ + +} |