From 1719f8e108141fa16c83ff170c1a60f2cb44cf75 Mon Sep 17 00:00:00 2001 From: evgeny Date: Sun, 1 Nov 2026 21:38:36 +0100 Subject: [PATCH] Save shared stream microphone through the main window --- tools/chatgui/src/mainwindow.cpp | 2 ++ tools/chatgui/src/stream_publish_window.cpp | 6 +----- tools/chatgui/src/stream_publish_window.h | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/chatgui/src/mainwindow.cpp b/tools/chatgui/src/mainwindow.cpp index 6873f4a21..d453fe88a 100644 --- a/tools/chatgui/src/mainwindow.cpp +++ b/tools/chatgui/src/mainwindow.cpp @@ -806,6 +806,8 @@ void MainWindow::showStreamPublisher(quint64 group, StreamGridWindow* returnTo) qint64 constructedUs = elapsed.nsecsElapsed() / 1000; connect(m_streamPublishWindow, &StreamPublishWindow::settingsChanged, this, [](const QString& settings) { postUiStateKv("stream_capture_settings", settings); }); + connect(m_streamPublishWindow, &StreamPublishWindow::microphoneChanged, this, + [](const QString& id) { postUiStateKv("audio_input_id", id); }); if (returnTo) connect(m_streamPublishWindow, &StreamPublishWindow::closed, returnTo, [returnTo] { if (!returnTo->isVisible()) return; returnTo->raise(); returnTo->activateWindow(); diff --git a/tools/chatgui/src/stream_publish_window.cpp b/tools/chatgui/src/stream_publish_window.cpp index fdcda8f03..217d9899a 100644 --- a/tools/chatgui/src/stream_publish_window.cpp +++ b/tools/chatgui/src/stream_publish_window.cpp @@ -2,7 +2,6 @@ #include "videoplayer_window.h" #include "capture_controls.h" #include "sound_manager.h" -#include "../transport/gui_bridge.h" #include "debug_config.h" #include #include @@ -201,11 +200,8 @@ StreamPublishWindow::StreamPublishWindow(StreamPublishEngine* engine, uint64_t g auto* sound = SoundManager::instance(); const QString id = action->data().toString(); if (id != sound->captureDevice()) { - if (gui_bridge_post_setting(GUI_SETTING_UI_STATE, "audio_input_id", id.toUtf8().constData()) < 0) { - DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "desktop microphone selection could not be saved input=%s", qPrintable(id)); - m_status->setText(text("Failed to select device")); refreshMicrophones(); synchronize(); return; - } sound->setDevices(sound->playbackDevice(), id); + emit microphoneChanged(id); } } synchronize(); saveSettings(); diff --git a/tools/chatgui/src/stream_publish_window.h b/tools/chatgui/src/stream_publish_window.h index 7b281e364..845f03119 100644 --- a/tools/chatgui/src/stream_publish_window.h +++ b/tools/chatgui/src/stream_publish_window.h @@ -23,6 +23,7 @@ public: StreamPublishWindow(StreamPublishEngine* engine, uint64_t group, QWidget* parent = nullptr, const QString& settings = {}); signals: void settingsChanged(const QString& settings); // Новый компактный JSON, только при изменении выбора; runtime handles не сохраняются. + void microphoneChanged(const QString& id); // Новый общий выбор SoundManager; владелец сохраняет audio_input_id в ui_state. void closed(); // Принят closeEvent; MainWindow использует сигнал для возврата фокуса в grid, без остановки публикации. protected: void closeEvent(QCloseEvent* event) override;