ApplicationLauncher: Get rid of m_processChannelMode field

Use QtcProcess::processChannelMode() getter instead.

Change-Id: I9e66f6e5ec8dd90d55f843328f02032351c802ac
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-04-25 14:20:50 +02:00
parent 85cb7d2b71
commit 272fbe82d0

View File

@@ -102,7 +102,6 @@ public:
// Local // Local
bool m_useTerminal = false; bool m_useTerminal = false;
QProcess::ProcessChannelMode m_processChannelMode;
// Keep track whether we need to emit a finished signal // Keep track whether we need to emit a finished signal
bool m_processRunning = false; bool m_processRunning = false;
@@ -125,8 +124,16 @@ static QProcess::ProcessChannelMode defaultProcessChannelMode()
ApplicationLauncherPrivate::ApplicationLauncherPrivate(ApplicationLauncher *parent) ApplicationLauncherPrivate::ApplicationLauncherPrivate(ApplicationLauncher *parent)
: q(parent) : q(parent)
, m_processChannelMode(defaultProcessChannelMode())
{ {
m_process.reset(new QtcProcess(this));
m_process->setProcessChannelMode(defaultProcessChannelMode());
connect(m_process.get(), &QtcProcess::started, q, &ApplicationLauncher::started);
connect(m_process.get(), &QtcProcess::done, this, &ApplicationLauncherPrivate::handleDone);
connect(m_process.get(), &QtcProcess::readyReadStandardError,
this, &ApplicationLauncherPrivate::handleStandardError);
connect(m_process.get(), &QtcProcess::readyReadStandardOutput,
this, &ApplicationLauncherPrivate::handleStandardOutput);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
connect(WinDebugInterface::instance(), &WinDebugInterface::cannotRetrieveDebugOutput, connect(WinDebugInterface::instance(), &WinDebugInterface::cannotRetrieveDebugOutput,
this, &ApplicationLauncherPrivate::cannotRetrieveLocalDebugOutput); this, &ApplicationLauncherPrivate::cannotRetrieveLocalDebugOutput);
@@ -144,7 +151,7 @@ ApplicationLauncher::~ApplicationLauncher() = default;
void ApplicationLauncher::setProcessChannelMode(QProcess::ProcessChannelMode mode) void ApplicationLauncher::setProcessChannelMode(QProcess::ProcessChannelMode mode)
{ {
d->m_processChannelMode = mode; d->m_process->setProcessChannelMode(mode);
} }
void ApplicationLauncher::setUseTerminal(bool on) void ApplicationLauncher::setUseTerminal(bool on)
@@ -337,7 +344,6 @@ void ApplicationLauncherPrivate::start()
m_resultData = {}; m_resultData = {};
m_process.reset(new QtcProcess(this));
if (m_isLocal) { if (m_isLocal) {
// Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...) // Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...)
const FilePath fixedPath = m_runnable.workingDirectory.normalizedPathName(); const FilePath fixedPath = m_runnable.workingDirectory.normalizedPathName();
@@ -403,19 +409,6 @@ void ApplicationLauncherPrivate::start()
else else
m_outputCodec = QTextCodec::codecForName("utf8"); m_outputCodec = QTextCodec::codecForName("utf8");
connect(m_process.get(), &QtcProcess::started, q, &ApplicationLauncher::started);
connect(m_process.get(), &QtcProcess::done, this, &ApplicationLauncherPrivate::handleDone);
m_process->setProcessChannelMode(m_processChannelMode);
if (m_processChannelMode == QProcess::SeparateChannels) {
connect(m_process.get(), &QtcProcess::readyReadStandardError,
this, &ApplicationLauncherPrivate::handleStandardError);
}
if (!m_useTerminal) {
connect(m_process.get(), &QtcProcess::readyReadStandardOutput,
this, &ApplicationLauncherPrivate::handleStandardOutput);
}
m_process->setTerminalMode(m_useTerminal ? Utils::TerminalMode::On : Utils::TerminalMode::Off); m_process->setTerminalMode(m_useTerminal ? Utils::TerminalMode::On : Utils::TerminalMode::Off);
m_process->start(); m_process->start();
} }