[Kst] branches/work/kst/portto4/kst/src
Mike Fenton
mike at staikos.net
Fri Sep 12 19:56:32 CEST 2008
SVN commit 860332 by fenton:
Add DataSourceSelector Dialog.
Modifications to FileRequester.
Remove Directory selector option from VectorTab.
M +5 -36 libkstapp/vectordialog.cpp
M +0 -4 libkstapp/vectordialog.h
M +68 -48 libkstapp/vectortab.ui
A widgets/datasourceselectordialog.cpp [License: GPL (v2+)]
A widgets/datasourceselectordialog.h [License: GPL (v2+)]
M +9 -6 widgets/filerequester.cpp
M +2 -0 widgets/widgets.pro
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #860331:860332
@@ -36,22 +36,14 @@
connect(_readFromSource, SIGNAL(toggled(bool)), this, SLOT(readFromSourceChanged()));
connect(_fileName, SIGNAL(changed(const QString &)), this, SLOT(fileNameChanged(const QString &)));
- connect(_directoryName, SIGNAL(changed(const QString &)), this, SLOT(fileNameChanged(const QString &)));
connect(_configure, SIGNAL(clicked()), this, SLOT(showConfigWidget()));
- connect(_useDirectory, SIGNAL(stateChanged(int)), this, SLOT(directorySourceChanged()));
connect(_dataRange, SIGNAL(modified()), this, SIGNAL(modified()));
connect(_numberOfSamples, SIGNAL(valueChanged(int)), this, SIGNAL(modified()));
connect(_from, SIGNAL(textChanged(const QString&)), this, SIGNAL(modified()));
connect(_to, SIGNAL(textChanged(const QString&)), this, SIGNAL(modified()));
_fileName->setFile(QDir::currentPath());
- _directoryName->setFile(QDir::currentPath());
- _directoryName->setMode(QFileDialog::DirectoryOnly);
- //Disable alternate Directory selector.
- _useDirectory->setVisible(true);
- _directoryName->setVisible(true);
-
_connect->setVisible(false);
}
@@ -84,13 +76,7 @@
void VectorTab::setFile(const QString &file) {
QFileInfo info(file);
- if (info.isDir()) {
- _directoryName->setFile(file);
- _useDirectory->setChecked(true);
- } else {
- _fileName->setFile(file);
- _useDirectory->setChecked(false);
- }
+ _fileName->setFile(file);
}
@@ -175,26 +161,18 @@
}
-void VectorTab::directorySourceChanged() {
- _fileName->setEnabled(!_useDirectory->isChecked());
- _directoryName->setEnabled(_useDirectory->isChecked());
- updateDataSource();
-}
-
-
void VectorTab::hideGeneratedOptions() {
- _readFromSource->setVisible(false);
- _generateX->setVisible(false);
+ _sourceGroup->setVisible(false);
_generatedVectorGroup->setVisible(false);
+ setMaximumHeight(300);
}
void VectorTab::hideDataOptions() {
- //_sourceGroup->setVisible(false);
- _readFromSource->setVisible(false);
- _generateX->setVisible(false);
+ _sourceGroup->setVisible(false);
_dataVectorGroup->setVisible(false);
_dataRange->setVisible(false);
+ setMaximumHeight(150);
}
@@ -211,15 +189,6 @@
}
-void VectorTab::updateDataSource() {
- if (_useDirectory->isChecked()) {
- fileNameChanged(_directoryName->file());
- } else {
- fileNameChanged(_fileName->file());
- }
-}
-
-
void VectorTab::fileNameChanged(const QString &file) {
QFileInfo info(file);
if (!info.exists())
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.h #860331:860332
@@ -76,14 +76,10 @@
private Q_SLOTS:
void readFromSourceChanged();
- void directorySourceChanged();
void fileNameChanged(const QString &file);
void showConfigWidget();
private:
- void updateDataSource();
-
- private:
VectorMode _mode;
ObjectStore *_store;
DataSourcePtr _dataSource;
--- branches/work/kst/portto4/kst/src/libkstapp/vectortab.ui #860331:860332
@@ -5,40 +5,74 @@
<rect>
<x>0</x>
<y>0</y>
- <width>694</width>
- <height>434</height>
+ <width>599</width>
+ <height>441</height>
</rect>
</property>
- <layout class="QGridLayout" name="gridLayout" >
+ <layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" >
- <widget class="QRadioButton" name="_readFromSource" >
- <property name="text" >
- <string>Read from data source</string>
+ <widget class="QGroupBox" name="_sourceGroup" >
+ <property name="title" >
+ <string>Source</string>
</property>
- <property name="checked" >
- <bool>true</bool>
- </property>
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QRadioButton" name="_readFromSource" >
+ <property name="text" >
+ <string>Read from data source</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="_generateX" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="whatsThis" >
+ <string>Generate a new vector with the properties given here as the independent variable.</string>
+ </property>
+ <property name="text" >
+ <string>&Generate</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QRadioButton" name="_generateX" >
- <property name="whatsThis" >
- <string>Generate a new vector with the properties given here as the independent variable.</string>
+ <item row="1" column="0" >
+ <widget class="QGroupBox" name="_dataVectorGroup" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="text" >
- <string>&Generate</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2" >
- <widget class="QGroupBox" name="_dataVectorGroup" >
<property name="title" >
<string>Data Vector Parameters</string>
</property>
- <layout class="QGridLayout" >
- <property name="topMargin" >
- <number>0</number>
- </property>
+ <layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
@@ -56,23 +90,6 @@
<widget class="Kst::FileRequester" native="1" name="_fileName" />
</item>
<item row="1" column="0" >
- <widget class="QCheckBox" name="_useDirectory" >
- <property name="layoutDirection" >
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text" >
- <string>Use Directory</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="Kst::FileRequester" native="1" name="_directoryName" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Field or column:</string>
@@ -85,14 +102,14 @@
</property>
</widget>
</item>
- <item row="2" column="1" >
+ <item row="1" column="1" >
<widget class="Kst::ComboBox" name="_field" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item>
- <item row="3" column="0" colspan="2" >
+ <item row="2" column="0" colspan="2" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
@@ -138,7 +155,7 @@
</layout>
</widget>
</item>
- <item row="2" column="0" colspan="2" >
+ <item row="2" column="0" >
<widget class="Kst::DataRange" native="1" name="_dataRange" >
<property name="sizePolicy" >
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
@@ -148,18 +165,21 @@
</property>
</widget>
</item>
- <item row="3" column="0" colspan="2" >
+ <item row="3" column="0" >
<widget class="QGroupBox" name="_generatedVectorGroup" >
<property name="enabled" >
<bool>false</bool>
</property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="title" >
<string>Vector values</string>
</property>
<layout class="QGridLayout" >
- <property name="topMargin" >
- <number>0</number>
- </property>
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="sizePolicy" >
--- branches/work/kst/portto4/kst/src/widgets/filerequester.cpp #860331:860332
@@ -11,6 +11,8 @@
#include "filerequester.h"
+#include "datasourceselectordialog.h"
+
#include <QStyle>
#include <QLineEdit>
#include <QToolButton>
@@ -55,7 +57,7 @@
_fileButton->setFixedSize(size + 8, size + 8);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
- connect (_fileEdit, SIGNAL(textEdited(const QString &)), this, SLOT(setFile(const QString &)));
+ connect (_fileEdit, SIGNAL(textChanged(const QString &)), this, SLOT(setFile(const QString &)));
connect (_fileButton, SIGNAL(clicked()), this, SLOT(chooseFile()));
QDirModel *dirModel = new QDirModel(this);
@@ -85,11 +87,12 @@
void FileRequester::chooseFile() {
QString file;
- if (_mode == QFileDialog::ExistingFile) {
- file = QFileDialog::getOpenFileName(this, QString(), _file);
- } else {
- file = QFileDialog::getExistingDirectory(this, QString(), _file);
- }
+
+ DataSourceSelectorDialog dialog(_file);
+ dialog.exec();
+
+ file = dialog.selectedDataSource();
+
if (!file.isEmpty()) {
setFile(file);
}
--- branches/work/kst/portto4/kst/src/widgets/widgets.pro #860331:860332
@@ -30,6 +30,7 @@
curveplacement.cpp \
curveselector.cpp \
datarange.cpp \
+ datasourceselectordialog.cpp \
dialogdefaults.cpp \
fftoptions.cpp \
filerequester.cpp \
@@ -49,6 +50,7 @@
curveplacement.h \
curveselector.h \
datarange.h \
+ datasourceselectordialog.h \
dialogdefaults.h \
fftoptions.h \
filerequester.h \
More information about the Kst
mailing list