From fa16ca8dd9358e90f823c40a39dd7d77b569b826 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 26 Dec 2018 18:21:42 +0200 Subject: [PATCH] Changed: Merge music player play/pause button into one, add stop button --HG-- branch : develop --- .../data/gamedev/interfaces_v3/compass.xml | 42 ++++++++++++++----- .../client/src/interface_v3/music_player.cpp | 11 +++++ 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml b/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml index 969ce332c..fbc8495d8 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml @@ -17,6 +17,9 @@ + @@ -37,11 +40,11 @@ + ondblclick_l="music_player" params_dblclick_l="song=#index" /> - + @@ -50,6 +53,17 @@ + + + + + + + + + + + + + params_l="stop" + tooltip="uiMP3Stop" /> + + = 0 && index < (sint)_Songs.size()) @@ -208,6 +209,8 @@ void CMusicPlayer::play (sint index) _CurrentSong = _Songs[_CurrentSongIndex]; updatePlaylist(prevSongIndex); + + NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:MP3_PLAYING")->setValueBool(true); } } @@ -217,6 +220,7 @@ void CMusicPlayer::pause () { if(!SoundMngr) return; + // pause the music only if we are really playing (else risk to pause a background music!) if(_State==Playing) { @@ -225,6 +229,8 @@ void CMusicPlayer::pause () if (_PlayStart > 0) _PauseTime = CTime::getLocalTime() - _PlayStart; + + NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:MP3_PLAYING")->setValueBool(false); } } @@ -234,11 +240,14 @@ void CMusicPlayer::stop () { if(!SoundMngr) return; + // stop the music only if we are really playing (else risk to stop a background music!) SoundMngr->stopMusic(0); _State = Stopped; _PlayStart = 0; _PauseTime = 0; + + NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:MP3_PLAYING")->setValueBool(false); } // *************************************************************************** @@ -446,6 +455,8 @@ public: MusicPlayer.previous(); else if (Params == "play") MusicPlayer.play(); + else if (Params == "stop") + MusicPlayer.stop(); else if (Params == "pause") MusicPlayer.pause(); else if (Params == "next")