Skip to content

Commit

Permalink
Add tooltip event filters controlled by setting
Browse files Browse the repository at this point in the history
  • Loading branch information
softins committed Jan 8, 2025
1 parent 55d3a3f commit aff9985
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/clientdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" ) );

Expand Down Expand Up @@ -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" ) );

Expand Down Expand Up @@ -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 );
}
2 changes: 2 additions & 0 deletions src/clientdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 25 additions & 3 deletions src/clientsettingsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -398,9 +408,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet
chbAudioAlerts->setAccessibleName ( tr ( "Audio Alerts check box" ) );

// show tooltips
chbShowToolTips->setWhatsThis ( "<b>" + tr ( "Show ToolTips" ) + ":</b> " +
tr ( "Enable or disable the showing of ToolTips when the mouse points to certain items." ) );
chbShowToolTips->setAccessibleName ( tr ( "Show ToolTips check box" ) );
chbShowToolTips->setWhatsThis ( "<b>" + tr ( "Show tool tips" ) + ":</b> " +
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 )
Expand Down Expand Up @@ -1228,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 );
}
2 changes: 2 additions & 0 deletions src/clientsettingsdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/clientsettingsdlgbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
<item>
<widget class="QCheckBox" name="chbShowToolTips">
<property name="text">
<string>Show Tooltips</string>
<string>Show tool tips</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit aff9985

Please sign in to comment.