win32 paths need some conversion
[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 #include "mussa_exceptions.hpp"
10
11 int main(int argc, char **argv)
12 {
13   MussaOptions opts;
14
15   // if we're under unix and don't have a display, see if we can still run
16 #ifdef Q_WS_X11
17   opts.useGUI = getenv("DISPLAY") != 0;
18 #endif
19
20   QApplication app(argc, argv, opts.useGUI);
21   Q_INIT_RESOURCE(icons);
22
23   initialize_mussa(opts, argc, argv);
24
25   if (opts.analysis == 0) {
26     return 1;
27   }
28
29   try {
30     if (opts.useGUI) { 
31       MussaWindow win(opts.analysis);
32       win.show();
33       app.exec();
34     }
35     return 0;
36   } catch (mussa_error e) {
37     qFatal(e.what());
38   } catch (boost::filesystem::filesystem_error e) {
39     qFatal(e.what());
40   } catch (std::runtime_error e) {
41     qFatal(e.what());
42   } catch (...) {
43     qFatal("unrecognized exception");
44   }
45   return 1;
46 }