From bab88eb99ee0fcaf170dd2a69def1f10ac7fd375 Mon Sep 17 00:00:00 2001 From: Hartmnt Date: Fri, 31 May 2024 12:04:28 +0000 Subject: [PATCH] FIX(client): Correctly remember muted state across restarts Previously, only the "mute" and "deaf" states were saved to the settings file. However, when a user deafens themselves without muting first, Mumble will automatically unmute the user as soon as they undeafen. The "autoUnmute" state was not saved in the settings though, leading to the state "deafened (muted implied)" being reduced to "deafened and muted". This commit moves the autoUnmute state from being a local member of MainWindow to the settings file allowing to preserve the "deafened (muted implied)" state. Fixes #6393 --- src/mumble/MainWindow.cpp | 9 ++++----- src/mumble/MainWindow.h | 1 - src/mumble/Settings.h | 1 + src/mumble/SettingsKeys.h | 1 + src/mumble/SettingsMacros.h | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index 556ab0ee6b4..f32428a4f40 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -136,7 +136,6 @@ MainWindow::MainWindow(QWidget *p) #endif forceQuit = false; restartOnQuit = false; - bAutoUnmute = false; Channel::add(Channel::ROOT_ID, tr("Root")); @@ -2716,7 +2715,7 @@ void MainWindow::on_qaAudioDeaf_triggered() { return; } - if (!qaAudioDeaf->isChecked() && bAutoUnmute) { + if (!qaAudioDeaf->isChecked() && Global::get().s.unmuteOnUndeaf) { qaAudioDeaf->setChecked(true); qaAudioMute->setChecked(false); on_qaAudioMute_triggered(); @@ -2730,13 +2729,13 @@ void MainWindow::on_qaAudioDeaf_triggered() { Global::get().s.bDeaf = qaAudioDeaf->isChecked(); if (Global::get().s.bDeaf && !Global::get().s.bMute) { - bAutoUnmute = true; - Global::get().s.bMute = true; + Global::get().s.unmuteOnUndeaf = true; + Global::get().s.bMute = true; qaAudioMute->setChecked(true); Global::get().l->log(Log::SelfDeaf, tr("Muted and deafened.")); } else if (Global::get().s.bDeaf) { Global::get().l->log(Log::SelfDeaf, tr("Deafened.")); - bAutoUnmute = false; + Global::get().s.unmuteOnUndeaf = false; } else { Global::get().l->log(Log::SelfUndeaf, tr("Undeafened.")); } diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h index dccdfd12607..e54eab71169 100644 --- a/src/mumble/MainWindow.h +++ b/src/mumble/MainWindow.h @@ -125,7 +125,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindow { bool forceQuit; /// Restart the client after shutdown bool restartOnQuit; - bool bAutoUnmute; /// Contains the cursor whose position is immediately before the image to /// save when activating the "Save Image As..." context menu item. diff --git a/src/mumble/Settings.h b/src/mumble/Settings.h index 09b37d69388..ad001d2f939 100644 --- a/src/mumble/Settings.h +++ b/src/mumble/Settings.h @@ -230,6 +230,7 @@ struct Settings { QString qsTxMuteCue = cqsDefaultMuteCue; bool bTransmitPosition = false; + bool unmuteOnUndeaf = false; bool bMute = false; bool bDeaf = false; bool bTTS = false; diff --git a/src/mumble/SettingsKeys.h b/src/mumble/SettingsKeys.h index 9fa29647d1f..57e45c43097 100644 --- a/src/mumble/SettingsKeys.h +++ b/src/mumble/SettingsKeys.h @@ -35,6 +35,7 @@ namespace SettingsKeys { */ // Audio settings +const SettingsKey UNMUTE_ON_UNDEAF_KEY = { "unmute_on_undeaf" }; const SettingsKey MUTE_KEY = { "mute" }; const SettingsKey DEAF_KEY = { "deaf" }; const SettingsKey TRANSMIT_MODE_KEY = { "transmit_mode" }; diff --git a/src/mumble/SettingsMacros.h b/src/mumble/SettingsMacros.h index 1d2047ada8b..03d5bb4449b 100644 --- a/src/mumble/SettingsMacros.h +++ b/src/mumble/SettingsMacros.h @@ -19,6 +19,7 @@ PROCESS(misc, CRASH_EMAIL_ADDRESS_KEY, crashReportEmail) #define AUDIO_SETTINGS \ + PROCESS(audio, UNMUTE_ON_UNDEAF_KEY, unmuteOnUndeaf) \ PROCESS(audio, MUTE_KEY, bMute) \ PROCESS(audio, DEAF_KEY, bDeaf) \ PROCESS(audio, TRANSMIT_MODE_KEY, atTransmit) \