[Kst] kdeextragear-2/kst

George Staikos staikos at kde.org
Fri Jul 9 00:31:59 CEST 2004


CVS commit by staikos: 

- remove duplicate signal
- make the ascii plugin update properly when the file is overwritten or erased
  and recreated


  M +1 -3      devel-docs/RELEASE_PLAN-0.98   1.21
  M +0 -3      kst/kstfitdialog_i.h   1.7
  M +14 -4     kst/datasources/ascii/ascii.cpp   1.15


--- kdeextragear-2/kst/devel-docs/RELEASE_PLAN-0.98  #1.20:1.21
@@ -8,6 +8,5 @@
 - Kst Settings don't work
 - do events work?
-- deleting a piolib database crashes kst, deleting ascii file - doesn't update
-        - reload makes ascii continue just fine               (George)
+- deleting a piolib database crashes kst (George)
 - "overwrite all" doesn't work in plugin manager <-- KIO related?
 - updates are calling plugins too often without need <-- major problem (George)
@@ -15,5 +14,4 @@
   most recent Qt releases
 - data display dialogs are unusable in realtime mode
-- QMetaObject::findSignal:KstFitDialogI: Conflict with KstFitDialog::modified()
 - fits should store the stat variables as scalars, not as a vector
 - locking is missing in places - especially dialogs (plugin, etc)

--- kdeextragear-2/kst/kst/kstfitdialog_i.h  #1.6:1.7
@@ -56,7 +56,4 @@ private slots:
   void updateScalarTooltip(const QString& n);
 
-signals:
-  void modified();
-
 private:
   QStringList _pluginList;

--- kdeextragear-2/kst/kst/datasources/ascii/ascii.cpp  #1.14:1.15
@@ -54,5 +54,4 @@ bool AsciiSource::initFile() {
     _rowIndex[0] = 0;
     _numLinesAlloc = 32768;
-    _numFrames = 0;
     _byteLength = 0;
   }
@@ -68,8 +67,18 @@ bool AsciiSource::initFile() {
 KstObject::UpdateType AsciiSource::update(int u) {
   Q_UNUSED(u)
+  bool forceUpdate = false;
   static char *tmpbuf = 0L;
   QFile file(_filename);
 
+  if (!_valid) {
+    _numFrames = 0;
+    _byteLength = 0;
+    _rowIndex[0] = 0;
+  }
+
   if (file.exists()) {
+    if (uint(_byteLength) != file.size() || !_valid) {
+      forceUpdate = true;
+    }
     _byteLength = file.size();
   } else {
@@ -84,4 +93,6 @@ KstObject::UpdateType AsciiSource::updat
   }
 
+  _valid = true;
+
   if (!tmpbuf) {
     tmpbuf = new char[MAXBUFREADLEN];
@@ -113,6 +124,5 @@ KstObject::UpdateType AsciiSource::updat
           has_dat = true;
         }
-      } else if (tmpbuf[i] == '\n' ||
-                 tmpbuf[i] == '\r') {
+      } else if (tmpbuf[i] == '\n' || tmpbuf[i] == '\r') {
         if (has_dat) {
           _numFrames++;
@@ -134,5 +144,5 @@ KstObject::UpdateType AsciiSource::updat
   file.close();
 
-  return new_data ? KstObject::UPDATE : KstObject::NO_CHANGE;
+  return forceUpdate ? KstObject::UPDATE : (new_data ? KstObject::UPDATE : KstObject::NO_CHANGE);
 }
 





More information about the Kst mailing list