Wed, 21 Aug 2013 10:54:33 +0300
more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
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" |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | |
409
8da2563c645a
Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents:
402
diff
changeset
|
34 | List<LDFile*> g_loadedFiles; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | ForgeWindow* g_win = null; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | 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
|
37 | 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
|
38 | File g_file_stderr (stderr, File::Write); |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
39 | 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
|
40 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | const vertex g_origin (0.0f, 0.0f, 0.0f); |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
42 | 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
|
43 | |
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
|
44 | 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
|
45 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | // ============================================================================= |
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
|
47 | // ----------------------------------------------------------------------------- |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | int main (int argc, char* argv[]) { |
436
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
49 | QApplication app (argc, argv); |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
50 | app.setOrganizationName (APPNAME); |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
51 | app.setApplicationName (APPNAME); |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
52 | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
261
diff
changeset
|
53 | g_app = &app; |
409
8da2563c645a
Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents:
402
diff
changeset
|
54 | LDFile::setCurrent (null); |
261
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
247
diff
changeset
|
55 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | // Load or create the configuration |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
458
diff
changeset
|
57 | if (!Config::load()) { |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
287
diff
changeset
|
58 | print ("Creating configuration file...\n"); |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
458
diff
changeset
|
59 | if (Config::save()) |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
287
diff
changeset
|
60 | print ("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
|
61 | else |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
287
diff
changeset
|
62 | print ("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
|
63 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
65 | LDPaths::initPaths(); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
66 | 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
|
67 | loadLogoedStuds(); |
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
|
68 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | 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
|
70 | 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
|
71 | win->show(); |
292
4779ca562d5e
Moved primitive handling to new code files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
290
diff
changeset
|
72 | |
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
|
73 | // 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
|
74 | // them to the profile tab, it's the most important form to fill in. |
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 | if (firststart) { |
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
|
76 | (new ConfigDialog (ConfigDialog::ProfileTab))->exec(); |
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 | 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
|
78 | 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
|
79 | } |
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
|
80 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
81 | loadPrimitives(); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
82 | return app.exec(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | |
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
|
85 | // ============================================================================= |
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
|
86 | // ----------------------------------------------------------------------------- |
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
|
87 | void doPrint (File& f, initlist<StringFormatArg> args) { |
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
|
88 | str msg = DoFormat (args); |
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 | 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
|
90 | f.flush(); |
229
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
91 | } |
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
92 | |
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 | // ============================================================================= |
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 | // ----------------------------------------------------------------------------- |
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
|
95 | void doPrint (FILE* fp, initlist<StringFormatArg> args) { |
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
|
96 | if (fp == stdout) |
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 | doPrint (g_file_stdout, args); |
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 | elif (fp == stderr) |
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
|
99 | doPrint (g_file_stderr, args); |
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
|
100 | else |
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
|
101 | fatal ("unknown FILE* argument"); |
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
|
102 | } |
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 | // ----------------------------------------------------------------------------- |
437
51313dba897d
corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
106 | str versionString() { |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
107 | if (g_versionString.length() == 0) { |
229
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
108 | #if VERSION_PATCH == 0 |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
109 | 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
|
110 | #else |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
111 | 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
|
112 | #endif // VERSION_PATCH |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
113 | } |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
114 | |
437
51313dba897d
corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
115 | return g_versionString; |
229
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
116 | } |
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
117 | |
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
|
118 | // ============================================================================= |
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
|
119 | // ----------------------------------------------------------------------------- |
437
51313dba897d
corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
120 | str versionMoniker() { |
229
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
121 | #if BUILD_ID == BUILD_INTERNAL |
437
51313dba897d
corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
122 | return "Internal"; |
229
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
123 | #elif BUILD_ID == BUILD_ALPHA |
437
51313dba897d
corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
124 | return "Alpha"; |
229
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
125 | #elif BUILD_ID == BUILD_BETA |
437
51313dba897d
corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
126 | return "Beta"; |
229
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
127 | #elif BUILD_ID == BUILD_RC |
437
51313dba897d
corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
128 | 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
|
129 | #else |
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
130 | return ""; |
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
131 | #endif // BUILD_ID |
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
132 | } |
b9e101b76eb3
Show the version info in the about dialog properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
133 | |
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
|
134 | // ============================================================================= |
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
|
135 | // ----------------------------------------------------------------------------- |
437
51313dba897d
corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
136 | str fullVersionString() { |
51313dba897d
corrected problems with the version string
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
137 | return fmt ("v%1 %2", versionString(), versionMoniker()); |
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
|
138 | } |
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
|
139 | |
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
|
140 | // ============================================================================= |
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
|
141 | // ----------------------------------------------------------------------------- |
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
|
142 | static void bombBox (str msg) { |
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
|
143 | msg.replace ("\n", "<br />"); |
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
|
144 | |
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
|
145 | QMessageBox box (null); |
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
|
146 | const QMessageBox::StandardButton btn = QMessageBox::Close; |
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
|
147 | box.setWindowTitle ("Fatal Error"); |
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
|
148 | box.setIconPixmap (getIcon ("bomb")); |
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
|
149 | box.setWindowIcon (getIcon ("ldforge")); |
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
|
150 | box.setText (msg); |
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
|
151 | box.addButton (btn); |
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
|
152 | box.button (btn)->setText ("Damn it"); |
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
|
153 | box.setDefaultButton (btn); |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
154 | box.exec(); |
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
|
155 | } |
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
|
156 | |
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
|
157 | // ============================================================================= |
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
|
158 | // ----------------------------------------------------------------------------- |
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
|
159 | void assertionFailure (const char* file, const ulong line, const char* funcname, const char* expr) { |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
271
diff
changeset
|
160 | str errmsg = fmt ("File: %1\nLine: %2:\nFunction %3:\n\nAssertion `%4' failed", |
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
|
161 | file, line, funcname, expr); |
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
|
162 | |
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
|
163 | #if BUILD_ID == BUILD_INTERNAL |
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
|
164 | errmsg += ", aborting."; |
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
|
165 | #else |
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
|
166 | errmsg += "."; |
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
|
167 | #endif |
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
|
168 | |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
169 | printf ("%s\n", errmsg.toStdString().c_str()); |
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
|
170 | |
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
|
171 | #if BUILD_ID == BUILD_INTERNAL |
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
|
172 | if (g_win) |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
173 | g_win->deleteLater(); |
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
|
174 | |
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
|
175 | bombBox (errmsg); |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
176 | abort(); |
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
|
177 | #endif |
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
|
178 | } |
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
|
179 | |
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
|
180 | // ============================================================================= |
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
|
181 | // ----------------------------------------------------------------------------- |
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
|
182 | void fatalError (const char* file, const ulong line, const char* funcname, str msg) { |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
271
diff
changeset
|
183 | str errmsg = fmt ("Aborting over a call to fatal():\nFile: %1\nLine: %2\nFunction: %3\n\n%4", |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
271
diff
changeset
|
184 | file, line, funcname, msg); |
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
|
185 | |
292
4779ca562d5e
Moved primitive handling to new code files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
290
diff
changeset
|
186 | print ("%1\n", errmsg); |
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
|
187 | |
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
|
188 | if (g_win) |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
189 | g_win->deleteLater(); |
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
|
190 | |
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
|
191 | bombBox (errmsg); |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
192 | abort(); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
193 | } |