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();
|
||||
|
Reference in New Issue
Block a user