From 4d3a6631747a8cdad13b771f7fc05c676dc473e3 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 19 Jan 2018 13:07:27 +0100 Subject: Added revision and branch to about dialog --- src/forms/aboutdialog.cpp | 51 ++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 29 deletions(-) (limited to 'src/forms') diff --git a/src/forms/aboutdialog.cpp b/src/forms/aboutdialog.cpp index 93ee86b..eb32533 100644 --- a/src/forms/aboutdialog.cpp +++ b/src/forms/aboutdialog.cpp @@ -9,27 +9,24 @@ #include "aboutdialog.h" #include "ui_aboutdialog.h" #include "version.h" +#include -constexpr const char *getCompiler() -{ +// The extra level of indirection will allow the preprocessor to expand the macros before they are converted to strings. +#define STR_HELPER(x) #x +#define STR(x) STR_HELPER(x) + +// compiler // clang also defines __GNUC__, so we need to check for clang first #if defined(__clang__) - return "Clang " __clang_version__; +#define compiler "Clang " __clang_version__ #elif defined(__GNUC__) - return "GCC " __VERSION__; +#define compiler "GCC " __VERSION__ #else - return "unknown compiler"; +#define compiler "unknown compiler"; #endif -} -inline const QString getLongVersion() -{ -#ifdef SMOLBOTE_DESCRIBE - return QString(SMOLBOTE_DESCRIBE); -#else - return qApp->applicationVersion(); -#endif -} +// libconfig +#define LIBCONFIG_VERSION_STR STR(LIBCONFIGXX_VER_MAJOR) "." STR(LIBCONFIGXX_VER_MINOR) "." STR(LIBCONFIGXX_VER_REVISION) AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent) @@ -40,14 +37,13 @@ AboutDialog::AboutDialog(QWidget *parent) ui->icon->setPixmap(qApp->windowIcon().pixmap(72, 72)); - QLabel *aboutLabel = new QLabel(this); + auto *aboutLabel = new QLabel(this); aboutLabel->setWordWrap(true); - aboutLabel->setText(tr("

smolbote %1

" - "

yet another no-frills browser

") - .arg(qApp->applicationVersion())); + aboutLabel->setText(tr("

smolbote " SMOLBOTE_VERSION "

" + "

yet another no-frills browser

")); ui->toolBox->addItem(aboutLabel, tr("About")); - QLabel *licenseLabel = new QLabel(this); + auto *licenseLabel = new QLabel(this); licenseLabel->setWordWrap(true); licenseLabel->setText(tr("

Copyright (C) 2017 Xian Nox

" "

This program is free software, and you are welcome to use it under the conditions set by the GNU GPLv3:" @@ -61,18 +57,15 @@ AboutDialog::AboutDialog(QWidget *parent) "

You can find the full license text in LICENSE.md.

")); ui->toolBox->addItem(licenseLabel, tr("License")); - QLabel *libsLabel = new QLabel(this); + auto *libsLabel = new QLabel(this); libsLabel->setWordWrap(true); - libsLabel->setText(tr("

Version %1

" - "

" - "Based on Qt " QT_VERSION_STR "
" - "Compiled with %2" - "

" + libsLabel->setText(tr("

Version " SMOLBOTE_DESCRIBE "

" + "

Branch: " SMOLBOTE_BRANCH "
" + "Compiled with " compiler "

" "

") - .arg(getLongVersion(), getCompiler(), qVersion())); + "
  • Qt " QT_VERSION_STR "
  • " + "
  • libconfig " LIBCONFIG_VERSION_STR "
  • " + "

    ")); ui->toolBox->addItem(libsLabel, tr("Details")); } -- cgit v1.2.1