src/main.cpp

changeset 6
67b6ef6917ba
parent 5
3c04e05ab24f
child 10
bc1414343e19
equal deleted inserted replaced
5:3c04e05ab24f 6:67b6ef6917ba
1 #include <QApplication> 1 #include <QApplication>
2 #include <QSettings> 2 #include <QSettings>
3 #include "types.h" 3 #include "types.h"
4 #include "config.h" 4 #include "config.h"
5 #include "demo.h"
5 6
6 const list<str> g_zanVersions ({ 7 const list<str> g_zanVersions ({
7 "1.1", 8 "1.1-r130716-1906M",
8 }); 9 });
9 10
10 // ============================================================================= 11 // =============================================================================
11 // ----------------------------------------------------------------------------- 12 // -----------------------------------------------------------------------------
12 int main( int argc, char* argv[] ) { 13 int main( int argc, char* argv[] ) {
13 QApplication app( argc, argv ); 14 QApplication app( argc, argv );
14 app.setApplicationName( UNIXNAME ); 15 app.setApplicationName( UNIXNAME );
15 app.setOrganizationName( UNIXNAME ); 16 app.setOrganizationName( UNIXNAME );
16 app.setApplicationVersion( versionString() ); 17 app.setApplicationVersion( versionString() );
17 18
18 print( "Settings path: %1\n", QSettings().fileName() );
19
20 for( int i = 1; i < argc; ++i ) { 19 for( int i = 1; i < argc; ++i ) {
21 str arg = argv[i]; 20 str arg = argv[i];
22 21
23 if( arg == "--config" ) { 22 if( arg == "--config" ) {
24 ConfigBox dlg; 23 ConfigBox dlg;
25 return dlg.exec(); 24 return dlg.exec();
26 } 25 }
27 } 26 }
28 27
29 return app.exec(); 28 if( argc != 2 ) {
29 fprint( stderr, "Usage: %1 <demo> - Launch a demo file\n", argv[0] );
30 fprint( stderr, " %1 --config - Configure " APPNAME "\n", argv[0] );
31 return 255;
32 }
33
34 return launchDemo( argv[1] );
30 } 35 }
31 36
32 // ============================================================================= 37 // =============================================================================
33 // ----------------------------------------------------------------------------- 38 // -----------------------------------------------------------------------------
34 str versionString() { 39 str versionString() {

mercurial