Huge Java detection refactor, version dialogs on first run (no JavaPath set) and "auto detect" button

This commit is contained in:
Sky
2013-10-14 02:59:21 +01:00
parent 0ae8073d41
commit 40a2456646
13 changed files with 421 additions and 50 deletions

View File

@ -17,6 +17,8 @@
#include "settingsdialog.h"
#include "ui_settingsdialog.h"
#include "logic/JavaUtils.h"
#include "gui/versionselectdialog.h"
#include "logic/lists/JavaVersionList.h"
#include <settingsobject.h>
#include <QFileDialog>
@ -184,10 +186,17 @@ void SettingsDialog::loadSettings(SettingsObject *s)
void SettingsDialog::on_pushButton_clicked()
{
JavaUtils jut;
auto javas = jut.FindJavaPaths();
JavaVersionPtr java;
ui->javaPathTextBox->setText(std::get<JI_PATH>(javas.at(0)));
VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, true);
vselect.setResizeOn(2);
vselect.exec();
if (vselect.result() == QDialog::Accepted && vselect.selectedVersion())
{
java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion());
ui->javaPathTextBox->setText(java->path);
}
}
void SettingsDialog::on_btnBrowse_clicked()