Merge pull request #3105 from Trial97/backport_3019
[Backport release-9.x] fixed double deletion for tasks
This commit is contained in:
commit
d453240a94
@ -1853,7 +1853,7 @@ bool Application::handleDataMigration(const QString& currentData,
|
|||||||
matcher->add(std::make_shared<SimplePrefixMatcher>("themes/"));
|
matcher->add(std::make_shared<SimplePrefixMatcher>("themes/"));
|
||||||
|
|
||||||
ProgressDialog diag;
|
ProgressDialog diag;
|
||||||
DataMigrationTask task(nullptr, oldData, currentData, matcher);
|
DataMigrationTask task(oldData, currentData, matcher);
|
||||||
if (diag.execWithTask(&task)) {
|
if (diag.execWithTask(&task)) {
|
||||||
qDebug() << "<> Migration succeeded";
|
qDebug() << "<> Migration succeeded";
|
||||||
setDoNotMigrate();
|
setDoNotMigrate();
|
||||||
|
@ -12,11 +12,8 @@
|
|||||||
|
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
|
|
||||||
DataMigrationTask::DataMigrationTask(QObject* parent,
|
DataMigrationTask::DataMigrationTask(const QString& sourcePath, const QString& targetPath, const IPathMatcher::Ptr pathMatcher)
|
||||||
const QString& sourcePath,
|
: Task(), m_sourcePath(sourcePath), m_targetPath(targetPath), m_pathMatcher(pathMatcher), m_copy(sourcePath, targetPath)
|
||||||
const QString& targetPath,
|
|
||||||
const IPathMatcher::Ptr pathMatcher)
|
|
||||||
: Task(parent), m_sourcePath(sourcePath), m_targetPath(targetPath), m_pathMatcher(pathMatcher), m_copy(sourcePath, targetPath)
|
|
||||||
{
|
{
|
||||||
m_copy.matcher(m_pathMatcher.get()).whitelist(true);
|
m_copy.matcher(m_pathMatcher.get()).whitelist(true);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
class DataMigrationTask : public Task {
|
class DataMigrationTask : public Task {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DataMigrationTask(QObject* parent, const QString& sourcePath, const QString& targetPath, IPathMatcher::Ptr pathmatcher);
|
explicit DataMigrationTask(const QString& sourcePath, const QString& targetPath, IPathMatcher::Ptr pathmatcher);
|
||||||
~DataMigrationTask() override = default;
|
~DataMigrationTask() override = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -116,7 +116,7 @@ void JavaCommon::TestCheck::run()
|
|||||||
emit finished();
|
emit finished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
checker.reset(new JavaChecker(m_path, "", 0, 0, 0, 0, this));
|
checker.reset(new JavaChecker(m_path, "", 0, 0, 0, 0));
|
||||||
connect(checker.get(), &JavaChecker::checkFinished, this, &JavaCommon::TestCheck::checkFinished);
|
connect(checker.get(), &JavaChecker::checkFinished, this, &JavaCommon::TestCheck::checkFinished);
|
||||||
checker->start();
|
checker->start();
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ void JavaCommon::TestCheck::checkFinished(const JavaChecker::Result& result)
|
|||||||
emit finished();
|
emit finished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
checker.reset(new JavaChecker(m_path, m_args, m_maxMem, m_maxMem, result.javaVersion.requiresPermGen() ? m_permGen : 0, 0, this));
|
checker.reset(new JavaChecker(m_path, m_args, m_maxMem, m_maxMem, result.javaVersion.requiresPermGen() ? m_permGen : 0, 0));
|
||||||
connect(checker.get(), &JavaChecker::checkFinished, this, &JavaCommon::TestCheck::checkFinishedWithArgs);
|
connect(checker.get(), &JavaChecker::checkFinished, this, &JavaCommon::TestCheck::checkFinishedWithArgs);
|
||||||
checker->start();
|
checker->start();
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
#include "launch/steps/TextPrint.h"
|
#include "launch/steps/TextPrint.h"
|
||||||
#include "tasks/Task.h"
|
#include "tasks/Task.h"
|
||||||
|
|
||||||
LaunchController::LaunchController(QObject* parent) : Task(parent) {}
|
LaunchController::LaunchController() : Task() {}
|
||||||
|
|
||||||
void LaunchController::executeTask()
|
void LaunchController::executeTask()
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ class LaunchController : public Task {
|
|||||||
public:
|
public:
|
||||||
void executeTask() override;
|
void executeTask() override;
|
||||||
|
|
||||||
LaunchController(QObject* parent = nullptr);
|
LaunchController();
|
||||||
virtual ~LaunchController() = default;
|
virtual ~LaunchController() = default;
|
||||||
|
|
||||||
void setInstance(InstancePtr instance) { m_instance = instance; }
|
void setInstance(InstancePtr instance) { m_instance = instance; }
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
#include "java/JavaUtils.h"
|
#include "java/JavaUtils.h"
|
||||||
|
|
||||||
JavaChecker::JavaChecker(QString path, QString args, int minMem, int maxMem, int permGen, int id, QObject* parent)
|
JavaChecker::JavaChecker(QString path, QString args, int minMem, int maxMem, int permGen, int id)
|
||||||
: Task(parent), m_path(path), m_args(args), m_minMem(minMem), m_maxMem(maxMem), m_permGen(permGen), m_id(id)
|
: Task(), m_path(path), m_args(args), m_minMem(minMem), m_maxMem(maxMem), m_permGen(permGen), m_id(id)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void JavaChecker::executeTask()
|
void JavaChecker::executeTask()
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "JavaVersion.h"
|
#include "JavaVersion.h"
|
||||||
#include "QObjectPtr.h"
|
#include "QObjectPtr.h"
|
||||||
@ -26,7 +25,7 @@ class JavaChecker : public Task {
|
|||||||
enum class Validity { Errored, ReturnedInvalidData, Valid } validity = Validity::Errored;
|
enum class Validity { Errored, ReturnedInvalidData, Valid } validity = Validity::Errored;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit JavaChecker(QString path, QString args, int minMem = 0, int maxMem = 0, int permGen = 0, int id = 0, QObject* parent = 0);
|
explicit JavaChecker(QString path, QString args, int minMem = 0, int maxMem = 0, int permGen = 0, int id = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void checkFinished(const Result& result);
|
void checkFinished(const Result& result);
|
||||||
|
@ -163,7 +163,7 @@ void JavaListLoadTask::executeTask()
|
|||||||
JavaUtils ju;
|
JavaUtils ju;
|
||||||
QList<QString> candidate_paths = m_only_managed_versions ? getPrismJavaBundle() : ju.FindJavaPaths();
|
QList<QString> candidate_paths = m_only_managed_versions ? getPrismJavaBundle() : ju.FindJavaPaths();
|
||||||
|
|
||||||
ConcurrentTask::Ptr job(new ConcurrentTask(this, "Java detection", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
ConcurrentTask::Ptr job(new ConcurrentTask("Java detection", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
||||||
m_job.reset(job);
|
m_job.reset(job);
|
||||||
connect(m_job.get(), &Task::finished, this, &JavaListLoadTask::javaCheckerFinished);
|
connect(m_job.get(), &Task::finished, this, &JavaListLoadTask::javaCheckerFinished);
|
||||||
connect(m_job.get(), &Task::progress, this, &Task::setProgress);
|
connect(m_job.get(), &Task::progress, this, &Task::setProgress);
|
||||||
@ -171,7 +171,7 @@ void JavaListLoadTask::executeTask()
|
|||||||
qDebug() << "Probing the following Java paths: ";
|
qDebug() << "Probing the following Java paths: ";
|
||||||
int id = 0;
|
int id = 0;
|
||||||
for (QString candidate : candidate_paths) {
|
for (QString candidate : candidate_paths) {
|
||||||
auto checker = new JavaChecker(candidate, "", 0, 0, 0, id, this);
|
auto checker = new JavaChecker(candidate, "", 0, 0, 0, id);
|
||||||
connect(checker, &JavaChecker::checkFinished, [this](const JavaChecker::Result& result) { m_results << result; });
|
connect(checker, &JavaChecker::checkFinished, [this](const JavaChecker::Result& result) { m_results << result; });
|
||||||
job->addTask(Task::Ptr(checker));
|
job->addTask(Task::Ptr(checker));
|
||||||
id++;
|
id++;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "LaunchStep.h"
|
#include "LaunchStep.h"
|
||||||
#include "LaunchTask.h"
|
#include "LaunchTask.h"
|
||||||
|
|
||||||
LaunchStep::LaunchStep(LaunchTask* parent) : Task(parent), m_parent(parent)
|
LaunchStep::LaunchStep(LaunchTask* parent) : Task(), m_parent(parent)
|
||||||
{
|
{
|
||||||
connect(this, &LaunchStep::readyForLaunch, parent, &LaunchTask::onReadyForLaunch);
|
connect(this, &LaunchStep::readyForLaunch, parent, &LaunchTask::onReadyForLaunch);
|
||||||
connect(this, &LaunchStep::logLine, parent, &LaunchTask::onLogLine);
|
connect(this, &LaunchStep::logLine, parent, &LaunchTask::onLogLine);
|
||||||
|
@ -94,7 +94,7 @@ void CheckJava::executeTask()
|
|||||||
// if timestamps are not the same, or something is missing, check!
|
// if timestamps are not the same, or something is missing, check!
|
||||||
if (m_javaSignature != storedSignature || storedVersion.size() == 0 || storedArchitecture.size() == 0 ||
|
if (m_javaSignature != storedSignature || storedVersion.size() == 0 || storedArchitecture.size() == 0 ||
|
||||||
storedRealArchitecture.size() == 0 || storedVendor.size() == 0) {
|
storedRealArchitecture.size() == 0 || storedVendor.size() == 0) {
|
||||||
m_JavaChecker.reset(new JavaChecker(realJavaPath, "", 0, 0, 0, 0, this));
|
m_JavaChecker.reset(new JavaChecker(realJavaPath, "", 0, 0, 0, 0));
|
||||||
emit logLine(QString("Checking Java version..."), MessageLevel::Launcher);
|
emit logLine(QString("Checking Java version..."), MessageLevel::Launcher);
|
||||||
connect(m_JavaChecker.get(), &JavaChecker::checkFinished, this, &CheckJava::checkJavaFinished);
|
connect(m_JavaChecker.get(), &JavaChecker::checkFinished, this, &CheckJava::checkJavaFinished);
|
||||||
m_JavaChecker->start();
|
m_JavaChecker->start();
|
||||||
|
@ -140,8 +140,8 @@ Task::Ptr Index::loadVersion(const QString& uid, const QString& version, Net::Mo
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto versionList = get(uid);
|
auto versionList = get(uid);
|
||||||
auto loadTask = makeShared<SequentialTask>(
|
auto loadTask =
|
||||||
this, tr("Load meta for %1:%2", "This is for the task name that loads the meta index.").arg(uid, version));
|
makeShared<SequentialTask>(tr("Load meta for %1:%2", "This is for the task name that loads the meta index.").arg(uid, version));
|
||||||
if (status() != BaseEntity::LoadStatus::Remote || force) {
|
if (status() != BaseEntity::LoadStatus::Remote || force) {
|
||||||
loadTask->addTask(this->loadTask(mode));
|
loadTask->addTask(this->loadTask(mode));
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,7 @@ VersionList::VersionList(const QString& uid, QObject* parent) : BaseVersionList(
|
|||||||
|
|
||||||
Task::Ptr VersionList::getLoadTask()
|
Task::Ptr VersionList::getLoadTask()
|
||||||
{
|
{
|
||||||
auto loadTask =
|
auto loadTask = makeShared<SequentialTask>(tr("Load meta for %1", "This is for the task name that loads the meta index.").arg(m_uid));
|
||||||
makeShared<SequentialTask>(this, tr("Load meta for %1", "This is for the task name that loads the meta index.").arg(m_uid));
|
|
||||||
loadTask->addTask(APPLICATION->metadataIndex()->loadTask(Net::Mode::Online));
|
loadTask->addTask(APPLICATION->metadataIndex()->loadTask(Net::Mode::Online));
|
||||||
loadTask->addTask(this->loadTask(Net::Mode::Online));
|
loadTask->addTask(this->loadTask(Net::Mode::Online));
|
||||||
return loadTask;
|
return loadTask;
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
* If the component list changes, start over.
|
* If the component list changes, start over.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ComponentUpdateTask::ComponentUpdateTask(Mode mode, Net::Mode netmode, PackProfile* list, QObject* parent) : Task(parent)
|
ComponentUpdateTask::ComponentUpdateTask(Mode mode, Net::Mode netmode, PackProfile* list) : Task()
|
||||||
{
|
{
|
||||||
d.reset(new ComponentUpdateTaskData);
|
d.reset(new ComponentUpdateTaskData);
|
||||||
d->m_profile = list;
|
d->m_profile = list;
|
||||||
|
@ -14,7 +14,7 @@ class ComponentUpdateTask : public Task {
|
|||||||
enum class Mode { Launch, Resolution };
|
enum class Mode { Launch, Resolution };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ComponentUpdateTask(Mode mode, Net::Mode netmode, PackProfile* list, QObject* parent = 0);
|
explicit ComponentUpdateTask(Mode mode, Net::Mode netmode, PackProfile* list);
|
||||||
virtual ~ComponentUpdateTask();
|
virtual ~ComponentUpdateTask();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -1093,7 +1093,7 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
|
|||||||
// load meta
|
// load meta
|
||||||
{
|
{
|
||||||
auto mode = session->status != AuthSession::PlayableOffline ? Net::Mode::Online : Net::Mode::Offline;
|
auto mode = session->status != AuthSession::PlayableOffline ? Net::Mode::Online : Net::Mode::Offline;
|
||||||
process->appendStep(makeShared<TaskStepWrapper>(pptr, makeShared<MinecraftLoadAndCheck>(this, mode, pptr)));
|
process->appendStep(makeShared<TaskStepWrapper>(pptr, makeShared<MinecraftLoadAndCheck>(this, mode)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// check java
|
// check java
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
#include "MinecraftInstance.h"
|
#include "MinecraftInstance.h"
|
||||||
#include "PackProfile.h"
|
#include "PackProfile.h"
|
||||||
|
|
||||||
MinecraftLoadAndCheck::MinecraftLoadAndCheck(MinecraftInstance* inst, Net::Mode netmode, QObject* parent)
|
MinecraftLoadAndCheck::MinecraftLoadAndCheck(MinecraftInstance* inst, Net::Mode netmode) : m_inst(inst), m_netmode(netmode) {}
|
||||||
: Task(parent), m_inst(inst), m_netmode(netmode)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void MinecraftLoadAndCheck::executeTask()
|
void MinecraftLoadAndCheck::executeTask()
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ class MinecraftInstance;
|
|||||||
class MinecraftLoadAndCheck : public Task {
|
class MinecraftLoadAndCheck : public Task {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit MinecraftLoadAndCheck(MinecraftInstance* inst, Net::Mode netmode, QObject* parent = nullptr);
|
explicit MinecraftLoadAndCheck(MinecraftInstance* inst, Net::Mode netmode);
|
||||||
virtual ~MinecraftLoadAndCheck() = default;
|
virtual ~MinecraftLoadAndCheck() = default;
|
||||||
void executeTask() override;
|
void executeTask() override;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
|
||||||
AuthFlow::AuthFlow(AccountData* data, Action action, QObject* parent) : Task(parent), m_data(data)
|
AuthFlow::AuthFlow(AccountData* data, Action action) : Task(), m_data(data)
|
||||||
{
|
{
|
||||||
if (data->type == AccountType::MSA) {
|
if (data->type == AccountType::MSA) {
|
||||||
if (action == Action::DeviceCode) {
|
if (action == Action::DeviceCode) {
|
||||||
|
@ -17,7 +17,7 @@ class AuthFlow : public Task {
|
|||||||
public:
|
public:
|
||||||
enum class Action { Refresh, Login, DeviceCode };
|
enum class Action { Refresh, Login, DeviceCode };
|
||||||
|
|
||||||
explicit AuthFlow(AccountData* data, Action action = Action::Refresh, QObject* parent = 0);
|
explicit AuthFlow(AccountData* data, Action action = Action::Refresh);
|
||||||
virtual ~AuthFlow() = default;
|
virtual ~AuthFlow() = default;
|
||||||
|
|
||||||
void executeTask() override;
|
void executeTask() override;
|
||||||
|
@ -121,7 +121,7 @@ shared_qobject_ptr<AuthFlow> MinecraftAccount::login(bool useDeviceCode)
|
|||||||
{
|
{
|
||||||
Q_ASSERT(m_currentTask.get() == nullptr);
|
Q_ASSERT(m_currentTask.get() == nullptr);
|
||||||
|
|
||||||
m_currentTask.reset(new AuthFlow(&data, useDeviceCode ? AuthFlow::Action::DeviceCode : AuthFlow::Action::Login, this));
|
m_currentTask.reset(new AuthFlow(&data, useDeviceCode ? AuthFlow::Action::DeviceCode : AuthFlow::Action::Login));
|
||||||
connect(m_currentTask.get(), &Task::succeeded, this, &MinecraftAccount::authSucceeded);
|
connect(m_currentTask.get(), &Task::succeeded, this, &MinecraftAccount::authSucceeded);
|
||||||
connect(m_currentTask.get(), &Task::failed, this, &MinecraftAccount::authFailed);
|
connect(m_currentTask.get(), &Task::failed, this, &MinecraftAccount::authFailed);
|
||||||
connect(m_currentTask.get(), &Task::aborted, this, [this] { authFailed(tr("Aborted")); });
|
connect(m_currentTask.get(), &Task::aborted, this, [this] { authFailed(tr("Aborted")); });
|
||||||
@ -135,7 +135,7 @@ shared_qobject_ptr<AuthFlow> MinecraftAccount::refresh()
|
|||||||
return m_currentTask;
|
return m_currentTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentTask.reset(new AuthFlow(&data, AuthFlow::Action::Refresh, this));
|
m_currentTask.reset(new AuthFlow(&data, AuthFlow::Action::Refresh));
|
||||||
|
|
||||||
connect(m_currentTask.get(), &Task::succeeded, this, &MinecraftAccount::authSucceeded);
|
connect(m_currentTask.get(), &Task::succeeded, this, &MinecraftAccount::authSucceeded);
|
||||||
connect(m_currentTask.get(), &Task::failed, this, &MinecraftAccount::authFailed);
|
connect(m_currentTask.get(), &Task::failed, this, &MinecraftAccount::authFailed);
|
||||||
|
@ -57,9 +57,7 @@
|
|||||||
#include "tasks/SequentialTask.h"
|
#include "tasks/SequentialTask.h"
|
||||||
|
|
||||||
AutoInstallJava::AutoInstallJava(LaunchTask* parent)
|
AutoInstallJava::AutoInstallJava(LaunchTask* parent)
|
||||||
: LaunchStep(parent)
|
: LaunchStep(parent), m_instance(m_parent->instance()), m_supported_arch(SysInfo::getSupportedJavaArchitecture()) {};
|
||||||
, m_instance(m_parent->instance())
|
|
||||||
, m_supported_arch(SysInfo::getSupportedJavaArchitecture()) {};
|
|
||||||
|
|
||||||
void AutoInstallJava::executeTask()
|
void AutoInstallJava::executeTask()
|
||||||
{
|
{
|
||||||
@ -179,7 +177,7 @@ void AutoInstallJava::downloadJava(Meta::Version::Ptr version, QString javaName)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
auto seq = makeShared<SequentialTask>(this, tr("Install Java"));
|
auto seq = makeShared<SequentialTask>(tr("Install Java"));
|
||||||
seq->addTask(m_current_task);
|
seq->addTask(m_current_task);
|
||||||
seq->addTask(makeShared<Java::SymlinkTask>(final_path));
|
seq->addTask(makeShared<Java::SymlinkTask>(final_path));
|
||||||
m_current_task = seq;
|
m_current_task = seq;
|
||||||
|
@ -26,16 +26,12 @@ class BasicFolderLoadTask : public Task {
|
|||||||
[[nodiscard]] ResultPtr result() const { return m_result; }
|
[[nodiscard]] ResultPtr result() const { return m_result; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BasicFolderLoadTask(QDir dir) : Task(nullptr, false), m_dir(dir), m_result(new Result), m_thread_to_spawn_into(thread())
|
BasicFolderLoadTask(QDir dir) : Task(false), m_dir(dir), m_result(new Result), m_thread_to_spawn_into(thread())
|
||||||
{
|
{
|
||||||
m_create_func = [](QFileInfo const& entry) -> Resource::Ptr { return makeShared<Resource>(entry); };
|
m_create_func = [](QFileInfo const& entry) -> Resource::Ptr { return makeShared<Resource>(entry); };
|
||||||
}
|
}
|
||||||
BasicFolderLoadTask(QDir dir, std::function<Resource::Ptr(QFileInfo const&)> create_function)
|
BasicFolderLoadTask(QDir dir, std::function<Resource::Ptr(QFileInfo const&)> create_function)
|
||||||
: Task(nullptr, false)
|
: Task(false), m_dir(dir), m_result(new Result), m_create_func(std::move(create_function)), m_thread_to_spawn_into(thread())
|
||||||
, m_dir(dir)
|
|
||||||
, m_result(new Result)
|
|
||||||
, m_create_func(std::move(create_function))
|
|
||||||
, m_thread_to_spawn_into(thread())
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
[[nodiscard]] bool canAbort() const override { return true; }
|
[[nodiscard]] bool canAbort() const override { return true; }
|
||||||
|
@ -52,11 +52,10 @@ static bool checkDependencies(std::shared_ptr<GetModDependenciesTask::PackDepend
|
|||||||
(!loaders || !sel->version.loaders || sel->version.loaders & loaders);
|
(!loaders || !sel->version.loaders || sel->version.loaders & loaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetModDependenciesTask::GetModDependenciesTask(QObject* parent,
|
GetModDependenciesTask::GetModDependenciesTask(BaseInstance* instance,
|
||||||
BaseInstance* instance,
|
|
||||||
ModFolderModel* folder,
|
ModFolderModel* folder,
|
||||||
QList<std::shared_ptr<PackDependency>> selected)
|
QList<std::shared_ptr<PackDependency>> selected)
|
||||||
: SequentialTask(parent, tr("Get dependencies"))
|
: SequentialTask(tr("Get dependencies"))
|
||||||
, m_selected(selected)
|
, m_selected(selected)
|
||||||
, m_flame_provider{ ModPlatform::ResourceProvider::FLAME, std::make_shared<ResourceDownload::FlameModModel>(*instance),
|
, m_flame_provider{ ModPlatform::ResourceProvider::FLAME, std::make_shared<ResourceDownload::FlameModModel>(*instance),
|
||||||
std::make_shared<FlameAPI>() }
|
std::make_shared<FlameAPI>() }
|
||||||
@ -185,7 +184,7 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
|
|||||||
auto provider = providerName == m_flame_provider.name ? m_flame_provider : m_modrinth_provider;
|
auto provider = providerName == m_flame_provider.name ? m_flame_provider : m_modrinth_provider;
|
||||||
|
|
||||||
auto tasks = makeShared<SequentialTask>(
|
auto tasks = makeShared<SequentialTask>(
|
||||||
this, QString("DependencyInfo: %1").arg(dep.addonId.toString().isEmpty() ? dep.version : dep.addonId.toString()));
|
QString("DependencyInfo: %1").arg(dep.addonId.toString().isEmpty() ? dep.version : dep.addonId.toString()));
|
||||||
|
|
||||||
if (!dep.addonId.toString().isEmpty()) {
|
if (!dep.addonId.toString().isEmpty()) {
|
||||||
tasks->addTask(getProjectInfoTask(pDep));
|
tasks->addTask(getProjectInfoTask(pDep));
|
||||||
|
@ -61,10 +61,7 @@ class GetModDependenciesTask : public SequentialTask {
|
|||||||
std::shared_ptr<ResourceAPI> api;
|
std::shared_ptr<ResourceAPI> api;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit GetModDependenciesTask(QObject* parent,
|
explicit GetModDependenciesTask(BaseInstance* instance, ModFolderModel* folder, QList<std::shared_ptr<PackDependency>> selected);
|
||||||
BaseInstance* instance,
|
|
||||||
ModFolderModel* folder,
|
|
||||||
QList<std::shared_ptr<PackDependency>> selected);
|
|
||||||
|
|
||||||
auto getDependecies() const -> QList<std::shared_ptr<PackDependency>> { return m_pack_dependencies; }
|
auto getDependecies() const -> QList<std::shared_ptr<PackDependency>> { return m_pack_dependencies; }
|
||||||
QHash<QString, PackDependencyExtraInfo> getExtraInfo();
|
QHash<QString, PackDependencyExtraInfo> getExtraInfo();
|
||||||
|
@ -157,7 +157,7 @@ bool validate(QFileInfo file)
|
|||||||
|
|
||||||
} // namespace DataPackUtils
|
} // namespace DataPackUtils
|
||||||
|
|
||||||
LocalDataPackParseTask::LocalDataPackParseTask(int token, DataPack& dp) : Task(nullptr, false), m_token(token), m_data_pack(dp) {}
|
LocalDataPackParseTask::LocalDataPackParseTask(int token, DataPack& dp) : Task(false), m_token(token), m_data_pack(dp) {}
|
||||||
|
|
||||||
bool LocalDataPackParseTask::abort()
|
bool LocalDataPackParseTask::abort()
|
||||||
{
|
{
|
||||||
|
@ -730,7 +730,7 @@ bool loadIconFile(const Mod& mod, QPixmap* pixmap)
|
|||||||
} // namespace ModUtils
|
} // namespace ModUtils
|
||||||
|
|
||||||
LocalModParseTask::LocalModParseTask(int token, ResourceType type, const QFileInfo& modFile)
|
LocalModParseTask::LocalModParseTask(int token, ResourceType type, const QFileInfo& modFile)
|
||||||
: Task(nullptr, false), m_token(token), m_type(type), m_modFile(modFile), m_result(new Result())
|
: Task(false), m_token(token), m_type(type), m_modFile(modFile), m_result(new Result())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool LocalModParseTask::abort()
|
bool LocalModParseTask::abort()
|
||||||
|
@ -358,9 +358,7 @@ bool validate(QFileInfo file)
|
|||||||
|
|
||||||
} // namespace ResourcePackUtils
|
} // namespace ResourcePackUtils
|
||||||
|
|
||||||
LocalResourcePackParseTask::LocalResourcePackParseTask(int token, ResourcePack& rp)
|
LocalResourcePackParseTask::LocalResourcePackParseTask(int token, ResourcePack& rp) : Task(false), m_token(token), m_resource_pack(rp) {}
|
||||||
: Task(nullptr, false), m_token(token), m_resource_pack(rp)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool LocalResourcePackParseTask::abort()
|
bool LocalResourcePackParseTask::abort()
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ bool validate(QFileInfo file)
|
|||||||
|
|
||||||
} // namespace ShaderPackUtils
|
} // namespace ShaderPackUtils
|
||||||
|
|
||||||
LocalShaderPackParseTask::LocalShaderPackParseTask(int token, ShaderPack& sp) : Task(nullptr, false), m_token(token), m_shader_pack(sp) {}
|
LocalShaderPackParseTask::LocalShaderPackParseTask(int token, ShaderPack& sp) : Task(false), m_token(token), m_shader_pack(sp) {}
|
||||||
|
|
||||||
bool LocalShaderPackParseTask::abort()
|
bool LocalShaderPackParseTask::abort()
|
||||||
{
|
{
|
||||||
|
@ -230,8 +230,7 @@ bool validate(QFileInfo file)
|
|||||||
|
|
||||||
} // namespace TexturePackUtils
|
} // namespace TexturePackUtils
|
||||||
|
|
||||||
LocalTexturePackParseTask::LocalTexturePackParseTask(int token, TexturePack& rp) : Task(nullptr, false), m_token(token), m_texture_pack(rp)
|
LocalTexturePackParseTask::LocalTexturePackParseTask(int token, TexturePack& rp) : Task(false), m_token(token), m_texture_pack(rp) {}
|
||||||
{}
|
|
||||||
|
|
||||||
bool LocalTexturePackParseTask::abort()
|
bool LocalTexturePackParseTask::abort()
|
||||||
{
|
{
|
||||||
|
@ -170,7 +170,7 @@ bool validate(QFileInfo file)
|
|||||||
|
|
||||||
} // namespace WorldSaveUtils
|
} // namespace WorldSaveUtils
|
||||||
|
|
||||||
LocalWorldSaveParseTask::LocalWorldSaveParseTask(int token, WorldSave& save) : Task(nullptr, false), m_token(token), m_save(save) {}
|
LocalWorldSaveParseTask::LocalWorldSaveParseTask(int token, WorldSave& save) : Task(false), m_token(token), m_save(save) {}
|
||||||
|
|
||||||
bool LocalWorldSaveParseTask::abort()
|
bool LocalWorldSaveParseTask::abort()
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
ModFolderLoadTask::ModFolderLoadTask(QDir mods_dir, QDir index_dir, bool is_indexed, bool clean_orphan)
|
ModFolderLoadTask::ModFolderLoadTask(QDir mods_dir, QDir index_dir, bool is_indexed, bool clean_orphan)
|
||||||
: Task(nullptr, false)
|
: Task(false)
|
||||||
, m_mods_dir(mods_dir)
|
, m_mods_dir(mods_dir)
|
||||||
, m_index_dir(index_dir)
|
, m_index_dir(index_dir)
|
||||||
, m_is_indexed(is_indexed)
|
, m_is_indexed(is_indexed)
|
||||||
|
@ -16,7 +16,7 @@ class CheckUpdateTask : public Task {
|
|||||||
std::list<Version>& mcVersions,
|
std::list<Version>& mcVersions,
|
||||||
QList<ModPlatform::ModLoaderType> loadersList,
|
QList<ModPlatform::ModLoaderType> loadersList,
|
||||||
std::shared_ptr<ModFolderModel> mods_folder)
|
std::shared_ptr<ModFolderModel> mods_folder)
|
||||||
: Task(nullptr), m_mods(mods), m_game_versions(mcVersions), m_loaders_list(loadersList), m_mods_folder(mods_folder) {};
|
: Task(), m_mods(mods), m_game_versions(mcVersions), m_loaders_list(loadersList), m_mods_folder(mods_folder) {};
|
||||||
|
|
||||||
struct UpdatableMod {
|
struct UpdatableMod {
|
||||||
QString name;
|
QString name;
|
||||||
|
@ -19,7 +19,7 @@ static ModrinthAPI modrinth_api;
|
|||||||
static FlameAPI flame_api;
|
static FlameAPI flame_api;
|
||||||
|
|
||||||
EnsureMetadataTask::EnsureMetadataTask(Mod* mod, QDir dir, ModPlatform::ResourceProvider prov)
|
EnsureMetadataTask::EnsureMetadataTask(Mod* mod, QDir dir, ModPlatform::ResourceProvider prov)
|
||||||
: Task(nullptr), m_index_dir(dir), m_provider(prov), m_hashing_task(nullptr), m_current_task(nullptr)
|
: Task(), m_index_dir(dir), m_provider(prov), m_hashing_task(nullptr), m_current_task(nullptr)
|
||||||
{
|
{
|
||||||
auto hash_task = createNewHash(mod);
|
auto hash_task = createNewHash(mod);
|
||||||
if (!hash_task)
|
if (!hash_task)
|
||||||
@ -30,9 +30,9 @@ EnsureMetadataTask::EnsureMetadataTask(Mod* mod, QDir dir, ModPlatform::Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
EnsureMetadataTask::EnsureMetadataTask(QList<Mod*>& mods, QDir dir, ModPlatform::ResourceProvider prov)
|
EnsureMetadataTask::EnsureMetadataTask(QList<Mod*>& mods, QDir dir, ModPlatform::ResourceProvider prov)
|
||||||
: Task(nullptr), m_index_dir(dir), m_provider(prov), m_current_task(nullptr)
|
: Task(), m_index_dir(dir), m_provider(prov), m_current_task(nullptr)
|
||||||
{
|
{
|
||||||
m_hashing_task.reset(new ConcurrentTask(this, "MakeHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
m_hashing_task.reset(new ConcurrentTask("MakeHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
||||||
for (auto* mod : mods) {
|
for (auto* mod : mods) {
|
||||||
auto hash_task = createNewHash(mod);
|
auto hash_task = createNewHash(mod);
|
||||||
if (!hash_task)
|
if (!hash_task)
|
||||||
@ -43,7 +43,7 @@ EnsureMetadataTask::EnsureMetadataTask(QList<Mod*>& mods, QDir dir, ModPlatform:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EnsureMetadataTask::EnsureMetadataTask(QHash<QString, Mod*>& mods, QDir dir, ModPlatform::ResourceProvider prov)
|
EnsureMetadataTask::EnsureMetadataTask(QHash<QString, Mod*>& mods, QDir dir, ModPlatform::ResourceProvider prov)
|
||||||
: Task(nullptr), m_mods(mods), m_index_dir(dir), m_provider(prov), m_current_task(nullptr)
|
: Task(), m_mods(mods), m_index_dir(dir), m_provider(prov), m_current_task(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Hashing::Hasher::Ptr EnsureMetadataTask::createNewHash(Mod* mod)
|
Hashing::Hasher::Ptr EnsureMetadataTask::createNewHash(Mod* mod)
|
||||||
|
@ -677,7 +677,7 @@ void FlameCreationTask::validateZIPResources(QEventLoop& loop)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto task = makeShared<ConcurrentTask>(this, "CreateModMetadata", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
auto task = makeShared<ConcurrentTask>("CreateModMetadata", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
||||||
auto results = m_mod_id_resolver->getResults().files;
|
auto results = m_mod_id_resolver->getResults().files;
|
||||||
auto folder = FS::PathCombine(m_stagingPath, "minecraft", "mods", ".index");
|
auto folder = FS::PathCombine(m_stagingPath, "minecraft", "mods", ".index");
|
||||||
for (auto file : results) {
|
for (auto file : results) {
|
||||||
|
@ -103,8 +103,7 @@ void FlamePackExportTask::collectHashes()
|
|||||||
setStatus(tr("Finding file hashes..."));
|
setStatus(tr("Finding file hashes..."));
|
||||||
setProgress(1, 5);
|
setProgress(1, 5);
|
||||||
auto allMods = mcInstance->loaderModList()->allMods();
|
auto allMods = mcInstance->loaderModList()->allMods();
|
||||||
ConcurrentTask::Ptr hashingTask(
|
ConcurrentTask::Ptr hashingTask(new ConcurrentTask("MakeHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
||||||
new ConcurrentTask(this, "MakeHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
|
||||||
task.reset(hashingTask);
|
task.reset(hashingTask);
|
||||||
for (const QFileInfo& file : files) {
|
for (const QFileInfo& file : files) {
|
||||||
const QString relative = gameRoot.relativeFilePath(file.absoluteFilePath());
|
const QString relative = gameRoot.relativeFilePath(file.absoluteFilePath());
|
||||||
|
@ -40,7 +40,7 @@ void ModrinthCheckUpdate::executeTask()
|
|||||||
setProgress(0, 9);
|
setProgress(0, 9);
|
||||||
|
|
||||||
auto hashing_task =
|
auto hashing_task =
|
||||||
makeShared<ConcurrentTask>(this, "MakeModrinthHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
makeShared<ConcurrentTask>("MakeModrinthHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
||||||
for (auto* mod : m_mods) {
|
for (auto* mod : m_mods) {
|
||||||
auto hash = mod->metadata()->hash;
|
auto hash = mod->metadata()->hash;
|
||||||
|
|
||||||
@ -91,7 +91,6 @@ void ModrinthCheckUpdate::checkVersionsResponse(std::shared_ptr<QByteArray> resp
|
|||||||
// it means this specific version is not available
|
// it means this specific version is not available
|
||||||
if (project_obj.isEmpty()) {
|
if (project_obj.isEmpty()) {
|
||||||
qDebug() << "Mod " << m_mappings.find(hash).value()->name() << " got an empty response." << "Hash: " << hash;
|
qDebug() << "Mod " << m_mappings.find(hash).value()->name() << " got an empty response." << "Hash: " << hash;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
NetJob::NetJob(QString job_name, shared_qobject_ptr<QNetworkAccessManager> network, int max_concurrent)
|
NetJob::NetJob(QString job_name, shared_qobject_ptr<QNetworkAccessManager> network, int max_concurrent)
|
||||||
: ConcurrentTask(nullptr, job_name), m_network(network)
|
: ConcurrentTask(job_name), m_network(network)
|
||||||
{
|
{
|
||||||
#if defined(LAUNCHER_APPLICATION)
|
#if defined(LAUNCHER_APPLICATION)
|
||||||
if (APPLICATION_DYN && max_concurrent < 0)
|
if (APPLICATION_DYN && max_concurrent < 0)
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "tasks/Task.h"
|
#include "tasks/Task.h"
|
||||||
|
|
||||||
ConcurrentTask::ConcurrentTask(QObject* parent, QString task_name, int max_concurrent) : Task(parent), m_total_max_size(max_concurrent)
|
ConcurrentTask::ConcurrentTask(QString task_name, int max_concurrent) : Task(), m_total_max_size(max_concurrent)
|
||||||
{
|
{
|
||||||
setObjectName(task_name);
|
setObjectName(task_name);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ class ConcurrentTask : public Task {
|
|||||||
public:
|
public:
|
||||||
using Ptr = shared_qobject_ptr<ConcurrentTask>;
|
using Ptr = shared_qobject_ptr<ConcurrentTask>;
|
||||||
|
|
||||||
explicit ConcurrentTask(QObject* parent = nullptr, QString task_name = "", int max_concurrent = 6);
|
explicit ConcurrentTask(QString task_name = "", int max_concurrent = 6);
|
||||||
~ConcurrentTask() override;
|
~ConcurrentTask() override;
|
||||||
|
|
||||||
// safe to call before starting the task
|
// safe to call before starting the task
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
MultipleOptionsTask::MultipleOptionsTask(QObject* parent, const QString& task_name) : ConcurrentTask(parent, task_name, 1) {}
|
MultipleOptionsTask::MultipleOptionsTask(const QString& task_name) : ConcurrentTask(task_name, 1) {}
|
||||||
|
|
||||||
void MultipleOptionsTask::executeNextSubTask()
|
void MultipleOptionsTask::executeNextSubTask()
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
class MultipleOptionsTask : public ConcurrentTask {
|
class MultipleOptionsTask : public ConcurrentTask {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit MultipleOptionsTask(QObject* parent = nullptr, const QString& task_name = "");
|
explicit MultipleOptionsTask(const QString& task_name = "");
|
||||||
~MultipleOptionsTask() override = default;
|
~MultipleOptionsTask() override = default;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "tasks/ConcurrentTask.h"
|
#include "tasks/ConcurrentTask.h"
|
||||||
|
|
||||||
SequentialTask::SequentialTask(QObject* parent, QString task_name) : ConcurrentTask(parent, task_name, 1) {}
|
SequentialTask::SequentialTask(QString task_name) : ConcurrentTask(task_name, 1) {}
|
||||||
|
|
||||||
void SequentialTask::subTaskFailed(Task::Ptr task, const QString& msg)
|
void SequentialTask::subTaskFailed(Task::Ptr task, const QString& msg)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
class SequentialTask : public ConcurrentTask {
|
class SequentialTask : public ConcurrentTask {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SequentialTask(QObject* parent = nullptr, QString task_name = "");
|
explicit SequentialTask(QString task_name = "");
|
||||||
~SequentialTask() override = default;
|
~SequentialTask() override = default;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
Q_LOGGING_CATEGORY(taskLogC, "launcher.task")
|
Q_LOGGING_CATEGORY(taskLogC, "launcher.task")
|
||||||
|
|
||||||
Task::Task(QObject* parent, bool show_debug) : QObject(parent), m_show_debug(show_debug)
|
Task::Task(bool show_debug) : m_show_debug(show_debug)
|
||||||
{
|
{
|
||||||
m_uid = QUuid::createUuid();
|
m_uid = QUuid::createUuid();
|
||||||
setAutoDelete(false);
|
setAutoDelete(false);
|
||||||
|
@ -87,7 +87,7 @@ class Task : public QObject, public QRunnable {
|
|||||||
enum class State { Inactive, Running, Succeeded, Failed, AbortedByUser };
|
enum class State { Inactive, Running, Succeeded, Failed, AbortedByUser };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Task(QObject* parent = 0, bool show_debug_log = true);
|
explicit Task(bool show_debug_log = true);
|
||||||
virtual ~Task() = default;
|
virtual ~Task() = default;
|
||||||
|
|
||||||
bool isRunning() const;
|
bool isRunning() const;
|
||||||
|
@ -46,7 +46,7 @@ BlockedModsDialog::BlockedModsDialog(QWidget* parent, const QString& title, cons
|
|||||||
: QDialog(parent), ui(new Ui::BlockedModsDialog), m_mods(mods), m_hash_type(hash_type)
|
: QDialog(parent), ui(new Ui::BlockedModsDialog), m_mods(mods), m_hash_type(hash_type)
|
||||||
{
|
{
|
||||||
m_hashing_task = shared_qobject_ptr<ConcurrentTask>(
|
m_hashing_task = shared_qobject_ptr<ConcurrentTask>(
|
||||||
new ConcurrentTask(this, "MakeHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
new ConcurrentTask("MakeHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()));
|
||||||
connect(m_hashing_task.get(), &Task::finished, this, &BlockedModsDialog::hashTaskFinished);
|
connect(m_hashing_task.get(), &Task::finished, this, &BlockedModsDialog::hashTaskFinished);
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -85,7 +85,7 @@ int MSALoginDialog::exec()
|
|||||||
connect(m_authflow_task.get(), &AuthFlow::authorizeWithBrowserWithExtra, this, &MSALoginDialog::authorizeWithBrowserWithExtra);
|
connect(m_authflow_task.get(), &AuthFlow::authorizeWithBrowserWithExtra, this, &MSALoginDialog::authorizeWithBrowserWithExtra);
|
||||||
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_authflow_task.get(), &Task::abort);
|
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_authflow_task.get(), &Task::abort);
|
||||||
|
|
||||||
m_devicecode_task.reset(new AuthFlow(m_account->accountData(), AuthFlow::Action::DeviceCode, this));
|
m_devicecode_task.reset(new AuthFlow(m_account->accountData(), AuthFlow::Action::DeviceCode));
|
||||||
connect(m_devicecode_task.get(), &Task::failed, this, &MSALoginDialog::onTaskFailed);
|
connect(m_devicecode_task.get(), &Task::failed, this, &MSALoginDialog::onTaskFailed);
|
||||||
connect(m_devicecode_task.get(), &Task::succeeded, this, &QDialog::accept);
|
connect(m_devicecode_task.get(), &Task::succeeded, this, &QDialog::accept);
|
||||||
connect(m_devicecode_task.get(), &Task::aborted, this, &MSALoginDialog::reject);
|
connect(m_devicecode_task.get(), &Task::aborted, this, &MSALoginDialog::reject);
|
||||||
|
@ -45,8 +45,7 @@ ModUpdateDialog::ModUpdateDialog(QWidget* parent,
|
|||||||
, m_parent(parent)
|
, m_parent(parent)
|
||||||
, m_mod_model(mods)
|
, m_mod_model(mods)
|
||||||
, m_candidates(search_for)
|
, m_candidates(search_for)
|
||||||
, m_second_try_metadata(
|
, m_second_try_metadata(new ConcurrentTask("Second Metadata Search", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()))
|
||||||
new ConcurrentTask(nullptr, "Second Metadata Search", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()))
|
|
||||||
, m_instance(instance)
|
, m_instance(instance)
|
||||||
, m_include_deps(includeDeps)
|
, m_include_deps(includeDeps)
|
||||||
{
|
{
|
||||||
@ -89,7 +88,7 @@ void ModUpdateDialog::checkCandidates()
|
|||||||
auto versions = mcVersions(m_instance);
|
auto versions = mcVersions(m_instance);
|
||||||
auto loadersList = mcLoadersList(m_instance);
|
auto loadersList = mcLoadersList(m_instance);
|
||||||
|
|
||||||
SequentialTask check_task(m_parent, tr("Checking for updates"));
|
SequentialTask check_task(tr("Checking for updates"));
|
||||||
|
|
||||||
if (!m_modrinth_to_update.empty()) {
|
if (!m_modrinth_to_update.empty()) {
|
||||||
m_modrinth_check_task.reset(new ModrinthCheckUpdate(m_modrinth_to_update, versions, loadersList, m_mod_model));
|
m_modrinth_check_task.reset(new ModrinthCheckUpdate(m_modrinth_to_update, versions, loadersList, m_mod_model));
|
||||||
@ -187,7 +186,7 @@ void ModUpdateDialog::checkCandidates()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_include_deps && !APPLICATION->settings()->get("ModDependenciesDisabled").toBool()) { // dependencies
|
if (m_include_deps && !APPLICATION->settings()->get("ModDependenciesDisabled").toBool()) { // dependencies
|
||||||
auto depTask = makeShared<GetModDependenciesTask>(this, m_instance, m_mod_model.get(), selectedVers);
|
auto depTask = makeShared<GetModDependenciesTask>(m_instance, m_mod_model.get(), selectedVers);
|
||||||
|
|
||||||
connect(depTask.get(), &Task::failed, this,
|
connect(depTask.get(), &Task::failed, this,
|
||||||
[&](QString reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->exec(); });
|
[&](QString reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->exec(); });
|
||||||
@ -261,7 +260,7 @@ auto ModUpdateDialog::ensureMetadata() -> bool
|
|||||||
{
|
{
|
||||||
auto index_dir = indexDir();
|
auto index_dir = indexDir();
|
||||||
|
|
||||||
SequentialTask seq(m_parent, tr("Looking for metadata"));
|
SequentialTask seq(tr("Looking for metadata"));
|
||||||
|
|
||||||
// A better use of data structures here could remove the need for this QHash
|
// A better use of data structures here could remove the need for this QHash
|
||||||
QHash<QString, bool> should_try_others;
|
QHash<QString, bool> should_try_others;
|
||||||
|
@ -298,7 +298,7 @@ GetModDependenciesTask::Ptr ModDownloadDialog::getModDependenciesTask()
|
|||||||
selectedVers.append(std::make_shared<GetModDependenciesTask::PackDependency>(selected->getPack(), selected->getVersion()));
|
selectedVers.append(std::make_shared<GetModDependenciesTask::PackDependency>(selected->getPack(), selected->getVersion()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return makeShared<GetModDependenciesTask>(this, m_instance, model, selectedVers);
|
return makeShared<GetModDependenciesTask>(m_instance, model, selectedVers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -317,7 +317,7 @@ void InstallDialog::done(int result)
|
|||||||
deletePath();
|
deletePath();
|
||||||
}
|
}
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
auto seq = makeShared<SequentialTask>(this, tr("Install Java"));
|
auto seq = makeShared<SequentialTask>(tr("Install Java"));
|
||||||
seq->addTask(task);
|
seq->addTask(task);
|
||||||
seq->addTask(makeShared<Java::SymlinkTask>(final_path));
|
seq->addTask(makeShared<Java::SymlinkTask>(final_path));
|
||||||
task = seq;
|
task = seq;
|
||||||
|
@ -209,7 +209,7 @@ void ModFolderPage::installMods()
|
|||||||
|
|
||||||
ResourceDownload::ModDownloadDialog mdownload(this, m_model, m_instance);
|
ResourceDownload::ModDownloadDialog mdownload(this, m_model, m_instance);
|
||||||
if (mdownload.exec()) {
|
if (mdownload.exec()) {
|
||||||
auto tasks = new ConcurrentTask(this, "Download Mods", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
auto tasks = new ConcurrentTask("Download Mods", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||||
tasks->deleteLater();
|
tasks->deleteLater();
|
||||||
@ -292,7 +292,7 @@ void ModFolderPage::updateMods(bool includeDeps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (update_dialog.exec()) {
|
if (update_dialog.exec()) {
|
||||||
auto tasks = new ConcurrentTask(this, "Download Mods", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
auto tasks = new ConcurrentTask("Download Mods", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||||
tasks->deleteLater();
|
tasks->deleteLater();
|
||||||
@ -423,7 +423,7 @@ void ModFolderPage::changeModVersion()
|
|||||||
ResourceDownload::ModDownloadDialog mdownload(this, m_model, m_instance);
|
ResourceDownload::ModDownloadDialog mdownload(this, m_model, m_instance);
|
||||||
mdownload.setModMetadata((*mods_list.begin())->metadata());
|
mdownload.setModMetadata((*mods_list.begin())->metadata());
|
||||||
if (mdownload.exec()) {
|
if (mdownload.exec()) {
|
||||||
auto tasks = new ConcurrentTask(this, "Download Mods", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
auto tasks = new ConcurrentTask("Download Mods", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||||
tasks->deleteLater();
|
tasks->deleteLater();
|
||||||
|
@ -37,8 +37,6 @@
|
|||||||
|
|
||||||
#include "ResourcePackPage.h"
|
#include "ResourcePackPage.h"
|
||||||
|
|
||||||
#include "ResourceDownloadTask.h"
|
|
||||||
|
|
||||||
#include "ui/dialogs/CustomMessageBox.h"
|
#include "ui/dialogs/CustomMessageBox.h"
|
||||||
#include "ui/dialogs/ProgressDialog.h"
|
#include "ui/dialogs/ProgressDialog.h"
|
||||||
#include "ui/dialogs/ResourceDownloadDialog.h"
|
#include "ui/dialogs/ResourceDownloadDialog.h"
|
||||||
@ -72,8 +70,7 @@ void ResourcePackPage::downloadRPs()
|
|||||||
|
|
||||||
ResourceDownload::ResourcePackDownloadDialog mdownload(this, std::static_pointer_cast<ResourcePackFolderModel>(m_model), m_instance);
|
ResourceDownload::ResourcePackDownloadDialog mdownload(this, std::static_pointer_cast<ResourcePackFolderModel>(m_model), m_instance);
|
||||||
if (mdownload.exec()) {
|
if (mdownload.exec()) {
|
||||||
auto tasks =
|
auto tasks = new ConcurrentTask("Download Resource Pack", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||||
new ConcurrentTask(this, "Download Resource Pack", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
|
||||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||||
tasks->deleteLater();
|
tasks->deleteLater();
|
||||||
|
@ -65,7 +65,7 @@ void ShaderPackPage::downloadShaders()
|
|||||||
|
|
||||||
ResourceDownload::ShaderPackDownloadDialog mdownload(this, std::static_pointer_cast<ShaderPackFolderModel>(m_model), m_instance);
|
ResourceDownload::ShaderPackDownloadDialog mdownload(this, std::static_pointer_cast<ShaderPackFolderModel>(m_model), m_instance);
|
||||||
if (mdownload.exec()) {
|
if (mdownload.exec()) {
|
||||||
auto tasks = new ConcurrentTask(this, "Download Shaders", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
auto tasks = new ConcurrentTask("Download Shaders", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||||
tasks->deleteLater();
|
tasks->deleteLater();
|
||||||
|
@ -74,8 +74,7 @@ void TexturePackPage::downloadTPs()
|
|||||||
|
|
||||||
ResourceDownload::TexturePackDownloadDialog mdownload(this, std::static_pointer_cast<TexturePackFolderModel>(m_model), m_instance);
|
ResourceDownload::TexturePackDownloadDialog mdownload(this, std::static_pointer_cast<TexturePackFolderModel>(m_model), m_instance);
|
||||||
if (mdownload.exec()) {
|
if (mdownload.exec()) {
|
||||||
auto tasks =
|
auto tasks = new ConcurrentTask("Download Texture Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||||
new ConcurrentTask(this, "Download Texture Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
|
||||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||||
tasks->deleteLater();
|
tasks->deleteLater();
|
||||||
|
@ -435,7 +435,7 @@ void VersionPage::on_actionDownload_All_triggered()
|
|||||||
if (updateTasks.isEmpty()) {
|
if (updateTasks.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto task = makeShared<SequentialTask>(this);
|
auto task = makeShared<SequentialTask>();
|
||||||
for (auto t : updateTasks) {
|
for (auto t : updateTasks) {
|
||||||
task->addTask(t);
|
task->addTask(t);
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ void JavaSettingsWidget::checkJavaPath(const QString& path)
|
|||||||
}
|
}
|
||||||
setJavaStatus(JavaStatus::Pending);
|
setJavaStatus(JavaStatus::Pending);
|
||||||
m_checker.reset(
|
m_checker.reset(
|
||||||
new JavaChecker(path, "", minHeapSize(), maxHeapSize(), m_permGenSpinBox->isVisible() ? m_permGenSpinBox->value() : 0, 0, this));
|
new JavaChecker(path, "", minHeapSize(), maxHeapSize(), m_permGenSpinBox->isVisible() ? m_permGenSpinBox->value() : 0, 0));
|
||||||
connect(m_checker.get(), &JavaChecker::checkFinished, this, &JavaSettingsWidget::checkFinished);
|
connect(m_checker.get(), &JavaChecker::checkFinished, this, &JavaSettingsWidget::checkFinished);
|
||||||
m_checker->start();
|
m_checker->start();
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class BasicTask : public Task {
|
|||||||
friend class TaskTest;
|
friend class TaskTest;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BasicTask(bool show_debug_log = true) : Task(nullptr, show_debug_log) {}
|
BasicTask(bool show_debug_log = true) : Task(show_debug_log) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void executeTask() override { emitSucceeded(); }
|
void executeTask() override { emitSucceeded(); }
|
||||||
|
Loading…
Reference in New Issue
Block a user