Make plasma libs build.
[amarok.git] / src / Process.h
blob55d10a2f1a75a9be23e614a248da27140aeec606
1 /***************************************************************************
2 * copyright : (C) 2007 Shane King <kde@dontletsstart.com> *
3 **************************************************************************/
5 /***************************************************************************
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 ***************************************************************************/
14 #ifndef AMAROK_PROCESS_H
15 #define AMAROK_PROCESS_H
17 #include "amarok_export.h"
19 #include <KProcess>
21 class QTextCodec;
23 // Classes needed to wrap some KProcess stuff to make it more like K3Process
24 // Also need to close fds on fork under unix
26 ////////////////////////////////////////////////////////////////////////////////
27 // class Process
28 ////////////////////////////////////////////////////////////////////////////////
30 class AMAROK_EXPORT Process : public KProcess
32 Q_OBJECT
34 public:
35 explicit Process(QObject *parent = 0);
37 void setLowPriority(bool lowPriority) { this->lowPriority = lowPriority; }
39 void start();
41 // for K3Process compat
42 Q_SIGNALS:
43 void processExited(Process *proc);
44 void receivedStdout(Process *proc);
45 void receivedStderr(Process *proc);
47 protected:
48 virtual void setupChildProcess();
50 private slots:
51 void finished();
52 void readyReadStandardOutput();
53 void readyReadStandardError();
55 private:
56 bool lowPriority;
59 ////////////////////////////////////////////////////////////////////////////////
60 // class ProcIO
61 ////////////////////////////////////////////////////////////////////////////////
63 class AMAROK_EXPORT ProcIO : public Process
65 Q_OBJECT
67 public:
68 ProcIO();
70 int readln (QString &line);
71 bool writeStdin(const QString &line);
73 void start();
75 Q_SIGNALS:
76 void readReady(ProcIO *pio);
78 private slots:
79 void readyReadStandardOutput();
81 private:
82 QTextCodec *codec;
85 ////////////////////////////////////////////////////////////////////////////////
86 // class ShellProcess
87 ////////////////////////////////////////////////////////////////////////////////
89 class AMAROK_EXPORT ShellProcess : public Process
91 public:
92 explicit ShellProcess(QObject *parent = 0) : Process(parent) {}
94 ShellProcess &operator<<(const QString& arg);
95 ShellProcess &operator<<(const QStringList& args);
98 #endif // AMAROK_PROCESS_H