Huge Java detection refactor, version dialogs on first run (no JavaPath set) and "auto detect" button
This commit is contained in:
parent
0ae8073d41
commit
40a2456646
13 changed files with 421 additions and 50 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue