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 #include <QMutex>
11 
12 // MythTV headers
13 #include "mythexp.h"
14 #include "mythscreentype.h"
15 
16 class MythUIButton;
17 class MythUIButtonList;
19 class MythUITextEdit;
20 
22 {
23  Q_OBJECT
24 
25  public:
26  MythTerminal(MythScreenStack *parent, QString program,
27  QStringList arguments);
28  virtual void deleteLater(void)
29  { TeardownAll(); MythScreenType::deleteLater(); }
30  void Init(void) override; // MythScreenType
31  bool Create(void) override; // MythScreenType
32 
33  public slots:
34  void Start(void);
35  void Kill(void);
36  bool IsDone(void) const;
37  void AddText(const QString&);
38 
39  protected slots:
40  void ProcessHasText(void); // connected to from process' readyRead signal
41  void ProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
42 
43  protected:
44  virtual ~MythTerminal() { TeardownAll(); }
45  void TeardownAll(void);
46 
47  mutable QMutex m_lock {QMutex::Recursive};
48  bool m_running {false};
49  QProcess *m_process {nullptr};
50  QString m_program;
51  QStringList m_arguments;
52  MythUIButtonListItem *m_currentLine {nullptr};
53  MythUIButtonList *m_output {nullptr};
54  MythUITextEdit *m_textEdit {nullptr};
55  MythUIButton *m_enterButton {nullptr};
56 };
57 
58 #endif // MYTH_TERMINAL_H
unsigned int slots[4]
Definition: element.c:38
#define MPUBLIC
Definition: mythexp.h:10
virtual bool Create(void)
virtual ~MythTerminal()
Definition: mythterminal.h:44
QString m_program
Definition: mythterminal.h:50
A text entry and edit widget.
QStringList m_arguments
Definition: mythterminal.h:51
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
A single button widget.
Definition: mythuibutton.h:21
virtual void deleteLater(void)
Definition: mythterminal.h:28
virtual void Init(void)
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Screen in which all other widgets are contained and rendered.