[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Aug 23 16:35:01 UTC 2011
SVN commit 1249079 by netterfield:
CCBUG: 277740
Fix crash cases for a number of dialogs related to invalid input.
However, I can not confirm 277740, though I this may have fixed it.
M +2 -1 libkstapp/csddialog.h
M +17 -1 libkstapp/curvedialog.cpp
M +3 -1 libkstapp/curvedialog.h
M +3 -2 libkstapp/datadialog.cpp
M +1 -0 libkstapp/datadialog.h
M +7 -1 libkstapp/equationdialog.cpp
M +2 -0 libkstapp/equationdialog.h
M +6 -1 libkstapp/histogramdialog.cpp
M +3 -0 libkstapp/histogramdialog.h
M +2 -0 libkstapp/imagedialog.h
M +7 -1 libkstapp/legenditem.cpp
M +7 -1 libkstapp/powerspectrumdialog.cpp
M +2 -0 libkstapp/powerspectrumdialog.h
M +9 -1 libkstapp/viewitem.cpp
M +4 -0 widgets/vectorselector.cpp
M +1 -0 widgets/vectorselector.h
--- branches/work/kst/portto4/kst/src/libkstapp/csddialog.h #1249078:1249079
@@ -64,8 +64,9 @@
void setVector(VectorPtr vector);
+ virtual bool dialogValid() const {return bool(_CSDTab->vector()) || (editMode() == EditMultiple);}
+
protected:
-// virtual QString tagString() const;
virtual ObjectPtr createNewDataObject();
virtual ObjectPtr editExistingDataObject() const;
--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.cpp #1249078:1249079
@@ -104,6 +104,11 @@
}
+bool CurveTab::xVectorSelected() const {
+ return _xVector->vectorSelected();
+}
+
+
VectorPtr CurveTab::yVector() const {
return _yVector->selectedVector();
}
@@ -114,6 +119,11 @@
}
+bool CurveTab::yVectorSelected() const {
+ return _yVector->vectorSelected();
+}
+
+
void CurveTab::setYVector(VectorPtr vector) {
_yVector->setSelectedVector(vector);
}
@@ -363,10 +373,16 @@
void CurveDialog::updateButtons() {
- _buttonBox->button(QDialogButtonBox::Ok)->setEnabled((_curveTab->xVector() && _curveTab->yVector()) || (editMode() == EditMultiple));
+ _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(dialogValid());
}
+bool CurveDialog::dialogValid() const {
+ bool valid = (_curveTab->xVectorSelected() && _curveTab->yVectorSelected()) || (editMode() == EditMultiple);
+ return (valid);
+}
+
+
ObjectPtr CurveDialog::createNewDataObject() {
Q_ASSERT(_document && _document->objectStore());
--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.h #1249078:1249079
@@ -33,10 +33,12 @@
VectorPtr xVector() const;
bool xVectorDirty() const;
void setXVector(VectorPtr vector);
+ bool xVectorSelected() const;
VectorPtr yVector() const;
bool yVectorDirty() const;
void setYVector(VectorPtr vector);
+ bool yVectorSelected() const;
VectorPtr xError() const;
bool xErrorDirty() const;
@@ -88,9 +90,9 @@
void setVector(VectorPtr vector);
protected:
-// virtual QString tagString() const;
virtual ObjectPtr createNewDataObject();
virtual ObjectPtr editExistingDataObject() const;
+ virtual bool dialogValid() const;
private Q_SLOTS:
void updateButtons();
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.cpp #1249078:1249079
@@ -187,8 +187,9 @@
void DataDialog::updateApplyButton() {
- _buttonBox->button(QDialogButtonBox::Apply)->setEnabled(_modified);
- _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(_modified);
+ bool valid = dialogValid();
+ _buttonBox->button(QDialogButtonBox::Apply)->setEnabled(_modified && valid);
+ _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(_modified && valid);
}
void DataDialog::editMultiple(const QList<ObjectPtr> &objects) {
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.h #1249078:1249079
@@ -59,6 +59,7 @@
EditMultipleWidget *_editMultipleWidget;
QString _dataObjectName;
+ virtual bool dialogValid() const {return true;}
public Q_SLOTS:
void slotEditMultiple();
--- branches/work/kst/portto4/kst/src/libkstapp/equationdialog.cpp #1249078:1249079
@@ -262,10 +262,16 @@
void EquationDialog::updateButtons() {
- _buttonBox->button(QDialogButtonBox::Ok)->setEnabled((_equationTab->xVector() && !_equationTab->equation().isEmpty()) || (editMode() == EditMultiple));
+ _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(dialogValid());
}
+bool EquationDialog::dialogValid() const {
+ bool valid = (_equationTab->xVectorSelected()) || (editMode() == EditMultiple);
+ return (valid);
+}
+
+
void EquationDialog::configureTab(ObjectPtr object) {
if (!object) {
_equationTab->curveAppearance()->loadWidgetDefaults();
--- branches/work/kst/portto4/kst/src/libkstapp/equationdialog.h #1249078:1249079
@@ -33,6 +33,7 @@
VectorPtr xVector() const;
bool xVectorDirty() const;
void setXVector(VectorPtr vector);
+ bool xVectorSelected() const {return _xVectors->vectorSelected();}
QString equation() const;
bool equationDirty() const;
@@ -70,6 +71,7 @@
public:
explicit EquationDialog(ObjectPtr dataObject, QWidget *parent = 0);
virtual ~EquationDialog();
+ virtual bool dialogValid() const;
protected:
// virtual QString tagString() const;
--- branches/work/kst/portto4/kst/src/libkstapp/histogramdialog.cpp #1249078:1249079
@@ -335,10 +335,15 @@
void HistogramDialog::updateButtons() {
- _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(_histogramTab->vector() || (editMode() == EditMultiple));
+ _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(dialogValid());
}
+bool HistogramDialog::dialogValid() const {
+ return _histogramTab->vectorSelected() || (editMode() == EditMultiple);
+}
+
+
void HistogramDialog::setVector(VectorPtr vector) {
_histogramTab->setVector(vector);
}
--- branches/work/kst/portto4/kst/src/libkstapp/histogramdialog.h #1249078:1249079
@@ -45,6 +45,7 @@
VectorPtr vector() const;
bool vectorDirty() const;
void setVector(VectorPtr vector);
+ bool vectorSelected() const {return _vector->vectorSelected();}
double min() const;
bool minDirty() const;
@@ -95,6 +96,8 @@
void setVector(VectorPtr vector);
+ virtual bool dialogValid() const;
+
protected:
// virtual QString tagString() const;
virtual ObjectPtr createNewDataObject();
--- branches/work/kst/portto4/kst/src/libkstapp/imagedialog.h #1249078:1249079
@@ -112,6 +112,8 @@
void setMatrix(MatrixPtr matrix);
+ virtual bool dialogValid() const {return bool(_imageTab->matrix()) || (editMode() == EditMultiple);}
+
protected:
virtual ObjectPtr createNewDataObject();
virtual ObjectPtr editExistingDataObject() const;
--- branches/work/kst/portto4/kst/src/libkstapp/legenditem.cpp #1249078:1249079
@@ -80,6 +80,12 @@
legendItems = _relations;
}
+ int count = legendItems.count();
+ if (count <= 0) { // no legend or box if there are no legend items
+ return;
+ }
+
+
QList<DrawnLegendItem> legendPixmaps;
QSize legendSize(0, 0);
@@ -88,10 +94,10 @@
// generate string list of relation names
QStringList names;
- int count = legendItems.count();
bool allAuto = true;
bool sameX = true;
bool sameYUnits = true;
+
LabelInfo label_info = legendItems.at(0)->xLabelInfo();
QString yUnits = legendItems.at(0)->yLabelInfo().units;
--- branches/work/kst/portto4/kst/src/libkstapp/powerspectrumdialog.cpp #1249078:1249079
@@ -154,6 +154,7 @@
}
+
void PowerSpectrumDialog::configureTab(ObjectPtr object) {
if (!object) {
_powerSpectrumTab->FFTOptionsWidget()->loadWidgetDefaults();
@@ -186,10 +187,15 @@
void PowerSpectrumDialog::updateButtons() {
- _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(_powerSpectrumTab->vector() || (editMode() == EditMultiple));
+ _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(dialogValid());
}
+bool PowerSpectrumDialog::dialogValid() const {
+ bool valid = _powerSpectrumTab->vector() || (editMode() == EditMultiple);
+ return valid;
+}
+
ObjectPtr PowerSpectrumDialog::createNewDataObject() {
Q_ASSERT(_document && _document->objectStore());
PSDPtr powerspectrum = _document->objectStore()->createObject<PSD>();
--- branches/work/kst/portto4/kst/src/libkstapp/powerspectrumdialog.h #1249078:1249079
@@ -37,6 +37,7 @@
VectorPtr vector() const;
bool vectorDirty() const;
void setVector(const VectorPtr vector);
+ bool vectorSelected() const {return _vector->vectorSelected();}
CurveAppearance* curveAppearance() const;
CurvePlacement* curvePlacement() const;
@@ -59,6 +60,7 @@
virtual ~PowerSpectrumDialog();
void setVector(VectorPtr vector);
+ virtual bool dialogValid() const;
protected:
// virtual QString tagString() const;
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #1249078:1249079
@@ -149,6 +149,7 @@
xml.writeStartElement("position");
xml.writeAttribute("x", QVariant(pos().x()).toString());
xml.writeAttribute("y", QVariant(pos().y()).toString());
+ xml.writeAttribute("z", QVariant(zValue()).toString());
xml.writeEndElement();
xml.writeStartElement("rect");
xml.writeAttribute("x", QVariant(viewRect().x()).toString());
@@ -245,7 +246,7 @@
}
} else if (xml.name().toString() == "position") {
knownTag = true;
- double x = 0, y = 0;
+ double x = 0, y = 0, z = DRAWING_ZORDER;
av = attrs.value("x");
if (!av.isNull()) {
x = av.toString().toDouble();
@@ -255,6 +256,13 @@
y = av.toString().toDouble();
}
setPos(x, y);
+
+ av = attrs.value("z");
+ if (!av.isNull()) {
+ z = av.toString().toDouble();
+ }
+ setZValue(z);
+
} else if (xml.name().toString() == "brush") {
knownTag = true;
QBrush brush;
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.cpp #1249078:1249079
@@ -74,6 +74,10 @@
}
+bool VectorSelector::vectorSelected() const {
+ return (_vector->currentIndex()>=0);
+}
+
bool VectorSelector::selectedVectorDirty() const {
return _vector->currentIndex() != -1;
}
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.h #1249078:1249079
@@ -33,6 +33,7 @@
void setObjectStore(ObjectStore *store);
VectorPtr selectedVector() const;
+ bool vectorSelected() const;
bool selectedVectorDirty() const;
void setSelectedVector(VectorPtr selectedVector);
More information about the Kst
mailing list