feat: implement job service

Log:
This commit is contained in:
heyuming 2023-07-12 10:35:27 +08:00 committed by Comix
parent eac09c2cca
commit fdf01923db
3 changed files with 23 additions and 7 deletions

View File

@ -5,8 +5,8 @@
<annotation <annotation
name="org.freedesktop.DBus.Description" name="org.freedesktop.DBus.Description"
value="Value of `Status` is one of value="Value of `Status` is one of
`pending`, `working`, `done`, `started`, `running`, `finished`,
`pasuing`, `paused`, `resuming`, `suspending`, `suspend`,
`canceled` and `failed`." `canceled` and `failed`."
/> />
</property> </property>

View File

@ -13,21 +13,32 @@ JobService::~JobService() {}
QString JobService::status() const QString JobService::status() const
{ {
// TODO: impl if (job.isFinished())
return {}; return "finished";
if (job.isCanceled())
return "canceled";
if (job.isSuspended())
return "suspended";
if (job.isSuspending())
return "suspending";
if (job.isStarted())
return "started";
if (job.isRunning())
return "running";
return "failed";
} }
void JobService::Cancel() void JobService::Cancel()
{ {
// TODO: impl job.cancel();
} }
void JobService::Pause() void JobService::Pause()
{ {
// TODO: impl job.suspend();
} }
void JobService::Resume() void JobService::Resume()
{ {
// TODO: impl job.resume();
} }

View File

@ -6,6 +6,8 @@
#define JOBSERVICE_H #define JOBSERVICE_H
#include <QObject> #include <QObject>
#include <QFuture>
#include <QVariant>
class JobService : public QObject class JobService : public QObject
{ {
@ -22,6 +24,9 @@ public Q_SLOTS:
void Cancel(); void Cancel();
void Pause(); void Pause();
void Resume(); void Resume();
private:
QFuture<QVariant> job;
}; };
#endif #endif