src/version.cpp

Mon, 27 Jun 2022 02:00:49 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Mon, 27 Jun 2022 02:00:49 +0300
changeset 270
1202b102a10b
parent 268
fb319526ba6c
child 272
9d52b119b3f5
permissions
-rw-r--r--

Fix qrc path in mainwindow.ui

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>
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 #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
21 #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
22 #include "src/version.h"
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23
268
fb319526ba6c Define application name and version in CMakeLists
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 264
diff changeset
24 const char* fullVersionString()
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 {
268
fb319526ba6c Define application name and version in CMakeLists
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 264
diff changeset
26 if (::BUILD_TYPE != ReleaseBuild) {
fb319526ba6c Define application name and version in CMakeLists
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 264
diff changeset
27 return VERSION_STRING "-" HG_DATE_VERSION;
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 }
268
fb319526ba6c Define application name and version in CMakeLists
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 264
diff changeset
29 else {
fb319526ba6c Define application name and version in CMakeLists
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 264
diff changeset
30 return VERSION_STRING;
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 }
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 }
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34 static QString makeCommitTimeString()
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35 {
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36 QString result;
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37 #ifdef HG_DATE_TIME
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
38 {
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
39 char buffer[100];
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
40 constexpr time_t timestamp = HG_DATE_TIME;
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
41 strftime (buffer, sizeof buffer, "%d %b %Y", localtime (&timestamp));
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
42 result += buffer;
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
43 }
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
44 #endif
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
45 return result;
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
46 }
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
47
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
48 const QString &commitTimeString()
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
49 {
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
50 static QString result = makeCommitTimeString();
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
51 return result;
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
52 }

mercurial