00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef URPOJOB_H
00024 #define URPOJOB_H
00025
00026 #include <QObject>
00027
00028 #include "urpoprocess.h"
00029 class UrpoConnection;
00030
00040 class UrpoJob : public QObject
00041 {
00042 Q_OBJECT
00043 public:
00044 explicit UrpoJob(UrpoConnection* connection);
00045
00046
00047 enum JobStatus {
00048 Ready,
00049 Running,
00050 Successed,
00051 Failed,
00052 Cancelled
00053 };
00054
00059 JobStatus getStatus() const { return status_; }
00060
00061 signals:
00062 void debugMessage(QString message);
00066 void finished(bool successed, QString errorStr = QString());
00067
00068 public slots:
00070 void start() { startJob(); }
00072 void cancel() { cancelJob(); }
00073
00074
00075 protected:
00076 virtual void startJob() = 0;
00077 virtual void cancelJob() = 0;
00080 void finish(JobStatus status);
00084 void fail(QString errorString);
00086 UrpoConnection* getConnection() { return connection_; }
00087
00095 void sendDebugMessage(QString message);
00096
00098 UrpoProcess* newProcess();
00099
00101 void setStatus(JobStatus status) { status_ = status; }
00102
00103 private:
00104 UrpoConnection* connection_;
00105 JobStatus status_;
00106
00107 };
00108
00109 #endif // URPOJOB_H