[Kst] branches/work/kst/pluginify/kst/src
Adam Treat
treat at kde.org
Tue Sep 19 19:11:32 CEST 2006
SVN commit 586456 by treat:
* Don't shadow the KstDataObject object maps..
* KstBasicDialog is now feature complete
M +62 -24 libkstapp/kstbasicdialog_i.cpp
M +9 -9 libkstmath/kstbasicplugin.cpp
M +6 -6 libkstmath/kstbasicplugin.h
M +6 -6 plugins/testplugin/testplugin.cpp
M +6 -6 plugins/testplugin/testplugin.h
--- branches/work/kst/pluginify/kst/src/libkstapp/kstbasicdialog_i.cpp #586455:586456
@@ -84,12 +84,12 @@
}
int cnt = 0;
- int numInputOutputs = ptr->inputVectors().count()
- + ptr->inputScalars().count()
- + ptr->inputStrings().count()
- + ptr->outputVectors().count()
- + ptr->outputScalars().count()
- + ptr->outputStrings().count();
+ int numInputOutputs = ptr->inputVectorList().count()
+ + ptr->inputScalarList().count()
+ + ptr->inputStringList().count()
+ + ptr->outputVectorList().count()
+ + ptr->outputScalarList().count()
+ + ptr->outputStringList().count();
_grid = new QGridLayout(_w->_frame, numInputOutputs + 1, 2, 0, 8);
_grid->setColStretch(1,1);
@@ -97,21 +97,21 @@
//create input widgets
//First, the inputVectors...
- QStringList iv = ptr->inputVectors();
+ QStringList iv = ptr->inputVectorList();
QStringList::ConstIterator ivI = iv.begin();
for (; ivI != iv.end(); ++ivI) {
createInputVector(*ivI, ++cnt);
}
//Now, the inputScalars...
- QStringList is = ptr->inputScalars();
+ QStringList is = ptr->inputScalarList();
QStringList::ConstIterator isI = is.begin();
for (; isI != is.end(); ++isI) {
createInputScalar(*isI, ++cnt);
}
//Finally, the inputStrings...
- QStringList istr = ptr->inputStrings();
+ QStringList istr = ptr->inputStringList();
QStringList::ConstIterator istrI = istr.begin();
for (; istrI != istr.end(); ++istrI) {
createInputString(*istrI, ++cnt);
@@ -128,21 +128,21 @@
//create output widgets
//output vectors...
- QStringList ov = ptr->outputVectors();
+ QStringList ov = ptr->outputVectorList();
QStringList::ConstIterator ovI = ov.begin();
for (; ovI != ov.end(); ++ovI) {
createOutputWidget(*ovI, ++cnt);
}
//output scalars...
- QStringList os = ptr->outputScalars();
+ QStringList os = ptr->outputScalarList();
QStringList::ConstIterator osI = os.begin();
for (; osI != os.end(); ++osI) {
createOutputWidget(*osI, ++cnt);
}
//ouput strings...
- QStringList ostr = ptr->outputStrings();
+ QStringList ostr = ptr->outputStringList();
QStringList::ConstIterator ostrI = ostr.begin();
for (; ostrI != ostr.end(); ++ostrI) {
createOutputWidget(*ostrI, ++cnt);
@@ -244,7 +244,7 @@
//set the outputs
//output vectors...
- QStringList ov = ptr->outputVectors();
+ QStringList ov = ptr->outputVectorList();
QStringList::ConstIterator ovI = ov.begin();
for (; ovI != ov.end(); ++ovI) {
if (QLineEdit *w = output(*ovI)) {
@@ -253,7 +253,7 @@
}
//output scalars...
- QStringList os = ptr->outputScalars();
+ QStringList os = ptr->outputScalarList();
QStringList::ConstIterator osI = os.begin();
for (; osI != os.end(); ++osI) {
if (QLineEdit *w = output(*osI)) {
@@ -262,7 +262,7 @@
}
//ouput strings...
- QStringList ostr = ptr->outputStrings();
+ QStringList ostr = ptr->outputStringList();
QStringList::ConstIterator ostrI = ostr.begin();
for (; ostrI != ostr.end(); ++ostrI) {
if (QLineEdit *w = output(*ostrI)) {
@@ -289,6 +289,44 @@
bool KstBasicDialogI::editObject() {
//called upon clicking 'ok' in 'edit' mode
//return false if the specified objects can't be editted, otherwise true
+
+ KstBasicPluginPtr ptr = kst_cast<KstBasicPlugin>(_dp);
+ Q_ASSERT(ptr); //should never happen...
+
+ ptr->writeLock();
+ if (_tagName->text() != ptr->tagName() && KstData::self()->dataTagNameNotUnique(_tagName->text())) {
+ _tagName->setFocus();
+ ptr->unlock();
+ return false;
+ }
+
+ ptr->setTagName(_tagName->text());
+
+ // Must unlock before clear()
+ for (KstVectorMap::Iterator i = ptr->inputVectors().begin(); i != ptr->inputVectors().end(); ++i) {
+ (*i)->unlock();
+ }
+ for (KstScalarMap::Iterator i = ptr->inputScalars().begin(); i != ptr->inputScalars().end(); ++i) {
+ (*i)->unlock();
+ }
+ for (KstStringMap::Iterator i = ptr->inputStrings().begin(); i != ptr->inputStrings().end(); ++i) {
+ (*i)->unlock();
+ }
+ ptr->inputVectors().clear();
+ ptr->inputScalars().clear();
+ ptr->inputStrings().clear();
+
+ ptr->unlock();
+
+ // Save the vectors and scalars
+ if (!editSingleObject(ptr) || !ptr->isValid()) {
+ KMessageBox::sorry(this, i18n("There is an error in the values you entered."));
+ return false;
+ }
+
+ ptr->setDirty();
+
+ emit modified();
return true;
}
@@ -322,7 +360,7 @@
//input vectors...
KstVectorList::Iterator v;
- QStringList iv = ptr->inputVectors();
+ QStringList iv = ptr->inputVectorList();
QStringList::ConstIterator ivI = iv.begin();
for (; ivI != iv.end(); ++ivI) {
if (VectorSelector *w = vector(*ivI)) {
@@ -335,7 +373,7 @@
//input scalars...
KstScalarList::Iterator s;
- QStringList is = ptr->inputScalars();
+ QStringList is = ptr->inputScalarList();
QStringList::ConstIterator isI = is.begin();
for (; isI != is.end(); ++isI) {
if (ScalarSelector *w = scalar(*isI)) {
@@ -358,7 +396,7 @@
//input strings...
KstStringList::Iterator str;
- QStringList istr = ptr->inputStrings();
+ QStringList istr = ptr->inputStringList();
QStringList::ConstIterator istrI = istr.begin();
for (; istrI != istr.end(); ++istrI) {
if (StringSelector *w = string(*istrI)) {
@@ -392,7 +430,7 @@
//Update the various widgets...
//input vectors...
- QStringList iv = ptr->inputVectors();
+ QStringList iv = ptr->inputVectorList();
QStringList::ConstIterator ivI = iv.begin();
for (; ivI != iv.end(); ++ivI) {
KstVectorPtr p = ptr->inputVector(*ivI);
@@ -403,7 +441,7 @@
}
//input scalars...
- QStringList is = ptr->inputScalars();
+ QStringList is = ptr->inputScalarList();
QStringList::ConstIterator isI = is.begin();
for (; isI != is.end(); ++isI) {
KstScalarPtr p = ptr->inputScalar(*isI);
@@ -414,7 +452,7 @@
}
//input strings...
- QStringList istr = ptr->inputStrings();
+ QStringList istr = ptr->inputStringList();
QStringList::ConstIterator istrI = istr.begin();
for (; istrI != istr.end(); ++istrI) {
KstStringPtr p = ptr->inputString(*istrI);
@@ -425,7 +463,7 @@
}
//output vectors...
- QStringList ov = ptr->outputVectors();
+ QStringList ov = ptr->outputVectorList();
QStringList::ConstIterator ovI = ov.begin();
for (; ovI != ov.end(); ++ovI) {
KstVectorPtr p = ptr->outputVector(*ovI);
@@ -437,7 +475,7 @@
}
//output scalars...
- QStringList os = ptr->outputScalars();
+ QStringList os = ptr->outputScalarList();
QStringList::ConstIterator osI = os.begin();
for (; osI != os.end(); ++osI) {
KstScalarPtr p = ptr->outputScalar(*osI);
@@ -449,7 +487,7 @@
}
//ouput strings...
- QStringList ostr = ptr->outputStrings();
+ QStringList ostr = ptr->outputStringList();
QStringList::ConstIterator ostrI = ostr.begin();
for (; ostrI != ostr.end(); ++ostrI) {
KstStringPtr p = ptr->outputString(*ostrI);
--- branches/work/kst/pluginify/kst/src/libkstmath/kstbasicplugin.cpp #586455:586456
@@ -264,7 +264,7 @@
//TODO Could use some templates perhaps...
bool KstBasicPlugin::inputsExist() const {
//First, check the inputVectors...
- QStringList iv = inputVectors();
+ QStringList iv = inputVectorList();
QStringList::ConstIterator ivI = iv.begin();
for (; ivI != iv.end(); ++ivI) {
if (!inputVector(*ivI))
@@ -272,7 +272,7 @@
}
//Now, check the inputScalars...
- QStringList is = inputScalars();
+ QStringList is = inputScalarList();
QStringList::ConstIterator isI = is.begin();
for (; isI != is.end(); ++isI) {
if (!inputScalar(*isI))
@@ -280,7 +280,7 @@
}
//Finally, check the inputStrings...
- QStringList istr = inputStrings();
+ QStringList istr = inputStringList();
QStringList::ConstIterator istrI = istr.begin();
for (; istrI != istr.end(); ++istrI) {
if (!inputString(*istrI))
@@ -294,7 +294,7 @@
bool depUpdated = force;
//First, update the inputVectors...
- QStringList iv = inputVectors();
+ QStringList iv = inputVectorList();
QStringList::ConstIterator ivI = iv.begin();
for (; ivI != iv.end(); ++ivI) {
depUpdated =
@@ -302,7 +302,7 @@
}
//Now, update the inputScalars...
- QStringList is = inputScalars();
+ QStringList is = inputScalarList();
QStringList::ConstIterator isI = is.begin();
for (; isI != is.end(); ++isI) {
depUpdated =
@@ -310,7 +310,7 @@
}
//Finally, update the inputStrings...
- QStringList istr = inputStrings();
+ QStringList istr = inputStringList();
QStringList::ConstIterator istrI = istr.begin();
for (; istrI != istr.end(); ++istrI) {
depUpdated =
@@ -322,7 +322,7 @@
void KstBasicPlugin::updateOutput(int updateCounter) const {
//output vectors...
- QStringList ov = outputVectors();
+ QStringList ov = outputVectorList();
QStringList::ConstIterator ovI = ov.begin();
for (; ovI != ov.end(); ++ovI) {
if (KstVectorPtr o = outputVector(*ovI)) {
@@ -334,7 +334,7 @@
}
//output scalars...
- QStringList os = outputScalars();
+ QStringList os = outputScalarList();
QStringList::ConstIterator osI = os.begin();
for (; osI != os.end(); ++osI) {
if (KstScalarPtr o = outputScalar(*osI)) {
@@ -343,7 +343,7 @@
}
//ouput strings...
- QStringList ostr = outputStrings();
+ QStringList ostr = outputStringList();
QStringList::ConstIterator ostrI = ostr.begin();
for (; ostrI != ostr.end(); ++ostrI) {
if (KstStringPtr o = outputString(*ostrI)) {
--- branches/work/kst/pluginify/kst/src/libkstmath/kstbasicplugin.h #586455:586456
@@ -33,13 +33,13 @@
virtual bool algorithm() = 0;
//String lists of the names of the expected inputs.
- virtual QStringList inputVectors() const = 0;
- virtual QStringList inputScalars() const = 0;
- virtual QStringList inputStrings() const = 0;
+ virtual QStringList inputVectorList() const = 0;
+ virtual QStringList inputScalarList() const = 0;
+ virtual QStringList inputStringList() const = 0;
//String lists of the names of the expected outputs.
- virtual QStringList outputVectors() const = 0;
- virtual QStringList outputScalars() const = 0;
- virtual QStringList outputStrings() const = 0;
+ virtual QStringList outputVectorList() const = 0;
+ virtual QStringList outputScalarList() const = 0;
+ virtual QStringList outputStringList() const = 0;
//Pure virtual methods inherited from KstDataObject
//This _must_ equal the 'Name' entry in the .desktop file of
--- branches/work/kst/pluginify/kst/src/plugins/testplugin/testplugin.cpp #586455:586456
@@ -44,32 +44,32 @@
}
-QStringList TestPlugin::inputVectors() const {
+QStringList TestPlugin::inputVectorList() const {
return QStringList( VECTOR_IN );
}
-QStringList TestPlugin::inputScalars() const {
+QStringList TestPlugin::inputScalarList() const {
return QStringList( SCALAR_IN );
}
-QStringList TestPlugin::inputStrings() const {
+QStringList TestPlugin::inputStringList() const {
return QStringList( STRING_IN );
}
-QStringList TestPlugin::outputVectors() const {
+QStringList TestPlugin::outputVectorList() const {
return QStringList( VECTOR_OUT );
}
-QStringList TestPlugin::outputScalars() const {
+QStringList TestPlugin::outputScalarList() const {
return QStringList( SCALAR_OUT );
}
-QStringList TestPlugin::outputStrings() const {
+QStringList TestPlugin::outputStringList() const {
return QStringList( STRING_OUT );
}
--- branches/work/kst/pluginify/kst/src/plugins/testplugin/testplugin.h #586455:586456
@@ -27,12 +27,12 @@
virtual bool algorithm();
- virtual QStringList inputVectors() const;
- virtual QStringList inputScalars() const;
- virtual QStringList inputStrings() const;
- virtual QStringList outputVectors() const;
- virtual QStringList outputScalars() const;
- virtual QStringList outputStrings() const;
+ virtual QStringList inputVectorList() const;
+ virtual QStringList inputScalarList() const;
+ virtual QStringList inputStringList() const;
+ virtual QStringList outputVectorList() const;
+ virtual QStringList outputScalarList() const;
+ virtual QStringList outputStringList() const;
virtual QString propertyString() const { return "Test Plugin"; }
More information about the Kst
mailing list