Ask for java path when hostname changes from the last run.
This commit is contained in:
parent
be2c7f4515
commit
aca7764afc
@ -265,6 +265,7 @@ void MultiMC::initGlobalSettings()
|
||||
|
||||
// Java Settings
|
||||
m_settings->registerSetting(new Setting("JavaPath", ""));
|
||||
m_settings->registerSetting(new Setting("LastHostname", ""));
|
||||
m_settings->registerSetting(new Setting("JvmArgs", ""));
|
||||
|
||||
// Custom Commands
|
||||
|
@ -615,7 +615,8 @@ void MainWindow::on_actionChangeInstMCVersion_triggered()
|
||||
auto result = QMessageBox::warning(
|
||||
this, tr("Are you sure?"),
|
||||
tr("This will remove any library/version customization you did previously. "
|
||||
"This includes things like Forge install and similar."), QMessageBox::Ok, QMessageBox::Abort);
|
||||
"This includes things like Forge install and similar."),
|
||||
QMessageBox::Ok, QMessageBox::Abort);
|
||||
if (result != QMessageBox::Ok)
|
||||
return;
|
||||
}
|
||||
@ -707,22 +708,42 @@ void MainWindow::instanceEnded()
|
||||
}
|
||||
|
||||
void MainWindow::checkSetDefaultJava()
|
||||
{
|
||||
bool askForJava = false;
|
||||
{
|
||||
QString currentHostName = QHostInfo::localHostName();
|
||||
QString oldHostName = MMC->settings()->get("LastHostname").toString();
|
||||
if (currentHostName != oldHostName)
|
||||
{
|
||||
MMC->settings()->set("LastHostname", currentHostName);
|
||||
askForJava = true;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QString currentJavaPath = MMC->settings()->get("JavaPath").toString();
|
||||
if (currentJavaPath.isEmpty())
|
||||
{
|
||||
QLOG_DEBUG() << "Java path not set, showing Java selection dialog...";
|
||||
askForJava = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (askForJava)
|
||||
{
|
||||
QLOG_DEBUG() << "Java path needs resetting, showing Java selection dialog...";
|
||||
|
||||
JavaVersionPtr java;
|
||||
|
||||
VersionSelectDialog vselect(MMC->javalist().get(), tr("First run: select a Java version"), this, false);
|
||||
VersionSelectDialog vselect(MMC->javalist().get(), tr("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. "
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user