[Kst] kdeextragear-2/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Thu Jul 15 04:52:55 CEST 2004


CVS commit by netterfield: 

First shot at adding 'frameNum' scalar for data sources:
	-Binary compatibility is maintained: I used *d.
		Do we want to bother since it isn't promised yet?
	-It requires a call to updateNumFrameScalar() from update in
	the plugins, or it stays at 0.  I have modified all existing
	plugins to do this.

	-This has uncovered a ... bug: data sources get created by browsing with
	the dialogs, but never get deleted or purged.  I think an auto-purge is
	in order.  Not sure where or how yet.


  M +11 -2     kstdatasource.cpp   1.22
  M +8 -3      kstdatasource.h   1.10
  M +1 -0      datasources/ascii/ascii.cpp   1.17
  M +1 -0      datasources/dirfile/dirfile.cpp   1.7
  M +1 -0      datasources/frame/frame.cpp   1.4
  M +38 -36    datasources/lfiio/lfiio.cpp   1.7
  M +1 -0      datasources/planck/planck.cpp   1.16


--- kdeextragear-2/kst/kst/kstdatasource.cpp  #1.21:1.22
@@ -237,4 +237,6 @@ KstDataSource::KstDataSource(const QStri
   Q_UNUSED(type)
   _valid = false;
+  d = new KstDataSourcePrivate;
+  d->numFrames = new KstScalar(filename + i18n("-frames"));
 }
 
@@ -239,6 +241,10 @@ KstDataSource::KstDataSource(const QStri
 }
 
-
 KstDataSource::~KstDataSource() {
+  KST::scalarList.lock().writeLock();
+  KST::scalarList.remove(d->numFrames);
+  KST::scalarList.lock().writeUnlock();
+  d->numFrames = 0;
+  delete d;
 }
 
@@ -249,4 +255,7 @@ KstObject::UpdateType KstDataSource::upd
 }
 
+void KstDataSource::updateNumFramesScalar() {
+  d->numFrames->setValue(frameCount());
+}
 
 int KstDataSource::readField(double *v, const QString& field, int s, int n) {

--- kdeextragear-2/kst/kst/kstdatasource.h  #1.9:1.10
@@ -24,5 +24,5 @@
 
 #include "kstobject.h"
-
+#include "kstscalar.h"
 
 namespace KST {
@@ -30,5 +30,8 @@ namespace KST {
 }
 
-class KstDataSourcePrivate;
+class KstDataSourcePrivate {
+public:
+  KstScalarPtr numFrames;
+};
 
 // BINARY COMPATIBILITY IS NOT YET GUARANTEED
@@ -91,4 +94,6 @@ protected:
   virtual void virtual_hook(int id, void *data);
 
+  void updateNumFramesScalar();
+
   /** Is the object valid? */
   bool _valid;

--- kdeextragear-2/kst/kst/datasources/ascii/ascii.cpp  #1.16:1.17
@@ -144,4 +144,5 @@ KstObject::UpdateType AsciiSource::updat
   file.close();
 
+  updateNumFramesScalar();
   return forceUpdate ? KstObject::UPDATE : (new_data ? KstObject::UPDATE : KstObject::NO_CHANGE);
 }

--- kdeextragear-2/kst/kst/datasources/dirfile/dirfile.cpp  #1.6:1.7
@@ -69,4 +69,5 @@ KstObject::UpdateType DirFileSource::upd
   _frameCount = newNF;
 
+  updateNumFramesScalar();
   return isnew ? KstObject::UPDATE : KstObject::NO_CHANGE;
 }

--- kdeextragear-2/kst/kst/datasources/frame/frame.cpp  #1.3:1.4
@@ -128,4 +128,5 @@ KstObject::UpdateType FrameSource::updat
   _frameCount = newN;
 
+  updateNumFramesScalar();
   return isnew ? KstObject::UPDATE : KstObject::NO_CHANGE;
 }

--- kdeextragear-2/kst/kst/datasources/lfiio/lfiio.cpp  #1.6:1.7
@@ -144,4 +144,6 @@ KstObject::UpdateType LFIIOSource::updat
   }
   
+  updateNumFramesScalar();
+
   return updateType;
 }

--- kdeextragear-2/kst/kst/datasources/planck/planck.cpp  #1.15:1.16
@@ -48,4 +48,5 @@ KstObject::UpdateType PlanckSource::upda
   Q_UNUSED(u)
   if (_valid && _planckObject && _planckObject->updated()) {
+    updateNumFramesScalar();
     return KstObject::UPDATE;
   }





More information about the Kst mailing list