diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2023-09-16 18:20:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-16 18:20:45 +0200 |
commit | bf6dc10f355f95095d8b21154189257980dda4a2 (patch) | |
tree | e6a78559d8f666f468165066f21eff6289a2cb04 /launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp | |
parent | 4cb424470be46926bc7583332e3f94133d1e7583 (diff) | |
parent | 94c1cd6bcfbc7a66286c18bf1d1c3854f49deb64 (diff) | |
download | PrismLauncher-bf6dc10f355f95095d8b21154189257980dda4a2.tar.gz PrismLauncher-bf6dc10f355f95095d8b21154189257980dda4a2.tar.bz2 PrismLauncher-bf6dc10f355f95095d8b21154189257980dda4a2.zip |
Merge pull request #1605 from TheKodeToad/flame-shaders
Diffstat (limited to 'launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp')
-rw-r--r-- | launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp b/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp index 1403e98f..23373ec9 100644 --- a/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp +++ b/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp @@ -173,6 +173,45 @@ void FlameTexturePackPage::openUrl(const QUrl& url) TexturePackResourcePage::openUrl(url); } +FlameShaderPackPage::FlameShaderPackPage(ShaderPackDownloadDialog* dialog, BaseInstance& instance) + : ShaderPackResourcePage(dialog, instance) +{ + m_model = new FlameShaderPackModel(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 constructor... + connect(m_ui->sortByBox, SIGNAL(currentIndexChanged(int)), this, SLOT(triggerSearch())); + connect(m_ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FlameShaderPackPage::onSelectionChanged); + connect(m_ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &FlameShaderPackPage::onVersionSelectionChanged); + connect(m_ui->resourceSelectionButton, &QPushButton::clicked, this, &FlameShaderPackPage::onResourceSelected); + + m_ui->packDescription->setMetaEntry(metaEntryBase()); +} + +bool FlameShaderPackPage::optedOut(ModPlatform::IndexedVersion& ver) const +{ + return isOptedOut(ver); +} + +void FlameShaderPackPage::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); + ShaderPackResourcePage::openUrl({ QUrl::fromPercentEncoding(query.toUtf8()) }); // double decoding is necessary + return; + } + } + + ShaderPackResourcePage::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... @@ -188,5 +227,9 @@ auto FlameTexturePackPage::shouldDisplay() const -> bool { return true; } +auto FlameShaderPackPage::shouldDisplay() const -> bool +{ + return true; +} } // namespace ResourceDownload |