[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Sun Dec 21 06:22:17 CET 2003


CVS commit by staikos: 

Make scalars work by name, and make the filter create a scalar with a given
name if it is specified but it doesn't exist.  This may not be ideal but it's
the most convenient implementation right now.  For some reason when scalars
are changed for a plugin, the plugin doesn't update.


  M +31 -6     filterlisteditor.ui.h   1.13


--- kdeextragear-2/kst/kst/filterlisteditor.ui.h  #1.12:1.13
@@ -111,6 +111,7 @@ void FilterListEditor::moveRight()
             FilterListBoxItem *fli = new FilterListBoxItem(_applied, txt);
             for (QValueList<Plugin::Data::IOValue>::ConstIterator ivi = pp->data()._inputs.begin(); ivi != pp->data()._inputs.end(); ++ivi) {
-                // FIXME: need to name the scalar here
-                fli->arguments.insert((*ivi)._name, new KstScalar);
+                KstScalar *s = new KstScalar;
+                fli->arguments.insert((*ivi)._name, s);
+                KST::scalarList.remove(s);
             }
         }
@@ -269,6 +270,10 @@ void FilterListEditor::editFilter()
     connect(vle->_variableList, SIGNAL(itemRenamed(QListViewItem*, int)), this, SLOT(filtersetModified()));
     for (KstScalarMap::Iterator i = item->arguments.begin(); i != item->arguments.end(); ++i) {
-        // FIXME: support non-constants too
-        QListViewItem *lvi = new QListViewItem(vle->_variableList, i.key(), QString::number(i.data()->value()));
+        QListViewItem *lvi;
+        if (KST::scalarList.findTag(i.data()->tagName()) != KST::scalarList.end()) {
+            lvi = new QListViewItem(vle->_variableList, i.key(), i.data()->tagName());
+        } else {
+            lvi = new QListViewItem(vle->_variableList, i.key(), QString::number(i.data()->value()));
+        }
         lvi->setRenameEnabled(1, true);   
     }
@@ -278,6 +283,26 @@ void FilterListEditor::editFilter()
     if (rc == QDialog::Accepted) {
         for (QListViewItem *i = vle->_variableList->firstChild(); i; i = i->nextSibling()) {
-            // FIXME: support non-constants too
-            item->arguments[i->text(0)]->setValue(i->text(1).toDouble());
+            bool ok = true;
+            double x = 0.0;
+
+            if (!i->text(1).isEmpty()) {
+                x = i->text(1).toDouble(&ok);
+            }
+
+            if (ok) {
+                if (KST::scalarList.find(item->arguments[i->text(0)]) != KST::scalarList.end()) {
+                    KstScalarPtr s = new KstScalar;
+                    item->arguments[i->text(0)] = s;
+                    KST::scalarList.remove(s);
+                }
+                item->arguments[i->text(0)]->setValue(x);
+            } else {
+                KstScalarPtr s = *KST::scalarList.findTag(i->text(1));
+                if (!s) {
+                    s = new KstScalar(i->text(1));
+                    s->setValue(0.0);
+                }
+                item->arguments[i->text(0)] = s;
+            }
         }
     }





More information about the Kst mailing list