[Kst] branches/work/kst/portto4/kst/src/libkst

Barth Netterfield netterfield at astro.utoronto.ca
Mon Feb 7 16:38:11 CET 2011


SVN commit 1219255 by netterfield:

Read file properties from the .kst file when using filename override.

Don't escape special characters in units so latex can be used (eg, m^2)



 M  +4 -4      datasourcepluginfactory.cpp  
 M  +7 -6      datavector.cpp  


--- branches/work/kst/portto4/kst/src/libkst/datasourcepluginfactory.cpp #1219254:1219255
@@ -65,17 +65,17 @@
     return 0;
   }
 
-  if (store->override.fileName.isEmpty()) {
+  if (!store->override.fileName.isEmpty()) {
+    fileName = store->override.fileName;
+  }
+
     DataSourcePtr dataSource = DataSourcePluginManager::loadSource(store, fileName, fileType);
     if (dataSource) {
       dataSource->parseProperties(propertyAttributes);
     }
 
     return dataSource;
-  } else {
-    return 0;
   }
-}
 
 }
 
--- branches/work/kst/portto4/kst/src/libkst/datavector.cpp #1219254:1219255
@@ -305,7 +305,13 @@
 QString DataVector::label() const {
   // Initialize label to field name, always
   QString label = _field;
-  // If there is a meta string named "quantity", override the default label (does that really make sense???)
+
+  // un-escape escaped special characters so they aren't escaped 2x.
+  label.replace("\\_", "_").replace("\\^","^").replace("\\[", "[").replace("\\]", "]");
+  // now escape the special characters.
+  label.replace('_', "\\_").replace('^', "\\^").replace('[', "\\[").replace(']', "\\]");
+
+  // If there is a meta string named "quantity", override the default label
   if (_fieldStrings.contains("quantity")) {
     label = _fieldStrings.value("quantity")->value();
   }
@@ -324,11 +330,6 @@
     }
   }
 
-  // un-escape escaped special characters so they aren't escaped 2x.
-  label.replace("\\_", "_").replace("\\^","^").replace("\\[", "[").replace("\\]", "]");
-  // now escape the special characters.
-  label.replace('_', "\\_").replace('^', "\\^").replace('[', "\\[").replace(']', "\\]");
-
   return label;
 }
 


More information about the Kst mailing list