Open desktop stream playback windows from channel sources

This commit is contained in:
evgeny committed 2026-10-12 22:12:41 +02:00
1 parent fe7734b9e0
commit b4ebaa8863
3 files changed
+19

No files matched your search

+15
View File
@@ -1,5 +1,6 @@
#include <QCoreApplication>
#include "mainwindow.h"
#include "streamplayer_window.h"
#include "channellist.h"
#include "messagelist.h"
#include "messagedelegate.h"
@@ -197,6 +198,8 @@ MainWindow::MainWindow(QWidget *parent, DbManager* db, const QString& cfgPath,
}
MainWindow::~MainWindow() {
if (m_streamPlayer) delete m_streamPlayer.data();
gui_bridge_set_stream_sources_cb(nullptr);
s_mainWindow = nullptr;
m_cpuLoadTimer->stop();
gui_bridge_set_cpu_load_cb(nullptr);
@@ -585,8 +588,11 @@ void MainWindow::setupBridgeCallbacks() {
s_mainWindow->m_channelList->setCpuLoad(0);
s_mainWindow->m_accountList->model()->setRadioState(0, false, false);
s_mainWindow->m_messageList->clearDmCallRoute();
s_mainWindow->m_messageList->clearStreams();
if (s_mainWindow->m_streamPlayer) s_mainWindow->m_streamPlayer->close();
s_mainWindow->m_channelList->clearDmPresence();
} else {
if (type == 12) s_mainWindow->m_messageList->watchStreams();
s_mainWindow->m_channelList->refreshDmPresence();
}
});
@@ -599,12 +605,21 @@ void MainWindow::setupBridgeCallbacks() {
if (s_mainWindow)
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);
});
gui_bridge_set_attachment_preparation_cb([](const uint8_t* data, int len) {
if (s_mainWindow) s_mainWindow->m_messageList->onAttachmentPreparation(data, len);
});
}
void MainWindow::setupConnects() {
connect(m_messageList, &MessageList::streamRequested, this,
[this](quint64 group, quint64 source, quint64 epoch, const QString& name) {
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(RadioAudioEngine::instance(), &RadioAudioEngine::stateChanged, this, [this] {
auto* engine = RadioAudioEngine::instance();
m_accountList->model()->setRadioState(engine->groupId(), engine->isActive(), engine->isTransmitting());