Commit Graph

9993 Commits

Author SHA1 Message Date
ispyisail b4c0e2a52a Fix dragging parts selected in the symbol editor's Parts list
Selecting several parts by clicking them in the Parts list, then dragging
one on the drawing, moved only the part under the cursor; the others
stayed where they were. No selection handles were shown either.

updateSelectionFromPartsList() blocks the scene's signals while it copies
the list selection to the drawing, so selectionChanged never reached
ElementScene::managePrimitivesGroups(), which sets up the decorator that
moves a multi-part selection. Call it once the signals are unblocked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 21:31:59 +13:00
Laurent Trinques b485258424 Merge pull request #1237 from ispyisail/fix/bugtracker-344-locked-show-text
Fix bugtracker #344: say why a wire's "show text" box is locked
2026-10-02 09:26:56 +02:00
Laurent Trinques bf0a8bd8d5 Merge pull request #1236 from ispyisail/fix/aux-machine-manufacturer-reference-variables
Fix %{machine_manufacturer_reference_auxiliary1..4} never resolving
2026-10-02 09:24:55 +02:00
ispyisail 59b25b5f18 Fix bugtracker #344: say why a wire's "show text" box is locked
The conductor properties dialog disables the "Texte visible" checkbox
when the folio has "Afficher un texte de potentiel par folio" on, but it
also hides that option, so nothing told the user why the box could not
be ticked. A wire saved with its text off then looked impossible to fix.

The locked box's tooltip now names the folio option and where to change
it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 20:23:16 +13:00
ispyisail fe8498a26c Fix %{machine_manufacturer_reference_auxiliary1..4} never resolving
AssignVariables::replaceVariable() is a fixed list of replacements. Every
auxiliary family is listed for blocks 1 to 4 except the machine
manufacturer reference, which stopped at the plain
%{machine_manufacturer_reference}. A text using one of the four
auxiliary forms printed the variable itself on the folio and in exports.

Add the four, next to their manufacturer-reference neighbours.

Test: tst_resaveunchanged resaves a project with one terminal whose
texts combine each machine reference variable with its neighbour, and
checks the saved texts carry the values. It fails without the fix (the
variable is saved as typed) and passes with it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 19:40:31 +13:00
Laurent Trinques 5a9c280ff4 Merge pull request #1234 from ispyisail/fix/bugtracker-345-unlinked-contact-label
Linux build and tests / Build and test (Qt 6, Debug) (push) Failing after 5m2s
Fix bugtracker #345: crash opening a project with an unlinked contact
2026-10-02 08:19:49 +02:00
Laurent Trinques 8d2243586e Merge pull request #1205 from ispyisail/feature/multi-wire-properties-panel
Edit several wires at once in the Selection properties panel
2026-10-02 07:56:25 +02:00
Laurent Trinques bbb6f502e7 Merge pull request #1216 from ispyisail/fix/935-folio-to-sheet
Rename "folio" to "sheet" in the English interface
2026-10-02 07:55:18 +02:00
Laurent Trinques ee4051daee Merge pull request #1212 from ispyisail/feature/sketch-fillet
Add a fillet tool to round the corner between two drawn lines
2026-10-02 07:54:35 +02:00
Laurent Trinques e35a5e3d66 Merge pull request #1215 from neitri/master
Russian translate
2026-10-02 07:52:33 +02:00
ispyisail c0b8472665 Fix bugtracker #345: crash opening a project with an unlinked contact
A contact (slave) not linked to a coil has no element to take its label
from: DynamicElementTextItem::elementUseForInfo() returns null. Since
8985babfe (#978) the composite-text branch of updateLabel() called
element->actualLabel() without checking, so a text built from %{label}
on such a contact crashed QElectroTech while the project was loading
(QETProject::refresh -> Diagram::refreshContents). The project could not
be opened again.

Check the element as the ElementInfo branch above already does; with no
element, %{label} shows empty, as it did before 8985babfe.

Test: tst_resaveunchanged opens a blank project holding one unlinked
contact with a %{label} text. It fails without the fix (the --resave
crashes) and passes with it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 18:48:48 +13:00
ispyisail 6c8fb720c1 Merge pull request #1232 from ispyisail/fix/symbol-preview-size-limit
Fix a huge symbol size crashing QElectroTech while drawing its icon
2026-10-02 17:00:21 +13:00
ispyisail c3774e4037 Merge pull request #1231 from ispyisail/fix/projects-panel-close-use-after-free
Fix a crash when closing QElectroTech without saving an edited project
2026-10-02 16:59:45 +13:00
ispyisail 1002b269ac Fix a symbol with a huge size aborting QElectroTech in its preview
ElementPictureFactory::pixmap() made a pixmap of whatever width and
height the symbol file declares. A symbol whose parts span 280 000 px
(made by the GUI fuzzer in the symbol editor) asked for a ~315 GB
pixmap. Under AddressSanitizer that aborts QElectroTech; the symbol then
sat in the user collection and every later start died loading its icon.

The preview is now drawn scaled down to fit 4096 px on its longer side.
The largest symbols in the shipped collection are 3160 px, so none of
them changes. The size is also bounded before it is rounded up to a
multiple of 10, so a crafted value near INT_MAX cannot overflow.

Checked with a user collection holding one symbol declared 280000 x
280000, on ASan builds: master aborts (out of memory, exit 1) 3/3 when
the collection is expanded; with this change QElectroTech keeps running
and lists the symbol, 3/3.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 16:17:58 +13:00
ispyisail 924b87447f Fix a use-after-free when closing QElectroTech without saving
Closing QElectroTech with an edited project and choosing "Close without
saving" read freed memory. Destroying the project clears each folio's
undo stack, which signals the Projects panel to refresh that project.
The refresh reached GenericPanel::updateItem(), whose only statement was
QApplication::processEvents(). That ran the editor window's pending
deleteLater(), destroying the panel, and GenericPanel::addProject() then
carried on using it (genericpanel.cpp:142).

The call was added in 2013 (70b7cd7d1) to keep the window responsive
while the panel reloaded, when it also listed the whole element
collection. The collection has its own panel now; this one lists
projects, folios and title block templates. updateItem() is again what
its comment says it is: a hook that does nothing.

Found by the GUI fuzzer under AddressSanitizer. Reproduced 3/3 on master
51b122993 (open a project, move everything on a folio, Ctrl+Q, Close
without Saving: heap-use-after-free, exit 1); 0/3 with this change
(exit 0, no report), with the save prompt confirmed on screen.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 16:15:51 +13:00
ispyisail 51b1229935 Merge pull request #1228 from ispyisail/feature/mcp-macro-recorder
Add MCP tools to read macro recordings and check scripts against them
2026-10-02 15:14:16 +13:00
ispyisail cddc4e53f0 Merge pull request #1227 from ispyisail/feature/macro-recorder
Add a macro recorder: record a task by hand, for an assistant to script
2026-10-02 15:13:54 +13:00
ispyisail f6867a0f4e Merge pull request #1225 from ispyisail/feature/mcp-live-tools
Add MCP live tools to act on the project open in QElectroTech
2026-10-02 15:13:29 +13:00
ispyisail 0f909e1246 Merge pull request #1224 from ispyisail/feature/mcp-script-tools
Add MCP tools to write, test and store script buttons
2026-10-02 15:13:08 +13:00
ispyisail cc07bb0e96 Merge pull request #1223 from ispyisail/feature/script-live-ask-first
Add ask-first, an Assistant panel and safe commands to live mode
2026-10-02 15:12:45 +13:00
ispyisail b18b6388d3 Merge pull request #1222 from ispyisail/feature/script-live
Add live mode: an AI assistant works on the open project as you watch
2026-10-02 15:12:17 +13:00
ispyisail 5fbc129671 Merge pull request #1221 from ispyisail/feature/script-manager
Add a script manager: write, try, give an icon to and delete scripts
2026-10-02 15:11:53 +13:00
ispyisail bec51d6fd1 Merge pull request #1220 from ispyisail/feature/script-buttons
Add script buttons: stored scripts with an icon in menu and toolbar
2026-10-02 15:11:26 +13:00
ispyisail 43f41eb044 Merge pull request #1219 from ispyisail/feature/script-current-folio-undo
Make a script run one undo step, and let it find the folio on screen
2026-10-02 15:11:03 +13:00
ispyisail 3e5e41b63f Merge pull request #1218 from ispyisail/fix/1210-report-menu-both-arrows
Fix #1210: keep both coming and going arrows in the right-click menu
2026-10-02 15:10:39 +13:00
ispyisail ed54271c23 Merge pull request #1214 from ispyisail/feature/mcp-conductor-defaults
Add a qet_edit op for a folio's wire defaults (one number per potential)
2026-10-02 15:09:56 +13:00
ispyisail 1e7dce4bd5 Merge pull request #1211 from ispyisail/fix/arc-middle-handle-overlap
Fix the arc's middle handle covering a resize or skew handle
2026-10-02 15:09:27 +13:00
ispyisail c22fd5fbbc Macro recorder: name the folder with the platform's separators in the copied request
On Windows the request read C:/users/...; the box above it already showed
C:\users\... Found testing the Windows package under Wine.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 14:51:30 +13:00
ispyisail e23fc2aaad Add a macro recorder: record a task by hand, for an assistant to script
Projet > Scripts > Enregistrer une macro (also in command search and the
shortcut bar) records what is done on the current project until clicked
again. Under <data folder>/recordings/<id>/ it saves the whole project
before and after, the folio and selection at the start, and each step from
the undo history -- its name, the commands inside it, the folio, what was
selected, and the folio after it. No editing command is taught to the
recorder, and nothing new walks the scene: the files are QElectroTech's
own serialisation.

While recording, the status bar shows "● Enregistrement : N étapes" with
Arrêter. At the end a box says where it went and offers "Copier la demande
pour l'assistant": a ready-made request naming the recording, to paste
into the assistant's chat, since QElectroTech cannot send it anything
itself. qet-assistant.json lists the recordings, and live status says
whether one is under way and which was last.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 14:10:50 +13:00
ispyisail f4660f19ec qet-mcp: macro recordings -- read what a person did, check a script against it
qet_recording_list and qet_recording_read fetch what QElectroTech's macro
recorder saved: each step from the undo history as structured changes
(consecutive folio states diffed with qet_diff), and the overall change
from before.qet to after.qet. qet_recording_check runs a script on a copy
of before.qet from where the person started -- the folio on screen (a
proxy answers qet.currentFolio(), which a Qt object will not let a script
replace) and the selection -- and says whether the result matches
after.qet, or what differs. qet_recording_remove deletes one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 14:06:51 +13:00
ispyisail 7694f4833d Merge branch 'feature/script-live' into feature/script-live-ask-first 2026-10-02 13:03:34 +13:00
ispyisail a99c58487d qet-mcp: find the live channel in qet-assistant.json
QElectroTech now advertises its live channel in the "live" part of
qet-assistant.json instead of a live-session.json of its own. When nothing
is listening, the error now tells apart QElectroTech not running, live
mode switched off, and the start-up warning not accepted.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 13:03:33 +13:00
ispyisail 124173514d Live mode: advertise the channel in qet-assistant.json
The socket name and token now go in the "live" part of the one file the
qet MCP server reads about this QElectroTech, rather than in a
live-session.json of their own, and are cleared when the channel closes.
The file also says whether the live setting is on.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 13:03:33 +13:00
ispyisail 15c114edd5 qet-mcp: read qet-assistant.json; qet_about; a note at first contact
QElectroTech now writes qet-assistant.json with its folders, features,
script calls and stored scripts. The server reads it to find the scripts
folder -- right even when QElectroTech runs with --data-dir, where the
per-platform guess was wrong -- and qet_about shows it, never the live
token. The initialize reply now carries instructions: what QElectroTech
is, headless and live, the usual order of tools, start with qet_about.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 13:02:26 +13:00
ispyisail 3a5b72c40f Merge branch 'feature/script-manager' into feature/script-live
# Conflicts:
#	cmake/qet_compilation_vars.cmake
#	sources/qetdiagrameditor.cpp
#	sources/ui/configpage/generalconfigurationpage.cpp
2026-10-02 12:58:54 +13:00
ispyisail 3cc857c754 Merge branch 'feature/script-buttons' into feature/script-manager
# Conflicts:
#	cmake/qet_compilation_vars.cmake
#	sources/qetdiagrameditor.cpp
2026-10-02 12:52:43 +13:00
ispyisail 5473ed7cdb Script buttons: qet-assistant.json, what an assistant needs to know in one file
QElectroTech now writes qet-assistant.json in the standard data folder
when an editor opens, and again whenever the stored scripts or the
scripting setting change: its version and program, every folder (data,
settings, scripts, the element and title block collections), which
features are on, every call a script can make (QetScriptApi::signatures(),
apiSignatures() without a running script), and the stored scripts with
their ids, files, icons and shortcuts, plus those refused and why. On
quit it says nothing is running any more.

The qet MCP server reads it rather than guessing each folder per
platform, which is wrong as soon as QElectroTech runs with --data-dir:
the file stays where the server can find it and names the folders
actually in use. Readable by the user only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 12:49:01 +13:00
ispyisail da312fa467 Merge branch 'feature/script-live' into feature/script-live-ask-first 2026-10-02 11:57:53 +13:00
ispyisail 7d91e8fdf1 Live mode: find the open project while QElectroTech is not the active window
While the user types to the assistant, QElectroTech is not the active
application, and QMdiArea then reports no active sub-window: status said
no project was open and every run was refused. Make the sub-window it
remembers active again before handling a request; the focus stays where
the user put it. Found with the Windows package under Wine; reproduced on
Linux with another window focused.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 11:57:53 +13:00
ispyisail 78ee9ccbaa Merge branch 'feature/script-live' into feature/script-live-ask-first 2026-10-02 11:15:15 +13:00
ispyisail e7b699b59a Live mode: close each connection once it is answered
The qet MCP server connects once per request. On Windows a named pipe's
disconnection reaches QLocalSocket late, so the second of two quick calls
was turned away as "another assistant is already connected". Found
testing the Windows package under Wine with a Windows-side client.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 11:15:15 +13:00
ispyisail 3083654ad3 Live mode: ask first, an Assistant log, commands, folios, screenshot
A script the assistant writes on the spot is shown to the user before it
runs: Exécuter, Refuser, or Toujours pour cette session. Stored scripts
run as a click would. The choice is per session and never saved.

An "Assistant" dock lists every action with the time, ✓ or ✗, and its
undo step; the script, its log or its error show on hover and on a
double-click. It opens with live mode and holds the ask-first box.

The assistant may also:
- trigger an editor command from an allow-list of ones that open no
  dialog and that undo can take back (selection, zoom, rotate, snap,
  group, reset wires); saving, deleting, exporting and the rest are
  refused;
- show another folio;
- undo the newest step only if it made it ("Assistant : …");
- take a picture of the folio on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:43:19 +13:00
ispyisail 2fb14c5bd0 Live mode: an AI assistant acts on the open project while the user watches
A new setting, Configurer QElectroTech > Général > "Autoriser un assistant
IA à agir sur le projet ouvert", off by default. Off, nothing changes:
no channel is opened. On, every start shows a warning first -- Continuer,
Pas pour cette session, or Désactiver -- and nothing can connect until
the user answers Continuer. It waits for any other start-up question to
be answered, so the two never stack.

Accepted, LiveServer opens a local socket only the user's account can
use, with a random name and token written to live-session.json in the
data folder for the qet MCP server, and removed when the channel closes.
One JSON request per line: status (project, folio on screen, selection,
last undo step, stored scripts), run_script and run_stored. Requests are
queued out of the socket handler before they run (the lesson of PR #861).

Each run is one undo step named "Assistant : <name>". The status bar
shows the mode and the assistant's last action with a ✓ or ✗ and the
time, and an Arrêter button that closes the channel for the session.
Unticking the setting closes it at once.

QetScripting::runSource() runs script text and, for a live run, returns
what qet.log() wrote, the error with its line and the undo step instead
of showing boxes; qet.showMessage() is logged rather than opening a box
nobody asked for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:41:29 +13:00
ispyisail ae06377f1a qet-mcp: live commands, folios, undo of the assistant's own step, screenshot
qet_live_screenshot returns an MCP image the assistant can look at;
--call prints an image part as a data: URI instead of failing on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:40:29 +13:00
ispyisail 3d4f546dbc Keep both folio report arrows in the folio's context menu
Fixes #1210. The "Renvoi de folio" submenu offered the common coming and
going arrows only while the project had no folio report element yet.
Placing one copies it into the embedded collection, so from then on the
menu listed just that one and the other arrow could not be inserted until
the project was closed without saving.

The two common arrows are now always listed, after the project's own
report elements, each name once.

Checked in the GUI on a blank one-folio project: on master the submenu
drops from two entries to one after a coming arrow is placed and the
second pick places another coming arrow; with this change it keeps two
entries and the second pick places a going arrow (both in the saved file).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:34:03 +13:00
ispyisail bf74468c40 qet-mcp: live mode tools, to act on the project open in QElectroTech
qet_live_status, qet_live_run_script and qet_live_run_stored talk to a
running QElectroTech through the channel its LiveServer opens, only when
live mode is switched on in its settings and accepted at this start. They
find it through live-session.json in QElectroTech's data folder and send
its token on every request; with no session, the error says which of the
three switches is missing. Running needs QET_ENABLE_SCRIPTING=1 as editing
does; asking for the status does not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:27:25 +13:00
ispyisail cd51f39d7b qet-mcp: the scripts folder rule as a pure function, tested for Windows and macOS
Checked against a real Windows package under Wine: QElectroTech keeps its
data in %APPDATA%\QElectroTech\QElectroTech, next to which the scripts
folder goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:05:24 +13:00
ispyisail 4f47093cb2 Script buttons: a manager to write, try and delete stored scripts
Projet > Scripts > Gérer les scripts… lists the stored scripts with their
icons, and the files that get no button with the reason. For each one it
edits the name, icon (a file copied next to the script, a theme icon, or
the initials), tooltip, shortcut, when it is enabled, and the script
itself; "Tester" saves it and runs it on the current project, one Ctrl+Z
to undo; "Supprimer" deletes it with its icon if no other script uses it.

It only reads and writes the files in the scripts folder, so a script
written here, by hand or by an assistant over the qet MCP server is the
same thing, and the folder's watcher turns each into a button.

ScriptHeader gains compose(), bodyOf() and idFor(), header-only and
tested: what the manager writes reads back as what was typed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 09:22:10 +13:00
ispyisail 55eac848df qet-mcp: tools to write, test and store scripts that QElectroTech shows as buttons
qet_script_api lists every qet.* call, asked of the QElectroTech that will
run it (qet.apiSignatures() where the build has it, names otherwise), with
the header format that makes a script a button.

qet_script_test runs a script's text on a copy of a project and returns the
qet_diff of what it changed, its log and its errors with their line.

qet_script_install stores a script, and optionally an SVG icon, in the
scripts folder QElectroTech reads; with test_project it tests first and
stores nothing if the test fails. qet_script_list, qet_script_read and
qet_script_remove complete the set.

The folder is the server's choice, never the call's: ids are checked as
file names, and storing or removing needs QET_ENABLE_SCRIPTING=1 like an
edit, because a stored script runs when the user clicks it. A header is
checked with the same rules as QElectroTech's own, so nothing is stored
that would get no button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 09:13:05 +13:00
ispyisail b7ce89944e Scripting: qet.apiSignatures(), the calls a script can make
Read from the meta-object, so the list is the one the running build has:
for someone writing a script, and for an assistant that has to write one
without the source at hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 09:04:06 +13:00