src/main.cpp

Thu, 09 Mar 2017 12:50:14 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 09 Mar 2017 12:50:14 +0200
changeset 1209
c2723022b173
parent 1208
8d4b8a9df724
permissions
-rw-r--r--

Laid groundwork for library collection support.

655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
1072
9ce9496427f2 Happy new year 2017!
Teemu Piippo <teemu@hecknology.net>
parents: 1070
diff changeset
3 * Copyright (C) 2013 - 2017 Teemu Piippo
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include <QApplication>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include "crashCatcher.h"
953
8349552ee5e9 Refactor LDrawPathDialog and LDPaths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 952
diff changeset
21 #include "ldpaths.h"
998
5be0ce31ce60 Now compiles again
Teemu Piippo <crimsondusk64@gmail.com>
parents: 987
diff changeset
22 #include "documentmanager.h"
1018
49358df9495b Transformed primitive management into a new class PrimitiveManager that is a member of MainWindow
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1017
diff changeset
23 #include "mainwindow.h"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24
1208
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
25 /*
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
26 * Returns the configuration singleton.
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
27 */
1192
317f4ce38f3f Made configuration a global singleton. I think I can give in at least that much because it makes solving a lot of problems easier.
Teemu Piippo <teemu@hecknology.net>
parents: 1161
diff changeset
28 Configuration& configuration()
317f4ce38f3f Made configuration a global singleton. I think I can give in at least that much because it makes solving a lot of problems easier.
Teemu Piippo <teemu@hecknology.net>
parents: 1161
diff changeset
29 {
317f4ce38f3f Made configuration a global singleton. I think I can give in at least that much because it makes solving a lot of problems easier.
Teemu Piippo <teemu@hecknology.net>
parents: 1161
diff changeset
30 static Configuration configuration;
317f4ce38f3f Made configuration a global singleton. I think I can give in at least that much because it makes solving a lot of problems easier.
Teemu Piippo <teemu@hecknology.net>
parents: 1161
diff changeset
31 return configuration;
317f4ce38f3f Made configuration a global singleton. I think I can give in at least that much because it makes solving a lot of problems easier.
Teemu Piippo <teemu@hecknology.net>
parents: 1161
diff changeset
32 }
317f4ce38f3f Made configuration a global singleton. I think I can give in at least that much because it makes solving a lot of problems easier.
Teemu Piippo <teemu@hecknology.net>
parents: 1161
diff changeset
33
1208
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
34 /*
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
35 * Runs the main LDforge application.
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
36 */
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
37 int main(int argc, char* argv[])
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 {
1208
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
39 QApplication app {argc, argv};
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
40 app.setOrganizationName(APPNAME);
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
41 app.setApplicationName(APPNAME);
1012
413ecd6b9801 It worx again!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 998
diff changeset
42
1208
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
43 // Abort if we don't have a valid LDraw library path.
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
44 if (not LDPaths {}.checkPaths())
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
45 return 1;
1012
413ecd6b9801 It worx again!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 998
diff changeset
46
1058
695edd4f0411 Cleaned up crash catcher, fixed missing <math.h> include
Teemu Piippo <teemu@hecknology.net>
parents: 1029
diff changeset
47 initializeCrashHandler();
1114
ffd49a28f49e Moved some global constants into appropriate namespaces.
Teemu Piippo <teemu@hecknology.net>
parents: 1086
diff changeset
48 LDColor::initColors();
1192
317f4ce38f3f Made configuration a global singleton. I think I can give in at least that much because it makes solving a lot of problems easier.
Teemu Piippo <teemu@hecknology.net>
parents: 1161
diff changeset
49 MainWindow mainWindow;
317f4ce38f3f Made configuration a global singleton. I think I can give in at least that much because it makes solving a lot of problems easier.
Teemu Piippo <teemu@hecknology.net>
parents: 1161
diff changeset
50 mainWindow.show();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51
864
34033bc2ffb6 - ldforge can now open files from command-line input
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
52 // Process the command line
34033bc2ffb6 - ldforge can now open files from command-line input
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
53 for (int arg = 1; arg < argc; ++arg)
1208
8d4b8a9df724 Some cleanup in LDPaths
Teemu Piippo <teemu@hecknology.net>
parents: 1192
diff changeset
54 mainWindow.documents()->openMainModel(QString::fromLocal8Bit(argv[arg]));
864
34033bc2ffb6 - ldforge can now open files from command-line input
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
55
987
91281e39c50c Removed the exiting hacks
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
56 return app.exec();
1012
413ecd6b9801 It worx again!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 998
diff changeset
57 }

mercurial