summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2014-02-16 11:49:55 +0100
committerJan Dalheimer <jan@dalheimer.de>2014-02-16 11:49:55 +0100
commitc88c639b8efdcdfe87c2ce44fa270889826b38ef (patch)
treec85b6311dfae21bcb67615bbad85bbc05b6617e0 /gui
parent616c37269053bc4f111792dbb9374cc119a58339 (diff)
downloadMultiMC-c88c639b8efdcdfe87c2ce44fa270889826b38ef.tar
MultiMC-c88c639b8efdcdfe87c2ce44fa270889826b38ef.tar.gz
MultiMC-c88c639b8efdcdfe87c2ce44fa270889826b38ef.tar.lz
MultiMC-c88c639b8efdcdfe87c2ce44fa270889826b38ef.tar.xz
MultiMC-c88c639b8efdcdfe87c2ce44fa270889826b38ef.zip
Fix for windows and update tool menu after closing settings dialog
Diffstat (limited to 'gui')
-rw-r--r--gui/MainWindow.cpp88
-rw-r--r--gui/MainWindow.h2
2 files changed, 49 insertions, 41 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp
index 3f469061..16c88201 100644
--- a/gui/MainWindow.cpp
+++ b/gui/MainWindow.cpp
@@ -360,6 +360,51 @@ void MainWindow::showInstanceContextMenu(const QPoint &pos)
myMenu.exec(view->mapToGlobal(pos));
}
+void MainWindow::updateToolsMenu()
+{
+ if (ui->actionLaunchInstance->menu())
+ {
+ ui->actionLaunchInstance->menu()->deleteLater();
+ }
+ QMenu *launchMenu = new QMenu(this);
+ QAction *normalLaunch = launchMenu->addAction(tr("Launch"));
+ connect(normalLaunch, &QAction::triggered, [this](){doLaunch();});
+ launchMenu->addSeparator()->setText(tr("Profilers"));
+ for (auto profiler : MMC->profilers().values())
+ {
+ QAction *profilerAction = launchMenu->addAction(profiler->name());
+ QString error;
+ if (!profiler->check(&error))
+ {
+ profilerAction->setDisabled(true);
+ profilerAction->setToolTip(tr("Profiler not setup correctly. Go into settings, \"External Tools\"."));
+ }
+ else
+ {
+ connect(profilerAction, &QAction::triggered, [this, profiler](){doLaunch(true, profiler.get());});
+ }
+ }
+ launchMenu->addSeparator()->setText(tr("Tools"));
+ for (auto tool : MMC->tools().values())
+ {
+ QAction *toolAction = launchMenu->addAction(tool->name());
+ QString error;
+ if (!tool->check(&error))
+ {
+ toolAction->setDisabled(true);
+ toolAction->setToolTip(tr("Tool not setup correctly. Go into settings, \"External Tools\"."));
+ }
+ else
+ {
+ connect(toolAction, &QAction::triggered, [this, tool]()
+ {
+ tool->createDetachedTool(m_selectedInstance, this)->run();
+ });
+ }
+ }
+ ui->actionLaunchInstance->setMenu(launchMenu);
+}
+
void MainWindow::repopulateAccountsMenu()
{
accountMenu->clear();
@@ -933,6 +978,7 @@ void MainWindow::on_actionSettings_triggered()
// FIXME: quick HACK to make this work. improve, optimize.
proxymodel->invalidate();
proxymodel->sort(0);
+ updateToolsMenu();
}
void MainWindow::on_actionManageAccounts_triggered()
@@ -1429,47 +1475,7 @@ void MainWindow::instanceChanged(const QModelIndex &current, const QModelIndex &
m_statusLeft->setText(m_selectedInstance->getStatusbarDescription());
updateInstanceToolIcon(m_selectedInstance->iconKey());
- if (ui->actionLaunchInstance->menu())
- {
- ui->actionLaunchInstance->menu()->deleteLater();
- }
- QMenu *launchMenu = new QMenu;
- QAction *normalLaunch = launchMenu->addAction(tr("Launch"));
- connect(normalLaunch, &QAction::triggered, [this](){doLaunch();});
- launchMenu->addSeparator()->setText(tr("Profilers"));
- for (auto profiler : MMC->profilers().values())
- {
- QAction *profilerAction = launchMenu->addAction(profiler->name());
- QString error;
- if (!profiler->check(&error))
- {
- profilerAction->setDisabled(true);
- profilerAction->setToolTip(tr("Profiler not setup correctly. Go into settings, \"External Tools\"."));
- }
- else
- {
- connect(profilerAction, &QAction::triggered, [this, profiler](){doLaunch(true, profiler.get());});
- }
- }
- launchMenu->addSeparator()->setText(tr("Tools"));
- for (auto tool : MMC->tools().values())
- {
- QAction *toolAction = launchMenu->addAction(tool->name());
- QString error;
- if (!tool->check(&error))
- {
- toolAction->setDisabled(true);
- toolAction->setToolTip(tr("Tool not setup correctly. Go into settings, \"External Tools\"."));
- }
- else
- {
- connect(toolAction, &QAction::triggered, [this, tool]()
- {
- tool->createDetachedTool(m_selectedInstance, this)->run();
- });
- }
- }
- ui->actionLaunchInstance->setMenu(launchMenu);
+ updateToolsMenu();
MMC->settings()->set("SelectedInstance", m_selectedInstance->id());
}
diff --git a/gui/MainWindow.h b/gui/MainWindow.h
index 682c711d..7a29977d 100644
--- a/gui/MainWindow.h
+++ b/gui/MainWindow.h
@@ -141,6 +141,8 @@ slots:
void showInstanceContextMenu(const QPoint&);
+ void updateToolsMenu();
+
public
slots:
void instanceActivated(QModelIndex);