QtBackgroundProcess  1.5.2
A Library to create background applications with simple, automated foreground control
terminal.h
1 #ifndef QTBACKGROUNDPROCESS_TERMINAL_H
2 #define QTBACKGROUNDPROCESS_TERMINAL_H
3 
4 #include "QtBackgroundProcess/qtbackgroundprocess_global.h"
5 
6 #include <QtCore/qcommandlineparser.h>
7 #include <QtCore/qiodevice.h>
8 #include <QtCore/qsharedpointer.h>
9 
10 class QLocalSocket;
11 
12 namespace QtBackgroundProcess {
13 
14 class TerminalPrivate;
16 class Q_BACKGROUNDPROCESS_EXPORT Terminal : public QIODevice
17 {
18  Q_OBJECT
19 
21  Q_PROPERTY(bool starter READ isStarter CONSTANT)
23  Q_PROPERTY(QSharedPointer<QCommandLineParser> parser READ parser CONSTANT)
25  Q_PROPERTY(bool autoDelete READ isAutoDelete WRITE setAutoDelete)
26 
27 public:
29  explicit Terminal(TerminalPrivate *d_ptr, QObject *parent = nullptr);
31  ~Terminal();
32 
34  bool isStarter() const;
36  QSharedPointer<QCommandLineParser> parser() const;
38  bool isAutoDelete() const;
39 
41  bool isSequential() const override;
43  void close() override;
45  qint64 bytesAvailable() const override;
46 
47 public Q_SLOTS:
49  void disconnectTerminal();
51  void setAutoDelete(bool autoDelete);
52 
54  void writeLine(const QByteArray &line, bool flush = true);
56  void flush();
57 
58 Q_SIGNALS:
60  void terminalDisconnected();
62  void terminalError(int errorCode);
63 
64 protected:
66  qint64 readData(char *data, qint64 maxlen) override;
68  qint64 writeData(const char *data, qint64 len) override;
69 
70 private:
71  TerminalPrivate *d;
72 
73  bool open(OpenMode mode) override;
74 };
75 
76 }
77 
78 #endif // QTBACKGROUNDPROCESS_TERMINAL_H
Represents a connection to a terminal in the master process.
Definition: terminal.h:16
The Namespace containing all classes of the QtBackgroundProcess module.
Definition: app.h:13