1 /* |
|
2 * LDForge: LDraw parts authoring CAD |
|
3 * Copyright (C) 2013, 2014 Santeri 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 |
|
19 #include <QApplication> |
|
20 #include <QMessageBox> |
|
21 #include <QAbstractButton> |
|
22 #include <QFile> |
|
23 #include <QTextStream> |
|
24 #include <QDir> |
|
25 #include <QDate> |
|
26 #include "MainWindow.h" |
|
27 #include "Document.h" |
|
28 #include "Misc.h" |
|
29 #include "Configuration.h" |
|
30 #include "Colors.h" |
|
31 #include "Types.h" |
|
32 #include "Primitives.h" |
|
33 #include "GLRenderer.h" |
|
34 #include "ConfigurationDialog.h" |
|
35 #include "Dialogs.h" |
|
36 #include "CrashCatcher.h" |
|
37 |
|
38 QList<LDDocument*> g_loadedFiles; |
|
39 MainWindow* g_win = null; |
|
40 static QString g_versionString, g_fullVersionString; |
|
41 |
|
42 const Vertex g_origin (0.0f, 0.0f, 0.0f); |
|
43 const Matrix g_identity ({1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}); |
|
44 |
|
45 cfg (Bool, firststart, true); |
|
46 |
|
47 // ============================================================================= |
|
48 // |
|
49 int main (int argc, char* argv[]) |
|
50 { |
|
51 QApplication app (argc, argv); |
|
52 app.setOrganizationName (APPNAME); |
|
53 app.setApplicationName (APPNAME); |
|
54 initCrashCatcher(); |
|
55 LDDocument::setCurrent (null); |
|
56 |
|
57 // Load or create the configuration |
|
58 if (!Config::load()) |
|
59 { |
|
60 print ("Creating configuration file...\n"); |
|
61 |
|
62 if (Config::save()) |
|
63 print ("Configuration file successfully created.\n"); |
|
64 else |
|
65 critical ("Failed to create configuration file!\n"); |
|
66 } |
|
67 |
|
68 LDPaths::initPaths(); |
|
69 initColors(); |
|
70 MainWindow* win = new MainWindow; |
|
71 newFile(); |
|
72 win->show(); |
|
73 |
|
74 // If this is the first start, get the user to configuration. Especially point |
|
75 // them to the profile tab, it's the most important form to fill in. |
|
76 if (firststart) |
|
77 { |
|
78 (new ConfigDialog (ConfigDialog::ProfileTab))->exec(); |
|
79 firststart = false; |
|
80 Config::save(); |
|
81 } |
|
82 |
|
83 loadPrimitives(); |
|
84 return app.exec(); |
|
85 } |
|