aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui')
-rw-r--r--launcher/ui/InstanceWindow.cpp8
-rw-r--r--launcher/ui/InstanceWindow.h4
-rw-r--r--launcher/ui/dialogs/InstallLoaderDialog.cpp148
-rw-r--r--launcher/ui/dialogs/InstallLoaderDialog.h45
-rw-r--r--launcher/ui/dialogs/ResourceDownloadDialog.cpp28
-rw-r--r--launcher/ui/dialogs/ResourceDownloadDialog.h5
-rw-r--r--launcher/ui/pages/BasePageContainer.h1
-rw-r--r--launcher/ui/pages/instance/VersionPage.cpp141
-rw-r--r--launcher/ui/pages/instance/VersionPage.h5
-rw-r--r--launcher/ui/pages/instance/VersionPage.ui62
-rw-r--r--launcher/ui/pages/modplatform/ResourcePage.cpp4
-rw-r--r--launcher/ui/widgets/PageContainer.cpp8
-rw-r--r--launcher/ui/widgets/PageContainer.h6
13 files changed, 250 insertions, 215 deletions
diff --git a/launcher/ui/InstanceWindow.cpp b/launcher/ui/InstanceWindow.cpp
index c62b370f..d784a40f 100644
--- a/launcher/ui/InstanceWindow.cpp
+++ b/launcher/ui/InstanceWindow.cpp
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * 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
@@ -263,6 +264,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 554c4c74..582cff13 100644
--- a/launcher/ui/InstanceWindow.h
+++ b/launcher/ui/InstanceWindow.h
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * 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
@@ -56,6 +57,7 @@ public:
virtual ~InstanceWindow();
bool selectPage(QString pageId) override;
+ BasePage* selectedPage() const override;
void refreshContainer() override;
QString instanceId();
diff --git a/launcher/ui/dialogs/InstallLoaderDialog.cpp b/launcher/ui/dialogs/InstallLoaderDialog.cpp
new file mode 100644
index 00000000..6e1ad1c0
--- /dev/null
+++ b/launcher/ui/dialogs/InstallLoaderDialog.cpp
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * Prism Launcher - Minecraft Launcher
+ * 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
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "InstallLoaderDialog.h"
+
+#include <QDialogButtonBox>
+#include <QPushButton>
+#include <QVBoxLayout>
+#include "Application.h"
+#include "BuildConfig.h"
+#include "DesktopServices.h"
+#include "meta/Index.h"
+#include "minecraft/MinecraftInstance.h"
+#include "minecraft/PackProfile.h"
+#include "ui/widgets/PageContainer.h"
+#include "ui/widgets/VersionSelectWidget.h"
+
+class LoaderPage : public VersionSelectWidget, public BasePage {
+ public:
+ LoaderPage(const QString& id,
+ const QString& icon,
+ const QString& name,
+ // "lightweight" loaders are independent to any game version
+ const bool lightweight,
+ const std::shared_ptr<PackProfile> profile,
+ QWidget* parent = nullptr)
+ : VersionSelectWidget(parent), m_id(id), m_icon(icon), m_name(name)
+ {
+ const QString minecraftVersion = profile->getComponentVersion("net.minecraft");
+ setEmptyString(tr("No versions are currently available for Minecraft %1").arg(minecraftVersion));
+ if (!lightweight)
+ setExactFilter(BaseVersionList::ParentVersionRole, minecraftVersion);
+
+ if (const QString currentVersion = profile->getComponentVersion(id); !currentVersion.isNull())
+ setCurrentVersion(currentVersion);
+ }
+
+ QString id() const override { return m_id; }
+ QString displayName() const override { return m_name; }
+ QIcon icon() const override { return APPLICATION->getThemedIcon(m_icon); }
+
+ void openedImpl() override
+ {
+ if (m_loaded)
+ return;
+
+ const auto versions = APPLICATION->metadataIndex()->get(m_id);
+ if (!versions)
+ return;
+
+ initialize(versions.get());
+ m_loaded = true;
+ }
+
+ private:
+ const QString m_id;
+ const QString m_icon;
+ const QString m_name;
+ bool m_loaded = false;
+};
+
+InstallLoaderDialog::InstallLoaderDialog(std::shared_ptr<PackProfile> profile, QWidget* parent)
+ : QDialog(parent), m_profile(profile), m_container(new PageContainer(this)), m_buttons(new QDialogButtonBox(this))
+{
+ auto layout = new QVBoxLayout(this);
+
+ m_container->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
+ layout->addWidget(m_container);
+
+ auto buttonLayout = new QHBoxLayout(this);
+
+ auto refreshButton = new QPushButton(tr("&Refresh"), this);
+ connect(refreshButton, &QPushButton::pressed, this, [this] {
+ LoaderPage* page = dynamic_cast<LoaderPage*>(m_container->selectedPage());
+ Q_ASSERT(page != nullptr);
+ page->loadList();
+ });
+ buttonLayout->addWidget(refreshButton);
+
+ m_buttons->setOrientation(Qt::Horizontal);
+ m_buttons->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
+ connect(m_buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
+ connect(m_buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
+ buttonLayout->addWidget(m_buttons);
+
+ layout->addLayout(buttonLayout);
+
+ setWindowTitle(dialogTitle());
+ resize(650, 400);
+
+ connect(m_container, &PageContainer::selectedPageChanged, this,
+ [this](BasePage* previous, BasePage* selected) { updateAcceptButton(selected); });
+ updateAcceptButton(m_container->selectedPage());
+}
+
+QList<BasePage*> InstallLoaderDialog::getPages()
+{
+ return { // Forge
+ new LoaderPage("net.minecraftforge", "forge", tr("Forge"), false, m_profile, this),
+ // Fabric
+ new LoaderPage("net.fabricmc.fabric-loader", "fabricmc-small", tr("Fabric"), true, m_profile, this),
+ // Quilt
+ new LoaderPage("org.quiltmc.quilt-loader", "quiltmc", tr("Quilt"), true, m_profile, this),
+ // LiteLoader
+ new LoaderPage("com.mumfrey.liteloader", "liteloader", tr("LiteLoader"), false, m_profile, this)
+ };
+}
+
+QString InstallLoaderDialog::dialogTitle()
+{
+ return tr("Install Loader");
+}
+
+void InstallLoaderDialog::updateAcceptButton(const BasePage* page)
+{
+ auto installed = !m_profile->getComponentVersion(page->id()).isNull();
+ m_buttons->button(QDialogButtonBox::Ok)->setText(installed ? tr("&Update") : tr("&Install"));
+}
+
+void InstallLoaderDialog::done(int result)
+{
+ if (result == Accepted) {
+ LoaderPage* page = dynamic_cast<LoaderPage*>(m_container->selectedPage());
+ Q_ASSERT(page != nullptr);
+
+ if (page->selectedVersion()) {
+ m_profile->setComponentVersion(page->id(), page->selectedVersion()->descriptor());
+ m_profile->resolve(Net::Mode::Online);
+ }
+ }
+
+ QDialog::done(result);
+}
diff --git a/launcher/ui/dialogs/InstallLoaderDialog.h b/launcher/ui/dialogs/InstallLoaderDialog.h
new file mode 100644
index 00000000..6c8762dc
--- /dev/null
+++ b/launcher/ui/dialogs/InstallLoaderDialog.h
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * Prism Launcher - Minecraft Launcher
+ * 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
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <QDialog>
+#include "ui/pages/BasePageProvider.h"
+
+class MinecraftInstance;
+class PageContainer;
+class PackProfile;
+class QDialogButtonBox;
+
+class InstallLoaderDialog : public QDialog, public BasePageProvider {
+ Q_OBJECT
+
+ public:
+ explicit InstallLoaderDialog(std::shared_ptr<PackProfile> instance, QWidget* parent = nullptr);
+
+ QList<BasePage*> getPages() override;
+ QString dialogTitle() override;
+
+ void updateAcceptButton(const BasePage* page);
+ void done(int result) override;
+
+ private:
+ std::shared_ptr<PackProfile> m_profile;
+ PageContainer* m_container;
+ QDialogButtonBox* m_buttons;
+};
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
index 4f59f560..283f35bc 100644
--- a/launcher/ui/dialogs/ResourceDownloadDialog.cpp
+++ b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
@@ -2,7 +2,7 @@
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
- * Copyright (C) 2022 TheKodeToad <TheKodeToad@proton.me>
+ * 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
@@ -207,15 +207,17 @@ bool ResourceDownloadDialog::selectPage(QString pageId)
return m_container->selectPage(pageId);
}
-ResourcePage* ResourceDownloadDialog::getSelectedPage()
+ResourcePage* ResourceDownloadDialog::selectedPage()
{
- return m_selectedPage;
+ ResourcePage* result = dynamic_cast<ResourcePage*>(m_container->selectedPage());
+ Q_ASSERT(result != nullptr);
+ return result;
}
void ResourceDownloadDialog::addResource(ModPlatform::IndexedPack::Ptr pack, ModPlatform::IndexedVersion& ver)
{
removeResource(pack->name);
- m_selectedPage->addResourceToPage(pack, ver, getBaseModel());
+ selectedPage()->addResourceToPage(pack, ver, getBaseModel());
setButtonStatus();
}
@@ -255,14 +257,8 @@ void ResourceDownloadDialog::selectedPageChanged(BasePage* previous, BasePage* s
return;
}
- m_selectedPage = dynamic_cast<ResourcePage*>(selected);
- if (!m_selectedPage) {
- qCritical() << "Page '" << selected->displayName() << "' in ResourceDownloadDialog is not a ResourcePage!";
- return;
- }
-
// Same effect as having a global search bar
- m_selectedPage->setSearchTerm(prev_page->getSearchTerm());
+ selectedPage()->setSearchTerm(prev_page->getSearchTerm());
}
ModDownloadDialog::ModDownloadDialog(QWidget* parent, const std::shared_ptr<ModFolderModel>& mods, BaseInstance* instance)
@@ -285,8 +281,6 @@ QList<BasePage*> ModDownloadDialog::getPages()
if (APPLICATION->capabilities() & Application::SupportsFlame)
pages.append(FlameModPage::create(this, *m_instance));
- m_selectedPage = dynamic_cast<ModPage*>(pages[0]);
-
return pages;
}
@@ -325,8 +319,6 @@ QList<BasePage*> ResourcePackDownloadDialog::getPages()
if (APPLICATION->capabilities() & Application::SupportsFlame)
pages.append(FlameResourcePackPage::create(this, *m_instance));
- m_selectedPage = dynamic_cast<ResourcePackResourcePage*>(pages[0]);
-
return pages;
}
@@ -352,8 +344,6 @@ QList<BasePage*> TexturePackDownloadDialog::getPages()
if (APPLICATION->capabilities() & Application::SupportsFlame)
pages.append(FlameTexturePackPage::create(this, *m_instance));
- m_selectedPage = dynamic_cast<TexturePackResourcePage*>(pages[0]);
-
return pages;
}
@@ -374,11 +364,7 @@ ShaderPackDownloadDialog::ShaderPackDownloadDialog(QWidget* parent,
QList<BasePage*> ShaderPackDownloadDialog::getPages()
{
QList<BasePage*> pages;
-
pages.append(ModrinthShaderPackPage::create(this, *m_instance));
-
- m_selectedPage = dynamic_cast<ShaderPackResourcePage*>(pages[0]);
-
return pages;
}
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.h b/launcher/ui/dialogs/ResourceDownloadDialog.h
index f65daaa3..e9d2cfbe 100644
--- a/launcher/ui/dialogs/ResourceDownloadDialog.h
+++ b/launcher/ui/dialogs/ResourceDownloadDialog.h
@@ -2,7 +2,7 @@
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
- * Copyright (C) 2022 TheKodeToad <TheKodeToad@proton.me>
+ * 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
@@ -61,7 +61,7 @@ class ResourceDownloadDialog : public QDialog, public BasePageProvider {
QString dialogTitle() override { return tr("Download %1").arg(resourcesString()); };
bool selectPage(QString pageId);
- ResourcePage* getSelectedPage();
+ ResourcePage* selectedPage();
void addResource(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&);
void removeResource(const QString&);
@@ -88,7 +88,6 @@ class ResourceDownloadDialog : public QDialog, public BasePageProvider {
const std::shared_ptr<ResourceFolderModel> m_base_model;
PageContainer* m_container = nullptr;
- ResourcePage* m_selectedPage = nullptr;
QDialogButtonBox m_buttons;
QVBoxLayout m_vertical_layout;
diff --git a/launcher/ui/pages/BasePageContainer.h b/launcher/ui/pages/BasePageContainer.h
index b41fe12a..eb3c9427 100644
--- a/launcher/ui/pages/BasePageContainer.h
+++ b/launcher/ui/pages/BasePageContainer.h
@@ -7,6 +7,7 @@ class BasePageContainer
public:
virtual ~BasePageContainer(){};
virtual bool selectPage(QString pageId) = 0;
+ virtual BasePage* selectedPage() const = 0;
virtual BasePage* getPage(QString pageId) { return nullptr; };
virtual void refreshContainer() = 0;
virtual bool requestClose() = 0;
diff --git a/launcher/ui/pages/instance/VersionPage.cpp b/launcher/ui/pages/instance/VersionPage.cpp
index 59107c53..53a71008 100644
--- a/launcher/ui/pages/instance/VersionPage.cpp
+++ b/launcher/ui/pages/instance/VersionPage.cpp
@@ -6,7 +6,7 @@
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
* Copyright (C) 2022-2023 Sefa Eyeoglu <contact@scrumplex.net>
- * Copyright (C) 2022 TheKodeToad <TheKodeToad@proton.me>
+ * 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
@@ -52,6 +52,7 @@
#include <QUrl>
#include "VersionPage.h"
+#include "ui/dialogs/InstallLoaderDialog.h"
#include "ui_VersionPage.h"
#include "ui/dialogs/CustomMessageBox.h"
@@ -254,20 +255,6 @@ void VersionPage::updateRunningStatus(bool running)
void VersionPage::updateVersionControls()
{
- // FIXME: this is a dirty hack
- auto minecraftVersion = Version(m_profile->getComponentVersion("net.minecraft"));
-
- ui->actionInstall_Forge->setEnabled(controlsEnabled);
-
- bool supportsFabric = minecraftVersion >= Version("1.14");
- ui->actionInstall_Fabric->setEnabled(controlsEnabled && supportsFabric);
-
- bool supportsQuilt = minecraftVersion >= Version("1.14");
- ui->actionInstall_Quilt->setEnabled(controlsEnabled && supportsQuilt);
-
- bool supportsLiteLoader = minecraftVersion <= Version("1.12.2");
- ui->actionInstall_LiteLoader->setEnabled(controlsEnabled && supportsLiteLoader);
-
updateButtons();
}
@@ -445,17 +432,6 @@ void VersionPage::on_actionChange_version_triggered()
return;
}
auto uid = list->uid();
- // FIXME: this is a horrible HACK. Get version filtering information from the actual metadata...
- if(uid == "net.minecraftforge")
- {
- on_actionInstall_Forge_triggered();
- return;
- }
- else if (uid == "com.mumfrey.liteloader")
- {
- on_actionInstall_LiteLoader_triggered();
- return;
- }
VersionSelectDialog vselect(list.get(), tr("Change %1 version").arg(name), this);
if (uid == "net.fabricmc.intermediary" || uid == "org.quiltmc.hashed")
{
@@ -507,87 +483,11 @@ void VersionPage::on_actionDownload_All_triggered()
m_container->refreshContainer();
}
-void VersionPage::on_actionInstall_Forge_triggered()
+void VersionPage::on_actionInstall_Loader_triggered()
{
- auto vlist = APPLICATION->metadataIndex()->get("net.minecraftforge");
- if(!vlist)
- {
- return;
- }
- VersionSelectDialog vselect(vlist.get(), tr("Select Forge version"), this);
- vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft"));
- vselect.setEmptyString(tr("No Forge versions are currently available for Minecraft ") + m_profile->getComponentVersion("net.minecraft"));
- vselect.setEmptyErrorString(tr("Couldn't load or download the Forge version lists!"));
-
- auto currentVersion = m_profile->getComponentVersion("net.minecraftforge");
- if(!currentVersion.isEmpty())
- {
- vselect.setCurrentVersion(currentVersion);
- }
-
- if (vselect.exec() && vselect.selectedVersion())
- {
- auto vsn = vselect.selectedVersion();
- m_profile->setComponentVersion("net.minecraftforge", vsn->descriptor());
- m_profile->resolve(Net::Mode::Online);
- // m_profile->installVersion();
- preselect(m_profile->rowCount(QModelIndex())-1);
- m_container->refreshContainer();
- }
-}
-
-void VersionPage::on_actionInstall_Fabric_triggered()
-{
- auto vlist = APPLICATION->metadataIndex()->get("net.fabricmc.fabric-loader");
- if(!vlist)
- {
- return;
- }
- VersionSelectDialog vselect(vlist.get(), tr("Select Fabric Loader version"), this);
- vselect.setEmptyString(tr("No Fabric Loader versions are currently available."));
- vselect.setEmptyErrorString(tr("Couldn't load or download the Fabric Loader version lists!"));
-
- auto currentVersion = m_profile->getComponentVersion("net.fabricmc.fabric-loader");
- if(!currentVersion.isEmpty())
- {
- vselect.setCurrentVersion(currentVersion);
- }
-
- if (vselect.exec() && vselect.selectedVersion())
- {
- auto vsn = vselect.selectedVersion();
- m_profile->setComponentVersion("net.fabricmc.fabric-loader", vsn->descriptor());
- m_profile->resolve(Net::Mode::Online);
- preselect(m_profile->rowCount(QModelIndex())-1);
- m_container->refreshContainer();
- }
-}
-
-void VersionPage::on_actionInstall_Quilt_triggered()
-{
- auto vlist = APPLICATION->metadataIndex()->get("org.quiltmc.quilt-loader");
- if(!vlist)
- {
- return;
- }
- VersionSelectDialog vselect(vlist.get(), tr("Select Quilt Loader version"), this);
- vselect.setEmptyString(tr("No Quilt Loader versions are currently available."));
- vselect.setEmptyErrorString(tr("Couldn't load or download the Quilt Loader version lists!"));
-
- auto currentVersion = m_profile->getComponentVersion("org.quiltmc.quilt-loader");
- if(!currentVersion.isEmpty())
- {
- vselect.setCurrentVersion(currentVersion);
- }
-
- if (vselect.exec() && vselect.selectedVersion())
- {
- auto vsn = vselect.selectedVersion();
- m_profile->setComponentVersion("org.quiltmc.quilt-loader", vsn->descriptor());
- m_profile->resolve(Net::Mode::Online);
- preselect(m_profile->rowCount(QModelIndex())-1);
- m_container->refreshContainer();
- }
+ InstallLoaderDialog dialog(m_inst->getPackProfile(), this);
+ dialog.exec();
+ m_container->refreshContainer();
}
void VersionPage::on_actionAdd_Empty_triggered()
@@ -608,35 +508,6 @@ void VersionPage::on_actionAdd_Empty_triggered()
}
}
-void VersionPage::on_actionInstall_LiteLoader_triggered()
-{
- auto vlist = APPLICATION->metadataIndex()->get("com.mumfrey.liteloader");
- if(!vlist)
- {
- return;
- }
- VersionSelectDialog vselect(vlist.get(), tr("Select LiteLoader version"), this);
- vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft"));
- vselect.setEmptyString(tr("No LiteLoader versions are currently available for Minecraft ") + m_profile->getComponentVersion("net.minecraft"));
- vselect.setEmptyErrorString(tr("Couldn't load or download the LiteLoader version lists!"));
-
- auto currentVersion = m_profile->getComponentVersion("com.mumfrey.liteloader");
- if(!currentVersion.isEmpty())
- {
- vselect.setCurrentVersion(currentVersion);
- }
-
- if (vselect.exec() && vselect.selectedVersion())
- {
- auto vsn = vselect.selectedVersion();
- m_profile->setComponentVersion("com.mumfrey.liteloader", vsn->descriptor());
- m_profile->resolve(Net::Mode::Online);
- // m_profile->installVersion(vselect.selectedVersion());
- preselect(m_profile->rowCount(QModelIndex())-1);
- m_container->refreshContainer();
- }
-}
-
void VersionPage::on_actionLibrariesFolder_triggered()
{
DesktopServices::openDirectory(m_inst->getLocalLibraryPath(), true);
diff --git a/launcher/ui/pages/instance/VersionPage.h b/launcher/ui/pages/instance/VersionPage.h
index d0087714..0dcb4635 100644
--- a/launcher/ui/pages/instance/VersionPage.h
+++ b/launcher/ui/pages/instance/VersionPage.h
@@ -79,11 +79,8 @@ public:
private slots:
void on_actionChange_version_triggered();
- void on_actionInstall_Forge_triggered();
- void on_actionInstall_Fabric_triggered();
- void on_actionInstall_Quilt_triggered();
+ void on_actionInstall_Loader_triggered();
void on_actionAdd_Empty_triggered();
- void on_actionInstall_LiteLoader_triggered();
void on_actionReload_triggered();
void on_actionRemove_triggered();
void on_actionMove_up_triggered();
diff --git a/launcher/ui/pages/instance/VersionPage.ui b/launcher/ui/pages/instance/VersionPage.ui
index a73c42d6..9be21d49 100644
--- a/launcher/ui/pages/instance/VersionPage.ui
+++ b/launcher/ui/pages/instance/VersionPage.ui
@@ -98,11 +98,7 @@
<addaction name="actionEdit"/>
<addaction name="actionRevert"/>
<addaction name="separator"/>
- <addaction name="actionInstall_Forge"/>
- <addaction name="actionInstall_Fabric"/>
- <addaction name="actionInstall_Quilt"/>
- <addaction name="actionInstall_LiteLoader"/>
- <addaction name="separator"/>
+ <addaction name="actionInstall_Loader"/>
<addaction name="actionAdd_to_Minecraft_jar"/>
<addaction name="actionReplace_Minecraft_jar"/>
<addaction name="actionAdd_Agents"/>
@@ -116,26 +112,26 @@
</widget>
<action name="actionChange_version">
<property name="text">
- <string>Change version</string>
+ <string>Change Version</string>
</property>
<property name="toolTip">
- <string>Change version of the selected package.</string>
+ <string>Change version of the selected component.</string>
</property>
</action>
<action name="actionMove_up">
<property name="text">
- <string>Move up</string>
+ <string>Move Up</string>
</property>
<property name="toolTip">
- <string>Make the selected package apply sooner.</string>
+ <string>Make the selected component apply sooner.</string>
</property>
</action>
<action name="actionMove_down">
<property name="text">
- <string>Move down</string>
+ <string>Move Down</string>
</property>
<property name="toolTip">
- <string>Make the selected package apply later.</string>
+ <string>Make the selected component apply later.</string>
</property>
</action>
<action name="actionRemove">
@@ -143,7 +139,7 @@
<string>Remove</string>
</property>
<property name="toolTip">
- <string>Remove selected package from the instance.</string>
+ <string>Remove selected component from the instance.</string>
</property>
</action>
<action name="actionCustomize">
@@ -151,7 +147,7 @@
<string>Customize</string>
</property>
<property name="toolTip">
- <string>Customize selected package.</string>
+ <string>Customize selected component.</string>
</property>
</action>
<action name="actionEdit">
@@ -159,7 +155,7 @@
<string>Edit</string>
</property>
<property name="toolTip">
- <string>Edit selected package.</string>
+ <string>Edit selected component.</string>
</property>
</action>
<action name="actionRevert">
@@ -167,39 +163,15 @@
<string>Revert</string>
</property>
<property name="toolTip">
- <string>Revert the selected package to default.</string>
- </property>
- </action>
- <action name="actionInstall_Forge">
- <property name="text">
- <string>Install Forge</string>
- </property>
- <property name="toolTip">
- <string>Install the Minecraft Forge package.</string>
- </property>
- </action>
- <action name="actionInstall_Fabric">
- <property name="text">
- <string>Install Fabric</string>
- </property>
- <property name="toolTip">
- <string>Install the Fabric Loader package.</string>
- </property>
- </action>
- <action name="actionInstall_Quilt">
- <property name="text">
- <string>Install Quilt</string>
- </property>
- <property name="toolTip">
- <string>Install the Quilt Loader package.</string>
+ <string>Revert the selected component to default.</string>
</property>
</action>
- <action name="actionInstall_LiteLoader">
+ <action name="actionInstall_Loader">
<property name="text">
- <string>Install LiteLoader</string>
+ <string>Install Loader</string>
</property>
<property name="toolTip">
- <string>Install the LiteLoader package.</string>
+ <string>Install a mod loader.</string>
</property>
</action>
<action name="actionAdd_to_Minecraft_jar">
@@ -228,7 +200,7 @@
<string>Add Empty</string>
</property>
<property name="toolTip">
- <string>Add an empty custom package.</string>
+ <string>Add an empty custom component.</string>
</property>
</action>
<action name="actionReload">
@@ -236,12 +208,12 @@
<string>Reload</string>
</property>
<property name="toolTip">
- <string>Reload all packages.</string>
+ <string>Reload all components.</string>
</property>
</action>
<action name="actionDownload_All">
<property name="text">
- <string>Download All</string>
+ <string>Download all</string>
</property>
<property name="toolTip">
<string>Download the files needed to launch the instance now.</string>
diff --git a/launcher/ui/pages/modplatform/ResourcePage.cpp b/launcher/ui/pages/modplatform/ResourcePage.cpp
index aab2ee89..41447142 100644
--- a/launcher/ui/pages/modplatform/ResourcePage.cpp
+++ b/launcher/ui/pages/modplatform/ResourcePage.cpp
@@ -4,7 +4,7 @@
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
- * Copyright (C) 2022 TheKodeToad <TheKodeToad@proton.me>
+ * 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
@@ -394,7 +394,7 @@ void ResourcePage::openUrl(const QUrl& url)
if (auto current_pack = getCurrentPack(); current_pack && slug != current_pack->slug) {
m_parent_dialog->selectPage(page);
- auto newPage = m_parent_dialog->getSelectedPage();
+ auto newPage = m_parent_dialog->selectedPage();
QLineEdit* searchEdit = newPage->m_ui->searchEdit;
auto model = newPage->m_model;
diff --git a/launcher/ui/widgets/PageContainer.cpp b/launcher/ui/widgets/PageContainer.cpp
index b98c9796..0a8a0544 100644
--- a/launcher/ui/widgets/PageContainer.cpp
+++ b/launcher/ui/widgets/PageContainer.cpp
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
+ * 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
@@ -141,6 +142,11 @@ BasePage* PageContainer::getPage(QString pageId)
return m_model->findPageEntryById(pageId);
}
+BasePage* PageContainer::selectedPage() const
+{
+ return m_currentPage;
+}
+
const QList<BasePage*> PageContainer::getPages() const
{
return m_model->pages();
diff --git a/launcher/ui/widgets/PageContainer.h b/launcher/ui/widgets/PageContainer.h
index ad74d43a..bb365c82 100644
--- a/launcher/ui/widgets/PageContainer.h
+++ b/launcher/ui/widgets/PageContainer.h
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
+ * 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
@@ -78,7 +79,8 @@ public:
return false;
}
- virtual bool selectPage(QString pageId) override;
+ bool selectPage(QString pageId) override;
+ BasePage* selectedPage() const override;
BasePage* getPage(QString pageId) override;
const QList<BasePage*> getPages() const;