summaryrefslogtreecommitdiffstats
path: root/gui/MainWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/MainWindow.cpp')
-rw-r--r--gui/MainWindow.cpp43
1 files changed, 12 insertions, 31 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp
index 7ea67764..6ae41f50 100644
--- a/gui/MainWindow.cpp
+++ b/gui/MainWindow.cpp
@@ -127,8 +127,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
view->installEventFilter(this);
proxymodel = new InstanceProxyModel(this);
-// proxymodel->setSortRole(KCategorizedSortFilterProxyModel::CategorySortRole);
- //proxymodel->setFilterRole(KCategorizedSortFilterProxyModel::CategorySortRole);
+ // proxymodel->setSortRole(KCategorizedSortFilterProxyModel::CategorySortRole);
+ // proxymodel->setFilterRole(KCategorizedSortFilterProxyModel::CategorySortRole);
// proxymodel->setDynamicSortFilter ( true );
// FIXME: instList should be global-ish, or at least not tied to the main window...
@@ -176,6 +176,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
{
MMC->lwjgllist()->loadList();
}
+
assets_downloader = new OneSixAssets();
connect(assets_downloader, SIGNAL(indexStarted()), SLOT(assetsIndexStarted()));
connect(assets_downloader, SIGNAL(filesStarted()), SLOT(assetsFilesStarted()));
@@ -418,7 +419,7 @@ void MainWindow::on_actionSettings_triggered()
{
SettingsDialog dialog(this);
dialog.exec();
- //FIXME: quick HACK to make this work. improve, optimize.
+ // FIXME: quick HACK to make this work. improve, optimize.
proxymodel->invalidate();
proxymodel->sort(0);
}
@@ -598,7 +599,7 @@ void MainWindow::doLogin(const QString &errorMsg)
void MainWindow::prepareLaunch(BaseInstance* instance, MojangAccountPtr account)
{
- BaseUpdate *updateTask = instance->doUpdate();
+ Task *updateTask = instance->doUpdate();
if (!updateTask)
{
launchInstance(instance, account);
@@ -606,7 +607,7 @@ void MainWindow::prepareLaunch(BaseInstance* instance, MojangAccountPtr account)
else
{
ProgressDialog tDialog(this);
- connect(updateTask, &BaseUpdate::succeeded, [this, instance, account] { launchInstance(instance, account); });
+ connect(updateTask, &Task::succeeded, [this, instance, account] { launchInstance(instance, account); });
connect(updateTask, SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString)));
tDialog.exec(updateTask);
delete updateTask;
@@ -667,29 +668,15 @@ void MainWindow::launchInstance(BaseInstance *instance, MojangAccountPtr account
if (!proc)
return;
- // Prepare GUI: If it shall stay open disable the required parts
- if (MMC->settings()->get("NoHide").toBool())
- {
- ui->actionLaunchInstance->setEnabled(false);
- }
- else
- {
- this->hide();
- }
+ this->hide();
console = new ConsoleWindow(proc);
-
- connect(proc, SIGNAL(log(QString, MessageLevel::Enum)), console,
- SLOT(write(QString, MessageLevel::Enum)));
- connect(proc, SIGNAL(ended(BaseInstance *)), this, SLOT(instanceEnded(BaseInstance *)));
-
- if (instance->settings().get("ShowConsole").toBool())
- {
- console->show();
- }
+ connect(console, SIGNAL(isClosing()), this, SLOT(instanceEnded()));
// I think this will work...
- proc->setLogin(account->username(), account->accessToken());
+ QString username = account->username();
+ QString session_id = account->accessToken();
+ proc->setLogin(username, session_id);
proc->launch();
}
@@ -845,15 +832,9 @@ void MainWindow::on_actionEditInstNotes_triggered()
}
}
-void MainWindow::instanceEnded(BaseInstance *instance)
+void MainWindow::instanceEnded()
{
this->show();
- ui->actionLaunchInstance->setEnabled(m_selectedInstance);
-
- if (instance->settings().get("AutoCloseConsole").toBool())
- {
- console->close();
- }
}
void MainWindow::checkSetDefaultJava()