remove task parent from constuctor
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@@ -155,7 +155,7 @@ void ModFolderPage::downloadMods()
|
||||
|
||||
ResourceDownload::ModDownloadDialog mdownload(this, m_model, m_instance);
|
||||
if (mdownload.exec()) {
|
||||
auto tasks = new ConcurrentTask(this, tr("Download Mods"), APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
auto tasks = new ConcurrentTask(tr("Download Mods"), APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
@@ -238,7 +238,7 @@ void ModFolderPage::updateMods(bool includeDeps)
|
||||
}
|
||||
|
||||
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) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
@@ -310,7 +310,7 @@ void ModFolderPage::changeModVersion()
|
||||
ResourceDownload::ModDownloadDialog mdownload(this, m_model, m_instance);
|
||||
mdownload.setResourceMetadata((*mods_list.begin())->metadata());
|
||||
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) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
|
||||
#include "ResourcePackPage.h"
|
||||
|
||||
#include "ResourceDownloadTask.h"
|
||||
|
||||
#include "ui/dialogs/CustomMessageBox.h"
|
||||
#include "ui/dialogs/ProgressDialog.h"
|
||||
#include "ui/dialogs/ResourceDownloadDialog.h"
|
||||
@@ -88,8 +86,7 @@ void ResourcePackPage::downloadResourcePacks()
|
||||
|
||||
ResourceDownload::ResourcePackDownloadDialog mdownload(this, m_model, m_instance);
|
||||
if (mdownload.exec()) {
|
||||
auto tasks =
|
||||
new ConcurrentTask(this, "Download Resource Pack", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
auto tasks = new ConcurrentTask("Download Resource Pack", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
@@ -168,8 +165,7 @@ void ResourcePackPage::updateResourcePacks()
|
||||
}
|
||||
|
||||
if (update_dialog.exec()) {
|
||||
auto tasks =
|
||||
new ConcurrentTask(this, "Download Resource Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
auto tasks = new ConcurrentTask("Download Resource Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
@@ -234,7 +230,7 @@ void ResourcePackPage::changeResourcePackVersion()
|
||||
if (rows.count() != 1)
|
||||
return;
|
||||
|
||||
Resource &resource = m_model->at(m_filterModel->mapToSource(rows[0]).row());
|
||||
Resource& resource = m_model->at(m_filterModel->mapToSource(rows[0]).row());
|
||||
|
||||
if (resource.metadata() == nullptr)
|
||||
return;
|
||||
@@ -242,8 +238,7 @@ void ResourcePackPage::changeResourcePackVersion()
|
||||
ResourceDownload::ResourcePackDownloadDialog mdownload(this, m_model, m_instance);
|
||||
mdownload.setResourceMetadata(resource.metadata());
|
||||
if (mdownload.exec()) {
|
||||
auto tasks =
|
||||
new ConcurrentTask(this, "Download Resource Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
auto tasks = new ConcurrentTask("Download Resource Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
|
||||
@@ -83,7 +83,7 @@ void ShaderPackPage::downloadShaderPack()
|
||||
|
||||
ResourceDownload::ShaderPackDownloadDialog mdownload(this, m_model, m_instance);
|
||||
if (mdownload.exec()) {
|
||||
auto tasks = new ConcurrentTask(this, "Download Shader Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
auto tasks = new ConcurrentTask("Download Shader Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
@@ -162,7 +162,7 @@ void ShaderPackPage::updateShaderPacks()
|
||||
}
|
||||
|
||||
if (update_dialog.exec()) {
|
||||
auto tasks = new ConcurrentTask(this, "Download Shader Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
auto tasks = new ConcurrentTask("Download Shader Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
@@ -227,7 +227,7 @@ void ShaderPackPage::changeShaderPackVersion()
|
||||
if (rows.count() != 1)
|
||||
return;
|
||||
|
||||
Resource &resource = m_model->at(m_filterModel->mapToSource(rows[0]).row());
|
||||
Resource& resource = m_model->at(m_filterModel->mapToSource(rows[0]).row());
|
||||
|
||||
if (resource.metadata() == nullptr)
|
||||
return;
|
||||
@@ -235,8 +235,7 @@ void ShaderPackPage::changeShaderPackVersion()
|
||||
ResourceDownload::ShaderPackDownloadDialog mdownload(this, m_model, m_instance);
|
||||
mdownload.setResourceMetadata(resource.metadata());
|
||||
if (mdownload.exec()) {
|
||||
auto tasks =
|
||||
new ConcurrentTask(this, "Download Shader Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
auto tasks = new ConcurrentTask("Download Shader Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
|
||||
@@ -92,8 +92,7 @@ void TexturePackPage::downloadTexturePacks()
|
||||
|
||||
ResourceDownload::TexturePackDownloadDialog mdownload(this, m_model, m_instance);
|
||||
if (mdownload.exec()) {
|
||||
auto tasks =
|
||||
new ConcurrentTask(this, "Download Texture Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
auto tasks = new ConcurrentTask("Download Texture Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
@@ -172,8 +171,7 @@ void TexturePackPage::updateTexturePacks()
|
||||
}
|
||||
|
||||
if (update_dialog.exec()) {
|
||||
auto tasks =
|
||||
new ConcurrentTask(this, "Download Texture Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
auto tasks = new ConcurrentTask("Download Texture Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
@@ -223,7 +221,8 @@ void TexturePackPage::deleteTexturePackMetadata()
|
||||
m_model->deleteMetadata(selection);
|
||||
}
|
||||
|
||||
void TexturePackPage::changeTexturePackVersion() {
|
||||
void TexturePackPage::changeTexturePackVersion()
|
||||
{
|
||||
if (m_instance->typeName() != "Minecraft")
|
||||
return; // this is a null instance or a legacy instance
|
||||
|
||||
@@ -237,7 +236,7 @@ void TexturePackPage::changeTexturePackVersion() {
|
||||
if (rows.count() != 1)
|
||||
return;
|
||||
|
||||
Resource &resource = m_model->at(m_filterModel->mapToSource(rows[0]).row());
|
||||
Resource& resource = m_model->at(m_filterModel->mapToSource(rows[0]).row());
|
||||
|
||||
if (resource.metadata() == nullptr)
|
||||
return;
|
||||
@@ -245,8 +244,7 @@ void TexturePackPage::changeTexturePackVersion() {
|
||||
ResourceDownload::TexturePackDownloadDialog mdownload(this, m_model, m_instance);
|
||||
mdownload.setResourceMetadata(resource.metadata());
|
||||
if (mdownload.exec()) {
|
||||
auto tasks =
|
||||
new ConcurrentTask(this, "Download Texture Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
auto tasks = new ConcurrentTask("Download Texture Packs", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
connect(tasks, &Task::failed, [this, tasks](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
tasks->deleteLater();
|
||||
|
||||
@@ -435,7 +435,7 @@ void VersionPage::on_actionDownload_All_triggered()
|
||||
if (updateTasks.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
auto task = makeShared<SequentialTask>(this);
|
||||
auto task = makeShared<SequentialTask>();
|
||||
for (auto t : updateTasks) {
|
||||
task->addTask(t);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user