Files
GVFG_Standalone/GVFG_Qt_Sample/mainwindow.h
T
Mark.lin 8282724e47 Simplify Qt sample controller boundaries
Compared with 57ad00c:

- Remove the redundant GvfgClient and gvfg_api forwarding layer so the sample calls the public GVFG capture and preview C APIs directly from CaptureController.

- Keep MainWindow limited to widget state, user actions, preview-window presentation, and option synchronization while CaptureController continues to own device, channel, worker, delivery, and logging state.

- Restore the f612cfd customer-visible behavior for hidden CH1 status, Y210 option tooltips, startup log-path reporting, contextual preview errors, timestamped error logging, and zero-copy option status synchronization.

- Preserve the requested device-name number suffixes, MinGW consumer support, video frame release handling, audio read-copy-release queue, QAudioSink playback-thread ownership, delivery accounting, and diagnostic output.

- Destroy and disconnect CaptureController while MainWindow and its UI are still valid, preventing destructor-time callbacks from reaching an object whose derived destructor has completed.

- Use supported QString multi-argument formatting to satisfy clazy without mixing numeric arguments into QString-only overloads.

Validation: git diff --cached --check and focused source/API parity inspection against f612cfd passed. No configure, build, runtime launch, capture, audio playback, device-event, shutdown, or hardware validation was run.
2026-09-11 16:32:58 +08:00

40 lines
836 B
C++

#pragma once
#include <gvfg_capture.h>
#include <QWidget>
#include <array>
class CaptureController;
class QCloseEvent;
class PreviewWindow;
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow final : public QWidget
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
protected:
void closeEvent(QCloseEvent *event) override;
private:
void syncControllerOptions(int channel);
void showPreviewWindow(int channel, bool fullscreen);
void updateOutputFormatOptions(int changedChannel = -1);
void updateUiState();
void appendLogLine(const QString &line);
Ui::MainWindow *ui_ = nullptr;
CaptureController *controller_ = nullptr;
std::array<PreviewWindow *, 2> previewWindows_{};
};
QWidget *createMainWindow();