Updated links

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-04-21 20:37:17 +03:00
parent b4fa6e120a
commit 42bc91463e
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
6 changed files with 26 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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