Phase 5 sub-commit 1: DevConsole + child-output capture + Ctrl+` toggle
BackendConnection now captures the bundled FrankenPHP child's merged stdout+stderr into a 500-line ring buffer, mirrors each line through qCInfo(lcBundled) so terminal users still see logs, and exposes childLogTail() / childLogLine for QML. DevConsole.qml is an opt-in monospaced viewer with auto-scroll + clear that the skeleton and the todo example bind to Ctrl+`. Dev mode (when BRIDGE_URL is set, no bundled child) renders an explanatory hint. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
#include <QElapsedTimer>
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QQueue>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QtQmlIntegration>
|
||||
|
||||
class QNetworkAccessManager;
|
||||
@@ -78,6 +80,11 @@ public:
|
||||
/// after this completes; emits `updateApplied` / `updateApplyFailed`.
|
||||
Q_INVOKABLE void applyUpdate();
|
||||
|
||||
/// Returns a snapshot of the captured child stdout/stderr ring buffer
|
||||
/// (most recent kChildLogMax lines). Bundled mode only — empty in dev
|
||||
/// mode. Used by `DevConsole.qml` to seed its view on first show.
|
||||
Q_INVOKABLE QStringList childLogTail() const;
|
||||
|
||||
signals:
|
||||
void urlChanged();
|
||||
void tokenChanged();
|
||||
@@ -94,10 +101,16 @@ signals:
|
||||
void updateApplied();
|
||||
void updateApplyFailed(const QString& reason);
|
||||
|
||||
/// Emitted for each newline-terminated chunk read from the bundled
|
||||
/// FrankenPHP child's merged stdout+stderr stream. DevConsole.qml
|
||||
/// listens for these to populate its log view live.
|
||||
void childLogLine(const QString& line);
|
||||
|
||||
private slots:
|
||||
void probe();
|
||||
void onProbeFinished();
|
||||
void onChildFinished(int exitCode, QProcess::ExitStatus status);
|
||||
void onChildOutputReady();
|
||||
void onUpdateCheckFinished(int exitCode, QProcess::ExitStatus status);
|
||||
void onUpdateApplyFinished(int exitCode, QProcess::ExitStatus status);
|
||||
|
||||
@@ -138,6 +151,10 @@ private:
|
||||
int m_supervisorRetries = 0;
|
||||
static constexpr int kMaxSupervisorRetries = 5;
|
||||
|
||||
QQueue<QString> m_childLog;
|
||||
QString m_childLogBuffer;
|
||||
static constexpr int kChildLogMax = 500;
|
||||
|
||||
QProcess* m_updateCheck = nullptr;
|
||||
QProcess* m_updateApply = nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user