1 /*************************************************************************** 2 * * 3 * copyright : (C) 2007 The University of Toronto * 4 * netterfield@astro.utoronto.ca * 5 * * 6 * This program is free software; you can redistribute it and/or modify * 7 * it under the terms of the GNU General Public License as published by * 8 * the Free Software Foundation; either version 2 of the License, or * 9 * (at your option) any later version. * 10 * * 11 ***************************************************************************/ 12 13 14 #ifndef ITSDATASOURCE_H 15 #define ITSDATASOURCE_H 16 17 #include <datasource.h> 18 #include <dataplugin.h> 19 20 #include "its.h" 21 22 class DataInterfaceITSMatrix; 23 class DataInterfaceITSVector; 24 25 class ITSSource : public Kst::DataSource { 26 Q_OBJECT 27 28 public: 29 ITSSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e); 30 31 ~ITSSource(); 32 33 friend class DataInterfaceITSMatrix; 34 friend class DataInterfaceITSVector; 35 36 bool init(); 37 virtual void reset(); 38 39 Kst::Object::UpdateType internalDataSourceUpdate(); 40 41 42 QString fileType() const; 43 44 void save(QXmlStreamWriter &streamWriter); 45 46 class Config; 47 isImageStream(QString field)48 virtual bool isImageStream(QString field) {Q_UNUSED(field) return true;} 49 50 private: 51 mutable Config *_config; 52 53 DataInterfaceITSMatrix* im; 54 DataInterfaceITSVector* iv; 55 56 QMap<QString, int> _matrixNames; 57 QStringList _vectorList; 58 59 ITSfile *_itsfile; 60 61 int _nframes; 62 63 ITSimage _itsImage; 64 }; 65 66 67 class ITSSourcePlugin : public QObject, public Kst::DataSourcePluginInterface { 68 Q_OBJECT Q_INTERFACES(Kst::DataSourcePluginInterface)69 Q_INTERFACES(Kst::DataSourcePluginInterface) 70 Q_PLUGIN_METADATA(IID "com.kst.DataSourcePluginInterface/2.0") 71 public: 72 virtual ~ITSSourcePlugin() {} 73 74 virtual QString pluginName() const; 75 virtual QString pluginDescription() const; 76 hasConfigWidget()77 virtual bool hasConfigWidget() const { return false; } 78 79 virtual Kst::DataSource *create(Kst::ObjectStore *store, 80 QSettings *cfg, 81 const QString &filename, 82 const QString &type, 83 const QDomElement &element) const; 84 85 virtual QStringList matrixList(QSettings *cfg, 86 const QString& filename, 87 const QString& type, 88 QString *typeSuggestion, 89 bool *complete) const; 90 91 virtual QStringList fieldList(QSettings *cfg, 92 const QString& filename, 93 const QString& type, 94 QString *typeSuggestion, 95 bool *complete) const; 96 97 virtual QStringList scalarList(QSettings *cfg, 98 const QString& filename, 99 const QString& type, 100 QString *typeSuggestion, 101 bool *complete) const; 102 103 virtual QStringList stringList(QSettings *cfg, 104 const QString& filename, 105 const QString& type, 106 QString *typeSuggestion, 107 bool *complete) const; 108 109 virtual int understands(QSettings *cfg, const QString& filename) const; 110 111 virtual bool supportsTime(QSettings *cfg, const QString& filename) const; 112 113 virtual QStringList provides() const; 114 115 virtual Kst::DataSourceConfigWidget *configWidget(QSettings *cfg, const QString& filename) const; 116 }; 117 118 119 #endif 120 // vim: ts=2 sw=2 et 121