mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 21:34:12 +02:00
b3a4e30010
A wire saved without a uuid got a random one on every load, never saved (#754): it had no identity from one session to the next, so a script could only name it as "the wire on terminal N of symbol X", and a comparison of two versions could not tell a moved wire from a new one. When a folio is loaded, such a wire now gets a UUID v5 derived from its two ends -- the symbol and terminal at each, sorted so the direction it was drawn in does not matter -- and it is written on save. Never its place in the file or its folio's index: inserting or moving a folio, or saving the wires in another order, does not change it. Once saved the uuid no longer depends on the ends, so re-connecting the wire keeps it; QETProject::derivedItemUuid() never hands out a uuid the file already carries, so a wire later drawn on the ends it left gets another one. Wires that have a uuid keep it; a paste still renews them. The 24 example projects: 3,189 wires, none with a uuid before, all 3,189 after one save, none lost, no uuid used twice in any project; two saves of the same file are identical, and a second save keeps every wire's uuid. Discussion #1103 has the measurements behind the recipe. tst_derivedwireuuid runs --resave on a fixture naming ends by uuid and on examples/tremie_vibrante.qet (ends by terminal number): every wire gets a distinct uuid, the same on every load, read back after a save, kept per wire when a folio is inserted, the wires are reordered or a wire is drawn the other way, and a newcomer on a re-connected wire's old ends gets another uuid. Without this change 14 of the 18 fail; with the uuid taken from folio index and file order instead, the folio-insert and reorder tests fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>