Merge branch 'blyxxyz-status-position'
This commit is contained in:
commit
db1ba9ac88
@ -24,6 +24,8 @@ Added
|
|||||||
- Add new default binding `;t` for `:hint input`.
|
- Add new default binding `;t` for `:hint input`.
|
||||||
- New variables `$QUTE_CONFIG_DIR`, `$QUTE_DATA_DIR` and
|
- New variables `$QUTE_CONFIG_DIR`, `$QUTE_DATA_DIR` and
|
||||||
`$QUTE_DOWNLOAD_DIR` available for userscripts.
|
`$QUTE_DOWNLOAD_DIR` available for userscripts.
|
||||||
|
- New option `ui` -> `status-position` to configure the position of the
|
||||||
|
status bar (top/bottom).
|
||||||
|
|
||||||
Changed
|
Changed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -164,12 +164,12 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* Kevin Velghe
|
* Kevin Velghe
|
||||||
* Austin Anderson
|
* Austin Anderson
|
||||||
* Jimmy
|
* Jimmy
|
||||||
|
* Jan Verbeek
|
||||||
* Alexey "Averrin" Nabrodov
|
* Alexey "Averrin" Nabrodov
|
||||||
* avk
|
* avk
|
||||||
* ZDarian
|
* ZDarian
|
||||||
* Milan Svoboda
|
* Milan Svoboda
|
||||||
* John ShaggyTwoDope Jenkins
|
* John ShaggyTwoDope Jenkins
|
||||||
* Jan Verbeek
|
|
||||||
* Peter Vilim
|
* Peter Vilim
|
||||||
* Clayton Craft
|
* Clayton Craft
|
||||||
* Oliver Caldwell
|
* Oliver Caldwell
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|<<ui-zoom-levels,zoom-levels>>|The available zoom levels, separated by commas.
|
|<<ui-zoom-levels,zoom-levels>>|The available zoom levels, separated by commas.
|
||||||
|<<ui-default-zoom,default-zoom>>|The default zoom level.
|
|<<ui-default-zoom,default-zoom>>|The default zoom level.
|
||||||
|<<ui-downloads-position,downloads-position>>|Where to show the downloaded files.
|
|<<ui-downloads-position,downloads-position>>|Where to show the downloaded files.
|
||||||
|
|<<ui-status-position,status-position>>|The position of the status bar.
|
||||||
|<<ui-message-timeout,message-timeout>>|Time (in ms) to show messages in the statusbar for.
|
|<<ui-message-timeout,message-timeout>>|Time (in ms) to show messages in the statusbar for.
|
||||||
|<<ui-message-unfocused,message-unfocused>>|Whether to show messages in unfocused windows.
|
|<<ui-message-unfocused,message-unfocused>>|Whether to show messages in unfocused windows.
|
||||||
|<<ui-confirm-quit,confirm-quit>>|Whether to confirm quitting the application.
|
|<<ui-confirm-quit,confirm-quit>>|Whether to confirm quitting the application.
|
||||||
@ -516,6 +517,17 @@ Valid values:
|
|||||||
|
|
||||||
Default: +pass:[top]+
|
Default: +pass:[top]+
|
||||||
|
|
||||||
|
[[ui-status-position]]
|
||||||
|
=== status-position
|
||||||
|
The position of the status bar.
|
||||||
|
|
||||||
|
Valid values:
|
||||||
|
|
||||||
|
* +top+
|
||||||
|
* +bottom+
|
||||||
|
|
||||||
|
Default: +pass:[bottom]+
|
||||||
|
|
||||||
[[ui-message-timeout]]
|
[[ui-message-timeout]]
|
||||||
=== message-timeout
|
=== message-timeout
|
||||||
Time (in ms) to show messages in the statusbar for.
|
Time (in ms) to show messages in the statusbar for.
|
||||||
|
@ -272,6 +272,10 @@ def data(readonly=False):
|
|||||||
SettingValue(typ.VerticalPosition(), 'top'),
|
SettingValue(typ.VerticalPosition(), 'top'),
|
||||||
"Where to show the downloaded files."),
|
"Where to show the downloaded files."),
|
||||||
|
|
||||||
|
('status-position',
|
||||||
|
SettingValue(typ.VerticalPosition(), 'bottom'),
|
||||||
|
"The position of the status bar."),
|
||||||
|
|
||||||
('message-timeout',
|
('message-timeout',
|
||||||
SettingValue(typ.Int(), '2000'),
|
SettingValue(typ.Int(), '2000'),
|
||||||
"Time (in ms) to show messages in the statusbar for."),
|
"Time (in ms) to show messages in the statusbar for."),
|
||||||
|
@ -202,22 +202,35 @@ class MainWindow(QWidget):
|
|||||||
self.resize_completion()
|
self.resize_completion()
|
||||||
elif section == 'ui' and option == 'downloads-position':
|
elif section == 'ui' and option == 'downloads-position':
|
||||||
self._add_widgets()
|
self._add_widgets()
|
||||||
|
elif section == 'ui' and option == 'status-position':
|
||||||
|
self._add_widgets()
|
||||||
|
self.resize_completion()
|
||||||
|
|
||||||
def _add_widgets(self):
|
def _add_widgets(self):
|
||||||
"""Add or readd all widgets to the VBox."""
|
"""Add or readd all widgets to the VBox."""
|
||||||
self._vbox.removeWidget(self.tabbed_browser)
|
self._vbox.removeWidget(self.tabbed_browser)
|
||||||
self._vbox.removeWidget(self._downloadview)
|
self._vbox.removeWidget(self._downloadview)
|
||||||
self._vbox.removeWidget(self.status)
|
self._vbox.removeWidget(self.status)
|
||||||
position = config.get('ui', 'downloads-position')
|
downloads_position = config.get('ui', 'downloads-position')
|
||||||
if position == 'top':
|
status_position = config.get('ui', 'status-position')
|
||||||
self._vbox.addWidget(self._downloadview)
|
widgets = [self.tabbed_browser]
|
||||||
self._vbox.addWidget(self.tabbed_browser)
|
|
||||||
elif position == 'bottom':
|
if status_position == 'top':
|
||||||
self._vbox.addWidget(self.tabbed_browser)
|
widgets.insert(0, self.status)
|
||||||
self._vbox.addWidget(self._downloadview)
|
elif status_position == 'bottom':
|
||||||
|
widgets.append(self.status)
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid position {}!".format(position))
|
raise ValueError("Invalid position {}!".format(status_position))
|
||||||
self._vbox.addWidget(self.status)
|
|
||||||
|
if downloads_position == 'top':
|
||||||
|
widgets.insert(0, self._downloadview)
|
||||||
|
elif downloads_position == 'bottom':
|
||||||
|
widgets.append(self._downloadview)
|
||||||
|
else:
|
||||||
|
raise ValueError("Invalid position {}!".format(downloads_position))
|
||||||
|
|
||||||
|
for widget in widgets:
|
||||||
|
self._vbox.addWidget(widget)
|
||||||
|
|
||||||
def _load_state_geometry(self):
|
def _load_state_geometry(self):
|
||||||
"""Load the geometry from the state file."""
|
"""Load the geometry from the state file."""
|
||||||
@ -370,12 +383,19 @@ class MainWindow(QWidget):
|
|||||||
height = contents_height
|
height = contents_height
|
||||||
else:
|
else:
|
||||||
contents_height = -1
|
contents_height = -1
|
||||||
# hpoint now would be the bottom-left edge of the widget if it was on
|
status_position = config.get('ui', 'status-position')
|
||||||
# the top of the main window.
|
if status_position == 'bottom':
|
||||||
topleft_y = self.height() - self.status.height() - height
|
top = self.height() - self.status.height() - height
|
||||||
topleft_y = qtutils.check_overflow(topleft_y, 'int', fatal=False)
|
top = qtutils.check_overflow(top, 'int', fatal=False)
|
||||||
topleft = QPoint(0, topleft_y)
|
topleft = QPoint(0, top)
|
||||||
bottomright = self.status.geometry().topRight()
|
bottomright = self.status.geometry().topRight()
|
||||||
|
elif status_position == 'top':
|
||||||
|
topleft = self.status.geometry().bottomLeft()
|
||||||
|
bottom = self.status.height() + height
|
||||||
|
bottom = qtutils.check_overflow(bottom, 'int', fatal=False)
|
||||||
|
bottomright = QPoint(self.width(), bottom)
|
||||||
|
else:
|
||||||
|
raise ValueError("Invalid position {}!".format(status_position))
|
||||||
rect = QRect(topleft, bottomright)
|
rect = QRect(topleft, bottomright)
|
||||||
log.misc.debug('completion rect: {}'.format(rect))
|
log.misc.debug('completion rect: {}'.format(rect))
|
||||||
if rect.isValid():
|
if rect.isValid():
|
||||||
|
Loading…
Reference in New Issue
Block a user