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

Peter Kümmel syntheticpp at gmx.net
Mon Aug 30 18:56:13 CEST 2010


SVN commit 1170062 by kuemmel:

Add option to choose update type in data source wizard.

CCBUG: 248104

 M  +5 -0      libkst/datasource.cpp  
 M  +2 -0      libkst/datasource.h  
 M  +41 -0     libkstapp/datawizard.cpp  
 M  +2 -0      libkstapp/datawizard.h  
 M  +53 -2     libkstapp/datawizardpagedatasource.ui  


--- branches/work/kst/portto4/kst/src/libkst/datasource.cpp #1170061:1170062
@@ -196,7 +196,12 @@
 }
 
 
+DataSource::UpdateCheckType DataSource::updateType() const
+{
+  return _updateCheckType;
+}
 
+
 void DataSource::setUpdateType(UpdateCheckType updateType, const QString& file)
 {
   _updateCheckType = updateType;
--- branches/work/kst/portto4/kst/src/libkst/datasource.h #1170061:1170062
@@ -103,6 +103,8 @@
 
     enum UpdateCheckType { Timer, File, None };
     void setUpdateType(UpdateCheckType updateType, const QString& file = QString());
+    UpdateCheckType updateType() const;
+
     virtual UpdateType objectUpdate(qint64 newSerial);
 
     void internalUpdate() {return;}
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #1170061:1170062
@@ -46,6 +46,9 @@
    QString default_source = _dialogDefaults->value("vector/datasource",".").toString();
   _url->setFile(default_source);
   _url->setFocus();
+
+  initUpdateBox();  
+  connect(_updateBox, SIGNAL(activated(int)), this, SLOT(updateTypeActivated(int)));
 }
 
 
@@ -53,6 +56,42 @@
 }
 
 
+void DataWizardPageDataSource::initUpdateBox()
+{
+  _updateBox->clear();
+
+  if (_dataSource) {
+    _updateBox->addItem("Time interval");
+    _updateBox->addItem("Change detection");
+    _updateBox->addItem("Don't update");
+    switch (_dataSource->updateType()) {
+      case DataSource::Timer: _updateBox->setCurrentIndex(0); break;
+      case DataSource::File:  _updateBox->setCurrentIndex(1); break;
+      case DataSource::None:  _updateBox->setCurrentIndex(2); break;
+      default: break;
+    };
+
+  } else {
+    _updateBox->addItem("Unknown");
+    _updateBox->setCurrentIndex(0);
+  }
+}
+
+void DataWizardPageDataSource::updateTypeActivated(int idx)
+{
+  initUpdateBox();
+  if (!_dataSource) {    
+    return;
+  }
+  switch (idx) {
+    case 0: _dataSource->setUpdateType(DataSource::Timer); break;
+    case 1: _dataSource->setUpdateType(DataSource::File);  break;
+    case 2: _dataSource->setUpdateType(DataSource::None);  break;
+    default: break;
+  };
+}
+
+
 bool DataWizardPageDataSource::isComplete() const {
   return _pageValid;
 }
@@ -94,6 +133,8 @@
     _store->cleanUpDataSourceList();
   }
 
+  initUpdateBox();
+
   emit completeChanged();
   emit dataSourceChanged();
 }
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.h #1170061:1170062
@@ -49,6 +49,7 @@
     void sourceChanged(const QString&);
     void configureSource();
     void sourceValid(QString filename, int requestID);
+    void updateTypeActivated(int);
 
   Q_SIGNALS:
     void dataSourceChanged();
@@ -58,6 +59,7 @@
     ObjectStore *_store;
     DataSourcePtr _dataSource;
     int _requestID;
+    void initUpdateBox();
 };
 
 class DataWizardPageVectors : public QWizardPage, Ui::DataWizardPageVectors
--- branches/work/kst/portto4/kst/src/libkstapp/datawizardpagedatasource.ui #1170061:1170062
@@ -16,7 +16,7 @@
     <height>350</height>
    </size>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
+  <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
     <widget class="QLabel" name="textLabel2">
      <property name="sizePolicy">
@@ -26,7 +26,11 @@
       </sizepolicy>
      </property>
      <property name="text">
-      <string>&lt;p&gt;Please select a &lt;i&gt;data source&lt;/i&gt; to work from.  This will typically be your file containing data points or vectors.&lt;/p&gt;</string>
+      <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Please select a &lt;/span&gt;&lt;span style=&quot; font-size:8pt; font-style:italic;&quot;&gt;data source&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; to work from. This will typically be your file containing data points or vectors.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
      </property>
      <property name="alignment">
       <set>Qt::AlignTop</set>
@@ -37,6 +41,8 @@
     </widget>
    </item>
    <item>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
     <widget class="Kst::DataSourceSelector" name="_url" native="true">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -102,6 +108,51 @@
     </layout>
    </item>
    <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
+       <item>
+        <spacer name="horizontalSpacer_2">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QLabel" name="_fileType_2">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>10</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text">
+          <string>Update type. Use 'Time interval' for non local data.</string>
+         </property>
+         <property name="wordWrap">
+          <bool>false</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QComboBox" name="_updateBox">
+         <property name="minimumSize">
+          <size>
+           <width>120</width>
+           <height>0</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>


More information about the Kst mailing list