From 386507ae390abb166ea9c2b4aa953235667a51f5 Mon Sep 17 00:00:00 2001 From: Tony Mountifield Date: Tue, 24 Dec 2024 11:55:21 +0000 Subject: [PATCH 1/3] Add settings checkbox to enable/disable tooltips --- src/clientsettingsdlg.cpp | 12 ++++++++++++ src/clientsettingsdlg.h | 2 ++ src/clientsettingsdlgbase.ui | 15 +++++++++++++++ src/settings.cpp | 9 +++++++++ src/settings.h | 2 ++ 5 files changed, 40 insertions(+) diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index ad92a0f8e1..53d68a4558 100644 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -477,6 +477,11 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet butLearnSoloOffset->setAccessibleName ( tr ( "Solo offset MIDI learn button" ) ); butLearnMuteOffset->setAccessibleName ( tr ( "Mute offset MIDI learn button" ) ); + // show tooltips + chbShowToolTips->setWhatsThis ( "" + tr ( "Show ToolTips" ) + ": " + + tr ( "Enable or disable the showing of ToolTips when the mouse points to certain items." ) ); + chbShowToolTips->setAccessibleName ( tr ( "Show ToolTips check box" ) ); + // init driver button #if defined( _WIN32 ) && !defined( WITH_JACK ) butDriverSetup->setText ( tr ( "ASIO Device Settings" ) ); @@ -561,6 +566,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet // init audio alerts chbAudioAlerts->setCheckState ( pSettings->bEnableAudioAlerts ? Qt::Checked : Qt::Unchecked ); + // init show tooltips + chbShowToolTips->setCheckState ( pSettings->bShowToolTips ? Qt::Checked : Qt::Unchecked ); + // update feedback detection chbDetectFeedback->setCheckState ( pSettings->bEnableFeedbackDetection ? Qt::Checked : Qt::Unchecked ); @@ -726,6 +734,8 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet QObject::connect ( chbAudioAlerts, &QCheckBox::stateChanged, this, &CClientSettingsDlg::OnAudioAlertsChanged ); + QObject::connect ( chbShowToolTips, &QCheckBox::stateChanged, this, &CClientSettingsDlg::OnShowToolTipsChanged ); + // line edits QObject::connect ( edtNewClientLevel, &QLineEdit::editingFinished, this, &CClientSettingsDlg::OnNewClientLevelEditingFinished ); @@ -1275,6 +1285,8 @@ void CClientSettingsDlg::OnMeterStyleActivated ( int iMeterStyleIdx ) void CClientSettingsDlg::OnAudioAlertsChanged ( int value ) { pSettings->bEnableAudioAlerts = value == Qt::Checked; } +void CClientSettingsDlg::OnShowToolTipsChanged ( int value ) { pSettings->bShowToolTips = value == Qt::Checked; } + void CClientSettingsDlg::OnAutoJitBufStateChanged ( int value ) { pClient->SetDoAutoSockBufSize ( value == Qt::Checked ); diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index 7844f64117..9d6b4e541e 100644 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -120,6 +120,7 @@ public slots: void OnGUIDesignActivated ( int iDesignIdx ); void OnMeterStyleActivated ( int iMeterStyleIdx ); void OnAudioAlertsChanged ( int value ); + void OnShowToolTipsChanged ( int value ); void OnLanguageChanged ( QString strLanguage ) { pSettings->strLanguage = strLanguage; } void OnAliasTextChanged ( const QString& strNewName ); void OnInstrumentActivated ( int iCntryListItem ); @@ -140,6 +141,7 @@ public slots: void GUIDesignChanged(); void MeterStyleChanged(); void AudioAlertsChanged(); + void ShowToolTipsChanged(); void AudioChannelsChanged(); void CustomDirectoriesChanged(); void NumMixerPanelRowsChanged ( int value ); diff --git a/src/clientsettingsdlgbase.ui b/src/clientsettingsdlgbase.ui index 842ab9220c..d5165b96a6 100644 --- a/src/clientsettingsdlgbase.ui +++ b/src/clientsettingsdlgbase.ui @@ -276,6 +276,13 @@ + + + + + + + @@ -322,6 +329,13 @@ + + + + Show Tooltips + + + @@ -2266,6 +2280,7 @@ cbxLanguage spnMixerRows chbAudioAlerts + chbShowToolTips cbxSoundcard butDriverSetup cbxLInChan diff --git a/src/settings.cpp b/src/settings.cpp index bdc453913e..05f03ebcbd 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -460,6 +460,12 @@ void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument, bEnableAudioAlerts = bValue; } + // show tooltips + if ( GetFlagIniSet ( IniXMLDocument, "client", "showtooltips", bValue ) ) + { + bShowToolTips = bValue; + } + // name pClient->ChannelInfo.strName = FromBase64ToString ( GetIniSetting ( IniXMLDocument, "client", "name_base64", ToBase64 ( QCoreApplication::translate ( "CMusProfDlg", "No Name" ) ) ) ); @@ -927,6 +933,9 @@ void CClientSettings::WriteSettingsToXML ( QDomDocument& IniXMLDocument, bool is // audio alerts SetFlagIniSet ( IniXMLDocument, "client", "enableaudioalerts", bEnableAudioAlerts ); + // show tooltips + SetFlagIniSet ( IniXMLDocument, "client", "showtooltips", bShowToolTips ); + // name PutIniSetting ( IniXMLDocument, "client", "name_base64", ToBase64 ( pClient->ChannelInfo.strName ) ); diff --git a/src/settings.h b/src/settings.h index 4086a217fa..e0b4adb14e 100644 --- a/src/settings.h +++ b/src/settings.h @@ -179,6 +179,7 @@ class CClientSettings : public CSettings eDirectoryType ( AT_DEFAULT ), bEnableFeedbackDetection ( true ), bEnableAudioAlerts ( false ), + bShowToolTips ( true ), vecWindowPosSettings(), // empty array vecWindowPosChat(), // empty array vecWindowPosConnect(), // empty array @@ -252,6 +253,7 @@ class CClientSettings : public CSettings int iCustomDirectoryIndex; // index of selected custom directory bool bEnableFeedbackDetection; bool bEnableAudioAlerts; + bool bShowToolTips; // window position/state settings QByteArray vecWindowPosSettings; From d28f82249b8ab49687f10c3bfd577741926f86f1 Mon Sep 17 00:00:00 2001 From: Tony Mountifield Date: Tue, 24 Dec 2024 14:57:41 +0000 Subject: [PATCH 2/3] Add tooltip event filters controlled by setting --- src/clientdlg.cpp | 16 ++++++++++++++++ src/clientdlg.h | 2 ++ src/clientsettingsdlg.cpp | 28 +++++++++++++++++++++++++--- src/clientsettingsdlg.h | 2 ++ src/clientsettingsdlgbase.ui | 2 +- 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index b102c34724..c707dfca20 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -104,11 +104,13 @@ CClientDlg::CClientDlg ( CClient* pNCliP, lbrInputLevelL->setAccessibleName ( strInpLevHAccText ); lbrInputLevelL->setAccessibleDescription ( strInpLevHAccDescr ); lbrInputLevelL->setToolTip ( strInpLevHTT ); + lbrInputLevelL->installEventFilter ( this ); // install event filter for tooltips lbrInputLevelL->setEnabled ( false ); lbrInputLevelR->setWhatsThis ( strInpLevH ); lbrInputLevelR->setAccessibleName ( strInpLevHAccText ); lbrInputLevelR->setAccessibleDescription ( strInpLevHAccDescr ); lbrInputLevelR->setToolTip ( strInpLevHTT ); + lbrInputLevelR->installEventFilter ( this ); // install event filter for tooltips lbrInputLevelR->setEnabled ( false ); // connect/disconnect button @@ -173,6 +175,7 @@ CClientDlg::CClientDlg ( CClient* pNCliP, "you will not have much fun using %1." ) .arg ( APP_NAME ) + TOOLTIP_COM_END_TEXT ); + ledDelay->installEventFilter ( this ); // install event filter for tooltips ledDelay->setAccessibleName ( tr ( "Delay status LED indicator" ) ); @@ -204,6 +207,7 @@ CClientDlg::CClientDlg ( CClient* pNCliP, ledBuffers->setToolTip ( tr ( "If this LED indicator turns red, " "the audio stream is interrupted." ) + TOOLTIP_COM_END_TEXT ); + ledBuffers->installEventFilter ( this ); // install event filter for tooltips ledBuffers->setAccessibleName ( tr ( "Local Jitter Buffer status LED indicator" ) ); @@ -1558,3 +1562,15 @@ void CClientDlg::OnMIDIControllerUsageChanged ( bool bEnabled ) // Enable/disable runtime MIDI via the sound interface through the public CClient interface pClient->EnableMIDI ( bEnabled ); } + +bool CClientDlg::eventFilter ( QObject* obj, QEvent* event ) +{ + if ( event->type() == QEvent::ToolTip ) + { + // return true to suppress tooltip, false to allow it + return !pSettings->bShowToolTips; + } + + // continue with normal processing for other events + return QObject::eventFilter ( obj, event ); +} diff --git a/src/clientdlg.h b/src/clientdlg.h index 6a34cc66f0..c54f4328a1 100644 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -142,6 +142,8 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase virtual void dropEvent ( QDropEvent* Event ) { ManageDragNDrop ( Event, false ); } void UpdateDisplay(); + bool eventFilter ( QObject* obj, QEvent* event ); + CClientSettingsDlg ClientSettingsDlg; CChatDlg ChatDlg; CConnectDlg ConnectDlg; diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index 53d68a4558..ce118692e9 100644 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -129,16 +129,21 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet lblNetBuf->setWhatsThis ( strJitterBufferSize ); lblNetBuf->setToolTip ( strJitterBufferSizeTT ); + lblNetBuf->installEventFilter ( this ); // install event filter for tooltips grbJitterBuffer->setWhatsThis ( strJitterBufferSize ); grbJitterBuffer->setToolTip ( strJitterBufferSizeTT ); + grbJitterBuffer->installEventFilter ( this ); // install event filter for tooltips sldNetBuf->setWhatsThis ( strJitterBufferSize ); sldNetBuf->setAccessibleName ( tr ( "Local jitter buffer slider control" ) ); sldNetBuf->setToolTip ( strJitterBufferSizeTT ); + sldNetBuf->installEventFilter ( this ); // install event filter for tooltips sldNetBufServer->setWhatsThis ( strJitterBufferSize ); sldNetBufServer->setAccessibleName ( tr ( "Server jitter buffer slider control" ) ); sldNetBufServer->setToolTip ( strJitterBufferSizeTT ); + sldNetBufServer->installEventFilter ( this ); // install event filter for tooltips chbAutoJitBuf->setAccessibleName ( tr ( "Auto jitter buffer check box" ) ); chbAutoJitBuf->setToolTip ( strJitterBufferSizeTT ); + chbAutoJitBuf->installEventFilter ( this ); // install event filter for tooltips #if !defined( WITH_JACK ) // sound card device @@ -166,6 +171,7 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet "driver, make sure to connect the ASIO inputs in the kX DSP settings " "panel." ) + TOOLTIP_COM_END_TEXT ); + cbxSoundcard->installEventFilter ( this ); // install event filter for tooltips # endif // sound card input/output channel mapping @@ -272,17 +278,21 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet rbtBufferDelayPreferred->setWhatsThis ( strSndCrdBufDelay ); rbtBufferDelayPreferred->setAccessibleName ( tr ( "64 samples setting radio button" ) ); rbtBufferDelayPreferred->setToolTip ( strSndCrdBufDelayTT ); + rbtBufferDelayPreferred->installEventFilter ( this ); // install event filter for tooltips rbtBufferDelayDefault->setWhatsThis ( strSndCrdBufDelay ); rbtBufferDelayDefault->setAccessibleName ( tr ( "128 samples setting radio button" ) ); rbtBufferDelayDefault->setToolTip ( strSndCrdBufDelayTT ); + rbtBufferDelayDefault->installEventFilter ( this ); // install event filter for tooltips rbtBufferDelaySafe->setWhatsThis ( strSndCrdBufDelay ); rbtBufferDelaySafe->setAccessibleName ( tr ( "256 samples setting radio button" ) ); rbtBufferDelaySafe->setToolTip ( strSndCrdBufDelayTT ); + rbtBufferDelaySafe->installEventFilter ( this ); // install event filter for tooltips #if defined( _WIN32 ) && !defined( WITH_JACK ) butDriverSetup->setWhatsThis ( strSndCardDriverSetup ); butDriverSetup->setAccessibleName ( tr ( "ASIO Device Settings push button" ) ); butDriverSetup->setToolTip ( strSndCardDriverSetupTT ); + butDriverSetup->installEventFilter ( this ); // install event filter for tooltips #endif // fancy skin @@ -478,9 +488,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet butLearnMuteOffset->setAccessibleName ( tr ( "Mute offset MIDI learn button" ) ); // show tooltips - chbShowToolTips->setWhatsThis ( "" + tr ( "Show ToolTips" ) + ": " + - tr ( "Enable or disable the showing of ToolTips when the mouse points to certain items." ) ); - chbShowToolTips->setAccessibleName ( tr ( "Show ToolTips check box" ) ); + chbShowToolTips->setWhatsThis ( "" + tr ( "Show tool tips" ) + ": " + + tr ( "Enable or disable the showing of tool tips when the mouse points to certain items." ) ); + chbShowToolTips->setAccessibleName ( tr ( "Show tool tips check box" ) ); // init driver button #if defined( _WIN32 ) && !defined( WITH_JACK ) @@ -1708,3 +1718,15 @@ void CClientSettingsDlg::OnMidiCCReceived ( int ccNumber ) } void CClientSettingsDlg::OnMIDIPickupModeToggled ( bool checked ) { pSettings->bMIDIPickupMode = checked; } + +bool CClientSettingsDlg::eventFilter ( QObject* obj, QEvent* event ) +{ + if ( event->type() == QEvent::ToolTip ) + { + // return true to suppress tooltip, false to allow it + return !pSettings->bShowToolTips; + } + + // continue with normal processing for other events + return QObject::eventFilter ( obj, event ); +} diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index 9d6b4e541e..89657d5a59 100644 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -94,6 +94,8 @@ class CClientSettingsDlg : public CBaseDlg, private Ui_CClientSettingsDlgBase virtual void showEvent ( QShowEvent* ) override; virtual bool eventFilter ( QObject* obj, QEvent* event ) override; + bool eventFilter ( QObject* obj, QEvent* event ); + CClient* pClient; CClientSettings* pSettings; QTimer TimerStatus; diff --git a/src/clientsettingsdlgbase.ui b/src/clientsettingsdlgbase.ui index d5165b96a6..19f39d3a9b 100644 --- a/src/clientsettingsdlgbase.ui +++ b/src/clientsettingsdlgbase.ui @@ -332,7 +332,7 @@ - Show Tooltips + Show tool tips From ac5a877ff58b78b4928e6b7ea139c7921ef64661 Mon Sep 17 00:00:00 2001 From: jrd Date: Sun, 19 Jul 2026 02:36:59 +0000 Subject: [PATCH 3/3] Merge tooltip suppression into existing CClientSettingsDlg::eventFilter Since #3446 was written, main gained its own eventFilter override in CClientSettingsDlg (MIDI device list refresh on dropdown click), which collided with the one this branch adds. Fold the ToolTip suppression check into that filter and drop the duplicate declaration/definition. Co-Authored-By: Claude Fable 5 --- src/clientsettingsdlg.cpp | 18 ++++++------------ src/clientsettingsdlg.h | 2 -- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index ce118692e9..e045dbbb23 100644 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -1056,6 +1056,12 @@ void CClientSettingsDlg::showEvent ( QShowEvent* event ) bool CClientSettingsDlg::eventFilter ( QObject* obj, QEvent* event ) { + if ( event->type() == QEvent::ToolTip ) + { + // return true to suppress tooltip, false to allow it + return !pSettings->bShowToolTips; + } + // Refresh MIDI device list when user clicks on the dropdown if ( obj == cbxMidiDevice ) { @@ -1718,15 +1724,3 @@ void CClientSettingsDlg::OnMidiCCReceived ( int ccNumber ) } void CClientSettingsDlg::OnMIDIPickupModeToggled ( bool checked ) { pSettings->bMIDIPickupMode = checked; } - -bool CClientSettingsDlg::eventFilter ( QObject* obj, QEvent* event ) -{ - if ( event->type() == QEvent::ToolTip ) - { - // return true to suppress tooltip, false to allow it - return !pSettings->bShowToolTips; - } - - // continue with normal processing for other events - return QObject::eventFilter ( obj, event ); -} diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index 89657d5a59..9d6b4e541e 100644 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -94,8 +94,6 @@ class CClientSettingsDlg : public CBaseDlg, private Ui_CClientSettingsDlgBase virtual void showEvent ( QShowEvent* ) override; virtual bool eventFilter ( QObject* obj, QEvent* event ) override; - bool eventFilter ( QObject* obj, QEvent* event ); - CClient* pClient; CClientSettings* pSettings; QTimer TimerStatus;