diff options
| author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-19 13:07:27 +0100 | 
|---|---|---|
| committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-19 13:07:27 +0100 | 
| commit | 4d3a6631747a8cdad13b771f7fc05c676dc473e3 (patch) | |
| tree | e177f24999313c51b7086cfce480304f141c99df /src/forms | |
| parent | Added shortcuts to navbar actions (diff) | |
| download | smolbote-4d3a6631747a8cdad13b771f7fc05c676dc473e3.tar.xz | |
Added revision and branch to about dialog
Diffstat (limited to 'src/forms')
| -rw-r--r-- | src/forms/aboutdialog.cpp | 51 | 
1 files changed, 22 insertions, 29 deletions
| 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 <libconfig.h++> -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("<h2>smolbote %1</h2>" -                           "<p><i>yet another no-frills browser</i></p>") -                            .arg(qApp->applicationVersion())); +    aboutLabel->setText(tr("<h2>smolbote " SMOLBOTE_VERSION "</h2>" +                           "<p><i>yet another no-frills browser</i></p>"));      ui->toolBox->addItem(aboutLabel, tr("About")); -    QLabel *licenseLabel = new QLabel(this); +    auto *licenseLabel = new QLabel(this);      licenseLabel->setWordWrap(true);      licenseLabel->setText(tr("<p>Copyright (C) 2017 Xian Nox</p>"                               "<p>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)                               "<p>You can find the full license text in LICENSE.md.</p>"));      ui->toolBox->addItem(licenseLabel, tr("License")); -    QLabel *libsLabel = new QLabel(this); +    auto *libsLabel = new QLabel(this);      libsLabel->setWordWrap(true); -    libsLabel->setText(tr("<h3>Version %1</h3>" -                          "<p>" -                          "Based on Qt " QT_VERSION_STR "<br>" -                          "Compiled with %2" -                          "</p>" +    libsLabel->setText(tr("<h3>Version " SMOLBOTE_DESCRIBE "</h3>" +                          "<p>Branch: " SMOLBOTE_BRANCH "<br>" +                          "Compiled with " compiler "</p>"                            "<p><ul>" -                          "<li>Qt %3</li>" -                          "<li>libconfig</li>" -                          "</ul></p>") -                           .arg(getLongVersion(), getCompiler(), qVersion())); +                          "<li>Qt " QT_VERSION_STR "</li>" +                          "<li>libconfig " LIBCONFIG_VERSION_STR "</li>" +                          "</ul></p>"));      ui->toolBox->addItem(libsLabel, tr("Details"));  } | 
