Skip to content

Commit

Permalink
Ubuntu - Add Java install instructions and fix duplicates in Java det…
Browse files Browse the repository at this point in the history
…ection
  • Loading branch information
weirddan455 committed May 25, 2021
1 parent 97e3ea6 commit f9b6927
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 17 deletions.
137 changes: 126 additions & 11 deletions forms/javadialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@
</rect>
</property>
<property name="text">
<string>Oracle Java 8 is recommended as it includes JavaFX (needed for the &quot;What's New&quot; 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.)</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Oracle Java 8 is recommended as it includes JavaFX (needed for the &amp;quot;What's New&amp;quot; page.)&lt;/p&gt;&lt;p&gt;OpenJDK builds and Java 11 may be used but they do not include JavaFX.&lt;/p&gt;&lt;p&gt;The links below will direct you to where these can be downloaded.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
Expand Down Expand Up @@ -113,9 +111,9 @@ Links on the Windows tabs do include Linux builds if there are issues with the p
<widget class="QLabel" name="archLabel">
<property name="geometry">
<rect>
<x>40</x>
<y>110</y>
<width>491</width>
<x>10</x>
<y>100</y>
<width>551</width>
<height>20</height>
</rect>
</property>
Expand All @@ -129,9 +127,9 @@ Links on the Windows tabs do include Linux builds if there are issues with the p
<widget class="QLineEdit" name="archCmd">
<property name="geometry">
<rect>
<x>40</x>
<y>150</y>
<width>311</width>
<x>20</x>
<y>130</y>
<width>321</width>
<height>22</height>
</rect>
</property>
Expand All @@ -145,8 +143,125 @@ Links on the Windows tabs do include Linux builds if there are issues with the p
<widget class="QPushButton" name="archButton">
<property name="geometry">
<rect>
<x>379</x>
<y>150</y>
<x>390</x>
<y>130</y>
<width>141</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Copy to Clipboard</string>
</property>
</widget>
<widget class="QLabel" name="ubuntuLabel">
<property name="geometry">
<rect>
<x>10</x>
<y>190</y>
<width>551</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Ubuntu</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="Line" name="line">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>551</width>
<height>20</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="Line" name="line_2">
<property name="geometry">
<rect>
<x>10</x>
<y>170</y>
<width>551</width>
<height>20</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLineEdit" name="ubuntuCmd">
<property name="geometry">
<rect>
<x>20</x>
<y>220</y>
<width>321</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>sudo apt install openjdk-8-jre</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="ubuntuButton">
<property name="geometry">
<rect>
<x>390</x>
<y>220</y>
<width>141</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Copy to Clipboard</string>
</property>
</widget>
<widget class="QLabel" name="ubuntuLabelFX">
<property name="geometry">
<rect>
<x>10</x>
<y>260</y>
<width>541</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>OpenJFX for Java 8 has been removed in recent Ubuntu releases.
On Ubuntu 18.04, it can be installed with the following command.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLineEdit" name="ubuntuFXCmd">
<property name="geometry">
<rect>
<x>20</x>
<y>310</y>
<width>321</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>sudo apt install openjfx=8u161-b12-1ubuntu2</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="ubuntuFXButton">
<property name="geometry">
<rect>
<x>390</x>
<y>310</y>
<width>141</width>
<height>22</height>
</rect>
Expand Down
10 changes: 10 additions & 0 deletions src/javadialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
2 changes: 2 additions & 0 deletions src/javadialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ QVector<JavaInfo> 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<JavaInfo> javaLocations;
for (int i = 0; i < javaList.size(); i++)
{
Expand All @@ -271,7 +271,7 @@ QVector<JavaInfo> 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++)
{
Expand All @@ -280,19 +280,19 @@ QVector<JavaInfo> 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);
}
Expand Down

0 comments on commit f9b6927

Please sign in to comment.