[Kst] branches/work/kst/pluginify/kst/src/plugins

Adam Treat treat at kde.org
Fri Sep 15 00:40:48 CEST 2006


SVN commit 584464 by treat:

* Fix a couple of typos and add scalars created directly
through the ScalarSelector widget


 M  +4 -4      crossspectrum/crosspowerspectrum.cpp  
 M  +25 -2     crossspectrum/crossspectrumdialog_i.cpp  
 M  +5 -5      linefit/linefitplugin.cpp  


--- branches/work/kst/pluginify/kst/src/plugins/crossspectrum/crosspowerspectrum.cpp #584463:584464
@@ -173,19 +173,19 @@
 
 void CrossPowerSpectrum::setReal(const QString &name) {
   KstVectorPtr v = new KstVector(name, 0, this, false);
-  _outputVectors.insert("Cross Spectrum: Real", v);
+  _outputVectors.insert(REAL, v);
   KST::addVectorToList(v);
 }
 
 void CrossPowerSpectrum::setImaginary(const QString &name) {
   KstVectorPtr v = new KstVector(name, 0, this, false);
-  _outputVectors.insert("Cross Spectrum: Imaginary", v);
+  _outputVectors.insert(IMAGINARY, v);
   KST::addVectorToList(v);
 }
 
 void CrossPowerSpectrum::setFrequency(const QString &name) {
   KstVectorPtr v = new KstVector(name, 0, this, false);
-  _outputVectors.insert("Frequency", v);
+  _outputVectors.insert(FREQUENCY, v);
   KST::addVectorToList(v);
 }
 
@@ -198,7 +198,7 @@
     return lastUpdateResult();
   }
 
-  if (v1() || !v2() || !fft() || !sample()) {
+  if (!v1() || !v2() || !fft() || !sample()) {
     return setLastUpdateResult(NO_CHANGE);
   }
 
--- branches/work/kst/pluginify/kst/src/plugins/crossspectrum/crossspectrumdialog_i.cpp #584463:584464
@@ -173,6 +173,7 @@
   return true;
 }
 
+#include <kdebug.h>
 bool CrossSpectrumDialogI::editSingleObject(CrossPowerSpectrumPtr cps)
 {
   KST::vectorList.lock().readLock();
@@ -194,11 +195,33 @@
     it2 = KST::scalarList.findTag(_w->_fft->selectedScalar());
     if (it2 != KST::scalarList.end()) {
       cps->setFFT(*it2);
+    } else {
+      kdDebug() << "fft new" << endl;
+      //Deal with direct entry
+      bool ok;
+      double val = _w->_fft->_scalar->currentText().toDouble(&ok);
+      if (ok) {
+        cps->setFFT(new KstScalar(_w->_fft->_scalar->currentText(),
+                                  0L, val, true, false, false));
+      } else {
+        //deal with error...
+      }
     }
 
-    it = KST::vectorList.findTag(_w->_sample->selectedScalar());
-    if (it != KST::vectorList.end()) {
+    it2 = KST::scalarList.findTag(_w->_sample->selectedScalar());
+    if (it2 != KST::scalarList.end()) {
       cps->setSample(*it2);
+    } else {
+      kdDebug() << "sample new" << endl;
+      //Deal with direct entry
+      bool ok;
+      double val = _w->_sample->_scalar->currentText().toDouble(&ok);
+      if (ok) {
+        cps->setSample(new KstScalar(_w->_sample->_scalar->currentText(),
+                                  0L, val, true, false, false));
+      } else {
+        //deal with error...
+      }
     }
   }
 
--- branches/work/kst/pluginify/kst/src/plugins/linefit/linefitplugin.cpp #584463:584464
@@ -285,29 +285,29 @@
 
 void LineFit::setXInterpolated(const QString &name) {
   KstVectorPtr v = new KstVector(name, 0, this, false);
-  _outputVectors.insert("X Interpolated", v);
+  _outputVectors.insert(X_INTERPOLATED, v);
   KST::addVectorToList(v);
 }
 
 void LineFit::setYInterpolated(const QString &name) {
   KstVectorPtr v = new KstVector(name, 0, this, false);
-  _outputVectors.insert("Y Interpolated", v);
+  _outputVectors.insert(Y_INTERPOLATED, v);
   KST::addVectorToList(v);
 }
 
 void LineFit::setA(const QString &name) {
   KstScalarPtr sp = new KstScalar(name, this);
-  _outputScalars.insert("a", sp);
+  _outputScalars.insert(A, sp);
 }
 
 void LineFit::setB(const QString &name) {
   KstScalarPtr sp = new KstScalar(name, this);
-  _outputScalars.insert("b", sp);
+  _outputScalars.insert(B, sp);
 }
 
 void LineFit::setChi2(const QString &name) {
   KstScalarPtr sp = new KstScalar(name, this);
-  _outputScalars.insert("chi^2", sp);
+  _outputScalars.insert(CHI2, sp);
 }
 
 QString LineFit::propertyString() const {


More information about the Kst mailing list