Skip to content

Commit

Permalink
Add settings checkbox to enable/disable tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
softins committed Dec 31, 2024
1 parent fe88e3e commit 21d11da
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/clientsettingsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,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 ToolTips" ) + ":</b> " +
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" ) );
Expand Down Expand Up @@ -480,6 +485,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 +653,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 +1008,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
2 changes: 2 additions & 0 deletions src/clientsettingsdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,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 +117,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 Tooltips</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

0 comments on commit 21d11da

Please sign in to comment.