Allow to set message clear timer to 0

Fixes #2527
This commit is contained in:
Florian Bruhin 2017-04-16 13:07:33 +02:00
parent 7c4e4a5818
commit 842c2d297e
4 changed files with 10 additions and 4 deletions

View File

@ -44,6 +44,7 @@ Changed
- The HTTP cache is disabled with QtWebKit on Qt 5.8 now as it leads to frequent
crashes due to a Qt bug.
- stdin is now closed immediately for processes spawned from qutebrowser
- When ui -> message-timeout is set to 0, messages are now never cleared.
Fixed
~~~~~

View File

@ -581,6 +581,7 @@ Default: +pass:[bottom]+
[[ui-message-timeout]]
=== message-timeout
Time (in ms) to show messages in the statusbar for.
Set to 0 to never clear messages.
Default: +pass:[2000]+

View File

@ -317,8 +317,9 @@ def data(readonly=False):
"The position of the status bar."),
('message-timeout',
SettingValue(typ.Int(), '2000'),
"Time (in ms) to show messages in the statusbar for."),
SettingValue(typ.Int(minval=0), '2000'),
"Time (in ms) to show messages in the statusbar for.\n"
"Set to 0 to never clear messages."),
('message-unfocused',
SettingValue(typ.Bool(), 'false'),

View File

@ -98,7 +98,9 @@ class MessageView(QWidget):
@config.change_filter('ui', 'message-timeout')
def _set_clear_timer_interval(self):
"""Configure self._clear_timer according to the config."""
self._clear_timer.setInterval(config.get('ui', 'message-timeout'))
interval = config.get('ui', 'message-timeout')
if interval != 0:
self._clear_timer.setInterval(interval)
@pyqtSlot()
def clear_messages(self):
@ -125,7 +127,8 @@ class MessageView(QWidget):
widget = Message(level, text, replace=replace, parent=self)
self._vbox.addWidget(widget)
widget.show()
self._clear_timer.start()
if config.get('ui', 'message-timeout') != 0:
self._clear_timer.start()
self._messages.append(widget)
self._last_text = text
self.show()