Mon, 27 Jun 2022 02:01:52 +0300
One more hardcoded name
24 | 1 | /* |
2 | * LDForge: LDraw parts authoring CAD | |
3 | * Copyright (C) 2013 - 2020 Teemu Piippo | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
1 | 19 | #include <QString> |
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 | 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 | 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 | 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 | 31 | } |
32 | } | |
33 | ||
34 | static QString makeCommitTimeString() | |
35 | { | |
36 | QString result; | |
37 | #ifdef HG_DATE_TIME | |
38 | { | |
39 | char buffer[100]; | |
40 | constexpr time_t timestamp = HG_DATE_TIME; | |
41 | strftime (buffer, sizeof buffer, "%d %b %Y", localtime (×tamp)); | |
42 | result += buffer; | |
43 | } | |
44 | #endif | |
45 | return result; | |
46 | } | |
47 | ||
48 | const QString &commitTimeString() | |
49 | { | |
50 | static QString result = makeCommitTimeString(); | |
51 | return result; | |
52 | } |