QtBackgroundProcess  1.5.2
A Library to create background applications with simple, automated foreground control
Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
QtBackgroundProcess::Terminal Class Reference

Represents a connection to a terminal in the master process. More...

#include <terminal.h>

+ Inheritance diagram for QtBackgroundProcess::Terminal:

Public Slots

void disconnectTerminal ()
 Disconnects the terminal from the master. More...
 
void setAutoDelete (bool autoDelete)
 WRITE accessor for App::autoDelete.
 
void writeLine (const QByteArray &line, bool flush=true)
 Writes the given line, appends a newline and optionally flushes.
 
void flush ()
 Flushes the terminal.
 

Signals

void terminalDisconnected ()
 Will be emitted after the terminal has been disconnected.
 
void terminalError (int errorCode)
 Will be emitted if an error occured.
 

Public Member Functions

 Terminal (TerminalPrivate *d_ptr, QObject *parent=nullptr)
 Creates a new terminal from it's private implementation.
 
 ~Terminal ()
 Destructor.
 
bool isStarter () const
 READ accessor for App::starter.
 
QSharedPointer< QCommandLineParserparser () const
 READ accessor for App::parser.
 
bool isAutoDelete () const
 READ accessor for App::autoDelete.
 
bool isSequential () const override
 Inherits QIODevice::isSequential.
 
void close () override
 Inherits QIODevice::close. More...
 
qint64 bytesAvailable () const override
 Inherits QIODevice::bytesAvailable.
 
- Public Member Functions inherited from QIODevice
 QIODevice (QObject *parent)
 
OpenMode openMode () const
 
void setTextModeEnabled (bool enabled)
 
bool isTextModeEnabled () const
 
bool isOpen () const
 
bool isReadable () const
 
bool isWritable () const
 
int readChannelCount () const
 
int writeChannelCount () const
 
int currentReadChannel () const
 
void setCurrentReadChannel (int channel)
 
int currentWriteChannel () const
 
void setCurrentWriteChannel (int channel)
 
virtual qint64 pos () const
 
virtual qint64 size () const
 
virtual bool seek (qint64 pos)
 
virtual bool atEnd () const
 
virtual bool reset ()
 
virtual qint64 bytesToWrite () const
 
qint64 read (char *data, qint64 maxSize)
 
QByteArray read (qint64 maxSize)
 
QByteArray readAll ()
 
qint64 readLine (char *data, qint64 maxSize)
 
QByteArray readLine (qint64 maxSize)
 
virtual bool canReadLine () const
 
void startTransaction ()
 
void commitTransaction ()
 
void rollbackTransaction ()
 
bool isTransactionStarted () const
 
qint64 write (const char *data, qint64 maxSize)
 
qint64 write (const char *data)
 
qint64 write (const QByteArray &byteArray)
 
qint64 peek (char *data, qint64 maxSize)
 
QByteArray peek (qint64 maxSize)
 
virtual bool waitForReadyRead (int msecs)
 
virtual bool waitForBytesWritten (int msecs)
 
void ungetChar (char c)
 
bool putChar (char c)
 
bool getChar (char *c)
 
QString errorString () const
 
void readyRead ()
 
void channelReadyRead (int channel)
 
void bytesWritten (qint64 bytes)
 
void channelBytesWritten (int channel, qint64 bytes)
 
void aboutToClose ()
 
void readChannelFinished ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
virtual const QMetaObjectmetaObject () const
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool isWindowType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool block)
 
QThreadthread () const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const
 
const QObjectList & children () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const
 
bool disconnect (const QObject *receiver, const char *method) const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const
 
void dumpObjectInfo () const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const
 
bool inherits (const char *className) const
 
void deleteLater ()
 

Protected Member Functions

qint64 readData (char *data, qint64 maxlen) override
 Inherits QIODevice::readData.
 
qint64 writeData (const char *data, qint64 len) override
 Inherits QIODevice::writeData.
 
- Protected Member Functions inherited from QIODevice
virtual qint64 readLineData (char *data, qint64 maxSize)
 
void setOpenMode (OpenMode openMode)
 
void setErrorString (const QString &str)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 

Properties

bool starter
 Specifies, whether this terminal is the one that started the master process. More...
 
QSharedPointer< QCommandLineParserparser
 Returns a reference to the parser that parsed this terminals arguments. More...
 
bool autoDelete
 If true, the terminal will delete itself as soon as the connection has been closed. More...
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Public Attributes inherited from QIODevice
typedef OpenMode
 

Detailed Description

Represents a connection to a terminal in the master process.

For every connected terminal, one instance of the Terminal class is created, and provided by the app. The terminal allows interaction with each connected terminal, by receiving it's stdin and sending data to it's stdout.

The Terminal implements the QIODevice interface. This allows easy integration into the application. The terminal is a sequential device.

See also
App, App::connectedTerminals, GlobalTerminal

Definition at line 16 of file terminal.h.

Member Function Documentation

◆ close()

void QtBackgroundProcess::Terminal::close ( )
overridevirtual

Inherits QIODevice::close.

See also
Terminal::disconnectTerminal

Reimplemented from QIODevice.

◆ disconnectTerminal

QtBackgroundProcess::Terminal::disconnectTerminal ( )
slot

Disconnects the terminal from the master.

Softly disconnects the terminal by flushing it first and then closing it, waiting up to 500 milliseconds for data to be written.

Note
disconnecting the terminal will not be closed! You can still read remaining data from the terminal after disconnecting. For a full close, use the close() method.
See also
Terminal::close

Property Documentation

◆ autoDelete

QtBackgroundProcess::Terminal::autoDelete
readwrite

If true, the terminal will delete itself as soon as the connection has been closed.

Default: App::autoDeleteTerminals

If set to true the terminal will be automatically deleted, as soon as the terminal was disconnected. If you need to access the terminal even after closing, you can disable it.

Accessors
READisAutoDelete()
WRITEsetAutoDelete()
See also
App::autoDeleteTerminals, Terminal::disconnectTerminal, Terminal::terminalDisconnected

Definition at line 25 of file terminal.h.

◆ parser

QtBackgroundProcess::Terminal::parser
read

Returns a reference to the parser that parsed this terminals arguments.

Default: A parser setup by the app and filled with the sent arguments.

You can use the parser to get the received options and arguments. It is wrapped inside a QSharedPointer, because QCommandlineParser does not provide a copy constructor

Accessors
READparser()
CONSTANT
See also
App::setupParser, App::commandReceived

Definition at line 23 of file terminal.h.

◆ starter

QtBackgroundProcess::Terminal::starter
read

Specifies, whether this terminal is the one that started the master process.

Default: undefined

There will always be only one starter terminal per master process. It's arguments are passed to the startup function.

Accessors
READisStarter()
CONSTANT
See also
App::startupApp

Definition at line 21 of file terminal.h.


The documentation for this class was generated from the following files: