src/main.cpp

changeset 5
3c04e05ab24f
parent 3
d0b278fd29d5
child 6
67b6ef6917ba
equal deleted inserted replaced
4:3c23aa03190d 5:3c04e05ab24f
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 5
6 QSettings* cfg; 6 const list<str> g_zanVersions ({
7 "1.1",
8 });
7 9
8 // ============================================================================= 10 // =============================================================================
9 // ----------------------------------------------------------------------------- 11 // -----------------------------------------------------------------------------
10 int main( int argc, char* argv[] ) { 12 int main( int argc, char* argv[] ) {
11 QApplication app( argc, argv ); 13 QApplication app( argc, argv );
12 app.setApplicationName( APPNAME ); 14 app.setApplicationName( UNIXNAME );
15 app.setOrganizationName( UNIXNAME );
13 app.setApplicationVersion( versionString() ); 16 app.setApplicationVersion( versionString() );
14 17
15 QSettings settings; 18 print( "Settings path: %1\n", QSettings().fileName() );
16 cfg = &settings;
17 19
18 for( int i = 1; i < argc; ++i ) { 20 for( int i = 1; i < argc; ++i ) {
19 str arg = argv[i]; 21 str arg = argv[i];
20 22
21 if( arg == "--config" ) { 23 if( arg == "--config" ) {
22 ConfigBox* dlg = new ConfigBox; 24 ConfigBox dlg;
23 dlg->show(); 25 return dlg.exec();
24 } 26 }
25 } 27 }
26 28
27 print( "Hello world! This is " APPNAME " %1\n", versionString() );
28 return app.exec(); 29 return app.exec();
29 } 30 }
30 31
31 // ============================================================================= 32 // =============================================================================
32 // ----------------------------------------------------------------------------- 33 // -----------------------------------------------------------------------------
33 QString versionString() { 34 str versionString() {
34 str text = fmt( "v%1.%2", VERSION_MAJOR, VERSION_MINOR ); 35 str text = fmt( "v%1.%2", VERSION_MAJOR, VERSION_MINOR );
35 #if VERSION_PATCH != 0 36 #if VERSION_PATCH != 0
36 text += fmt( ".%1", VERSION_PATCH ); 37 text += fmt( ".%1", VERSION_PATCH );
37 #endif 38 #endif
38 39

mercurial