summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2021-04-28 00:54:54 +0200
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2021-04-28 13:25:27 +0200
commit32f71415306ce9b1037a1e862bf81d680108665a (patch)
tree60ec560a26106fad0846591e3fb1c89d638927f9 /src
parent9ba57d6ad20920b1d413593ab40f5fc53ab717a4 (diff)
DlgAbout: Show git-describe version
Diffstat (limited to 'src')
-rw-r--r--src/dialog/dlgabout.cpp29
-rw-r--r--src/dialog/dlgaboutdlg.ui68
-rw-r--r--src/util/versionstore.cpp72
-rw-r--r--src/util/versionstore.h17
-rw-r--r--src/version.h.in7
5 files changed, 129 insertions, 64 deletions
diff --git a/src/dialog/dlgabout.cpp b/src/dialog/dlgabout.cpp
index 7174a46240..23003a132d 100644
--- a/src/dialog/dlgabout.cpp
+++ b/src/dialog/dlgabout.cpp
@@ -13,25 +13,9 @@ DlgAbout::DlgAbout(QWidget* parent) : QDialog(parent), Ui::DlgAboutDlg() {
mixxx_icon->load(QString(":/images/mixxx_icon.svg"));
mixxx_logo->load(QString(":/images/mixxx_logo.svg"));
- QString mixxxVersion = VersionStore::version();
- QString gitBranch = VersionStore::gitBranch();
- QString buildRevision = VersionStore::developmentRevision();
-
- QStringList version;
- version.append(mixxxVersion);
-
- if (!gitBranch.isEmpty() || !buildRevision.isEmpty()) {
- QStringList buildInfo;
- buildInfo.append("build");
- if (!gitBranch.isEmpty()) {
- buildInfo.append(gitBranch);
- }
- if (!buildRevision.isEmpty()) {
- buildInfo.append(QString("r%1").arg(buildRevision));
- }
- version.append(QString("(%1)").arg(buildInfo.join(" ")));
- }
- version_label->setText(version.join(" "));
+ version_label->setText(VersionStore::applicationName() +
+ QStringLiteral(" ") + VersionStore::version());
+ git_version_label->setText(VersionStore::gitVersion());
QFile licenseFile(":/LICENSE");
if (!licenseFile.open(QIODevice::ReadOnly)) {
@@ -40,7 +24,12 @@ DlgAbout::DlgAbout(QWidget* parent) : QDialog(parent), Ui::DlgAboutDlg() {
licenseText->setPlainText(licenseFile.readAll());
}
- QString s_devTeam = tr("Mixxx %1 Development Team").arg(mixxxVersion);
+ QString s_devTeam =
+ tr("Mixxx %1.%2 Development Team")
+ .arg(QString::number(
+ VersionStore::versionNumber().majorVersion()),
+ QString::number(VersionStore::versionNumber()
+ .minorVersion()));
QString s_contributions = tr("With contributions from:");
QString s_specialThanks = tr("And special thanks to:");
QString s_pastDevs = tr("Past Developers");
diff --git a/src/dialog/dlgaboutdlg.ui b/src/dialog/dlgaboutdlg.ui
index f52c992ef1..fc53c5320f 100644
--- a/src/dialog/dlgaboutdlg.ui
+++ b/src/dialog/dlgaboutdlg.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>300</width>
- <height>424</height>
+ <width>494</width>
+ <height>513</height>
</rect>
</property>
<property name="sizePolicy">
@@ -29,7 +29,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="QSvgWidget" name="mixxx_icon">
+ <widget class="QSvgWidget" name="mixxx_icon" native="true">
<property name="maximumSize">
<size>
<width>32</width>
@@ -39,7 +39,7 @@
</widget>
</item>
<item>
- <widget class="QSvgWidget" name="mixxx_logo">
+ <widget class="QSvgWidget" name="mixxx_logo" native="true">
<property name="maximumSize">
<size>
<width>170</width>
@@ -64,13 +64,49 @@
</layout>
</item>
<item>
- <widget class="QLabel" name="version_label">
- <property name="text">
- <string notr="true">2.x.x</string>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
+ <widget class="QWidget" name="widget" native="true">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="version_label">
+ <property name="text">
+ <string notr="true">Mixxx 2.x.x</string>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="1">
+ <widget class="QLabel" name="git_version_label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Unknown</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Git Version:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
</item>
<item>
@@ -107,7 +143,7 @@
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Droid Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;Credits go here&lt;/span&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -182,8 +218,16 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>QSvgWidget</class>
+ <extends>QWidget</extends>
+ <header>qsvgwidget.h</header>
+ </customwidget>
+ </customwidgets>
<resources>
<include location="../../res/mixxx.qrc"/>
<include location="../../res/mixxx.qrc"/>
</resources>
+ <connections/>
</ui>
diff --git a/src/util/versionstore.cpp b/src/util/versionstore.cpp
index 6d44a5a860..7dd8e52546 100644
--- a/src/util/versionstore.cpp
+++ b/src/util/versionstore.cpp
@@ -33,17 +33,33 @@
namespace {
-const QString kMixxxVersion = QStringLiteral(MIXXX_VERSION);
+const QVersionNumber kMixxxVersionNumber = QVersionNumber(
+ MIXXX_VERSION_MAJOR, MIXXX_VERSION_MINOR, MIXXX_VERSION_PATCH);
+const QString kMixxxVersionSuffix = QString(MIXXX_VERSION_SUFFIX);
const QString kMixxx = QStringLiteral("Mixxx");
-const QString kGitBranch = QStringLiteral(GIT_BRANCH);
-const QString kBuildRev = QStringLiteral(BUILD_REV);
-const QString kBuildFlags = QStringLiteral(BUILD_FLAGS);
+const QString kGitBranch = QString(GIT_BRANCH);
+const QString kGitDescribe = QString(GIT_DESCRIBE);
+const QString kBuildFlags = QString(BUILD_FLAGS);
} // namespace
// static
QString VersionStore::version() {
- return MIXXX_VERSION;
+ if (kMixxxVersionSuffix.isEmpty()) {
+ return kMixxxVersionNumber.toString();
+ } else {
+ return kMixxxVersionNumber.toString() + QStringLiteral("-") + kMixxxVersionSuffix;
+ }
+}
+
+// static
+QVersionNumber VersionStore::versionNumber() {
+ return kMixxxVersionNumber;
+}
+
+// static
+QString VersionStore::versionSuffix() {
+ return kMixxxVersionSuffix;
}
// static
@@ -55,21 +71,17 @@ QString VersionStore::applicationName() {
QString VersionStore::applicationTitle() {
#ifdef __APPLE__
QString base = kMixxx;
-#elif defined(AMD64) || defined(EM64T) || defined(x86_64)
- QString base("Mixxx " MIXXX_VERSION " x64");
-#elif defined(IA64)
- QString base("Mixxx " MIXXX_VERSION " Itanium");
#else
- QString base("Mixxx " MIXXX_VERSION);
+ QString base = kMixxx + QStringLiteral(" ") + VersionStore::version();
+#if defined(AMD64) || defined(EM64T) || defined(x86_64)
+ base.append(" x64");
+#elif defined(IA64)
+ base.append(" Itanium");
+#endif
#endif
#ifdef MIXXX_BUILD_NUMBER_IN_TITLE_BAR
- QString branch = developmentBranch();
- QString branch_revision = developmentRevision();
- if (!branch.isEmpty() && !branch_revision.isEmpty()) {
- base.append(QString(" (build %1-r%2)")
- .arg(branch, branch_revision));
- }
+ base.append(QStringLiteral(" - ") + VersionStore::gitVersion());
#endif
return base;
}
@@ -80,8 +92,23 @@ QString VersionStore::gitBranch() {
}
// static
-QString VersionStore::developmentRevision() {
- return kBuildRev;
+QString VersionStore::gitDescribe() {
+ return kGitDescribe;
+}
+
+// static
+QString VersionStore::gitVersion() {
+ QString gitVersion = VersionStore::gitDescribe();
+ if (gitVersion.isEmpty()) {
+ gitVersion = QStringLiteral("unknown");
+ }
+
+ QString gitBranch = VersionStore::gitBranch();
+ if (!gitBranch.isEmpty()) {
+ gitVersion.append(QStringLiteral(" (") + gitBranch + QStringLiteral(" branch)"));
+ }
+
+ return gitVersion;
}
// static
@@ -135,17 +162,10 @@ QStringList VersionStore::dependencyVersions() {
void VersionStore::logBuildDetails() {
QString version = VersionStore::version();
- QString buildRevision = developmentRevision();
QString buildFlags = VersionStore::buildFlags();
QStringList buildInfo;
- if (!kGitBranch.isEmpty() && !buildRevision.isEmpty()) {
- buildInfo.append(
- QString("git %1 r%2").arg(kGitBranch, buildRevision));
- } else if (!buildRevision.isEmpty()) {
- buildInfo.append(
- QString("git r%2").arg(buildRevision));
- }
+ buildInfo.append(QString("git %1").arg(VersionStore::gitVersion()));
#ifndef DISABLE_BUILDTIME // buildtime=1, on by default
buildInfo.append("built on: " __DATE__ " @ " __TIME__);
#endif
diff --git a/src/util/versionstore.h b/src/util/versionstore.h
index 5764355760..a844abbde4 100644
--- a/src/util/versionstore.h
+++ b/src/util/versionstore.h
@@ -1,12 +1,19 @@
#pragma once
#include <QString>
+#include <QVersionNumber>
class VersionStore {
public:
- // Returns the current Mixxx version (e.g. 1.12.0-alpha)
+ // Returns the current Mixxx version string (e.g. 1.12.0-alpha)
static QString version();
+ // Returns the current Mixxx version number (e.g. 1.12.0)
+ static QVersionNumber versionNumber();
+
+ // Returns the current Mixxx version suffix (e.g. "beta")
+ static QString versionSuffix();
+
// Returns the application name. (e.g. "Mixxx")
static QString applicationName();
@@ -17,9 +24,11 @@ class VersionStore {
// string if the branch is unknown.
static QString gitBranch();
- // Returns the development revision (e.g. git3096) or the null string if the
- // revision is unknown.
- static QString developmentRevision();
+ // Returns the output of "git describe"
+ static QString gitDescribe();
+
+ // Returns the output of "git describe" and the branch name (if available)
+ static QString gitVersion();
// Returns the build flags used to build Mixxx (e.g. "hid=1 modplug=0") or
// the null string if the flags are unknown.
diff --git a/src/version.h.in b/src/version.h.in
index b642184232..71c8381ab5 100644
--- a/src/version.h.in
+++ b/src/version.h.in
@@ -4,7 +4,10 @@
#error "Include only from versionstore.cpp do avoid unnecessary recompile on every commit."
#endif
-#define MIXXX_VERSION "@MIXXX_VERSION@"
+#define MIXXX_VERSION_MAJOR @CMAKE_PROJECT_VERSION_MAJOR@
+#define MIXXX_VERSION_MINOR @CMAKE_PROJECT_VERSION_MINOR@
+#define MIXXX_VERSION_PATCH @CMAKE_PROJECT_VERSION_PATCH@
+#define MIXXX_VERSION_SUFFIX "@MIXXX_VERSION_PRERELEASE@"
#define GIT_BRANCH "@GIT_BRANCH@"
-#define BUILD_REV "@GIT_COMMIT_COUNT@"
+#define GIT_DESCRIBE "@GIT_DESCRIBE@"
#define BUILD_FLAGS "@BUILD_FLAGS@"