aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/CMakeLists.txt3
-rw-r--r--launcher/resources/multimc/128x128/instances/fabricmc.pngbin0 -> 4839 bytes
-rw-r--r--launcher/resources/multimc/128x128/instances/liteloader.pngbin0 -> 20337 bytes
-rw-r--r--launcher/resources/multimc/22x22/fabricmc-small.pngbin0 -> 5672 bytes
-rw-r--r--launcher/resources/multimc/multimc.qrc6
-rw-r--r--launcher/resources/multimc/scalable/instances/forge.svg43
-rw-r--r--launcher/resources/multimc/scalable/instances/quiltmc.svg98
-rw-r--r--launcher/ui/InstanceWindow.cpp8
-rw-r--r--launcher/ui/InstanceWindow.h4
-rw-r--r--launcher/ui/dialogs/InstallLoaderDialog.cpp139
-rw-r--r--launcher/ui/dialogs/InstallLoaderDialog.h42
-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.cpp142
-rw-r--r--launcher/ui/pages/instance/VersionPage.h5
-rw-r--r--launcher/ui/pages/instance/VersionPage.ui71
-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
20 files changed, 388 insertions, 225 deletions
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index ce2771a4..d0989577 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -944,6 +944,8 @@ SET(LAUNCHER_SOURCES
ui/dialogs/ChooseProviderDialog.cpp
ui/dialogs/ModUpdateDialog.cpp
ui/dialogs/ModUpdateDialog.h
+ ui/dialogs/InstallLoaderDialog.cpp
+ ui/dialogs/InstallLoaderDialog.h
# GUI - widgets
ui/widgets/Common.cpp
@@ -1066,6 +1068,7 @@ qt_wrap_ui(LAUNCHER_UI
ui/dialogs/ScrollMessageBox.ui
ui/dialogs/BlockedModsDialog.ui
ui/dialogs/ChooseProviderDialog.ui
+ ui/dialogs/InstallLoaderDialog.ui
)
qt_add_resources(LAUNCHER_RESOURCES
diff --git a/launcher/resources/multimc/128x128/instances/fabricmc.png b/launcher/resources/multimc/128x128/instances/fabricmc.png
new file mode 100644
index 00000000..c78543ae
--- /dev/null
+++ b/launcher/resources/multimc/128x128/instances/fabricmc.png
Binary files differ
diff --git a/launcher/resources/multimc/128x128/instances/liteloader.png b/launcher/resources/multimc/128x128/instances/liteloader.png
new file mode 100644
index 00000000..88295e64
--- /dev/null
+++ b/launcher/resources/multimc/128x128/instances/liteloader.png
Binary files differ
diff --git a/launcher/resources/multimc/22x22/fabricmc-small.png b/launcher/resources/multimc/22x22/fabricmc-small.png
new file mode 100644
index 00000000..e21ae9e8
--- /dev/null
+++ b/launcher/resources/multimc/22x22/fabricmc-small.png
Binary files differ
diff --git a/launcher/resources/multimc/multimc.qrc b/launcher/resources/multimc/multimc.qrc
index 2c00f28f..907fbb5d 100644
--- a/launcher/resources/multimc/multimc.qrc
+++ b/launcher/resources/multimc/multimc.qrc
@@ -347,5 +347,11 @@
<file>scalable/export.svg</file>
<file>scalable/launch.svg</file>
<file>scalable/server.svg</file>
+
+ <file>scalable/instances/forge.svg</file>
+ <file>scalable/instances/quiltmc.svg</file>
+ <file>22x22/fabricmc-small.png</file>
+ <file>128x128/instances/fabricmc.png</file>
+ <file>128x128/instances/liteloader.png</file>
</qresource>
</RCC>
diff --git a/launcher/resources/multimc/scalable/instances/forge.svg b/launcher/resources/multimc/scalable/instances/forge.svg
new file mode 100644
index 00000000..ea402c5b
--- /dev/null
+++ b/launcher/resources/multimc/scalable/instances/forge.svg
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xml:space="preserve"
+ width="24"
+ height="24"
+ viewBox="164.072 372.466 24 24"
+ version="1.1"
+ id="svg132"
+ sodipodi:docname="forge.svg"
+ inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg"><defs
+ id="defs136" /><sodipodi:namedview
+ id="namedview134"
+ pagecolor="#ffffff"
+ bordercolor="#000000"
+ borderopacity="0.25"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="false"
+ inkscape:zoom="16"
+ inkscape:cx="24.28125"
+ inkscape:cy="4.9375"
+ inkscape:window-width="1920"
+ inkscape:window-height="1011"
+ inkscape:window-x="0"
+ inkscape:window-y="32"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg132" /><rect
+ style="fill:#1d2d41;fill-opacity:1;stroke-width:1.02136"
+ id="rect7386"
+ width="24"
+ height="24"
+ x="164.07201"
+ y="372.466" /><path
+ fill="#1e2d41"
+ d="m 183.16438,381.24198 -8.60519,-0.42066 10.51249,-0.008 V 379.966 h -11.85315 v 3.18329 c 0,0.0266 -0.34666,-2.07997 -0.42599,-2.66864 h -0.93198 v 2.96329 c 0,0.028 -0.39866,-2.47596 -0.44066,-2.78929 h -6.3479 c 0.43266,0.37466 2.81996,2.40997 4.51726,3.24729 0.85065,0.41999 1.89464,0.42332 2.8233,0.44933 0.47199,0.0134 0.96665,0.0493 1.31997,0.39866 0.51266,0.50865 0.62665,1.29731 0.18466,1.89396 -0.43732,0.59 -1.66797,0.718 -1.66797,0.718 l -1.02531,1.25798 v 1.46063 h 2.3313 l 0.072,-1.44329 2.01597,-1.42932 c -0.21534,0.17199 -0.69533,0.63332 -1.41664,1.7433 a 3.9826047,3.9826047 0 0 0 -0.38934,0.79333 c 0.50933,-0.43134 1.55531,-0.72667 2.76396,-0.72667 1.20665,0 2.25196,0.29467 2.76195,0.72533 a 3.9752715,3.9752715 0 0 0 -0.38866,-0.79199 c -0.72132,-1.11064 -1.20131,-1.57131 -1.41664,-1.7433 l 2.01597,1.42932 0.0727,1.44329 h 2.17462 v -1.45997 l -1.02464,-1.25864 c 0,0 -1.51798,-0.0967 -1.9153,-0.71733 -1.14466,-1.7893 0.48066,-4.5666 4.28327,-5.40258 z"
+ style="fill:#ffffff;stroke-width:0.227407"
+ id="path130" /></svg>
diff --git a/launcher/resources/multimc/scalable/instances/quiltmc.svg b/launcher/resources/multimc/scalable/instances/quiltmc.svg
new file mode 100644
index 00000000..a7aaca53
--- /dev/null
+++ b/launcher/resources/multimc/scalable/instances/quiltmc.svg
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ id="Layer_1"
+ data-name="Layer 1"
+ viewBox="0 0 23.999999 23.999999"
+ version="1.1"
+ sodipodi:docname="quiltmc.svg"
+ width="24"
+ height="24"
+ inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview27"
+ pagecolor="#ffffff"
+ bordercolor="#000000"
+ borderopacity="0.25"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="false"
+ inkscape:zoom="10.390684"
+ inkscape:cx="24.685575"
+ inkscape:cy="9.5277659"
+ inkscape:window-width="1499"
+ inkscape:window-height="749"
+ inkscape:window-x="100"
+ inkscape:window-y="118"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="Layer_1" />
+ <defs
+ id="defs4">
+ <style
+ id="style2">.cls-1{fill:#1b112b;}.cls-2{fill:#9722ff;}.cls-3{fill:#dc29dd;}.cls-4{fill:#27a2fd;}.cls-5{fill:#34f;}</style>
+ </defs>
+ <rect
+ class="cls-1"
+ width="24"
+ height="24"
+ rx="5.9670944"
+ id="rect6"
+ x="0"
+ y="0"
+ style="stroke-width:0.0262717" />
+ <path
+ class="cls-2"
+ d="M 8.53568,6.3874419 A 0.27217496,0.27217496 0 0 0 8.8075922,6.6593542 H 9.2699744 V 7.6928834 H 8.8075922 a 0.27191225,0.27191225 0 0 0 0,0.5438245 H 9.2699744 V 9.0293255 A 0.24091162,0.24091162 0 0 1 9.0290628,9.2702371 H 8.2364452 V 8.807855 a 0.27191225,0.27191225 0 0 0 -0.5438245,0 V 9.2702371 H 6.6590914 V 8.807855 a 0.27191224,0.27191224 0 0 0 -0.5438244,0 V 9.2702371 H 5.3226493 A 0.24117434,0.24117434 0 0 1 5.0817377,9.0293255 V 5.322912 A 0.24091162,0.24091162 0 0 1 5.3226493,5.0820004 H 9.0290628 A 0.2406489,0.2406489 0 0 1 9.2699744,5.322912 V 6.115267 H 8.8075922 A 0.27217496,0.27217496 0 0 0 8.53568,6.3874419 Z"
+ id="path8"
+ style="stroke-width:0.0262717" />
+ <path
+ class="cls-3"
+ d="m 13.267216,6.3874419 a 0.27191224,0.27191224 0 0 0 0.271912,0.2719123 h 0.463696 v 1.0335292 h -0.462382 a 0.27191225,0.27191225 0 0 0 0,0.5438245 h 0.462382 V 9.0293255 A 0.24117434,0.24117434 0 0 1 13.761912,9.2702371 H 10.054973 A 0.24091162,0.24091162 0 0 1 9.8140616,9.0293255 V 8.2367079 h 0.4621194 a 0.27191225,0.27191225 0 1 0 0,-0.5438245 H 9.8140616 V 6.6593542 h 0.4621194 a 0.27217496,0.27217496 0 1 0 0,-0.5440872 H 9.8140616 V 5.322912 A 0.2406489,0.2406489 0 0 1 10.054973,5.0820004 h 3.706414 a 0.24091162,0.24091162 0 0 1 0.240911,0.2409116 v 0.792355 h -0.462382 a 0.27191224,0.27191224 0 0 0 -0.2727,0.2721749 z"
+ id="path10"
+ style="stroke-width:0.0262717" />
+ <path
+ class="cls-4"
+ d="M 18.73436,5.322912 V 9.0293255 A 0.24091162,0.24091162 0 0 1 18.493448,9.2702371 H 17.70083 V 8.807855 a 0.27191224,0.27191224 0 0 0 -0.543824,0 V 9.2702371 H 16.123477 V 8.807855 a 0.27191251,0.27191251 0 0 0 -0.543825,0 V 9.2702371 H 14.787034 A 0.24117434,0.24117434 0 0 1 14.546123,9.0293255 V 8.2367079 h 0.462382 a 0.27191225,0.27191225 0 1 0 0,-0.5438245 H 14.546123 V 6.6593542 h 0.462382 a 0.27217496,0.27217496 0 0 0 0,-0.5440872 H 14.546123 V 5.322912 a 0.24091162,0.24091162 0 0 1 0.240911,-0.2409116 h 3.706414 A 0.2406489,0.2406489 0 0 1 18.73436,5.322912 Z"
+ id="path12"
+ style="stroke-width:0.0262717" />
+ <path
+ class="cls-3"
+ d="m 9.2699744,10.054973 v 3.706414 A 0.2406489,0.2406489 0 0 1 9.0290628,14.002298 H 8.2364452 v -0.462382 a 0.27191225,0.27191225 0 1 0 -0.5438245,0 v 0.462908 H 6.6590914 v -0.462382 a 0.27191224,0.27191224 0 0 0 -0.5438244,0 v 0.462382 H 5.3226493 A 0.24091162,0.24091162 0 0 1 5.0817377,13.761912 V 10.054973 A 0.24117434,0.24117434 0 0 1 5.3226493,9.8140616 H 6.115267 v 0.4623824 a 0.27191224,0.27191224 0 0 0 0.5438244,0 V 9.8140616 h 1.0335293 v 0.4623824 a 0.27191225,0.27191225 0 1 0 0.5438245,0 V 9.8140616 h 0.7926176 a 0.24091162,0.24091162 0 0 1 0.2409116,0.2409114 z"
+ id="path14"
+ style="stroke-width:0.0262717" />
+ <path
+ class="cls-4"
+ d="m 13.267216,11.119503 a 0.27191224,0.27191224 0 0 0 0.271912,0.271912 h 0.463696 v 1.03353 h -0.462382 a 0.27191224,0.27191224 0 0 0 0,0.543824 h 0.462382 v 0.792618 a 0.24091162,0.24091162 0 0 1 -0.240912,0.240911 h -0.793143 v -0.462382 a 0.27191224,0.27191224 0 1 0 -0.543824,0 v 0.462908 h -1.03353 v -0.462382 a 0.27217496,0.27217496 0 0 0 -0.544087,0 v 0.462382 H 10.054973 A 0.2406489,0.2406489 0 0 1 9.8140616,13.761912 V 10.054973 A 0.24091162,0.24091162 0 0 1 10.054973,9.8140616 h 3.706414 a 0.24117434,0.24117434 0 0 1 0.240911,0.2409114 v 0.792618 h -0.462382 a 0.27191224,0.27191224 0 0 0 -0.2727,0.271912 z"
+ id="path16"
+ style="stroke-width:0.0262717" />
+ <path
+ class="cls-5"
+ d="m 18.73436,10.054973 v 3.706414 a 0.2406489,0.2406489 0 0 1 -0.240912,0.240911 h -3.706414 a 0.24091162,0.24091162 0 0 1 -0.240911,-0.240911 v -0.792618 h 0.462382 a 0.27191224,0.27191224 0 1 0 0,-0.543824 h -0.462382 v -1.03353 h 0.462382 a 0.27191224,0.27191224 0 0 0 0,-0.543824 h -0.462382 v -0.792618 a 0.24117434,0.24117434 0 0 1 0.240911,-0.2409114 h 0.792093 v 0.4623824 a 0.27191224,0.27191224 0 0 0 0.543824,0 V 9.8140616 h 1.033529 v 0.4623824 a 0.27191251,0.27191251 0 0 0 0.543825,0 V 9.8140616 h 0.792617 a 0.24091162,0.24091162 0 0 1 0.241438,0.2409114 z"
+ id="path18"
+ style="stroke-width:0.0262717" />
+ <path
+ class="cls-2"
+ d="m 8.53568,15.851827 a 0.27217496,0.27217496 0 0 0 0.2719122,0.271912 h 0.4623822 v 1.033267 H 8.8075922 a 0.27217496,0.27217496 0 0 0 0,0.544087 h 0.4623822 v 0.792618 A 0.24091162,0.24091162 0 0 1 9.0290628,18.734622 H 5.3226493 A 0.24117434,0.24117434 0 0 1 5.0817377,18.493711 V 14.787297 A 0.24091162,0.24091162 0 0 1 5.3226493,14.546386 H 6.115267 v 0.462119 a 0.27191224,0.27191224 0 1 0 0.5438244,0 v -0.462119 h 1.0335293 v 0.462119 a 0.27191225,0.27191225 0 1 0 0.5438245,0 v -0.462119 h 0.7926176 a 0.2406489,0.2406489 0 0 1 0.2409116,0.240911 v 0.79183 H 8.8075922 a 0.27217496,0.27217496 0 0 0 -0.2719122,0.2727 z"
+ id="path20"
+ style="stroke-width:0.0262717" />
+ <path
+ class="cls-5"
+ d="m 14.002824,14.787297 v 3.706414 a 0.24117434,0.24117434 0 0 1 -0.240912,0.240911 H 10.054973 A 0.24091162,0.24091162 0 0 1 9.8140616,18.493711 v -0.792618 h 0.4621194 a 0.27217496,0.27217496 0 1 0 0,-0.544087 H 9.8140616 v -1.033267 h 0.4621194 a 0.27217496,0.27217496 0 1 0 0,-0.544087 H 9.8140616 v -0.792355 a 0.2406489,0.2406489 0 0 1 0.2409114,-0.240911 h 0.792355 v 0.462119 a 0.27217496,0.27217496 0 1 0 0.544087,0 v -0.462119 h 1.03353 v 0.462119 a 0.27191224,0.27191224 0 1 0 0.543824,0 v -0.462119 h 0.792618 a 0.24091162,0.24091162 0 0 1 0.241437,0.240911 z"
+ id="path22"
+ style="stroke-width:0.0262717" />
+ <rect
+ class="cls-2"
+ x="-2.0941913"
+ y="22.665482"
+ width="4.1882367"
+ height="4.1882367"
+ rx="0.24091162"
+ transform="rotate(-45)"
+ id="rect24"
+ style="stroke-width:0.0262717" />
+</svg>
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..cc8d7e54
--- /dev/null
+++ b/launcher/ui/dialogs/InstallLoaderDialog.cpp
@@ -0,0 +1,139 @@
+// 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))
+{
+ 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);
+
+ auto buttons = new QDialogButtonBox(this);
+ buttons->setOrientation(Qt::Horizontal);
+ buttons->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
+ connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
+ connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
+ buttonLayout->addWidget(buttons);
+
+ layout->addLayout(buttonLayout);
+
+ setWindowTitle(dialogTitle());
+ resize(650, 400);
+}
+
+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::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..7a32e427
--- /dev/null
+++ b/launcher/ui/dialogs/InstallLoaderDialog.h
@@ -0,0 +1,42 @@
+// 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 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 done(int result) override;
+
+ private:
+ std::shared_ptr<PackProfile> m_profile;
+ PageContainer* m_container;
+};
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
index 6d90480f..8d4e51b2 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
@@ -148,15 +148,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();
}
@@ -196,14 +198,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)
@@ -226,8 +222,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;
}
@@ -253,8 +247,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;
}
@@ -280,8 +272,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;
}
@@ -302,11 +292,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 5b5b48c6..b56a9adc 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
@@ -60,7 +60,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&);
@@ -85,7 +85,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 74b7ec7c..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();
}
@@ -287,7 +274,6 @@ void VersionPage::updateButtons(int row)
ui->actionAdd_Empty->setEnabled(controlsEnabled);
ui->actionImport_Components->setEnabled(controlsEnabled);
ui->actionReload->setEnabled(controlsEnabled);
- ui->actionInstall_mods->setEnabled(controlsEnabled);
ui->actionReplace_Minecraft_jar->setEnabled(controlsEnabled);
ui->actionAdd_to_Minecraft_jar->setEnabled(controlsEnabled);
ui->actionAdd_Agents->setEnabled(controlsEnabled);
@@ -446,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")
{
@@ -508,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()
@@ -609,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 4777eafe..cf7c659b 100644
--- a/launcher/ui/pages/instance/VersionPage.ui
+++ b/launcher/ui/pages/instance/VersionPage.ui
@@ -98,12 +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="actionInstall_mods"/>
- <addaction name="separator"/>
+ <addaction name="actionInstall_Loader"/>
<addaction name="actionAdd_to_Minecraft_jar"/>
<addaction name="actionReplace_Minecraft_jar"/>
<addaction name="actionAdd_Agents"/>
@@ -118,26 +113,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">
@@ -145,7 +140,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">
@@ -153,7 +148,7 @@
<string>Customize</string>
</property>
<property name="toolTip">
- <string>Customize selected package.</string>
+ <string>Customize selected component.</string>
</property>
</action>
<action name="actionEdit">
@@ -161,7 +156,7 @@
<string>Edit</string>
</property>
<property name="toolTip">
- <string>Edit selected package.</string>
+ <string>Edit selected component.</string>
</property>
</action>
<action name="actionRevert">
@@ -169,47 +164,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>
- </property>
- </action>
- <action name="actionInstall_LiteLoader">
- <property name="text">
- <string>Install LiteLoader</string>
- </property>
- <property name="toolTip">
- <string>Install the LiteLoader package.</string>
+ <string>Revert the selected component to default.</string>
</property>
</action>
- <action name="actionInstall_mods">
+ <action name="actionInstall_Loader">
<property name="text">
- <string>Install mods</string>
+ <string>Install Loader</string>
</property>
<property name="toolTip">
- <string>Install normal mods.</string>
+ <string>Install a mod loader.</string>
</property>
</action>
<action name="actionAdd_to_Minecraft_jar">
@@ -238,7 +201,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">
@@ -246,12 +209,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 34df42ec..43a52973 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;