put qt gui launching code into a function
[mussa.git] / qui / mussagl.cpp
1 #include <boost/filesystem/operations.hpp>
2 using namespace boost::filesystem;
3
4 #include <QApplication>
5
6 #include "qui/MussaWindow.hpp"
7 #include "alg/parse_options.hpp"
8
9 int startgui(Mussa *analysis, int argc, char **argv)
10 {
11   QApplication app(argc, argv);
12   Q_INIT_RESOURCE(icons);
13   MussaWindow win(analysis);
14   win.show();
15   app.exec();
16
17   return 0;
18 }
19
20 int main(int argc, char **argv)
21 {
22   // let boost::filesystem store the path we were initially launched in
23   initial_path();
24
25   Mussa *analysis = initialize_mussa(argc, argv);
26   if (analysis == 0) {
27     return 1;
28   }
29
30   return startgui(analysis, argc, argv);
31 }