ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
testcard_preview.h
Go to the documentation of this file.
1//
2// Copyright (c) 2026, Astute Systems PTY LTD
3//
4// This file is part of the VivoeX project developed by Astute Systems.
5//
6// License. See the LICENSE file in the project root for full license details.
7//
12
13#ifndef STREAMS_TESTCARD_PREVIEW_H
14#define STREAMS_TESTCARD_PREVIEW_H
15
16#include <QObject>
17#include <QComboBox>
18#include <QEvent>
19#include <QGraphicsView>
20#include <QGraphicsScene>
21#include <QGraphicsPixmapItem>
22#include <QTimer>
23#include <QLabel>
24#include <QSpinBox>
25#include <cstdint>
26#include <vector>
27
28#include "../ui_toolx.h"
29#include "rtp/rtp_utils.h"
30
34class TestCardPreview : public QObject
35{
36 Q_OBJECT
37
38public:
45 explicit TestCardPreview(Ui::Dialog &ui, QWidget *parent = nullptr);
46
50 ~TestCardPreview() final;
51
52public slots:
56 void startPreview();
57
61 void stopPreview();
62
68 void setPattern(int index);
69
75 void setWidth(int width);
76
82 void setHeight(int height);
83
84protected:
92 bool eventFilter(QObject *obj, QEvent *event) override;
93
94private slots:
98 void renderFrame();
99
100private:
104 void generateTestCard();
105
107 Ui::Dialog &m_ui;
109 QTimer m_timer;
111 QGraphicsScene *m_scene = nullptr;
113 QGraphicsPixmapItem *m_pixmapItem = nullptr;
115 std::vector<uint8_t> m_buffer;
117 int m_pattern = 0;
119 uint32_t m_width = 640;
121 uint32_t m_height = 480;
123 bool m_running = false;
125 uint64_t m_frameCount = 0;
127 mediax::rtp::TestCardState m_state;
128};
129
130#endif // STREAMS_TESTCARD_PREVIEW_H
void generateTestCard()
Generate the test card into the buffer.
Definition testcard_preview.cpp:211
uint32_t m_width
Preview width.
Definition testcard_preview.h:119
bool m_running
Whether preview is running.
Definition testcard_preview.h:123
bool eventFilter(QObject *obj, QEvent *event) override
Event filter to handle resize events on the preview view.
Definition testcard_preview.cpp:109
std::vector< uint8_t > m_buffer
Raw pixel buffer (RGB24).
Definition testcard_preview.h:115
void setWidth(int width)
Change the preview resolution width.
Definition testcard_preview.cpp:161
~TestCardPreview() final
Destroy the TestCardPreview object.
Definition testcard_preview.cpp:120
QGraphicsPixmapItem * m_pixmapItem
The pixmap item in the scene.
Definition testcard_preview.h:113
TestCardPreview(Ui::Dialog &ui, QWidget *parent=nullptr)
Construct a new TestCardPreview object.
Definition testcard_preview.cpp:24
void startPreview()
Start playing the preview at 25 Hz.
Definition testcard_preview.cpp:125
uint32_t m_height
Preview height.
Definition testcard_preview.h:121
mediax::rtp::TestCardState m_state
Animation state carried between frames.
Definition testcard_preview.h:127
void setHeight(int height)
Change the preview resolution height.
Definition testcard_preview.cpp:180
QTimer m_timer
Timer for 25 Hz frame updates.
Definition testcard_preview.h:109
void setPattern(int index)
Change the test card pattern.
Definition testcard_preview.cpp:147
QGraphicsScene * m_scene
The graphics scene.
Definition testcard_preview.h:111
Ui::Dialog & m_ui
The main UI reference.
Definition testcard_preview.h:107
void stopPreview()
Stop the preview.
Definition testcard_preview.cpp:137
uint64_t m_frameCount
Frame counter for animated patterns.
Definition testcard_preview.h:125
int m_pattern
Current test card pattern index.
Definition testcard_preview.h:117
void renderFrame()
Timer callback to render the next frame.
Definition testcard_preview.cpp:199