[Kst] branches/work/kst/portto4/kst/src
Adam Treat
treat at kde.org
Tue Sep 25 17:43:20 CEST 2007
SVN commit 716917 by treat:
* Reimplement Kst::DataRange so we can begin
reading vectors in from disk.
M +16 -4 libkstapp/vectordialog.cpp
M +4 -4 libkstapp/vectordialog.h
M +6 -6 libkstapp/vectortab.ui
M +120 -0 widgets/datarange.cpp
M +37 -0 widgets/datarange.h
M +12 -0 widgets/datarange.ui
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #716916:716917
@@ -15,6 +15,8 @@
#include "kstsvector.h"
+#include <limits.h>
+
namespace Kst {
VectorTab::VectorTab(QWidget *parent)
@@ -31,16 +33,26 @@
}
-int VectorTab::from() const {
- return _from->value();
+qreal VectorTab::from() const {
+ return _from->text().toDouble();
}
-int VectorTab::to() const {
- return _to->value();
+void VectorTab::setFrom(qreal from) {
+ _from->setText(QString::number(from));
}
+qreal VectorTab::to() const {
+ return _to->text().toDouble();
+}
+
+
+void VectorTab::setTo(qreal to) {
+ _to->setText(QString::number(to));
+}
+
+
int VectorTab::numberOfSamples() const {
return _numberOfSamples->value();
}
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.h #716916:716917
@@ -33,11 +33,11 @@
void setMode(Mode mode) { _mode = mode; }
//Slave vector mode methods...
- int from() const;
- void setFrom(int from);
+ qreal from() const;
+ void setFrom(qreal from);
- int to() const;
- void setTo(int to);
+ qreal to() const;
+ void setTo(qreal to);
int numberOfSamples() const;
void setNumberOfSamples(int numberOfSamples);
--- branches/work/kst/portto4/kst/src/libkstapp/vectortab.ui #716916:716917
@@ -271,12 +271,12 @@
</widget>
</item>
<item>
- <widget class="QSpinBox" name="_to" >
+ <widget class="QLineEdit" name="_to" >
<property name="whatsThis" >
<string>The minimum value of the independent variable.</string>
</property>
- <property name="value" >
- <number>-10.0</number>
+ <property name="text" >
+ <string>-10.0</string>
</property>
</widget>
</item>
@@ -300,12 +300,12 @@
</widget>
</item>
<item>
- <widget class="QSpinBox" name="_from" >
+ <widget class="QLineEdit" name="_from" >
<property name="whatsThis" >
<string>The maximum value of the independent variable.</string>
</property>
- <property name="value" >
- <number>10.0</number>
+ <property name="text" >
+ <string>10.0</string>
</property>
</widget>
</item>
--- branches/work/kst/portto4/kst/src/widgets/datarange.cpp #716916:716917
@@ -16,12 +16,132 @@
DataRange::DataRange(QWidget *parent)
: QWidget(parent) {
setupUi(this);
+
+ connect(_countFromEnd, SIGNAL(toggled(bool)), this, SLOT(countFromEndChanged()));
+ connect(_readToEnd, SIGNAL(toggled(bool)), this, SLOT(readToEndChanged()));
+ connect(_doSkip, SIGNAL(toggled(bool)), this, SLOT(doSkipChanged()));
}
DataRange::~DataRange() {
}
+
+qreal DataRange::start() const {
+ return _start->text().toDouble();
}
+
+void DataRange::setStart(qreal start) {
+ _start->setText(QString::number(start));
+}
+
+
+QString DataRange::startUnits() const {
+ return _startUnits->currentText();
+}
+
+
+void DataRange::setStartUnits(const QString &startUnits) const {
+ _startUnits->setItemText(_startUnits->currentIndex(), startUnits);
+}
+
+
+qreal DataRange::range() const {
+ return _range->text().toDouble();
+}
+
+
+void DataRange::setRange(qreal range) {
+ _range->setText(QString::number(range));
+}
+
+
+QString DataRange::rangeUnits() const {
+ return _rangeUnits->currentText();
+}
+
+
+void DataRange::setRangeUnits(const QString &rangeUnits) const {
+ _rangeUnits->setItemText(_startUnits->currentIndex(), rangeUnits);
+}
+
+
+int DataRange::skip() const {
+ return _skip->value();
+}
+
+
+void DataRange::setSkip(int skip) {
+ _skip->setValue(skip);
+}
+
+
+bool DataRange::countFromEnd() const {
+ return _countFromEnd->isChecked();
+}
+
+
+void DataRange::setCountFromEnd(bool countFromEnd) {
+ _countFromEnd->setChecked(countFromEnd);
+}
+
+
+bool DataRange::readToEnd() const {
+ return _readToEnd->isChecked();
+}
+
+
+void DataRange::setReadToEnd(bool readToEnd) {
+ _readToEnd->setChecked(readToEnd);
+}
+
+
+bool DataRange::doSkip() const {
+ return _doSkip->isChecked();
+}
+
+
+void DataRange::setDoSkip(bool doSkip) {
+ _doSkip->setChecked(doSkip);
+}
+
+
+bool DataRange::doFilter() const {
+ return _doFilter->isChecked();
+}
+
+
+void DataRange::setDoFilter(bool doFilter) {
+ _doFilter->setChecked(doFilter);
+}
+
+
+void DataRange::countFromEndChanged() {
+ if (countFromEnd()) {
+ setReadToEnd(false);
+ }
+
+ _range->setEnabled(!countFromEnd());
+ _rangeUnits->setEnabled(!countFromEnd());
+}
+
+
+void DataRange::readToEndChanged() {
+ if (readToEnd()) {
+ setCountFromEnd(false);
+ }
+
+ _start->setEnabled(!readToEnd());
+ _startUnits->setEnabled(!readToEnd());
+}
+
+
+void DataRange::doSkipChanged() {
+ _skip->setEnabled(doSkip());
+ _doFilter->setEnabled(doSkip());
+}
+
+}
+
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/widgets/datarange.h #716916:716917
@@ -19,11 +19,48 @@
namespace Kst {
+//FIXME Need to add time related methods/functionality
+
class KST_EXPORT DataRange : public QWidget, public Ui::DataRange {
Q_OBJECT
public:
DataRange(QWidget *parent = 0);
virtual ~DataRange();
+
+ qreal start() const;
+ void setStart(qreal start);
+
+ //FIXME Probably should be an enum...
+ QString startUnits() const;
+ void setStartUnits(const QString &startUnits) const;
+
+ qreal range() const;
+ void setRange(qreal range);
+
+ //FIXME Probably should be an enum...
+ QString rangeUnits() const;
+ void setRangeUnits(const QString &rangeUnits) const;
+
+ int skip() const;
+ void setSkip(int skip);
+
+ bool countFromEnd() const;
+ void setCountFromEnd(bool countFromEnd);
+
+ bool readToEnd() const;
+ void setReadToEnd(bool readToEnd);
+
+ bool doSkip() const;
+ void setDoSkip(bool doSkip);
+
+ bool doFilter() const;
+ void setDoFilter(bool doFilter);
+
+ private Q_SLOTS:
+ void countFromEndChanged();
+ void readToEndChanged();
+ void doSkipChanged();
+
};
}
--- branches/work/kst/portto4/kst/src/widgets/datarange.ui #716916:716917
@@ -98,6 +98,9 @@
<property name="text" >
<string>&Read to end</string>
</property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item row="0" column="4" >
@@ -204,10 +207,16 @@
<property name="whatsThis" >
<string>The index of the first data read. For ASCII files, this is the data row number in the file. For frame based files, this is the first frame.</string>
</property>
+ <property name="text" >
+ <string>0</string>
+ </property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QLineEdit" name="_range" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
@@ -233,6 +242,9 @@
</item>
<item row="1" column="3" >
<widget class="QComboBox" name="_rangeUnits" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<item>
<property name="text" >
<string>frames</string>
More information about the Kst
mailing list