From 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 30 Jun 2011 00:15:53 +0000 Subject: 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 --- src/common/global/process.h | 67 ++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 31 deletions(-) (limited to 'src/common/global/process.h') 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 -#include -#include -#include +#include +#include +#include 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 -- cgit v1.2.1