Made auto java checkbox dependent

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-02-18 09:46:44 +02:00
parent a7dad96a70
commit 4c76f7afe0
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 10 additions and 1 deletions

View File

@ -41,6 +41,7 @@
#include "ui/java/JavaDownloader.h"
#include "ui_JavaPage.h"
#include <QCheckBox>
#include <QDir>
#include <QFileDialog>
#include <QMessageBox>
@ -65,6 +66,11 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage)
ui->managedJavaList->selectCurrent();
ui->managedJavaList->setEmptyString(tr("No java versions are currently available in the meta"));
ui->managedJavaList->setEmptyErrorString(tr("Couldn't load or download the java version lists!"));
connect(ui->autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this] {
ui->autodownloadCheckBox->setEnabled(ui->autodetectJavaCheckBox->isChecked());
if (!ui->autodetectJavaCheckBox->isChecked())
ui->autodownloadCheckBox->setChecked(false);
});
loadSettings();
updateThresholds();
@ -128,7 +134,7 @@ void JavaPage::loadSettings()
ui->skipCompatibilityCheckbox->setChecked(s->get("IgnoreJavaCompatibility").toBool());
ui->skipJavaWizardCheckbox->setChecked(s->get("IgnoreJavaWizard").toBool());
ui->autodetectJavaCheckBox->setChecked(s->get("AutomaticJavaSwitch").toBool());
ui->autodownloadCheckBox->setChecked(s->get("AutomaticJavaDownload").toBool());
ui->autodownloadCheckBox->setChecked(s->get("AutomaticJavaSwitch").toBool() && s->get("AutomaticJavaDownload").toBool());
m_extra_paths = new QStringListModel(s->get("JavaExtraSearchPaths").toStringList());
ui->extraJavaPathsList->setModel(m_extra_paths);
}

View File

@ -303,6 +303,9 @@
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="autodownloadCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Autodownload Mojang Java</string>
</property>