src/main.cc

changeset 611
6679e47b019f
parent 609
a8dc74a809c6
child 613
2d01590da286
equal deleted inserted replaced
610:f8244301110d 611:6679e47b019f
19 #include <QApplication> 19 #include <QApplication>
20 #include <QMessageBox> 20 #include <QMessageBox>
21 #include <QAbstractButton> 21 #include <QAbstractButton>
22 #include <QFile> 22 #include <QFile>
23 #include <QTextStream> 23 #include <QTextStream>
24 #include <QDir>
24 #include "gui.h" 25 #include "gui.h"
25 #include "document.h" 26 #include "document.h"
26 #include "misc.h" 27 #include "misc.h"
27 #include "config.h" 28 #include "config.h"
28 #include "colors.h" 29 #include "colors.h"
33 #include "dialogs.h" 34 #include "dialogs.h"
34 #include "crashcatcher.h" 35 #include "crashcatcher.h"
35 36
36 QList<LDDocument*> g_loadedFiles; 37 QList<LDDocument*> g_loadedFiles;
37 ForgeWindow* g_win = null; 38 ForgeWindow* g_win = null;
38 const QApplication* g_app = null;
39 static QString g_versionString, g_fullVersionString; 39 static QString g_versionString, g_fullVersionString;
40 40
41 const Vertex g_origin (0.0f, 0.0f, 0.0f); 41 const Vertex g_origin (0.0f, 0.0f, 0.0f);
42 const Matrix g_identity ({1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}); 42 const Matrix g_identity ({1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f});
43 43
44 cfg (Bool, firststart, true); 44 cfg (Bool, firststart, true);
45
46 static QString g_argv0;
47
48 QString getApplicationDirectory()
49 {
50 assert (g_argv0.isEmpty() == false);
51
52 if (g_argv0.indexOf (DIRSLASH) != -1)
53 return dirname (g_argv0);
54
55 return ".";
56 }
45 57
46 // ============================================================================= 58 // =============================================================================
47 // ----------------------------------------------------------------------------- 59 // -----------------------------------------------------------------------------
48 int main (int argc, char* argv[]) 60 int main (int argc, char* argv[])
49 { 61 {
50 QApplication app (argc, argv); 62 QApplication app (argc, argv);
51 app.setOrganizationName (APPNAME); 63 app.setOrganizationName (APPNAME);
52 app.setApplicationName (APPNAME); 64 app.setApplicationName (APPNAME);
53 g_app = &app; 65 g_argv0 = argv[0];
54
55 initCrashCatcher(); 66 initCrashCatcher();
56 LDDocument::setCurrent (null); 67 LDDocument::setCurrent (null);
57 68
58 // Load or create the configuration 69 // Load or create the configuration
59 if (!Config::load()) 70 if (!Config::load())

mercurial