From 59bbe67c490ba4e993dd332208fc8cbeeb933c71 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jan 2018 19:35:26 +0900 Subject: isJobRunning() facility function --- jobs/basejob.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'jobs') diff --git a/jobs/basejob.h b/jobs/basejob.h index e3a379fa..2f75c095 100644 --- a/jobs/basejob.h +++ b/jobs/basejob.h @@ -51,6 +51,7 @@ namespace QMatrixClient * (which BaseJob used to inherit from). */ enum StatusCode { NoError = 0 // To be compatible with Qt conventions , Success = 0 + , Pending = 1 , ErrorLevel = 100 // Errors have codes starting from this , NetworkError = 100 , JsonParseError @@ -279,4 +280,9 @@ namespace QMatrixClient class Private; QScopedPointer d; }; + + inline bool isJobRunning(BaseJob* job) + { + return job && job->error() == BaseJob::Pending; + } } // namespace QMatrixClient -- cgit v1.2.3 From 8fb9e3560ebf24ed6b697e3142a4fc7c6bd23393 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 9 Jan 2018 11:48:34 +0900 Subject: BaseJob: change initial job status from NoError to Pending Otherwise isJobRunning() is of no great use. --- jobs/basejob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'jobs') diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp index 8d116c26..9df3e430 100644 --- a/jobs/basejob.cpp +++ b/jobs/basejob.cpp @@ -65,7 +65,7 @@ class BaseJob::Private bool needsToken; QScopedPointer reply; - Status status = NoError; + Status status = Pending; QTimer timer; QTimer retryTimer; -- cgit v1.2.3