aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-01-19 13:07:27 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-01-19 13:07:27 +0100
commit4d3a6631747a8cdad13b771f7fc05c676dc473e3 (patch)
treee177f24999313c51b7086cfce480304f141c99df
parentAdded shortcuts to navbar actions (diff)
downloadsmolbote-4d3a6631747a8cdad13b771f7fc05c676dc473e3.tar.xz
Added revision and branch to about dialog
-rw-r--r--CMakeLists.txt6
-rw-r--r--src/forms/aboutdialog.cpp51
-rw-r--r--src/version.h.in10
3 files changed, 33 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb0c2ca..a0e6b9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,8 +52,10 @@ add_subdirectory(plugins/ProfileEditor)
# configure a header file to pass version information
# if you don't have git, or are building this off the source tarball, define versions in version.h.in
-execute_process(COMMAND hg log -r '.' --template={latesttag} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsVersion OUTPUT_STRIP_TRAILING_WHITESPACE)
-execute_process(COMMAND hg identify --id WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsCommit OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND hg log -r '.' --template={latesttag} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsVersion OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND hg identify --id WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsCommit OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND hg identify --num WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsRevision OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND hg identify --branch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsBranch OUTPUT_STRIP_TRAILING_WHITESPACE)
configure_file(src/version.h.in "${PROJECT_BINARY_DIR}/version.h")
set(SourceCode
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"));
}
diff --git a/src/version.h.in b/src/version.h.in
index 0f597ed..88008cf 100644
--- a/src/version.h.in
+++ b/src/version.h.in
@@ -1,9 +1,13 @@
#ifndef VERSION_H
#define VERSION_H
-// 0.2.1
+// Version: 1.2.3
#define SMOLBOTE_VERSION "@VcsVersion@"
-// 0.2.1-0fd54a21a551+
-#define SMOLBOTE_DESCRIBE "@VcsVersion@-@VcsCommit@"
+
+// Describe: 1.2.3-r123-0123456789ab
+#define SMOLBOTE_DESCRIBE "@VcsVersion@-r@VcsRevision@-@VcsCommit@"
+
+// Branch: default
+#define SMOLBOTE_BRANCH "@VcsBranch@"
#endif //VERSION_H