Open own broadcast controls and keep rejected voice recording idle
This commit is contained in:
1 parent
ba17f9908d
commit
80bd17a28e
3 files changed
+7
-3
No files matched your search
@@ -437,15 +437,18 @@ MessageList::MessageList(DbManager* db, AudioRecorder* recorder, QWidget *parent
|
||||
m_streamBtn->setCursor(Qt::PointingHandCursor);
|
||||
connect(m_streamBtn, &QPushButton::clicked, this, [this] {
|
||||
auto watch = [this](const LiveSource& source) {
|
||||
if (source.self) { emit streamPublishRequested(m_currentChannelId.toULongLong()); return; }
|
||||
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop selected stream group=%s source=%llx epoch=%llx",
|
||||
qPrintable(m_currentChannelId), (unsigned long long)source.id, (unsigned long long)source.epoch);
|
||||
emit streamRequested(m_currentChannelId.toULongLong(), source.id, source.epoch, source.name);
|
||||
};
|
||||
QMenu menu(this);
|
||||
auto* publish = menu.addAction(QCoreApplication::translate("ChatGui", "Broadcast stream"));
|
||||
bool own = std::any_of(m_streamSources.begin(), m_streamSources.end(), [](const LiveSource& source) { return source.self; });
|
||||
auto* publish = menu.addAction(QCoreApplication::translate("ChatGui", own ? "Manage stream" : "Start stream"));
|
||||
connect(publish, &QAction::triggered, this, [this] { emit streamPublishRequested(m_currentChannelId.toULongLong()); });
|
||||
if (!m_streamSources.isEmpty()) menu.addSeparator();
|
||||
for (const auto& source : m_streamSources) {
|
||||
if (source.self) continue;
|
||||
auto* action = menu.addAction(QStringLiteral("%1 · %2").arg(source.name).arg(source.id));
|
||||
connect(action, &QAction::triggered, this, [watch, source] { watch(source); });
|
||||
}
|
||||
@@ -1512,7 +1515,7 @@ void MessageList::onStreamSources(const uint8_t* data, int len) {
|
||||
clearStreams(); return;
|
||||
}
|
||||
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, member.value("self").toInt() != 0});
|
||||
}
|
||||
m_streamSources = std::move(sources); m_streamBtn->setVisible(true);
|
||||
m_streamBtn->setText(m_streamSources.size() > 1 ? QString::number(m_streamSources.size()) : QString());
|
||||
|
||||
Reference in new issue
Block a user