[Kst] branches/work/kst/portto4/kst/src

Peter Kümmel syntheticpp at yahoo.com
Fri Mar 19 15:11:41 CET 2010


SVN commit 1105205 by kuemmel:

Merge /home/synth/transfer/gkst

 M  +3 -1      datasources/ascii/asciisource.cpp  
 M  +4 -1      datasources/qimagesource/qimagesource.cpp  
 M  +4 -1      datasources/sampledatasource/sampledatasource.cpp  
 M  +7 -2      libkst/datasource.cpp  
 M  +27 -15    libkst/datasource.h  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1105204:1105205
@@ -58,10 +58,12 @@
 
 
 AsciiSource::AsciiSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e)
-: Kst::DataSource(store, cfg, filename, type, File), _rowIndex(0L), _config(0L), _tmpBuf(0L), _tmpBufSize(0) {
+: Kst::DataSource(store, cfg, filename, type), _rowIndex(0L), _config(0L), _tmpBuf(0L), _tmpBufSize(0) {
 
   //TIME_IN_SCOPE(Ctor_AsciiSource);
 
+  setUpdateType(File);
+
   _valid = false;
   _haveHeader = false;
   _fieldListComplete = false;
--- branches/work/kst/portto4/kst/src/datasources/qimagesource/qimagesource.cpp #1105204:1105205
@@ -41,7 +41,10 @@
 
 
 QImageSource::QImageSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e)
-: Kst::DataSource(store, cfg, filename, type, None), _config(0L) {
+: Kst::DataSource(store, cfg, filename, type), _config(0L) {
+  
+  setUpdateType(None);
+
   _valid = false;
   if (!type.isEmpty() && type != qimageTypeString) {
     return;
--- branches/work/kst/portto4/kst/src/datasources/sampledatasource/sampledatasource.cpp #1105204:1105205
@@ -50,7 +50,10 @@
 
 ***********************/
 SampleDatasourceSource::SampleDatasourceSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e)
-: Kst::DataSource(store, cfg, filename, type, None), _config(0L) {
+: Kst::DataSource(store, cfg, filename, type), _config(0L) {
+
+  setUpdateType(None);
+
   _valid = false;
   if (!type.isEmpty() && type != "Sample Datasource") {
     return;
--- branches/work/kst/portto4/kst/src/libkst/datasource.cpp #1105204:1105205
@@ -96,8 +96,8 @@
 
 
 
-DataSource::DataSource(ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const UpdateCheckType updateType)
-    : Object(), _filename(filename), _cfg(cfg), _updateCheckType(updateType) {
+DataSource::DataSource(ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type)
+: Object(), _filename(filename), _cfg(cfg), _updateCheckType(File) {
   Q_UNUSED(type)
   Q_UNUSED(store)
   _valid = false;
@@ -135,7 +135,12 @@
 }
 
 
+void DataSource::setUpdateType(UpdateCheckType updateType)
+{
+_updateCheckType = updateType;
+}
 
+
 void DataSource::checkUpdate() {
   if (!UpdateManager::self()->paused()) {
     UpdateManager::self()->doUpdates(false);
--- branches/work/kst/portto4/kst/src/libkst/datasource.h #1105204:1105205
@@ -64,29 +64,26 @@
   Q_OBJECT
 
   public:
-    enum UpdateCheckType { Timer, File, None };
+    DataSource(ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type);
+    virtual ~DataSource();
     
 
-    DataSource(ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const UpdateCheckType updateType = File);
-    virtual ~DataSource();
-
-    virtual UpdateType objectUpdate(qint64 newSerial);
-
+    /************************************************************/
+    /* Dynamic type system                                      */
+    /************************************************************/
     virtual const QString& typeString() const;
     static const QString staticTypeString;
     static const QString staticTypeTag;
 
-    bool hasConfigWidget() const;
-    DataSourceConfigWidget *configWidget();
-    virtual void parseProperties(QXmlStreamAttributes &properties);
 
-    bool reusable() const;
-    void disableReuse();
+    /************************************************************/
+    /* Methods for update system                                */
+    /************************************************************/
 
-    virtual bool isValid() const; // generally you don't need to change this
-    // returns _valid;
+    enum UpdateCheckType { Timer, File, None };
+    void setUpdateType(UpdateCheckType updateType);
+    virtual UpdateType objectUpdate(qint64 newSerial);
 
-    // these are not used by datasources
     void internalUpdate() {return;}
     qint64 minInputSerial() const {return 0;}
     qint64 minInputSerialOfLastChange() const {return 0;}
@@ -94,9 +91,24 @@
    /** Updates number of samples.
       For ascii files, it also reads and writes to a temporary binary file.
       It must be implemented by the datasource. */
-
     virtual UpdateType internalDataSourceUpdate() = 0;
 
+
+    /************************************************************/
+    /* UI TODO leave here?                                      */
+    /************************************************************/
+    bool hasConfigWidget() const;
+    DataSourceConfigWidget *configWidget();
+    virtual void parseProperties(QXmlStreamAttributes &properties);
+
+    bool reusable() const;
+    void disableReuse();
+
+    virtual bool isValid() const; // generally you don't need to change this
+
+
+
+
     virtual QString fileName() const;
 
     /** Returns the file type or an error message in a static string


More information about the Kst mailing list