39 {
40 #ifdef __GNUC__
41 #ifndef __MINGW32__
42
43
44 #endif
45 #endif
46
47 cout << endl;
48 cout << "*******************************************************************" << endl;
49 cout << "*** !! Welcome to FFSM - The Forest Sector Simulator !! ***" << endl;
50 cout << "*** For info & doc: http://www.ffsm-project.org/doc ***" << endl;
51 cout << "*** Full compiled on: " << __DATE__ << " - " << __TIME__ << " ***" << endl;
52 cout << "*******************************************************************" << endl<<endl;
53
54
56 int debug=0;
58
59
60
61
62
63
64 QDir dir;
65 QString currentDir = dir.currentPath();
66
67
68
69
70
71 QString inputFileName = "";
72 QString scenarioName = "";
73
74
75
77
78
79
80
81
82
83
84 opt->
addUsage(
"*** FFSM - Forest Sector Simulator ***" );
87 opt->
addUsage(
" -h --help Prints this help " );
88 opt->
addUsage(
" -c --console Run in console mode (no gui, default: false) " );
89 opt->
addUsage(
" -i --input_file [input_file_name] Input file (relative path, default: 'data/ffsmInput.ods') " );
90 opt->
addUsage(
" -s --scenario [scenario_name] Scenario name (default: the first defined in the input file) " );
93 opt->
addUsage(
" - input_file and scenario options have no effect in GUI mode;" );
94 opt->
addUsage(
" - the working directory is the base path relative to the input file." );
96 opt->
addUsage(
"Read installed documentation or browse it at http://www.ffsm-project.org/doc." );
98
99
101 opt->
setFlag(
"console",
'c' );
104
105
107
108
111 delete opt;
112 return EXIT_FAILURE;
113 }
114
115 if( opt->
getValue(
'i' ) != NULL || opt->
getValue(
"input_file" ) != NULL ){
116 QString tempdata(opt->
getValue(
'i' ));
117 inputFileName = currentDir + "/" + tempdata;
118 }
119 else {
120 inputFileName = currentDir + "/data/ffsmInput.ods";
121 }
122
124 scenarioName = opt->
getValue(
's' );
125 }
126
130 }
131 else {
132 QApplication app(argc, argv);
134 mainWin.show();
135 return app.exec();
136 }
137 delete opt;
138}
bool getFlag(const char *_option)
void setOption(const char *opt_string)
void processCommandArgs()
void setFlag(const char *opt_string)
char * getValue(const char *_option)
void addUsage(const char *line)
void basicTest()
Simple tests that doesn't require anything else (are encapsulated) and so they can be run at the begi...
Thread manager. Responsable to manage the main thread and "speak" with the GUI.
void runFromConsole(QString inputFileName_h, QString scenarioName_h)
Re-draw the map making it to fit (with the right proportions) to the widget.