Basic, unfinished & broken impl

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2023-06-19 22:42:27 +01:00
parent fd9a8d1551
commit 6ccc7e77f9
18 changed files with 287 additions and 217 deletions

View File

@ -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

View File

@ -347,5 +347,9 @@
<file>scalable/export.svg</file>
<file>scalable/launch.svg</file>
<file>scalable/server.svg</file>
<file>scalable/fabric-loader.svg</file>
<file>scalable/quilt-loader.svg</file>
<file>scalable/forge-loader.svg</file>
</qresource>
</RCC>

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="32" height="32"><image xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAT5JREFU WIXtliFLBEEYhh/FYBAtq5j08oLtwnVB/AFWDWIyXrhyYhCDXNhfYLPeDxDBbrAJ1++S6BbLGdcg L8eMN6yzrsws3NtmP+Zj3uf9mB1YqCZ12mnRaaeF777l/ziMj5b+2kCu724HAByf9QB4eh79qndw Ait1NXrPPwCDRAHlJIITqDwDruyvL7sA7O5sG99dJJpHQM6zmz4Am8mGUfcl0RwCduaSpr+MxMVV ZtRFIn4CLue2REKaTj+BmfPDg30A7h8egYgIOG9C38y1Hk9e5/aznUvxEZDzXvd87gY5tTO3iSj7 6P8FzhnI8zcAXkbf6720ZdTtzMcTc+ob8x5wnlKzcHpyBECSbAE/SYiAr3MpXgKSi8T62ipQ3bkU nEDpm3DmbGiQGGTDWg4QnEDlF5FUNXspOIGFvgDGZobq+WvV0wAAAABJRU5ErkJggg==" width="32" height="32" x="164.072" y="372.466" preserveAspectRatio="none" style="image-rendering:pixelated"/><image xlink:href="data:image/png;base64,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" width="32" height="32" preserveAspectRatio="none" style="image-rendering:pixelated"/></svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="32" height="32" viewBox="164.072 372.466 32 32"><path fill="#1e2d41" d="m192.211 382.794-12.908-.631 15.769-.012v-1.271h-17.78v4.775c0 .04-.52-3.12-.639-4.003h-1.398v4.445c0 .042-.598-3.714-.661-4.184h-9.522c.649.562 4.23 3.615 6.776 4.871 1.276.63 2.842.635 4.235.674.708.02 1.45.074 1.98.598.769.763.94 1.946.277 2.841-.656.885-2.502 1.077-2.502 1.077l-1.538 1.887v2.191h3.497l.108-2.165 3.024-2.144c-.323.258-1.043.95-2.125 2.615a5.974 5.974 0 0 0-.584 1.19c.764-.647 2.333-1.09 4.146-1.09 1.81 0 3.378.442 4.143 1.088a5.963 5.963 0 0 0-.583-1.188c-1.082-1.666-1.802-2.357-2.125-2.615l3.024 2.144.109 2.165h3.262v-2.19l-1.537-1.888s-2.277-.145-2.873-1.076c-1.717-2.684.721-6.85 6.425-8.104z" style="stroke-width:.341115"/></svg>

After

Width:  |  Height:  |  Size: 799 B

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="32"
height="32"
version="1.1"
id="svg610"
sodipodi:docname="quilt-loader.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="defs614" />
<sodipodi:namedview
id="namedview612"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="9.27"
inkscape:cx="5.1240561"
inkscape:cy="18.662352"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="svg610" />
<path
d="m 9.6700715,5.9303528 c 0,0.2594651 0.2143021,0.4737672 0.4737675,0.4737672 h 0.805847 V 8.2026643 H 10.143839 A 0.4719961,0.4719961 0 0 0 9.6833547,8.6764315 c 0,0.2568083 0.2036756,0.4675683 0.4604843,0.4711105 h 0.805847 v 1.383223 c 0,0.232013 -0.186851,0.418863 -0.418864,0.418863 H 9.1511414 V 10.143781 A 0.4719961,0.4719961 0 0 0 8.6764887,9.6700142 0.4719961,0.4719961 0 0 0 8.2027215,10.143781 v 0.805847 H 6.4050628 v -0.805847 a 0.47465274,0.47465274 0 1 0 -0.9484199,0 v 0.805847 H 4.0760764 A 0.42063442,0.42063442 0 0 1 3.6545565,10.530765 V 4.0760192 c 0,-0.2320131 0.1895068,-0.42152 0.4215199,-0.42152 h 6.4556316 c 0.230242,0 0.417978,0.1895069 0.417978,0.42152 v 1.381452 H 10.143839 A 0.4719961,0.4719961 0 0 0 9.6700715,5.9312384 Z m 0,0"
style="fill:#9722ff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.885546"
id="path592" />
<path
d="m 17.912735,5.9303528 c 0,0.2594651 0.21076,0.4737672 0.473767,0.4737672 h 0.805847 v 1.7985443 h -0.805847 a 0.47288164,0.47288164 0 0 0 0,0.9448777 h 0.805847 v 1.383223 c 0,0.232013 -0.185964,0.418863 -0.417978,0.418863 H 12.316083 A 0.41797778,0.41797778 0 0 1 11.89722,10.530765 V 9.147542 h 0.805847 a 0.46579728,0.46579728 0 0 0 0.418863,-0.2320131 0.47819492,0.47819492 0 0 0 0,-0.4808515 0.46579728,0.46579728 0 0 0 -0.418863,-0.2320131 H 11.89722 V 6.4050056 h 0.805847 A 0.47553828,0.47553828 0 0 0 13.12193,5.6877132 0.46579728,0.46579728 0 0 0 12.703067,5.4565857 H 11.89722 V 4.0760192 a 0.42151997,0.42151997 0 0 1 0.418863,-0.4224055 h 6.454746 c 0.232013,0 0.418864,0.1903924 0.418864,0.4224055 v 1.381452 h -0.805847 a 0.4719961,0.4719961 0 0 0 -0.471111,0.4737672 z m 0,0"
style="fill:#dc29dd;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.885546"
id="path594" />
<path
d="m 27.432356,4.0760192 v 6.4556318 c 0,0.230242 -0.185965,0.417977 -0.418863,0.417977 H 25.633812 V 10.143781 A 0.48173711,0.48173711 0 0 0 25.398257,9.7213759 0.47111055,0.47111055 0 0 0 24.685392,10.143781 v 0.805847 h -1.797659 v -0.805847 a 0.48173711,0.48173711 0 0 0 -0.235555,-0.4224051 0.47819492,0.47819492 0 0 0 -0.480852,0 0.47819492,0.47819492 0 0 0 -0.232013,0.4224051 v 0.805847 h -1.380566 a 0.42329106,0.42329106 0 0 1 -0.42152,-0.418863 V 9.1510842 h 0.809389 A 0.47553828,0.47553828 0 0 0 21.365479,8.4346774 0.47288164,0.47288164 0 0 0 20.946616,8.2026643 H 20.137227 V 6.4050056 h 0.809389 a 0.47420996,0.47420996 0 0 0 0,-0.9484199 H 20.137227 V 4.0760192 c 0,-0.2320131 0.190392,-0.42152 0.42152,-0.42152 h 6.455631 c 0.231128,0 0.417978,0.1895069 0.417978,0.42152 z m 0,0"
style="fill:#27a2fd;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.885546"
id="path596" />
<path
d="m 10.949686,12.316026 v 6.454746 c 0,0.232013 -0.186851,0.418863 -0.418864,0.418863 H 9.1511414 v -0.805847 a 0.47465274,0.47465274 0 0 0 -0.9475344,0 v 0.805847 H 6.4032917 V 18.383788 A 0.47553828,0.47553828 0 0 0 5.6868849,17.964925 0.47288164,0.47288164 0 0 0 5.4557573,18.382903 V 19.18875 H 4.0760764 A 0.42063442,0.42063442 0 0 1 3.6545565,18.770772 v -6.455631 c 0,-0.230242 0.1895068,-0.417978 0.4215199,-0.417978 h 1.381452 v 0.805847 a 0.4737672,0.4737672 0 0 0 0.9475344,0 v -0.805847 h 1.7976587 v 0.805847 a 0.47243887,0.47243887 0 1 0 0.9448777,0 v -0.805847 h 1.3832228 a 0.41886333,0.41886333 0 0 1 0.418864,0.418863 z m 0,0"
style="fill:#dc29dd;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.885546"
id="path598" />
<path
d="m 17.912735,14.17036 a 0.47376719,0.47376719 0 0 0 0.473767,0.473767 h 0.805847 v 1.798544 h -0.805847 a 0.47465274,0.47465274 0 0 0 0,0.947535 h 0.805847 v 1.380566 c 0,0.232013 -0.185964,0.418863 -0.417978,0.418863 h -1.384108 v -0.805847 a 0.48173711,0.48173711 0 0 0 -0.23467,-0.422405 0.47819492,0.47819492 0 0 0 -0.480851,0 0.48527929,0.48527929 0 0 0 -0.232014,0.42152 v 0.805847 h -1.798544 v -0.805847 a 0.4719961,0.4719961 0 0 0 -0.473767,-0.473767 0.4719961,0.4719961 0 0 0 -0.474653,0.473767 V 19.18875 H 12.316083 A 0.43391761,0.43391761 0 0 1 12.01854,19.068316 0.43391761,0.43391761 0 0 1 11.89722,18.770772 v -6.455631 c 0,-0.230242 0.18685,-0.417978 0.418863,-0.417978 h 6.454746 c 0.232013,0 0.418864,0.18685 0.418864,0.418863 v 1.379681 h -0.805847 a 0.47376719,0.47376719 0 0 0 -0.471111,0.474653 z m 0,0"
style="fill:#27a2fd;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.885546"
id="path600" />
<path
d="m 27.432356,12.316026 v 6.454746 c 0,0.232013 -0.185965,0.418863 -0.418863,0.418863 h -6.454746 a 0.42063442,0.42063442 0 0 1 -0.42152,-0.418863 v -1.380566 h 0.805847 a 0.47730938,0.47730938 0 0 0 0.422405,-0.715522 0.48173711,0.48173711 0 0 0 -0.422405,-0.232013 h -0.805847 v -1.798544 h 0.805847 a 0.47730938,0.47730938 0 0 0 0.422405,-0.235555 0.4719961,0.4719961 0 0 0 0,-0.47731 0.47730938,0.47730938 0 0 0 -0.422405,-0.235555 h -0.805847 v -1.379681 c 0,-0.232013 0.190392,-0.418863 0.42152,-0.418863 h 1.380566 v 0.805847 a 0.46933946,0.46933946 0 0 0 0.470225,0.460484 c 0.259465,0 0.467569,-0.203676 0.473768,-0.460484 v -0.805847 h 1.799429 v 0.805847 a 0.4737675,0.4737675 0 0 0 0.947535,0 v -0.805847 h 1.380566 a 0.41886333,0.41886333 0 0 1 0.42152,0.418863 z m 0,0"
style="fill:#3344ff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.885546"
id="path602" />
<path
d="m 9.6700715,22.413023 c 0,0.259465 0.2143021,0.470225 0.4737675,0.470225 h 0.805847 v 1.802972 h -0.805847 a 0.47376719,0.47376719 0 0 0 -0.4737675,0.46934 c 0,0.263893 0.2143021,0.474653 0.4737675,0.474653 h 0.805847 v 1.380566 c 0,0.231128 -0.186851,0.42152 -0.418864,0.42152 H 4.0760764 A 0.42329106,0.42329106 0 0 1 3.6545565,27.010779 V 20.55869 c 0,-0.231128 0.1895068,-0.42152 0.4215199,-0.42152 h 1.381452 v 0.805847 a 0.46225509,0.46225509 0 0 0 0.2311276,0.418863 0.46225509,0.46225509 0 0 0 0.4808515,0 0.4719961,0.4719961 0 0 0 0.2355553,-0.418863 V 20.13717 h 1.7976587 v 0.805847 a 0.47243887,0.47243887 0 1 0 0.9448777,0 V 20.13717 h 1.3832228 c 0.232013,0 0.418864,0.190392 0.418864,0.42152 v 1.377024 h -0.805847 a 0.47819492,0.47819492 0 0 0 -0.4737675,0.478195 z m 0,0"
style="fill:#9722ff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.885546"
id="path604" />
<path
d="m 19.189693,20.55869 v 6.455631 c 0,0.231128 -0.186851,0.417978 -0.418864,0.417978 H 12.315198 A 0.41797778,0.41797778 0 0 1 11.89722,27.013436 v -1.379681 h 0.805847 a 0.4737675,0.4737675 0 0 0 0,-0.947535 H 11.89722 v -1.799429 h 0.805847 A 0.47553828,0.47553828 0 0 0 13.12193,22.171269 0.46579728,0.46579728 0 0 0 12.703067,21.939256 H 11.89722 V 20.55869 a 0.42151997,0.42151997 0 0 1 0.418863,-0.422406 h 1.379681 v 0.806733 c 0,0.263007 0.211646,0.473767 0.474653,0.473767 a 0.4719961,0.4719961 0 0 0 0.473767,-0.473767 V 20.13717 h 1.798544 v 0.805847 a 0.47553828,0.47553828 0 0 0 0.232014,0.418863 0.46225509,0.46225509 0 0 0 0.480851,0 0.4719961,0.4719961 0 0 0 0.23467,-0.418863 V 20.13717 h 1.380566 a 0.42151997,0.42151997 0 0 1 0.418864,0.42152 z m 0,0"
style="fill:#3344ff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.885546"
id="path606" />
<path
d="m 20.43477,24.997047 4.562334,-4.562334 a 0.42417661,0.42417661 0 0 1 0.595087,0 l 4.562334,4.562334 a 0.41797778,0.41797778 0 0 1 0,0.595087 l -4.562334,4.562334 a 0.41797778,0.41797778 0 0 1 -0.595087,0 L 20.43477,25.592134 a 0.42417661,0.42417661 0 0 1 0,-0.595087 z m 0,0"
style="fill:#9722ff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.885546"
id="path608" />
</svg>

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -263,6 +263,11 @@ bool InstanceWindow::selectPage(QString pageId)
return m_container->selectPage(pageId);
}
BasePage* InstanceWindow::selectedPage()
{
return m_container->selectedPage();
}
void InstanceWindow::refreshContainer()
{
m_container->refreshContainer();

View File

@ -56,6 +56,7 @@ public:
virtual ~InstanceWindow();
bool selectPage(QString pageId) override;
BasePage* selectedPage() override;
void refreshContainer() override;
QString instanceId();

View File

@ -0,0 +1,121 @@
#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(std::move(id)), m_icon(std::move(icon)), m_name(std::move(name))
{
const QString minecraftVersion = profile->getComponentVersion("net.minecraft");
setEmptyErrorString(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 { // Fabric
new LoaderPage("net.fabricmc.fabric-loader", "fabric-loader", tr("Fabric"), true, m_profile, this),
// Quilt
new LoaderPage("org.quiltmc.quilt-loader", "quilt-loader", tr("Quilt"), true, m_profile, this),
// Forge
new LoaderPage("net.minecraftforge", "forge-loader", tr("Forge"), false, 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);
}

View File

@ -0,0 +1,42 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 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;
};

View File

@ -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;
}

View File

@ -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;

View File

@ -7,6 +7,7 @@ class BasePageContainer
public:
virtual ~BasePageContainer(){};
virtual bool selectPage(QString pageId) = 0;
virtual BasePage* selectedPage() = 0;
virtual BasePage* getPage(QString pageId) { return nullptr; };
virtual void refreshContainer() = 0;
virtual bool requestClose() = 0;

View File

@ -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);

View File

@ -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();

View File

@ -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>
<string>Revert the selected component to default.</string>
</property>
</action>
<action name="actionInstall_Forge">
<action name="actionInstall_Loader">
<property name="text">
<string>Install Forge</string>
<string>Install Loader</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>
</property>
</action>
<action name="actionInstall_mods">
<property name="text">
<string>Install mods</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>

View File

@ -389,7 +389,7 @@ void ResourcePage::openUrl(const QUrl& url)
if (slug != getCurrentPack()->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;

View File

@ -137,6 +137,11 @@ BasePage* PageContainer::getPage(QString pageId)
return m_model->findPageEntryById(pageId);
}
BasePage* PageContainer::selectedPage()
{
return m_currentPage;
}
const QList<BasePage*> PageContainer::getPages() const
{
return m_model->pages();

View File

@ -78,7 +78,8 @@ public:
return false;
}
virtual bool selectPage(QString pageId) override;
bool selectPage(QString pageId) override;
BasePage* selectedPage() override;
BasePage* getPage(QString pageId) override;
const QList<BasePage*> getPages() const;