[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Tue Apr 26 19:29:24 CEST 2005
CVS commit by staikos:
add a static mechanism to determine if a source supports time. Inefficient, but
we have to wait for Kst2 for something better. Fixes the vector dialog time
support
M +25 -0 kstdatasource.cpp 1.69
M +2 -0 kstdatasource.h 1.44
M +2 -2 kstvectordialog_i.cpp 1.74
M +9 -1 datasources/planck/planck.cpp 1.40
--- kdeextragear-2/kst/kst/kstdatasource.cpp #1.68:1.69
@@ -127,4 +127,14 @@ namespace KST {
}
+ return 0;
+ }
+
+ bool supportsTime(KConfig *cfg, const QString& filename) const {
+ bool (*sym)(KConfig*, const QString&) = (bool(*)(KConfig*, const QString&))symbol("supportsTime");
+ if (sym) {
+ bool rc = (sym)(cfg, filename);
+ return rc;
+ }
+
return false;
}
@@ -449,4 +459,19 @@ KstDataSourceConfigWidget* KstDataSource
+bool KstDataSource::supportsTime(const QString& filename, const QString& type) {
+ if (filename == "stdin" || filename == "-") {
+ return false;
+ }
+
+ QString fn = obtainFile(filename);
+ if (fn.isEmpty()) {
+ return false;
+ }
+
+ QValueList<PluginSortContainer> bestPlugins = bestPluginsForSource(fn, type);
+ return (*bestPlugins.begin()).plugin->supportsTime(kConfigObject, fn);
+}
+
+
QStringList KstDataSource::fieldListForSource(const QString& filename, const QString& type, QString *outType, bool *complete) {
if (filename == "stdin" || filename == "-") {
--- kdeextragear-2/kst/kst/kstdatasource.h #1.43:1.44
@@ -61,4 +61,6 @@ class KST_EXPORT KstDataSource : public
// @since 1.1.0
static bool pluginHasConfigWidget(const QString& plugin);
+ // @since 1.1.0
+ static bool supportsTime(const QString& plugin, const QString& type = QString::null);
--- kdeextragear-2/kst/kst/kstvectordialog_i.cpp #1.73:1.74
@@ -134,4 +134,5 @@ void KstVectorDialogI::updateCompletion(
Field->setEnabled(true);
_connect->hide();
+ _kstDataRange->setAllowTime(ds->supportsTimeConversions());
} else {
QString type;
@@ -158,4 +159,5 @@ void KstVectorDialogI::updateCompletion(
_configWidget = KstDataSource::configWidgetForSource(u, type);
}
+ _kstDataRange->setAllowTime(KstDataSource::supportsTime(u, type));
}
@@ -172,7 +174,5 @@ void KstVectorDialogI::updateCompletion(
Field->setCurrentText(current_text);
}
- _kstDataRange->setAllowTime(ds && ds->supportsTimeConversions());
_OK->setEnabled(Field->isEnabled());
-
}
--- kdeextragear-2/kst/kst/datasources/planck/planck.cpp #1.39:1.40
@@ -338,4 +338,12 @@ QStringList provides_planck() {
}
+bool supportsTime_planck(KConfig*, const QString& filename) {
+ KstSharedPtr<Planck::Object> pobj = new Planck::Object;
+ if (!pobj->setGroup(filename) || !pobj->isValid()) {
+ return false;
+ }
+ return pobj->fields().contains("TIMES_OF_SAMPLES") || pobj->fields().contains("TIMESEC");
+}
+
int understands_planck(KConfig*, const QString& filename) {
bool rc = Planck::validDatabase(filename);
@@ -363,5 +371,5 @@ QStringList fieldList_planck(KConfig*, c
QStringList rc = pobj->fields();
- rc.append("INDEX");
+ rc.prepend("INDEX");
return rc;
}
More information about the Kst
mailing list