Terminal: Make audible bell configurable

Change-Id: I6cc02f2f1b873f39352151265fb7ba1fe0f170fc
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-03-24 22:14:18 +01:00
parent af5f702f54
commit 2eb4884742
4 changed files with 16 additions and 3 deletions

View File

@@ -104,12 +104,19 @@ TerminalSettings::TerminalSettings()
"instead of closing the terminal.")); "instead of closing the terminal."));
sendEscapeToTerminal.setDefaultValue(false); sendEscapeToTerminal.setDefaultValue(false);
audibleBell.setSettingsKey("AudibleBell");
audibleBell.setLabelText(Tr::tr("Audible bell"));
audibleBell.setToolTip(Tr::tr("If enabled, the terminal will beep when a bell "
"character is received."));
audibleBell.setDefaultValue(true);
registerAspect(&font); registerAspect(&font);
registerAspect(&fontSize); registerAspect(&fontSize);
registerAspect(&shell); registerAspect(&shell);
registerAspect(&allowBlinkingCursor); registerAspect(&allowBlinkingCursor);
registerAspect(&enableTerminal); registerAspect(&enableTerminal);
registerAspect(&sendEscapeToTerminal); registerAspect(&sendEscapeToTerminal);
registerAspect(&audibleBell);
setupColor(this, setupColor(this,
foregroundColor, foregroundColor,

View File

@@ -29,6 +29,7 @@ public:
Utils::BoolAspect allowBlinkingCursor; Utils::BoolAspect allowBlinkingCursor;
Utils::BoolAspect sendEscapeToTerminal; Utils::BoolAspect sendEscapeToTerminal;
Utils::BoolAspect audibleBell;
}; };
} // namespace Terminal } // namespace Terminal

View File

@@ -378,9 +378,10 @@ QWidget *TerminalSettingsPage::widget()
Column { Column {
Group { Group {
title(Tr::tr("General")), title(Tr::tr("General")),
Row { Column {
settings.enableTerminal, st, settings.enableTerminal, st,
settings.sendEscapeToTerminal, st settings.sendEscapeToTerminal, st,
settings.audibleBell, st,
}, },
}, },
Group { Group {

View File

@@ -332,7 +332,11 @@ void TerminalWidget::setupSurface()
connect(m_surface.get(), &Internal::TerminalSurface::unscroll, this, [this] { connect(m_surface.get(), &Internal::TerminalSurface::unscroll, this, [this] {
verticalScrollBar()->setValue(verticalScrollBar()->maximum()); verticalScrollBar()->setValue(verticalScrollBar()->maximum());
}); });
connect(m_surface.get(), &Internal::TerminalSurface::bell, this, [] { QApplication::beep(); }); connect(m_surface.get(), &Internal::TerminalSurface::bell, this, [] {
if (TerminalSettings::instance().audibleBell.value())
QApplication::beep();
});
if (m_shellIntegration) { if (m_shellIntegration) {
connect(m_shellIntegration.get(), connect(m_shellIntegration.get(),
&ShellIntegration::commandChanged, &ShellIntegration::commandChanged,