summaryrefslogtreecommitdiffstats
path: root/src/common/nokde/nokde_kprocess.h
blob: 29ba71f88b6e92d3032c598597d617674fb04431 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef _KPROCESS_H_
#define _KPROCESS_H_

#include <tqdir.h>
#include "common/global/global.h"
#include "common/common/synchronous.h"
#if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
class TQProcess;
#else
class Q3Process;
#endif

class TDEProcess : public TQObject
{
TQ_OBJECT
  
public:
  TDEProcess(TQObject *parent = 0, const char *name = 0);
  void clearArguments() { _arguments.clear(); }
  TDEProcess &operator<< (const TQString &arg) { _arguments += arg; return *this; }
  TDEProcess &operator<< (const TQStringList &args) { _arguments += args; return *this; }
  TQStringList args() const { return _arguments; }
  void setEnvironment(const TQString &name, const TQString &value) { _environment += name + "=" + value; }
  bool start();
  bool writeStdin(const char *buffer, int len);
  bool kill();
  bool kill(int n);
  int exitStatus() const;
  bool isRunning() const;
  void setWorkingDirectory(const TQDir &dir);
  void setUseShell(bool useShell);

signals:
  void processExited(TDEProcess *process);
  void receivedStdout(TDEProcess *process, char *buffer, int len);
  void receivedStderr(TDEProcess *process, char *buffer, int len);

private slots:
  void processExitedSlot();
  void readyReadStdoutSlot();
  void readyReadStderrSlot();

private:
#if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
  TQProcess *_process;
#else
  Q3Process  *_process;
#endif
  TQStringList _arguments,_environment;
};

#endif