remove task parent from constuctor

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2024-10-28 19:13:14 +02:00
parent ba07a136dc
commit 2b590f24ed
56 changed files with 86 additions and 113 deletions

View File

@@ -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)
{
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);
ui->setupUi(this);

View File

@@ -85,7 +85,7 @@ int MSALoginDialog::exec()
connect(m_authflow_task.get(), &AuthFlow::authorizeWithBrowserWithExtra, this, &MSALoginDialog::authorizeWithBrowserWithExtra);
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::succeeded, this, &QDialog::accept);
connect(m_devicecode_task.get(), &Task::aborted, this, &MSALoginDialog::reject);

View File

@@ -298,7 +298,7 @@ GetModDependenciesTask::Ptr ModDownloadDialog::getModDependenciesTask()
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;

View File

@@ -45,8 +45,7 @@ ResourceUpdateDialog::ResourceUpdateDialog(QWidget* parent,
, m_parent(parent)
, m_resource_model(resource_model)
, m_candidates(search_for)
, m_second_try_metadata(
new ConcurrentTask(nullptr, "Second Metadata Search", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()))
, m_second_try_metadata(new ConcurrentTask("Second Metadata Search", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()))
, m_instance(instance)
, m_include_deps(include_deps)
, m_filter_loaders(filter_loaders)
@@ -90,7 +89,7 @@ void ResourceUpdateDialog::checkCandidates()
auto versions = mcVersions(m_instance);
auto loadersList = m_filter_loaders ? mcLoadersList(m_instance) : QList<ModPlatform::ModLoaderType>();
SequentialTask check_task(m_parent, tr("Checking for updates"));
SequentialTask check_task(tr("Checking for updates"));
if (!m_modrinth_to_update.empty()) {
m_modrinth_check_task.reset(new ModrinthCheckUpdate(m_modrinth_to_update, versions, loadersList, m_resource_model));
@@ -195,7 +194,7 @@ void ResourceUpdateDialog::checkCandidates()
auto* mod_model = dynamic_cast<ModFolderModel*>(m_resource_model.get());
if (mod_model != nullptr) {
auto depTask = makeShared<GetModDependenciesTask>(this, m_instance, mod_model, selectedVers);
auto depTask = makeShared<GetModDependenciesTask>(m_instance, mod_model, selectedVers);
connect(depTask.get(), &Task::failed, this,
[&](const QString& reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->exec(); });
@@ -265,7 +264,7 @@ auto ResourceUpdateDialog::ensureMetadata() -> bool
{
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
QHash<QString, bool> should_try_others;