File indexing completed on 2024-12-22 04:17:17

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2007 The University of Toronto                        *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 
0014 #ifndef SAMPLEDATASOURCE_H
0015 #define SAMPLEDATASOURCE_H
0016 
0017 #include <datasource.h>
0018 #include <dataplugin.h>
0019 
0020 class SampleDatasourceSource : public Kst::DataSource {
0021   Q_OBJECT
0022 
0023   public:
0024     SampleDatasourceSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e);
0025 
0026     ~SampleDatasourceSource();
0027 
0028     bool init();
0029     virtual void reset();
0030 
0031     Kst::Object::UpdateType internalDataSourceUpdate();
0032 
0033  
0034     QString fileType() const;
0035 
0036     void save(QXmlStreamWriter &streamWriter);
0037 
0038     class Config;
0039 
0040 
0041   private:
0042     mutable Config *_config;
0043 };
0044 
0045 
0046 class SampleDatasourcePlugin : public QObject, public Kst::DataSourcePluginInterface {
0047     Q_OBJECT
0048     Q_INTERFACES(Kst::DataSourcePluginInterface)
0049     Q_PLUGIN_METADATA(IID "com.kst.DataSourcePluginInterface/2.0")
0050   public:
0051     virtual ~SampleDatasourcePlugin() {}
0052 
0053     virtual QString pluginName() const;
0054     virtual QString pluginDescription() const;
0055 
0056     virtual bool hasConfigWidget() const { return false; }
0057 
0058     virtual Kst::DataSource *create(Kst::ObjectStore *store,
0059                                   QSettings *cfg,
0060                                   const QString &filename,
0061                                   const QString &type,
0062                                   const QDomElement &element) const;
0063 
0064     virtual QStringList matrixList(QSettings *cfg,
0065                                   const QString& filename,
0066                                   const QString& type,
0067                                   QString *typeSuggestion,
0068                                   bool *complete) const;
0069 
0070     virtual QStringList fieldList(QSettings *cfg,
0071                                   const QString& filename,
0072                                   const QString& type,
0073                                   QString *typeSuggestion,
0074                                   bool *complete) const;
0075 
0076     virtual QStringList scalarList(QSettings *cfg,
0077                                   const QString& filename,
0078                                   const QString& type,
0079                                   QString *typeSuggestion,
0080                                   bool *complete) const;
0081 
0082     virtual QStringList stringList(QSettings *cfg,
0083                                   const QString& filename,
0084                                   const QString& type,
0085                                   QString *typeSuggestion,
0086                                   bool *complete) const;
0087 
0088     virtual int understands(QSettings *cfg, const QString& filename) const;
0089 
0090     virtual bool supportsTime(QSettings *cfg, const QString& filename) const;
0091 
0092     virtual QStringList provides() const;
0093 
0094     virtual Kst::DataSourceConfigWidget *configWidget(QSettings *cfg, const QString& filename) const;
0095 };
0096 
0097 
0098 #endif
0099 // vim: ts=2 sw=2 et