[Kst] branches/work/kst/hierarchy/kst/src
Eli Fidler
eli at staikos.net
Mon Dec 11 22:34:40 CET 2006
SVN commit 612573 by fidler:
make a constant for the tag separator replacement (currently "_")
clean up display tags
better debugging
M +3 -1 libkst/kstobject.cpp
M +5 -12 libkst/kstobject.h
M +3 -3 libkst/kstobjectcollection.h
M +3 -1 libkst/kstrvector.cpp
M +1 -1 libkstapp/ksteqdialog_i.cpp
M +1 -1 libkstapp/ksteventmonitor_i.cpp
--- branches/work/kst/hierarchy/kst/src/libkst/kstobject.cpp #612572:612573
@@ -19,7 +19,9 @@
#include "kstobject.h"
/** Tag globals */
-const QString KstObjectTag::tagSeparator = QString("/");
+const QChar KstObjectTag::tagSeparator = QChar('/');
+const QChar KstObjectTag::tagSeparatorReplacement = QChar('_');
+
const QStringList KstObjectTag::globalTagContext = QStringList();
const QStringList KstObjectTag::constantTagContext = QStringList("CONSTANTS");
--- branches/work/kst/hierarchy/kst/src/libkst/kstobject.h #612572:612573
@@ -54,7 +54,8 @@
public:
static const KstObjectTag invalidTag;
- static const QString tagSeparator;
+ static const QChar tagSeparator;
+ static const QChar tagSeparatorReplacement;
static const QStringList globalTagContext;
static const QStringList constantTagContext;
@@ -70,22 +71,14 @@
}
// construct a tag in the context of another tag
- KstObjectTag(const QString& tag, const KstObjectTag& contextTag) :
+ KstObjectTag(const QString& tag, const KstObjectTag& contextTag, bool alwaysShowContext = true) :
_uniqueDisplayComponents(UINT_MAX)
{
_tag = cleanTag(tag);
_context = contextTag.fullTag();
- _minDisplayComponents = 1 + contextTag._minDisplayComponents;
+ _minDisplayComponents = 1 + (alwaysShowContext ? KMAX(contextTag._minDisplayComponents, (unsigned int)1) : 0);
}
- KstObjectTag(const KstObjectTag& tag, const KstObjectTag& contextTag, unsigned int minDisplayComponentsFromContext = 1) :
- _uniqueDisplayComponents(UINT_MAX)
- {
- _tag = tag._tag;
- _context = contextTag.fullTag() + tag.context();
- _minDisplayComponents = tag.components() + minDisplayComponentsFromContext;
- }
-
// construct a tag from a fullTag representation
KstObjectTag(QStringList fullTag) : _minDisplayComponents(1), _uniqueDisplayComponents(UINT_MAX) {
_tag = cleanTag(fullTag.last());
@@ -174,7 +167,7 @@
static QString cleanTag(const QString& in_tag) {
if (in_tag.contains(tagSeparator)) {
QString tag = in_tag;
- tag.replace(tagSeparator, "-");
+ tag.replace(tagSeparator, tagSeparatorReplacement);
kstdWarning() << "cleaning tag name containing " << tagSeparator << ":\"" << in_tag << "\" -> \"" << tag << "\"" << endl;
return tag;
} else {
--- branches/work/kst/hierarchy/kst/src/libkst/kstobjectcollection.h #612572:612573
@@ -18,7 +18,7 @@
#ifndef KSTOBJECTCOLLECTION_H
#define KSTOBJECTCOLLECTION_H
-// NAMEDEBUG: 0 for no debug, 1 for some debug, 2 for all debug
+// NAMEDEBUG: 0 for no debug, 1 for some debug, 2 for more debug, 3 for all debug
#define NAMEDEBUG 2
#include "ksdebug.h"
@@ -628,7 +628,7 @@
return nodes;
}
-#if NAMEDEBUG > 1
+#if NAMEDEBUG > 2
kstdDebug() << "Looking for related nodes to \"" << o->tag().tagString() << "\"" << endl;
#endif
@@ -639,7 +639,7 @@
QValueList<KstObjectTreeNode<T> *> nodeList = _index[*i];
for (typename QValueList<KstObjectTreeNode<T> *>::ConstIterator i2 = nodeList.begin(); i2 != nodeList.end(); ++i2) {
if ((*i2)->object() && (*i2)->object() != o && !nodes.contains(*i2)) {
-#if NAMEDEBUG > 1
+#if NAMEDEBUG > 2
kstdDebug() << "Found related node to \"" << o->tag().tagString() << "\": \"" << (*i2)->object()->tag().tagString() << "\"" << endl;
#endif
nodes << (*i2);
--- branches/work/kst/hierarchy/kst/src/libkst/kstrvector.cpp #612572:612573
@@ -106,7 +106,9 @@
in_file = in_provider;
}
if (in_file) {
- setTagName(KstObjectTag(tag(), in_file->tag(), 0));
+ // use datasource as tag context for this RVector
+ // allow unique vector names to be displayed at top-level
+ setTagName(KstObjectTag(tag().tag(), in_file->tag(), false));
}
if (o_n > -2) {
--- branches/work/kst/hierarchy/kst/src/libkstapp/ksteqdialog_i.cpp #612572:612573
@@ -145,7 +145,7 @@
QString tag_name = _tagName->text();
QString etext = _w->_equation->text();
etext.remove(QRegExp("[^a-zA-Z0-9\\(\\)\\+\\-\\*/\\%\\^\\|\\&\\!<>=_.]"));
- etext.replace(KstObjectTag::tagSeparator, "_");
+ etext.replace(KstObjectTag::tagSeparator, KstObjectTag::tagSeparatorReplacement);
if (etext.length() > 12) {
etext.truncate(12);
etext += "...";
--- branches/work/kst/hierarchy/kst/src/libkstapp/ksteventmonitor_i.cpp #612572:612573
@@ -178,7 +178,7 @@
bool KstEventMonitorI::newObject() {
QString tag_name = _tagName->text();
tag_name.replace("<New_Event>", _w->lineEditEquation->text());
- tag_name.replace(KstObjectTag::tagSeparator, "_");
+ tag_name.replace(KstObjectTag::tagSeparator, KstObjectTag::tagSeparatorReplacement);
// verify that the event name is unique
if (KstData::self()->dataTagNameNotUnique(tag_name)) {
More information about the Kst
mailing list