From c9816c67c562055048ab6eb5d3b644cbec5b5161 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Thu, 11 Aug 2011 18:13:54 +0300 Subject: [PATCH] GUI: Show extraversion in About-dialog. If the "extra version" is defined (not empty) then it is shown after the actual version number in the About-dialog. Ticket: #2164 ([GUI] Add revision info to "About" window) --- gui/aboutdialog.cpp | 9 +++++++-- gui/aboutdialog.h | 3 ++- gui/mainwindow.cpp | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gui/aboutdialog.cpp b/gui/aboutdialog.cpp index ec79fc6bf..41b45ae1c 100644 --- a/gui/aboutdialog.cpp +++ b/gui/aboutdialog.cpp @@ -21,12 +21,17 @@ #include #include "aboutdialog.h" -AboutDialog::AboutDialog(const QString &version, QWidget *parent) +AboutDialog::AboutDialog(const QString &version, const QString &extraVersion, QWidget *parent) : QDialog(parent) { mUI.setupUi(this); - mUI.mVersion->setText(mUI.mVersion->text().arg(version)); + QString fmtVersion(version); + if (!extraVersion.isEmpty()) + { + fmtVersion += " (" + extraVersion + ")"; + } + mUI.mVersion->setText(mUI.mVersion->text().arg(fmtVersion)); QString url = "http://cppcheck.sourceforge.net/"; mUI.mHomepage->setText(mUI.mHomepage->text().arg(url)); connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept())); diff --git a/gui/aboutdialog.h b/gui/aboutdialog.h index 6e08358a1..f8bc58c92 100644 --- a/gui/aboutdialog.h +++ b/gui/aboutdialog.h @@ -36,7 +36,8 @@ class AboutDialog : public QDialog { Q_OBJECT public: - AboutDialog(const QString &version, QWidget *parent = 0); + AboutDialog(const QString &version, const QString &extraVersion, + QWidget *parent = 0); private: Ui::About mUI; diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 57b6284bf..ae4a1fb94 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -680,7 +680,7 @@ void MainWindow::ToggleAllChecked(bool checked) void MainWindow::About() { - AboutDialog *dlg = new AboutDialog(CppCheck::version(), this); + AboutDialog *dlg = new AboutDialog(CppCheck::version(), CppCheck::extraVersion(), this); dlg->exec(); }