Connect the all-streams window to chat actions and service lifetime

This commit is contained in:
evgeny committed 2026-10-20 16:39:50 +02:00
1 parent bad9ee3a0c
commit fd05ec47ab
3 files changed
+19 -2

No files matched your search

+16 -1
View File
@@ -2,6 +2,7 @@
#include "mainwindow.h"
#include "single_instance.h"
#include "streamplayer_window.h"
#include "streamgrid_window.h"
#include "stream_publish_engine.h"
#include "stream_publish_window.h"
#include "channellist.h"
@@ -211,6 +212,7 @@ MainWindow::~MainWindow() {
if (m_streamPublishWindow) delete m_streamPublishWindow.data();
delete m_streamPublisher; m_streamPublisher = nullptr;
if (m_streamPlayer) delete m_streamPlayer.data();
if (m_streamGrid) delete m_streamGrid.data();
gui_bridge_set_stream_sources_cb(nullptr);
s_mainWindow = nullptr;
m_cpuLoadTimer->stop();
@@ -634,6 +636,7 @@ void MainWindow::setupBridgeCallbacks() {
s_mainWindow->m_messageList->clearDmCallRoute();
s_mainWindow->m_messageList->clearStreams();
if (s_mainWindow->m_streamPlayer) s_mainWindow->m_streamPlayer->close();
if (s_mainWindow->m_streamGrid) s_mainWindow->m_streamGrid->close();
s_mainWindow->m_channelList->clearDmPresence();
} else {
if (type == 12) s_mainWindow->m_messageList->watchStreams();
@@ -650,7 +653,9 @@ void MainWindow::setupBridgeCallbacks() {
s_mainWindow->m_messageList->onDmMessages(data, len);
});
gui_bridge_set_stream_sources_cb([](const uint8_t* data, int len) {
if (s_mainWindow) s_mainWindow->m_messageList->onStreamSources(data, len);
if (!s_mainWindow) return;
s_mainWindow->m_messageList->onStreamSources(data, len);
if (s_mainWindow->m_streamGrid) s_mainWindow->m_streamGrid->onSources(data, len);
});
gui_bridge_set_attachment_preparation_cb([](const uint8_t* data, int len) {
if (s_mainWindow) s_mainWindow->m_messageList->onAttachmentPreparation(data, len);
@@ -678,10 +683,20 @@ void MainWindow::setupConnects() {
});
connect(m_messageList, &MessageList::streamRequested, this,
[this](quint64 group, quint64 source, quint64 epoch, const QString& name) {
if (m_streamGrid) delete m_streamGrid.data();
if (m_streamPlayer) delete m_streamPlayer.data();
m_streamPlayer = new StreamPlayerWindow(group, source, epoch, name);
m_streamPlayer->setAttribute(Qt::WA_DeleteOnClose); m_streamPlayer->show();
});
connect(m_messageList, &MessageList::allStreamsRequested, this, [this](quint64 group) {
if (m_streamPlayer) delete m_streamPlayer.data();
if (m_streamGrid && m_streamGrid->group() != group) delete m_streamGrid.data();
if (!m_streamGrid) {
m_streamGrid = new StreamGridWindow(group);
m_streamGrid->setAttribute(Qt::WA_DeleteOnClose);
}
m_streamGrid->show(); m_streamGrid->raise(); m_streamGrid->activateWindow();
});
connect(RadioAudioEngine::instance(), &RadioAudioEngine::stateChanged, this, [this] {
auto* engine = RadioAudioEngine::instance();
m_accountList->model()->setRadioState(engine->groupId(), engine->isActive(), engine->isTransmitting());