ACF $AcfVersion:0$
CConsoleReader.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QThread>
7
8
9namespace iqt
10{
11
12
16class CConsoleReader: public QObject
17{
18 Q_OBJECT
19
20public:
21 typedef QObject BaseClass;
22
23 explicit CConsoleReader(QObject* parentPtr = NULL);
24
28 virtual void Start();
29
33 virtual void Stop();
34
38 bool IsRunning() const;
39
40signals:
44 void KeyPressedSignal(char character);
45
46protected:
47 class InputObserver: public QThread
48 {
49 public:
50 explicit InputObserver(CConsoleReader& parent);
51
52 void Stop();
53
54 protected:
55 // reimplemented (QThread)
56 virtual void run() override;
57
58 private:
59 CConsoleReader& m_parent;
60 bool m_shouldBeFinished;
61 };
62
63private:
64 InputObserver m_inputObserver;
65};
66
67
68} // namespace iqt
69
70
virtual void run() override
InputObserver(CConsoleReader &parent)
User-input reader for command line console.
void KeyPressedSignal(char character)
Emit typed character.
virtual void Start()
Start reading of the user input on the console.
bool IsRunning() const
Check if the reader is running.
CConsoleReader(QObject *parentPtr=NULL)
virtual void Stop()
Stop reading of the user input on the console.
#define NULL
Definition istd.h:74
This namespace contains non-UI utility classes based on Qt.