warn the user if we're going to replace an analysis
[mussa.git] / qui / MussaWindow.cpp
index 8d51ab542d208b2d6b473a1adeaeab5225e9ee79..8f87a1ffa13f1fdd6acab9f057342b79c640744b 100644 (file)
@@ -297,12 +297,14 @@ void MussaWindow::clear()
 void MussaWindow::createNewAnalysis()
 {
   try {
+    // ideally we should open a new window if there's an analysis
+    // but this should work for the moment.
+    if (not isClearingAnalysisSafe()) return;
+
     if (setup_analysis_dialog.exec()) {
       Mussa *m = 0;
       m = setup_analysis_dialog.getMussa();
       setAnalysis(m);
-    } else {
-      std::cout << "New mussa exp. aborted!\n";
     }
   } catch(mussa_error e) {
     QString msg(e.what());
@@ -459,6 +461,10 @@ void MussaWindow::loadMupa()
     return;
   // try to load safely
   try {
+    // ideally we should open a new window if there's an analysis
+    // but this should work for the moment.
+    if (not isClearingAnalysisSafe()) return;
+
     Mussa *m = new Mussa;
     fs::path converted_path(mupa_path.toStdString(), fs::native);
     connect(m, SIGNAL(progress(const std::string&, int, int)),
@@ -488,6 +494,10 @@ void MussaWindow::loadSavedAnalysis()
     return;
   // try to safely load
   try {
+    // ideally we should open a new window if there's an analysis
+    // but this should work for the moment.
+    if (not isClearingAnalysisSafe()) return;
+
     Mussa *m = new Mussa;
     fs::path converted_path(muway_dir.toStdString(), fs::native);
     connect(m, SIGNAL(progress(const std::string&, int, int)),