Made JavaDownloader a task and added some quick UI
Signed-off-by: timoreo <contact@timoreo.fr>
This commit is contained in:
@ -48,13 +48,14 @@
|
||||
#include "java/JavaUtils.h"
|
||||
#include "java/JavaInstallList.h"
|
||||
|
||||
#include "settings/SettingsObject.h"
|
||||
#include <FileSystem.h>
|
||||
#include "Application.h"
|
||||
#include <sys.h>
|
||||
#include "SysInfo.h"
|
||||
#include "Application.h"
|
||||
#include "JavaDownloader.h"
|
||||
|
||||
#include "SysInfo.h"
|
||||
#include "settings/SettingsObject.h"
|
||||
#include "ui/dialogs/ProgressDialog.h"
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage)
|
||||
{
|
||||
@ -214,8 +215,23 @@ void JavaPage::on_javaDownloadBtn_clicked(){
|
||||
QMessageBox::warning(this, tr("Unknown OS"), tr("The OS you are running is not supported by Mojang or Azul. Please install Java manually."));
|
||||
return;
|
||||
}
|
||||
//TODO display a selection for java 8 or 18
|
||||
JavaDownloader::downloadJava(false, version);
|
||||
//Selection using QMessageBox for java 8 or 17
|
||||
QMessageBox box(QMessageBox::Icon::Question, tr("Java version"), tr("Do you want to download Java version 8 or 17?\n Java 8 is recommended for minecraft versions below 1.17\n Java 17 is recommended for minecraft versions above or equal to 1.17"),
|
||||
QMessageBox::NoButton, this);
|
||||
box.addButton("Java 17", QMessageBox::YesRole);
|
||||
auto no = box.addButton("Java 8", QMessageBox::NoRole);
|
||||
auto cancel = box.addButton(tr("Download both"), QMessageBox::AcceptRole);
|
||||
box.exec();
|
||||
bool isLegacy = box.clickedButton() == no;
|
||||
|
||||
auto down = new JavaDownloader(isLegacy, version);
|
||||
ProgressDialog dialog(this);
|
||||
dialog.execWithTask(down);
|
||||
if(box.clickedButton() == cancel) {
|
||||
auto dwn = new JavaDownloader(false, version);
|
||||
ProgressDialog dg(this);
|
||||
dg.execWithTask(dwn);
|
||||
}
|
||||
}
|
||||
|
||||
void JavaPage::checkerFinished()
|
||||
|
Reference in New Issue
Block a user