[Kst] [Bug 142897] More intuitive vector selection for complex data sources
Andrew Walker
arwalker at sumusltd.com
Fri Jul 20 03:42:25 CEST 2007
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=142897
------- Additional Comments From arwalker sumusltd com 2007-07-20 03:42 -------
SVN commit 690077 by arwalker:
CCBUG:142897 continue work for hierarchical data sources
M +10 -5 datasources/planckIDEF/planckIDEF.cpp
M +11 -0 libkst/kstdataplugin.h
M +18 -1 libkst/kstdatasource.cpp
M +3 -0 libkst/kstdatasource.h
M +5 -1 libkstapp/kstdatawizard_i.cpp
--- branches/work/kst/1.5/kst/src/datasources/planckIDEF/planckIDEF.cpp #690076:690077
@ -501,7 +501,7 @
iResult = fits_read_keyword( ffits, "EXTNAME", value, comment, &iStatus );
if( iResult == 0 )
{
- prefixNew = prefix + QDir::separator() + QString( value ).remove( QChar( '\'' ) );
+ prefixNew = prefix + separator() + QString( value ).remove( QChar( '\'' ) );
}
iResult = 0;
@ -554,7 +554,7 @
fileList* folderFields;
folderField folderField;
QString baseName = baseFilename(*it);
- QString pathname = folder.path() + QDir::separator() + *it;
+ QString pathname = folder.path() + separator() + *it;
int numFrames;
folderFields = _basefiles.find( baseName );
@ -574,7 +574,7 @
fld->table = 0;
fld->column = 0;
- strIndex = baseName + QDir::separator() + "INDEX";
+ strIndex = baseName + separator() + "INDEX";
_fields.insert( strIndex, fld );
_fieldList.append( strIndex );
@ -833,7 +833,7 @
fld = _fields.find( fieldName );
if( fld != 0L )
{
- if( fieldName == fld->basefile + QDir::separator() + QString("INDEX") )
+ if( fieldName == fld->basefile + separator() + QString("INDEX") )
{
for( i = 0; i < n; ++i )
{
@ -965,7 +965,7 @
{
for (QStringList::ConstIterator it = files.begin(); it != files.end(); ++it)
{
- pathname = folder.path() + QDir::separator() + *it;
+ pathname = folder.path() + separator() + *it;
if( checkValidPlanckIDEFFile( pathname ) )
{
@ -1190,6 +1190,11 @
return rc;
}
+ bool supportsHierarchy_planckIDEF( )
+ {
+ return true;
+ }
+
int understands_planckIDEF( KConfig*, const QString& filename )
{
QFileInfo fileinfo( filename );
--- branches/work/kst/1.5/kst/src/libkst/kstdataplugin.h #690076:690077
@ -224,6 +224,17 @
return false;
}
+ bool supportsHierarchy() const {
+ bool (*sym)() = (bool(*)())symbol("supportsHierarchy");
+ if (sym) {
+ //kstdDebug() << "Checking if " << service->property("Name").toString() << " provides " << type << endl;
+ bool rc = (sym)();
+ return rc;
+ }
+
+ return false;
+ }
+
bool provides(const QString& type) const {
return provides().contains(type);
}
--- branches/work/kst/1.5/kst/src/libkst/kstdatasource.cpp #690076:690077
@ -318,6 +318,24 @
}
+bool KstDataSource::supportsHierarchy(const QString& filename, const QString& type) {
+ if (filename.isEmpty() || filename == "stdin" || filename == "-") {
+ return false;
+ }
+
+ QString fn = obtainFile(filename);
+ if (fn.isEmpty()) {
+ return false;
+ }
+
+ QValueList<PluginSortContainer> bestPlugins = bestPluginsForSource(fn, type);
+ if (bestPlugins.isEmpty()) {
+ return false;
+ }
+ return (*bestPlugins.begin()).plugin->supportsHierarchy();
+}
+
+
QStringList KstDataSource::fieldListForSource(const QString& filename, const QString& type, QString *outType, bool *complete) {
if (filename == "stdin" || filename == "-") {
return QStringList();
@ -360,7 +378,6 @
}
}
-
return rc;
}
--- branches/work/kst/1.5/kst/src/libkst/kstdatasource.h #690076:690077
@ -19,6 +19,7 @
#define KSTDATASOURCE_H
#include <qdict.h>
+#include <qdir.h>
#include <qdom.h>
#include <qguardedptr.h>
#include <qstring.h>
@ -74,6 +75,8 @
static bool pluginHasConfigWidget(const QString& plugin);
// since 1.1.0
static bool supportsTime(const QString& plugin, const QString& type = QString::null);
+ static bool supportsHierarchy(const QString& filename, const QString& type = QString::null);
+ static char separator() { return QDir::separator(); }
KstDataSourceConfigWidget *configWidget() const;
--- branches/work/kst/1.5/kst/src/libkstapp/kstdatawizard_i.cpp #690076:690077
@ -299,6 +299,7 @
ds = 0L;
} else {
fl = KstDataSource::fieldListForSource(file, QString::null, &fileType, &complete);
+ hierarchy = KstDataSource::supportsHierarchy(file, QString::null);
}
if (!fl.isEmpty() && !fileType.isEmpty()) {
@ -337,12 +338,14 @
for (QStringList::ConstIterator it = fl.begin(); it != fl.end(); ++it) {
QListViewItem *item = new QListViewItem(_vectors, *it);
+ QString str;
+
item->setDragEnabled(true);
- QString str;
str.sprintf("%0*d", count, index++);
item->setText(1, str);
_countMap[*it] = str;
}
+
_vectors->sort();
KST::vectorDefaults.sync();
@ -548,6 +551,7 @
_vectors->setSorting(3, true); // Qt 3.1 compat
QRegExp re(filter, true /* case insensitive */, true /* wildcard */);
QListViewItemIterator it(_vectors);
+
while (it.current()) {
QListViewItem *i = it.current();
++it;
More information about the Kst
mailing list