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

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2005 C. Barth Netterfield                             *
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 QIMAGESOURCE_H
0015 #define QIMAGESOURCE_H
0016 
0017 #include <datasource.h>
0018 #include <dataplugin.h>
0019 
0020 class DataInterfaceQImageVector;
0021 class DataInterfaceQImageMatrix;
0022   
0023 class QImageSource : public Kst::DataSource 
0024 {
0025   Q_OBJECT
0026 
0027   public:
0028     QImageSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e);
0029 
0030     ~QImageSource();
0031 
0032     bool init();
0033     virtual void reset();
0034 
0035     Kst::Object::UpdateType internalDataSourceUpdate();
0036 
0037     bool isEmpty() const;
0038     QString fileType() const;
0039 
0040     void save(QXmlStreamWriter &streamWriter);
0041 
0042     virtual const QString& typeString() const;
0043 
0044     class Config;
0045 
0046     //int readScalar(double &S, const QString& scalar);
0047     //int readString(QString &S, const QString& string);
0048 
0049   private:
0050     QImage _image;
0051     mutable Config *_config;
0052 
0053     DataInterfaceQImageVector* iv;
0054     DataInterfaceQImageMatrix* im;
0055 };
0056 
0057 
0058 class QImageSourcePlugin : public QObject, public Kst::DataSourcePluginInterface {
0059     Q_OBJECT
0060     Q_INTERFACES(Kst::DataSourcePluginInterface)
0061     Q_PLUGIN_METADATA(IID "com.kst.DataSourcePluginInterface/2.0")
0062   public:
0063     virtual ~QImageSourcePlugin() {}
0064 
0065     virtual QString pluginName() const;
0066     virtual QString pluginDescription() const;
0067 
0068     virtual bool hasConfigWidget() const { return false; }
0069 
0070     virtual Kst::DataSource *create(Kst::ObjectStore *store,
0071                                   QSettings *cfg,
0072                                   const QString &filename,
0073                                   const QString &type,
0074                                   const QDomElement &element) const;
0075 
0076     virtual QStringList matrixList(QSettings *cfg,
0077                                   const QString& filename,
0078                                   const QString& type,
0079                                   QString *typeSuggestion,
0080                                   bool *complete) const;
0081 
0082     virtual QStringList fieldList(QSettings *cfg,
0083                                   const QString& filename,
0084                                   const QString& type,
0085                                   QString *typeSuggestion,
0086                                   bool *complete) const;
0087 
0088     virtual QStringList scalarList(QSettings *cfg,
0089                                   const QString& filename,
0090                                   const QString& type,
0091                                   QString *typeSuggestion,
0092                                   bool *complete) const;
0093 
0094     virtual QStringList stringList(QSettings *cfg,
0095                                   const QString& filename,
0096                                   const QString& type,
0097                                   QString *typeSuggestion,
0098                                   bool *complete) const;
0099 
0100     virtual int understands(QSettings *cfg, const QString& filename) const;
0101 
0102     virtual bool supportsTime(QSettings *cfg, const QString& filename) const;
0103 
0104     virtual QStringList provides() const;
0105 
0106     virtual Kst::DataSourceConfigWidget *configWidget(QSettings *cfg, const QString& filename) const;
0107 };
0108 
0109 
0110 #endif
0111 // vim: ts=2 sw=2 et