Added more logs for auto java install

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-03-20 17:39:10 +02:00
parent 703470e57d
commit 1c809f0fb1
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
5 changed files with 22 additions and 13 deletions

View File

@ -91,7 +91,21 @@ void AutoInstallJava::executeTask()
emit progressReportingRequest(); emit progressReportingRequest();
return; return;
} }
if (m_supported_arch.isEmpty()) {
emit logLine(tr("Your system(%1 %2) is not compatible with auto java download. Using the default java path.")
.arg(SysInfo::currentSystem(), SysInfo::useQTForArch()),
MessageLevel::Warning);
emitSucceeded();
return;
}
auto wantedJavaName = packProfile->getProfile()->getCompatibleJavaName(); auto wantedJavaName = packProfile->getProfile()->getCompatibleJavaName();
if (wantedJavaName.isEmpty()) {
emit logLine(tr("Your meta informtation is old or doesn't have the information necesary to determine what java should be used. "
"Using the default java path."),
MessageLevel::Warning);
emitSucceeded();
return;
}
QDir javaDir(APPLICATION->javaPath()); QDir javaDir(APPLICATION->javaPath());
auto wantedJavaPath = javaDir.absoluteFilePath(wantedJavaName); auto wantedJavaPath = javaDir.absoluteFilePath(wantedJavaName);
if (QFileInfo::exists(wantedJavaPath)) { if (QFileInfo::exists(wantedJavaPath)) {
@ -136,7 +150,8 @@ void AutoInstallJava::setJavaPathFromPartial()
if (QFileInfo::exists(finalPath)) { if (QFileInfo::exists(finalPath)) {
setJavaPath(finalPath); setJavaPath(finalPath);
} else { } else {
emit logLine(tr("No compatible java version was found. Using the default one."), MessageLevel::Warning); emit logLine(tr("No compatible java version was found(the binary file doesn't exists). Using the default one."),
MessageLevel::Warning);
emitSucceeded(); emitSucceeded();
} }
return; return;
@ -188,6 +203,8 @@ void AutoInstallJava::tryNextMajorJava()
auto wantedJavaName = packProfile->getProfile()->getCompatibleJavaName(); auto wantedJavaName = packProfile->getProfile()->getCompatibleJavaName();
auto majorJavaVersions = packProfile->getProfile()->getCompatibleJavaMajors(); auto majorJavaVersions = packProfile->getProfile()->getCompatibleJavaMajors();
if (m_majorJavaVersionIndex >= majorJavaVersions.length()) { if (m_majorJavaVersionIndex >= majorJavaVersions.length()) {
emit logLine(tr("No Java versions found for your operating system: %1 %2").arg(SysInfo::currentSystem(), SysInfo::useQTForArch()),
MessageLevel::Warning);
emit logLine(tr("No compatible java version was found. Using the default one."), MessageLevel::Warning); emit logLine(tr("No compatible java version was found. Using the default one."), MessageLevel::Warning);
emitSucceeded(); emitSucceeded();
return; return;

View File

@ -72,6 +72,7 @@ class InstallJavaPage : public QWidget, public BasePage {
void initialize(Meta::VersionList::Ptr vlist) void initialize(Meta::VersionList::Ptr vlist)
{ {
vlist->setProvidedRoles({ BaseVersionList::VersionRole, BaseVersionList::RecommendedRole, BaseVersionList::VersionPointerRole }); vlist->setProvidedRoles({ BaseVersionList::VersionRole, BaseVersionList::RecommendedRole, BaseVersionList::VersionPointerRole });
vlist->sort(1);
majorVersionSelect->initialize(vlist.get()); majorVersionSelect->initialize(vlist.get());
} }

View File

@ -27,7 +27,7 @@ class PackProfile;
class QDialogButtonBox; class QDialogButtonBox;
namespace Java { namespace Java {
class InstallDialog final : public QDialog, public BasePageProvider { class InstallDialog final : public QDialog, private BasePageProvider {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -66,8 +66,8 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage)
if (BuildConfig.JAVA_DOWNLOADER_ENABLED) { if (BuildConfig.JAVA_DOWNLOADER_ENABLED) {
ui->managedJavaList->initialize(new JavaInstallList(this, true)); ui->managedJavaList->initialize(new JavaInstallList(this, true));
ui->managedJavaList->selectCurrent(); ui->managedJavaList->selectCurrent();
ui->managedJavaList->setEmptyString(tr("No java versions are currently available in the meta")); ui->managedJavaList->setEmptyString(tr("No managed java versions are installed"));
ui->managedJavaList->setEmptyErrorString(tr("Couldn't load or download the java version lists!")); ui->managedJavaList->setEmptyErrorString(tr("Couldn't load the managed java list!"));
connect(ui->autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this] { connect(ui->autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this] {
ui->autodownloadCheckBox->setEnabled(ui->autodetectJavaCheckBox->isChecked()); ui->autodownloadCheckBox->setEnabled(ui->autodetectJavaCheckBox->isChecked());
if (!ui->autodetectJavaCheckBox->isChecked()) if (!ui->autodetectJavaCheckBox->isChecked())
@ -75,7 +75,6 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage)
}); });
} else { } else {
ui->autodownloadCheckBox->setHidden(true); ui->autodownloadCheckBox->setHidden(true);
ui->javaDownloadBtn->setHidden(true);
ui->tabWidget->tabBar()->hide(); ui->tabWidget->tabBar()->hide();
} }

View File

@ -178,13 +178,6 @@
</item> </item>
<item row="2" column="0" colspan="3"> <item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="javaDownloadBtn">
<property name="text">
<string>Download Java</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="javaDetectBtn"> <widget class="QPushButton" name="javaDetectBtn">
<property name="sizePolicy"> <property name="sizePolicy">
@ -424,7 +417,6 @@
<tabstop>permGenSpinBox</tabstop> <tabstop>permGenSpinBox</tabstop>
<tabstop>javaPathTextBox</tabstop> <tabstop>javaPathTextBox</tabstop>
<tabstop>javaBrowseBtn</tabstop> <tabstop>javaBrowseBtn</tabstop>
<tabstop>javaDownloadBtn</tabstop>
<tabstop>javaDetectBtn</tabstop> <tabstop>javaDetectBtn</tabstop>
<tabstop>javaTestBtn</tabstop> <tabstop>javaTestBtn</tabstop>
<tabstop>skipCompatibilityCheckbox</tabstop> <tabstop>skipCompatibilityCheckbox</tabstop>