Add volume slider for title/background music (#1130)

* add volume slider

* add translations

* stop music when checkbox unchecked

* remove GUI build command args

* combine functions

* add accidentaly removed copyright and licencing information
(thanks QT Designer)
This commit is contained in:
tGecko
2024-09-28 18:54:28 +02:00
committed by GitHub
parent 1dd2e46fce
commit 7b5d66e5c1
33 changed files with 223 additions and 7 deletions

View File

@@ -527,7 +527,11 @@ void MainWindow::PlayBackgroundMusic() {
int itemID = isTableList ? m_game_list_frame->currentItem()->row()
: m_game_grid_frame->crtRow * m_game_grid_frame->columnCnt +
m_game_grid_frame->crtColumn;
if (itemID > m_game_info->m_games.size() - 1) {
// Can happen in grid mode
BackgroundMusicPlayer::getInstance().stopMusic();
return;
}
QString snd0path;
Common::FS::PathToQString(snd0path, m_game_info->m_games[itemID].snd0_path);
BackgroundMusicPlayer::getInstance().playMusic(snd0path);
@@ -619,6 +623,7 @@ void MainWindow::ConfigureGuiFromSettings() {
} else {
ui->setlistModeGridAct->setChecked(true);
}
BackgroundMusicPlayer::getInstance().setVolume(Config::getBGMvolume());
}
void MainWindow::SaveWindowState() const {