summaryrefslogtreecommitdiffstats
path: root/daemon.h
blob: 58c8a0138122147ec6f1ace92d28f5f362d2a507 (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
#ifndef DAEMON_H
#define DAEMON_H

#include <QObject>
#include <QStringList>
class QTcpServer;
class QTcpSocket;
class Protocol;
class App;

class Daemon : public QObject
{
Q_OBJECT

public:
    Daemon(QObject *parent = 0);
    virtual ~Daemon();

private slots:
    void newConnection();
    void printCommand(const QStringList &);
    void clientDisconnect();
    void clientRead();
    void handleCommands(const QStringList &);

    void appStarted(pid_t);
    void appStopped(pid_t, int, int);
    void appStdout(pid_t, const QByteArray &);
    void appStderr(pid_t, const QByteArray &);
    void appDebugging(pid_t, quint16);
    void appError(const QString &);

private:
    void loadDefaults();

    QTcpServer *mServer;
    QTcpSocket *mClient;
    Protocol *mProtocol;
    App *mApp;

    QString defaultApp;
    QStringList defaultArgs;
    quint16 mPort;
};

#endif // DAEMON_H