feat: implement job service
Log:
This commit is contained in:
parent
eac09c2cca
commit
fdf01923db
@ -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>
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user