[Kst] branches/work/kst/portto4/kst
Mike Fenton
mike at staikos.net
Fri Nov 9 20:25:01 CET 2007
SVN commit 734743 by fenton:
Add test for DataMatrix and fix for matrix creation.
Update MatrixSelector and MatrixEditorDialog to populate correctly.
Update MatrixDialog to only include Matrices from the DataSource.
M +7 -7 src/datasources/ascii/ascii.cpp
M +2 -2 src/libkstapp/matrixdialog.cpp
M +1 -0 src/libkstapp/matrixeditordialog.cpp
M +1 -0 src/widgets/matrixselector.cpp
M +4 -0 tests/main.cpp
A tests/testdatamatrix.cpp [License: GPL (v2+)]
A tests/testdatamatrix.h [License: GPL (v2+)]
M +2 -0 tests/tests.pro
--- branches/work/kst/portto4/kst/src/datasources/ascii/ascii.cpp #734742:734743
@@ -110,9 +110,8 @@
}
s.writeAttribute("headerstart", QString::number(_dataLine));
- if (_readFields) {
- s.writeAttribute("fields", QString::number(_fieldsLine));
- }
+ s.writeAttribute("fields", QString::number(_fieldsLine));
+ s.writeAttribute("readfields", QVariant(_readFields).toString());
s.writeEndElement();
}
@@ -126,6 +125,7 @@
_dataLine = properties.value("headerstart").toString().toInt();
_fieldsLine = properties.value("fields").toString().toInt();
+ _readFields = QVariant(properties.value("readfields").toString()).toBool();
}
void load(const QDomElement& e) {
@@ -378,14 +378,14 @@
bool AsciiSource::matrixDimensions(const QString& matrix, int* xDim, int* yDim) {
-
+
if (!isValidMatrix(matrix)) {
return false;
}
// total frames in the matrix
int totalFrames = frameCount(matrix);
-
+
// y dimension is in the matrix name
*yDim = matrix.section(',', 1,1).toInt();
*xDim = totalFrames / (*yDim); // the last row doesn't count
@@ -738,7 +738,7 @@
QStringList AsciiSource::matrixList() const {
if (_matrixList.isEmpty()) {
- // for ascii data sources, matrix fields start with [MATRIXNAME,Y,x,y,w,l]
+ // for ascii data sources, matrix fields start with [MATRIXNAME,Y,x,y,w,l]
// where Y = size of y dimension
// x = x coordinate of minimum
// y = y coordinate of minimum
@@ -746,7 +746,7 @@
// l = y step size
_matrixList = fieldList().filter(QRegExp("^\\[\\w*,\\S*,\\S*,\\S*,\\S*,\\S*\\]$"));
}
-
+
return _matrixList;
}
--- branches/work/kst/portto4/kst/src/libkstapp/matrixdialog.cpp #734742:734743
@@ -377,8 +377,8 @@
_dataSource->readLock();
- _field->addItems(_dataSource->fieldList());
- _field->setEditable(!_dataSource->fieldListIsComplete());
+ _field->addItems(_dataSource->matrixList());
+ _field->setEditable(!_dataSource->fieldListIsComplete() && !_dataSource->matrixList().empty());
_configure->setEnabled(_dataSource->hasConfigWidget());
_dataSource->unlock();
--- branches/work/kst/portto4/kst/src/libkstapp/matrixeditordialog.cpp #734742:734743
@@ -24,6 +24,7 @@
setupUi(this);
connect(matrixSelector, SIGNAL(selectionChanged()), this, SLOT(matrixSelected()));
+ matrixSelector->setObjectStore(doc->objectStore());
}
--- branches/work/kst/portto4/kst/src/widgets/matrixselector.cpp #734742:734743
@@ -46,6 +46,7 @@
void MatrixSelector::setObjectStore(ObjectStore *store) {
_store = store;
+ fillMatrices();;
}
--- branches/work/kst/portto4/kst/tests/main.cpp #734742:734743
@@ -17,6 +17,7 @@
#include "testvector.h"
#include "testscalar.h"
#include "testmatrix.h"
+#include "testdatamatrix.h"
#include "testcsd.h"
#include "testpsd.h"
#include "testhistogram.h"
@@ -52,6 +53,9 @@
TestEditableMatrix test8;
QTest::qExec(&test8, argc, argv);
+ TestDataMatrix dataMatrixTest;
+ QTest::qExec(&dataMatrixTest, argc, argv);
+
TestLabelParser test9;
QTest::qExec(&test9, argc, argv);
--- branches/work/kst/portto4/kst/tests/tests.pro #734742:734743
@@ -24,6 +24,7 @@
main.cpp \
testeditablematrix.cpp \
testcsd.cpp \
+ testdatamatrix.cpp \
testdatasource.cpp \
testeqparser.cpp \
testhistogram.cpp \
@@ -37,6 +38,7 @@
HEADERS += \
testeditablematrix.h \
testcsd.h \
+ testdatamatrix.h \
testdatasource.h \
testhistogram.h \
testeqparser.h \
More information about the Kst
mailing list