feat: implement job service
Log:
This commit is contained in:
parent
eac09c2cca
commit
fdf01923db
@ -5,8 +5,8 @@
|
||||
<annotation
|
||||
name="org.freedesktop.DBus.Description"
|
||||
value="Value of `Status` is one of
|
||||
`pending`, `working`, `done`,
|
||||
`pasuing`, `paused`, `resuming`,
|
||||
`started`, `running`, `finished`,
|
||||
`suspending`, `suspend`,
|
||||
`canceled` and `failed`."
|
||||
/>
|
||||
</property>
|
||||
|
@ -13,21 +13,32 @@ JobService::~JobService() {}
|
||||
|
||||
QString JobService::status() const
|
||||
{
|
||||
// TODO: impl
|
||||
return {};
|
||||
if (job.isFinished())
|
||||
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()
|
||||
{
|
||||
// TODO: impl
|
||||
job.cancel();
|
||||
}
|
||||
|
||||
void JobService::Pause()
|
||||
{
|
||||
// TODO: impl
|
||||
job.suspend();
|
||||
}
|
||||
|
||||
void JobService::Resume()
|
||||
{
|
||||
// TODO: impl
|
||||
job.resume();
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
#define JOBSERVICE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QFuture>
|
||||
#include <QVariant>
|
||||
|
||||
class JobService : public QObject
|
||||
{
|
||||
@ -22,6 +24,9 @@ public Q_SLOTS:
|
||||
void Cancel();
|
||||
void Pause();
|
||||
void Resume();
|
||||
|
||||
private:
|
||||
QFuture<QVariant> job;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user