From 70b2b2a1d52e55f1adf15d52147305186388faea Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 19 Jan 2022 14:02:20 +0100 Subject: [PATCH] ConsoleProcess: Uniform the common interface of QtcProcess This is a preliminary step before merging ConsoleProcess into QtcProcess. Remove processError() signal, use errorOccurred() instead. Change-Id: If11064944228c82a9099fffdba942c4276690085 Reviewed-by: hjk Reviewed-by: Qt CI Bot --- src/libs/utils/consoleprocess.cpp | 1 - src/libs/utils/consoleprocess.h | 1 - src/plugins/debugger/terminal.cpp | 6 +++--- src/plugins/debugger/terminal.h | 2 +- src/plugins/projectexplorer/applicationlauncher.cpp | 8 ++++---- src/plugins/python/pythonutils.cpp | 6 +++--- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/libs/utils/consoleprocess.cpp b/src/libs/utils/consoleprocess.cpp index e6c4cb8f1f0..19fd1d831d9 100644 --- a/src/libs/utils/consoleprocess.cpp +++ b/src/libs/utils/consoleprocess.cpp @@ -1026,7 +1026,6 @@ void ConsoleProcess::emitError(QProcess::ProcessError err, const QString &errorS d->m_error = err; d->m_errorString = errorString; emit errorOccurred(err); - emit processError(errorString); } bool TerminalCommand::operator==(const TerminalCommand &other) const diff --git a/src/libs/utils/consoleprocess.h b/src/libs/utils/consoleprocess.h index 229747353b7..fa1971ca741 100644 --- a/src/libs/utils/consoleprocess.h +++ b/src/libs/utils/consoleprocess.h @@ -114,7 +114,6 @@ public: signals: void errorOccurred(QProcess::ProcessError error); - void processError(const QString &errorString); // These reflect the state of the actual client process void started(); diff --git a/src/plugins/debugger/terminal.cpp b/src/plugins/debugger/terminal.cpp index 6b9da60f41d..00720c01c0c 100644 --- a/src/plugins/debugger/terminal.cpp +++ b/src/plugins/debugger/terminal.cpp @@ -174,7 +174,7 @@ TerminalRunner::TerminalRunner(RunControl *runControl, { setId("TerminalRunner"); - connect(&m_stubProc, &ConsoleProcess::processError, + connect(&m_stubProc, &ConsoleProcess::errorOccurred, this, &TerminalRunner::stubError); connect(&m_stubProc, &ConsoleProcess::started, this, &TerminalRunner::stubStarted); @@ -235,9 +235,9 @@ void TerminalRunner::stubStarted() reportStarted(); } -void TerminalRunner::stubError(const QString &msg) +void TerminalRunner::stubError() { - reportFailure(msg); + reportFailure(m_stubProc.errorString()); } } // namespace Internal diff --git a/src/plugins/debugger/terminal.h b/src/plugins/debugger/terminal.h index 896fec855aa..ee6ce49faec 100644 --- a/src/plugins/debugger/terminal.h +++ b/src/plugins/debugger/terminal.h @@ -86,7 +86,7 @@ private: void stop() final; void stubStarted(); - void stubError(const QString &msg); + void stubError(); Utils::ConsoleProcess m_stubProc; std::function m_stubRunnable; diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index 47fa9751d0c..e144c0f4290 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -77,7 +77,7 @@ public: // Local void handleProcessStarted(); void localGuiProcessError(); - void localConsoleProcessError(const QString &error); + void localConsoleProcessError(); void readLocalStandardOutput(); void readLocalStandardError(); void cannotRetrieveLocalDebugOutput(); @@ -151,7 +151,7 @@ ApplicationLauncherPrivate::ApplicationLauncherPrivate(ApplicationLauncher *pare connect(&m_consoleProcess, &ConsoleProcess::started, this, &ApplicationLauncherPrivate::handleProcessStarted); - connect(&m_consoleProcess, &ConsoleProcess::processError, + connect(&m_consoleProcess, &ConsoleProcess::errorOccurred, this, &ApplicationLauncherPrivate::localConsoleProcessError); connect(&m_consoleProcess, &ConsoleProcess::finished, this, [this] { localProcessDone(m_consoleProcess.exitCode(), m_consoleProcess.exitStatus()); @@ -294,9 +294,9 @@ void ApplicationLauncherPrivate::localGuiProcessError() } } -void ApplicationLauncherPrivate::localConsoleProcessError(const QString &error) +void ApplicationLauncherPrivate::localConsoleProcessError() { - emit q->appendMessage(error, ErrorMessageFormat); + emit q->appendMessage(m_consoleProcess.errorString(), ErrorMessageFormat); if (m_processRunning && m_consoleProcess.applicationPID() == 0) { m_processRunning = false; emit q->processExited(-1, QProcess::NormalExit); diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp index 74294263a93..d13a233750b 100644 --- a/src/plugins/python/pythonutils.cpp +++ b/src/plugins/python/pythonutils.cpp @@ -113,13 +113,13 @@ void openPythonRepl(const FilePath &file, ReplType type) process->setWorkingDirectory(workingDir(file)); const QString commandLine = process->command().toUserOutput(); QObject::connect(process, - &ConsoleProcess::processError, + &ConsoleProcess::errorOccurred, process, - [process, commandLine](const QString &errorString) { + [process, commandLine] { Core::MessageManager::writeDisrupting( QCoreApplication::translate("Python", "Failed to run Python (%1): \"%2\".") - .arg(commandLine, errorString)); + .arg(commandLine, process->errorString())); process->deleteLater(); }); QObject::connect(process, &ConsoleProcess::stubStopped, process, &QObject::deleteLater);