mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-05 10:34:13 +02:00
Keep terminal uuids when a whole category is replaced; never duplicate one
Review of the previous commit: - keep() could give an old uuid to a new terminal while another terminal of the new definition already carried it (a moved terminal), leaving two terminals with one uuid. A terminal carrying any old uuid is now left alone, and an old uuid already in use is never handed out. - copyDirectory() replaced a whole category of the embedded collection (drag a folder onto the project's folder of the same name) without carrying terminal uuids over. keepInDirectory() walks both trees by name and calls keep() on each symbol. - The "wire(s) not loaded" log line repeated the folio's list on every paste; it is now written only when a folio is loaded. tst_terminaluuids: 3 new cases, each red on the previous keep(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -870,6 +870,15 @@ ElementsLocation XmlElementCollection::copyDirectory(
|
||||
created_location.setPath(destination.projectCollectionPath() % "/" % new_dir_name);
|
||||
}
|
||||
|
||||
//The symbols of the replaced directory keep their terminal uuids,
|
||||
//see TerminalUuids::keep()
|
||||
if (!element.isNull()) {
|
||||
QDomElement new_dir_dom = directory(created_location.collectionPath(false));
|
||||
if (!new_dir_dom.isNull()) {
|
||||
TerminalUuids::keepInDirectory(element, new_dir_dom);
|
||||
}
|
||||
}
|
||||
|
||||
emit directorieAdded(created_location.collectionPath(false));
|
||||
return created_location;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user