From 9e84b09e991b30d6515eea40b60110a2b80f0a1c Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 10 Jul 2023 13:14:07 +0200 Subject: [PATCH] Valgrind: Some more direct FilePath use Change-Id: I99db6996482cd5a14dcc4d68c55b22c64feef9fa Reviewed-by: Christian Stenger --- src/plugins/valgrind/callgrindtool.cpp | 10 +++++----- src/plugins/valgrind/valgrindengine.cpp | 10 ++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index d2dfc469e03..691d5051e58 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -361,7 +361,7 @@ CallgrindToolPrivate::CallgrindToolPrivate() action->setIcon(kCachegrindIcon.icon()); action->setToolTip(Tr::tr("Open results in KCachegrind.")); connect(action, &QAction::triggered, this, [this, settings] { - Process::startDetached({FilePath::fromString(settings->kcachegrindExecutable.value()), { m_lastFileName }}); + Process::startDetached({settings->kcachegrindExecutable(), { m_lastFileName }}); }); // dump action @@ -908,10 +908,10 @@ void CallgrindToolPrivate::takeParserData(ParseData *data) doClear(true); setParseData(data); - const QString kcachegrindExecutable = - ValgrindGlobalSettings::instance()->kcachegrindExecutable.value(); - const bool kcachegrindExists = !Utils::Environment::systemEnvironment().searchInPath( - kcachegrindExecutable).isEmpty(); + const FilePath kcachegrindExecutable = + ValgrindGlobalSettings::instance()->kcachegrindExecutable(); + const FilePath found = kcachegrindExecutable.searchInPath(); + const bool kcachegrindExists = found.isExecutableFile(); m_startKCachegrind->setEnabled(kcachegrindExists && !m_lastFileName.isEmpty()); createTextMarks(); } diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index 61ef89c3041..ee1484108c8 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -144,11 +144,13 @@ void ValgrindToolRunner::runnerFinished() void ValgrindToolRunner::receiveProcessError(const QString &message, QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { - const QString valgrind = m_settings.valgrindExecutable.value(); - if (!valgrind.isEmpty()) - appendMessage(Tr::tr("Error: \"%1\" could not be started: %2").arg(valgrind, message), ErrorMessageFormat); - else + const FilePath valgrind = m_settings.valgrindExecutable(); + if (!valgrind.isEmpty()) { + appendMessage(Tr::tr("Error: \"%1\" could not be started: %2") + .arg(valgrind.toUserOutput(), message), ErrorMessageFormat); + } else { appendMessage(Tr::tr("Error: no Valgrind executable set."), ErrorMessageFormat); + } } else if (m_isStopping && error == QProcess::Crashed) { // process gets killed on stop appendMessage(Tr::tr("Process terminated."), ErrorMessageFormat); } else {