From e8c5c2b154c62a2d26aadd6669540267497e8d8d Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Wed, 22 Apr 2020 10:26:21 +0300 Subject: [PATCH] Show version number in Cppcheck GUI's title bar (#2615) Also don't mark the string "Cppcheck" as translatable, as it is questionable whether the product's name is supposed to be translated ever. --- gui/mainwindow.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index b6f609b37..b2099eb86 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -1363,11 +1363,18 @@ void MainWindow::toggleFilterToolBar() void MainWindow::formatAndSetTitle(const QString &text) { + QString nameWithVersion = QString("Cppcheck %1").arg(CppCheck::version()); + + QString extraVersion = CppCheck::extraVersion(); + if (!extraVersion.isEmpty()) { + nameWithVersion += " (" + extraVersion + ")"; + } + QString title; if (text.isEmpty()) - title = tr("Cppcheck"); + title = nameWithVersion; else - title = QString(tr("Cppcheck - %1")).arg(text); + title = QString("%1 - %2").arg(nameWithVersion, text); setWindowTitle(title); }