aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-04-21 20:37:17 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-04-21 20:37:17 +0300
commit42bc91463e8dc7c078476c8606937552ce623c62 (patch)
tree847d7509aa4588c2c9b552caa4b3f7d69866642e
parentb4fa6e120a98fde89443b262f351412f36de7566 (diff)
downloadPrismLauncher-42bc91463e8dc7c078476c8606937552ce623c62.tar.gz
PrismLauncher-42bc91463e8dc7c078476c8606937552ce623c62.tar.bz2
PrismLauncher-42bc91463e8dc7c078476c8606937552ce623c62.zip
Updated links
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
-rw-r--r--launcher/ResourceDownloadTask.h3
-rw-r--r--launcher/modplatform/flame/FlameAPI.h2
-rw-r--r--launcher/modplatform/modrinth/ModrinthAPI.h2
-rw-r--r--launcher/ui/dialogs/ResourceDownloadDialog.cpp12
-rw-r--r--launcher/ui/dialogs/ReviewMessageBox.cpp12
-rw-r--r--launcher/ui/dialogs/ReviewMessageBox.h7
6 files changed, 26 insertions, 12 deletions
diff --git a/launcher/ResourceDownloadTask.h b/launcher/ResourceDownloadTask.h
index 29d3ae0a..a12c05b8 100644
--- a/launcher/ResourceDownloadTask.h
+++ b/launcher/ResourceDownloadTask.h
@@ -38,7 +38,8 @@ class ResourceDownloadTask : public SequentialTask {
const QString& getCustomPath() const { return m_pack_version.custom_target_folder; }
const QVariant& getVersionID() const { return m_pack_version.fileId; }
const ModPlatform::IndexedVersion& getVersion() const { return m_pack_version; }
- const ModPlatform::IndexedPack& getPack() const { return m_pack; }
+ ModPlatform::IndexedPack& getPack() { return m_pack; }
+ const ModPlatform::ResourceProvider& getProvider() const { return m_pack.provider; }
private:
ModPlatform::IndexedPack m_pack;
diff --git a/launcher/modplatform/flame/FlameAPI.h b/launcher/modplatform/flame/FlameAPI.h
index 3b4af952..4ffc36d2 100644
--- a/launcher/modplatform/flame/FlameAPI.h
+++ b/launcher/modplatform/flame/FlameAPI.h
@@ -87,7 +87,7 @@ class FlameAPI : public NetworkResourceAPI {
[[nodiscard]] std::optional<QString> getDependencyURL(DependencySearchArgs const& args) const override
{
- return QString("https://api.curseforge.com/v1/mods/%1/files?pageSize=10000&gameVersion=%2&modLoaderType=%")
+ return QString("https://api.curseforge.com/v1/mods/%1/files?pageSize=10000&gameVersion=%2&modLoaderType=%3")
.arg(args.dependency.addonId.toString())
.arg(args.mcVersion.toString())
.arg(getMappedModLoader(args.loader));
diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h
index 07c8cf2a..95722ccb 100644
--- a/launcher/modplatform/modrinth/ModrinthAPI.h
+++ b/launcher/modplatform/modrinth/ModrinthAPI.h
@@ -146,7 +146,7 @@ class ModrinthAPI : public NetworkResourceAPI {
[[nodiscard]] std::optional<QString> getDependencyURL(DependencySearchArgs const& args) const override
{
return args.dependency.version.length() != 0 ? QString("%1/version/%2").arg(BuildConfig.MODRINTH_PROD_URL, args.dependency.version)
- : QString("%1/project/%2/version?game_versions=[\"%1\"]&loaders=[\"%1\"]")
+ : QString("%1/project/%2/version?game_versions=[\"%3\"]&loaders=[\"%4\"]")
.arg(BuildConfig.MODRINTH_PROD_URL)
.arg(args.dependency.addonId.toString())
.arg(args.mcVersion.toString())
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
index 38c57361..c16dcca7 100644
--- a/launcher/ui/dialogs/ResourceDownloadDialog.cpp
+++ b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
@@ -124,6 +124,8 @@ void ResourceDownloadDialog::connectButtons()
connect(HelpButton, &QPushButton::clicked, m_container, &PageContainer::help);
}
+static ModPlatform::ProviderCapabilities ProviderCaps;
+
void ResourceDownloadDialog::confirm()
{
auto confirm_dialog = ReviewMessageBox::create(this, tr("Confirm %1 to download").arg(resourcesString()));
@@ -160,7 +162,8 @@ void ResourceDownloadDialog::confirm()
keys.sort(Qt::CaseInsensitive);
for (auto& task : keys) {
auto selected = m_selected.constFind(task).value();
- confirm_dialog->appendResource({ task, selected->getFilename(), selected->getCustomPath() });
+ confirm_dialog->appendResource(
+ { task, selected->getFilename(), selected->getCustomPath(), ProviderCaps.name(selected->getProvider()) });
}
if (confirm_dialog->exec()) {
@@ -206,9 +209,10 @@ void ResourceDownloadDialog::removeResource(ModPlatform::IndexedPack& pack, ModP
if (auto selected_task_it = m_selected.find(pack.name); selected_task_it != m_selected.end()) {
auto selected_task = *selected_task_it;
auto old_version_id = selected_task->getVersionID();
-
- // If the new and old version IDs don't match, search for the old one and deselect it.
- if (ver.fileId != old_version_id)
+ if (selected_task->getProvider() != pack.provider) // If the pack name matches but they are different providers search for the
+ // old one(in the actual pack) and deselect it.
+ getVersionWithID(selected_task->getPack(), old_version_id).is_currently_selected = false;
+ else if (ver.fileId != old_version_id) // If the new and old version IDs don't match, search for the old one and deselect it.
getVersionWithID(pack, old_version_id).is_currently_selected = false;
}
diff --git a/launcher/ui/dialogs/ReviewMessageBox.cpp b/launcher/ui/dialogs/ReviewMessageBox.cpp
index 7b2df278..86e68aae 100644
--- a/launcher/ui/dialogs/ReviewMessageBox.cpp
+++ b/launcher/ui/dialogs/ReviewMessageBox.cpp
@@ -40,7 +40,8 @@ void ReviewMessageBox::appendResource(ResourceInformation&& info)
auto filenameItem = new QTreeWidgetItem(itemTop);
filenameItem->setText(0, tr("Filename: %1").arg(info.filename));
- itemTop->insertChildren(0, { filenameItem });
+ auto childIndx = 0;
+ itemTop->insertChildren(childIndx++, { filenameItem });
if (!info.custom_file_path.isEmpty()) {
auto customPathItem = new QTreeWidgetItem(itemTop);
@@ -49,9 +50,16 @@ void ReviewMessageBox::appendResource(ResourceInformation&& info)
itemTop->insertChildren(1, { customPathItem });
itemTop->setIcon(1, QIcon(APPLICATION->getThemedIcon("status-yellow")));
- itemTop->setToolTip(1, tr("This file will be downloaded to a folder location different from the default, possibly due to its loader requiring it."));
+ itemTop->setToolTip(
+ childIndx++,
+ tr("This file will be downloaded to a folder location different from the default, possibly due to its loader requiring it."));
}
+ auto providerItem = new QTreeWidgetItem(itemTop);
+ providerItem->setText(0, tr("Provider: %1").arg(info.provider));
+
+ itemTop->insertChildren(childIndx++, { providerItem });
+
ui->modTreeWidget->addTopLevelItem(itemTop);
}
diff --git a/launcher/ui/dialogs/ReviewMessageBox.h b/launcher/ui/dialogs/ReviewMessageBox.h
index 5ec2bc23..9579da33 100644
--- a/launcher/ui/dialogs/ReviewMessageBox.h
+++ b/launcher/ui/dialogs/ReviewMessageBox.h
@@ -13,9 +13,10 @@ class ReviewMessageBox : public QDialog {
static auto create(QWidget* parent, QString&& title, QString&& icon = "") -> ReviewMessageBox*;
using ResourceInformation = struct res_info {
- QString name;
- QString filename;
- QString custom_file_path {};
+ QString name;
+ QString filename;
+ QString custom_file_path{};
+ QString provider;
};
void appendResource(ResourceInformation&& info);