Slideshow remembers video position, fix preview restore on close
- Grabs video position before opening slideshow and seeks to it - Use closed signal from closeEvent instead of destroyed for reliable preview restoration on slideshow close
This commit is contained in:
parent
cfbb58fe9f
commit
fec1470629
@ -1082,21 +1082,28 @@ class BooruApp(QMainWindow):
|
|||||||
path = self._preview._current_path
|
path = self._preview._current_path
|
||||||
if not path:
|
if not path:
|
||||||
return
|
return
|
||||||
# Clear the main preview — slideshow takes over
|
|
||||||
info = self._preview._info_label.text()
|
info = self._preview._info_label.text()
|
||||||
|
# Grab video position before clearing
|
||||||
|
video_pos = 0
|
||||||
|
if self._preview._stack.currentIndex() == 1:
|
||||||
|
video_pos = self._preview._video_player._player.position()
|
||||||
|
# Clear the main preview — slideshow takes over
|
||||||
self._preview.clear()
|
self._preview.clear()
|
||||||
self._preview._info_label.setText(info)
|
self._preview._info_label.setText(info)
|
||||||
self._preview._current_path = path
|
self._preview._current_path = path
|
||||||
from .preview import FullscreenPreview
|
from .preview import FullscreenPreview
|
||||||
cols = self._grid._flow.columns
|
cols = self._grid._flow.columns
|
||||||
show_actions = self._stack.currentIndex() != 2 # hide for Library tab
|
show_actions = self._stack.currentIndex() != 2
|
||||||
self._fullscreen_window = FullscreenPreview(grid_cols=cols, show_actions=show_actions, parent=self)
|
self._fullscreen_window = FullscreenPreview(grid_cols=cols, show_actions=show_actions, parent=self)
|
||||||
self._fullscreen_window.navigate.connect(self._navigate_fullscreen)
|
self._fullscreen_window.navigate.connect(self._navigate_fullscreen)
|
||||||
if show_actions:
|
if show_actions:
|
||||||
self._fullscreen_window.bookmark_requested.connect(self._bookmark_from_preview)
|
self._fullscreen_window.bookmark_requested.connect(self._bookmark_from_preview)
|
||||||
self._fullscreen_window.save_toggle_requested.connect(self._save_toggle_from_slideshow)
|
self._fullscreen_window.save_toggle_requested.connect(self._save_toggle_from_slideshow)
|
||||||
self._fullscreen_window.destroyed.connect(self._on_fullscreen_closed)
|
self._fullscreen_window.closed.connect(self._on_fullscreen_closed)
|
||||||
self._fullscreen_window.set_media(path, self._preview._info_label.text())
|
self._fullscreen_window.set_media(path, info)
|
||||||
|
# Seek to the position from the preview
|
||||||
|
if video_pos > 0 and self._fullscreen_window._stack.currentIndex() == 1:
|
||||||
|
self._fullscreen_window._video._player.setPosition(video_pos)
|
||||||
if show_actions:
|
if show_actions:
|
||||||
self._update_fullscreen_state()
|
self._update_fullscreen_state()
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ class FullscreenPreview(QMainWindow):
|
|||||||
navigate = Signal(int) # direction: -1/+1 for left/right, -cols/+cols for up/down
|
navigate = Signal(int) # direction: -1/+1 for left/right, -cols/+cols for up/down
|
||||||
bookmark_requested = Signal()
|
bookmark_requested = Signal()
|
||||||
save_toggle_requested = Signal() # save or unsave depending on state
|
save_toggle_requested = Signal() # save or unsave depending on state
|
||||||
|
closed = Signal()
|
||||||
|
|
||||||
def __init__(self, grid_cols: int = 3, show_actions: bool = True, parent=None) -> None:
|
def __init__(self, grid_cols: int = 3, show_actions: bool = True, parent=None) -> None:
|
||||||
super().__init__(parent, Qt.WindowType.Window)
|
super().__init__(parent, Qt.WindowType.Window)
|
||||||
@ -176,6 +177,7 @@ class FullscreenPreview(QMainWindow):
|
|||||||
from PySide6.QtWidgets import QApplication
|
from PySide6.QtWidgets import QApplication
|
||||||
QApplication.instance().removeEventFilter(self)
|
QApplication.instance().removeEventFilter(self)
|
||||||
self._video.stop()
|
self._video.stop()
|
||||||
|
self.closed.emit()
|
||||||
super().closeEvent(event)
|
super().closeEvent(event)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user