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

Peter Kümmel syntheticpp at gmx.net
Thu Jan 20 09:18:19 CET 2011


SVN commit 1215903 by kuemmel:

don't use full data source file name when showed in View dialog

 M  +13 -0     primitivemodel.cpp  
 M  +1 -0      primitivemodel.h  
 M  +5 -4      scalarmodel.cpp  
 M  +5 -4      stringmodel.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/primitivemodel.cpp #1215902:1215903
@@ -188,6 +188,19 @@
 }
 
 
+PrimitiveTreeItem* PrimitiveModel::addDataSourceFileItem(DataSourcePtr dataSource, PrimitiveTreeItem* parent)
+{
+  QString path = dataSource->descriptiveName();
+  QFileInfo info(path);
+  
+  PrimitiveTreeItem* item = addPrimitiveTreeItem(QList<QVariant>() << info.fileName(), parent);
+  new PrimitiveTreeItem(QList<QVariant>() << "In directory" << info.path(), item);
+
+  return item;
 }
 
+
+
+}
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/primitivemodel.h #1215902:1215903
@@ -89,6 +89,7 @@
 
 protected:
   PrimitiveTreeItem* addPrimitiveTreeItem(const QList<QVariant>& data, PrimitiveTreeItem* parent);
+  PrimitiveTreeItem* addDataSourceFileItem(DataSourcePtr dataSource, PrimitiveTreeItem* parent);
 
 private:
   ObjectStore *_store;
--- branches/work/kst/portto4/kst/src/libkstapp/scalarmodel.cpp #1215902:1215903
@@ -25,13 +25,14 @@
 
 
 void ScalarModel::addDataSourcesMetas(DataSourcePtr dataSource, PrimitiveTreeItem* parent) {
-  if (dataSource->scalar().list().isEmpty()) {
+
+  PrimitiveTreeItem* item = addDataSourceFileItem(dataSource, parent);
+
+  QStringList scalars = dataSource->scalar().list();
+  if (scalars.isEmpty()) {
     return;
   }
 
-  PrimitiveTreeItem* item = addPrimitiveTreeItem(QList<QVariant>() << dataSource->Name(), parent);
-
-  QStringList scalars = dataSource->scalar().list();
   scalars.sort();
   foreach(const QString& scalar, scalars) {
     double value;
--- branches/work/kst/portto4/kst/src/libkstapp/stringmodel.cpp #1215902:1215903
@@ -25,13 +25,14 @@
 
 
 void StringModel::addDataSourcesMetas(DataSourcePtr dataSource, PrimitiveTreeItem* parent) {
-  if (dataSource->string().list().isEmpty()) {
+
+  PrimitiveTreeItem* item = addDataSourceFileItem(dataSource, parent);
+
+  QStringList strings = dataSource->string().list();
+  if (strings.isEmpty()) {
     return;
   }
 
-  PrimitiveTreeItem* item = addPrimitiveTreeItem(QList<QVariant>() << dataSource->Name(), parent);
-
-  QStringList strings = dataSource->string().list();
   strings.sort();
   foreach(const QString& str, strings) {
     QString value;


More information about the Kst mailing list