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>
This commit is contained in:
ispyisail
2026-10-02 14:10:27 +13:00
parent 7694f4833d
commit e23fc2aaad
7 changed files with 447 additions and 1 deletions
+6
View File
@@ -18,6 +18,7 @@
#include "liveserver.h"
#include "assistantinfo.h"
#include "macrorecorder.h"
#include "qetscripting.h"
#include "scriptlibrary.h"
#include "../diagram.h"
@@ -310,6 +311,11 @@ QJsonObject LiveServer::status()
scripts.append(QJsonObject{{QStringLiteral("id"), s.header.id},
{QStringLiteral("name"), s.header.name}});
answer.insert(QStringLiteral("stored_scripts"), scripts);
//So an assistant can notice a recording the user just made
answer.insert(QStringLiteral("macro_recorder"), QJsonObject{
{QStringLiteral("recording"), MacroRecorder::instance().isRecording()},
{QStringLiteral("steps"), MacroRecorder::instance().stepCount()},
{QStringLiteral("last_recording"), MacroRecorder::instance().lastId()}});
QETDiagramEditor *e = editor();
QETProject *project = e ? e->currentProject() : nullptr;