Scribus
Open source desktop publishing at your fingertips
deferredtask.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #ifndef _DEFERREDTASK_H
8 #define _DEFERREDTASK_H
9 
10 #include <QObject>
11 #include <QString>
12 #include "scribusapi.h"
13 
14 class QTimer;
15 
37 class SCRIBUS_API DeferredTask : public QObject
38 {
39  Q_OBJECT
40 
41 public:
44  virtual ~DeferredTask();
45 
48  bool isFinished() const;
49 
53  virtual const QString& lastError() const;
54 
55 public slots:
56 
60  virtual void start();
61 
66  void runUntilFinished();
67 
72  virtual void cancel();
73 
74 signals:
78  void aborted(bool);
79 
83  void finished();
84 
90  void progress(int);
91 
92 protected slots:
96  virtual void next() = 0;
97 
98 protected:
102  DeferredTask(QObject* parent);
103 
105  QString m_lastError;
106 
108  void init();
109 
111  void cleanup();
112 
117  void done();
118 
119 private:
122  int m_status;
123 
125  QTimer* m_timer;
126 };
127 
128 #endif
QString m_lastError
Human readable, translated version of last error encountered.
Definition: deferredtask.h:105
DeferredTask is an abstraction of a generally long-running operation that is done in small steps unde...
Definition: deferredtask.h:37