[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Jul 1 06:00:08 CEST 2008
SVN commit 826599 by netterfield:
Numerous dialog and naming bug fixes, including:
-scalar combo refilling from equation dialog
-better combo to equation filling
-fix generated scalar naming
M +13 -1 libkst/scalar.cpp
M +2 -0 libkst/scalar.h
M +2 -1 libkstapp/datamanager.cpp
M +2 -1 libkstapp/dialoglaunchergui.cpp
M +1 -1 libkstapp/dialoglaunchergui.h
M +1 -0 libkstapp/equationdialog.cpp
M +8 -0 libkstapp/scalardialog.cpp
M +2 -0 libkstapp/scalardialog.h
M +2 -1 libkstmath/dialoglauncher.cpp
M +1 -1 libkstmath/dialoglauncher.h
M +1 -1 libkstmath/enodes.cpp
M +26 -4 widgets/scalarselector.cpp
M +2 -2 widgets/scalarselector.h
M +3 -4 widgets/vectorselector.cpp
--- branches/work/kst/portto4/kst/src/libkst/scalar.cpp #826598:826599
@@ -161,8 +161,20 @@
}
QString Scalar::descriptionTip() const {
- return i18n("Scalar: %1 = %2\n%3").arg(Name()).arg(value()).arg(_provider->descriptionTip());
+ if (_provider) {
+ return i18n("Scalar: %1 = %2\n%3").arg(Name()).arg(value()).arg(_provider->descriptionTip());
+ } else {
+ return i18n("Scalar: %1 = %2").arg(Name()).arg(value());
+ }
}
+QString Scalar::_automaticDescriptiveName() const {
+ if (_orphan) {
+ return QString::number(value());
+ } else {
+ return Primitive::_automaticDescriptiveName();
+ }
}
+
+}
// vim: et ts=2 sw=2
--- branches/work/kst/portto4/kst/src/libkst/scalar.h #826598:826599
@@ -37,6 +37,8 @@
friend class ObjectStore;
+ virtual QString _automaticDescriptiveName() const;
+
public:
virtual const QString& typeString() const;
static const QString staticTypeString;
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #826598:826599
@@ -302,7 +302,8 @@
void DataManager::showScalarDialog() {
- DialogLauncher::self()->showScalarDialog();
+ QString scalarName;
+ DialogLauncher::self()->showScalarDialog(scalarName);
_doc->session()->triggerReset();
}
--- branches/work/kst/portto4/kst/src/libkstapp/dialoglaunchergui.cpp #826598:826599
@@ -47,9 +47,10 @@
}
-void DialogLauncherGui::showScalarDialog(ObjectPtr objectPtr) {
+void DialogLauncherGui::showScalarDialog(QString &scalarname, ObjectPtr objectPtr) {
ScalarDialog dialog(objectPtr, kstApp->mainWindow());
dialog.exec();
+ scalarname = dialog.scalarName();
}
--- branches/work/kst/portto4/kst/src/libkstapp/dialoglaunchergui.h #826598:826599
@@ -28,7 +28,7 @@
virtual void showMatrixDialog(ObjectPtr objectPtr = 0);
- virtual void showScalarDialog(ObjectPtr objectPtr = 0);
+ virtual void showScalarDialog(QString &scalarname, ObjectPtr objectPtr = 0);
virtual void showStringDialog(ObjectPtr objectPtr = 0);
--- branches/work/kst/portto4/kst/src/libkstapp/equationdialog.cpp #826598:826599
@@ -199,6 +199,7 @@
void EquationTab::updateVectorCombos() {
_xVectors->fillVectors();
_vectors->fillVectors();
+ _scalars->fillScalars();
}
EquationDialog::EquationDialog(ObjectPtr dataObject, QWidget *parent)
--- branches/work/kst/portto4/kst/src/libkstapp/scalardialog.cpp #826598:826599
@@ -50,6 +50,8 @@
ScalarDialog::ScalarDialog(ObjectPtr dataObject, QWidget *parent)
: DataDialog(dataObject, parent) {
+ _scalarName = QString();
+
if (editMode() == Edit)
setWindowTitle(tr("Edit Scalar"));
else
@@ -116,6 +118,8 @@
scalar->update();
scalar->unlock();
+ _scalarName = scalar->Name();
+
return static_cast<ObjectPtr>(scalar);
}
@@ -135,6 +139,10 @@
return dataObject();
}
+QString ScalarDialog::scalarName() const {
+ return _scalarName;
}
+}
+
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/scalardialog.h #826598:826599
@@ -45,6 +45,7 @@
public:
ScalarDialog(ObjectPtr dataObject, QWidget *parent = 0);
virtual ~ScalarDialog();
+ QString scalarName() const;
protected:
// virtual QString tagString() const;
@@ -59,6 +60,7 @@
private:
ScalarTab *_scalarTab;
+ QString _scalarName;
};
}
--- branches/work/kst/portto4/kst/src/libkstmath/dialoglauncher.cpp #826598:826599
@@ -63,8 +63,9 @@
}
-void DialogLauncher::showScalarDialog(ObjectPtr objectPtr) {
+void DialogLauncher::showScalarDialog(QString &scalarname, ObjectPtr objectPtr) {
Q_UNUSED(objectPtr);
+ Q_UNUSED(scalarname);
}
--- branches/work/kst/portto4/kst/src/libkstmath/dialoglauncher.h #826598:826599
@@ -46,7 +46,7 @@
virtual void showMatrixDialog(ObjectPtr objectPtr = 0);
- virtual void showScalarDialog(ObjectPtr objectPtr = 0);
+ virtual void showScalarDialog(QString &scalarname, ObjectPtr objectPtr = 0);
virtual void showStringDialog(ObjectPtr objectPtr = 0);
--- branches/work/kst/portto4/kst/src/libkstmath/enodes.cpp #826598:826599
@@ -797,7 +797,7 @@
} else if (_vector) {
return QString("[") + _vector->Name() + QString("]");
} else if (_scalar) {
- return _scalar->Name();
+ return QString("[") + _scalar->Name() + QString("]");
} else {
return QString::null;
}
--- branches/work/kst/portto4/kst/src/widgets/scalarselector.cpp #826598:826599
@@ -38,7 +38,7 @@
connect(_newScalar, SIGNAL(pressed()), this, SLOT(newScalar()));
connect(_editScalar, SIGNAL(pressed()), this, SLOT(editScalar()));
connect(_selectScalar, SIGNAL(pressed()), this, SLOT(selectScalar()));
- connect(_scalar, SIGNAL(currentIndexChanged(int)), this, SLOT(emitSelectionChanged()));
+ connect(_scalar, SIGNAL(activated(int)), this, SLOT(emitSelectionChanged()));
connect(_scalar, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDescriptionTip()));
}
@@ -72,18 +72,40 @@
void ScalarSelector::setSelectedScalar(ScalarPtr selectedScalar) {
- Q_UNUSED(selectedScalar);
+ int i=-1,j;
+ for (j=0; j<_scalar->count() ; j++) {
+ if (selectedScalar.data() == (qVariantValue<Scalar*>(_scalar->itemData(j)))) {
+ i=j;
+ break;
+ }
+ }
+ Q_ASSERT(i != -1);
+
+ _scalar->setCurrentIndex(i);
+
}
void ScalarSelector::newScalar() {
- DialogLauncher::self()->showScalarDialog();
+ QString scalarName;
+
+ DialogLauncher::self()->showScalarDialog(scalarName);
fillScalars();
+
+ ScalarPtr scalar = kst_cast<Scalar>(_store->retrieveObject(scalarName));
+
+
+ if (scalar) {
+ setSelectedScalar(scalar);
+ emitSelectionChanged();
+ }
}
void ScalarSelector::editScalar() {
- DialogLauncher::self()->showScalarDialog(ObjectPtr(selectedScalar()));
+ QString scalarName;
+ DialogLauncher::self()->showScalarDialog(scalarName, ObjectPtr(selectedScalar()));
+ fillScalars();
}
--- branches/work/kst/portto4/kst/src/widgets/scalarselector.h #826598:826599
@@ -35,6 +35,8 @@
ScalarPtr selectedScalar() const;
void setSelectedScalar(ScalarPtr selectedScalar);
+ void fillScalars();
+
Q_SIGNALS:
void selectionChanged(const QString&);
@@ -46,8 +48,6 @@
void updateDescriptionTip();
private:
- void fillScalars();
-
ScalarListSelector* _scalarListSelector;
ObjectStore *_store;
};
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.cpp #826598:826599
@@ -34,10 +34,9 @@
connect(_newVector, SIGNAL(pressed()), this, SLOT(newVector()));
connect(_editVector, SIGNAL(pressed()), this, SLOT(editVector()));
- connect(_vector, SIGNAL(currentIndexChanged(int)), this, SLOT(emitSelectionChanged()));
+ connect(_vector, SIGNAL(activated(int)), this, SLOT(emitSelectionChanged()));
connect(_vector, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDescriptionTip()));
- //FIXME need to find a way to call fillVectors when the vectorList changes
}
@@ -121,9 +120,9 @@
if (vector) {
setSelectedVector(vector);
+ emitSelectionChanged();
+ emit contentChanged();
}
-
- emit contentChanged();
}
More information about the Kst
mailing list