Automatisierte Screenshot Aufnahme per [SCREENSHOT] datei implementiert

This commit is contained in:
2026-08-26 01:22:13 +02:00
parent 36923e1646
commit ef335f2d9e
16 changed files with 365 additions and 52 deletions

View File

@@ -41,8 +41,10 @@ private slots:
void onError(const QString &message);
void onNewLine(const QString &line);
void onTagDetected(const QString &tag, const QString &value);
void onScreenshotRequested(const QString &filename);
void showFormatReference();
void configureTagFilter();
void configureScreenshotDir();
void showAbout();
private:
@@ -53,6 +55,7 @@ private:
void doShutdown();
void saveSettings();
void restoreSettings();
void updateScreenshotDirTooltip();
QThread *m_thread = nullptr;
SerialWorker *m_worker = nullptr;
@@ -71,6 +74,7 @@ private:
QAction *m_connectAction = nullptr;
QAction *m_disconnectAction = nullptr;
QAction *m_screenshotDirAction = nullptr;
// Splitters (saved/restored via QSettings)
QSplitter *m_mainSplitter = nullptr;
@@ -78,5 +82,6 @@ private:
SerialConfig m_lastConfig;
QSet<QString> m_suppressedTags; // tags hidden from Raw view
QString m_screenshotDir; // target folder for [SCREENSHOT] tag captures
bool m_shutdownDone = false;
};

View File

@@ -48,6 +48,11 @@ public slots:
signals:
void newLine(const QString &line);
void tagDetected(const QString &tag, const QString &value);
// Fired specifically for a [SCREENSHOT] control tag (in addition to the
// normal tagDetected() above, so it still shows up in the Tag Monitor
// history too). `filename` is whatever followed the tag, verbatim -
// the receiver is responsible for sanitizing/defaulting it.
void screenshotRequested(const QString &filename);
void clearScreen();
void portOpened();
void portClosed();

View File

@@ -27,10 +27,27 @@ public:
public:
void shutdown(); // safe to call multiple times, called from MainWindow::closeEvent
// Folder that saveAutoScreenshot() writes into. Empty = not configured
// (saveAutoScreenshot() will report an error instead of silently
// dropping the request).
void setAutoScreenshotDir(const QString &dir) { m_autoScreenshotDir = dir; }
public slots:
void onNewFrame(const QImage &frame);
void clearFrame(); // blanks the preview (used on ANSI clear-screen)
// Saves whichever frame is currently in m_frame under `filename` inside
// m_autoScreenshotDir. Triggered by a [SCREENSHOT] control tag from the
// firmware - the point is to grab the frame that's already in flight
// the instant the tag arrives (no dialog, no user reaction time), e.g.
// to reliably catch a video frame showing a memory dump.
void saveAutoScreenshot(const QString &filename);
signals:
// Emitted after every saveAutoScreenshot() attempt so the caller (the
// main window) can surface a transient status message. Never blocks/
// pops a dialog itself, since this can fire in rapid succession from
// firmware-driven triggers.
void autoScreenshotResult(bool success, const QString &message);
private slots:
void onStartStop();
@@ -76,4 +93,8 @@ private:
QProcess *m_recordProcess = nullptr;
bool m_recording = false;
QSize m_recordSize;
// Folder for saveAutoScreenshot() ([SCREENSHOT] tag). Set via
// setAutoScreenshotDir(), persisted/restored by MainWindow.
QString m_autoScreenshotDir;
};