|
|
|
@ -441,8 +441,10 @@ MessageList::MessageList(DbManager* db, AudioRecorder* recorder, QWidget *parent |
|
|
|
qPrintable(m_currentChannelId), (unsigned long long)source.id, (unsigned long long)source.epoch); |
|
|
|
qPrintable(m_currentChannelId), (unsigned long long)source.id, (unsigned long long)source.epoch); |
|
|
|
emit streamRequested(m_currentChannelId.toULongLong(), source.id, source.epoch, source.name); |
|
|
|
emit streamRequested(m_currentChannelId.toULongLong(), source.id, source.epoch, source.name); |
|
|
|
}; |
|
|
|
}; |
|
|
|
if (m_streamSources.size() == 1) { watch(m_streamSources.front()); return; } |
|
|
|
|
|
|
|
QMenu menu(this); |
|
|
|
QMenu menu(this); |
|
|
|
|
|
|
|
auto* publish = menu.addAction(QCoreApplication::translate("ChatGui", "Broadcast stream")); |
|
|
|
|
|
|
|
connect(publish, &QAction::triggered, this, [this] { emit streamPublishRequested(m_currentChannelId.toULongLong()); }); |
|
|
|
|
|
|
|
if (!m_streamSources.isEmpty()) menu.addSeparator(); |
|
|
|
for (const auto& source : m_streamSources) { |
|
|
|
for (const auto& source : m_streamSources) { |
|
|
|
auto* action = menu.addAction(QStringLiteral("%1 · %2").arg(source.name).arg(source.id)); |
|
|
|
auto* action = menu.addAction(QStringLiteral("%1 · %2").arg(source.name).arg(source.id)); |
|
|
|
connect(action, &QAction::triggered, this, [watch, source] { watch(source); }); |
|
|
|
connect(action, &QAction::triggered, this, [watch, source] { watch(source); }); |
|
|
|
@ -1482,7 +1484,11 @@ void MessageList::watchStreams() { |
|
|
|
gui_stream_watch(isDmChannel(m_currentChannelId) ? 0 : m_currentChannelId.toULongLong()); |
|
|
|
gui_stream_watch(isDmChannel(m_currentChannelId) ? 0 : m_currentChannelId.toULongLong()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void MessageList::clearStreams() { m_streamSources.clear(); m_streamBtn->hide(); } |
|
|
|
void MessageList::clearStreams() { |
|
|
|
|
|
|
|
m_streamSources.clear(); m_streamBtn->setText(QString()); |
|
|
|
|
|
|
|
m_streamBtn->setVisible(!m_currentChannelId.isEmpty() && !isDmChannel(m_currentChannelId)); |
|
|
|
|
|
|
|
m_streamBtn->setToolTip(QCoreApplication::translate("ChatGui", "Live streams")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Полный снимок применяется атомарно; ответы предыдущего канала не меняют текущую шапку. */ |
|
|
|
/* Полный снимок применяется атомарно; ответы предыдущего канала не меняют текущую шапку. */ |
|
|
|
void MessageList::onStreamSources(const uint8_t* data, int len) { |
|
|
|
void MessageList::onStreamSources(const uint8_t* data, int len) { |
|
|
|
@ -1508,7 +1514,7 @@ void MessageList::onStreamSources(const uint8_t* data, int len) { |
|
|
|
QString name = member.value("name").toString(); if (name.isEmpty()) name = QString::number(id); |
|
|
|
QString name = member.value("name").toString(); if (name.isEmpty()) name = QString::number(id); |
|
|
|
sources.push_back({id, epoch, name}); |
|
|
|
sources.push_back({id, epoch, name}); |
|
|
|
} |
|
|
|
} |
|
|
|
m_streamSources = std::move(sources); m_streamBtn->setVisible(!m_streamSources.isEmpty()); |
|
|
|
m_streamSources = std::move(sources); m_streamBtn->setVisible(true); |
|
|
|
m_streamBtn->setText(m_streamSources.size() > 1 ? QString::number(m_streamSources.size()) : QString()); |
|
|
|
m_streamBtn->setText(m_streamSources.size() > 1 ? QString::number(m_streamSources.size()) : QString()); |
|
|
|
m_streamBtn->setToolTip(QCoreApplication::translate("ChatGui", "Live streams: %1").arg(m_streamSources.size())); |
|
|
|
m_streamBtn->setToolTip(QCoreApplication::translate("ChatGui", "Live streams: %1").arg(m_streamSources.size())); |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop stream header group=%llx sources=%d", (unsigned long long)group, (int)m_streamSources.size()); |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop stream header group=%llx sources=%d", (unsigned long long)group, (int)m_streamSources.size()); |
|
|
|
|