Show the build date of the nightlies in the About dialog

This commit is contained in:
Martin Kleusberg
2017-10-31 18:21:58 +01:00
parent 3fe181bba7
commit 0bc430bfad
3 changed files with 18 additions and 12 deletions

View File

@@ -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

View File

@@ -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
}

View File

@@ -18,6 +18,8 @@ public:
MainWindow* mainWindow() { return m_mainWindow; }
static QString versionString();
protected:
bool event(QEvent* event);