From: Diane Trout Date: Wed, 12 Apr 2006 22:20:42 +0000 (+0000) Subject: put qt gui launching code into a function X-Git-Url: http://woldlab.caltech.edu/gitweb/?a=commitdiff_plain;h=152cc82006cfd5945c0234ecd7a7536f88eec144;p=mussa.git put qt gui launching code into a function Delaying instaintation QApplication allows us to run even if we don't have a connection to an X server --- diff --git a/qui/mussagl.cpp b/qui/mussagl.cpp index 28f7bc5..d7b685c 100644 --- a/qui/mussagl.cpp +++ b/qui/mussagl.cpp @@ -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); }