[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Mar 16 02:19:23 CET 2005


CVS commit by staikos: 

first big benefit of new update scheme: plugins only update when their
dependencies update now.


  M +20 -7     kstplugin.cpp   1.87


--- kdeextragear-2/kst/kst/kstplugin.cpp  #1.86:1.87
@@ -236,7 +236,7 @@ KstObject::UpdateType KstPlugin::update(
   }
 
-  if (update_counter != -1) {
-    //bool force = false;
-    // FIXME: we should only update if one of our dependencies was updated
+  bool force = false;
+  if (update_counter <= 0) {
+    force = true;
   }
 
@@ -262,4 +262,5 @@ KstObject::UpdateType KstPlugin::update(
   QDict<bool> doNew(17);
   bool ignore = true; // work around Qt 3.1 issue
+  bool doUpdate = force;
 
   // Populate the input scalars and vectors
@@ -276,10 +277,17 @@ KstObject::UpdateType KstPlugin::update(
         doNew.insert((*it)._name, &ignore);
       }
-      _inVectors[vitcnt] = _inputVectors[(*it)._name]->value();
-      _inArrayLens[vitcnt++] = _inputVectors[(*it)._name]->length();
+      KstVectorPtr iv = _inputVectors[(*it)._name];
+      doUpdate = (UPDATE == iv->update(update_counter)) || doUpdate;
+      _inVectors[vitcnt] = iv->value();
+      _inArrayLens[vitcnt++] = iv->length();
     } else if ((*it)._type == Plugin::Data::IOValue::FloatType) {
-      _inScalars[itcnt++] = _inputScalars[(*it)._name]->value();
+      KstScalarPtr is = _inputScalars[(*it)._name];
+      doUpdate = (UPDATE == is->update(update_counter)) || doUpdate;
+      _inScalars[itcnt++] = is->value();
     } else if ((*it)._type == Plugin::Data::IOValue::StringType) {
-      _inStrings[sitcnt++] = strdup(_inputStrings[(*it)._name]->value().latin1());
+      KstStringPtr is = _inputStrings[(*it)._name];
+      doUpdate = (UPDATE == is->update(update_counter)) || doUpdate;
+      // Maybe we should use UTF-8 instead?
+      _inStrings[sitcnt++] = strdup(is->value().latin1());
     } else if ((*it)._type == Plugin::Data::IOValue::PidType) {
       _inScalars[itcnt++] = getpid();
@@ -287,4 +295,9 @@ KstObject::UpdateType KstPlugin::update(
   }
 
+  if (!doUpdate) {
+    CLEANUP();
+    return setLastUpdateResult(NO_CHANGE);
+  }
+
   vitcnt = 0;
   // Populate the output vectors




More information about the Kst mailing list