ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
cast_tab.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_CAST_TAB_H
14#define STREAMS_CAST_TAB_H
15
16#include <map>
17#include <memory>
18
19#include <QObject>
20#include <QJsonObject>
21#include <QString>
22#include <QTimer>
23#include <QVariantMap>
24#include <QWidget>
25
26#include "../ui_toolx.h"
27#include "qt6/QtCastDiscovery.h"
30
40class CastTab : public QObject
41{
42 Q_OBJECT
43
44public:
51 explicit CastTab(Ui::Dialog &ui, QWidget *parent = nullptr);
52
56 ~CastTab() final;
57
58 CastTab(const CastTab &) = delete;
59 CastTab &operator=(const CastTab &) = delete;
60 CastTab(CastTab &&) = delete;
61 CastTab &operator=(CastTab &&) = delete;
62
68 int activeCount() const;
69
75 QJsonObject toJson() const;
76
86 void fromJson(const QJsonObject &settings);
87
88public slots:
92 void refresh();
93
97 void startSelected();
98
102 void stopSelected();
103
104private:
107 {
109 std::unique_ptr<toolx::streams::CastGenerator> generator;
111 QVariantMap device;
113 uint32_t width = 0;
115 uint32_t height = 0;
117 uint32_t framerate = 0;
118 };
119
121 void rebuildTable();
123 QString selectedId() const;
125 QVariantMap selectedDevice() const;
127 void selectionChanged();
129 void fillResolutions(uint32_t max_height, uint32_t select_width, uint32_t select_height);
131 void fillFramerates(uint32_t select_framerate);
133 int selectedPattern() const;
135 void updateStates();
137 void updateButtons();
139 void setStateText(int row, const QString &text, bool good, bool bad);
141 void save() const;
143 void load();
144
146 Ui::Dialog &m_ui;
148 QWidget *m_parent;
150 mediax::qt6::QtCastDiscovery *m_discovery = nullptr;
152 std::map<QString, ActiveCast> m_casts;
154 QTimer m_timer;
160 bool m_loading = false;
162 uint32_t m_saved_width = 1280;
164 uint32_t m_saved_height = 720;
166 uint32_t m_saved_framerate = 25;
167};
168
169#endif // STREAMS_CAST_TAB_H
Casts an H.264 encoded test card to a Chromecast.
QWidget * m_parent
Parent widget for message boxes.
Definition cast_tab.h:148
int activeCount() const
The number of devices being cast to.
Definition cast_tab.cpp:196
QVariantMap selectedDevice() const
The selected device, empty if none.
Definition cast_tab.cpp:367
mediax::qt6::QtCastDiscovery * m_discovery
Finds the Chromecasts.
Definition cast_tab.h:150
void setStateText(int row, const QString &text, bool good, bool bad)
Show the state of one row.
Definition cast_tab.cpp:527
~CastTab() final
Stop all the casts and discovery.
Definition cast_tab.cpp:186
void startSelected()
Cast the selected test card to the selected device.
Definition cast_tab.cpp:251
void updateStates()
Show the state of every row.
Definition cast_tab.cpp:472
bool m_loading
Set while the widgets are changed by the program so the edits are not acted on.
Definition cast_tab.h:160
TabIndicator m_indicator
Red dot on the tab header while casting.
Definition cast_tab.h:156
void fillFramerates(uint32_t select_framerate)
Fill the frame rate combo for the picture height of the selected resolution.
Definition cast_tab.cpp:443
void selectionChanged()
The settings combos follow the selected device.
Definition cast_tab.cpp:377
uint32_t m_saved_width
The saved picture width, restored when the device allows it.
Definition cast_tab.h:162
uint32_t m_saved_height
The saved picture height.
Definition cast_tab.h:164
void save() const
Save the picture and test card settings.
Definition cast_tab.cpp:537
void rebuildTable()
Rebuild the table from the discovered devices and the devices being cast to.
Definition cast_tab.cpp:308
CastTab(Ui::Dialog &ui, QWidget *parent=nullptr)
Construct a new Chromecast tab, wire up the widgets and start discovery.
Definition cast_tab.cpp:87
int selectedPattern() const
The test card index selected in the pattern combo.
Definition cast_tab.cpp:467
QTimer m_timer
Refreshes the state column.
Definition cast_tab.h:154
void refresh()
Ask the network for Chromecasts again.
Definition cast_tab.cpp:240
Ui::Dialog & m_ui
The main dialogue UI.
Definition cast_tab.h:146
void fromJson(const QJsonObject &settings)
Apply the picture and test card settings of a JSON object.
Definition cast_tab.cpp:211
QString selectedId() const
The id of the selected device, empty if none.
Definition cast_tab.cpp:362
void load()
Load the saved picture and test card settings.
Definition cast_tab.cpp:548
uint32_t m_saved_framerate
The saved frame rate.
Definition cast_tab.h:166
void updateButtons()
Enable the buttons that apply to the selection and update the count.
Definition cast_tab.cpp:513
QJsonObject toJson() const
The picture and test card settings as a JSON object for the configuration file.
Definition cast_tab.cpp:201
std::map< QString, ActiveCast > m_casts
The running casts keyed by device id.
Definition cast_tab.h:152
void fillResolutions(uint32_t max_height, uint32_t select_width, uint32_t select_height)
Fill the resolution combo for the tallest picture a device plays.
Definition cast_tab.cpp:405
QString m_discovery_error
Message of a failed discovery.
Definition cast_tab.h:158
void stopSelected()
Stop casting to the selected device.
Definition cast_tab.cpp:298
Shows a red dot on the right of a tab header while something is running.
Definition tab_indicator.h:31
A running cast and the settings it was started with.
Definition cast_tab.h:107
uint32_t height
Picture height.
Definition cast_tab.h:115
uint32_t framerate
Frames per second.
Definition cast_tab.h:117
std::unique_ptr< toolx::streams::CastGenerator > generator
The generator.
Definition cast_tab.h:109
QVariantMap device
The device, kept in case discovery loses it while it is being cast to.
Definition cast_tab.h:111
uint32_t width
Picture width.
Definition cast_tab.h:113
A small red dot on the right of a tab header, shown while streams are running.