Navigation Menu

Skip to content

Commit

Permalink
Show the build date of the nightlies in the About dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
MKleusberg committed Oct 31, 2017
1 parent 3fe181b commit 0bc430b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions 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),
Expand All @@ -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
Expand Down
24 changes: 14 additions & 10 deletions src/Application.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
2 changes: 2 additions & 0 deletions src/Application.h
Expand Up @@ -18,6 +18,8 @@ class Application : public QApplication

MainWindow* mainWindow() { return m_mainWindow; }

static QString versionString();

protected:
bool event(QEvent* event);

Expand Down

0 comments on commit 0bc430b

Please sign in to comment.