Load saved analysis can open new windows
authorDiane Trout <diane@caltech.edu>
Sat, 16 Sep 2006 00:12:53 +0000 (00:12 +0000)
committerDiane Trout <diane@caltech.edu>
Sat, 16 Sep 2006 00:12:53 +0000 (00:12 +0000)
ticket:105
this makes mussa behave a bit more like a traditional gui app, in that
saved analyses will replace empty windows, but will create new windows
if there's already something loaded.

Also new windows will copy the default_dir from the parent window.

qui/MussaWindow.cpp

index f22fe1d7abfc8c091ebb4691f5b4937b95b19057..47c9111a9dc0686dd00878039da7b0d02fdd1e8e 100644 (file)
@@ -517,9 +517,17 @@ void MussaWindow::loadSavedAnalysis()
             this, SLOT(updateProgress(const std::string&, int, int)));
     m->load(converted_path);
     // only switch mussas if we loaded without error
-    setAnalysis(m);
-    setWindowTitle(converted_path.native_file_string().c_str());
-    default_dir = converted_path.branch_path();
+    if (analysis->empty()) {
+      // our current window is empty so load and replace.
+      setAnalysis(m);
+      setWindowTitle(converted_path.native_file_string().c_str());
+      default_dir = converted_path.branch_path();
+    } else {
+      MussaWindow *win = new MussaWindow(m);
+      win->setWindowTitle(converted_path.native_file_string().c_str());
+      win->default_dir = converted_path.branch_path();
+      win->show();
+    }
   } catch (mussa_load_error e) {
     QString msg("Unable to load ");
     msg += muway_dir;
@@ -534,6 +542,7 @@ void MussaWindow::newMussaWindow()
 {
   Mussa *a = new Mussa();
   MussaWindow *win = new MussaWindow(a);
+  win->default_dir = default_dir;
   win->show();
 }