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 setTransform(int rotation, bool mirrorX, bool mirrorY);
59 void setGlobalTestCard(const QImage& img);
60
61 // Called when fullscreen is toggled via double-click (index, isFullscreen)
62 std::function<void(int, bool)> onFullscreenToggled;
63
64protected:
65 void paintEvent(QPaintEvent* event) override;
66 void mouseDoubleClickEvent(QMouseEvent* event) override;
67
68private:
69 int m_index{};
70 PreviewContent m_content{PreviewContent::Black};
71 QSize m_resolution{1280, 720};
72 QRectF m_sourceRect{0, 0, 1, 1};
73 QImage m_globalTestCard;
74 EdgeBlend m_blendLeft;
75 EdgeBlend m_blendRight;
76 EdgeBlend m_blendTop;
77 EdgeBlend m_blendBottom;
78 CornerWarp m_cornerWarp;
79 int m_rotation{0};
80 bool m_mirrorX{false};
81 bool m_mirrorY{false};
82};
83}
Definition OutputPreview.hpp:24
Definition OutputPreview.hpp:48
Binds the rendering pipeline to ossia processes.
Definition CameraDevice.cpp:30
Definition WindowSettings.hpp:49
Definition WindowSettings.hpp:43