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

Barth Netterfield netterfield at astro.utoronto.ca
Wed Mar 9 04:14:33 CET 2011


SVN commit 1224218 by netterfield:

FEATURE:
Add a data source config dialog option to the change file dialog, to allow configuration options to
be set for the new data file.



 M  +15 -0     changefiledialog.cpp  
 M  +1 -0      changefiledialog.h  
 M  +59 -4     changefiledialog.ui  


--- branches/work/kst/portto4/kst/src/libkstapp/changefiledialog.cpp #1224217:1224218
@@ -13,6 +13,7 @@
 #include "changefiledialog.h"
 
 #include "datacollection.h"
+#include "datasourcedialog.h"
 #include "datavector.h"
 #include "datamatrix.h"
 #include "datascalar.h"
@@ -68,6 +69,8 @@
   connect(_buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(OKClicked()));
   connect(_buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
 
+  connect(_configure, SIGNAL(clicked()), this, SLOT(showConfigWidget()));
+
   _dataFile->setFile(QDir::currentPath());
   updateButtons();
 }
@@ -82,7 +85,15 @@
   QDialog::show();
 }
 
+void ChangeFileDialog::showConfigWidget() {
+  QPointer<DataSourceDialog> dialog = new DataSourceDialog(DataDialog::New, _dataSource, this);
+  if ( dialog->exec() == QDialog::Accepted ) {
+    fileNameChanged(_dataSource->fileName());
+  }
+  delete dialog;
+}
 
+
 void ChangeFileDialog::removeButtonClicked() {
   foreach (QListWidgetItem* item, _selectedFilePrimitiveList->selectedItems()) {
     _changeFilePrimitiveList->addItem(_selectedFilePrimitiveList->takeItem(_selectedFilePrimitiveList->row(item)));
@@ -125,13 +136,17 @@
     return;
   }
   _dataSource = DataSourcePluginManager::findOrLoadSource(_store, filename);
+  _fileType->setText(_dataSource->fileType());
   updateButtons();
+  _configure->setEnabled(_dataSource->hasConfigWidget());
+
 }
 
 
 void ChangeFileDialog::fileNameChanged(const QString &file) {
   _dataSource = 0;
   updateButtons();
+  _configure->setEnabled(false);
 
   _requestID += 1;
   ValidateDataSourceThread *validateDSThread = new ValidateDataSourceThread(file, _requestID);
--- branches/work/kst/portto4/kst/src/libkstapp/changefiledialog.h #1224217:1224218
@@ -48,6 +48,7 @@
 
     void availableDoubleClicked(QListWidgetItem * item);
     void selectedDoubleClicked(QListWidgetItem * item);
+    void showConfigWidget();
 
     void updateButtons();
     void OKClicked();
--- branches/work/kst/portto4/kst/src/libkstapp/changefiledialog.ui #1224217:1224218
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>580</width>
-    <height>450</height>
+    <width>603</width>
+    <height>452</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -180,6 +180,12 @@
         </property>
         <item row="0" column="0">
          <widget class="QLabel" name="textLabel1">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
           <property name="text">
            <string>&amp;File:</string>
           </property>
@@ -203,7 +209,7 @@
         </item>
        </layout>
       </item>
-      <item row="1" column="0">
+      <item row="2" column="0">
        <layout class="QGridLayout">
         <property name="margin">
          <number>0</number>
@@ -236,7 +242,7 @@
         </item>
        </layout>
       </item>
-      <item row="2" column="0">
+      <item row="3" column="0">
        <layout class="QGridLayout">
         <property name="margin">
          <number>0</number>
@@ -279,7 +285,56 @@
         </item>
        </layout>
       </item>
+      <item row="1" column="0">
+       <layout class="QHBoxLayout" name="horizontalLayout_4">
+        <item>
+         <spacer name="horizontalSpacer">
+          <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">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+            <horstretch>10</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>Unknown File Type</string>
+          </property>
+          <property name="wordWrap">
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="_configure">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>Con&amp;figure...</string>
+          </property>
+         </widget>
+        </item>
      </layout>
+      </item>
+     </layout>
     </widget>
    </item>
    <item>


More information about the Kst mailing list