Skip to content

Commit 0bc430b

Browse files
committed
Show the build date of the nightlies in the About dialog
1 parent 3fe181b commit 0bc430b

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

src/AboutDialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "AboutDialog.h"
22
#include "ui_AboutDialog.h"
3-
#include "version.h"
43
#include "sqlite.h"
4+
#include "Application.h"
55

66
AboutDialog::AboutDialog(QWidget *parent) :
77
QDialog(parent),
@@ -11,7 +11,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
1111
this->setFixedSize(this->width(), this->height());
1212
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
1313

14-
ui->label_version->setText(tr("Version ") + APP_VERSION + "\n\n" +
14+
ui->label_version->setText(tr("Version ") + Application::versionString() + "\n\n" +
1515
tr("Qt Version ") + QT_VERSION_STR + "\n\n" +
1616
#ifdef ENABLE_SQLCIPHER
1717
tr("SQLCipher Version ") + SQLITE_VERSION

src/Application.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,7 @@ Application::Application(int& argc, char** argv) :
8989
qWarning() << qPrintable(tr(" [file]\t\tOpen this SQLite database"));
9090
m_dontShowMainWindow = true;
9191
} else if(arguments().at(i) == "-v" || arguments().at(i) == "--version") {
92-
// Distinguish between high and low patch version numbers. High numbers as in x.y.99 indicate nightly builds or
93-
// beta releases. For these we want to include the build date. For the release versions we don't add the release
94-
// date in order to avoid confusion about what is more important, version number or build date, and about different
95-
// build dates for the same version. This also should help making release builds reproducible out of the box.
96-
#if PATCH_VERSION >= 99
97-
QString build_date = QString(" (%1)").arg(__DATE__);
98-
#else
99-
QString build_date;
100-
#endif
101-
qWarning() << qPrintable(tr("This is DB Browser for SQLite version %1%2.").arg(APP_VERSION).arg(build_date));
92+
qWarning() << qPrintable(tr("This is DB Browser for SQLite version %1.").arg(versionString()));
10293
m_dontShowMainWindow = true;
10394
} else if(arguments().at(i) == "-s" || arguments().at(i) == "--sql") {
10495
// Run SQL file: If file exists add it to list of scripts to execute
@@ -170,3 +161,16 @@ bool Application::event(QEvent* event)
170161
return QApplication::event(event);
171162
}
172163
}
164+
165+
QString Application::versionString()
166+
{
167+
// Distinguish between high and low patch version numbers. High numbers as in x.y.99 indicate nightly builds or
168+
// beta releases. For these we want to include the build date. For the release versions we don't add the release
169+
// date in order to avoid confusion about what is more important, version number or build date, and about different
170+
// build dates for the same version. This also should help making release builds reproducible out of the box.
171+
#if PATCH_VERSION >= 99
172+
return QString("%1 (%2)").arg(APP_VERSION).arg(__DATE__);
173+
#else
174+
return QString("%1").arg(APP_VERSION);
175+
#endif
176+
}

src/Application.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class Application : public QApplication
1818

1919
MainWindow* mainWindow() { return m_mainWindow; }
2020

21+
static QString versionString();
22+
2123
protected:
2224
bool event(QEvent* event);
2325

0 commit comments

Comments
 (0)