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

Peter Kümmel syntheticpp at gmx.net
Tue Aug 31 20:07:07 CEST 2010


SVN commit 1170371 by kuemmel:

Make changing update type also possible after using the wizard.

BUG: 248104

 M  +4 -2      changedatasampledialog.cpp  
 M  +2 -1      datawizard.cpp  
 M  +37 -0     vectordialog.cpp  
 M  +2 -0      vectordialog.h  
 M  +144 -76   vectortab.ui  


--- branches/work/kst/portto4/kst/src/libkstapp/changedatasampledialog.cpp #1170370:1170371
@@ -239,8 +239,10 @@
   for (int i = 0; i < selectedItems.size(); ++i) {
     if (DataVectorPtr vector = kst_cast<DataVector>(_store->retrieveObject(selectedItems.at(i)->text()))) {
       vector->writeLock();
-      vector->changeFrames( (_dataRange->countFromEnd() ? -1 : int(_dataRange->start())),
-                            (_dataRange->readToEnd() ? -1 : int(_dataRange->range())),
+      int from = (_dataRange->countFromEnd() ? -1 : (int)_dataRange->start());
+      int range = (_dataRange->readToEnd() ? -1 : (int)_dataRange->range());
+      vector->changeFrames( from, 
+                            range,
                             _dataRange->skip(),
                             _dataRange->doSkip(),
                             _dataRange->doFilter());
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #1170370:1170371
@@ -69,7 +69,8 @@
       case DataSource::None:  _updateBox->setCurrentIndex(2); break;
       default: break;
     };
-  } else {    _updateBox->setEnabled(false);
+  } else {
+    _updateBox->setEnabled(false);
   }
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #1170370:1170371
@@ -54,13 +54,48 @@
   _dataRange->groupBox2->layout()->setContentsMargins(0,top_margin,0,0); 
 
   _connect->setVisible(false);
+
+  _updateBox->addItem("Time interval");
+  _updateBox->addItem("Change detection");
+  _updateBox->addItem("Don't update");
+  updateUpdateBox();
+  connect(_updateBox, SIGNAL(activated(int)), this, SLOT(updateTypeActivated(int)));
 }
 
 
 VectorTab::~VectorTab() {
 }
 
+void VectorTab::updateUpdateBox()
+{
+  if (_dataSource) {
+    _updateBox->setEnabled(true);
+    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->setEnabled(false);
+  }
+}
 
+void VectorTab::updateTypeActivated(int idx)
+{
+  if (!_dataSource) {
+    _updateBox->setEnabled(false);
+    return;
+  }
+  switch (idx) {
+    _updateBox->setEnabled(true);
+    case 0: _dataSource->setUpdateType(DataSource::Timer); break;
+    case 1: _dataSource->setUpdateType(DataSource::File);  break;
+    case 2: _dataSource->setUpdateType(DataSource::None);  break;
+    default: break;
+  };
+}
+
 DataSourcePtr VectorTab::dataSource() const {
   return _dataSource;
 }
@@ -226,6 +261,8 @@
   _field->setEditable(!_dataSource->vector().isListComplete());
   _configure->setEnabled(_dataSource->hasConfigWidget());
 
+  updateUpdateBox();
+
   _dataSource->unlock();
   emit sourceChanged();
 }
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.h #1170370:1170371
@@ -81,6 +81,7 @@
     void fileNameChanged(const QString &file);
     void showConfigWidget();
     void sourceValid(QString filename, int requestID);
+    void updateTypeActivated(int);
 
   private:
     VectorMode _mode;
@@ -88,6 +89,7 @@
     DataSourcePtr _dataSource;
     QString _initField;
     int _requestID;
+    void updateUpdateBox();
 };
 
 class VectorDialog : public DataDialog {
--- branches/work/kst/portto4/kst/src/libkstapp/vectortab.ui #1170370:1170371
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0" >
  <class>VectorTab</class>
  <widget class="QWidget" name="VectorTab" >
@@ -6,14 +7,14 @@
     <x>0</x>
     <y>0</y>
     <width>745</width>
-    <height>420</height>
+    <height>552</height>
    </rect>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout" >
+  <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
     <widget class="QGroupBox" name="_generatedVectorGroup" >
      <property name="sizePolicy" >
-      <sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
+      <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
@@ -27,11 +28,17 @@
      <property name="checked" >
       <bool>false</bool>
      </property>
-     <layout class="QGridLayout" >
-      <item row="0" column="0" >
        <widget class="QLabel" name="label_2" >
+      <property name="geometry">
+       <rect>
+        <x>10</x>
+        <y>26</y>
+        <width>95</width>
+        <height>16</height>
+       </rect>
+      </property>
         <property name="sizePolicy" >
-         <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+       <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -46,36 +53,59 @@
          <cstring>_numberOfSamples</cstring>
         </property>
        </widget>
-      </item>
-      <item row="1" column="0" colspan="2" >
-       <layout class="QHBoxLayout" >
-        <property name="spacing" >
-         <number>6</number>
+     <widget class="QSpinBox" name="_numberOfSamples">
+      <property name="geometry">
+       <rect>
+        <x>111</x>
+        <y>23</y>
+        <width>81</width>
+        <height>20</height>
+       </rect>
         </property>
-        <property name="margin" >
-         <number>0</number>
-        </property>
-        <item>
-         <widget class="QLabel" name="label" >
           <property name="sizePolicy" >
-           <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+       <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
             <horstretch>0</horstretch>
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
-          <property name="text" >
-           <string>Fro&amp;m:</string>
+      <property name="whatsThis">
+       <string>The number of samples for the new independent variable.</string>
           </property>
-          <property name="wordWrap" >
-           <bool>false</bool>
+      <property name="maximum">
+       <number>1000000000</number>
           </property>
-          <property name="buddy" >
-           <cstring>_from</cstring>
+      <property name="singleStep">
+       <number>1000</number>
           </property>
+      <property name="value">
+       <number>1000</number>
+      </property>
          </widget>
-        </item>
-        <item>
+     <widget class="QLineEdit" name="_to">
+      <property name="geometry">
+       <rect>
+        <x>205</x>
+        <y>50</y>
+        <width>133</width>
+        <height>20</height>
+       </rect>
+      </property>
+      <property name="whatsThis">
+       <string>The maximum value of the independent variable.</string>
+      </property>
+      <property name="text">
+       <string>10.0</string>
+      </property>
+     </widget>
          <widget class="QLineEdit" name="_from" >
+      <property name="geometry">
+       <rect>
+        <x>45</x>
+        <y>50</y>
+        <width>133</width>
+        <height>20</height>
+       </rect>
+      </property>
           <property name="whatsThis" >
            <string>The minimum value of the independent variable.</string>
           </property>
@@ -83,11 +113,17 @@
            <string>-10.0</string>
           </property>
          </widget>
-        </item>
-        <item>
          <widget class="QLabel" name="label_3" >
+      <property name="geometry">
+       <rect>
+        <x>184</x>
+        <y>53</y>
+        <width>16</width>
+        <height>16</height>
+       </rect>
+      </property>
           <property name="sizePolicy" >
-           <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+       <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
             <horstretch>0</horstretch>
             <verstretch>0</verstretch>
            </sizepolicy>
@@ -102,42 +138,31 @@
            <cstring>_to</cstring>
           </property>
          </widget>
-        </item>
-        <item>
-         <widget class="QLineEdit" name="_to" >
-          <property name="whatsThis" >
-           <string>The maximum value of the independent variable.</string>
+     <widget class="QLabel" name="label">
+      <property name="geometry">
+       <rect>
+        <x>11</x>
+        <y>53</y>
+        <width>28</width>
+        <height>16</height>
+       </rect>
           </property>
-          <property name="text" >
-           <string>10.0</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item row="0" column="1" >
-       <widget class="QSpinBox" name="_numberOfSamples" >
         <property name="sizePolicy" >
-         <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+       <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
-        <property name="whatsThis" >
-         <string>The number of samples for the new independent variable.</string>
+      <property name="text">
+       <string>Fro&amp;m:</string>
         </property>
-        <property name="maximum" >
-         <number>1000000000</number>
+      <property name="wordWrap">
+       <bool>false</bool>
         </property>
-        <property name="singleStep" >
-         <number>1000</number>
+      <property name="buddy">
+       <cstring>_from</cstring>
         </property>
-        <property name="value" >
-         <number>1000</number>
-        </property>
        </widget>
-      </item>
-     </layout>
     </widget>
    </item>
    <item>
@@ -148,8 +173,11 @@
      <property name="checkable" >
       <bool>true</bool>
      </property>
-     <layout class="QGridLayout" name="gridLayout_2" >
-      <item row="0" column="0" >
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="Kst::DataSourceSelector" name="_fileName" native="true"/>
+      </item>
+      <item>
        <widget class="QLabel" name="label_4" >
         <property name="text" >
          <string>File name:</string>
@@ -162,13 +190,17 @@
         </property>
        </widget>
       </item>
-      <item row="0" column="1" >
-       <widget class="Kst::DataSourceSelector" native="1" name="_fileName" />
+      <item>
+       <widget class="Kst::ComboBox" name="_field">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+       </widget>
       </item>
-      <item row="1" column="0" >
+      <item>
        <widget class="QLabel" name="label_5" >
         <property name="sizePolicy" >
-         <sizepolicy vsizetype="Preferred" hsizetype="Fixed" >
+         <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -187,14 +219,7 @@
         </property>
        </widget>
       </item>
-      <item row="1" column="1" >
-       <widget class="Kst::ComboBox" name="_field" >
-        <property name="enabled" >
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0" colspan="2" >
+      <item>
        <layout class="QHBoxLayout" >
         <property name="margin" >
          <number>0</number>
@@ -237,10 +262,53 @@
         </item>
        </layout>
       </item>
-      <item row="3" column="0" colspan="2" >
-       <widget class="Kst::DataRange" native="1" name="_dataRange" >
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_3">
+        <item>
+         <spacer name="horizontalSpacer_3">
+          <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_3">
         <property name="sizePolicy" >
-         <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
+           <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>0</width>
+            <height>0</height>
+           </size>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="Kst::DataRange" name="_dataRange" native="true">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -255,16 +323,16 @@
  <layoutdefault spacing="6" margin="11" />
  <customwidgets>
   <customwidget>
+   <class>Kst::ComboBox</class>
+   <extends>QComboBox</extends>
+   <header>combobox.h</header>
+  </customwidget>
+  <customwidget>
    <class>Kst::DataSourceSelector</class>
    <extends>QWidget</extends>
    <header>datasourceselector.h</header>
   </customwidget>
   <customwidget>
-   <class>Kst::ComboBox</class>
-   <extends>QComboBox</extends>
-   <header>combobox.h</header>
-  </customwidget>
-  <customwidget>
    <class>Kst::DataRange</class>
    <extends>QWidget</extends>
    <header>datarange.h</header>


More information about the Kst mailing list