diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index cbfa04518d..799749d616 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -84,11 +84,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 @@ -153,6 +155,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" ) ); @@ -184,6 +187,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" ) ); @@ -1516,3 +1520,15 @@ void CClientDlg::SetPingTime ( const int iPingTime, const int iOverallDelayMs, c // set current LED status ledDelay->SetLight ( eOverallDelayLEDColor ); } + +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 2a9062a58d..ba67ba6664 100644 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -121,6 +121,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 c7458826fd..d12dfd093d 100644 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -106,16 +106,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 @@ -143,6 +148,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 @@ -249,17 +255,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 @@ -397,6 +407,11 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet "A second sound device may be required to hear the alerts." ) ); chbAudioAlerts->setAccessibleName ( tr ( "Audio Alerts check box" ) ); + // show tooltips + 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 ) butDriverSetup->setText ( tr ( "ASIO Device Settings" ) ); @@ -480,6 +495,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 ); @@ -645,6 +663,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 ); @@ -998,6 +1018,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 ); @@ -1216,3 +1238,15 @@ void CClientSettingsDlg::OnAudioPanValueChanged ( int value ) pClient->SetAudioInFader ( value ); UpdateAudioFaderSlider(); } + +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 4678aeb32f..e310bab803 100644 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -71,6 +71,8 @@ class CClientSettingsDlg : public CBaseDlg, private Ui_CClientSettingsDlgBase virtual void showEvent ( QShowEvent* ); + bool eventFilter ( QObject* obj, QEvent* event ); + CClient* pClient; CClientSettings* pSettings; QTimer TimerStatus; @@ -97,6 +99,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 ); @@ -116,6 +119,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 7ee311701a..95e9b778d6 100644 --- a/src/clientsettingsdlgbase.ui +++ b/src/clientsettingsdlgbase.ui @@ -276,6 +276,13 @@ + + + + + + + @@ -322,6 +329,13 @@ + + + + Show tool tips + + + @@ -1358,6 +1372,7 @@ cbxLanguage spnMixerRows chbAudioAlerts + chbShowToolTips cbxSoundcard butDriverSetup cbxLInChan diff --git a/src/settings.cpp b/src/settings.cpp index 20a89b2ad4..37baea050f 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -289,6 +289,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" ) ) ) ); @@ -652,6 +658,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 a7d7564519..9dc09b1709 100644 --- a/src/settings.h +++ b/src/settings.h @@ -157,6 +157,7 @@ class CClientSettings : public CSettings eDirectoryType ( AT_DEFAULT ), bEnableFeedbackDetection ( true ), bEnableAudioAlerts ( false ), + bShowToolTips ( true ), vecWindowPosSettings(), // empty array vecWindowPosChat(), // empty array vecWindowPosConnect(), // empty array @@ -191,6 +192,7 @@ class CClientSettings : public CSettings int iCustomDirectoryIndex; // index of selected custom directory bool bEnableFeedbackDetection; bool bEnableAudioAlerts; + bool bShowToolTips; // window position/state settings QByteArray vecWindowPosSettings;