[Kst] kdeextragear-2/kst
George Staikos
staikos at kde.org
Sat Oct 2 23:57:23 CEST 2004
CVS commit by staikos:
- add PSD and plugin curve hints
- add curve hint example to linefit.xml
M +12 -0 kst/kstplugin.cpp 1.67
M +2 -0 kst/kstplugin.h 1.30
M +2 -0 kst/kstpsd.cpp 1.8
M +108 -99 kst/plugin.h 1.28
M +41 -1 kst/pluginxmlparser.cpp 1.26
M +1 -0 kst/pluginxmlparser.h 1.9
M +5 -0 plugins/linefit/linefit.xml 1.5
--- kdeextragear-2/kst/kst/kstplugin.cpp #1.66:1.67
@@ -416,3 +416,15 @@ void KstPlugin::_showDialog() {
}
+
+const KstCurveHintList* KstPlugin::curveHints() const {
+ _curveHints->clear();
+ if (_plugin) {
+ for (QValueList<Plugin::Data::CurveHint>::ConstIterator i = _plugin->data()._hints.begin(); i != _plugin->data()._hints.end(); ++i) {
+ _curveHints->append(new KstCurveHint((*i).name, _outputVectors[(*i).x]->tagName(), _outputVectors[(*i).y]->tagName()));
+ }
+ }
+ return KstDataObject::curveHints();
+}
+
+
// vim: ts=2 sw=2 et
--- kdeextragear-2/kst/kst/kstplugin.h #1.29:1.30
@@ -46,4 +46,6 @@ class KstPlugin : public KstDataObject {
virtual QString propertyString() const;
+ virtual const KstCurveHintList* curveHints() const;
+
protected:
static void countScalarsAndVectors(const QValueList<Plugin::Data::IOValue>& table, unsigned& scalars, unsigned& vectors);
--- kdeextragear-2/kst/kst/kstpsd.cpp #1.7:1.8
@@ -154,4 +154,6 @@ void KstPSD::commonConstructor(const QSt
_sVector = _outputVectors.insert(SVECTOR, ov);
+ _curveHints->append(new KstCurveHint(i18n("PSD Curve"), (*_fVector)->tagName(), (*_sVector)->tagName()));
+
update();
}
--- kdeextragear-2/kst/kst/plugin.h #1.27:1.28
@@ -26,6 +26,6 @@ class KLibrary;
class Plugin : public KstShared {
-friend class PluginLoader;
-public:
+ friend class PluginLoader;
+ public:
virtual ~Plugin();
@@ -110,8 +110,17 @@ public:
// Parameter list
QMap<QString, QPair<ParameterTypes, QString> > _parameters;
+
+ // Curve hints
+ struct CurveHint {
+ CurveHint() {}
+ CurveHint(const QString& name, const QString& x, const QString& y)
+ : name(name), x(x), y(y) {}
+ QString name, x, y;
+ };
+ QValueList<Data::CurveHint> _hints;
};
-protected:
+ protected:
Plugin();
--- kdeextragear-2/kst/kst/pluginxmlparser.cpp #1.25:1.26
@@ -97,4 +97,6 @@ static const QString QS_filter_output("o
static const QString QS_localdata("localdata");
static const QString QS_pid("pid");
+static const QString QS_curvehints("curvehints");
+static const QString QS_hint("hint");
int PluginXMLParser::parseDOM(const QDomDocument& doc) {
@@ -115,4 +117,6 @@ QDomElement topElem = doc.documentElemen
} else if (tn == QS_paralist) {
rc = parseParalist(e);
+ } else if (tn == QS_curvehints) {
+ rc = parseCurveHints(e);
} else {
// Unknown tag
@@ -356,6 +360,42 @@ return 0;
}
+
+int PluginXMLParser::parseCurveHints(const QDomElement& element) {
+ QDomNode n = element.firstChild();
+
+ while (!n.isNull()) {
+ int rc = 0;
+ QDomElement e = n.toElement();
+
+ if (e.isNull()) {
+ n = n.nextSibling();
+ continue;
+ }
+
+ QString tn = e.tagName().lower();
+ if (tn == QS_hint) {
+ QString n = e.attribute(QS_name);
+ QString x = e.attribute("x");
+ QString y = e.attribute("y");
+ if (!n.isEmpty() && !y.isEmpty() && !x.isEmpty()) {
+ _pluginData._hints.append(Plugin::Data::CurveHint(n, x, y));
+ }
+ } else {
+ // Unknown node
+ }
+
+ if (rc < 0) {
+ return rc;
+ }
+
+ n = n.nextSibling();
+ }
+
+ return 0;
+}
+
+
int PluginXMLParser::parseParalist(const QDomElement& element) {
-QDomNode n = element.firstChild();
+ QDomNode n = element.firstChild();
while (!n.isNull()) {
--- kdeextragear-2/kst/kst/pluginxmlparser.h #1.8:1.9
@@ -46,4 +46,5 @@ private:
int parseInterface(const QDomElement& element);
int parseParalist(const QDomElement& element);
+ int parseCurveHints(const QDomElement& element);
int parseIO(const QDomElement& element, QValueList<Plugin::Data::IOValue>& collection);
--- kdeextragear-2/kst/plugins/linefit/linefit.xml #1.4:1.5
@@ -34,4 +34,9 @@
</output>
</interface>
+
+<curvehints>
+<hint name="Line of best fit" x="X Interpolated" y="Y Interpolated"/>
+</curvehints>
+
</module>
More information about the Kst
mailing list