18 #include "PropertiesViewPlugin.h"
19 #include "core/modules/LanguageControl.h"
21 #include <QDockWidget>
29 connect( window, SIGNAL(propertyChanged(QString, QString)),
30 this, SLOT(updateCurrentEntityAttr(QString, QString)) );
45 QString line =
"<" + entity->getType() +
"> </" + entity->getType() +
">\n";
50 qDebug() <<
"PropertiesViewPlugin::onEntityAddError(" << error <<
")";
55 QString line =
"PLUGIN (" + pluginID +
") changed the Entity (" +
56 entity->getType() +
" - " + entity->getUniqueId() +
")";
58 if(entity != NULL && currentEntity != NULL)
60 if(entity->getUniqueId() == currentEntity->getUniqueId())
61 updateCurrentEntity();
67 QString line =
"PLUGIN (" + pluginID +
") removed Entity (" +
70 if(entityID == currentEntityId)
97 QString *
id = (QString*) param;
98 if(
id != NULL && *
id !=
"") {
99 currentEntity =
project->getEntityById(*
id);
100 currentEntityId = *id;
103 if(currentEntity != NULL)
105 window->
setTagname(currentEntity->getType(),
"");
106 updateCurrentEntity();
112 void PropertiesViewPlugin::updateCurrentEntity(QString errorMessage)
115 if( currentEntity->hasAttribute(
"id") )
116 name = currentEntity->getAttribute(
"id");
117 else if(currentEntity->hasAttribute(
"name"))
118 name = currentEntity->getAttribute(
"name");
122 if(currentEntity->getType() != window->
getTagname())
123 window->
setTagname(currentEntity->getType(), name);
129 QMap <QString, QString>::iterator begin, end, it;
130 currentEntity->getAttributeIterator(begin, end);
131 for (it = begin; it != end; ++it)
137 void PropertiesViewPlugin::updateCurrentEntityAttr(QString attr, QString value)
139 if (currentEntity != NULL)
141 if(currentEntity->hasAttribute(attr) &&
142 currentEntity->getAttribute(attr) == value)
149 QMap <QString, QString> attrs;
150 QMap <QString, QString>::iterator begin, end, it;
151 currentEntity->getAttributeIterator(begin, end);
153 for (it = begin; it != end; ++it)
157 if(!value.isNull() && !value.isEmpty())
159 if(PropertyEditor::isURL(currentEntity->getType(), attr))
162 value = Utilities::relativePath(
project->getLocation(), value,
166 qDebug() <<
"Do not changing to a relative path";
169 attrs.insert(attr, value);
173 attrs.insert(it.key(), it.value());
176 if(!attrs.contains(attr))
178 if(!value.isNull() && !value.isEmpty() && value !=
"")
180 if(PropertyEditor::isURL(currentEntity->getType(), attr))
183 value = Utilities::relativePath(
project->getLocation(), value,
187 qDebug() <<
"Do not changing to a relative path";
190 attrs.insert(attr, value);
199 void PropertiesViewPlugin::validationError(QString pluginID,
void * param)
203 pair <QString , QString> *p = (pair <QString, QString> *) param;
205 QString uid = p->first;
207 if(currentEntity ==
project->getEntityById(uid))
208 updateCurrentEntity(p->second);