1 /**************************************************************************
5 Unix Remote Printing Operation
6 Copyright (c) Arto Hyvättinen 2010
8 This file is part of URPO.
10 URPO is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
15 URPO is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
21 **************************************************************************/
28 #include "urpoprocess.h"
31 /*! Base class for jobs (abstract)
33 @author Arto Hyvättinen
40 class UrpoJob : public QObject
44 explicit UrpoJob(UrpoConnection* connection);
57 @return Job status (Ready, Running, Successed, Failed
59 JobStatus getStatus() const { return status_; }
62 void debugMessage(QString message);
63 /*! Job finished (successed of failed)
65 @param successed True if job successed, false if failed */
66 void finished(bool successed, QString errorStr = QString());
70 void start() { startJob(); }
72 void cancel() { cancelJob(); }
76 virtual void startJob() = 0;
77 virtual void cancelJob() = 0;
79 @arg status Job status (Successed, Failed, Cancelled) */
80 void finish(JobStatus status);
83 emit finished() with error status and message */
84 void fail(QString errorString);
85 /*! Get connection pointer */
86 UrpoConnection* getConnection() { return connection_; }
88 /*! Send debug message
90 @param message Message to debug monitor
92 If debug monitor has been connected, send message to debug monitor
95 void sendDebugMessage(QString message);
97 /*! Create new UrpoProcess */
98 UrpoProcess* newProcess();
100 /*! Set job status */
101 void setStatus(JobStatus status) { status_ = status; }
104 UrpoConnection* connection_;