src/version.cpp

Mon, 27 Jun 2022 23:57:47 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Mon, 27 Jun 2022 23:57:47 +0300
changeset 277
3406191af523
parent 273
57952c5ca59b
child 280
d0774130e860
permissions
-rw-r--r--

Add missing third party acknowledgements

24
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
1 /*
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
2 * LDForge: LDraw parts authoring CAD
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
3 * Copyright (C) 2013 - 2020 Teemu Piippo
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
4 *
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
5 * This program is free software: you can redistribute it and/or modify
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
6 * it under the terms of the GNU General Public License as published by
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
8 * (at your option) any later version.
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
9 *
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
10 * This program is distributed in the hope that it will be useful,
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
13 * GNU General Public License for more details.
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
14 *
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
15 * You should have received a copy of the GNU General Public License
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
17 */
1a0faaaceb84 added license
Teemu Piippo <teemu@hecknology.net>
parents: 1
diff changeset
18
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 #include <QString>
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
20 #include <QDateTime>
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 #include <time.h>
264
76a025db4948 Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 250
diff changeset
22 #include <hginfo.h>
76a025db4948 Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 250
diff changeset
23 #include "src/version.h"
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
25 #ifdef HG_ALL_TAGS
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
26 # define HGTEXT HG_NODE " (" HG_ALL_TAGS ")"
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
27 #else
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
28 # define HGTEXT HG_NODE
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
29 #endif
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
30
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
31 QString detailedVersionString()
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 {
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
33 return QStringLiteral(VERSION_STRING "-" HGTEXT)
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
34 + " (" + revisionDateString() + ")";
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35 }
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
37 QString versionString()
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
38 {
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
39 #ifndef HG_VERSION_TAG
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
40 return detailedVersionString();
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
41 #else
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
42 return QStringLiteral(HG_VERSION_TAG);
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
43 #endif
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
44 }
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
45
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
46 static QString makeFullVersionString()
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
47 {
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
48 QString versionstring = APPNAME " " + versionString();
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
49 return versionstring;
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
50 }
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
51
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
52 const QString& fullVersionString()
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
53 {
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
54 static const QString cached = makeFullVersionString();
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
55 return cached;
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
56 }
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
57
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
58 QString revisionDateString()
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
59 {
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
60 const QDateTime dt = QDateTime::fromSecsSinceEpoch(HG_DATE_TIME);
273
57952c5ca59b Adjust date string
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 272
diff changeset
61 return dt.toString(QObject::tr("d MMM yyyy"));
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
62 }

mercurial