Merge remote-tracking branch 'origin/pr/4189'
This commit is contained in:
commit
5527d27ba7
@ -668,9 +668,10 @@ class AbstractAudio(QObject):
|
||||
muted_changed = pyqtSignal(bool)
|
||||
recently_audible_changed = pyqtSignal(bool)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
def __init__(self, tab, parent=None):
|
||||
super().__init__(parent)
|
||||
self._widget = None
|
||||
self._tab = tab
|
||||
|
||||
def set_muted(self, muted: bool):
|
||||
"""Set this tab as muted or not."""
|
||||
|
@ -643,6 +643,7 @@ class WebEngineAudio(browsertab.AbstractAudio):
|
||||
page = self._widget.page()
|
||||
page.audioMutedChanged.connect(self.muted_changed)
|
||||
page.recentlyAudibleChanged.connect(self.recently_audible_changed)
|
||||
self._tab.url_changed.connect(self._on_url_changed)
|
||||
|
||||
def set_muted(self, muted: bool):
|
||||
page = self._widget.page()
|
||||
@ -656,6 +657,11 @@ class WebEngineAudio(browsertab.AbstractAudio):
|
||||
page = self._widget.page()
|
||||
return page.recentlyAudible()
|
||||
|
||||
@pyqtSlot(QUrl)
|
||||
def _on_url_changed(self, url):
|
||||
mute = config.instance.get('content.mute', url=url)
|
||||
self.set_muted(mute)
|
||||
|
||||
|
||||
class _WebEnginePermissions(QObject):
|
||||
|
||||
@ -1000,7 +1006,7 @@ class WebEngineTab(browsertab.AbstractTab):
|
||||
self.printing = WebEnginePrinting(tab=self)
|
||||
self.elements = WebEngineElements(tab=self)
|
||||
self.action = WebEngineAction(tab=self)
|
||||
self.audio = WebEngineAudio(parent=self)
|
||||
self.audio = WebEngineAudio(tab=self, parent=self)
|
||||
self._permissions = _WebEnginePermissions(tab=self, parent=self)
|
||||
self._scripts = _WebEngineScripts(tab=self, parent=self)
|
||||
# We're assigning settings in _set_widget
|
||||
|
@ -667,7 +667,7 @@ class WebKitTab(browsertab.AbstractTab):
|
||||
self.printing = WebKitPrinting(tab=self)
|
||||
self.elements = WebKitElements(tab=self)
|
||||
self.action = WebKitAction(tab=self)
|
||||
self.audio = WebKitAudio(parent=self)
|
||||
self.audio = WebKitAudio(tab=self, parent=self)
|
||||
# We're assigning settings in _set_widget
|
||||
self.settings = webkitsettings.WebKitSettings(settings=None)
|
||||
self._set_widget(widget)
|
||||
|
@ -806,6 +806,12 @@ content.xss_auditing:
|
||||
Suspicious scripts will be blocked and reported in the inspector's
|
||||
JavaScript console.
|
||||
|
||||
content.mute:
|
||||
default: false
|
||||
type: Bool
|
||||
supports_pattern: true
|
||||
desc: Automatically mute tabs.
|
||||
|
||||
# emacs: '
|
||||
|
||||
## completion
|
||||
|
@ -257,7 +257,7 @@ class FakeWebTab(browsertab.AbstractTab):
|
||||
self.history = FakeWebTabHistory(self, can_go_back=can_go_back,
|
||||
can_go_forward=can_go_forward)
|
||||
self.scroller = FakeWebTabScroller(self, scroll_pos_perc)
|
||||
self.audio = FakeWebTabAudio()
|
||||
self.audio = FakeWebTabAudio(self)
|
||||
wrapped = QWidget()
|
||||
self._layout.wrap(self, wrapped)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user