summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/dialogs/LoginDialog.cpp8
-rw-r--r--application/dialogs/ProgressDialog.cpp4
-rw-r--r--application/dialogs/ProgressDialog.h10
-rw-r--r--application/pages/InstanceSettingsPage.h1
-rw-r--r--application/pages/LegacyUpgradePage.h1
-rw-r--r--application/pages/LogPage.h1
-rw-r--r--application/pages/ModFolderPage.h1
-rw-r--r--application/pages/NotesPage.h1
-rw-r--r--application/pages/VersionPage.h2
-rw-r--r--logic/BaseInstaller.h4
-rw-r--r--logic/CMakeLists.txt1
-rw-r--r--logic/forge/ForgeInstaller.cpp6
-rw-r--r--logic/forge/ForgeInstaller.h2
-rw-r--r--logic/java/JavaCheckerJob.cpp2
-rw-r--r--logic/java/JavaCheckerJob.h20
-rw-r--r--logic/java/JavaVersionList.cpp4
-rw-r--r--logic/java/JavaVersionList.h2
-rw-r--r--logic/liteloader/LiteLoaderInstaller.cpp2
-rw-r--r--logic/liteloader/LiteLoaderInstaller.h2
-rw-r--r--logic/minecraft/OneSixUpdate.cpp26
-rw-r--r--logic/minecraft/OneSixUpdate.h8
-rw-r--r--logic/news/NewsChecker.cpp6
-rw-r--r--logic/news/NewsChecker.h8
-rw-r--r--logic/status/StatusChecker.cpp4
-rw-r--r--logic/status/StatusChecker.h2
-rw-r--r--logic/tasks/ProgressProvider.h41
-rw-r--r--logic/tasks/SequentialTask.cpp6
-rw-r--r--logic/tasks/SequentialTask.h4
-rw-r--r--logic/tasks/Task.cpp2
-rw-r--r--logic/tasks/Task.h10
-rw-r--r--logic/trans/TranslationDownloader.cpp8
-rw-r--r--logic/trans/TranslationDownloader.h4
32 files changed, 80 insertions, 123 deletions
diff --git a/application/dialogs/LoginDialog.cpp b/application/dialogs/LoginDialog.cpp
index 3af5c702..7e0f7df8 100644
--- a/application/dialogs/LoginDialog.cpp
+++ b/application/dialogs/LoginDialog.cpp
@@ -44,11 +44,11 @@ void LoginDialog::accept()
// Setup the login task and start it
m_account = MojangAccount::createFromUsername(ui->userTextBox->text());
m_loginTask = m_account->login(nullptr, ui->passTextBox->text());
- connect(m_loginTask.get(), &ProgressProvider::failed, this, &LoginDialog::onTaskFailed);
- connect(m_loginTask.get(), &ProgressProvider::succeeded, this,
+ connect(m_loginTask.get(), &Task::failed, this, &LoginDialog::onTaskFailed);
+ connect(m_loginTask.get(), &Task::succeeded, this,
&LoginDialog::onTaskSucceeded);
- connect(m_loginTask.get(), &ProgressProvider::status, this, &LoginDialog::onTaskStatus);
- connect(m_loginTask.get(), &ProgressProvider::progress, this, &LoginDialog::onTaskProgress);
+ connect(m_loginTask.get(), &Task::status, this, &LoginDialog::onTaskStatus);
+ connect(m_loginTask.get(), &Task::progress, this, &LoginDialog::onTaskProgress);
m_loginTask->start();
}
diff --git a/application/dialogs/ProgressDialog.cpp b/application/dialogs/ProgressDialog.cpp
index 61ebaa28..9a437d7a 100644
--- a/application/dialogs/ProgressDialog.cpp
+++ b/application/dialogs/ProgressDialog.cpp
@@ -54,7 +54,7 @@ void ProgressDialog::updateSize()
resize(QSize(480, minimumSizeHint().height()));
}
-int ProgressDialog::exec(ProgressProvider *task)
+int ProgressDialog::exec(Task *task)
{
this->task = task;
@@ -74,7 +74,7 @@ int ProgressDialog::exec(ProgressProvider *task)
return QDialog::Accepted;
}
-ProgressProvider *ProgressDialog::getTask()
+Task *ProgressDialog::getTask()
{
return task;
}
diff --git a/application/dialogs/ProgressDialog.h b/application/dialogs/ProgressDialog.h
index d5153680..fb80d0ce 100644
--- a/application/dialogs/ProgressDialog.h
+++ b/application/dialogs/ProgressDialog.h
@@ -17,7 +17,7 @@
#include <QDialog>
-class ProgressProvider;
+class Task;
namespace Ui
{
@@ -34,11 +34,11 @@ public:
void updateSize();
- int exec(ProgressProvider *task);
+ int exec(Task *task);
void setSkipButton(bool present, QString label = QString());
- ProgressProvider *getTask();
+ Task *getTask();
public
slots:
@@ -49,7 +49,7 @@ slots:
void changeStatus(const QString &status);
void changeProgress(qint64 current, qint64 total);
-
+
private
slots:
void on_skipButton_clicked(bool checked);
@@ -61,5 +61,5 @@ protected:
private:
Ui::ProgressDialog *ui;
- ProgressProvider *task;
+ Task *task;
};
diff --git a/application/pages/InstanceSettingsPage.h b/application/pages/InstanceSettingsPage.h
index 85df5880..60cc1898 100644
--- a/application/pages/InstanceSettingsPage.h
+++ b/application/pages/InstanceSettingsPage.h
@@ -17,7 +17,6 @@
#include <QWidget>
-#include "net/NetJob.h"
#include "java/JavaChecker.h"
#include "BaseInstance.h"
#include "BasePage.h"
diff --git a/application/pages/LegacyUpgradePage.h b/application/pages/LegacyUpgradePage.h
index 108b1024..f39bff95 100644
--- a/application/pages/LegacyUpgradePage.h
+++ b/application/pages/LegacyUpgradePage.h
@@ -18,7 +18,6 @@
#include <QWidget>
#include "minecraft/OneSixInstance.h"
-#include "net/NetJob.h"
#include "pages/BasePage.h"
#include <MultiMC.h>
diff --git a/application/pages/LogPage.h b/application/pages/LogPage.h
index fe7bbecb..e28c9690 100644
--- a/application/pages/LogPage.h
+++ b/application/pages/LogPage.h
@@ -18,7 +18,6 @@
#include <QWidget>
#include "BaseInstance.h"
-#include "net/NetJob.h"
#include "BaseProcess.h"
#include "BasePage.h"
#include <MultiMC.h>
diff --git a/application/pages/ModFolderPage.h b/application/pages/ModFolderPage.h
index 4e89f85f..864125be 100644
--- a/application/pages/ModFolderPage.h
+++ b/application/pages/ModFolderPage.h
@@ -18,7 +18,6 @@
#include <QWidget>
#include "minecraft/OneSixInstance.h"
-#include "net/NetJob.h"
#include "BasePage.h"
#include <MultiMC.h>
diff --git a/application/pages/NotesPage.h b/application/pages/NotesPage.h
index 62e0c692..e9e5aa48 100644
--- a/application/pages/NotesPage.h
+++ b/application/pages/NotesPage.h
@@ -18,7 +18,6 @@
#include <QWidget>
#include "BaseInstance.h"
-#include "net/NetJob.h"
#include "BasePage.h"
#include <MultiMC.h>
diff --git a/application/pages/VersionPage.h b/application/pages/VersionPage.h
index 587fcf07..d115d8f8 100644
--- a/application/pages/VersionPage.h
+++ b/application/pages/VersionPage.h
@@ -18,7 +18,6 @@
#include <QWidget>
#include "minecraft/OneSixInstance.h"
-#include "net/NetJob.h"
#include "BasePage.h"
namespace Ui
@@ -72,7 +71,6 @@ private:
Ui::VersionPage *ui;
std::shared_ptr<MinecraftProfile> m_version;
OneSixInstance *m_inst;
- NetJobPtr forgeJob;
public
slots:
diff --git a/logic/BaseInstaller.h b/logic/BaseInstaller.h
index 2d71a799..d4f43beb 100644
--- a/logic/BaseInstaller.h
+++ b/logic/BaseInstaller.h
@@ -21,7 +21,7 @@ class OneSixInstance;
class QDir;
class QString;
class QObject;
-class ProgressProvider;
+class Task;
struct BaseVersion;
typedef std::shared_ptr<BaseVersion> BaseVersionPtr;
@@ -35,7 +35,7 @@ public:
virtual bool add(OneSixInstance *to);
virtual bool remove(OneSixInstance *from);
- virtual ProgressProvider *createInstallTask(OneSixInstance *instance, BaseVersionPtr version, QObject *parent) = 0;
+ virtual Task *createInstallTask(OneSixInstance *instance, BaseVersionPtr version, QObject *parent) = 0;
protected:
virtual QString id() const = 0;
diff --git a/logic/CMakeLists.txt b/logic/CMakeLists.txt
index 6389159e..3cea50ab 100644
--- a/logic/CMakeLists.txt
+++ b/logic/CMakeLists.txt
@@ -177,7 +177,6 @@ SET(LOGIC_SOURCES
icons/IconList.cpp
# Tasks
- tasks/ProgressProvider.h
tasks/Task.h
tasks/Task.cpp
tasks/ThreadTask.h
diff --git a/logic/forge/ForgeInstaller.cpp b/logic/forge/ForgeInstaller.cpp
index ee68069b..47e0f1e9 100644
--- a/logic/forge/ForgeInstaller.cpp
+++ b/logic/forge/ForgeInstaller.cpp
@@ -384,8 +384,8 @@ protected:
{ setProgress(100 * current / qMax((qint64)1, total)); });
connect(fjob, &NetJob::status, [this](const QString & msg)
{ setStatus(msg); });
- connect(fjob, &NetJob::failed, [this]()
- { emitFailed(tr("Failure to download forge")); });
+ connect(fjob, &NetJob::failed, [this](QString reason)
+ { emitFailed(tr("Failure to download forge:\n%1").arg(reason)); });
connect(fjob, &NetJob::succeeded, installFunction);
fjob->start();
}
@@ -428,7 +428,7 @@ private:
BaseVersionPtr m_version;
};
-ProgressProvider *ForgeInstaller::createInstallTask(OneSixInstance *instance,
+Task *ForgeInstaller::createInstallTask(OneSixInstance *instance,
BaseVersionPtr version, QObject *parent)
{
if (!version)
diff --git a/logic/forge/ForgeInstaller.h b/logic/forge/ForgeInstaller.h
index 1b31d39f..ae30177f 100644
--- a/logic/forge/ForgeInstaller.h
+++ b/logic/forge/ForgeInstaller.h
@@ -30,7 +30,7 @@ class ForgeInstaller : public BaseInstaller
public:
ForgeInstaller();
virtual ~ForgeInstaller(){}
- virtual ProgressProvider *createInstallTask(OneSixInstance *instance, BaseVersionPtr version, QObject *parent) override;
+ virtual Task *createInstallTask(OneSixInstance *instance, BaseVersionPtr version, QObject *parent) override;
virtual QString id() const override { return "net.minecraftforge"; }
protected:
diff --git a/logic/java/JavaCheckerJob.cpp b/logic/java/JavaCheckerJob.cpp
index 149024c0..bf4271c2 100644
--- a/logic/java/JavaCheckerJob.cpp
+++ b/logic/java/JavaCheckerJob.cpp
@@ -33,7 +33,7 @@ void JavaCheckerJob::partFinished(JavaCheckResult result)
}
}
-void JavaCheckerJob::start()
+void JavaCheckerJob::executeTask()
{
qDebug() << m_job_name.toLocal8Bit() << " started.";
m_running = true;
diff --git a/logic/java/JavaCheckerJob.h b/logic/java/JavaCheckerJob.h
index a98d88cd..84b6fc6f 100644
--- a/logic/java/JavaCheckerJob.h
+++ b/logic/java/JavaCheckerJob.h
@@ -18,16 +18,16 @@
#include <QtNetwork>
#include <QLabel>
#include "JavaChecker.h"
-#include "tasks/ProgressProvider.h"
+#include "tasks/Task.h"
class JavaCheckerJob;
typedef std::shared_ptr<JavaCheckerJob> JavaCheckerJobPtr;
-class JavaCheckerJob : public ProgressProvider
+class JavaCheckerJob : public Task
{
Q_OBJECT
public:
- explicit JavaCheckerJob(QString job_name) : ProgressProvider(), m_job_name(job_name) {};
+ explicit JavaCheckerJob(QString job_name) : Task(), m_job_name(job_name) {};
bool addJavaCheckerAction(JavaCheckerPtr base)
{
@@ -66,17 +66,17 @@ public:
signals:
void started();
- void progress(int current, int total);
void finished(QList<JavaCheckResult>);
-public
-slots:
- virtual void start();
- // FIXME: implement
+
+public slots:
virtual void abort() {};
-private
-slots:
+
+private slots:
void partFinished(JavaCheckResult result);
+protected:
+ virtual void executeTask() override;
+
private:
QString m_job_name;
QList<JavaCheckerPtr> javacheckers;
diff --git a/logic/java/JavaVersionList.cpp b/logic/java/JavaVersionList.cpp
index bb5f025f..72fa6dc8 100644
--- a/logic/java/JavaVersionList.cpp
+++ b/logic/java/JavaVersionList.cpp
@@ -178,7 +178,7 @@ void JavaListLoadTask::executeTask()
m_job = std::shared_ptr<JavaCheckerJob>(new JavaCheckerJob("Java detection"));
connect(m_job.get(), SIGNAL(finished(QList<JavaCheckResult>)), this, SLOT(javaCheckerFinished(QList<JavaCheckResult>)));
- connect(m_job.get(), SIGNAL(progress(int, int)), this, SLOT(checkerProgress(int, int)));
+ connect(m_job.get(), SIGNAL(progress(qint64,qint64)), this, SLOT(checkerProgress(qint64, qint64)));
qDebug() << "Probing the following Java paths: ";
int id = 0;
@@ -197,7 +197,7 @@ void JavaListLoadTask::executeTask()
m_job->start();
}
-void JavaListLoadTask::checkerProgress(int current, int total)
+void JavaListLoadTask::checkerProgress(qint64 current, qint64 total)
{
float progress = (current * 100.0) / total;
this->setProgress((int) progress);
diff --git a/logic/java/JavaVersionList.h b/logic/java/JavaVersionList.h
index 820bd5a6..0117ea76 100644
--- a/logic/java/JavaVersionList.h
+++ b/logic/java/JavaVersionList.h
@@ -87,7 +87,7 @@ public:
virtual void executeTask();
public slots:
void javaCheckerFinished(QList<JavaCheckResult> results);
- void checkerProgress(int current, int total);
+ void checkerProgress(qint64 current, qint64 total);
protected:
std::shared_ptr<JavaCheckerJob> m_job;
diff --git a/logic/liteloader/LiteLoaderInstaller.cpp b/logic/liteloader/LiteLoaderInstaller.cpp
index ab802380..9a06d620 100644
--- a/logic/liteloader/LiteLoaderInstaller.cpp
+++ b/logic/liteloader/LiteLoaderInstaller.cpp
@@ -136,7 +136,7 @@ private:
BaseVersionPtr m_version;
};
-ProgressProvider *LiteLoaderInstaller::createInstallTask(OneSixInstance *instance,
+Task *LiteLoaderInstaller::createInstallTask(OneSixInstance *instance,
BaseVersionPtr version,
QObject *parent)
{
diff --git a/logic/liteloader/LiteLoaderInstaller.h b/logic/liteloader/LiteLoaderInstaller.h
index 51d58706..490d2107 100644
--- a/logic/liteloader/LiteLoaderInstaller.h
+++ b/logic/liteloader/LiteLoaderInstaller.h
@@ -30,7 +30,7 @@ public:
bool add(OneSixInstance *to) override;
virtual QString id() const override { return "com.mumfrey.liteloader"; }
- ProgressProvider *createInstallTask(OneSixInstance *instance, BaseVersionPtr version, QObject *parent) override;
+ Task *createInstallTask(OneSixInstance *instance, BaseVersionPtr version, QObject *parent) override;
private:
LiteLoaderVersionPtr m_version;
diff --git a/logic/minecraft/OneSixUpdate.cpp b/logic/minecraft/OneSixUpdate.cpp
index 8a7a1f66..8db0c68f 100644
--- a/logic/minecraft/OneSixUpdate.cpp
+++ b/logic/minecraft/OneSixUpdate.cpp
@@ -72,7 +72,7 @@ void OneSixUpdate::executeTask()
return;
}
connect(versionUpdateTask.get(), SIGNAL(succeeded()), SLOT(jarlibStart()));
- connect(versionUpdateTask.get(), SIGNAL(failed(QString)), SLOT(versionUpdateFailed(QString)));
+ connect(versionUpdateTask.get(), &NetJob::failed, this, &OneSixUpdate::versionUpdateFailed);
connect(versionUpdateTask.get(), SIGNAL(progress(qint64, qint64)),
SIGNAL(progress(qint64, qint64)));
setStatus(tr("Getting the version files from Mojang..."));
@@ -100,7 +100,7 @@ void OneSixUpdate::assetIndexStart()
jarlibDownloadJob.reset(job);
connect(jarlibDownloadJob.get(), SIGNAL(succeeded()), SLOT(assetIndexFinished()));
- connect(jarlibDownloadJob.get(), SIGNAL(failed()), SLOT(assetIndexFailed()));
+ connect(jarlibDownloadJob.get(), &NetJob::failed, this, &OneSixUpdate::assetIndexFailed);
connect(jarlibDownloadJob.get(), SIGNAL(progress(qint64, qint64)),
SIGNAL(progress(qint64, qint64)));
@@ -146,7 +146,7 @@ void OneSixUpdate::assetIndexFinished()
job->addNetAction(dl);
jarlibDownloadJob.reset(job);
connect(jarlibDownloadJob.get(), SIGNAL(succeeded()), SLOT(assetsFinished()));
- connect(jarlibDownloadJob.get(), SIGNAL(failed()), SLOT(assetsFailed()));
+ connect(jarlibDownloadJob.get(), &NetJob::failed, this, &OneSixUpdate::assetsFailed);
connect(jarlibDownloadJob.get(), SIGNAL(progress(qint64, qint64)),
SIGNAL(progress(qint64, qint64)));
jarlibDownloadJob->start();
@@ -155,9 +155,9 @@ void OneSixUpdate::assetIndexFinished()
assetsFinished();
}
-void OneSixUpdate::assetIndexFailed()
+void OneSixUpdate::assetIndexFailed(QString reason)
{
- emitFailed(tr("Failed to download the assets index!"));
+ emitFailed(tr("Failed to download the assets index:\n%1").arg(reason));
}
void OneSixUpdate::assetsFinished()
@@ -165,9 +165,9 @@ void OneSixUpdate::assetsFinished()
emitSucceeded();
}
-void OneSixUpdate::assetsFailed()
+void OneSixUpdate::assetsFailed(QString reason)
{
- emitFailed(tr("Failed to download assets!"));
+ emitFailed(tr("Failed to download assets:\n%1").arg(reason));
}
void OneSixUpdate::jarlibStart()
@@ -280,7 +280,7 @@ void OneSixUpdate::jarlibStart()
}
connect(jarlibDownloadJob.get(), SIGNAL(succeeded()), SLOT(jarlibFinished()));
- connect(jarlibDownloadJob.get(), SIGNAL(failed()), SLOT(jarlibFailed()));
+ connect(jarlibDownloadJob.get(), &NetJob::failed, this, &OneSixUpdate::jarlibFailed);
connect(jarlibDownloadJob.get(), SIGNAL(progress(qint64, qint64)),
SIGNAL(progress(qint64, qint64)));
@@ -336,12 +336,12 @@ void OneSixUpdate::jarlibFinished()
}
}
-void OneSixUpdate::jarlibFailed()
+void OneSixUpdate::jarlibFailed(QString reason)
{
QStringList failed = jarlibDownloadJob->getFailedFiles();
QString failed_all = failed.join("\n");
emitFailed(
- tr("Failed to download the following files:\n%1\n\nPlease try again.").arg(failed_all));
+ tr("Failed to download the following files:\n%1\n\nReason:%2\nPlease try again.").arg(failed_all, reason));
}
void OneSixUpdate::fmllibsStart()
@@ -400,7 +400,7 @@ void OneSixUpdate::fmllibsStart()
}
connect(dljob, SIGNAL(succeeded()), SLOT(fmllibsFinished()));
- connect(dljob, SIGNAL(failed()), SLOT(fmllibsFailed()));
+ connect(dljob, &NetJob::failed, this, &OneSixUpdate::fmllibsFailed);
connect(dljob, SIGNAL(progress(qint64, qint64)), SIGNAL(progress(qint64, qint64)));
legacyDownloadJob.reset(dljob);
legacyDownloadJob->start();
@@ -437,9 +437,9 @@ void OneSixUpdate::fmllibsFinished()
assetIndexStart();
}
-void OneSixUpdate::fmllibsFailed()
+void OneSixUpdate::fmllibsFailed(QString reason)
{
- emitFailed("Game update failed: it was impossible to fetch the required FML libraries.");
+ emitFailed(tr("Game update failed: it was impossible to fetch the required FML libraries.\nReason:\n%1").arg(reason));
return;
}
diff --git a/logic/minecraft/OneSixUpdate.h b/logic/minecraft/OneSixUpdate.h
index c8c3b03f..6901e3d6 100644
--- a/logic/minecraft/OneSixUpdate.h
+++ b/logic/minecraft/OneSixUpdate.h
@@ -40,18 +40,18 @@ slots:
void jarlibStart();
void jarlibFinished();
- void jarlibFailed();
+ void jarlibFailed(QString reason);
void fmllibsStart();
void fmllibsFinished();
- void fmllibsFailed();
+ void fmllibsFailed(QString reason);
void assetIndexStart();
void assetIndexFinished();
- void assetIndexFailed();
+ void assetIndexFailed(QString reason);
void assetsFinished();
- void assetsFailed();
+ void assetsFailed(QString reason);
private:
NetJobPtr jarlibDownloadJob;
diff --git a/logic/news/NewsChecker.cpp b/logic/news/NewsChecker.cpp
index 39796e36..be4aa1d1 100644
--- a/logic/news/NewsChecker.cpp
+++ b/logic/news/NewsChecker.cpp
@@ -33,7 +33,7 @@ void NewsChecker::reloadNews()
qDebug() << "Ignored request to reload news. Currently reloading already.";
return;
}
-
+
qDebug() << "Reloading news.";
NetJob* job = new NetJob("News RSS Feed");
@@ -95,10 +95,10 @@ void NewsChecker::rssDownloadFinished()
succeed();
}
-void NewsChecker::rssDownloadFailed()
+void NewsChecker::rssDownloadFailed(QString reason)
{
// Set an error message and fail.
- fail("Failed to load news RSS feed.");
+ fail(tr("Failed to load news RSS feed:\n%1").arg(reason));
}
diff --git a/logic/news/NewsChecker.h b/logic/news/NewsChecker.h
index 3a0f9ec8..effa80bf 100644
--- a/logic/news/NewsChecker.h
+++ b/logic/news/NewsChecker.h
@@ -31,7 +31,7 @@ public:
* Constructs a news reader to read from the given RSS feed URL.
*/
NewsChecker(const QString& feedUrl);
-
+
/*!
* Returns the error message for the last time the news was loaded.
* Empty string if the last load was successful.
@@ -42,7 +42,7 @@ public:
* Returns true if the news has been loaded successfully.
*/
bool isNewsLoaded() const;
-
+
//! True if the news is currently loading. If true, reloadNews() will do nothing.
bool isLoadingNews() const;
@@ -70,7 +70,7 @@ signals:
protected slots:
void rssDownloadFinished();
- void rssDownloadFailed();
+ void rssDownloadFailed(QString reason);
protected:
//! The URL for the RSS feed to fetch.
@@ -91,7 +91,7 @@ protected:
*/
QString m_lastLoadError;
-
+
/*!
* Emits newsLoaded() and sets m_lastLoadError to empty string.
*/
diff --git a/logic/status/StatusChecker.cpp b/logic/status/StatusChecker.cpp
index 5e6cc612..13cac037 100644
--- a/logic/status/StatusChecker.cpp
+++ b/logic/status/StatusChecker.cpp
@@ -104,9 +104,9 @@ void StatusChecker::statusDownloadFinished()
succeed();
}
-void StatusChecker::statusDownloadFailed()
+void StatusChecker::statusDownloadFailed(QString reason)
{
- fail("Failed to load status JSON.");
+ fail(tr("Failed to load status JSON:\n%1").arg(reason));
}
diff --git a/logic/status/StatusChecker.h b/logic/status/StatusChecker.h
index 316066fe..28283eb3 100644
--- a/logic/status/StatusChecker.h
+++ b/logic/status/StatusChecker.h
@@ -44,7 +44,7 @@ signals:
protected slots:
void statusDownloadFinished();
- void statusDownloadFailed();
+ void statusDownloadFailed(QString reason);
protected:
QMap<QString, QString> m_prevEntries;
diff --git a/logic/tasks/ProgressProvider.h b/logic/tasks/ProgressProvider.h
deleted file mode 100644
index 57bfd5c8..00000000
--- a/logic/tasks/ProgressProvider.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright 2013-2015 MultiMC Contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <QObject>
-
-class ProgressProvider : public QObject
-{
- Q_OBJECT
-protected:
- explicit ProgressProvider(QObject *parent = 0) : QObject(parent)
- {
- }
-signals:
- void started();
- void progress(qint64 current, qint64 total);
- void succeeded();
- void failed(QString reason);
- void status(QString status);
-
-public:
- virtual ~ProgressProvider() {}
- virtual bool isRunning() const = 0;
-public
-slots:
- virtual void start() = 0;
- virtual void abort() = 0;
-};
diff --git a/logic/tasks/SequentialTask.cpp b/logic/tasks/SequentialTask.cpp
index e08206f8..f744d273 100644
--- a/logic/tasks/SequentialTask.cpp
+++ b/logic/tasks/SequentialTask.cpp
@@ -4,7 +4,7 @@ SequentialTask::SequentialTask(QObject *parent) : Task(parent), m_currentIndex(-
{
}
-void SequentialTask::addTask(std::shared_ptr<ProgressProvider> task)
+void SequentialTask::addTask(std::shared_ptr<Task> task)
{
m_queue.append(task);
}
@@ -19,7 +19,7 @@ void SequentialTask::startNext()
{
if (m_currentIndex != -1)
{
- std::shared_ptr<ProgressProvider> previous = m_queue[m_currentIndex];
+ std::shared_ptr<Task> previous = m_queue[m_currentIndex];
disconnect(previous.get(), 0, this, 0);
}
m_currentIndex++;
@@ -28,7 +28,7 @@ void SequentialTask::startNext()
emitSucceeded();
return;
}
- std::shared_ptr<ProgressProvider> next = m_queue[m_currentIndex];
+ std::shared_ptr<Task> next = m_queue[m_currentIndex];
connect(next.get(), SIGNAL(failed(QString)), this, SLOT(subTaskFailed(QString)));
connect(next.get(), SIGNAL(status(QString)), this, SLOT(subTaskStatus(QString)));
connect(next.get(), SIGNAL(progress(qint64, qint64)), this, SLOT(subTaskProgress(qint64, qint64)));
diff --git a/logic/tasks/SequentialTask.h b/logic/tasks/SequentialTask.h
index f1fe9c72..1c90765c 100644
--- a/logic/tasks/SequentialTask.h
+++ b/logic/tasks/SequentialTask.h
@@ -11,7 +11,7 @@ class SequentialTask : public Task
public:
explicit SequentialTask(QObject *parent = 0);
- void addTask(std::shared_ptr<ProgressProvider> task);
+ void addTask(std::shared_ptr<Task> task);
protected:
void executeTask();
@@ -24,6 +24,6 @@ slots:
void subTaskProgress(qint64 current, qint64 total);
private:
- QQueue<std::shared_ptr<ProgressProvider> > m_queue;
+ QQueue<std::shared_ptr<Task> > m_queue;
int m_currentIndex;
};
diff --git a/logic/tasks/Task.cpp b/logic/tasks/Task.cpp
index 56f8bf01..150ea48d 100644
--- a/logic/tasks/Task.cpp
+++ b/logic/tasks/Task.cpp
@@ -16,7 +16,7 @@
#include "Task.h"
#include <QDebug>
-Task::Task(QObject *parent) : ProgressProvider(parent)
+Task::Task(QObject *parent) : QObject(parent)
{
}
diff --git a/logic/tasks/Task.h b/logic/tasks/Task.h
index 089a110b..746a2b26 100644
--- a/logic/tasks/Task.h
+++ b/logic/tasks/Task.h
@@ -17,9 +17,8 @@
#include <QObject>
#include <QString>
-#include "ProgressProvider.h"
-class Task : public ProgressProvider
+class Task : public QObject
{
Q_OBJECT
public:
@@ -40,6 +39,13 @@ public:
*/
virtual QString failReason() const;
+signals:
+ void started();
+ void progress(qint64 current, qint64 total);
+ void succeeded();
+ void failed(QString reason);
+ void status(QString status);
+
public
slots:
virtual void start();
diff --git a/logic/trans/TranslationDownloader.cpp b/logic/trans/TranslationDownloader.cpp
index ccc4d590..5a9cde12 100644
--- a/logic/trans/TranslationDownloader.cpp
+++ b/logic/trans/TranslationDownloader.cpp
@@ -39,15 +39,15 @@ void TranslationDownloader::indexRecieved()
connect(m_dl_job.get(), &NetJob::failed, this, &TranslationDownloader::dlFailed);
m_dl_job->start();
}
-void TranslationDownloader::dlFailed()
+void TranslationDownloader::dlFailed(QString reason)
{
- qCritical() << "Translations Download Failed!";
+ qCritical() << "Translations Download Failed:" << reason;
}
void TranslationDownloader::dlGood()
{
qDebug() << "Got translations!";
}
-void TranslationDownloader::indexFailed()
+void TranslationDownloader::indexFailed(QString reason)
{
- qCritical() << "Translations Index Download Failed!";
+ qCritical() << "Translations Index Download Failed:" << reason;
}
diff --git a/logic/trans/TranslationDownloader.h b/logic/trans/TranslationDownloader.h
index 6bcb223f..78e7fe1c 100644
--- a/logic/trans/TranslationDownloader.h
+++ b/logic/trans/TranslationDownloader.h
@@ -20,8 +20,8 @@ public:
private slots:
void indexRecieved();
- void indexFailed();
- void dlFailed();
+ void indexFailed(QString reason);
+ void dlFailed(QString reason);
void dlGood();
private: