From 9c8e59d2fbbe1fd7b8ca8020d0b1915f26b0fd31 Mon Sep 17 00:00:00 2001 From: ann0see Date: Sun, 15 Nov 2026 18:34:35 +0100 Subject: [PATCH] Store the settings when the settings dialog is closed Settings are currently only written when the application becomes inactive or quits (see CSettings). Anything that ends the process before that, for example a crash or the application being killed, discards the changes the user just made, including the musician profile, the audio device configuration and the language. Write them as well when the settings dialog is hidden, which covers closing it from the menu, from the check box and during shutdown. --- src/clientsettingsdlg.cpp | 9 +++++++++ src/clientsettingsdlg.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index ad92a0f8e1..c791599abc 100644 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -1034,6 +1034,15 @@ void CClientSettingsDlg::showEvent ( QShowEvent* event ) QDialog::showEvent ( event ); } +void CClientSettingsDlg::hideEvent ( QHideEvent* event ) +{ + // store the settings when the dialog is closed, so that they survive the + // application being terminated before it becomes inactive + pSettings->Save ( false ); + + QDialog::hideEvent ( event ); +} + bool CClientSettingsDlg::eventFilter ( QObject* obj, QEvent* event ) { // Refresh MIDI device list when user clicks on the dropdown diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index 7844f64117..85c5e71839 100644 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -92,6 +92,7 @@ class CClientSettingsDlg : public CBaseDlg, private Ui_CClientSettingsDlgBase QString GenSndCrdBufferDelayString ( const int iFrameSize, const QString strAddText = "" ); virtual void showEvent ( QShowEvent* ) override; + virtual void hideEvent ( QHideEvent* ) override; virtual bool eventFilter ( QObject* obj, QEvent* event ) override; CClient* pClient;