create an options structure to indicate if we need a gui
[mussa.git] / qui / mussagl.cpp
1 #include <boost/filesystem/operations.hpp>
2 using namespace boost::filesystem;
3
4 #include <stdlib.h>
5 #include <QApplication>
6
7 #include "qui/MussaWindow.hpp"
8 #include "alg/parse_options.hpp"
9
10 int main(int argc, char **argv)
11 {
12   MussaOptions opts;
13
14   // if we're under unix and don't have a display, see if we can still run
15 #ifdef Q_WS_X11
16   opts.useGUI = getenv("DISPLAY") != 0;
17 #endif
18
19   QApplication app(argc, argv, opts.useGUI);
20   Q_INIT_RESOURCE(icons);
21
22   initialize_mussa(opts, argc, argv);
23
24   if (opts.analysis == 0) {
25     return 1;
26   }
27
28   if (opts.useGUI) { 
29     MussaWindow win(opts.analysis);
30     win.show();
31     app.exec();
32   }
33
34   return 0;
35 }