From 910cfeac20fc01a3e5c6a19bd7a47362d04194f7 Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 14 Sep 2026 21:12:53 +0300 Subject: [PATCH] =?UTF-8?q?chatgui:=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B9=D0=BA=D0=B0=20=D0=B7=D0=B2=D1=83=D0=BA=D0=B0=20=D1=83?= =?UTF-8?q?=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=B0=D0=BD=D0=B0=D0=BB=20(sound=5Fon=5Fm?= =?UTF-8?q?essage)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/chatgui/src/channelsettingsdialog.cpp | 7 +++++++ tools/chatgui/src/channelsettingsdialog.h | 1 + tools/chatgui/src/mainwindow.cpp | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/chatgui/src/channelsettingsdialog.cpp b/tools/chatgui/src/channelsettingsdialog.cpp index e0eeab5b..09adad79 100644 --- a/tools/chatgui/src/channelsettingsdialog.cpp +++ b/tools/chatgui/src/channelsettingsdialog.cpp @@ -38,6 +38,10 @@ ChannelSettingsDialog::ChannelSettingsDialog(const QString& channelId, DbManager m_autoPlayVoice->setToolTip(QStringLiteral("Voice messages will play automatically when received. Multiple messages queue up and play sequentially without interrupting current playback.")); layout->addWidget(m_autoPlayVoice); + m_soundOnMessage = new QCheckBox(QStringLiteral("Play sound on incoming message"), this); + m_soundOnMessage->setToolTip(QStringLiteral("Play a notification sound when a message arrives in this channel.")); + layout->addWidget(m_soundOnMessage); + m_pttMode = new QCheckBox(QStringLiteral("Push-To-Talk (PTT) mode"), this); m_pttMode->setToolTip(QStringLiteral("Record voice messages with push-to-talk. (Coming soon)")); m_pttMode->setEnabled(false); @@ -74,6 +78,8 @@ ChannelSettingsDialog::ChannelSettingsDialog(const QString& channelId, DbManager if (m_db && m_db->isOpen()) { QString autoPlayKey = QStringLiteral("ch_%1_auto_play_voice").arg(channelId); m_autoPlayVoice->setChecked(m_db->getUiStateInt(autoPlayKey, 0) != 0); + QString soundKey = QStringLiteral("ch_%1_sound_on_message").arg(channelId); + m_soundOnMessage->setChecked(m_db->getUiStateInt(soundKey, 1) != 0); QString pttKey = QStringLiteral("ch_%1_ptt_mode").arg(channelId); m_pttMode->setChecked(m_db->getUiStateInt(pttKey, 0) != 0); } @@ -94,6 +100,7 @@ void ChannelSettingsDialog::onSave() { } }; saveKey("auto_play_voice", m_autoPlayVoice->isChecked() ? 1 : 0); + saveKey("sound_on_message", m_soundOnMessage->isChecked() ? 1 : 0); saveKey("ptt_mode", m_pttMode->isChecked() ? 1 : 0); accept(); } diff --git a/tools/chatgui/src/channelsettingsdialog.h b/tools/chatgui/src/channelsettingsdialog.h index d15fd3d2..9328de7d 100644 --- a/tools/chatgui/src/channelsettingsdialog.h +++ b/tools/chatgui/src/channelsettingsdialog.h @@ -18,5 +18,6 @@ private: QString m_channelId; DbManager* m_db; QCheckBox* m_autoPlayVoice; + QCheckBox* m_soundOnMessage; QCheckBox* m_pttMode; }; diff --git a/tools/chatgui/src/mainwindow.cpp b/tools/chatgui/src/mainwindow.cpp index a5a0a20a..7092aff2 100644 --- a/tools/chatgui/src/mainwindow.cpp +++ b/tools/chatgui/src/mainwindow.cpp @@ -593,7 +593,8 @@ void MainWindow::openImage(const QString& filePath) { void MainWindow::onMessageReceived(const char* ch_id, int ch_id_len, uint64_t author) { QString cid = QString::fromUtf8(ch_id, ch_id_len); - if (m_db && author != m_db->myNodeId()) + if (m_db && author != m_db->myNodeId() + && m_db->getUiStateInt(QStringLiteral("ch_%1_sound_on_message").arg(cid), 1)) SoundManager::instance()->play("msg_incoming"); if (m_messageList) { if (cid == m_currentChannelId) {