Connect the all-streams window to chat actions and service lifetime
This commit is contained in:
1 parent
bad9ee3a0c
commit
fd05ec47ab
3 files changed
+19
-2
No files matched your search
@@ -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());
|
||||
|
||||
@@ -22,6 +22,7 @@ class AudioRecorder;
|
||||
class ConnMonitorWindow;
|
||||
class VideoPlayerWindow;
|
||||
class StreamPlayerWindow;
|
||||
class StreamGridWindow;
|
||||
class StreamPublishEngine;
|
||||
class StreamPublishWindow;
|
||||
class ImageViewerWindow;
|
||||
@@ -131,6 +132,7 @@ private:
|
||||
ConnMonitorWindow *m_connMonitor = nullptr;
|
||||
VideoPlayerWindow *m_videoPlayer = nullptr;
|
||||
QPointer<StreamPlayerWindow> m_streamPlayer;
|
||||
QPointer<StreamGridWindow> m_streamGrid;
|
||||
StreamPublishEngine* m_streamPublisher = nullptr;
|
||||
QPointer<StreamPublishWindow> m_streamPublishWindow;
|
||||
ImageViewerWindow *m_imageViewer = nullptr;
|
||||
|
||||
@@ -539,7 +539,7 @@ MessageList::MessageList(DbManager* db, AudioRecorder* recorder, QWidget *parent
|
||||
if (!channel.toULongLong()) return;
|
||||
auto text = [](const char* s) { return QCoreApplication::translate("ChatGui", s); };
|
||||
QMenu menu(this);
|
||||
const bool own = std::any_of(m_streamSources.begin(), m_streamSources.end(), [](const LiveSource& source) { return source.self; });
|
||||
const bool own = std::any_of(m_streamSources.begin(), m_streamSources.end(), [](const LiveStreamSource& source) { return source.self; });
|
||||
auto* publish = menu.addAction(text(own ? "Manage stream" : "Start stream"));
|
||||
menu.addSeparator();
|
||||
auto* files = menu.addAction(text("Group files"));
|
||||
|
||||
Reference in new issue
Block a user