Skip to content

Commit

Permalink
Valgrind: Replace virtual method with setter
Browse files Browse the repository at this point in the history
Change-Id: Ice8e426b39368caf0df8f7400eb56d3d86c0c0e5
  • Loading branch information
JarekKobus committed Feb 7, 2025
1 parent e218d37 commit c16542a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
6 changes: 1 addition & 5 deletions src/plugins/valgrind/callgrindengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ CallgrindToolRunner::CallgrindToolRunner(RunControl *runControl)
: ValgrindToolRunner(runControl)
{
setId("CallgrindToolRunner");
setProgressTitle(Tr::tr("Profiling"));

connect(&m_runner, &ValgrindProcess::valgrindStarted, this, [this](qint64 pid) {
m_pid = pid;
Expand Down Expand Up @@ -77,11 +78,6 @@ void CallgrindToolRunner::addToolArguments(CommandLine &cmd) const
cmd.addArgs(m_settings.callgrindArguments(), CommandLine::Raw);
}

QString CallgrindToolRunner::progressTitle() const
{
return Tr::tr("Profiling");
}

void CallgrindToolRunner::start()
{
const FilePath executable = runControl()->commandLine().executable();
Expand Down
1 change: 0 additions & 1 deletion src/plugins/valgrind/callgrindengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class CallgrindToolRunner : public ValgrindToolRunner

protected:
void addToolArguments(Utils::CommandLine &cmd) const override;
QString progressTitle() const override;

signals:
void parserDataReady(const Callgrind::ParseDataPtr &data);
Expand Down
8 changes: 2 additions & 6 deletions src/plugins/valgrind/memchecktool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ class MemcheckToolRunner final : public ValgrindToolRunner
void parserError(const Valgrind::XmlProtocol::Error &error);

private:
QString progressTitle() const final;
void addToolArguments(CommandLine &cmd) const final;

void startDebugger(qint64 valgrindPid);
Expand All @@ -116,11 +115,6 @@ class MemcheckToolRunner final : public ValgrindToolRunner
std::unique_ptr<Process> m_process;
};

QString MemcheckToolRunner::progressTitle() const
{
return Tr::tr("Analyzing Memory");
}

void MemcheckToolRunner::start()
{
if (runControl()->device()->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
Expand Down Expand Up @@ -1120,6 +1114,8 @@ MemcheckToolRunner::MemcheckToolRunner(RunControl *runControl)
, m_withGdb(runControl->runMode() == MEMCHECK_WITH_GDB_RUN_MODE)
{
setId("MemcheckToolRunner");
setProgressTitle(Tr::tr("Analyzing Memory"));

connect(&m_runner, &ValgrindProcess::error, this, &MemcheckToolRunner::parserError);

if (m_withGdb) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/valgrind/valgrindengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void ValgrindToolRunner::start()

using namespace std::chrono_literals;
FutureProgress *fp
= ProgressManager::addTimedTask(m_progress, progressTitle(), "valgrind", 100s);
= ProgressManager::addTimedTask(m_progress, m_progressTitle, "valgrind", 100s);
connect(fp, &FutureProgress::canceled,
this, &ValgrindToolRunner::handleProgressCanceled);
connect(fp, &FutureProgress::finished,
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/valgrind/valgrindengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ValgrindToolRunner : public ProjectExplorer::RunWorker
void stop() override;

protected:
virtual QString progressTitle() const = 0;
void setProgressTitle(const QString &title) { m_progressTitle = title; }
virtual void addToolArguments(Utils::CommandLine &cmd) const = 0;

ValgrindSettings m_settings{false};
Expand All @@ -39,6 +39,7 @@ class ValgrindToolRunner : public ProjectExplorer::RunWorker

private:
bool m_isStopping = false;
QString m_progressTitle;
};

} // Valgrind::Internal

0 comments on commit c16542a

Please sign in to comment.