From 312009513d0b3b3a8e08d386bd249ea85aa8bdef Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sat, 14 Sep 2024 18:27:12 +0300 Subject: [PATCH 1/2] add open java folder action Signed-off-by: Trial97 --- launcher/Application.cpp | 1 + launcher/LaunchController.cpp | 1 + launcher/ui/MainWindow.cpp | 7 +++++++ launcher/ui/MainWindow.h | 2 +- launcher/ui/MainWindow.ui | 15 ++++++++++++++- launcher/ui/themes/ThemeManager.h | 4 +++- 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 35eb6e91e6..3bed11db2e 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -1870,6 +1870,7 @@ QUrl Application::normalizeImportUrl(QString const& url) return QUrl::fromUserInput(url); } } + const QString Application::javaPath() { return m_settings->get("JavaDir").toString(); diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp index 73800574f1..687da13220 100644 --- a/launcher/LaunchController.cpp +++ b/launcher/LaunchController.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include "BuildConfig.h" diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index a5ccbc19a2..f19ac85d22 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -233,6 +233,8 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi if (qgetenv("XDG_CURRENT_DESKTOP") == "gamescope") { ui->mainToolBar->addAction(ui->actionCloseWindow); } + + ui->actionViewJavaFolder->setVisible(BuildConfig.JAVA_DOWNLOADER_ENABLED); } // add the toolbar toggles to the view menu @@ -1223,6 +1225,11 @@ void MainWindow::on_actionViewLogsFolder_triggered() DesktopServices::openPath("logs", true); } +void MainWindow::on_actionViewJavaFolder_triggered() +{ + DesktopServices::openPath(APPLICATION->javaPath(), true); +} + void MainWindow::refreshInstances() { APPLICATION->instances()->loadList(); diff --git a/launcher/ui/MainWindow.h b/launcher/ui/MainWindow.h index 41bef99805..0e692eda7d 100644 --- a/launcher/ui/MainWindow.h +++ b/launcher/ui/MainWindow.h @@ -48,7 +48,6 @@ #include "BaseInstance.h" #include "minecraft/auth/MinecraftAccount.h" -#include "net/NetJob.h" class LaunchController; class NewsChecker; @@ -119,6 +118,7 @@ class MainWindow : public QMainWindow { void on_actionViewCatPackFolder_triggered(); void on_actionViewIconsFolder_triggered(); void on_actionViewLogsFolder_triggered(); + void on_actionViewJavaFolder_triggered(); void on_actionViewSkinsFolder_triggered(); diff --git a/launcher/ui/MainWindow.ui b/launcher/ui/MainWindow.ui index bad8762ad6..819a1efe70 100644 --- a/launcher/ui/MainWindow.ui +++ b/launcher/ui/MainWindow.ui @@ -131,7 +131,7 @@ 0 0 800 - 22 + 27 @@ -192,6 +192,7 @@ + @@ -788,6 +789,18 @@ Open the cat packs folder in a file browser. + + + + .. + + + Java + + + Open the java folder in a file browser. + + diff --git a/launcher/ui/themes/ThemeManager.h b/launcher/ui/themes/ThemeManager.h index c7e32bc8c9..a9036107c8 100644 --- a/launcher/ui/themes/ThemeManager.h +++ b/launcher/ui/themes/ThemeManager.h @@ -18,10 +18,12 @@ */ #pragma once +#include +#include #include +#include #include "IconTheme.h" -#include "ui/MainWindow.h" #include "ui/themes/CatPack.h" #include "ui/themes/ITheme.h" From 1c6bd74ed8d4818231dd153993ed1643dc4e4543 Mon Sep 17 00:00:00 2001 From: QazCetelic Date: Sat, 14 Sep 2024 22:04:18 +0200 Subject: [PATCH 2/2] Disable folder action instead of hiding it and add additional information in the tooltip. Signed-off-by: QazCetelic --- launcher/ui/MainWindow.cpp | 3 ++- launcher/ui/MainWindow.ui | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index f19ac85d22..3f0bb3281e 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -234,7 +234,8 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi ui->mainToolBar->addAction(ui->actionCloseWindow); } - ui->actionViewJavaFolder->setVisible(BuildConfig.JAVA_DOWNLOADER_ENABLED); + ui->actionViewJavaFolder->setEnabled(BuildConfig.JAVA_DOWNLOADER_ENABLED); + } // add the toolbar toggles to the view menu diff --git a/launcher/ui/MainWindow.ui b/launcher/ui/MainWindow.ui index 819a1efe70..89e536b01f 100644 --- a/launcher/ui/MainWindow.ui +++ b/launcher/ui/MainWindow.ui @@ -798,7 +798,7 @@ Java - Open the java folder in a file browser. + Open the java folder in a file browser. Only available if the built-in Java downloader is used.