Skip to content

Commit

Permalink
Merge pull request PrismLauncher#2819 from Trial97/java_dir
Browse files Browse the repository at this point in the history
add open java folder action
  • Loading branch information
TayouVR authored Sep 16, 2024
2 parents 914ae6e + 2fd8685 commit 1b00d61
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions launcher/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,7 @@ QUrl Application::normalizeImportUrl(QString const& url)
return QUrl::fromUserInput(url);
}
}

const QString Application::javaPath()
{
return m_settings->get("JavaDir").toString();
Expand Down
1 change: 1 addition & 0 deletions launcher/LaunchController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include <QLineEdit>
#include <QList>
#include <QPushButton>
#include <QRegularExpression>
#include <QStringList>

#include "BuildConfig.h"
Expand Down
8 changes: 8 additions & 0 deletions launcher/ui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
if (qgetenv("XDG_CURRENT_DESKTOP") == "gamescope") {
ui->mainToolBar->addAction(ui->actionCloseWindow);
}

ui->actionViewJavaFolder->setEnabled(BuildConfig.JAVA_DOWNLOADER_ENABLED);

}

// add the toolbar toggles to the view menu
Expand Down Expand Up @@ -1223,6 +1226,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();
Expand Down
2 changes: 1 addition & 1 deletion launcher/ui/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

#include "BaseInstance.h"
#include "minecraft/auth/MinecraftAccount.h"
#include "net/NetJob.h"

class LaunchController;
class NewsChecker;
Expand Down Expand Up @@ -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();

Expand Down
15 changes: 14 additions & 1 deletion launcher/ui/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
<height>27</height>
</rect>
</property>
<widget class="QMenu" name="fileMenu">
Expand Down Expand Up @@ -192,6 +192,7 @@
<addaction name="actionViewInstanceFolder"/>
<addaction name="actionViewCentralModsFolder"/>
<addaction name="actionViewSkinsFolder"/>
<addaction name="actionViewJavaFolder"/>
<addaction name="separator"/>
<addaction name="actionViewIconThemeFolder"/>
<addaction name="actionViewWidgetThemeFolder"/>
Expand Down Expand Up @@ -788,6 +789,18 @@
<string>Open the cat packs folder in a file browser.</string>
</property>
</action>
<action name="actionViewJavaFolder">
<property name="icon">
<iconset theme="viewfolder">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Java</string>
</property>
<property name="toolTip">
<string>Open the java folder in a file browser. Only available if the built-in Java downloader is used.</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
Expand Down
4 changes: 3 additions & 1 deletion launcher/ui/themes/ThemeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
*/
#pragma once

#include <QDir>
#include <QLoggingCategory>
#include <QString>
#include <memory>

#include "IconTheme.h"
#include "ui/MainWindow.h"
#include "ui/themes/CatPack.h"
#include "ui/themes/ITheme.h"

Expand Down

0 comments on commit 1b00d61

Please sign in to comment.