33 QStringList _arguments) :
35 m_process(new QProcess()), m_program(
std::move(_program)),
36 m_arguments(
std::move(_arguments))
38 m_process->setProcessChannelMode(QProcess::MergedChannels);
42 connect(
m_process, qOverload<int,QProcess::ExitStatus>(&QProcess::finished),
48 QMutexLocker locker(&
m_lock);
61 QMutexLocker locker(&
m_lock);
63 while (!str.isEmpty())
65 int nlf = str.indexOf(
"\r\n");
66 nlf = (nlf < 0) ? str.indexOf(
"\r") : nlf;
67 nlf = (nlf < 0) ? str.indexOf(
"\n") : nlf;
69 QString curStr = (nlf >= 0) ? str.left(nlf) : str;
70 if (!curStr.isEmpty())
82 str = str.mid(nlf + 1);
93 QMutexLocker locker(&
m_lock);
100 QMutexLocker locker(&
m_lock);
107 QMutexLocker locker(&
m_lock);
108 return QProcess::NotRunning ==
m_process->state();
113 QMutexLocker locker(&
m_lock);
114 int64_t len =
m_process->bytesAvailable();
129 int exitCode, QProcess::ExitStatus exitStatus)
131 QMutexLocker locker(&
m_lock);
132 if (exitStatus == QProcess::CrashExit) {
133 AddText(tr(
"*** Crashed with status: %1 ***").arg(exitCode));
135 AddText(tr(
"*** Exited with status: %1 ***").arg(exitCode));
154 LOG(VB_GENERAL, LOG_ERR,
"Theme elements missing.");
169 QMutexLocker locker(&
m_lock);
175 m_process->write(text.toLocal8Bit().constData());
Screen in which all other widgets are contained and rendered.
void BuildFocusList(void)
bool Create(void) override
void AddText(const QString &_str)
MythUITextEdit * m_textEdit
void ProcessHasText(void)
MythUIButton * m_enterButton
MythUIButtonList * m_output
MythTerminal(MythScreenStack *parent, QString program, QStringList arguments)
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
MythUIButtonListItem * m_currentLine
void ProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
QString GetText(void) const
void SetEnabled(bool enable)
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)