summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-10-20 22:28:31 +0200
committerPetr Mrázek <peterix@gmail.com>2013-10-20 22:28:31 +0200
commitaca7764afc82f39bef32f41c5c53eb70e8f54ba8 (patch)
treec3cf63274f3d8aa2694392b2d6f67050e0ae4c0c /gui
parentbe2c7f451541647899478d0197d3e9500d63c833 (diff)
downloadMultiMC-aca7764afc82f39bef32f41c5c53eb70e8f54ba8.tar
MultiMC-aca7764afc82f39bef32f41c5c53eb70e8f54ba8.tar.gz
MultiMC-aca7764afc82f39bef32f41c5c53eb70e8f54ba8.tar.lz
MultiMC-aca7764afc82f39bef32f41c5c53eb70e8f54ba8.tar.xz
MultiMC-aca7764afc82f39bef32f41c5c53eb70e8f54ba8.zip
Ask for java path when hostname changes from the last run.
Diffstat (limited to 'gui')
-rw-r--r--gui/mainwindow.cpp41
1 files changed, 31 insertions, 10 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 0bd6f651..2efcda44 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -73,7 +73,7 @@
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
- MultiMCPlatform::fixWM_CLASS(this);
+ MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
setWindowTitle(QString("MultiMC %1").arg(MMC->version().toString()));
@@ -615,8 +615,9 @@ 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);
- if(result != QMessageBox::Ok)
+ "This includes things like Forge install and similar."),
+ QMessageBox::Ok, QMessageBox::Abort);
+ if (result != QMessageBox::Ok)
return;
}
m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor());
@@ -708,22 +709,42 @@ void MainWindow::instanceEnded()
void MainWindow::checkSetDefaultJava()
{
- QString currentJavaPath = MMC->settings()->get("JavaPath").toString();
- if(currentJavaPath.isEmpty())
+ bool askForJava = false;
{
- QLOG_DEBUG() << "Java path not set, showing Java selection dialog...";
+ 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())
+ {
+ 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. "
- "You can change this in the settings dialog."));
+ 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();