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
+5 -1
View File
@@ -19,6 +19,7 @@
#include "qetscriptapi.h"
#include "scriptlibrary.h"
#include "macrorecorder.h"
#include "../qetapp.h"
#include "../qetversion.h"
#include "../utils/qetsettings.h"
@@ -89,6 +90,7 @@ void write()
{QStringLiteral("data"), QETApp::dataDir()},
{QStringLiteral("config"), QETApp::configDir()},
{QStringLiteral("scripts"), ScriptLibrary::folder()},
{QStringLiteral("recordings"), MacroRecorder::folder()},
{QStringLiteral("elements_common"), QETApp::commonElementsDir()},
{QStringLiteral("elements_company"), QETApp::companyElementsDir()},
{QStringLiteral("elements_custom"), QETApp::customElementsDir()},
@@ -103,10 +105,12 @@ void write()
#endif
{QStringLiteral("scripting_enabled"), QetSettings::scriptingEnabled()},
{QStringLiteral("live_mode_setting"), QetSettings::liveAssistantEnabled()},
{QStringLiteral("live_mode_open"), !s_live.isEmpty()}}},
{QStringLiteral("live_mode_open"), !s_live.isEmpty()},
{QStringLiteral("macro_recording"), MacroRecorder::instance().isRecording()}}},
{QStringLiteral("script_api"), QJsonArray::fromStringList(QetScriptApi::signatures())},
{QStringLiteral("stored_scripts"), scripts},
{QStringLiteral("refused_scripts"), refused},
{QStringLiteral("recordings"), MacroRecorder::recordings()},
{QStringLiteral("live"), s_live.isEmpty() ? QJsonValue() : QJsonValue(s_live)}};
const QString file_path = path();