20 #include "crashCatcher.h" |
20 #include "crashCatcher.h" |
21 #include "ldpaths.h" |
21 #include "ldpaths.h" |
22 #include "documentmanager.h" |
22 #include "documentmanager.h" |
23 #include "mainwindow.h" |
23 #include "mainwindow.h" |
24 |
24 |
|
25 /* |
|
26 * Returns the configuration singleton. |
|
27 */ |
25 Configuration& configuration() |
28 Configuration& configuration() |
26 { |
29 { |
27 static Configuration configuration; |
30 static Configuration configuration; |
28 return configuration; |
31 return configuration; |
29 } |
32 } |
30 |
33 |
31 int main (int argc, char* argv[]) |
34 /* |
|
35 * Runs the main LDforge application. |
|
36 */ |
|
37 int main(int argc, char* argv[]) |
32 { |
38 { |
33 QApplication app (argc, argv); |
39 QApplication app {argc, argv}; |
34 app.setOrganizationName (APPNAME); |
40 app.setOrganizationName(APPNAME); |
35 app.setApplicationName (APPNAME); |
41 app.setApplicationName(APPNAME); |
36 |
42 |
37 LDPaths* paths = new LDPaths(&configuration()); |
43 // Abort if we don't have a valid LDraw library path. |
38 paths->checkPaths(); |
44 if (not LDPaths {}.checkPaths()) |
39 paths->deleteLater(); |
45 return 1; |
40 |
46 |
41 initializeCrashHandler(); |
47 initializeCrashHandler(); |
42 LDColor::initColors(); |
48 LDColor::initColors(); |
43 MainWindow mainWindow; |
49 MainWindow mainWindow; |
44 mainWindow.show(); |
50 mainWindow.show(); |
45 |
51 |
46 // Process the command line |
52 // Process the command line |
47 for (int arg = 1; arg < argc; ++arg) |
53 for (int arg = 1; arg < argc; ++arg) |
48 mainWindow.documents()->openMainModel(QString::fromLocal8Bit (argv[arg])); |
54 mainWindow.documents()->openMainModel(QString::fromLocal8Bit(argv[arg])); |
49 |
55 |
50 return app.exec(); |
56 return app.exec(); |
51 } |
57 } |