NOISSUE refactor NetAction to be based on Task
Still missing some things, this is part 1.
This commit is contained in:
		@@ -116,7 +116,7 @@ void OneSixUpdate::next()
 | 
			
		||||
		disconnect(task.get(), &Task::succeeded, this, &OneSixUpdate::subtaskSucceeded);
 | 
			
		||||
		disconnect(task.get(), &Task::failed, this, &OneSixUpdate::subtaskFailed);
 | 
			
		||||
		disconnect(task.get(), &Task::progress, this, &OneSixUpdate::progress);
 | 
			
		||||
		disconnect(task.get(), &Task::status, this, &OneSixUpdate::setStatus);
 | 
			
		||||
		disconnect(task.get(), &Task::status, this, &OneSixUpdate::setStatusText);
 | 
			
		||||
	}
 | 
			
		||||
	if(m_currentTask == m_tasks.size())
 | 
			
		||||
	{
 | 
			
		||||
@@ -132,7 +132,7 @@ void OneSixUpdate::next()
 | 
			
		||||
	connect(task.get(), &Task::succeeded, this, &OneSixUpdate::subtaskSucceeded);
 | 
			
		||||
	connect(task.get(), &Task::failed, this, &OneSixUpdate::subtaskFailed);
 | 
			
		||||
	connect(task.get(), &Task::progress, this, &OneSixUpdate::progress);
 | 
			
		||||
	connect(task.get(), &Task::status, this, &OneSixUpdate::setStatus);
 | 
			
		||||
	connect(task.get(), &Task::status, this, &OneSixUpdate::setStatusText);
 | 
			
		||||
	// if the task is already running, do not start it again
 | 
			
		||||
	if(!task->isRunning())
 | 
			
		||||
	{
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ AssetUpdateTask::AssetUpdateTask(OneSixInstance * inst)
 | 
			
		||||
}
 | 
			
		||||
void AssetUpdateTask::executeTask()
 | 
			
		||||
{
 | 
			
		||||
	setStatus(tr("Updating assets index..."));
 | 
			
		||||
	setStatusText(tr("Updating assets index..."));
 | 
			
		||||
	auto profile = m_inst->getMinecraftProfile();
 | 
			
		||||
	auto assets = profile->getMinecraftAssets();
 | 
			
		||||
	QUrl indexUrl = assets->url;
 | 
			
		||||
@@ -63,7 +63,7 @@ void AssetUpdateTask::assetIndexFinished()
 | 
			
		||||
	auto job = index.getDownloadJob();
 | 
			
		||||
	if(job)
 | 
			
		||||
	{
 | 
			
		||||
		setStatus(tr("Getting the assets files from Mojang..."));
 | 
			
		||||
		setStatusText(tr("Getting the assets files from Mojang..."));
 | 
			
		||||
		downloadJob = job;
 | 
			
		||||
		connect(downloadJob.get(), &NetJob::succeeded, this, &AssetUpdateTask::emitSucceeded);
 | 
			
		||||
		connect(downloadJob.get(), &NetJob::failed, this, &AssetUpdateTask::assetsFailed);
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ void FMLLibrariesTask::executeTask()
 | 
			
		||||
	auto &libList = fmlLibsMapping[version];
 | 
			
		||||
 | 
			
		||||
	// determine if we need some libs for FML or forge
 | 
			
		||||
	setStatus(tr("Checking for FML libraries..."));
 | 
			
		||||
	setStatusText(tr("Checking for FML libraries..."));
 | 
			
		||||
	forge_present = (profile->versionPatch("net.minecraftforge") != nullptr);
 | 
			
		||||
	// we don't...
 | 
			
		||||
	if (!forge_present)
 | 
			
		||||
@@ -58,7 +58,7 @@ void FMLLibrariesTask::executeTask()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// download missing libs to our place
 | 
			
		||||
	setStatus(tr("Dowloading FML libraries..."));
 | 
			
		||||
	setStatusText(tr("Dowloading FML libraries..."));
 | 
			
		||||
	auto dljob = new NetJob("FML libraries");
 | 
			
		||||
	auto metacache = ENV.metacache();
 | 
			
		||||
	for (auto &lib : fmlLibsToProcess)
 | 
			
		||||
@@ -86,7 +86,7 @@ void FMLLibrariesTask::fmllibsFinished()
 | 
			
		||||
	downloadJob.reset();
 | 
			
		||||
	if (!fmlLibsToProcess.isEmpty())
 | 
			
		||||
	{
 | 
			
		||||
		setStatus(tr("Copying FML libraries into the instance..."));
 | 
			
		||||
		setStatusText(tr("Copying FML libraries into the instance..."));
 | 
			
		||||
		OneSixInstance *inst = (OneSixInstance *)m_inst;
 | 
			
		||||
		auto metacache = ENV.metacache();
 | 
			
		||||
		int index = 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ LibrariesTask::LibrariesTask(OneSixInstance * inst)
 | 
			
		||||
 | 
			
		||||
void LibrariesTask::executeTask()
 | 
			
		||||
{
 | 
			
		||||
	setStatus(tr("Getting the library files from Mojang..."));
 | 
			
		||||
	setStatusText(tr("Getting the library files from Mojang..."));
 | 
			
		||||
	qDebug() << m_inst->name() << ": downloading libraries";
 | 
			
		||||
	OneSixInstance *inst = (OneSixInstance *)m_inst;
 | 
			
		||||
	inst->reloadProfile();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user