NOISSUE continue refactoring things to make tests pass
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
#include "Env.h"
|
||||
#include "AssetUpdateTask.h"
|
||||
|
||||
#include "minecraft/MinecraftInstance.h"
|
||||
#include "minecraft/PackProfile.h"
|
||||
#include "net/ChecksumValidator.h"
|
||||
#include "minecraft/AssetsUtils.h"
|
||||
|
||||
#include "Application.h"
|
||||
|
||||
AssetUpdateTask::AssetUpdateTask(MinecraftInstance * inst)
|
||||
{
|
||||
m_inst = inst;
|
||||
@ -24,7 +26,7 @@ void AssetUpdateTask::executeTask()
|
||||
QString localPath = assets->id + ".json";
|
||||
auto job = new NetJob(tr("Asset index for %1").arg(m_inst->name()));
|
||||
|
||||
auto metacache = ENV->metacache();
|
||||
auto metacache = APPLICATION->metacache();
|
||||
auto entry = metacache->resolveEntry("asset_indexes", localPath);
|
||||
entry->setStale(true);
|
||||
auto hexSha1 = assets->sha1.toLatin1();
|
||||
@ -41,7 +43,7 @@ void AssetUpdateTask::executeTask()
|
||||
connect(downloadJob.get(), &NetJob::progress, this, &AssetUpdateTask::progress);
|
||||
|
||||
qDebug() << m_inst->name() << ": Starting asset index download";
|
||||
downloadJob->start();
|
||||
downloadJob->start(APPLICATION->network());
|
||||
}
|
||||
|
||||
bool AssetUpdateTask::canAbort() const
|
||||
@ -62,7 +64,7 @@ void AssetUpdateTask::assetIndexFinished()
|
||||
// FIXME: this looks like a job for a generic validator based on json schema?
|
||||
if (!AssetsUtils::loadAssetsIndexJson(assets->id, asset_fname, index))
|
||||
{
|
||||
auto metacache = ENV->metacache();
|
||||
auto metacache = APPLICATION->metacache();
|
||||
auto entry = metacache->resolveEntry("asset_indexes", assets->id + ".json");
|
||||
metacache->evictEntry(entry);
|
||||
emitFailed(tr("Failed to read the assets index!"));
|
||||
@ -76,7 +78,7 @@ void AssetUpdateTask::assetIndexFinished()
|
||||
connect(downloadJob.get(), &NetJob::succeeded, this, &AssetUpdateTask::emitSucceeded);
|
||||
connect(downloadJob.get(), &NetJob::failed, this, &AssetUpdateTask::assetsFailed);
|
||||
connect(downloadJob.get(), &NetJob::progress, this, &AssetUpdateTask::progress);
|
||||
downloadJob->start();
|
||||
downloadJob->start(APPLICATION->network());
|
||||
return;
|
||||
}
|
||||
emitSucceeded();
|
||||
|
@ -24,5 +24,5 @@ public slots:
|
||||
|
||||
private:
|
||||
MinecraftInstance *m_inst;
|
||||
NetJobPtr downloadJob;
|
||||
NetJob::Ptr downloadJob;
|
||||
};
|
||||
|
@ -1,10 +1,12 @@
|
||||
#include "Env.h"
|
||||
#include <FileSystem.h>
|
||||
#include <minecraft/VersionFilterData.h>
|
||||
#include "FMLLibrariesTask.h"
|
||||
|
||||
#include "FileSystem.h"
|
||||
#include "minecraft/VersionFilterData.h"
|
||||
#include "minecraft/MinecraftInstance.h"
|
||||
#include "minecraft/PackProfile.h"
|
||||
|
||||
#include "BuildConfig.h"
|
||||
#include "Application.h"
|
||||
|
||||
FMLLibrariesTask::FMLLibrariesTask(MinecraftInstance * inst)
|
||||
{
|
||||
@ -60,7 +62,7 @@ void FMLLibrariesTask::executeTask()
|
||||
// download missing libs to our place
|
||||
setStatus(tr("Downloading FML libraries..."));
|
||||
auto dljob = new NetJob("FML libraries");
|
||||
auto metacache = ENV->metacache();
|
||||
auto metacache = APPLICATION->metacache();
|
||||
for (auto &lib : fmlLibsToProcess)
|
||||
{
|
||||
auto entry = metacache->resolveEntry("fmllibs", lib.filename);
|
||||
@ -72,7 +74,7 @@ void FMLLibrariesTask::executeTask()
|
||||
connect(dljob, &NetJob::failed, this, &FMLLibrariesTask::fmllibsFailed);
|
||||
connect(dljob, &NetJob::progress, this, &FMLLibrariesTask::progress);
|
||||
downloadJob.reset(dljob);
|
||||
downloadJob->start();
|
||||
downloadJob->start(APPLICATION->network());
|
||||
}
|
||||
|
||||
bool FMLLibrariesTask::canAbort() const
|
||||
@ -87,7 +89,7 @@ void FMLLibrariesTask::fmllibsFinished()
|
||||
{
|
||||
setStatus(tr("Copying FML libraries into the instance..."));
|
||||
MinecraftInstance *inst = (MinecraftInstance *)m_inst;
|
||||
auto metacache = ENV->metacache();
|
||||
auto metacache = APPLICATION->metacache();
|
||||
int index = 0;
|
||||
for (auto &lib : fmlLibsToProcess)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ public slots:
|
||||
|
||||
private:
|
||||
MinecraftInstance *m_inst;
|
||||
NetJobPtr downloadJob;
|
||||
NetJob::Ptr downloadJob;
|
||||
QList<FMLlib> fmlLibsToProcess;
|
||||
};
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
#include "Env.h"
|
||||
#include "LibrariesTask.h"
|
||||
|
||||
#include "minecraft/MinecraftInstance.h"
|
||||
#include "minecraft/PackProfile.h"
|
||||
|
||||
#include "Application.h"
|
||||
|
||||
LibrariesTask::LibrariesTask(MinecraftInstance * inst)
|
||||
{
|
||||
m_inst = inst;
|
||||
@ -21,7 +23,7 @@ void LibrariesTask::executeTask()
|
||||
auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name()));
|
||||
downloadJob.reset(job);
|
||||
|
||||
auto metacache = ENV->metacache();
|
||||
auto metacache = APPLICATION->metacache();
|
||||
|
||||
auto processArtifactPool = [&](const QList<LibraryPtr> & pool, QStringList & errors, const QString & localPath)
|
||||
{
|
||||
@ -63,7 +65,7 @@ void LibrariesTask::executeTask()
|
||||
connect(downloadJob.get(), &NetJob::succeeded, this, &LibrariesTask::emitSucceeded);
|
||||
connect(downloadJob.get(), &NetJob::failed, this, &LibrariesTask::jarlibFailed);
|
||||
connect(downloadJob.get(), &NetJob::progress, this, &LibrariesTask::progress);
|
||||
downloadJob->start();
|
||||
downloadJob->start(APPLICATION->network());
|
||||
}
|
||||
|
||||
bool LibrariesTask::canAbort() const
|
||||
|
@ -22,5 +22,5 @@ public slots:
|
||||
|
||||
private:
|
||||
MinecraftInstance *m_inst;
|
||||
NetJobPtr downloadJob;
|
||||
NetJob::Ptr downloadJob;
|
||||
};
|
||||
|
Reference in New Issue
Block a user