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

Adam Treat treat at kde.org
Thu Sep 14 17:42:23 CEST 2006


SVN commit 584376 by treat:

* Require vector selection.
* Sort out the UPDATE method.



 M  +2 -5      linefitdialog_i.cpp  
 M  +2 -11     linefitplugin.cpp  
 M  +0 -3      linefitplugin.h  


--- branches/work/kst/pluginify/kst/src/plugins/linefit/linefitdialog_i.cpp #584375:584376
@@ -61,9 +61,6 @@
   connect(_w->_xArray, SIGNAL(newVectorCreated(const QString&)), this, SIGNAL(modified()));
   connect(_w->_xArray, SIGNAL(newVectorCreated(const QString&)), this, SIGNAL(modified()));
 
-  _w->_xArray->provideNoneVector(true);
-  _w->_xArray->provideNoneVector(true);
-
   connect(this, SIGNAL(modified()), KstApp::inst()->document(), SLOT(wasModified())); //FIXME this should be in KstDataDialog constructor...
 }
 
@@ -102,7 +99,7 @@
   lf->unlock();
 
   // Save the vectors and scalars
-  if (!editSingleObject(lf) /*|| !lf->isValid()*/) {
+  if (!editSingleObject(lf) || !lf->isValid()) {
     KMessageBox::sorry(this, i18n("There is an error in the values you entered."));
     return false;
   }
@@ -113,7 +110,7 @@
   lf->setB(_w->_b->text());
   lf->setChi2(_w->_chi2->text());
 
-  if (!lf /*|| !lf->isValid()*/) {
+  if (!lf || !lf->isValid()) {
     KMessageBox::sorry(this, i18n("There is an error in the linefit you entered."));
     return false;
   }
--- branches/work/kst/pluginify/kst/src/plugins/linefit/linefitplugin.cpp #584375:584376
@@ -41,21 +41,16 @@
 
 LineFit::LineFit( QObject */*parent*/, const char */*name*/, const QStringList &/*args*/ )
     : KstDataObject() {
-  m_init = false;
 }
 
 LineFit::~LineFit() {
 }
 
 bool LineFit::isValid() const {
-  return m_init; //FIXME this is very clearly wrong
+  return true; //FIXME this is very clearly wrong
 }
 
 KstObject::UpdateType LineFit::update(int updateCounter) {
-  if (isValid()) {
-    return setLastUpdateResult(NO_CHANGE);
-  }
-
   bool force = dirty();
   setDirty(false);
 
@@ -77,10 +72,6 @@
 
   linefit();
 
-  m_init = true;
-
-  setLastUpdateResult(UPDATE); // make sure that provider callbacks work
-
   KstVectorPtr xOut = *_outputVectors.find(X_INTERPOLATED);
   KstVectorPtr yOut = *_outputVectors.find(Y_INTERPOLATED);
 
@@ -102,7 +93,7 @@
   b->update(updateCounter);
   chi2->update(updateCounter);
 
-  return setLastUpdateResult(UPDATE);
+  return setLastUpdateResult(depUpdated ? UPDATE : NO_CHANGE);
 }
 
 void LineFit::linefit() {
--- branches/work/kst/pluginify/kst/src/plugins/linefit/linefitplugin.h #584375:584376
@@ -91,9 +91,6 @@
   //Pure virtual slots from KstDataObject
   virtual void showNewDialog();
   virtual void showEditDialog();
-
-private:
-  bool m_init;
 };
 
 typedef KstSharedPtr<LineFit> LineFitPtr;


More information about the Kst mailing list