Mon, 27 Jun 2022 01:29:03 +0300
rename ldforge.qrc -> resources.qrc
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 | |
24 | static QString makeVersionString(const Version &version) | |
25 | { | |
26 | QString result = QString::number(version.major) + "." + QString::number(version.minor); | |
27 | if (version.patch != 0) { | |
28 | result += "."; | |
29 | result += QString::number(version.patch); | |
30 | } | |
31 | return result; | |
32 | } | |
33 | ||
34 | const QString& fullVersionString() | |
35 | { | |
36 | #ifdef HG_DATE_VERSION | |
250
2837b549e616
I felt that the compiler was too kind to me, so I enabled a big pile of warnings
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
24
diff
changeset
|
37 | if (::BUILD_TYPE != ReleaseBuild) { |
2837b549e616
I felt that the compiler was too kind to me, so I enabled a big pile of warnings
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
24
diff
changeset
|
38 | static const QString result = makeVersionString(APPVERSION) + "-" HG_DATE_VERSION; |
1 | 39 | return result; |
40 | } | |
41 | #else | |
42 | static const QString result = makeVersionString(::version); | |
43 | return result; | |
44 | #endif | |
45 | } | |
46 | ||
47 | static QString makeCommitTimeString() | |
48 | { | |
49 | QString result; | |
50 | #ifdef HG_DATE_TIME | |
51 | { | |
52 | char buffer[100]; | |
53 | constexpr time_t timestamp = HG_DATE_TIME; | |
54 | strftime (buffer, sizeof buffer, "%d %b %Y", localtime (×tamp)); | |
55 | result += buffer; | |
56 | } | |
57 | #endif | |
58 | return result; | |
59 | } | |
60 | ||
61 | const QString &commitTimeString() | |
62 | { | |
63 | static QString result = makeCommitTimeString(); | |
64 | return result; | |
65 | } |