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

Nicolas Brisset nicolas.brisset at eurocopter.com
Thu Apr 22 08:14:59 CEST 2010

SVN commit 1117430 by brisset:

When reading a file with the ASCII datasource, always load ASCII defaults before attempting to load file-specific settings (asciisourceconfig.cpp).
Also avoid overriding those defaults with hard-coded values when no key exists for the given file (namedparameter.h). That issue is actually more a problem that the test in asciisourceconfig.cpp / AsciiSourceConfig::readGroup is not specific enough: fileName.isEmpty() triggers too easily => if the file has no settings stored, we still try to read its settings and since we find nothing we revert to hard-coded default values. With this patch, the constructor sets hard-coded defaults, then we override them with the ASCII source's general defaults, then with file-specific values, but only if there are some in QSettings. If you think this patch is wrong, we have to find a way to test for the existence of settings for the given file instead of just testing whether the filename is empty.

BUG: 234396

 M  +2 -3      asciisourceconfig.cpp  
 M  +1 -3      namedparameter.h  

--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisourceconfig.cpp #1117429:1117430
@@ -115,9 +115,8 @@
 void AsciiSourceConfig::readGroup(QSettings& cfg, const QString& fileName) {
-  if (fileName.isEmpty()) {
-    read(cfg);
-  } else {
+  read(cfg);
+  if (!fileName.isEmpty()) {
--- branches/work/kst/portto4/kst/src/datasources/ascii/namedparameter.h #1117429:1117430
@@ -40,9 +40,7 @@
   void operator<<(QSettings& settings) {
     const QVariant var = settings.value(Key);
-    if (var.isNull())
-      setValue(_default_value);
-    else
+    if (!var.isNull())

More information about the Kst mailing list