diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
commit | 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch) | |
tree | b95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/common/global/process.h | |
parent | b79a2c28534cf09987eeeba3077fff9236df182a (diff) | |
download | piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.tar.gz piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.zip |
TQt4 port piklab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/common/global/process.h')
-rw-r--r-- | src/common/global/process.h | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/src/common/global/process.h b/src/common/global/process.h index 9c67149..d4e7db0 100644 --- a/src/common/global/process.h +++ b/src/common/global/process.h @@ -10,9 +10,9 @@ #define PROCESS_H #include <signal.h> -#include <qstringlist.h> -#include <qobject.h> -#include <qtimer.h> +#include <tqstringlist.h> +#include <tqobject.h> +#include <tqtimer.h> class KProcess; #include "global.h" @@ -23,24 +23,25 @@ namespace Process enum State { Stopped, StartFailed, Running, Exited, Timedout }; class Base; enum RunAction { NoRunAction = 0, Start = 1 }; -Q_DECLARE_FLAGS(RunActions, RunAction) -Q_DECLARE_OPERATORS_FOR_FLAGS(RunActions) +TQ_DECLARE_FLAGS(RunActions, RunAction) +TQ_DECLARE_OPERATORS_FOR_FLAGS(RunActions) extern State runSynchronously(Base &process, RunActions actions, uint timeout); // in ms (0 == no timeout) //---------------------------------------------------------------------------- -class Base : public QObject +class Base : public TQObject { Q_OBJECT + TQ_OBJECT public: - Base(QObject *parent, const char *name); + Base(TQObject *tqparent, const char *name); virtual ~Base(); - void setup(const QString &executable, const QStringList &options, bool withWine); - QStringList arguments() const; + void setup(const TQString &executable, const TQStringList &options, bool withWine); + TQStringList arguments() const; void setWorkingDirectory(const PURL::Directory &dir); void setUseShell(bool useShell); virtual bool start(uint timeout); // in ms (0 == no timeout) - QString prettyCommand() const { return arguments().join(" "); } - void writeToStdin(const QString &s); + TQString prettyCommand() const { return arguments().join(" "); } + void writeToStdin(const TQString &s); bool signal(int n); bool isRunning() const; State state() const { return _state; } @@ -64,20 +65,21 @@ protected slots: protected: State _state; KProcess *_process; - QTimer *_timer; - QString _stdout, _stderr; + TQTimer *_timer; + TQString _stdout, _stderr; - static bool isFilteredLine(const QString &line); + static bool isFilteredLine(const TQString &line); }; //---------------------------------------------------------------------------- class StringOutput : public Base { Q_OBJECT + TQ_OBJECT public: - StringOutput(QObject *parent = 0, const char *name = 0) : Base(parent, name) {} - QString sout() const { return _stdout; } - QString serr() const { return _stderr; } + StringOutput(TQObject *tqparent = 0, const char *name = 0) : Base(tqparent, name) {} + TQString sout() const { return _stdout; } + TQString serr() const { return _stderr; } private slots: virtual void receivedStdout(KProcess *, char *buffer, int len); @@ -88,49 +90,52 @@ private slots: class LineBase : public Base { Q_OBJECT + TQ_OBJECT public: - LineBase(QObject *parent = 0, const char *name = 0) : Base(parent, name) {} + LineBase(TQObject *tqparent = 0, const char *name = 0) : Base(tqparent, name) {} private slots: virtual void receivedStdout(KProcess *, char *buffer, int len); virtual void receivedStderr(KProcess *, char *buffer, int len); private: - virtual void addStdoutLine(const QString &line) = 0; - virtual void addStderrLine(const QString &line) = 0; + virtual void addStdoutLine(const TQString &line) = 0; + virtual void addStderrLine(const TQString &line) = 0; }; //---------------------------------------------------------------------------- class LineOutput : public LineBase { Q_OBJECT + TQ_OBJECT public: - LineOutput(QObject *parent = 0, const char *name = 0) : LineBase(parent, name) {} + LineOutput(TQObject *tqparent = 0, const char *name = 0) : LineBase(tqparent, name) {} virtual bool start(uint timeout); - QStringList sout() const { return _stdoutLines; } - QStringList serr() const { return _stderrLines; } + TQStringList sout() const { return _stdoutLines; } + TQStringList serr() const { return _stderrLines; } protected: - QStringList _stdoutLines, _stderrLines; + TQStringList _stdoutLines, _stderrLines; - virtual void addStdoutLine(const QString &line) { _stdoutLines += line; } - virtual void addStderrLine(const QString &line) { _stderrLines += line; } + virtual void addStdoutLine(const TQString &line) { _stdoutLines += line; } + virtual void addStderrLine(const TQString &line) { _stderrLines += line; } }; //---------------------------------------------------------------------------- class LineSignal : public LineBase { Q_OBJECT + TQ_OBJECT public: - LineSignal(QObject *parent = 0, const char *name = 0) : LineBase(parent, name) {} + LineSignal(TQObject *tqparent = 0, const char *name = 0) : LineBase(tqparent, name) {} signals: - void logStdoutLine(const QString &line); - void logStderrLine(const QString &line); + void logStdoutLine(const TQString &line); + void logStderrLine(const TQString &line); private: - virtual void addStdoutLine(const QString &line) { emit logStdoutLine(line); } - virtual void addStderrLine(const QString &line) { emit logStderrLine(line); } + virtual void addStdoutLine(const TQString &line) { emit logStdoutLine(line); } + virtual void addStderrLine(const TQString &line) { emit logStderrLine(line); } }; } // namespace |