Back to index

scribus-ng  1.3.4.dfsg+svn20071115
deferredtask.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #ifndef _DEFERREDTASK_H
00008 #define _DEFERREDTASK_H
00009 
00010 #include "qobject.h"
00011 #include "qstring.h"
00012 #include "scribusapi.h"
00013 
00014 class QTimer;
00015 
00037 class SCRIBUS_API DeferredTask : public QObject
00038 {
00039        Q_OBJECT
00040 
00041 public:
00044        virtual ~DeferredTask();
00045 
00048        bool isFinished() const;
00049 
00053        virtual const QString& lastError() const;
00054 
00055 public slots:
00056 
00060        virtual void start();
00061 
00066        void runUntilFinished();
00067 
00072        virtual void cancel();
00073 
00074 signals:
00078        void aborted(bool);
00079 
00083        void finished();
00084 
00090        void progress(int);
00091 
00092 protected slots:
00096        virtual void next() = 0;
00097 
00098 protected:
00102        DeferredTask(QObject* parent);
00103 
00105        QString m_lastError;
00106 
00108        void init();
00109 
00111        void cleanup();
00112 
00117        void done();
00118 
00119 private:
00122        int m_status;
00123 
00125        QTimer* m_timer;
00126 };
00127 
00128 #endif