summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
Diffstat (limited to 'logic')
-rw-r--r--logic/lists/ForgeVersionList.cpp43
-rw-r--r--logic/net/URLConstants.h2
2 files changed, 23 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();
});
diff --git a/logic/net/URLConstants.h b/logic/net/URLConstants.h
index dcd5c2b1..9579198d 100644
--- a/logic/net/URLConstants.h
+++ b/logic/net/URLConstants.h
@@ -29,4 +29,6 @@ const QString RESOURCE_BASE("resources.download.minecraft.net/");
const QString LIBRARY_BASE("libraries.minecraft.net/");
const QString SKINS_BASE("skins.minecraft.net/MinecraftSkins/");
const QString AUTH_BASE("authserver.mojang.com/");
+const QString FORGE_LEGACY_URL("http://files.minecraftforge.net/minecraftforge/json");
+const QString FORGE_GRADLE_URL("http://files.minecraftforge.net/maven/net/minecraftforge/forge/json");
}