Commit Graph

119 Commits

Author SHA1 Message Date
Laurent Trinques 7f7185172f Merge pull request #628 from ispyisail/feature-wiring-db-tables
Add terminal and conductor tables to projectDataBase (discussion #503, slice 2)
2026-08-21 14:03:02 +02:00
ispyisail ab159404a3 Give every terminal an identity, not only uuid-aware ones
The conductor table keyed on Terminal::uuid(), which comes from the catalog
.elmt definition and is empty for every element authored before that field
existed. A conductor was dropped unless *both* its terminals had one, so the
tables this slice adds were empty on almost every project in existence:

  examples corpus       conductor rows in the database
  industrial.qet        0 of 671
  affuteuse_250h.qet    0 of 263
  tremie_vibrante.qet   0 of 77
  741.qet               0 of 67

Across the 23 example projects, 16 of the 20 that contain conductors have
zero terminal uuids -- 2366 of 3002 conductors -- and overall coverage is
7.3%. Meanwhile --export-cables, already on master, lists all 671 conductors
of industrial.qet from the document. A feature that only works on newly
authored elements is not one users can rely on.

Terminal::stableUuid() returns the terminal's own uuid when it has one and
otherwise derives one from its local position and orientation inside its
element. That is not an invented scheme: it is what the project format
already does. TerminalData::fromXml() says so where it parses the field --
"if the attribute not exists, means, the element is created with an older
version of qet. So use the legacy approach to identify terminals" -- and the
legacy approach is the terminal's position. m_pos is read from the definition
and is not touched by moving the element on a folio, so the identity survives
loads, saves and folio moves. Derived values are UUID v5 in a fixed namespace,
so they are reproducible without being stored, and cannot collide with the v4
uuids the element editor generates.

Every project in the corpus now has exactly as many conductor rows as the
document has conductors -- 20 of 20 measured, 0 mismatches. (schema_indus.qet
is excluded: it blocks on a modal dialog at zero CPU under any CLI flag, the
pre-existing hang PR #661 addresses.)

Two things this deliberately does not key on:

- The terminal name. It is not stable: QET rewrites a terminal named "_" as
  unnamed, which would have silently changed the identity of 1421 of
  industrial.qet's 1790 terminals on their first resave. Measured across the
  corpus, dropping it costs nothing -- geometry alone yields exactly the same
  three collisions -- and it means renaming a terminal no longer changes what
  it is.

- Uniqueness in the face of a definition that declares two terminals at the
  same point and orientation. Three cases exist in the whole corpus. They
  merge to a single terminal row, which is harmless: two terminals identical
  in position and orientation are indistinguishable in every observable
  respect, and every conductor on either still resolves to the right element
  and terminal name. Both affected projects (industrial, perceuse) return
  their full conductor count.

The only conductor still skipped is one whose terminal has no parent element,
which has no identity to key on at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 20:42:21 +12:00
Kellermorph b3a4a41ad9 new Checkbox 2026-08-06 21:37:40 +02:00
Kellermorph 979df376d1 show terminalnames in export 2026-08-06 12:48:11 +02:00
Kellermorph 4c1f82f814 Fix-PLC-Manager 2026-07-31 21:02:07 +02:00
Kellermorph b025bd205d Implement slave contact groups — label transfer, terminal assignment and UI fixes 2026-07-17 09:47:32 +02:00
Kellermorph f62ce7e4ca Update terminal name 2026-07-10 14:36:47 +02:00
Kellermorph c884d32dbe Feature: Add terminal name label display in element editor 2026-07-09 14:02:27 +02:00
Laurent Trinques 14253930ae Merge pull request #509 from Kellermorph/master
Add Custom Guides
2026-07-07 16:34:56 +02:00
Shane Ringrose df5f622418 Fix TerminalData memory leak in Terminal destructor
Terminal stores its TerminalData* as member d but never deletes it.
Every Element creation (placing on diagram, loading icon for the
element browser, drag previews) leaks one TerminalData per terminal.
ASan confirmed 112 leaked objects (9856 bytes) in a short session
across four call sites all rooted in Element::parseTerminal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 00:38:07 +12:00
Kellermorph 4e0c075575 Fix grid and guide startup behavior and update german translation 2026-06-16 17:41:03 +02:00
Kellermorph 19704cf5ca Potential Isolation option for terminals 2026-05-27 21:20:50 +02:00
Laurent Trinques dbda958261 terminaldata: add No, Nc, Common types for SW contacts
Extend TerminalData::Type enum with three new semantic values:
- No     : Normally Open terminal of a switch (SW) contact
- Nc     : Normally Closed terminal of a switch (SW) contact
- Common : Common terminal of a switch (SW) contact

Update typeToString() and typeFromString() accordingly.
Fully backward compatible: existing Generic/Inner/Outer types
are unchanged. Elements without typed terminals fall back
to the previous behavior (first 2 named terminals).

terminal: expose terminalType() as public accessor

Add Terminal::terminalType() returning the TerminalData::Type
of this terminal. This allows crossrefitem and other consumers
to filter terminals by semantic role (No, Nc, Common) without
accessing TerminalData internals directly.

terminaleditor: add No, Nc, Common entries to type combobox

Expose the three new TerminalData types (No, Nc, Common) in
the element editor UI so users can assign a semantic role to
each terminal of a SW contact element.

Also fix a pre-existing bug in updateForm() where m_type_cb
was incorrectly using m_orientation_cb->findData() instead
of m_type_cb->findData(), preventing the type from being
restored correctly when selecting a terminal.

terminaleditor: add No, Nc, Common entries to type combobox

Expose the three new TerminalData types (No, Nc, Common) in
the element editor UI so users can assign a semantic role to
each terminal of a SW contact element.

Also fix a pre-existing bug in updateForm() where m_type_cb
was incorrectly using m_orientation_cb->findData() instead
of m_type_cb->findData(), preventing the type from being
restored correctly when selecting a terminal.
2026-05-23 02:09:32 +02:00
Laurent Trinques 4044d04cc5 One year
Auto-build doxygen docs / doxygen (push) Has been cancelled
Auto-build doxygen docs / deploy (push) Has been cancelled
2026-01-16 15:24:35 +01:00
plc-user 757df90951 minor: added some English comments 2025-03-13 21:05:21 +01:00
plc-user 2b0dd1b188 comments and whitespace 2025-03-07 18:13:53 +01:00
plc-user 4009e6aaab simplify and use the same code for Qt5 & Qt6
When reading and comparing Qt5-docs and Qt6-docs, I read,
that there are no differences in the functions!
So it is not necessary to have the differentiation
between the Qt-Versions.
Code compiles without errors or warnings for Qt5 and Qt6.
2025-03-02 18:56:34 +01:00
plc-user e0b26592c7 fix typos 2025-02-28 20:36:38 +01:00
plc-user 181680e6f1 add English comments 2025-02-22 09:20:46 +01:00
Laurent Trinques 43f0107eb1 Revert "Try Clazy fix-its"
Segfault on old Qt versions!
This reverts commit dba7caed30.
2025-02-14 16:17:58 +01:00
Laurent Trinques dba7caed30 Try Clazy fix-its
clazy is a compiler plugin which allows clang to understand Qt
semantics. You get more than 50 Qt related compiler warnings, ranging
from unneeded memory allocations to misusage of API, including fix-its
for automatic refactoring.

https://invent.kde.org/sdk/clazy
2025-02-14 15:52:23 +01:00
plc-user 516eb9eb45 fixed English comments 2025-02-12 14:02:30 +01:00
plc-user 940ae0c34a formatting / whitespace - unify declarations 2025-01-26 14:29:52 +01:00
Laurent Trinques 77bfe84a4c One year 2025-01-04 13:37:40 +01:00
plc-user f9073ca5fb add terminal-names to connection in qet-file 2024-06-16 15:53:09 +02:00
Laurent Trinques e73cf633ce 2023->2024 2024-03-29 10:09:48 +01:00
Laurent Trinques 9afef79629 Update Copyright date 2023-01-01 17:05:57 +01:00
joshua 11b8ef927b Revert "Merge branch 'XMLPropertiesNew'"
**Break a lot of thing.**

This reverts commit 1db1800572, reversing
changes made to 4c563821e8.
2021-03-11 19:52:50 +01:00
Martin Marmsoler 5d3710c4b2 copy all toXML() from master commit 4b82c3a0c4 into the current branch, because the new concept will be used only for user properties 2021-03-07 10:09:45 +01:00
Martin Marmsoler 058824f29a move all static xml functions to qetxml 2021-03-06 20:01:31 +01:00
Martin Marmsoler 9d4b90da1a Add userProperties 2021-03-04 19:18:28 +01:00
Martin 02b7ead041 fix compile issues 2021-02-24 18:48:59 +01:00
Martin ea364f9c4e merge 2021-02-23 17:35:55 +01:00
joshua a00404bc9f clean terminal and terminaldata class 2021-02-21 19:40:32 +01:00
joshua e2ebb445a8 Terminal : remove unused code 2021-02-21 19:40:32 +01:00
Laurent Trinques ef58f34c14 Update Copyright date 2021-02-20 12:13:46 +01:00
joshua 0c4f87bd76 Replace AddItemCommand class by AddGraphicsObjectCommand
The class is the same except the name and the use of QPointer to avoid
segfault with deleted QGraphicsObject.
2021-02-07 16:20:55 +01:00
joshua 2513961cd6 Revert "Update Copyright date"
This reverts commit d04bccc384.
2021-02-06 19:00:48 +01:00
Laurent Trinques d04bccc384 Update Copyright date 2021-02-06 18:33:42 +01:00
Simon De Backer d15443cf93 Wip Fix preprocessor on Cmake 2020-12-10 18:49:35 +01:00
Simon De Backer 10c4c3d528 Wip Fix preprocessor on Cmake 2020-12-08 19:57:35 +01:00
Martin Marmsoler 9658a88c18 fix compile issues 2020-10-20 08:54:56 +02:00
Martin Marmsoler 12e301b887 replace 4 spaces by a tab 2020-10-20 08:54:56 +02:00
Martin Marmsoler f3097fc537 rebase XMLProperties_New (c0d9bf9) to master 2020-10-20 08:54:14 +02:00
Martin Marmsoler 73b394527d replace tabs by 4 spaces 2020-10-20 08:53:43 +02:00
Simon De Backer c1e93fc442 QT6: QStyleOptionGraphicsItem 2020-10-03 15:48:40 +02:00
Simon De Backer 36dbe65457 Add TODO compile var + Fix doxygen issue
You can make your code warn on compile time for the TODO's
In order to do so, uncomment the following line. in pro file
DEFINES += TODO_LIST
2020-09-24 17:01:33 +02:00
Simon De Backer 5d92393ee7 Wrap code for better readability 2020-09-07 22:03:40 +02:00
Simon De Backer 666f20856e Fix some doxygen issues 2020-08-19 21:26:36 +02:00
Simon De Backer 566747eb2b Improve code style, Wrap code for better readability 2020-08-18 21:29:12 +02:00