Open own broadcast controls and keep rejected voice recording idle

This commit is contained in:
evgeny committed 2026-10-14 12:08:01 +02:00
1 parent ba17f9908d
commit 80bd17a28e
3 files changed
+7 -3

No files matched your search

+1
View File
@@ -466,6 +466,7 @@ void InputBar::onPttPressed() {
if (!m_recorder || !m_recorder->isInitialized()) return; if (!m_recorder || !m_recorder->isInitialized()) return;
m_recorder->startRecording(); m_recorder->startRecording();
m_pttActive = m_recorder->isRecording(); m_pttActive = m_recorder->isRecording();
if (!m_pttActive) { DEBUG_WARN(DEBUG_CATEGORY_MEDIA, "voice recording did not start; composer remains idle"); return; }
m_recordTarget = m_channelIdForRecord; m_recordTarget = m_channelIdForRecord;
m_recordReply = m_replyTo; m_recordReplyGeneration = m_replyGeneration; m_replyFailed = false; m_recordReply = m_replyTo; m_recordReplyGeneration = m_replyGeneration; m_replyFailed = false;
m_pttBtn->setStyleSheet(m_pttBtn->styleSheet() + m_pttBtn->setStyleSheet(m_pttBtn->styleSheet() +
+5 -2
View File
@@ -437,15 +437,18 @@ MessageList::MessageList(DbManager* db, AudioRecorder* recorder, QWidget *parent
m_streamBtn->setCursor(Qt::PointingHandCursor); m_streamBtn->setCursor(Qt::PointingHandCursor);
connect(m_streamBtn, &QPushButton::clicked, this, [this] { connect(m_streamBtn, &QPushButton::clicked, this, [this] {
auto watch = [this](const LiveSource& source) { 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", 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); 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);
}; };
QMenu menu(this); 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()); }); connect(publish, &QAction::triggered, this, [this] { emit streamPublishRequested(m_currentChannelId.toULongLong()); });
if (!m_streamSources.isEmpty()) menu.addSeparator(); if (!m_streamSources.isEmpty()) menu.addSeparator();
for (const auto& source : m_streamSources) { for (const auto& source : m_streamSources) {
if (source.self) continue;
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); });
} }
@@ -1512,7 +1515,7 @@ void MessageList::onStreamSources(const uint8_t* data, int len) {
clearStreams(); return; clearStreams(); return;
} }
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, member.value("self").toInt() != 0});
} }
m_streamSources = std::move(sources); m_streamBtn->setVisible(true); 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());
+1 -1
View File
@@ -89,7 +89,7 @@ private:
quint64 m_callGroup = 0; quint64 m_callGroup = 0;
QPushButton* m_radioBtn = nullptr; /* шапка: переключатель рации */ QPushButton* m_radioBtn = nullptr; /* шапка: переключатель рации */
QPushButton* m_streamBtn = nullptr; QPushButton* m_streamBtn = nullptr;
struct LiveSource { quint64 id, epoch; QString name; }; struct LiveSource { quint64 id, epoch; QString name; bool self = false; };
QList<LiveSource> m_streamSources; QList<LiveSource> m_streamSources;
RadioPanel* m_radioPanel = nullptr; /* верхняя панель устройств, VAD и PTT */ RadioPanel* m_radioPanel = nullptr; /* верхняя панель устройств, VAD и PTT */
bool m_radioOn = false; bool m_radioOn = false;