From 272fbe82d0db6b75bd7960bf240dc22466325e29 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 25 Apr 2022 14:20:50 +0200 Subject: [PATCH] ApplicationLauncher: Get rid of m_processChannelMode field Use QtcProcess::processChannelMode() getter instead. Change-Id: I9e66f6e5ec8dd90d55f843328f02032351c802ac Reviewed-by: hjk --- .../projectexplorer/applicationlauncher.cpp | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index 6b4f2e1cd4b..3f1faf90cd1 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -102,7 +102,6 @@ public: // Local bool m_useTerminal = false; - QProcess::ProcessChannelMode m_processChannelMode; // Keep track whether we need to emit a finished signal bool m_processRunning = false; @@ -125,8 +124,16 @@ static QProcess::ProcessChannelMode defaultProcessChannelMode() ApplicationLauncherPrivate::ApplicationLauncherPrivate(ApplicationLauncher *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 connect(WinDebugInterface::instance(), &WinDebugInterface::cannotRetrieveDebugOutput, this, &ApplicationLauncherPrivate::cannotRetrieveLocalDebugOutput); @@ -144,7 +151,7 @@ ApplicationLauncher::~ApplicationLauncher() = default; void ApplicationLauncher::setProcessChannelMode(QProcess::ProcessChannelMode mode) { - d->m_processChannelMode = mode; + d->m_process->setProcessChannelMode(mode); } void ApplicationLauncher::setUseTerminal(bool on) @@ -337,7 +344,6 @@ void ApplicationLauncherPrivate::start() m_resultData = {}; - m_process.reset(new QtcProcess(this)); if (m_isLocal) { // Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...) const FilePath fixedPath = m_runnable.workingDirectory.normalizedPathName(); @@ -403,19 +409,6 @@ void ApplicationLauncherPrivate::start() else 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->start(); }