Compared with 1214e72:
- Move device discovery, channel lifecycle, signal monitoring, frame delivery, preview submission, runtime logging, and shutdown coordination from MainWindow into a dedicated CaptureController.
- Add a GvfgClient RAII wrapper and gvfg_api namespace so one application module owns all direct calls to the public capture and preview C APIs.
- Keep MainWindow focused on widget creation, user actions, option synchronization, preview-window presentation, and UI state updates through controller signals.
- Preserve per-channel video workers, exact frame release handling, preview delivery accounting, startup timing, signal recovery, and diagnostic reporting while removing their implementation details from the UI class.
- Preserve the audio read-copy-release path, bounded playback queue, playback-thread QAudioSink ownership, recovery behavior, and byte/frame accounting inside the controller.
- Register the new source files in the standalone Qt sample target and document the resulting UI, capture-control, and API-adapter source boundaries.
Validation: git diff --cached --check passed before commit. No build, runtime launch, capture, audio playback, device-event, shutdown, or hardware validation was run.
42 lines
957 B
C++
42 lines
957 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 showError(const QString &apiName, gvfg_status_t status, int channel,
|
|
const QString &detail);
|
|
void appendLogLine(const QString &line);
|
|
|
|
Ui::MainWindow *ui_ = nullptr;
|
|
CaptureController *controller_ = nullptr;
|
|
std::array<PreviewWindow *, 2> previewWindows_{};
|
|
};
|
|
|
|
QWidget *createMainWindow();
|