[Kst] branches/work/kst/portto4/kst/src/datasources/ascii

Peter Kümmel syntheticpp at gmx.net
Thu Jan 27 16:35:33 CET 2011


SVN commit 1217500 by kuemmel:

save/restore reading units

 M  +16 -0     asciiconfig.ui  
 M  +5 -5      asciiplugin.cpp  
 M  +19 -1     asciisourceconfig.cpp  
 M  +6 -0      asciisourceconfig.h  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciiconfig.ui #1217499:1217500
@@ -394,5 +394,21 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>_readUnits</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>_unitsLine</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>112</x>
+     <y>175</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>273</x>
+     <y>175</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
 </ui>
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciiplugin.cpp #1217499:1217500
@@ -17,8 +17,8 @@
 
 #include "asciiplugin.h"
 #include "asciisourceconfig.h"
+#include "kst_atof.h"
 
-
 #include <QFile>
 #include <QFileInfo>
 #include <QButtonGroup>
@@ -72,10 +72,10 @@
   config._columnWidthIsConst = _columnWidthIsConst->isChecked();
   config._dataLine = _startLine->value() - 1;
   config._readFields = _readFields->isChecked();
-  //config._readUnits = _readUnits->isChecked();
+  config._readUnits = _readUnits->isChecked();
   config._useDot = _useDot->isChecked();
   config._fieldsLine = _fieldsLine->value() - 1;
-  //config._unitsLine = _unitsLine->value() - 1;
+  config._unitsLine = _unitsLine->value() - 1;
 
   return config;
 }
@@ -90,10 +90,10 @@
   _columnWidthIsConst->setChecked(config._columnWidthIsConst);
   _startLine->setValue(config._dataLine + 1);
   _readFields->setChecked(config._readFields);
-  //_readUnits->setChecked(config._readUnits);
+  _readUnits->setChecked(config._readUnits);
   _useDot->setChecked(config._useDot);
   _fieldsLine->setValue(config._fieldsLine + 1);
-  //_unitsLine->setValue(config._unitsLine + 1);
+  _unitsLine->setValue(config._unitsLine + 1);
 
   AsciiSourceConfig::ColumnType ct = (AsciiSourceConfig::ColumnType) config._columnType.value();
   if (ct == AsciiSourceConfig::Fixed) {
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisourceconfig.cpp #1217499:1217500
@@ -51,12 +51,15 @@
 const char AsciiSourceConfig::Tag_dataLine[] = "headerstart";
 const char AsciiSourceConfig::Key_readFields[] = "Read Fields";
 const char AsciiSourceConfig::Tag_readFields[] = "readfields";
+const char AsciiSourceConfig::Key_readUnits[] = "Read Units";
+const char AsciiSourceConfig::Tag_readUnits[] = "readunits";
 const char AsciiSourceConfig::Key_useDot[] = "Use Dot";
 const char AsciiSourceConfig::Tag_useDot[] = "usedot";
 const char AsciiSourceConfig::Key_fieldsLine[] = "Fields Line";
 const char AsciiSourceConfig::Tag_fieldsLine[] = "fields";
+const char AsciiSourceConfig::Key_unitsLine[] = "Units Line";
+const char AsciiSourceConfig::Tag_unitsLine[] = "units";
 
-
 AsciiSourceConfig::AsciiSourceConfig() :
   _delimiters(DEFAULT_COMMENT_DELIMITERS),
   _indexVector("INDEX"),
@@ -68,7 +71,9 @@
   _columnWidthIsConst(false),
   _dataLine(1),
   _readFields(false),
+  _readUnits(false),
   _fieldsLine(1),
+  _unitsLine(2),
   _useDot(true),
   _localSeparator(QLocale().decimalPoint().toAscii())
 {
@@ -89,6 +94,8 @@
   _useDot >> cfg;
   _fieldsLine >> cfg;
   _columnWidthIsConst >> cfg;
+  _readUnits >> cfg;
+  _unitsLine >> cfg;
 }
 
 
@@ -118,6 +125,9 @@
   _useDot << cfg;
   _fieldsLine << cfg;
   _columnWidthIsConst << cfg;
+  _readUnits << cfg;
+  _unitsLine << cfg;
+
 }
 
 
@@ -154,7 +164,10 @@
   _readFields >> s;
   _useDot >> s;
  _columnWidthIsConst >> s;
+  _readUnits >> s;
+  _unitsLine >> s;
 
+
   s.writeEndElement();
 }
 
@@ -172,6 +185,9 @@
   _useDot << attributes;
   _fieldsLine << attributes;
   _columnWidthIsConst << attributes;
+  _readUnits << attributes;
+  _unitsLine << attributes;
+
 }
 
 
@@ -193,6 +209,8 @@
         _useDot << elem;
         _fieldsLine << elem;
         _columnWidthIsConst << elem;
+        _readUnits << elem;
+        _unitsLine << elem;
       }
     }
     n = n.nextSibling();
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisourceconfig.h #1217499:1217500
@@ -45,10 +45,14 @@
     static const char Tag_dataLine[];
     static const char Key_readFields[];
     static const char Tag_readFields[];
+    static const char Key_readUnits[];
+    static const char Tag_readUnits[];
     static const char Key_useDot[];
     static const char Tag_useDot[];
     static const char Key_fieldsLine[];
     static const char Tag_fieldsLine[];
+    static const char Key_unitsLine[];
+    static const char Tag_unitsLine[];
 
   public:
     AsciiSourceConfig();
@@ -75,6 +79,8 @@
     NamedParameter<int, Key_dataLine, Tag_dataLine> _dataLine;
     NamedParameter<bool, Key_readFields, Tag_readFields> _readFields;
     NamedParameter<int, Key_fieldsLine, Tag_fieldsLine> _fieldsLine;
+    NamedParameter<bool, Key_readUnits, Tag_readUnits> _readUnits;
+    NamedParameter<int, Key_unitsLine, Tag_unitsLine> _unitsLine;
     NamedParameter<bool, Key_useDot, Tag_useDot> _useDot;
 
 


More information about the Kst mailing list