[Kst] kdeextragear-2/kst

George Staikos staikos at kde.org
Fri Feb 13 23:10:36 CET 2004


CVS commit by staikos: 

- added regression test for equations
- fixed equation bugs in dcop interface


  A            tests/test_equations.sh   1.1
  M +25 -10    kst/kstiface_impl.cpp   1.14


--- kdeextragear-2/kst/kst/kstiface_impl.cpp  #1.13:1.14
@@ -34,4 +34,5 @@
 #include <qfile.h>
 #include <qfileinfo.h>
+#include <qregexp.h>
 
 
@@ -149,6 +150,5 @@ bool KstIfaceImpl::plotEquation(double s
   }
 
-  // FIXME: generate etag, ptag properly - work out semantics for finding existing plot
-  etag = "Eq-" + plotName;
+  etag = "Eq-" + QString(equation).replace(QRegExp("[\\[\\]\\s]"), "_");
   ptag = "P-" + plotName;
 
@@ -157,7 +157,6 @@ bool KstIfaceImpl::plotEquation(double s
   }
 
-  if (!plot) {
-    plot = new KstPlot(ptag);
-    KST::plotList.append(plot);
+  while (KST::dataTagNameNotUnique(etag, false)) {
+    etag += '\'';
   }
 
@@ -167,4 +166,13 @@ bool KstIfaceImpl::plotEquation(double s
                             color.isValid() ? color : QColor("darkBlue"));
 
+  if (!eq->isValid()) {
+    return false;
+  }
+
+  if (!plot) {
+    plot = new KstPlot(ptag);
+    KST::plotList.append(plot);
+  }
+
   KST::dataObjectList.append(KstDataObjectPtr(eq));
 
@@ -202,6 +210,5 @@ bool KstIfaceImpl::plotEquation(const QS
   v = *it;
 
-  // FIXME: generate etag, ptag properly - work out semantics for finding existing plot
-  etag = "Eq-" + plotName;
+  etag = "Eq-" + QString(equation).replace(QRegExp("[\\[\\]\\s]"), "_");
   ptag = "P-" + plotName;
 
@@ -210,7 +217,6 @@ bool KstIfaceImpl::plotEquation(const QS
   }
 
-  if (!plot) {
-    plot = new KstPlot(ptag);
-    KST::plotList.append(plot);
+  while (KST::dataTagNameNotUnique(etag, false)) {
+    etag += '\'';
   }
 
@@ -220,4 +226,13 @@ bool KstIfaceImpl::plotEquation(const QS
                             color.isValid() ? color : QColor("darkBlue"));
 
+  if (!eq->isValid()) {
+    return false;
+  }
+
+  if (!plot) {
+    plot = new KstPlot(ptag);
+    KST::plotList.append(plot);
+  }
+
   KST::dataObjectList.append(KstDataObjectPtr(eq));
 





More information about the Kst mailing list