46 cfg (Bool, firststart, true); |
46 cfg (Bool, firststart, true); |
47 |
47 |
48 // ============================================================================= |
48 // ============================================================================= |
49 // ----------------------------------------------------------------------------- |
49 // ----------------------------------------------------------------------------- |
50 int main (int argc, char* argv[]) |
50 int main (int argc, char* argv[]) |
51 { QApplication app (argc, argv); |
51 { |
|
52 QApplication app (argc, argv); |
52 app.setOrganizationName (APPNAME); |
53 app.setOrganizationName (APPNAME); |
53 app.setApplicationName (APPNAME); |
54 app.setApplicationName (APPNAME); |
54 g_app = &app; |
55 g_app = &app; |
55 |
56 |
56 initCrashCatcher(); |
57 initCrashCatcher(); |
57 LDDocument::setCurrent (null); |
58 LDDocument::setCurrent (null); |
58 |
59 |
59 // Load or create the configuration |
60 // Load or create the configuration |
60 if (!Config::load()) |
61 if (!Config::load()) |
61 { log ("Creating configuration file...\n"); |
62 { |
|
63 log ("Creating configuration file...\n"); |
62 |
64 |
63 if (Config::save()) |
65 if (Config::save()) |
64 log ("Configuration file successfully created.\n"); |
66 log ("Configuration file successfully created.\n"); |
65 else |
67 else |
66 log ("failed to create configuration file!\n"); |
68 log ("failed to create configuration file!\n"); |
85 } |
88 } |
86 |
89 |
87 // ============================================================================= |
90 // ============================================================================= |
88 // ----------------------------------------------------------------------------- |
91 // ----------------------------------------------------------------------------- |
89 void doPrint (File& f, initlist<StringFormatArg> args) |
92 void doPrint (File& f, initlist<StringFormatArg> args) |
90 { str msg = DoFormat (args); |
93 { |
|
94 str msg = DoFormat (args); |
91 f.write (msg.toUtf8()); |
95 f.write (msg.toUtf8()); |
92 f.flush(); |
96 f.flush(); |
93 } |
97 } |
94 |
98 |
95 // ============================================================================= |
99 // ============================================================================= |
96 // ----------------------------------------------------------------------------- |
100 // ----------------------------------------------------------------------------- |
97 void doPrint (FILE* fp, initlist<StringFormatArg> args) |
101 void doPrint (FILE* fp, initlist<StringFormatArg> args) |
98 { str msg = DoFormat (args); |
102 { |
|
103 str msg = DoFormat (args); |
99 fwrite (msg.toStdString().c_str(), 1, msg.length(), fp); |
104 fwrite (msg.toStdString().c_str(), 1, msg.length(), fp); |
100 fflush (fp); |
105 fflush (fp); |
101 } |
106 } |
102 |
107 |
103 // ============================================================================= |
108 // ============================================================================= |
104 // ----------------------------------------------------------------------------- |
109 // ----------------------------------------------------------------------------- |
105 QString versionString() |
110 QString versionString() |
106 { if (g_versionString.length() == 0) |
111 { |
|
112 if (g_versionString.length() == 0) |
107 { |
113 { |
108 #if VERSION_PATCH == 0 |
114 #if VERSION_PATCH == 0 |
109 g_versionString = fmt ("%1.%2", VERSION_MAJOR, VERSION_MINOR); |
115 g_versionString = fmt ("%1.%2", VERSION_MAJOR, VERSION_MINOR); |
110 #else |
116 #else |
111 g_versionString = fmt ("%1.%2.%3", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); |
117 g_versionString = fmt ("%1.%2.%3", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); |