Writing about testing and evaluation.
[fic.git] / main.cpp
bloba4522851009a3e86d885ecc34182980b526f41d1
1 #include "gui.h"
2 #include "modules.h"
4 using namespace std;
6 /** Converts the files in batch mode, returns the exit code, implemented in batch.cpp */
7 int batchRun(const vector<const char*> &fileNames);
10 struct TestOpt: public unary_function<const char*,bool> {
11 bool operator()(const char *str) const
12 { return *str=='-'; }
15 int main(int argc,char **argv) {
16 int result;
17 ModuleFactory::init();
19 vector<const char*> fileNames;
20 remove_copy_if( argv+1, argv+argc, back_inserter(fileNames), TestOpt() );
22 if ( fileNames.empty() ) { // no filenames passed -> GUI mode
23 QApplication app(argc,argv);
25 ImageViewer viewer(app);
26 viewer.show();
27 result= app.exec();
29 } else { // batch mode
30 QCoreApplication app(argc,argv);
31 result= batchRun(fileNames);
34 ModuleFactory::destroy();
35 return result;