src/version.cpp

Sun, 03 Jul 2022 13:44:11 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sun, 03 Jul 2022 13:44:11 +0300
changeset 319
9727e545b0bc
parent 295
4241d948af28
permissions
-rw-r--r--

Extract the triangulation and triangle merging code into a new source file and clean it up somewhat

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>
280
d0774130e860 Fix build
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 273
diff changeset
21 #include <QObject>
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 #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
23 #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
24 #include "src/version.h"
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
26 #ifdef HG_ALL_TAGS
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
27 # 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
28 #else
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
29 # define HGTEXT HG_NODE
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
30 #endif
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
31
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 280
diff changeset
32 QString detailedVersionString(QLocale::FormatType formatType)
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 {
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 280
diff changeset
34 return QStringLiteral(CMAKE_PROJECT_VERSION "-" HGTEXT)
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 280
diff changeset
35 + " (" + revisionDateString(formatType) + ")";
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36 }
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 280
diff changeset
38 QString versionString(QLocale::FormatType formatType)
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
39 {
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
40 #ifndef HG_VERSION_TAG
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 280
diff changeset
41 return detailedVersionString(formatType);
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
42 #else
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
43 return QStringLiteral(HG_VERSION_TAG);
1
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 }
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
46
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 280
diff changeset
47 static QString makeFullVersionString(QLocale::FormatType formatType)
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
48 {
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 280
diff changeset
49 QString versionstring = CMAKE_PROJECT_NAME " " + versionString(formatType);
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
50 return versionstring;
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
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 280
diff changeset
53 const QString& fullVersionString(QLocale::FormatType formatType)
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
54 {
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 280
diff changeset
55 static const QString cached = makeFullVersionString(formatType);
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
56 return cached;
1
51d14b0c68c0 add version
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
57 }
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
58
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 280
diff changeset
59 QString revisionDateString(QLocale::FormatType formatType)
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
60 {
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
61 const QDateTime dt = QDateTime::fromSecsSinceEpoch(HG_DATE_TIME);
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 280
diff changeset
62 return QLocale{}.toString(dt.date(), formatType);
272
9d52b119b3f5 Sort out versions more, add about page
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 268
diff changeset
63 }

mercurial