From f9b6927136c32a944ed09a704f2e6a3d86f83b56 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Tue, 25 May 2021 14:10:38 -0500 Subject: [PATCH] Ubuntu - Add Java install instructions and fix duplicates in Java detection --- forms/javadialog.ui | 137 +++++++++++++++++++++++++++++++++++++---- src/javadialog.cpp | 10 +++ src/javadialog.h | 2 + src/settingsdialog.cpp | 12 ++-- 4 files changed, 144 insertions(+), 17 deletions(-) diff --git a/forms/javadialog.ui b/forms/javadialog.ui index 42768f3..08e26ef 100644 --- a/forms/javadialog.ui +++ b/forms/javadialog.ui @@ -58,9 +58,7 @@ - Oracle Java 8 is recommended as it includes JavaFX (needed for the "What's New" page.) -OpenJDK builds and Java 11 may be used but they do not include JavaFX. -The buttons below will direct you to where these can be downloaded (to be opened in your default web browser.) + <html><head/><body><p>Oracle Java 8 is recommended as it includes JavaFX (needed for the &quot;What's New&quot; page.)</p><p>OpenJDK builds and Java 11 may be used but they do not include JavaFX.</p><p>The links below will direct you to where these can be downloaded.</p></body></html> Qt::AlignCenter @@ -113,9 +111,9 @@ Links on the Windows tabs do include Linux builds if there are issues with the p - 40 - 110 - 491 + 10 + 100 + 551 20 @@ -129,9 +127,9 @@ Links on the Windows tabs do include Linux builds if there are issues with the p - 40 - 150 - 311 + 20 + 130 + 321 22 @@ -145,8 +143,125 @@ Links on the Windows tabs do include Linux builds if there are issues with the p - 379 - 150 + 390 + 130 + 141 + 22 + + + + Copy to Clipboard + + + + + + 10 + 190 + 551 + 20 + + + + Ubuntu + + + Qt::AlignCenter + + + + + + 10 + 80 + 551 + 20 + + + + Qt::Horizontal + + + + + + 10 + 170 + 551 + 20 + + + + Qt::Horizontal + + + + + + 20 + 220 + 321 + 22 + + + + sudo apt install openjdk-8-jre + + + true + + + + + + 390 + 220 + 141 + 22 + + + + Copy to Clipboard + + + + + + 10 + 260 + 541 + 31 + + + + OpenJFX for Java 8 has been removed in recent Ubuntu releases. +On Ubuntu 18.04, it can be installed with the following command. + + + Qt::AlignCenter + + + + + + 20 + 310 + 321 + 22 + + + + sudo apt install openjfx=8u161-b12-1ubuntu2 + + + true + + + + + + 390 + 310 141 22 diff --git a/src/javadialog.cpp b/src/javadialog.cpp index 92172e6..3df3b1d 100644 --- a/src/javadialog.cpp +++ b/src/javadialog.cpp @@ -19,3 +19,13 @@ void JavaDialog::on_archButton_clicked() { QApplication::clipboard()->setText(ui->archCmd->text()); } + +void JavaDialog::on_ubuntuButton_clicked() +{ + QApplication::clipboard()->setText(ui->ubuntuCmd->text()); +} + +void JavaDialog::on_ubuntuFXButton_clicked() +{ + QApplication::clipboard()->setText(ui->ubuntuFXCmd->text()); +} diff --git a/src/javadialog.h b/src/javadialog.h index 9028c8e..2c3efc2 100644 --- a/src/javadialog.h +++ b/src/javadialog.h @@ -20,6 +20,8 @@ class JavaDialog : public QDialog private slots: void on_archButton_clicked(); + void on_ubuntuButton_clicked(); + void on_ubuntuFXButton_clicked(); private: Ui::JavaDialog *ui; diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 1f25efd..09b3861 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -250,7 +250,7 @@ QVector SettingsDialog::detectSystemJava() QDir dir(linuxJavaHome); QStringList filter; filter << "java*"; - QStringList javaList = dir.entryList(filter, QDir::Dirs); + QStringList javaList = dir.entryList(filter, QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot); QVector javaLocations; for (int i = 0; i < javaList.size(); i++) { @@ -271,7 +271,7 @@ QVector SettingsDialog::detectSystemJava() } if (firstDashIndex != -1 && javaList.at(i).size() > firstDashIndex + 1) { - java.version.append("Java "); + java.version = "Java "; firstDashIndex++; for (int j = firstDashIndex; j < javaList.at(i).size() && stringData[j] != '-'; j++) { @@ -280,19 +280,19 @@ QVector SettingsDialog::detectSystemJava() } else { - java.version.append("Unknown Java Version"); + java.version = "Unknown Java Version"; } if (javaList.at(i).contains("openjdk", Qt::CaseInsensitive)) { - java.vendor.append("OpenJDK"); + java.vendor = "OpenJDK"; } else if (javaList.at(i).contains("oracle", Qt::CaseInsensitive)) { - java.vendor.append("Oracle"); + java.vendor = "Oracle"; } else { - java.vendor.append("Unknown Java Vendor"); + java.vendor = "Unknown Java Vendor"; } javaLocations.append(java); }