[Kst] branches/work/kst/portto4/kst/src
Mike Fenton
mike at staikos.net
Wed Sep 17 20:04:25 CEST 2008
SVN commit 861982 by fenton:
Add basic support for filter plugins.
Port Despike filter to new format.
Update Plugin Interface to include Type and Description.
M +1 -0 datasources/ascii/ascii.cpp
M +1 -0 datasources/ascii/ascii.h
M +1 -0 datasources/dirfile/dirfile.cpp
M +1 -0 datasources/dirfile/dirfile.h
M +1 -0 libkst/dataplugin.h
M +6 -0 libkstapp/datamanager.cpp
M +78 -0 libkstmath/dataobject.cpp
M +5 -0 libkstmath/dataobject.h
M +4 -0 libkstmath/dataobjectplugin.h
A old_plugins (directory)
AM old_plugins/despike (directory) plugins/despike#859885
D plugins/despike (directory)
A plugins/filters/despike (directory)
AM plugins/filters/despike/despike.pro
AM plugins/filters/despike/filterdespike.cpp [License: GPL (v2+)]
AM plugins/filters/despike/filterdespike.h [License: GPL (v2+)]
AM plugins/filters/despike/filterdespikeconfig.ui
AM plugins/filters/despike/kstplugin_filter_despike.desktop
A plugins/filters/filters.pro
M +2 -1 plugins/plugins.pro
M +1 -0 plugins/sampleplugin/sampleplugin.cpp
M +3 -0 plugins/sampleplugin/sampleplugin.h
--- branches/work/kst/portto4/kst/src/datasources/ascii/ascii.cpp #861981:861982
@@ -935,6 +935,7 @@
QString AsciiPlugin::pluginName() const { return "ASCII File Reader"; }
+QString AsciiPlugin::pluginDescription() const { return "ASCII File Reader"; }
Kst::DataSource *AsciiPlugin::create(Kst::ObjectStore *store, QSettings *cfg,
--- branches/work/kst/portto4/kst/src/datasources/ascii/ascii.h #861981:861982
@@ -97,6 +97,7 @@
virtual ~AsciiPlugin() {}
virtual QString pluginName() const;
+ virtual QString pluginDescription() const;
virtual bool hasConfigWidget() const { return true; }
--- branches/work/kst/portto4/kst/src/datasources/dirfile/dirfile.cpp #861981:861982
@@ -210,6 +210,7 @@
QString DirFilePlugin::pluginName() const { return "DirFile Reader"; }
+QString DirFilePlugin::pluginDescription() const { return "DirFile Reader"; }
Kst::DataSource *DirFilePlugin::create(Kst::ObjectStore *store,
--- branches/work/kst/portto4/kst/src/datasources/dirfile/dirfile.h #861981:861982
@@ -77,6 +77,7 @@
virtual ~DirFilePlugin() {}
virtual QString pluginName() const;
+ virtual QString pluginDescription() const;
virtual bool hasConfigWidget() const { return false; }
--- branches/work/kst/portto4/kst/src/libkst/dataplugin.h #861981:861982
@@ -30,6 +30,7 @@
virtual ~PluginInterface() {}
virtual QString pluginName() const { return QString::null; }
+ virtual QString pluginDescription() const { return QString::null; }
virtual bool hasConfigWidget() const { return false; }
};
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #861981:861982
@@ -126,6 +126,12 @@
connect(action, SIGNAL(triggered(QString&)), this, SLOT(showPluginDialog(QString&)));
_dataObjects->addAction(action);
}
+
+ foreach (QString pluginName, DataObject::filterPluginList()) {
+ action = new DataButtonAction(tr(pluginName));
+ connect(action, SIGNAL(triggered(QString&)), this, SLOT(showPluginDialog(QString&)));
+ _filters->addAction(action);
+ }
}
--- branches/work/kst/portto4/kst/src/libkstmath/dataobject.cpp #861981:861982
@@ -126,7 +126,57 @@
}
+QStringList DataObject::dataObjectPluginList() {
+ if (_pluginList.isEmpty()) {
+ scanPlugins();
+ }
+ QStringList plugins;
+
+ for (DataObjectPluginList::ConstIterator it = _pluginList.begin(); it != _pluginList.end(); ++it) {
+ if ((*it)->pluginType() == DataObjectPluginInterface::Generic) {
+ plugins += (*it)->pluginName();
+ }
+ }
+
+ return plugins;
+}
+
+
+QStringList DataObject::filterPluginList() {
+ if (_pluginList.isEmpty()) {
+ scanPlugins();
+ }
+
+ QStringList plugins;
+
+ for (DataObjectPluginList::ConstIterator it = _pluginList.begin(); it != _pluginList.end(); ++it) {
+ if ((*it)->pluginType() == DataObjectPluginInterface::Filter) {
+ plugins += (*it)->pluginName();
+ }
+ }
+
+ return plugins;
+}
+
+
+QStringList DataObject::fitsPluginList() {
+ if (_pluginList.isEmpty()) {
+ scanPlugins();
+ }
+
+ QStringList plugins;
+
+ for (DataObjectPluginList::ConstIterator it = _pluginList.begin(); it != _pluginList.end(); ++it) {
+ if ((*it)->pluginType() == DataObjectPluginInterface::Fit) {
+ plugins += (*it)->pluginName();
+ }
+ }
+
+ return plugins;
+}
+
+
DataObjectConfigWidget* DataObject::pluginWidget(const QString& name) {
if (_pluginList.isEmpty()) {
scanPlugins();
@@ -144,6 +194,34 @@
}
+QString DataObject::pluginDescription(const QString& name) {
+ if (_pluginList.isEmpty()) {
+ scanPlugins();
+ }
+
+ for (DataObjectPluginList::ConstIterator it = _pluginList.begin(); it != _pluginList.end(); ++it) {
+ if ((*it)->pluginName() == name) {
+ return (*it)->pluginDescription();
+ }
+ }
+ return QString();
+}
+
+
+int DataObject::pluginType(const QString& name) {
+ if (_pluginList.isEmpty()) {
+ scanPlugins();
+ }
+
+ for (DataObjectPluginList::ConstIterator it = _pluginList.begin(); it != _pluginList.end(); ++it) {
+ if ((*it)->pluginName() == name) {
+ return (*it)->pluginType();
+ }
+ }
+ return -1;
+}
+
+
DataObjectPtr DataObject::createPlugin(const QString& name, ObjectStore *store, DataObjectConfigWidget *configWidget, bool setupInputsOutputs) {
for (DataObjectPluginList::ConstIterator it = _pluginList.begin(); it != _pluginList.end(); ++it) {
if ((*it)->pluginName() == name) {
--- branches/work/kst/portto4/kst/src/libkstmath/dataobject.h #861981:861982
@@ -56,11 +56,16 @@
static void cleanupForExit();
/** Returns a list of object plugins found on the system. */
static QStringList pluginList();
+ static QStringList dataObjectPluginList();
+ static QStringList filterPluginList();
+ static QStringList fitsPluginList();
// static QWidget* pluginWidget(const QString& name, ObjectPtr objectPtr = 0, VectorPtr vector = 0);
static DataObjectPtr createPlugin(const QString& name, ObjectStore *store, VectorPtr vector);
static DataObjectConfigWidget* pluginWidget(const QString& name);
static DataObjectPtr createPlugin(const QString& name, ObjectStore *store, DataObjectConfigWidget *configWidget, bool setupInputsOutputs = true);
+ static QString pluginDescription(const QString &name);
+ static int pluginType(const QString &name);
virtual UpdateType update() = 0;
--- branches/work/kst/portto4/kst/src/libkstmath/dataobjectplugin.h #861981:861982
@@ -25,11 +25,15 @@
class DataObjectPluginInterface : public PluginInterface {
public:
+ enum PluginTypeID { Generic, Fit, Filter };
+
virtual ~DataObjectPluginInterface() {}
virtual DataObject *create(ObjectStore *store, DataObjectConfigWidget *configWidget, bool setupInputsOutputs = true) const = 0;
virtual DataObjectConfigWidget *configWidget(QSettings *settingsObject) const = 0;
+
+ virtual PluginTypeID pluginType() const = 0;
};
** branches/work/kst/portto4/kst/src/old_plugins/despike #property svn:ignore
+ Makefile.in
** branches/work/kst/portto4/kst/src/plugins/filters/despike/despike.pro #property svn:executable
+ *
** branches/work/kst/portto4/kst/src/plugins/filters/despike/filterdespike.cpp #property svn:executable
+ *
** branches/work/kst/portto4/kst/src/plugins/filters/despike/filterdespike.h #property svn:executable
+ *
** branches/work/kst/portto4/kst/src/plugins/filters/despike/filterdespikeconfig.ui #property svn:executable
+ *
** branches/work/kst/portto4/kst/src/plugins/filters/despike/kstplugin_filter_despike.desktop #property svn:executable
+ *
--- branches/work/kst/portto4/kst/src/plugins/plugins.pro #861981:861982
@@ -2,5 +2,6 @@
CONFIG += ordered
SUBDIRS += \
- sampleplugin
+ sampleplugin \
+ filters
--- branches/work/kst/portto4/kst/src/plugins/sampleplugin/sampleplugin.cpp #861981:861982
@@ -221,6 +221,7 @@
// Name used to identify the plugin. Used when loading the plugin.
QString SamplePlugin::pluginName() const { return "Sample DataObject Plugin"; }
+QString SamplePlugin::pluginDescription() const { return "Sample DataObject Plugin Description"; }
/**********************
--- branches/work/kst/portto4/kst/src/plugins/sampleplugin/sampleplugin.h #861981:861982
@@ -56,7 +56,10 @@
virtual ~SamplePlugin() {}
virtual QString pluginName() const;
+ virtual QString pluginDescription() const;
+ virtual DataObjectPluginInterface::PluginTypeID pluginType() const { return Generic; }
+
virtual bool hasConfigWidget() const { return true; }
virtual Kst::DataObject *create(Kst::ObjectStore *store, Kst::DataObjectConfigWidget *configWidget, bool setupInputsOutputs = true) const;
More information about the Kst
mailing list