diff options
| author | Trial97 <alexandru.tripon97@gmail.com> | 2023-08-15 12:49:21 +0300 |
|---|---|---|
| committer | Trial97 <alexandru.tripon97@gmail.com> | 2023-08-15 12:49:21 +0300 |
| commit | cf27d2f9ab206e24f7dfd909a88d7db48fd0a74a (patch) | |
| tree | 63675a840a90712b8b1468e87569fade7b11deb6 /launcher/ui | |
| parent | b2fdd8359405c93d0d93aa8c68971c986a1f68cb (diff) | |
| parent | 8f5bb982cd27dd9158b63d826769c168455a139b (diff) | |
| download | PrismLauncher-cf27d2f9ab206e24f7dfd909a88d7db48fd0a74a.tar.gz PrismLauncher-cf27d2f9ab206e24f7dfd909a88d7db48fd0a74a.tar.bz2 PrismLauncher-cf27d2f9ab206e24f7dfd909a88d7db48fd0a74a.zip | |
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into download_threads
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/ui')
84 files changed, 1125 insertions, 681 deletions
diff --git a/launcher/ui/InstanceWindow.cpp b/launcher/ui/InstanceWindow.cpp index 9c7886fa..7025cb79 100644 --- a/launcher/ui/InstanceWindow.cpp +++ b/launcher/ui/InstanceWindow.cpp @@ -2,6 +2,7 @@ /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net> + * Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -251,6 +252,11 @@ bool InstanceWindow::selectPage(QString pageId) return m_container->selectPage(pageId); } +BasePage* InstanceWindow::selectedPage() const +{ + return m_container->selectedPage(); +} + void InstanceWindow::refreshContainer() { m_container->refreshContainer(); diff --git a/launcher/ui/InstanceWindow.h b/launcher/ui/InstanceWindow.h index 508bcaa1..70f206f2 100644 --- a/launcher/ui/InstanceWindow.h +++ b/launcher/ui/InstanceWindow.h @@ -2,6 +2,7 @@ /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net> + * Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,6 +56,7 @@ class InstanceWindow : public QMainWindow, public BasePageContainer { virtual ~InstanceWindow(); bool selectPage(QString pageId) override; + BasePage* selectedPage() const override; void refreshContainer() override; QString instanceId(); diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index e342e833..a83ff1a2 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -515,9 +515,9 @@ void MainWindow::showInstanceContextMenu(const QPoint& pos) QAction* actionCreateInstance = new QAction(tr("Create instance"), this); actionCreateInstance->setToolTip(ui->actionAddInstance->toolTip()); if (!group.isNull()) { - QVariantMap data; - data["group"] = group; - actionCreateInstance->setData(data); + QVariantMap instance_action_data; + instance_action_data["group"] = group; + actionCreateInstance->setData(instance_action_data); } connect(actionCreateInstance, SIGNAL(triggered(bool)), SLOT(on_actionAddInstance_triggered())); @@ -527,9 +527,9 @@ void MainWindow::showInstanceContextMenu(const QPoint& pos) actions.append(actionCreateInstance); if (!group.isNull()) { QAction* actionDeleteGroup = new QAction(tr("Delete group '%1'").arg(group), this); - QVariantMap data; - data["group"] = group; - actionDeleteGroup->setData(data); + QVariantMap delete_group_action_data; + delete_group_action_data["group"] = group; + actionDeleteGroup->setData(delete_group_action_data); connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(deleteGroup())); actions.append(actionDeleteGroup); } @@ -627,7 +627,7 @@ void MainWindow::updateThemeMenu() themeMenu = new QMenu(this); } - auto themes = APPLICATION->getValidApplicationThemes(); + auto themes = APPLICATION->themeManager()->getValidApplicationThemes(); QActionGroup* themesGroup = new QActionGroup(this); @@ -641,7 +641,7 @@ void MainWindow::updateThemeMenu() themeAction->setActionGroup(themesGroup); connect(themeAction, &QAction::triggered, [theme]() { - APPLICATION->setApplicationTheme(theme->id()); + APPLICATION->themeManager()->setApplicationTheme(theme->id()); APPLICATION->settings()->set("ApplicationTheme", theme->id()); }); } @@ -744,9 +744,9 @@ void MainWindow::changeActiveAccount() if (sAction->data().type() != QVariant::Type::Int) return; - QVariant data = sAction->data(); + QVariant action_data = sAction->data(); bool valid = false; - int index = data.toInt(&valid); + int index = action_data.toInt(&valid); if (!valid) { index = -1; } @@ -1061,9 +1061,9 @@ void MainWindow::on_actionChangeInstIcon_triggered() void MainWindow::iconUpdated(QString icon) { if (icon == m_currentInstIcon) { - auto icon = APPLICATION->icons()->getIcon(m_currentInstIcon); - ui->actionChangeInstIcon->setIcon(icon); - changeIconButton->setIcon(icon); + auto new_icon = APPLICATION->icons()->getIcon(m_currentInstIcon); + ui->actionChangeInstIcon->setIcon(new_icon); + changeIconButton->setIcon(new_icon); } } @@ -1134,26 +1134,40 @@ void MainWindow::undoTrashInstance() ui->actionUndoTrashInstance->setEnabled(APPLICATION->instances()->trashedSomething()); } +void MainWindow::on_actionViewLauncherRootFolder_triggered() +{ + DesktopServices::openDirectory("."); +} + void MainWindow::on_actionViewInstanceFolder_triggered() { QString str = APPLICATION->settings()->get("InstanceDir").toString(); DesktopServices::openDirectory(str); } -void MainWindow::on_actionViewLauncherRootFolder_triggered() +void MainWindow::on_actionViewCentralModsFolder_triggered() { - const QString dataPath = QDir::currentPath(); - DesktopServices::openDirectory(dataPath); + DesktopServices::openDirectory(APPLICATION->settings()->get("CentralModsDir").toString(), true); } -void MainWindow::refreshInstances() +void MainWindow::on_actionViewIconThemeFolder_triggered() { - APPLICATION->instances()->loadList(); + DesktopServices::openDirectory(APPLICATION->themeManager()->getIconThemesFolder().path()); } -void MainWindow::on_actionViewCentralModsFolder_triggered() +void MainWindow::on_actionViewWidgetThemeFolder_triggered() { - DesktopServices::openDirectory(APPLICATION->settings()->get("CentralModsDir").toString(), true); + DesktopServices::openDirectory(APPLICATION->themeManager()->getApplicationThemesFolder().path()); +} + +void MainWindow::on_actionViewCatPackFolder_triggered() +{ + DesktopServices::openDirectory(APPLICATION->themeManager()->getCatPacksFolder().path()); +} + +void MainWindow::refreshInstances() +{ + APPLICATION->instances()->loadList(); } void MainWindow::checkForUpdates() @@ -1590,7 +1604,7 @@ void MainWindow::startTask(Task* task) task->start(); } -void MainWindow::instanceChanged(const QModelIndex& current, const QModelIndex& previous) +void MainWindow::instanceChanged(const QModelIndex& current, [[maybe_unused]] const QModelIndex& previous) { if (!current.isValid()) { APPLICATION->settings()->set("SelectedInstance", QString()); @@ -1725,7 +1739,7 @@ void MainWindow::setInstanceActionsEnabled(bool enabled) ui->actionCreateInstanceShortcut->setEnabled(enabled); } -void MainWindow::refreshCurrentInstance(bool running) +void MainWindow::refreshCurrentInstance([[maybe_unused]] bool running) { auto current = view->selectionModel()->currentIndex(); instanceChanged(current, current); diff --git a/launcher/ui/MainWindow.h b/launcher/ui/MainWindow.h index e6434dae..be9c4994 100644 --- a/launcher/ui/MainWindow.h +++ b/launcher/ui/MainWindow.h @@ -109,16 +109,19 @@ class MainWindow : public QMainWindow { void on_actionChangeInstIcon_triggered(); + void on_actionViewLauncherRootFolder_triggered(); + void on_actionViewInstanceFolder_triggered(); + void on_actionViewCentralModsFolder_triggered(); - void on_actionViewLauncherRootFolder_triggered(); + void on_actionViewIconThemeFolder_triggered(); + void on_actionViewWidgetThemeFolder_triggered(); + void on_actionViewCatPackFolder_triggered(); void on_actionViewSelectedInstFolder_triggered(); void refreshInstances(); - void on_actionViewCentralModsFolder_triggered(); - void checkForUpdates(); void on_actionSettings_triggered(); diff --git a/launcher/ui/MainWindow.ui b/launcher/ui/MainWindow.ui index e4421d40..6ef32099 100644 --- a/launcher/ui/MainWindow.ui +++ b/launcher/ui/MainWindow.ui @@ -186,9 +186,14 @@ <property name="toolTipsVisible"> <bool>true</bool> </property> - <addaction name="actionViewInstanceFolder"/> <addaction name="actionViewLauncherRootFolder"/> + <addaction name="separator"/> + <addaction name="actionViewInstanceFolder"/> <addaction name="actionViewCentralModsFolder"/> + <addaction name="separator"/> + <addaction name="actionViewIconThemeFolder"/> + <addaction name="actionViewWidgetThemeFolder"/> + <addaction name="actionViewCatPackFolder"/> </widget> <widget class="QMenu" name="accountsMenu"> <property name="title"> @@ -465,7 +470,8 @@ </action> <action name="actionExportInstanceZip"> <property name="icon"> - <iconset theme="launcher"/> + <iconset theme="launcher"> + <normaloff>.</normaloff>.</iconset> </property> <property name="text"> <string>Prism Launcher (zip)</string> @@ -473,7 +479,8 @@ </action> <action name="actionExportInstanceMrPack"> <property name="icon"> - <iconset theme="modrinth"/> + <iconset theme="modrinth"> + <normaloff>.</normaloff>.</iconset> </property> <property name="text"> <string>Modrinth (mrpack)</string> @@ -481,15 +488,17 @@ </action> <action name="actionExportInstanceFlamePack"> <property name="icon"> - <iconset theme="flame"/> + <iconset theme="flame"> + <normaloff>.</normaloff>.</iconset> </property> <property name="text"> - <string>CurseForge (zip)</string> + <string>CurseForge (zip)</string> </property> </action> <action name="actionExportInstanceToModList"> <property name="icon"> - <iconset theme="new"/> + <iconset theme="new"> + <normaloff>.</normaloff>.</iconset> </property> <property name="text"> <string>Mod List</string> @@ -552,7 +561,7 @@ <normaloff>.</normaloff>.</iconset> </property> <property name="text"> - <string>&View Instance Folder</string> + <string>View &Instance Folder</string> </property> <property name="toolTip"> <string>Open the instance folder in a file browser.</string> @@ -564,7 +573,7 @@ <normaloff>.</normaloff>.</iconset> </property> <property name="text"> - <string>&View Launcher Root Folder</string> + <string>View Launcher &Root Folder</string> </property> <property name="toolTip"> <string>Open the launcher's root folder in a file browser.</string> @@ -719,6 +728,38 @@ <string>Open the %1 wiki</string> </property> </action> + <action name="actionViewWidgetThemeFolder"> + <property name="icon"> + <iconset theme="viewfolder"> + <normaloff>.</normaloff>.</iconset> + </property> + <property name="text"> + <string>View &Widget Themes Folder</string> + </property> + <property name="toolTip"> < |
