diff options
author | flow <flowlnlnln@gmail.com> | 2023-01-29 18:07:49 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2023-02-05 17:02:56 -0300 |
commit | ada5e88eb933a41691121316c78cd2e564965fa0 (patch) | |
tree | 05cbf24f0e42e2a673ac8fafcd04de434b9d1b0d /launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp | |
parent | b724607e31d102c50cb42225b4a31f2932b2eb61 (diff) | |
download | PrismLauncher-ada5e88eb933a41691121316c78cd2e564965fa0.tar.gz PrismLauncher-ada5e88eb933a41691121316c78cd2e564965fa0.tar.bz2 PrismLauncher-ada5e88eb933a41691121316c78cd2e564965fa0.zip |
feat(RD): add texture pack downloader
This extends the resource pack downloader, with the custom behavior of
filtering the versions that shows up, to those <= 1.6. As always, Flame
is funky and requires a bit more workarounds than average.
This will also get a nice improvement when the Version parsing and
comparison PR gets merged! :D
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp')
-rw-r--r-- | launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp b/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp index 15b04ab4..f93e27e6 100644 --- a/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp +++ b/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp @@ -133,10 +133,50 @@ void FlameResourcePackPage::openUrl(const QUrl& url) ResourcePackResourcePage::openUrl(url); } +FlameTexturePackPage::FlameTexturePackPage(TexturePackDownloadDialog* dialog, BaseInstance& instance) + : TexturePackResourcePage(dialog, instance) +{ + m_model = new FlameTexturePackModel(instance); + m_ui->packView->setModel(m_model); + + addSortings(); + + // sometimes Qt just ignores virtual slots and doesn't work as intended it seems, + // so it's best not to connect them in the parent's contructor... + connect(m_ui->sortByBox, SIGNAL(currentIndexChanged(int)), this, SLOT(triggerSearch())); + connect(m_ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FlameTexturePackPage::onSelectionChanged); + connect(m_ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &FlameTexturePackPage::onVersionSelectionChanged); + connect(m_ui->resourceSelectionButton, &QPushButton::clicked, this, &FlameTexturePackPage::onResourceSelected); + + m_ui->packDescription->setMetaEntry(metaEntryBase()); +} + +bool FlameTexturePackPage::optedOut(ModPlatform::IndexedVersion& ver) const +{ + return isOptedOut(ver); +} + +void FlameTexturePackPage::openUrl(const QUrl& url) +{ + if (url.scheme().isEmpty()) { + QString query = url.query(QUrl::FullyDecoded); + + if (query.startsWith("remoteUrl=")) { + // attempt to resolve url from warning page + query.remove(0, 10); + ResourcePackResourcePage::openUrl({QUrl::fromPercentEncoding(query.toUtf8())}); // double decoding is necessary + return; + } + } + + TexturePackResourcePage::openUrl(url); +} + // I don't know why, but doing this on the parent class makes it so that // other mod providers start loading before being selected, at least with // my Qt, so we need to implement this in every derived class... auto FlameModPage::shouldDisplay() const -> bool { return true; } auto FlameResourcePackPage::shouldDisplay() const -> bool { return true; } +auto FlameTexturePackPage::shouldDisplay() const -> bool { return true; } } // namespace ResourceDownload |