src/main.cpp

Fri, 18 Oct 2013 21:52:09 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Fri, 18 Oct 2013 21:52:09 +0300
changeset 513
29eb671b34f6
parent 504
6a1fa662bfc1
child 553
2418d5955421
permissions
-rw-r--r--

Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().

183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
4 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
9 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
14 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include <QApplication>
237
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
20 #include <QMessageBox>
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
21 #include <QAbstractButton>
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
22 #include <QFile>
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
23 #include <QTextStream>
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include "gui.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include "file.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include "misc.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 #include "config.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 #include "colors.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 #include "types.h"
292
4779ca562d5e Moved primitive handling to new code files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 290
diff changeset
30 #include "primitives.h"
458
cb360f4d8979 Rewrote stud logo support, restructuring inlining stuff in the process. Logoed studs must only be used for rendering scenes, otherwise they will for instance get inlined in and that's not desired, or the vertex snapper will catch onto the logo's coordinates.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 455
diff changeset
31 #include "gldraw.h"
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
32 #include "configDialog.h"
513
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
33 #include "dialogs.h"
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
34 #include "crashcatcher.h"
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
36 QList<LDFile*> g_loadedFiles;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
37 ForgeWindow* g_win = null;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 const QApplication* g_app = null;
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
39 File g_file_stdout (stdout, File::Write);
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
40 File g_file_stderr (stderr, File::Write);
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
41 static str g_versionString, g_fullVersionString;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 const vertex g_origin (0.0f, 0.0f, 0.0f);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
44 const matrix g_identity ( {1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f});
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
46 cfg (Bool, firststart, true);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
47
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
49 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
50 int main (int argc, char* argv[])
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
51 { QApplication app (argc, argv);
436
4268a5507725 Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
52 app.setOrganizationName (APPNAME);
4268a5507725 Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
53 app.setApplicationName (APPNAME);
513
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
54 g_app = &app;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
55
513
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
56 initCrashCatcher();
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
57 LDFile::setCurrent (null);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
58
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 // Load or create the configuration
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
60 if (!Config::load())
513
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
61 { log ("Creating configuration file...\n");
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
62
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
63 if (Config::save())
513
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
64 log ("Configuration file successfully created.\n");
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65 else
513
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
66 log ("failed to create configuration file!\n");
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
68
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 409
diff changeset
69 LDPaths::initPaths();
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 409
diff changeset
70 initColors();
458
cb360f4d8979 Rewrote stud logo support, restructuring inlining stuff in the process. Logoed studs must only be used for rendering scenes, otherwise they will for instance get inlined in and that's not desired, or the vertex snapper will catch onto the logo's coordinates.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 455
diff changeset
71 loadLogoedStuds();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
72
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 ForgeWindow* win = new ForgeWindow;
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
74 newFile();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
75 win->show();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
76
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
77 // If this is the first start, get the user to configuration. Especially point
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
78 // them to the profile tab, it's the most important form to fill in.
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
79 if (firststart)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
80 { (new ConfigDialog (ConfigDialog::ProfileTab))->exec();
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
81 firststart = false;
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
82 Config::save();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
83 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
84
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 409
diff changeset
85 loadPrimitives();
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 409
diff changeset
86 return app.exec();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
89 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
90 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
91 void doPrint (File& f, initlist<StringFormatArg> args)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
92 { str msg = DoFormat (args);
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
93 f.write (msg.toUtf8());
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
94 f.flush();
229
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
95 }
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
96
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
97 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
98 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
99 void doPrint (FILE* fp, initlist<StringFormatArg> args)
497
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
100 { str msg = DoFormat (args);
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
101 fwrite (msg.toStdString().c_str(), 1, msg.length(), fp);
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
102 fflush (fp);
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
103 }
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
104
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
105 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
106 // -----------------------------------------------------------------------------
497
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
107 QString versionString()
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
108 { if (g_versionString.length() == 0)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
109 {
229
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
110 #if VERSION_PATCH == 0
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
111 g_versionString = fmt ("%1.%2", VERSION_MAJOR, VERSION_MINOR);
229
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
112 #else
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
113 g_versionString = fmt ("%1.%2.%3", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
229
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
114 #endif // VERSION_PATCH
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
115 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
116
437
51313dba897d corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
117 return g_versionString;
229
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
118 }
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
119
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
120 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
121 // -----------------------------------------------------------------------------
497
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
122 QString versionMoniker()
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
123 {
229
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
124 #if BUILD_ID == BUILD_INTERNAL
437
51313dba897d corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
125 return "Internal";
229
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
126 #elif BUILD_ID == BUILD_ALPHA
437
51313dba897d corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
127 return "Alpha";
229
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
128 #elif BUILD_ID == BUILD_BETA
437
51313dba897d corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
129 return "Beta";
229
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
130 #elif BUILD_ID == BUILD_RC
437
51313dba897d corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
131 return fmt ("RC %1", RC_NUMBER);
229
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
132 #else
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
133 return "";
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
134 #endif // BUILD_ID
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
135 }
b9e101b76eb3 Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
136
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
137 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 437
diff changeset
138 // -----------------------------------------------------------------------------
497
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
139 QString fullVersionString()
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
140 { return fmt ("v%1 %2", versionString(), versionMoniker());
497
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
141 }

mercurial