src/main.cpp

changeset 11
3ddebf76105e
parent 10
bc1414343e19
child 13
9bdddd2ccde6
equal deleted inserted replaced
10:bc1414343e19 11:3ddebf76105e
4 #include "config.h" 4 #include "config.h"
5 #include "demo.h" 5 #include "demo.h"
6 6
7 // ============================================================================= 7 // =============================================================================
8 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
9 int main( int argc, char* argv[] ) { 9 int main (int argc, char* argv[]) {
10 QApplication app( argc, argv ); 10 QApplication app (argc, argv);
11 app.setApplicationName( UNIXNAME ); 11 app.setApplicationName (UNIXNAME);
12 app.setOrganizationName( UNIXNAME ); 12 app.setOrganizationName (UNIXNAME);
13 app.setApplicationVersion( versionString() ); 13 app.setApplicationVersion (versionString());
14 14
15 for( int i = 1; i < argc; ++i ) { 15 for (int i = 1; i < argc; ++i) {
16 str arg = argv[i]; 16 str arg = argv[i];
17 17
18 if( arg == "--config" ) { 18 if (arg == "--config") {
19 ConfigBox dlg; 19 ConfigBox dlg;
20 return dlg.exec(); 20 return dlg.exec();
21 } 21 }
22 } 22 }
23 23
24 if( argc != 2 ) { 24 if (argc != 2) {
25 fprint( stderr, "Usage: %1 <demo> - Launch a demo file\n", argv[0] ); 25 fprint (stderr, "Usage: %1 <demo> - Launch a demo file\n", argv[0]);
26 fprint( stderr, " %1 --config - Configure " APPNAME "\n", argv[0] ); 26 fprint (stderr, " %1 --config - Configure " APPNAME "\n", argv[0]);
27 return 255; 27 return 255;
28 } 28 }
29 29
30 return launchDemo( argv[1] ); 30 return launchDemo (argv[1]);
31 } 31 }
32 32
33 // ============================================================================= 33 // =============================================================================
34 // ----------------------------------------------------------------------------- 34 // -----------------------------------------------------------------------------
35 str versionString() { 35 str versionString() {
36 str text = fmt( "v%1.%2", VERSION_MAJOR, VERSION_MINOR ); 36 str text = fmt ("v%1.%2", VERSION_MAJOR, VERSION_MINOR);
37 #if VERSION_PATCH != 0 37 #if VERSION_PATCH != 0
38 text += fmt( ".%1", VERSION_PATCH ); 38 text += fmt (".%1", VERSION_PATCH);
39 #endif 39 #endif
40 40
41 #if BUILD_ID == BUILD_INTERNAL 41 #if BUILD_ID == BUILD_INTERNAL
42 text += "-intern"; 42 text += "-intern";
43 #elif BUILD_ID == BUILD_ALPHA 43 #elif BUILD_ID == BUILD_ALPHA
44 text += "-alpha"; 44 text += "-alpha";
45 #elif BUILD_ID == BUILD_BETA 45 #elif BUILD_ID == BUILD_BETA
46 text += "-beta"; 46 text += "-beta";
47 #elif BUILD_ID == BUILD_RC 47 #elif BUILD_ID == BUILD_RC
48 text += fmt( "-rc%1", RC_ID ); 48 text += fmt ("-rc%1", RC_ID);
49 #elif BUILD_ID == BUILD_RELEASE 49 #elif BUILD_ID == BUILD_RELEASE
50 text += "-rel"; 50 text += "-rel";
51 #else 51 #else
52 # error Invalid build code! 52 # error Invalid build code!
53 #endif // BUILD_ID 53 #endif // BUILD_ID

mercurial