From ee241c3f6c6ec71778bd0e37967df058c7602937 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 26 May 2014 12:16:03 +0200 Subject: [PATCH] Make inspector detachable. --- TODO | 3 --- qutebrowser/config/configdata.py | 4 ++++ qutebrowser/widgets/mainwindow.py | 16 ++++++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index ddd43bb72..e6944eb02 100644 --- a/TODO +++ b/TODO @@ -64,8 +64,6 @@ Improvements / minor features - Display metavars for commands in input bar. - count support for special keys - set-as-default argument/command -- Make inspector height resizable -- Make inspector detachable (own window) - Enable disk caching QNetworkManager.setCache() and use a QNetworkDiskCache probably - clear cookies command @@ -80,7 +78,6 @@ Improvements / minor features elem = frame.findFirstElement('*:focus') - somehow unfocus elements (hide blinking cursor) when insert mode is left? - tabs: some more padding? -- Make it possible to open inspector in a new window. - Copy link location on crash mail should not copy mailto: - Drag&Drop of tabs to other windows - Use QNetworkAccessManager per QWebPage again so we can set proxy per tab. diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index e1bc88103..866808f2d 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -214,6 +214,10 @@ DATA = OrderedDict([ ('message-timeout', SettingValue(types.Int(), '2000'), "Time (in ms) to show messages in the statusbar for."), + + ('detach-inspector', + SettingValue(types.Bool(), 'false'), + "Whether to show the webinspector as own window."), )), ('network', sect.KeyValue( diff --git a/qutebrowser/widgets/mainwindow.py b/qutebrowser/widgets/mainwindow.py index c94fc4efd..4b34813d8 100644 --- a/qutebrowser/widgets/mainwindow.py +++ b/qutebrowser/widgets/mainwindow.py @@ -76,8 +76,10 @@ class MainWindow(QWidget): self.completion = CompletionView(self) self.inspector = QWebInspector() self.inspector.hide() - self._splitter.addWidget(self.inspector) - self._splitter.setStretchFactor(0, 50) + + if not config.get('ui', 'detach-inspector'): + self._splitter.addWidget(self.inspector) + self._splitter.setStretchFactor(0, 50) self._vbox.addWidget(self._splitter) @@ -97,6 +99,16 @@ class MainWindow(QWidget): """Resize completion if config changed.""" if section == 'completion' and option == 'height': self.resize_completion() + if section == 'ui' and option == 'detach-inspector': + detach = config.get('ui', 'detach-inspector') + if detach and self.inspector.parent() is not None: + shown = self.inspector.isVisible() + self.inspector.setParent(None) + if shown: + self.inspector.show() + elif not detach and self.inspector.parent() is None: + self._splitter.addWidget(self.inspector) + self._splitter.setStretchFactor(0, 50) def resize_completion(self): """Adjust completion according to config."""