diff options
author | TheKodeToad <TheKodeToad@proton.me> | 2022-11-01 16:58:22 +0000 |
---|---|---|
committer | TheKodeToad <TheKodeToad@proton.me> | 2022-11-01 16:58:22 +0000 |
commit | 7f32c6464d84181fc8947f632da340a863dc53d6 (patch) | |
tree | b9e0fa98bcaef118e0ca871dfe65ba57e322a5db /launcher/ui/pages/modplatform/flame/FlameModPage.cpp | |
parent | 04b39294ba012721279ca9d009f99f75178fd57a (diff) | |
download | PrismLauncher-7f32c6464d84181fc8947f632da340a863dc53d6.tar.gz PrismLauncher-7f32c6464d84181fc8947f632da340a863dc53d6.tar.bz2 PrismLauncher-7f32c6464d84181fc8947f632da340a863dc53d6.zip |
Initial better mod browser link implementation
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Diffstat (limited to 'launcher/ui/pages/modplatform/flame/FlameModPage.cpp')
-rw-r--r-- | launcher/ui/pages/modplatform/flame/FlameModPage.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/launcher/ui/pages/modplatform/flame/FlameModPage.cpp b/launcher/ui/pages/modplatform/flame/FlameModPage.cpp index fd6e32ff..a4b7b5a1 100644 --- a/launcher/ui/pages/modplatform/flame/FlameModPage.cpp +++ b/launcher/ui/pages/modplatform/flame/FlameModPage.cpp @@ -39,7 +39,7 @@ #include "FlameModModel.h" #include "ui/dialogs/ModDownloadDialog.h" -FlameModPage::FlameModPage(ModDownloadDialog* dialog, BaseInstance* instance) +FlameModPage::FlameModPage(ModDownloadDialog* dialog, BaseInstance* instance) : ModPage(dialog, instance, new FlameAPI()) { listModel = new FlameMod::ListModel(this); @@ -53,7 +53,7 @@ FlameModPage::FlameModPage(ModDownloadDialog* dialog, BaseInstance* instance) ui->sortByBox->addItem(tr("Sort by Author")); ui->sortByBox->addItem(tr("Sort by Downloads")); - // sometimes Qt just ignores virtual slots and doesn't work as intended it seems, + // 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(ui->sortByBox, SIGNAL(currentIndexChanged(int)), this, SLOT(triggerSearch())); connect(ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FlameModPage::onSelectionChanged); @@ -78,3 +78,18 @@ bool FlameModPage::optedOut(ModPlatform::IndexedVersion& ver) const // 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; } + +void FlameModPage::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); + ModPage::openUrl({QUrl::fromPercentEncoding(query.toUtf8())}); // double decoding is necessary + return; + } + } + + ModPage::openUrl(url); +}
\ No newline at end of file |