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
14 changes: 14 additions & 0 deletions src/clientdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
{
setupUi ( this );

// install event filter for tooltips
qApp->installEventFilter ( this );

// Add help text to controls -----------------------------------------------
// input level meter
QString strInpLevH = "<b>" + tr ( "Input Level Meter" ) + ":</b> " +
Expand Down Expand Up @@ -1516,3 +1519,14 @@ 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 && !pSettings->bShowToolTips )
{
return true; // don't show tooltip
}

// continue with normal processing of event
return CBaseDlg::eventFilter ( obj, event );
}
1 change: 1 addition & 0 deletions src/clientdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase
virtual void dragEnterEvent ( QDragEnterEvent* Event ) { ManageDragNDrop ( Event, true ); }
virtual void dropEvent ( QDropEvent* Event ) { ManageDragNDrop ( Event, false ); }
void UpdateDisplay();
bool eventFilter ( QObject* obj, QEvent* event );

CClientSettingsDlg ClientSettingsDlg;
CChatDlg ChatDlg;
Expand Down
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> " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it should be "Tooltips" by the style guide.
@gilgongo ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Guide says "Nouns use lower case unless they have a formal definition in this style guide". So it looks like if we're to be consistent with "check box" (for example) we might need to have it as "Show tool tips".

As an aside, we also use capitals to refer to things unique or in some way special to Jamulus, and not only terms in the Guide (hence "Audio Alerts" for example). Might add that to the Guide in fact. I like to think our slightly unusual use of capitals is inherited from the German origins of Jamulus :-)

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
Loading