summaryrefslogtreecommitdiffstats
path: root/gui/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/mainwindow.cpp')
-rw-r--r--gui/mainwindow.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index c726591d..06329140 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -53,6 +53,7 @@
#include "logic/lists/MinecraftVersionList.h"
#include "logic/lists/LwjglVersionList.h"
#include "logic/lists/IconList.h"
+#include "logic/lists/JavaVersionList.h"
#include "logic/net/LoginTask.h"
#include "logic/BaseInstance.h"
@@ -60,6 +61,7 @@
#include "logic/MinecraftProcess.h"
#include "logic/OneSixAssets.h"
#include "logic/OneSixUpdate.h"
+#include "logic/JavaUtils.h"
#include "logic/LegacyInstance.h"
@@ -701,3 +703,31 @@ void MainWindow::instanceEnded()
this->show();
ui->actionLaunchInstance->setEnabled(m_selectedInstance);
}
+
+void MainWindow::checkSetDefaultJava()
+{
+ QString currentJavaPath = MMC->settings()->get("JavaPath").toString();
+ if(currentJavaPath.isEmpty())
+ {
+ QLOG_DEBUG() << "Java path not set, showing Java selection dialog...";
+
+ JavaVersionPtr java;
+
+ VersionSelectDialog vselect(MMC->javalist().get(), tr("First run: select a Java version"), this, false);
+ vselect.setResizeOn(2);
+ vselect.exec();
+
+ if (!vselect.selectedVersion())
+ {
+ QMessageBox::warning(
+ this, tr("Invalid version selected"), tr("You didn't select a valid Java version, so MultiMC will select the default. "
+ "You can change this in the settings dialog."));
+
+ JavaUtils ju;
+ java = ju.GetDefaultJava();
+ }
+
+ java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion());
+ MMC->settings()->set("JavaPath", java->path);
+ }
+}