From 7e3592bee891e78c9d42dcd84bc9c1ac7a3e7688 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 6 May 2013 17:19:20 -0500 Subject: Made the version list load in the background on startup. Resolves JIRA issue MMC-11: https://jira.forkk.net/browse/MMC-11 --- libmultimc/include/task.h | 17 +++++++++++++++-- libmultimc/src/task.cpp | 30 ++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 6 deletions(-) (limited to 'libmultimc') diff --git a/libmultimc/include/task.h b/libmultimc/include/task.h index fc5b1d25..c8c12c02 100644 --- a/libmultimc/include/task.h +++ b/libmultimc/include/task.h @@ -48,8 +48,15 @@ public slots: void setProgress(int progress); signals: - void taskStarted(Task* task); - void taskEnded(Task* task); + void started(Task* task); + void ended(Task* task); + + void started(); + void ended(); + + + void statusChanged(Task* task, const QString& status); + void progressChanged(Task* task, int progress); void statusChanged(const QString& status); void progressChanged(int progress); @@ -58,6 +65,12 @@ protected: virtual void run(); virtual void executeTask() = 0; + virtual void emitStarted(); + virtual void emitEnded(); + + virtual void emitStatusChange(const QString &status); + virtual void emitProgressChange(int progress); + QString status; int progress; }; diff --git a/libmultimc/src/task.cpp b/libmultimc/src/task.cpp index 3e30827b..780c3b38 100644 --- a/libmultimc/src/task.cpp +++ b/libmultimc/src/task.cpp @@ -29,7 +29,7 @@ QString Task::getStatus() const void Task::setStatus(const QString &status) { this->status = status; - emit statusChanged(status); + emitStatusChange(status); } int Task::getProgress() const @@ -45,7 +45,7 @@ void Task::calcProgress(int parts, int whole) void Task::setProgress(int progress) { this->progress = progress; - emit progressChanged(progress); + emitProgressChange(progress); } void Task::startTask() @@ -55,7 +55,29 @@ void Task::startTask() void Task::run() { - emit taskStarted(this); + emitStarted(); executeTask(); - emit taskEnded(this); + emitEnded(); +} + +void Task::emitStarted() +{ + emit started(); + emit started(this); +} + +void Task::emitEnded() +{ + emit ended(); + emit ended(this); +} + +void Task::emitStatusChange(const QString &status) +{ + emit statusChanged(status); +} + +void Task::emitProgressChange(int progress) +{ + emit progressChanged(progress); } -- cgit v1.2.3