Change the uri of existing media or color paint with double-click

When double-clicking a paint QListWidgetItem, the uri of that paint can be
altered.

A new signal is sent to ColorMapper and TextureMapper objects so that they can
update heir color and texture paints respectively. Mappings of the old paint are
transferred to the new paint.

TODO: the active mapping may be lost in some cases, needs some more testing.
This commit is contained in:
Vasilis Liaskovitis
2014-05-22 11:30:25 +02:00
parent 1da6d0479a
commit 1aace8a578
9 changed files with 133 additions and 32 deletions
+19
View File
@@ -71,6 +71,25 @@ bool MappingManager::removePaint(uid paintId)
return true;
}
return false;
}
bool MappingManager::replacePaintMappings(Paint::ptr oldpaint, Paint::ptr newpaint)
{
// Make sure the paint to which this paint refers to exists in the manager.
if (oldpaint && newpaint)
{
QMap<uid, Mapping::ptr> paintMappings = getPaintMappings(oldpaint);
for (QMap<uid, Mapping::ptr>::const_iterator it = paintMappings.constBegin();
it != paintMappings.constEnd(); ++it) {
Mapping::ptr mapping = it.value();
mapping->setPaint(newpaint);
}
return true;
}
return false;
}