MythTV  master
mythterminal.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #ifndef MYTH_TERMINAL_H
4 #define MYTH_TERMINAL_H
5 
6 // Qt headers
7 #include <QObject>
8 #include <QString>
9 #include <QProcess>
10 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
11 #include <QMutex>
12 #else
13 #include <QRecursiveMutex>
14 #endif
15 
16 // MythTV headers
17 #include "mythexp.h"
18 #include "mythscreentype.h"
19 
20 class MythUIButton;
21 class MythUIButtonList;
23 class MythUITextEdit;
24 
26 {
27  Q_OBJECT
28 
29  public:
30  MythTerminal(MythScreenStack *parent, QString program,
31  QStringList arguments);
32  virtual void deleteLater(void)
33  { TeardownAll(); MythScreenType::deleteLater(); }
34  void Init(void) override; // MythScreenType
35  bool Create(void) override; // MythScreenType
36  bool IsDone(void) const;
37 
38  public slots:
39  void Start(void);
40  void Kill(void);
41  void AddText(const QString& _str);
42 
43  protected slots:
44  void ProcessHasText(void); // connected to from process' readyRead signal
45  void ProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
46 
47  protected:
48  ~MythTerminal() override { TeardownAll(); }
49  void TeardownAll(void);
50 
51 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
52  mutable QMutex m_lock {QMutex::Recursive};
53 #else
54  mutable QRecursiveMutex m_lock;
55 #endif
56  bool m_running {false};
57  QProcess *m_process {nullptr};
58  QString m_program;
59  QStringList m_arguments;
60  MythUIButtonListItem *m_currentLine {nullptr};
61  MythUIButtonList *m_output {nullptr};
62  MythUITextEdit *m_textEdit {nullptr};
63  MythUIButton *m_enterButton {nullptr};
64 };
65 
66 #endif // MYTH_TERMINAL_H
MPUBLIC
#define MPUBLIC
Definition: mythexp.h:10
MythTerminal::m_lock
QRecursiveMutex m_lock
Definition: mythterminal.h:54
mythexp.h
MythScreenStack
Definition: mythscreenstack.h:16
MythScreenType::Create
virtual bool Create(void)
Definition: mythscreentype.cpp:265
MythUITextEdit
A text entry and edit widget.
Definition: mythuitextedit.h:32
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:44
MythUIButtonListItem
Definition: mythuibuttonlist.h:27
MythTerminal::m_arguments
QStringList m_arguments
Definition: mythterminal.h:59
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
MythScreenType::Init
virtual void Init(void)
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Definition: mythscreentype.cpp:380
MythTerminal::m_program
QString m_program
Definition: mythterminal.h:58
MythTerminal::~MythTerminal
~MythTerminal() override
Definition: mythterminal.h:48
MythTerminal::deleteLater
virtual void deleteLater(void)
Definition: mythterminal.h:32
MythTerminal
Definition: mythterminal.h:25
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:151
mythscreentype.h