feat: added sound effects support to themes

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
2025-07-16 11:10:31 +05:00
parent f0df1f89be
commit 889ba4af2b
6 changed files with 143 additions and 6 deletions

View File

@ -220,6 +220,13 @@ class MainWindow(QMainWindow):
self.resize(width, height)
else:
self.showNormal()
self._startup_sound = self.theme_manager.get_sound(default_styles.SOUNDS["app_start"])
self._exit_sound = self.theme_manager.get_sound(default_styles.SOUNDS["app_exit"])
if self._startup_sound:
self._startup_sound.play()
@Slot(list)
def on_games_loaded(self, games: list[tuple]):
self.games = games
@ -2253,5 +2260,11 @@ class MainWindow(QMainWindow):
self.checkProcessTimer.deleteLater()
self.checkProcessTimer = None
QApplication.quit()
event.accept()
# Воспроизводим звук закрытия
if self._exit_sound:
self._exit_sound.play()
# Небольшая задержка перед закрытием, чтобы звук успел проиграться
QTimer.singleShot(100, lambda: event.accept())
event.ignore()
else:
event.accept()