Add up/down navigation in slideshow mode

Up/Down/J/K in slideshow now navigate by grid row, matching
the grid's column layout.
This commit is contained in:
pax 2026-04-04 20:01:00 -05:00
parent 127442e8d7
commit 97ad56c12f
2 changed files with 10 additions and 2 deletions

View File

@ -841,7 +841,8 @@ class BooruApp(QMainWindow):
# Pause the main preview's video player # Pause the main preview's video player
self._preview._video_player.stop() self._preview._video_player.stop()
from .preview import FullscreenPreview from .preview import FullscreenPreview
self._fullscreen_window = FullscreenPreview(parent=self) cols = self._grid._flow.columns
self._fullscreen_window = FullscreenPreview(grid_cols=cols, parent=self)
self._fullscreen_window.navigate.connect(self._navigate_fullscreen) self._fullscreen_window.navigate.connect(self._navigate_fullscreen)
self._fullscreen_window.destroyed.connect(self._on_fullscreen_closed) self._fullscreen_window.destroyed.connect(self._on_fullscreen_closed)
self._fullscreen_window.set_media(path, self._preview._info_label.text()) self._fullscreen_window.set_media(path, self._preview._info_label.text())

View File

@ -27,9 +27,10 @@ class FullscreenPreview(QMainWindow):
navigate = Signal(int) # -1 = prev, +1 = next navigate = Signal(int) # -1 = prev, +1 = next
def __init__(self, parent=None) -> None: def __init__(self, grid_cols: int = 3, parent=None) -> None:
super().__init__(parent, Qt.WindowType.Window) super().__init__(parent, Qt.WindowType.Window)
self.setWindowTitle("booru-viewer — Fullscreen") self.setWindowTitle("booru-viewer — Fullscreen")
self._grid_cols = grid_cols
self._stack = QStackedWidget() self._stack = QStackedWidget()
self.setCentralWidget(self._stack) self.setCentralWidget(self._stack)
@ -76,6 +77,12 @@ class FullscreenPreview(QMainWindow):
elif key in (Qt.Key.Key_Right, Qt.Key.Key_L): elif key in (Qt.Key.Key_Right, Qt.Key.Key_L):
self.navigate.emit(1) self.navigate.emit(1)
return True return True
elif key in (Qt.Key.Key_Up, Qt.Key.Key_K):
self.navigate.emit(-self._grid_cols)
return True
elif key in (Qt.Key.Key_Down, Qt.Key.Key_J):
self.navigate.emit(self._grid_cols)
return True
elif key == Qt.Key.Key_Space and self._stack.currentIndex() == 1: elif key == Qt.Key.Key_Space and self._stack.currentIndex() == 1:
self._video._toggle_play() self._video._toggle_play()
return True return True