put qt gui launching code into a function
authorDiane Trout <diane@caltech.edu>
Wed, 12 Apr 2006 22:20:42 +0000 (22:20 +0000)
committerDiane Trout <diane@caltech.edu>
Wed, 12 Apr 2006 22:20:42 +0000 (22:20 +0000)
Delaying instaintation QApplication allows us to run even if we don't
have a connection to an X server

qui/mussagl.cpp

index 28f7bc592976441cd7ef21f0be3101396c578761..d7b685cac1738776f0231dfd2b43ce2e8821cc5d 100644 (file)
@@ -6,21 +6,26 @@ using namespace boost::filesystem;
 #include "qui/MussaWindow.hpp"
 #include "alg/parse_options.hpp"
 
+int startgui(Mussa *analysis, int argc, char **argv)
+{
+  QApplication app(argc, argv);
+  Q_INIT_RESOURCE(icons);
+  MussaWindow win(analysis);
+  win.show();
+  app.exec();
+
+  return 0;
+}
+
 int main(int argc, char **argv)
 {
   // let boost::filesystem store the path we were initially launched in
   initial_path();
 
-  QApplication app(argc, argv);
-  Q_INIT_RESOURCE(icons);
   Mussa *analysis = initialize_mussa(argc, argv);
-
   if (analysis == 0) {
     return 1;
   }
 
-  MussaWindow win(analysis);
-  win.show();
-  app.exec();
-  return 0;
+  return startgui(analysis, argc, argv);
 }