From 0bc430bfad1c9517d0dde0095cc91bbc821f15c6 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Tue, 31 Oct 2017 18:21:58 +0100 Subject: [PATCH] Show the build date of the nightlies in the About dialog --- src/AboutDialog.cpp | 4 ++-- src/Application.cpp | 24 ++++++++++++++---------- src/Application.h | 2 ++ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/AboutDialog.cpp b/src/AboutDialog.cpp index 2c1ffb14..d52f5161 100644 --- a/src/AboutDialog.cpp +++ b/src/AboutDialog.cpp @@ -1,7 +1,7 @@ #include "AboutDialog.h" #include "ui_AboutDialog.h" -#include "version.h" #include "sqlite.h" +#include "Application.h" AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), @@ -11,7 +11,7 @@ AboutDialog::AboutDialog(QWidget *parent) : this->setFixedSize(this->width(), this->height()); this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); - ui->label_version->setText(tr("Version ") + APP_VERSION + "\n\n" + + ui->label_version->setText(tr("Version ") + Application::versionString() + "\n\n" + tr("Qt Version ") + QT_VERSION_STR + "\n\n" + #ifdef ENABLE_SQLCIPHER tr("SQLCipher Version ") + SQLITE_VERSION diff --git a/src/Application.cpp b/src/Application.cpp index 3462088b..861cf68e 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -89,16 +89,7 @@ Application::Application(int& argc, char** argv) : qWarning() << qPrintable(tr(" [file]\t\tOpen this SQLite database")); m_dontShowMainWindow = true; } else if(arguments().at(i) == "-v" || arguments().at(i) == "--version") { - // Distinguish between high and low patch version numbers. High numbers as in x.y.99 indicate nightly builds or - // beta releases. For these we want to include the build date. For the release versions we don't add the release - // date in order to avoid confusion about what is more important, version number or build date, and about different - // build dates for the same version. This also should help making release builds reproducible out of the box. -#if PATCH_VERSION >= 99 - QString build_date = QString(" (%1)").arg(__DATE__); -#else - QString build_date; -#endif - qWarning() << qPrintable(tr("This is DB Browser for SQLite version %1%2.").arg(APP_VERSION).arg(build_date)); + qWarning() << qPrintable(tr("This is DB Browser for SQLite version %1.").arg(versionString())); m_dontShowMainWindow = true; } else if(arguments().at(i) == "-s" || arguments().at(i) == "--sql") { // Run SQL file: If file exists add it to list of scripts to execute @@ -170,3 +161,16 @@ bool Application::event(QEvent* event) return QApplication::event(event); } } + +QString Application::versionString() +{ + // Distinguish between high and low patch version numbers. High numbers as in x.y.99 indicate nightly builds or + // beta releases. For these we want to include the build date. For the release versions we don't add the release + // date in order to avoid confusion about what is more important, version number or build date, and about different + // build dates for the same version. This also should help making release builds reproducible out of the box. +#if PATCH_VERSION >= 99 + return QString("%1 (%2)").arg(APP_VERSION).arg(__DATE__); +#else + return QString("%1").arg(APP_VERSION); +#endif +} diff --git a/src/Application.h b/src/Application.h index c5ef04a8..40c0f265 100644 --- a/src/Application.h +++ b/src/Application.h @@ -18,6 +18,8 @@ public: MainWindow* mainWindow() { return m_mainWindow; } + static QString versionString(); + protected: bool event(QEvent* event);