[Debichem-commits] [SCM] massXpert mass spectrometry suite: debian packaging branch, debian, updated. upstream/3.2.0-1-g5564507

Filippo Rusconi (Debian Maintainer) rusconi-debian at laposte.net
Thu Nov 24 21:26:57 UTC 2011


The following commit has been merged in the debian branch:
commit 0e2b3131abf437f9ac0d3e7f29a83ece0e37a511
Author: Filippo Rusconi (Debian Maintainer) <rusconi-debian at laposte.net>
Date:   Thu Jun 18 22:33:29 2009 +0200

    Fixed bug due to not really clearing seed/result data when using chemical pad.

diff --git a/gui/calculatorWnd.cpp b/gui/calculatorWnd.cpp
index 80c2f25..2125281 100644
--- a/gui/calculatorWnd.cpp
+++ b/gui/calculatorWnd.cpp
@@ -772,8 +772,12 @@ namespace massXpert
 
 
   void 
-  CalculatorWnd::apply()
+  CalculatorWnd::apply(const QString &formula)
   {
+    // If the 'formula' parameter contains a string, then account the
+    // formula and return immediately. This is the situation when this
+    // function is called from one chemical pad button.
+
     Application *application = static_cast<Application *>(qApp);
     QLocale locale = application->locale();
     QString mass;
@@ -880,6 +884,28 @@ namespace massXpert
     // And now append the new recorder string to the recorder textEdit.
     m_recorderDlg.record(recorder);
     
+    // OK, first check if the 'formula' parameter is empty or not.
+    if (!formula.isEmpty())
+      {
+	int res = accountFormula(formula);
+	
+	if (res == -1)
+	  QMessageBox::warning(0, 
+			       tr("massXpert - Calculator"),
+			       tr("Error accounting formula '%1'")
+			       .arg(formula),
+			       QMessageBox::Ok);
+	else if (res == 1)
+	  {
+	    recordResult();
+	    
+	    updateSeedResultLineEdits();
+	  }
+	
+	return;
+      }
+    
+
     // Finally we can start doing work with the chemical entities...
 
     // Atoms/Formulae
diff --git a/gui/calculatorWnd.hpp b/gui/calculatorWnd.hpp
index 4209481..c615add 100644
--- a/gui/calculatorWnd.hpp
+++ b/gui/calculatorWnd.hpp
@@ -112,7 +112,7 @@ namespace massXpert
 
     void showChemPad(int);
 
-    void apply();
+    void apply(const QString & = QString(""));
     void mzCalculation();  
     void isotopicPatternCalculation();
   };
diff --git a/gui/chemPadButton.cpp b/gui/chemPadButton.cpp
index a3b4e2f..69552ba 100644
--- a/gui/chemPadButton.cpp
+++ b/gui/chemPadButton.cpp
@@ -94,18 +94,7 @@ namespace massXpert
   {
     // We have to account for the formula corresponding to this button.
   
-    int res = mp_calculatorWnd->accountFormula(m_formula);
-  
-    if (res == -1)
-      QMessageBox::warning(0, 
-			    tr("massXpert - Calculator"),
-			    tr("Error accounting chemical pad formula."),
-			    QMessageBox::Ok);
-    else if (res == 1)
-      {
-	mp_calculatorWnd->recordResult();
-	mp_calculatorWnd->updateSeedResultLineEdits();
-      }
+    return mp_calculatorWnd->apply(m_formula);
   }
 
 } // namespace massXpert

-- 
massXpert mass spectrometry suite: debian packaging



More information about the Debichem-commits mailing list