ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
rtsp_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_RTSP_TAB_H
14#define STREAMS_RTSP_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/rtsp_player.h"
27
33class RtspTab : public QObject
34{
35 Q_OBJECT
36
37public:
44 explicit RtspTab(Ui::Dialog &ui, QWidget *parent = nullptr);
45
49 ~RtspTab() final;
50
51 RtspTab(const RtspTab &) = delete;
52 RtspTab &operator=(const RtspTab &) = delete;
53 RtspTab(RtspTab &&) = delete;
54 RtspTab &operator=(RtspTab &&) = delete;
55
62 QJsonArray toJson() const;
63
71 void fromJson(const QJsonArray &streams);
72
73public slots:
77 void addStream();
78
82 void removeSelected();
83
87 void playSelected();
88
92 void stopSelected();
93
94private:
96 int insertRow(const QString &name, const QString &url, const QString &user);
98 int rowOfId(int id) const;
100 int idOfRow(int row) const;
102 void setState(int id, const QString &state);
104 void updateButtons();
106 void save() const;
108 void load();
109
111 Ui::Dialog &m_ui;
113 QWidget *m_parent;
115 std::map<int, QPointer<RtspPlayer>> m_players;
119 int m_next_id = 1;
121 bool m_loading = false;
122};
123
124#endif // STREAMS_RTSP_TAB_H
~RtspTab() final
Stop all the players.
Definition rtsp_tab.cpp:102
int rowOfId(int id) const
Find the row of a stream, -1 if it was removed.
Definition rtsp_tab.cpp:251
void removeSelected()
Stop and remove the selected stream.
Definition rtsp_tab.cpp:160
std::map< int, QPointer< RtspPlayer > > m_players
The active players keyed by stream id.
Definition rtsp_tab.h:115
void setState(int id, const QString &state)
Show the state of a stream.
Definition rtsp_tab.cpp:268
void stopSelected()
Close the player of the selected stream.
Definition rtsp_tab.cpp:217
void fromJson(const QJsonArray &streams)
Replace the table with the streams of a JSON array.
Definition rtsp_tab.cpp:127
bool m_loading
Set while the table is being filled so edits are not saved.
Definition rtsp_tab.h:121
int insertRow(const QString &name, const QString &url, const QString &user)
Add a row to the table and return its index.
Definition rtsp_tab.cpp:230
int idOfRow(int row) const
The id of the stream in a row.
Definition rtsp_tab.cpp:262
QWidget * m_parent
Parent widget for player windows.
Definition rtsp_tab.h:113
void load()
Load the saved streams.
Definition rtsp_tab.cpp:313
void playSelected()
Open a player for the selected stream.
Definition rtsp_tab.cpp:179
void addStream()
Add an empty stream to the table and start editing its URL.
Definition rtsp_tab.cpp:149
void save() const
Save the names, URLs and user names.
Definition rtsp_tab.cpp:299
void updateButtons()
Enable the buttons that apply to the selected stream and update the count.
Definition rtsp_tab.cpp:285
int m_next_id
The id given to the next stream.
Definition rtsp_tab.h:119
TabIndicator m_indicator
Red dot on the tab header, visible while any stream is playing.
Definition rtsp_tab.h:117
QJsonArray toJson() const
The table as a JSON array for the configuration file.
Definition rtsp_tab.cpp:113
Ui::Dialog & m_ui
The main dialogue UI.
Definition rtsp_tab.h:111
RtspTab(Ui::Dialog &ui, QWidget *parent=nullptr)
Construct a new RTSP tab and wire up the widgets.
Definition rtsp_tab.cpp:68
Shows a red dot on the right of a tab header while something is running.
Definition tab_indicator.h:31
Video player window for RTSP camera streams.
A small red dot on the right of a tab header, shown while streams are running.