Git commit c6f1a92e69bae8b1e15ff928f7f6b97b5c2fefad by Andreas Cord-Landweh= r. Committed on 21/09/2012 at 22:02. Pushed by cordlandwehr into branch 'dataUseOnlyDynamicProperties'. Do not use fix encoded data names and values but use properties. With this commit the value/name elements of data elements are removed. Instead from now on those values have to be saved by properties. M +0 -18 src/Core/ConcurrentHelpClasses.h M +34 -74 src/Core/Data.cpp M +20 -31 src/Core/Data.h M +11 -27 src/Core/DataStructure.cpp M +2 -18 src/Core/DataStructure.h M +68 -2 src/Core/DataType.cpp M +44 -0 src/Core/DataType.h M +6 -6 src/Core/Modifiers/ValueModifier.cpp M +111 -59 src/GraphicsItem/DataItem.cpp M +12 -6 src/GraphicsItem/DataItem.h M +3 -3 src/GraphicsItem/GraphicsLayout.cpp M +4 -4 src/Interface/DataPropertiesWidget.cpp M +3 -3 src/Interface/VisualEditor/GraphScene.cpp M +1 -1 src/LoadSave/Plugins/dotFileFormat/DotFileFormatPlugin.cpp M +1 -1 src/LoadSave/Plugins/dotFileFormat/DotGraphParsingHelper.cpp M +3 -3 src/LoadSave/Plugins/gmlFileFormat/GmlFileFormatPlugin.cpp M +2 -2 src/LoadSave/Plugins/kmlFileFormat/KmlFileFormatPlugin.cpp M +1 -1 src/LoadSave/Plugins/tgfFileFormat/Tests/TestTgfFileFormatPl= ugin.cpp M +1 -1 src/LoadSave/Plugins/tgfFileFormat/TgfFileFormatPlugin.cpp M +2 -2 src/LoadSave/Plugins/tikzFileFormat/TikzFileFormatPlugin.cpp M +0 -1 src/LoadSave/RocsGraphFileFormatPlugin.cpp M +2 -3 src/Models/model_GraphProperties.cpp M +3 -3 src/Plugins/DataStructure/Graph/GraphStructure.cpp M +2 -2 src/Plugins/DataStructure/LinkedList/ListPlugin.cpp M +4 -4 src/Plugins/DataStructure/LinkedList/ListStructure.cpp M +1 -1 src/Plugins/DataStructure/RootedTree/RootedTreePlugin.cpp M +5 -5 src/Plugins/DataStructure/RootedTree/RootedTreeStructure.cpp http://commits.kde.org/rocs/c6f1a92e69bae8b1e15ff928f7f6b97b5c2fefad diff --git a/src/Core/ConcurrentHelpClasses.h b/src/Core/ConcurrentHelpClas= ses.h index 32ff823..c9cdf6e 100644 --- a/src/Core/ConcurrentHelpClasses.h +++ b/src/Core/ConcurrentHelpClasses.h @@ -42,15 +42,6 @@ struct PointerColorSetted { const QColor& m_color; }; = -struct DataNameVisibilitySetted { - DataNameVisibilitySetted(bool visibility) : m_visibility(visibility) {} - typedef void result_type; - void operator()(DataPtr d) { - d->setNameVisible(m_visibility); - } - bool m_visibility; -}; - struct PointerNameVisibilitySetted { PointerNameVisibilitySetted(bool visibility) : m_visibility(visibility= ) {} typedef void result_type; @@ -60,15 +51,6 @@ struct PointerNameVisibilitySetted { bool m_visibility; }; = -struct DataValueVisibilitySetted { - DataValueVisibilitySetted(bool visibility) : m_visibility(visibility) = {} - typedef void result_type; - void operator()(DataPtr d) { - d->setValueVisible(m_visibility); - } - bool m_visibility; -}; - struct PointerValueVisibilitySetted { PointerValueVisibilitySetted(bool visibility) : m_visibility(visibilit= y) {} typedef void result_type; diff --git a/src/Core/Data.cpp b/src/Core/Data.cpp index 9823fef..f33a4b3 100644 --- a/src/Core/Data.cpp +++ b/src/Core/Data.cpp @@ -44,18 +44,14 @@ public: qreal _x; qreal _y; qreal _width; - bool _showName; - bool _showValue; bool _visible; bool _colored; = DataStructurePtr _dataStructure; int _uniqueIdentifier; - int _dataType; - QString _name; + DataTypePtr _dataType; QColor _color; = - QVariant _value; QScriptValue _scriptvalue; QScriptEngine *_engine; = @@ -76,16 +72,13 @@ DataPrivate::DataPrivate(DataStructurePtr parent, int u= niqueIdentifier, int data : _x(0) , _y(0) , _width(0.3) - , _showName(parent->isDataNameVisible(dataType)) - , _showValue(parent->isDataValueVisible(dataType)) , _visible(parent->isDataVisible(dataType)) , _colored(false) , _dataStructure(parent) , _uniqueIdentifier(uniqueIdentifier) - , _dataType(dataType) , _color(parent->document()->dataType(dataType)->defaultColor()) - , _value(0) { + _dataType =3D _dataStructure->document()->dataType(dataType); _inPointers =3D PointerList(); _outPointers =3D PointerList(); } @@ -126,6 +119,17 @@ void Data::setQpointer(DataPtr q) d->q =3D q; } = +void Data::initialize() +{ + installEventFilter(this); + foreach(QString property, d->_dataType->properties()) { + addDynamicProperty(property, d->_dataType->propertyDefaultValue(pr= operty)); + } + + connect(d->_dataType.get(), SIGNAL(propertyAdded(QString, QVariant)), + this, SLOT(addDynamicProperty(QString,QVariant))); +} + DataPtr Data::getData() const { DataPtr px(d->q); @@ -148,25 +152,19 @@ Data::~Data() } } = -DataStructurePtr Data::dataStructure() const -{ - return d->_dataStructure; -} - -void Data::setNameVisible(bool visible) -{ - if (d->_showName !=3D visible) { - d->_showName =3D visible; - emit nameVisibilityChanged(visible); +bool Data::eventFilter(QObject *obj, QEvent *event){ + if (event->type() =3D=3D QEvent::DynamicPropertyChange) { + if (QDynamicPropertyChangeEvent* const dynEvent =3D dynamic_cast(event)) { + event->accept(); + emit(propertyChanged(dynEvent->propertyName())); + } } + return QObject::eventFilter(obj, event); } = -void Data::setValueVisible(bool visible) +DataStructurePtr Data::dataStructure() const { - if (d->_showValue !=3D visible) { - d->_showValue =3D visible; - emit valueVisibilityChanged(visible); - } + return d->_dataStructure; } = void Data::setColored(bool b) @@ -191,7 +189,7 @@ void Data::setVisible(bool visible) void Data::setDataType(int dataType) { Q_ASSERT(d->_dataStructure->document()->dataTypeList().contains(dataTy= pe)); - d->_dataType =3D dataType; + d->_dataType =3D d->_dataStructure->document()->dataType(dataType); d->_dataStructure->updateData(getData()); emit dataTypeChanged(dataType); } @@ -312,16 +310,6 @@ void Data::remove() emit removed(); } = -const QVariant Data::value() const -{ - return d->_value; -} - -const QString& Data::name() const -{ - return d->_name; -} - const QVariant Data::color() const { return d->_color; @@ -344,7 +332,12 @@ qreal Data::width() const = QString Data::icon() const { - return d->_dataStructure->document()->dataType(d->_dataType)->iconName= (); + return d->_dataType->iconName(); +} + +QList< QString > Data::properties() const +{ + return d->_dataType->properties(); } = PointerList& Data::inPointerList() const @@ -357,16 +350,6 @@ PointerList& Data::outPointerList() const return d->_outPointers; } = -bool Data::isNameVisible() const -{ - return d->_showName; -} - -bool Data::isValueVisible() const -{ - return d->_showValue; -} - bool Data::isColored() const { return d->_colored; @@ -379,7 +362,7 @@ int Data::identifier() const = int Data::dataType() const { - return d->_dataType; + return d->_dataType->identifier(); } = void Data::setX(int x) @@ -424,42 +407,19 @@ void Data::setColor(const QVariant& s) } } = -void Data::setName(const QString& s) -{ - if (d->_name !=3D s) { - d->_name =3D s; - emit nameChanged(s); - } -} - -void Data::setValue(const QVariant& s) -{ - if (d->_value !=3D s) { - d->_value =3D s; - emit valueChanged(s); - } -} - -void Data::setValue(const QString& s) -{ - QVariant v(s); - if (d->_value !=3D v) { - d->_value =3D v; - emit valueChanged(v); - } -} - void Data::addDynamicProperty(QString property, QVariant value) { - if (! setProperty(property.toUtf8(), value) && value.isValid()) { + if (!setProperty(property.toUtf8(), value) && value.isValid()) { DynamicPropertiesList::New()->addProperty(this, property); } + emit(propertyAdded(property)); } = void Data::removeDynamicProperty(QString property) { addDynamicProperty(property.toUtf8(), QVariant::Invalid); DynamicPropertiesList::New()->removeProperty(this, property); + emit(propertyRemoved(property)); } = QScriptValue Data::scriptValue() const @@ -485,7 +445,7 @@ QScriptValue Data::set_type(int dataType) = QScriptValue Data::type() { - return d->_dataStructure->engine()->newVariant(d->_dataType); + return d->_dataStructure->engine()->newVariant(d->_dataType->identifie= r()); } = void Data::add_property(QString name, QString value) diff --git a/src/Core/Data.h b/src/Core/Data.h index 3b5b401..14e2714 100644 --- a/src/Core/Data.h +++ b/src/Core/Data.h @@ -46,10 +46,8 @@ class ROCSLIB_EXPORT Data : public QObject Q_PROPERTY(qreal x READ x WRITE setX) Q_PROPERTY(qreal y READ y WRITE setY) Q_PROPERTY(qreal width READ width WRITE setWidth) - Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(int id READ identifier) Q_PROPERTY(QVariant color READ color WRITE setColor) - Q_PROPERTY(QVariant value READ value WRITE setValue) = public: /** @@ -152,15 +150,7 @@ public: */ QString icon() const; = - /** - * \return true if data name is visible, otherwise false - */ - bool isNameVisible() const; - - /** - * \return true if data value is visible, otherwise false - */ - bool isValueVisible() const; + QList properties() const; = /** * \return true if data element is visible, otherwise false @@ -207,6 +197,17 @@ public: */ PointerList& outPointerList() const; = +public slots: + void remove(); + void setX(int x); + void setY(int y); + void setWidth(double w); + void setPos(qreal x, qreal y); + void setColor(const QVariant& s); + void setColored(bool b =3D true); + void setVisible(bool visible); + void setDataType(int dataType); + /** * Add new dynamic property with identifier \p property to this data e= lement and * sets it to \p value. @@ -223,22 +224,6 @@ public: */ void removeDynamicProperty(QString property); = -public slots: - void remove(); - void setX(int x); - void setY(int y); - void setWidth(double w); - void setPos(qreal x, qreal y); - void setColor(const QVariant& s); - void setName(const QString& s); - void setValue(const QVariant& v); - void setNameVisible(bool visible); - void setValueVisible(bool visible); - void setColored(bool b =3D true); - void setVisible(bool visible); - void setValue(const QString& v); - void setDataType(int dataType); - /** * FIXME proof of concept implementation: since each Pointer emits a c= hanged direction signal, * there are unnecessary many updates. @@ -264,14 +249,13 @@ signals: void posChanged(const QPointF p); void widthChanged(double w); void colorChanged(const QColor& c); - void nameChanged(const QString& name); - void valueChanged(const QVariant& v); - void nameVisibilityChanged(bool b); - void valueVisibilityChanged(bool b); void visibilityChanged(bool visible); void useColorChanged(bool b); void dataTypeChanged(int dataType); void pointerListChanged(); + void propertyAdded(QString name); + void propertyRemoved(QString name); + void propertyChanged(QString name); = protected: /** @@ -286,9 +270,12 @@ protected: static DataPtr create(DataStructurePtr parent, int uniqueIdentifier, i= nt dataType) { DataPtr pi(new T(parent, uniqueIdentifier, dataType)); pi->setQpointer(pi); + pi->initialize(); return pi; } = + bool eventFilter(QObject *obj, QEvent *event); + private: /** * \internal @@ -301,6 +288,8 @@ private: * Set q-pointer in private data object. */ void setQpointer(DataPtr q); + + void initialize(); Data(Data const &, int uniqueIdentifier, int dataType); Data & operator=3D(Data const &); }; diff --git a/src/Core/DataStructure.cpp b/src/Core/DataStructure.cpp index 5195ec2..fd4e3d5 100644 --- a/src/Core/DataStructure.cpp +++ b/src/Core/DataStructure.cpp @@ -139,9 +139,9 @@ void DataStructure::importStructure(DataStructurePtr ot= her) = QHash dataTodata; foreach(DataPtr n, other->dataList()) { - DataPtr newdata =3D addData(n->name()); + DataPtr newdata =3D addData(n->property("name").toString()); newdata->setColor(n->color()); - newdata->setValue(n->value()); + //FIXME all dynamic properties must be set newdata->setX(n->x()); newdata->setY(n->y()); newdata->setWidth(n->width()); @@ -366,7 +366,11 @@ DataPtr DataStructure::addData(QString name, int dataT= ype) } = DataPtr n =3D Data::create(this->getDataStructure(), generateUniqueIde= ntifier(), dataType); - n->setName(name); + + if (n->property("name") =3D=3D QVariant::Invalid) { + document()->dataType(dataType)->addProperty("name"); + } + n->setProperty("name", name); return addData(n, dataType); } = @@ -384,12 +388,9 @@ DataPtr DataStructure::addData(DataPtr data, int dataT= ype) emit changed(); = // connect(data.get(), SIGNAL(removed()), this, SIG= NAL(changed())); //FIXME removed for now - connect(data.get(), SIGNAL(nameChanged(QString)), this, SIGNAL= (changed())); - connect(data.get(), SIGNAL(valueChanged(QVariant)), this, SIGNAL= (changed())); + connect(data.get(), SIGNAL(propertyChanged(QString)), this, SIGNAL= (changed())); connect(data.get(), SIGNAL(colorChanged(QColor)), this, SIGNAL= (changed())); connect(data.get(), SIGNAL(posChanged(QPointF)), this, SIGNAL= (changed())); - connect(data.get(), SIGNAL(nameVisibilityChanged(bool)), this, SIGNAL= (changed())); - connect(data.get(), SIGNAL(valueVisibilityChanged(bool)), this, SIGNAL= (changed())); connect(data.get(), SIGNAL(useColorChanged(bool)), this, SIGNAL= (changed())); return data; } @@ -402,12 +403,9 @@ DataList DataStructure::addDataList(DataList dataList,= int dataType) d->_dataTypeLists[dataType].append(n); emit dataCreated(n); // connect(n.get(), SIGNAL(removed()), this, SI= GNAL(changed())); //FIXME removed for now - connect(n.get(), SIGNAL(nameChanged(QString)), this, SIGNA= L(changed())); - connect(n.get(), SIGNAL(valueChanged(QVariant)), this, SIGNA= L(changed())); + connect(n.get(), SIGNAL(propertyChanged(QString)), this, SIGNA= L(changed())); connect(n.get(), SIGNAL(colorChanged(QColor)), this, SIGNA= L(changed())); connect(n.get(), SIGNAL(posChanged(QPointF)), this, SIGNA= L(changed())); - connect(n.get(), SIGNAL(nameVisibilityChanged(bool)), this, SIGNA= L(changed())); - connect(n.get(), SIGNAL(valueVisibilityChanged(bool)), this, SIGNA= L(changed())); connect(n.get(), SIGNAL(useColorChanged(bool)), this, SIGNA= L(changed())); } emit changed(); @@ -641,29 +639,15 @@ void DataStructure::setPointerColor(QColor color, int= pointerType) } = = -void DataStructure::setDataNameVisibility(bool visible, int dataType) -{ - d->_dataTypeNameVisibility[dataType] =3D visible; - QtConcurrent::blockingMap(d->_dataTypeLists[dataType], DataNameVisibil= itySetted(visible)); -} - - void DataStructure::toggleDataNameVisibility(int dataType) { - setDataNameVisibility(!isDataNameVisible(dataType), dataType); -} - - -void DataStructure::setDataValueVisibility(bool visible, int dataType) -{ - d->_dataTypeValueVisibility[dataType] =3D visible; - QtConcurrent::blockingMap(d->_dataTypeLists[dataType], DataValueVisibi= litySetted(visible)); + kFatal() << "must be ported"; } = = void DataStructure::toggleDataValueVisibility(int dataType) { - setDataValueVisibility(!isDataValueVisible(dataType), dataType); + kFatal() << "must be ported"; } = = diff --git a/src/Core/DataStructure.h b/src/Core/DataStructure.h index 10ace45..aa4cafc 100644 --- a/src/Core/DataStructure.h +++ b/src/Core/DataStructure.h @@ -227,26 +227,10 @@ public slots: */ void setDataColor(QColor color, int dataType); = - /** - * Set all names of all data elements of given \param dataType to the = given value of \param visible. - * This is a fast implementation that starts several threads for updat= ing all data elements in parallel. - * - * \param visible must be true if data names shall be shown, false if = hidden - * \param dataType is the identifier of the data type for that this fu= nction has affect. - */ - void setDataNameVisibility(bool visible, int dataType); - + //FIXME remove void toggleDataNameVisibility(int dataType); = - /** - * Set all values of all data of given \param dataType to the given va= lue of \param visible. - * This is a fast implementation that starts several threads for updat= ing all data types in parallel. - * - * \param visible must be true if data values shall be shown, false if= hidden - * \param dataType is the identifier of the data type for that this fu= nction has affect. - */ - void setDataValueVisibility(bool visible, int dataType); - + //FIXME remove void toggleDataValueVisibility(int dataType); = /** diff --git a/src/Core/DataType.cpp b/src/Core/DataType.cpp index d73051d..a18005b 100644 --- a/src/Core/DataType.cpp +++ b/src/Core/DataType.cpp @@ -29,15 +29,20 @@ class DataTypePrivate { public: + struct Property { + QString name; + QVariant defaultValue; + bool visible; + }; + DataTypePrivate() {} boost::weak_ptr q; // self pointer = + QList _properties; QString _name; QString _icon; QColor _defaultColor; int _identifier; - bool _valueVisibility; - bool _nameVisibility; bool _visibility; Document* _document; }; @@ -47,6 +52,7 @@ DataTypePtr DataType::create(Document* document, int iden= tifier) { DataTypePtr pi(new DataType(document, identifier)); pi->d->q =3D pi; + pi->addProperty("name", ""); = return pi; } @@ -144,6 +150,66 @@ const QColor& DataType::defaultColor() const return d->_defaultColor; } = +void DataType::addProperty(QString name, QString defaultValue) +{ + DataTypePrivate::Property newProperty; + newProperty.name =3D name; + newProperty.defaultValue =3D defaultValue; + newProperty.visible =3D true; + d->_properties.append(newProperty); + emit(propertyAdded(newProperty.name, newProperty.defaultValue)); +} + +QList DataType::properties() const +{ + QList properties; + QList::const_iterator iter =3D d->_properti= es.constBegin(); + while (iter !=3D d->_properties.constEnd()) { + properties.append(iter->name); + ++iter; + } + return properties; +} + +QVariant DataType::propertyDefaultValue(QString name) const +{ + //FIXME very inefficient with this implementation, but working + QList properties; + QList::const_iterator iter =3D d->_properti= es.constBegin(); + while (iter !=3D d->_properties.constEnd()) { + if (name =3D=3D iter->name) { + return iter->defaultValue; + } + } + return false; +} + +bool DataType::isPropertyVisible(QString name) const +{ + //FIXME very inefficient with this implementation, but working + QList properties; + QList::const_iterator iter =3D d->_properti= es.constBegin(); + while (iter !=3D d->_properties.constEnd()) { + if (name =3D=3D iter->name) { + return iter->visible; + } + } + return false; +} + +void DataType::setPropertyVisible(QString name, bool visible) +{ + //FIXME very inefficient with this implementation, but working + QList properties; + QList::iterator iter =3D d->_properties.beg= in(); + while (iter !=3D d->_properties.end()) { + if (name =3D=3D iter->name) { + iter->visible =3D visible; + return; + } + } +} + void DataType::remove() { d->_document->removeDataType(identifier()); diff --git a/src/Core/DataType.h b/src/Core/DataType.h index 339c6b1..95b0d90 100644 --- a/src/Core/DataType.h +++ b/src/Core/DataType.h @@ -21,6 +21,7 @@ #define DATATYPE_H = #include +#include #include #include = @@ -84,6 +85,34 @@ public: */ const QColor& defaultColor() const; = + /** + * Add a new dynamic property to all data elements of this data type. + * + * \param name is the unique name of the property + * \param defaultValue is the default value that is set initially + */ + void addProperty(QString name, QString defaultValue =3D ""); + + /** + * \return list of all properties, ordered in display order + */ + QList properties() const; + + /** + * \return default value for property \p name + */ + QVariant propertyDefaultValue(QString name) const; + + /** + * \return true if this property is visible, otherwise false. + */ + bool isPropertyVisible(QString name) const; + + /** + * Set visibility of property \p name to \p visible. + */ + void setPropertyVisible(QString name, bool visible); + public slots: /** * Set name of the data type. @@ -128,6 +157,21 @@ signals: */ void nameChanged(const QString& name); = + /** + * Emitted when new property was created. + */ + void propertyAdded(const QString& name, const QVariant& defaultValue); + + /** + * Emitted when property was removed. + */ + void propertyRemoved(const QString& name); + + /** + * Emitted when either the visibility or the order of propeties was ch= anged. + */ + void propertyListChanged(); + protected: /** * \internal diff --git a/src/Core/Modifiers/ValueModifier.cpp b/src/Core/Modifiers/Valu= eModifier.cpp index d0427fe..6bf21fe 100644 --- a/src/Core/Modifiers/ValueModifier.cpp +++ b/src/Core/Modifiers/ValueModifier.cpp @@ -41,9 +41,9 @@ ValueModifier::~ValueModifier() void ValueModifier::enumerate(QList dataList, int start, bool ove= rrideValues =3D true) { for (int i =3D 0; i < dataList.size(); i++) { - if (!overrideValues && !dataList[i]->value().isNull()) + if (!overrideValues && !dataList[i]->property("value").isNull()) return; - dataList[i]->setValue(QString::number(start++)); + dataList[i]->setProperty("value", QString::number(start++)); } } = @@ -70,9 +70,9 @@ void ValueModifier::assignRandomIntegers(QList d= ataList, int lowerLimit boost::variate_generator > die(g= en, distribution); = for (int i =3D 0; i < dataList.size(); i++) { - if (!overrideValues && !dataList[i]->value().isNull()) + if (!overrideValues && !dataList[i]->property("value").isNull()) return; - dataList[i]->setValue(QString::number(die())); + dataList[i]->setProperty("value", QString::number(die())); } } = @@ -108,9 +108,9 @@ void ValueModifier::assignRandomReals(QList da= taList, qreal lowerLimit, boost::variate_generator > die(= gen, distribution); = for (int i =3D 0; i < dataList.size(); i++) { - if (!overrideValues && !dataList[i]->value().isNull()) + if (!overrideValues && !dataList[i]->property("value").isNull()) return; - dataList[i]->setValue(QString::number(die())); + dataList[i]->setProperty("value", QString::number(die())); } } = diff --git a/src/GraphicsItem/DataItem.cpp b/src/GraphicsItem/DataItem.cpp index 4584204..77a504f 100644 --- a/src/GraphicsItem/DataItem.cpp +++ b/src/GraphicsItem/DataItem.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include = QMap DataItem::_sharedRenderers; @@ -58,33 +59,29 @@ void DataItem::removeSharedRenderer(QString iconPackage) DataItem::DataItem(DataPtr n) : QGraphicsSvgItem(0) , _data(n) - , _name(0) - , _value(0) , _colorizer(0) , _font(QFont("Helvetica [Cronyx]", 12)) , _oldStyle(GraphicsLayout::self()->viewStyleDataNode()) + , _item(new QGraphicsItemGroup()) , _originalWidth(n->width()) , _oldDataType(n->dataStructure()->document()->dataType(n->dataType())) { = connect(n.get(), SIGNAL(removed()), this, SLOT(deleteLater())); connect(_oldDataType.get(), SIGNAL(iconChanged(QString)), this, SLOT(u= pdateIcon())); - connect(n.get(), SIGNAL(nameChanged(QString)), this, SLOT(updateName()= )); - connect(n.get(), SIGNAL(valueChanged(QVariant)), this, SLOT(updateValu= e())); + + connect(n.get(), SIGNAL(propertyAdded(QString)), this, SLOT(registerPr= operty(QString))); + connect(n.get(), SIGNAL(propertyRemoved(QString)), this, SLOT(removePr= operty(QString))); + connect(n.get(), SIGNAL(propertyChanged(QString)), this, SLOT(updatePr= operty(QString))); + connect(GraphicsLayout::self(), SIGNAL(changed()), this, SLOT(updatePr= opertyList())); + connect(n.get(), SIGNAL(colorChanged(QColor)), this, SLOT(updateColor(= ))); connect(n.get(), SIGNAL(posChanged(QPointF)), this, SLOT(updatePos())); - connect(n.get(), SIGNAL(nameVisibilityChanged(bool)), this, SLOT(updat= eName())); - connect(n.get(), SIGNAL(valueVisibilityChanged(bool)), this, SLOT(upda= teValue())); connect(n.get(), SIGNAL(visibilityChanged(bool)), this, SLOT(updateVis= ibility(bool))); connect(n.get(), SIGNAL(useColorChanged(bool)), this, SLOT(updateColor= ())); connect(n.get(), SIGNAL(widthChanged(double)), this, SLOT(updateSize()= )); connect(n.get(), SIGNAL(dataTypeChanged(int)), this, SLOT(setupNode())= ); = - connect(GraphicsLayout::self(), SIGNAL(changed()), this, SLOT(updateNa= me())); - connect(GraphicsLayout::self(), SIGNAL(changed()), this, SLOT(updateVa= lue())); - connect(n.get(), SIGNAL(valueVisibilityChanged(bool)), this, SLOT(upda= teName())); - connect(n.get(), SIGNAL(nameVisibilityChanged(bool)), this, SLOT(updat= eValue())); - setCacheMode(QGraphicsItem::DeviceCoordinateCache); setZValue(1); setFlag(ItemIsSelectable, true); @@ -93,8 +90,11 @@ DataItem::DataItem(DataPtr n) = DataItem::~DataItem() { - delete _name; - delete _value; + foreach (QString name, _propertyValues.keys()) { + delete _propertyValues[name]; + } + _propertyValues.clear(); + delete _item; } = void DataItem::setupNode() @@ -105,13 +105,15 @@ void DataItem::setupNode() connect(_oldDataType.get(), SIGNAL(iconChanged(QString)), this, SL= OT(updateIcon())); } = - updateName(); - updateValue(); + foreach (QString name, _data->properties()) { + updateProperty(name); + } updateRenderer(); updateIcon(); updateColor(); updateSize(); updatePos(); + updatePropertyList(); update(); } = @@ -119,8 +121,6 @@ void DataItem::updatePos() { int fixPos =3D boundingRect().width() / 2; setPos(_data->x() - fixPos, _data->y() - fixPos); - updateName(); - updateValue(); } = void DataItem::updateSize() @@ -131,8 +131,6 @@ void DataItem::updateSize() resetTransform(); _width =3D _data->width(); setScale(_data->width()); - updateName(); - updateValue(); } = void DataItem::updateRenderer() @@ -160,12 +158,18 @@ void DataItem::updateVisibility(bool visible) { if (visible =3D=3D true) { this->show(); - _name->setVisible(_data->isNameVisible()); - _value->setVisible(_data->isValueVisible()); + QMap::const_iterator iter =3D _= propertyValues.constBegin(); + while (iter !=3D _propertyValues.constEnd()) { + (*iter)->setVisible(true); + ++iter; + } } else { this->hide(); - _value->setVisible(false); - _name->setVisible(false); + QMap::const_iterator iter =3D _= propertyValues.constBegin(); + while (iter !=3D _propertyValues.constEnd()) { + (*iter)->setVisible(false); + ++iter; + } } } = @@ -176,8 +180,6 @@ void DataItem::updateColor() if (!_data->isColored()) { delete _colorizer; setGraphicsEffect(0); - _name->setBrush(QBrush(Qt::black)); - _value->setBrush(QBrush(Qt::black)); _colorizer =3D 0; return; } @@ -186,54 +188,104 @@ void DataItem::updateColor() _colorizer =3D new QGraphicsColorizeEffect(); _colorizer->setColor(c); setGraphicsEffect(_colorizer); - _name->setBrush(QBrush(c)); - _value->setBrush(QBrush(c)); } = -void DataItem::updateName() +void DataItem::updateProperty(QString name) { - if (!_name) { - _name =3D new QGraphicsSimpleTextItem(i18n("%1", _data->name())); - _name->setFlags(ItemIgnoresTransformations); - _name->setFont(_font); - _name->setZValue(zValue() + 1); - } else if (_name->text() !=3D _data->name()) { - _name->setText(i18n("%1", _data->name())); - } - - int style =3D GraphicsLayout::self()->viewStyleDataNode(); - - qreal dataWidth =3D boundingRect().width() * scale(); - - qreal x =3D pos().x(); - if (style =3D=3D ConfigureDefaultProperties::CENTER) { - x +=3D ((dataWidth > _name->boundingRect().width() + 10) - ? ((dataWidth - _name->boundingRect().width()) / 4) - : dataWidth + 30); + if (!_propertyValues.contains(name)) { + registerProperty(name); + return; } + _propertyValues[name]->setText(data()->property(name.toStdString().c_s= tr()).toString()); + _propertyValues[name]->update(); +} = - qreal y =3D pos().y() + ((style =3D=3D ConfigureDefaultProperties::AB= OVE) ? + 15 - (dataWidth / 2) - : (style =3D=3D ConfigureDefaultProperties::BE= LOW) ? 25 + (dataWidth / 2) - : 0); - - _name->setVisible(_data->isNameVisible()); +QGraphicsItem* DataItem::propertyListItem() const +{ + return _item; +} = - if (_value && _value->isVisible()) { - y +=3D ((style =3D=3D ConfigureDefaultProperties::ABOVE) ? -20 : = 20); +void DataItem::updatePropertyList() +{ + qreal offset =3D 0; + foreach (QString property, data()->properties()) { + if (!_propertyValues.contains(property)) { + kError() << "Cannot update unknown property : " << property; + continue; + } + _propertyValues[property]->setPos(data()->x()+20, data()->y() + of= fset); + _propertyValues[property]->setVisible(true); + _propertyValues[property]->update(); + + offset +=3D 20; } - _name->setPos(x, y); } = -QGraphicsSimpleTextItem* DataItem::name() const +void DataItem::registerProperty(QString name) { - return _name; + if (_propertyValues.contains(name)) { + return; + } + // do not show property if it is not a type property + if (!_data->properties().contains(name)) { + return; + } + _propertyValues.insert(name, new QGraphicsSimpleTextItem(data()->prope= rty(name.toStdString().c_str()).toString())); + _propertyValues[name]->setFlags(ItemIgnoresTransformations); + _propertyValues[name]->setFont(_font); + _propertyValues[name]->setZValue(zValue() + 1); + _item->addToGroup(_propertyValues[name]); + + updatePropertyList(); } = -QGraphicsSimpleTextItem* DataItem::value() const +void DataItem::removeProperty(QString name) { - return _value; + if (_propertyValues.contains(name)) { + kWarning() << "Property not removed: not registered at DataItem."; + return; + } + delete _propertyValues[name]; + _propertyValues.remove(name); + _item->removeFromGroup(_propertyValues[name]); + + updatePropertyList(); } = +// void DataItem::updateName() +// { +// if (!_name) { +// _name =3D new QGraphicsSimpleTextItem(i18n("%1", _data->name())= ); +// _name->setFlags(ItemIgnoresTransformations); +// _name->setFont(_font); +// _name->setZValue(zValue() + 1); +// } else if (_name->text() !=3D _data->name()) { +// _name->setText(i18n("%1", _data->name())); +// } +// +// int style =3D GraphicsLayout::self()->viewStyleDataNode(); +// +// qreal dataWidth =3D boundingRect().width() * scale(); +// +// qreal x =3D pos().x(); +// if (style =3D=3D ConfigureDefaultProperties::CENTER) { +// x +=3D ((dataWidth > _name->boundingRect().width() + 10) +// ? ((dataWidth - _name->boundingRect().width()) / 4) +// : dataWidth + 30); +// } +// +// qreal y =3D pos().y() + ((style =3D=3D ConfigureDefaultProperties:= :ABOVE) ? + 15 - (dataWidth / 2) +// : (style =3D=3D ConfigureDefaultProperties:= :BELOW) ? 25 + (dataWidth / 2) +// : 0); +// +// _name->setVisible(_data->isNameVisible()); +// +// if (_value && _value->isVisible()) { +// y +=3D ((style =3D=3D ConfigureDefaultProperties::ABOVE) ? -20 = : 20); +// } +// _name->setPos(x, y); +// } +/* void DataItem::updateValue() { if (!_value) { @@ -266,4 +318,4 @@ void DataItem::updateValue() = _value->setPos(x, y); _value->setVisible(_data->isValueVisible()); -} +}*/ diff --git a/src/GraphicsItem/DataItem.h b/src/GraphicsItem/DataItem.h index 62529ad..94cfc25 100644 --- a/src/GraphicsItem/DataItem.h +++ b/src/GraphicsItem/DataItem.h @@ -31,6 +31,7 @@ class Data; class QGraphicsColorizeEffect; class QSvgRenderer; +class QGraphicsItem; class QGraphicsSimpleTextItem; = class ROCSLIB_EXPORT DataItem : public QGraphicsSvgItem @@ -46,30 +47,35 @@ public: static QSvgRenderer* sharedRenderer(QString iconPackage); static QSvgRenderer* registerSharedRenderer(QString iconPackage); static void removeSharedRenderer(QString iconPackage); - QGraphicsSimpleTextItem *name() const; - QGraphicsSimpleTextItem *value() const; + + /** + * \return the graphics item to be displayed at the scene + */ + QGraphicsItem *propertyListItem() const; void remove(); = private slots: void setupNode(); void updateRenderer(); void updateIcon(); - void updateName(); - void updateValue(); + void updateProperty(QString name); + void updatePropertyList(); void updateColor(); void updateVisibility(bool visible); void updatePos(); void updateSize(); + void registerProperty(QString name); + void removeProperty(QString name); = private: static QMap _sharedRenderers; DataPtr _data; - QGraphicsSimpleTextItem *_name; - QGraphicsSimpleTextItem *_value; + QMap _propertyValues; QGraphicsColorizeEffect *_colorizer; QGraphicsRectItem *_boundingRect; QFont _font; int _oldStyle; + QGraphicsItemGroup* _item; = qreal _originalWidth; qreal _width; diff --git a/src/GraphicsItem/GraphicsLayout.cpp b/src/GraphicsItem/Graphic= sLayout.cpp index e11faa6..ea54dd0 100644 --- a/src/GraphicsItem/GraphicsLayout.cpp +++ b/src/GraphicsItem/GraphicsLayout.cpp @@ -50,9 +50,9 @@ void GraphicsLayout::setViewStyleDataNode(int style) _viewStyleDataNode =3D style; QList< DataStructurePtr > dsList =3D DocumentManager::self()->activeDo= cument()->dataStructures(); foreach(DataStructurePtr ds, dsList) { - foreach(int identifier, ds->document()->dataTypeList()) { - // update all data elements - ds->setDataNameVisibility(ds->isDataNameVisible(identifier), i= dentifier); + foreach(int identifier, ds->document()->pointerTypeList()) { + // update all pointers + ds->setDataVisibility(ds->isDataVisible(identifier), identifie= r); } } emit changed(); diff --git a/src/Interface/DataPropertiesWidget.cpp b/src/Interface/DataPro= pertiesWidget.cpp index 9cf459a..03811c1 100644 --- a/src/Interface/DataPropertiesWidget.cpp +++ b/src/Interface/DataPropertiesWidget.cpp @@ -125,10 +125,10 @@ void DataPropertiesWidget::reflectAttributes() } = ui->_color->setColor(_data->color().value()); - ui->_name->setText(_data->name()); - ui->_value->setText(_data->value().toString()); - ui->_showName->setChecked(_data->isNameVisible()); - ui->_showValue->setChecked(_data->isValueVisible()); +// ui->_name->setText(_data->name()); +// ui->_value->setText(_data->value().toString()); +// ui->_showName->setChecked(_data->isNameVisible()); +// ui->_showValue->setChecked(_data->isValueVisible()); ui->_enableColor->setChecked(_data->isColored()); = DataTypePtr dataType =3D _data->dataStructure()->document()->dataType(= _data->dataType()); diff --git a/src/Interface/VisualEditor/GraphScene.cpp b/src/Interface/Visu= alEditor/GraphScene.cpp index 956cde4..841bfc8 100644 --- a/src/Interface/VisualEditor/GraphScene.cpp +++ b/src/Interface/VisualEditor/GraphScene.cpp @@ -190,8 +190,7 @@ QGraphicsItem *GraphScene::createData(DataPtr n) { DataItem *nItem =3D (DataItem*)(DataStructurePluginManager::self()->da= taItem(n)); addItem(nItem); - addItem(nItem->name()); - addItem(nItem->value()); + addItem(nItem->propertyListItem()); return nItem; } = @@ -279,8 +278,9 @@ void GraphScene::contextMenuEvent(QGraphicsSceneContext= MenuEvent* event) = void GraphScene::updateGraph(DataStructurePtr g) { + //FIXME this is a workaround to trigger updates foreach(DataPtr n, g->dataList()) { - n->setName(n->name()); + n->setColor(n->color()); } = foreach(PointerPtr e, g->pointers()) { diff --git a/src/LoadSave/Plugins/dotFileFormat/DotFileFormatPlugin.cpp b/s= rc/LoadSave/Plugins/dotFileFormat/DotFileFormatPlugin.cpp index fdeba16..267ad07 100644 --- a/src/LoadSave/Plugins/dotFileFormat/DotFileFormatPlugin.cpp +++ b/src/LoadSave/Plugins/dotFileFormat/DotFileFormatPlugin.cpp @@ -181,7 +181,7 @@ QString const DotFileFormatPlugin::processNode(DataPtr = node) const = // use identifier for unique identification, store name as argument "l= abel" nodeStr =3D QString("%1").arg(node->identifier()); - nodeStr.append(QString(" [label=3D%1 ").arg(node->name())); + nodeStr.append(QString(" [label=3D%1 ").arg(node->property("name").toS= tring())); = foreach(const QByteArray& property, node->dynamicPropertyNames()) { nodeStr.append(", "); diff --git a/src/LoadSave/Plugins/dotFileFormat/DotGraphParsingHelper.cpp b= /src/LoadSave/Plugins/dotFileFormat/DotGraphParsingHelper.cpp index 00bc231..fe6588d 100644 --- a/src/LoadSave/Plugins/dotFileFormat/DotGraphParsingHelper.cpp +++ b/src/LoadSave/Plugins/dotFileFormat/DotGraphParsingHelper.cpp @@ -202,7 +202,7 @@ void DotGraphParsingHelper::createPointers() DataPtr to =3D dataMap[toId]; = currentPointerPtr =3D dataStructure->addPointer(from, to); - kDebug() << "Creating new pointer: " << from->name() << " -> " << = to->name(); + kDebug() << "Creating new pointer: " << from->identifier() << " ->= " << to->identifier(); setPointerAttributes(); = fromId =3D toId; diff --git a/src/LoadSave/Plugins/gmlFileFormat/GmlFileFormatPlugin.cpp b/s= rc/LoadSave/Plugins/gmlFileFormat/GmlFileFormatPlugin.cpp index 6cd9d41..02e3066 100644 --- a/src/LoadSave/Plugins/gmlFileFormat/GmlFileFormatPlugin.cpp +++ b/src/LoadSave/Plugins/gmlFileFormat/GmlFileFormatPlugin.cpp @@ -108,7 +108,7 @@ void GmlFileFormatPlugin::writeFile(Document& document) out << QString("id \"%1\" \n").arg(graph->name()); = foreach(DataPtr n, graph->dataListAll()) { - out << QString("node [\n id \"%1\" \n").arg(n->name()); + out << QString("node [\n id \"%1\" \n").arg(n->property("name"= ).toString()); // foreach (QByteArray p, n->dynamicPropertyNames()){ // out << p << " " << n->property(p).toString() << "\n"; // } @@ -135,7 +135,7 @@ void GmlFileFormatPlugin::writeFile(Document& document) QString const GmlFileFormatPlugin::processEdge(PointerPtr e) const { QString edge; - edge.append(QString("source \"%1\"\n target \"%2\"\n").arg(e->from()->= name(), e->to()->name())); + edge.append(QString("source \"%1\"\n target \"%2\"\n").arg(e->from()->= property("name").toString(), e->to()->property("name").toString())); if (!e->name().isEmpty()) { edge.append(QString(" id \"%1\"\n").arg(e->name())); } @@ -158,7 +158,7 @@ QString const GmlFileFormatPlugin::processNode(DataPtr = n) const node.append(QString(" x %1 \n y %2 \n").arg(n->x()).arg(n->y())); node.append(QString(" width %1\n").arg(n->width())); // node.append (QString(" color \"%1\"\n").arg(n->color())); //Probl= em with comments (both starts by '#') - node.append(QString(" value \"%1\"\n").arg(n->value().toString())); + node.append(QString(" value \"%1\"\n").arg(n->property("value").toStri= ng())); node.append(QString(" iconPackage \"%1\"\n").arg(n->dataStructure()->d= ocument()->iconPackage())); node.append(QString(" icon \"%1\"\n").arg(n->icon())); = diff --git a/src/LoadSave/Plugins/kmlFileFormat/KmlFileFormatPlugin.cpp b/s= rc/LoadSave/Plugins/kmlFileFormat/KmlFileFormatPlugin.cpp index fcd647d..095519e 100644 --- a/src/LoadSave/Plugins/kmlFileFormat/KmlFileFormatPlugin.cpp +++ b/src/LoadSave/Plugins/kmlFileFormat/KmlFileFormatPlugin.cpp @@ -82,7 +82,7 @@ void KmlFileFormatPlugin::writeFile(Document& document) foreach(DataPtr n, graph->dataList()) { xmlWriter.writeStartElement("Placemark"); xmlWriter.writeStartElement("name"); - xmlWriter.writeCharacters(n->name()); + xmlWriter.writeCharacters(n->property("name").toString()); if (n->property("description").isValid()) { xmlWriter.writeCharacters(n->property("description").toStr= ing()); } @@ -103,7 +103,7 @@ void KmlFileFormatPlugin::writeFile(Document& document) xmlWriter.writeStartElement("Placemark"); xmlWriter.writeStartElement("name"); { - QString s =3D graph->dataList().at(0)->name(); + QString s =3D graph->dataList().at(0)->property("name").toStri= ng(); s.chop(2); xmlWriter.writeCharacters(s); } diff --git a/src/LoadSave/Plugins/tgfFileFormat/Tests/TestTgfFileFormatPlug= in.cpp b/src/LoadSave/Plugins/tgfFileFormat/Tests/TestTgfFileFormatPlugin.c= pp index 5253f55..eae383e 100644 --- a/src/LoadSave/Plugins/tgfFileFormat/Tests/TestTgfFileFormatPlugin.cpp +++ b/src/LoadSave/Plugins/tgfFileFormat/Tests/TestTgfFileFormatPlugin.cpp @@ -75,7 +75,7 @@ void TestTgfFileFormatPlugin::serializeUnserializeTest() QVERIFY2(n->adjacentDataList().size() =3D=3D 2, "ERROR: Number of = Adjacent Nodes is not 2"); QVERIFY2(n->pointerList().size() =3D=3D 2, "ERROR: Number of adjac= ent pointers is not 2"); } - QVERIFY(ds->dataList().at(0)->name() =3D=3D "first node"); + QVERIFY(ds->dataList().at(0)->property("name").toString() =3D=3D "firs= t node"); QVERIFY(ds->pointers().at(0)->value() =3D=3D "test value"); } = diff --git a/src/LoadSave/Plugins/tgfFileFormat/TgfFileFormatPlugin.cpp b/s= rc/LoadSave/Plugins/tgfFileFormat/TgfFileFormatPlugin.cpp index bf0c4e0..dd123d2 100644 --- a/src/LoadSave/Plugins/tgfFileFormat/TgfFileFormatPlugin.cpp +++ b/src/LoadSave/Plugins/tgfFileFormat/TgfFileFormatPlugin.cpp @@ -134,7 +134,7 @@ void TgfFileFormatPlugin::writeFile(Document &graph ) foreach(DataPtr n, g->dataList()) { out << n->identifier(); out << " "; - out << n->name(); + out << n->property("name").toString(); //TODO change to selectable= property out << '\n'; } out << "#\n"; diff --git a/src/LoadSave/Plugins/tikzFileFormat/TikzFileFormatPlugin.cpp b= /src/LoadSave/Plugins/tikzFileFormat/TikzFileFormatPlugin.cpp index 378116b..e70f065 100644 --- a/src/LoadSave/Plugins/tikzFileFormat/TikzFileFormatPlugin.cpp +++ b/src/LoadSave/Plugins/tikzFileFormat/TikzFileFormatPlugin.cpp @@ -114,8 +114,8 @@ void TikzFileFormatPlugin::writeFile(Document &graph) arg(n->identifier()). arg(n->x()/resize). arg(n->y()*(-1)/resize). - arg(n->name()). - arg(n->value().toString()); + arg(n->property("name").toString()). + arg(n->property("value").toString()); out << dataStr; out << '\n'; } diff --git a/src/LoadSave/RocsGraphFileFormatPlugin.cpp b/src/LoadSave/Rocs= GraphFileFormatPlugin.cpp index a3acb1c..06d0eef 100644 --- a/src/LoadSave/RocsGraphFileFormatPlugin.cpp +++ b/src/LoadSave/RocsGraphFileFormatPlugin.cpp @@ -206,7 +206,6 @@ void RocsGraphFileFormatPlugin::readFile() tmpData =3D tmpDataStructure->addData(name, 0); } if (tmpData) { - tmpData->setValue(value); tmpData->setColor(color); tmpData->setPos(posX, posY); = diff --git a/src/Models/model_GraphProperties.cpp b/src/Models/model_GraphP= roperties.cpp index ea0182a..c05199e 100644 --- a/src/Models/model_GraphProperties.cpp +++ b/src/Models/model_GraphProperties.cpp @@ -40,7 +40,6 @@ int GraphPropertiesModel::rowCount(const QModelIndex &par= ent) const if (_dataSource =3D=3D 0) { return 0; } - kDebug() << _dataSource->dynamicPropertyNames().size(); return _dataSource->dynamicPropertyNames().size(); } = @@ -138,8 +137,8 @@ bool GraphPropertiesModel::setData(const QModelIndex &i= ndex, const QVariant &val const char* propertyName =3D _dataSource->dynamicPropertyNames()[index.ro= w()]; if (index.column() =3D=3D 0 && value.toString() =3D=3D QString(propertyNa= me) ){ return false; - } = - = + } + switch (index.column()) { /* Change name. DinamicPropertiesList take part" = name new name object */ case 0: DynamicPropertiesList::New()->changePropertyName(QString(_= dataSource->dynamicPropertyNames()[index.row()]), value.toString(), _dataSo= urce); break; diff --git a/src/Plugins/DataStructure/Graph/GraphStructure.cpp b/src/Plugi= ns/DataStructure/Graph/GraphStructure.cpp index 34e2ce2..7e1985d 100644 --- a/src/Plugins/DataStructure/Graph/GraphStructure.cpp +++ b/src/Plugins/DataStructure/Graph/GraphStructure.cpp @@ -61,9 +61,9 @@ void Rocs::GraphStructure::importStructure(DataStructureP= tr other) setGraphType(Graph); QHash dataTodata; foreach(DataPtr n, other->dataList()) { - DataPtr newdata =3D addData(n->name()); + DataPtr newdata =3D addData(""); //n->name()); newdata->setColor(n->color()); - newdata->setValue(n->value()); + newdata->setProperty("value", n->property("value").toString()); newdata->setX(n->x()); newdata->setY(n->y()); newdata->setWidth(n->width()); @@ -373,7 +373,7 @@ DataPtr Rocs::GraphStructure::addData(QString name, int= dataType) boost::shared_ptr n =3D boost::static_pointer_cast( GraphNode::create(getDataStructur= e(), generateUniqueIdentifier(), dataType) ); - n->setName(name); + n->setProperty("name", name); return addData(n, dataType); } = diff --git a/src/Plugins/DataStructure/LinkedList/ListPlugin.cpp b/src/Plug= ins/DataStructure/LinkedList/ListPlugin.cpp index 4ef3f0d..c72f5d9 100644 --- a/src/Plugins/DataStructure/LinkedList/ListPlugin.cpp +++ b/src/Plugins/DataStructure/LinkedList/ListPlugin.cpp @@ -83,7 +83,7 @@ QLayout* Rocs::ListPlugin::nodeExtraProperties(DataPtr no= de, QWidget* parentWidg KLineEdit *_valueLine =3D new KLineEdit(parentWidget); _valueLine->setReadOnly(true); if (node->outPointerList().count() =3D=3D 1) { - _valueLine->setText(node->outPointerList().at(0)->to()->value().to= String()); + _valueLine->setText(node->outPointerList().at(0)->to()->property("= value").toString()); } lay->addWidget(_value, 0, 0); lay->addWidget(_valueLine, 0, 1); @@ -97,7 +97,7 @@ bool ListPlugin::canConvertFrom(Document* doc) const foreach(DataStructurePtr ds, doc->dataStructures()) { foreach(DataPtr data, ds->dataList()) { if (data->outPointerList().count() > 1) - errors.append(i18n("Data \'%1\' has more than one out poin= ter.", data->name())); + errors.append(i18n("Data \'%1\' has more than one out poin= ter.", data->identifier())); } } = diff --git a/src/Plugins/DataStructure/LinkedList/ListStructure.cpp b/src/P= lugins/DataStructure/LinkedList/ListStructure.cpp index a18cdc1..43e8186 100644 --- a/src/Plugins/DataStructure/LinkedList/ListStructure.cpp +++ b/src/Plugins/DataStructure/LinkedList/ListStructure.cpp @@ -55,9 +55,9 @@ void Rocs::ListStructure::importStructure(DataStructurePt= r other) m_building =3D true; QHash < Data*, DataPtr > dataTodata; foreach(DataPtr n, other->dataList()) { - DataPtr newdata =3D addData(n->name()); + DataPtr newdata =3D addData(""); //n->name()); newdata->setColor(n->color()); - newdata->setValue(n->value()); + newdata->setProperty("value", n->property("value").toString()); newdata->setX(n->x()); newdata->setY(n->y()); newdata->setWidth(n->width()); @@ -109,7 +109,7 @@ DataPtr Rocs::ListStructure::addData(QString name, int = dataType) boost::shared_ptr n =3D boost::static_pointer_cast( ListNode::create(getDataStructure(= ), generateUniqueIdentifier(), dataType) ); - n->setName(name); + n->setProperty("name", name); = if (m_building) { return addData(n, dataType);; @@ -167,7 +167,7 @@ QScriptValue Rocs::ListStructure::createNode(const QStr= ing & name) boost::shared_ptr n =3D boost::static_pointer_cast( DataStructure::addData(ListNode::c= reate(getDataStructure(), generateUniqueIdentifier(), 0)) ); - n->setName(name); + n->setProperty("name", name); n->setEngine(engine()); arrangeNodes(); return n->scriptValue(); diff --git a/src/Plugins/DataStructure/RootedTree/RootedTreePlugin.cpp b/sr= c/Plugins/DataStructure/RootedTree/RootedTreePlugin.cpp index 82348ca..1821b90 100644 --- a/src/Plugins/DataStructure/RootedTree/RootedTreePlugin.cpp +++ b/src/Plugins/DataStructure/RootedTree/RootedTreePlugin.cpp @@ -112,7 +112,7 @@ bool RootedTreePlugin::canConvertFrom(Document* doc) co= nst foreach ( DataPtr n, c->adjacentDataList()){ if (visited.contains(n.get())){ if (!cycles.contains(n.get())){ - errors << i18n("There are cycles at node %1. D= ata will be lost by conversion.", n->isNameVisible()); + errors << i18n("There are cycles at node %1. D= ata will be lost by conversion.", n->identifier()); cycles.insert(n.get()); } }else{ diff --git a/src/Plugins/DataStructure/RootedTree/RootedTreeStructure.cpp b= /src/Plugins/DataStructure/RootedTree/RootedTreeStructure.cpp index 76c0183..07642c2 100644 --- a/src/Plugins/DataStructure/RootedTree/RootedTreeStructure.cpp +++ b/src/Plugins/DataStructure/RootedTree/RootedTreeStructure.cpp @@ -78,9 +78,9 @@ void RootedTreeStructure::importStructure(DataStructurePt= r other) queue.enqueue(dataOther); = // add data element to tree and register mapping - DataPtr dataTree =3D addData(dataOther->name(), 0); + DataPtr dataTree =3D addData(dataOther->property("name").toString(= ), 0); dataTree->setColor(dataOther->color()); - dataTree->setValue(dataOther->value()); + dataTree->setProperty("value", dataOther->property("value").toStri= ng()); dataTree->setX(dataOther->x()); dataTree->setY(dataOther->y()); dataTree->setWidth(dataOther->width()); @@ -106,9 +106,9 @@ void RootedTreeStructure::importStructure(DataStructure= Ptr other) if (!visited.contains(adjacentData.get())){ visited.insert(adjacentData.get()); queue.enqueue(adjacentData); - DataPtr childdata =3D addData(adjacentData->name(), 0); + DataPtr childdata =3D addData(adjacentData->property("= name").toString(), 0); childdata->setColor(adjacentData->color()); - childdata->setValue(adjacentData->value()); + childdata->setProperty("value", adjacentData->property= ("value").toString()); childdata->setX(adjacentData->x()); childdata->setY(adjacentData->y()); childdata->setWidth(adjacentData->width()); @@ -198,7 +198,7 @@ DataPtr RootedTreeStructure::addData(QString name, int = dataType) { boost::shared_ptr n =3D boost::static_pointer_cast( RootedTreeNode::create(getDataStructure(), generateUniqueIdentifier(),= dataType) ); - n->setName(name); + n->setProperty("name", name); return addData(n); } =20