diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 93d290e34..b774461b2 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -31,6 +31,7 @@ |Setting|Description |<>|The available zoom levels, separated by commas. |<>|The default zoom level. +|<>|Where to show the downloaded files. |<>|Time (in ms) to show messages in the statusbar for. |<>|Whether to show messages in unfocused windows. |<>|Whether to confirm quitting the application. @@ -441,6 +442,17 @@ The default zoom level. Default: +pass:[100%]+ +[[ui-downloads-position]] +=== downloads-position +Where to show the downloaded files. + +Valid values: + + * +north+ + * +south+ + +Default: +pass:[north]+ + [[ui-message-timeout]] === message-timeout Time (in ms) to show messages in the statusbar for. diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 1d332e62a..96e146ada 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -235,6 +235,10 @@ def data(readonly=False): SettingValue(typ.Perc(), '100%'), "The default zoom level."), + ('downloads-position', + SettingValue(typ.VerticalPosition(), 'north'), + "Where to show the downloaded files."), + ('message-timeout', SettingValue(typ.Int(), '2000'), "Time (in ms) to show messages in the statusbar for."), diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index b0523f5f4..55159d538 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -1264,6 +1264,13 @@ class Position(BaseType): return self.MAPPING[value] +class VerticalPosition(BaseType): + + """The position of the download bar.""" + + valid_values = ValidValues('north', 'south') + + class UrlList(List): """A list of URLs.""" diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index dbcead867..c619a6f47 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -96,19 +96,18 @@ class MainWindow(QWidget): window=self.win_id) self._downloadview = downloadview.DownloadView(self.win_id) - self._vbox.addWidget(self._downloadview) self._downloadview.show() self._tabbed_browser = tabbedbrowser.TabbedBrowser(self.win_id) objreg.register('tabbed-browser', self._tabbed_browser, scope='window', window=self.win_id) - self._vbox.addWidget(self._tabbed_browser) # We need to set an explicit parent for StatusBar because it does some # show/hide magic immediately which would mean it'd show up as a # window. self.status = bar.StatusBar(self.win_id, parent=self) - self._vbox.addWidget(self.status) + + self._add_widgets() self._completion = completionwidget.CompletionView(self.win_id, self) @@ -141,6 +140,24 @@ class MainWindow(QWidget): """Resize the completion if related config options changed.""" if section == 'completion' and option in ('height', 'shrink'): self.resize_completion() + elif section == 'ui' and option == 'downloads-position': + self._add_widgets() + + def _add_widgets(self): + """Add or readd all widgets to the VBox.""" + self._vbox.removeWidget(self._tabbed_browser) + self._vbox.removeWidget(self._downloadview) + self._vbox.removeWidget(self.status) + position = config.get('ui', 'downloads-position') + if position == 'north': + self._vbox.addWidget(self._downloadview) + self._vbox.addWidget(self._tabbed_browser) + elif position == 'south': + self._vbox.addWidget(self._tabbed_browser) + self._vbox.addWidget(self._downloadview) + else: + raise ValueError("Invalid position {}!".format(position)) + self._vbox.addWidget(self.status) def _load_state_geometry(self): """Load the geometry from the state file."""