diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-12-23 00:43:29 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-12-23 00:43:29 +0100 |
commit | f402001453c4053d1c8c56b63896796d63df0388 (patch) | |
tree | f3741ce4529736a5d1ae02d89896eb65e1f9f4dc /logic/lists | |
parent | 56aeaec7d6a70e220893425ac8a3c6ecfb081009 (diff) | |
download | MultiMC-f402001453c4053d1c8c56b63896796d63df0388.tar MultiMC-f402001453c4053d1c8c56b63896796d63df0388.tar.gz MultiMC-f402001453c4053d1c8c56b63896796d63df0388.tar.lz MultiMC-f402001453c4053d1c8c56b63896796d63df0388.tar.xz MultiMC-f402001453c4053d1c8c56b63896796d63df0388.zip |
Use the central URL list for forge URLs
Diffstat (limited to 'logic/lists')
-rw-r--r-- | logic/lists/ForgeVersionList.cpp | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/logic/lists/ForgeVersionList.cpp b/logic/lists/ForgeVersionList.cpp index b6e06e77..78cb0de0 100644 --- a/logic/lists/ForgeVersionList.cpp +++ b/logic/lists/ForgeVersionList.cpp @@ -15,6 +15,7 @@ #include "ForgeVersionList.h" #include <logic/net/NetJob.h> +#include <logic/net/URLConstants.h> #include "MultiMC.h" #include <QtNetwork> @@ -23,9 +24,6 @@ #include "logger/QsLog.h" -#define JSON_URL "http://files.minecraftforge.net/minecraftforge/json" -#define GRADLE_JSON_URL "http://files.minecraftforge.net/maven/net/minecraftforge/forge/json" - ForgeVersionList::ForgeVersionList(QObject *parent) : BaseVersionList(parent) { } @@ -170,8 +168,10 @@ void ForgeListLoadTask::executeTask() forgeListEntry->stale = true; gradleForgeListEntry->stale = true; - job->addNetAction(listDownload = CacheDownload::make(QUrl(JSON_URL), forgeListEntry)); - job->addNetAction(gradleListDownload = CacheDownload::make(QUrl(GRADLE_JSON_URL), gradleForgeListEntry)); + job->addNetAction(listDownload = CacheDownload::make(QUrl(URLConstants::FORGE_LEGACY_URL), + forgeListEntry)); + job->addNetAction(gradleListDownload = CacheDownload::make( + QUrl(URLConstants::FORGE_GRADLE_URL), gradleForgeListEntry)); connect(listDownload.get(), SIGNAL(failed(int)), SLOT(listFailed())); connect(gradleListDownload.get(), SIGNAL(failed(int)), SLOT(gradleListFailed())); @@ -355,33 +355,32 @@ bool ForgeListLoadTask::parseForgeGradleList(QList<BaseVersionPtr> &out) } if (file.at(1).toString() == "installer") { - fVersion->installer_url = - QString("%1/%2-%3/%4-%2-%3-installer.%5") - .arg(webpath, fVersion->mcver, fVersion->jobbuildver, artifact, file.at(0).toString()); - installer_filename = QString("%1-%2-%3-installer.%4") - .arg(artifact, fVersion->mcver, fVersion->jobbuildver, file.at(0).toString()); + fVersion->installer_url = QString("%1/%2-%3/%4-%2-%3-installer.%5").arg( + webpath, fVersion->mcver, fVersion->jobbuildver, artifact, + file.at(0).toString()); + installer_filename = QString("%1-%2-%3-installer.%4").arg( + artifact, fVersion->mcver, fVersion->jobbuildver, file.at(0).toString()); } else if (file.at(1).toString() == "universal") { - fVersion->universal_url = - QString("%1/%2-%3/%4-%2-%3-universal.%5") - .arg(webpath, fVersion->mcver, fVersion->jobbuildver, artifact, file.at(0).toString()); - filename = QString("%1-%2-%3-universal.%4") - .arg(artifact, fVersion->mcver, fVersion->jobbuildver, file.at(0).toString()); + fVersion->universal_url = QString("%1/%2-%3/%4-%2-%3-universal.%5").arg( + webpath, fVersion->mcver, fVersion->jobbuildver, artifact, + file.at(0).toString()); + filename = QString("%1-%2-%3-universal.%4").arg( + artifact, fVersion->mcver, fVersion->jobbuildver, file.at(0).toString()); } else if (file.at(1).toString() == "changelog") { - fVersion->changelog_url = - QString("%1/%2-%3/%4-%2-%3-changelog.%5") - .arg(webpath, fVersion->mcver, fVersion->jobbuildver, artifact, file.at(0).toString()); + fVersion->changelog_url = QString("%1/%2-%3/%4-%2-%3-changelog.%5").arg( + webpath, fVersion->mcver, fVersion->jobbuildver, artifact, + file.at(0).toString()); } } if (fVersion->installer_url.isEmpty() && fVersion->universal_url.isEmpty()) { continue; } - fVersion->filename = fVersion->installer_url.isEmpty() ? - filename : installer_filename; + fVersion->filename = fVersion->installer_url.isEmpty() ? filename : installer_filename; out.append(fVersion); } @@ -406,8 +405,8 @@ void ForgeListLoadTask::listDownloaded() return; } - qSort(list.begin(), list.end(), - [](const BaseVersionPtr &p1, const BaseVersionPtr &p2) { + qSort(list.begin(), list.end(), [](const BaseVersionPtr & p1, const BaseVersionPtr & p2) + { // TODO better comparison (takes major/minor/build number into account) return p1->name() > p2->name(); }); |