src/main.cc

changeset 603
47e7773c7841
parent 600
209e3f1f7b2c
child 604
01bdac75994a
equal deleted inserted replaced
602:ac1744536b33 603:47e7773c7841
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");
73 win->show(); 75 win->show();
74 76
75 // If this is the first start, get the user to configuration. Especially point 77 // If this is the first start, get the user to configuration. Especially point
76 // them to the profile tab, it's the most important form to fill in. 78 // them to the profile tab, it's the most important form to fill in.
77 if (firststart) 79 if (firststart)
78 { (new ConfigDialog (ConfigDialog::ProfileTab))->exec(); 80 {
81 (new ConfigDialog (ConfigDialog::ProfileTab))->exec();
79 firststart = false; 82 firststart = false;
80 Config::save(); 83 Config::save();
81 } 84 }
82 85
83 loadPrimitives(); 86 loadPrimitives();
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);

mercurial