Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add profile checkbox to enable/disable tooltips #3446

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
34 changes: 34 additions & 0 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 @@ -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 ( "<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 )
butDriverSetup->setText ( tr ( "ASIO Device Settings" ) );
Expand Down Expand Up @@ -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 );

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

Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
}
4 changes: 4 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 All @@ -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 );
Expand All @@ -116,6 +119,7 @@ public slots:
void GUIDesignChanged();
void MeterStyleChanged();
void AudioAlertsChanged();
void ShowToolTipsChanged();
void AudioChannelsChanged();
void CustomDirectoriesChanged();
void NumMixerPanelRowsChanged ( int value );
Expand Down
15 changes: 15 additions & 0 deletions src/clientsettingsdlgbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,13 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblShowToolTips">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -322,6 +329,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chbShowToolTips">
<property name="text">
<string>Show tool tips</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down Expand Up @@ -1358,6 +1372,7 @@
<tabstop>cbxLanguage</tabstop>
<tabstop>spnMixerRows</tabstop>
<tabstop>chbAudioAlerts</tabstop>
<tabstop>chbShowToolTips</tabstop>
<tabstop>cbxSoundcard</tabstop>
<tabstop>butDriverSetup</tabstop>
<tabstop>cbxLInChan</tabstop>
Expand Down
9 changes: 9 additions & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" ) ) ) );
Expand Down Expand Up @@ -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 ) );

Expand Down
2 changes: 2 additions & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Loading