# Soundboard Engine - customizable soundboard # Copyright (C) 2026 Vidhu Kant Sharma # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from PySide6.QtCore import Signal from PySide6.QtWidgets import QHBoxLayout, QLabel, QPushButton, QWidget from AudioPlayer import PlayerStatus from Soundboard import SoundboardSound class StatusbarWidget(QWidget): play_requested = Signal(SoundboardSound) stop_requested = Signal() def __init__(self, parent=None): super().__init__(parent) layout = QHBoxLayout(self) layout.setContentsMargins(12, 16, 12, 8) self.now_playing_label = QLabel("Welcome to soundboard") layout.addWidget(self.now_playing_label, stretch=1) self.btn_replay = QPushButton("Play Again") self.btn_replay.clicked.connect( lambda: self.play_requested.emit(self.status.sound) ) self.btn_replay.setEnabled(False) layout.addWidget(self.btn_replay) self.btn_stop = QPushButton("Stop") self.btn_stop.clicked.connect(lambda: self.stop_requested.emit()) self.btn_stop.setEnabled(False) layout.addWidget(self.btn_stop) def set_status(self, status: PlayerStatus): self.status = status self.now_playing_label.setText( f"[{self.status.status}] {self.status.sound.title}" ) if self.status.status == "PLAYING": self.btn_stop.setEnabled(True) else: self.btn_stop.setEnabled(False) self.btn_replay.setEnabled(True)