Make inspector detachable.

This commit is contained in:
Florian Bruhin 2014-05-26 12:16:03 +02:00
parent 8eed5a02d4
commit ee241c3f6c
3 changed files with 18 additions and 5 deletions

3
TODO
View File

@ -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.

View File

@ -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(

View File

@ -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."""