ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
hls_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_HLS_TAB_H
14#define STREAMS_HLS_TAB_H
15
16#include <map>
17
18#include <QObject>
19#include <QJsonArray>
20#include <QPointer>
21#include <QString>
22#include <QWidget>
23
24#include "../ui_toolx.h"
25#include "streams/hls_player.h"
27
33class HlsTab : public QObject
34{
35 Q_OBJECT
36
37public:
44 explicit HlsTab(Ui::Dialog &ui, QWidget *parent = nullptr);
45
49 ~HlsTab() final;
50
51 HlsTab(const HlsTab &) = delete;
52 HlsTab &operator=(const HlsTab &) = delete;
53 HlsTab(HlsTab &&) = delete;
54 HlsTab &operator=(HlsTab &&) = delete;
55
61 QJsonArray toJson() const;
62
70 void fromJson(const QJsonArray &streams);
71
72public slots:
76 void addStream();
77
81 void removeSelected();
82
86 void playSelected();
87
91 void stopSelected();
92
93private:
95 int insertRow(const QString &name, const QString &url);
97 int rowOfId(int id) const;
99 int idOfRow(int row) const;
101 void setState(int id, const QString &state);
103 void updateButtons();
105 void save() const;
107 void load();
108
110 Ui::Dialog &m_ui;
112 QWidget *m_parent;
114 std::map<int, QPointer<HlsPlayer>> m_players;
118 int m_next_id = 1;
120 bool m_loading = false;
121};
122
123#endif // STREAMS_HLS_TAB_H
Ui::Dialog & m_ui
The main dialogue UI.
Definition hls_tab.h:110
void stopSelected()
Close the player of the selected stream.
Definition hls_tab.cpp:191
bool m_loading
Set while the table is being filled so edits are not saved.
Definition hls_tab.h:120
QJsonArray toJson() const
The table as a JSON array for the configuration file.
Definition hls_tab.cpp:91
void fromJson(const QJsonArray &streams)
Replace the table with the streams of a JSON array.
Definition hls_tab.cpp:104
std::map< int, QPointer< HlsPlayer > > m_players
The active players keyed by stream id.
Definition hls_tab.h:114
int insertRow(const QString &name, const QString &url)
Add a row to the table and return its index.
Definition hls_tab.cpp:204
void addStream()
Add an empty stream to the table and start editing its URL.
Definition hls_tab.cpp:125
void setState(int id, const QString &state)
Show the state of a stream.
Definition hls_tab.cpp:240
void load()
Load the saved streams.
Definition hls_tab.cpp:284
void updateButtons()
Enable the buttons that apply to the selected stream and update the count.
Definition hls_tab.cpp:257
int m_next_id
The id given to the next stream.
Definition hls_tab.h:118
int idOfRow(int row) const
The id of the stream in a row.
Definition hls_tab.cpp:234
void save() const
Save the names and URLs.
Definition hls_tab.cpp:271
int rowOfId(int id) const
Find the row of a stream, -1 if it was removed.
Definition hls_tab.cpp:223
QWidget * m_parent
Parent widget for player windows.
Definition hls_tab.h:112
HlsTab(Ui::Dialog &ui, QWidget *parent=nullptr)
Construct a new HLS tab and wire up the widgets.
Definition hls_tab.cpp:47
TabIndicator m_indicator
Red dot on the tab header, visible while any stream is playing.
Definition hls_tab.h:116
~HlsTab() final
Stop all the players.
Definition hls_tab.cpp:80
void playSelected()
Open a player for the selected stream.
Definition hls_tab.cpp:155
void removeSelected()
Stop and remove the selected stream.
Definition hls_tab.cpp:136
Shows a red dot on the right of a tab header while something is running.
Definition tab_indicator.h:31
Video player window for HLS (HTTP Live Streaming) streams.
A small red dot on the right of a tab header, shown while streams are running.