GUI: added option to suppress all beeps

This commit is contained in:
Jean-Francois Dockes 2019-09-22 11:23:39 +02:00
parent 303da9304d
commit 7f2dd3cd8b
6 changed files with 24 additions and 3 deletions

View File

@ -237,6 +237,8 @@ void rwSettings(bool writing)
SETTING_RW(prefs.termMatchType, "/Recoll/prefs/query/termMatchType",
Int, 0);
SETTING_RW(prefs.noBeeps, "/Recoll/prefs/query/noBeeps", Bool, false);
// This is not really the current program version, just a value to
// be used in case we have incompatible changes one day
SETTING_RW(prefs.rclVersion, "/Recoll/prefs/rclVersion", Int, 1009);

View File

@ -135,7 +135,9 @@ class PrefsPack {
// Program version that wrote this. Not used for now, in prevision
// of the case where we might need an incompatible change
int rclVersion;
// Suppress all noises
bool noBeeps;
bool showTrayIcon;
bool closeToTray;

View File

@ -375,7 +375,7 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
if (found) {
m_canBeep = true;
} else {
if (m_canBeep)
if (m_canBeep && !prefs.noBeeps)
QApplication::beep();
m_canBeep = false;
}

View File

@ -250,7 +250,12 @@ void RclMain::previewPrevOrNextInTab(Preview * w, int sid, int docnum, bool nxt)
else
docnum--;
if (docnum < 0 || !m_source || docnum >= m_source->getResCnt()) {
QApplication::beep();
if (!prefs.noBeeps) {
LOGDEB("Beeping\n");
QApplication::beep();
} else {
LOGDEB("Not beeping because nobeep is set\n");
}
return;
}

View File

@ -260,6 +260,16 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="noBeepsCB">
<property name="text">
<string>Suppress all beeps.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ssNoCompleteCB">
<property name="text">

View File

@ -126,6 +126,7 @@ void UIPrefsDialog::setFromPrefs()
filterBT_RB->setChecked(1);
break;
}
noBeepsCB->setChecked(prefs.noBeeps);
ssNoCompleteCB->setChecked(prefs.ssearchNoComplete);
ssSearchOnCompleteCB->setChecked(prefs.ssearchStartOnComplete);
ssSearchOnCompleteCB->setEnabled(!prefs.ssearchNoComplete);
@ -261,6 +262,7 @@ void UIPrefsDialog::setupReslistFontPB()
void UIPrefsDialog::accept()
{
prefs.noBeeps = noBeepsCB->isChecked();
prefs.ssearchNoComplete = ssNoCompleteCB->isChecked();
prefs.ssearchStartOnComplete = ssSearchOnCompleteCB->isChecked();