Loading...
Searching...
No Matches
OutputPreview.hpp
1#pragma once
2#include <Gfx/Window/WindowSettings.hpp>
3
4#include <QImage>
5#include <QObject>
6#include <QWidget>
7
8#include <functional>
9#include <vector>
10
11namespace Gfx
12{
13
14enum class PreviewContent
15{
16 Black,
17 PerOutputTestCard,
18 GlobalTestCard,
19 OutputIdentification
20};
21
22class PreviewWidget;
23class OutputPreviewWindows final : public QObject
24{
25public:
26 explicit OutputPreviewWindows(QObject* parent = nullptr);
28
29 void syncToMappings(const std::vector<OutputMapping>& mappings);
30 void setPreviewContent(PreviewContent mode);
31 void setInputResolution(QSize sz);
32 void setSyncPositions(bool sync);
33
34 // Called when a preview window's fullscreen state is toggled via double-click
35 std::function<void(int, bool)> onFullscreenToggled;
36
37private:
38 void closeAll();
39 void rebuildGlobalTestCard();
40
41 std::vector<PreviewWidget*> m_windows;
42 PreviewContent m_content{PreviewContent::Black};
43 QSize m_inputResolution{1920, 1080};
44 QImage m_globalTestCard;
45 bool m_syncPositions{true};
46};
47class PreviewWidget final : public QWidget
48{
49public:
50 explicit PreviewWidget(int index, PreviewContent content, QWidget* parent = nullptr);
51
52 void setOutputIndex(int idx);
53 void setPreviewContent(PreviewContent mode);
54 void setOutputResolution(QSize sz);
55 void setBlend(EdgeBlend left, EdgeBlend right, EdgeBlend top, EdgeBlend bottom);
56 void setSourceRect(QRectF rect);
57 void setCornerWarp(const CornerWarp& warp);
58 void setGlobalTestCard(const QImage& img);
59
60 // Called when fullscreen is toggled via double-click (index, isFullscreen)
61 std::function<void(int, bool)> onFullscreenToggled;
62
63protected:
64 void paintEvent(QPaintEvent* event) override;
65 void mouseDoubleClickEvent(QMouseEvent* event) override;
66
67private:
68 int m_index{};
69 PreviewContent m_content{PreviewContent::Black};
70 QSize m_resolution{1280, 720};
71 QRectF m_sourceRect{0, 0, 1, 1};
72 QImage m_globalTestCard;
73 EdgeBlend m_blendLeft;
74 EdgeBlend m_blendRight;
75 EdgeBlend m_blendTop;
76 EdgeBlend m_blendBottom;
77 CornerWarp m_cornerWarp;
78};
79}
Definition OutputPreview.hpp:24
Definition OutputPreview.hpp:48
Binds the rendering pipeline to ossia processes.
Definition CameraDevice.cpp:30
Definition WindowSettings.hpp:33
Definition WindowSettings.hpp:27