Changed: Merge music player play/pause button into one, add stop button
--HG-- branch : develop
This commit is contained in:
parent
798494ffbf
commit
fa16ca8dd9
2 changed files with 42 additions and 11 deletions
|
@ -17,6 +17,9 @@
|
||||||
<variable entry="UI:SAVE:MP3_SHUFFLE"
|
<variable entry="UI:SAVE:MP3_SHUFFLE"
|
||||||
type="sint32"
|
type="sint32"
|
||||||
value="0" />
|
value="0" />
|
||||||
|
<variable entry="UI:TEMP:MP3_PLAYING"
|
||||||
|
type="sint32"
|
||||||
|
value="0" />
|
||||||
<!--******************-->
|
<!--******************-->
|
||||||
<!--* MP3 PLAYER *-->
|
<!--* MP3 PLAYER *-->
|
||||||
<!--******************-->
|
<!--******************-->
|
||||||
|
@ -37,11 +40,11 @@
|
||||||
<ctrl type="button" id="btn" button_type="toggle_button" sizeref="wh" tx_normal="blank.tga" tx_pushed="blank.tga" tx_over="blank.tga" scale="true"
|
<ctrl type="button" id="btn" button_type="toggle_button" sizeref="wh" tx_normal="blank.tga" tx_pushed="blank.tga" tx_over="blank.tga" scale="true"
|
||||||
color="255 255 255 0" col_pushed="255 255 255 0" col_over="255 255 255 90"
|
color="255 255 255 0" col_pushed="255 255 255 0" col_over="255 255 255 90"
|
||||||
global_color_normal="true" global_color_pushed="true" global_color_over="true"
|
global_color_normal="true" global_color_pushed="true" global_color_over="true"
|
||||||
ondblclick_l="music_player" params_dblclick_l="song=#index" />
|
ondblclick_l="music_player" params_dblclick_l="song=#index" />
|
||||||
|
|
||||||
<view type="bitmap" id="bg" posref="MM MM" sizeref="wh" color="200 200 200 50" texture="blank.tga" scale="true" active="false" />
|
<view type="bitmap" id="bg" posref="MM MM" sizeref="wh" color="200 200 200 50" texture="blank.tga" scale="true" active="false" />
|
||||||
<view type="text" id="title" posref="ML ML" x="0" line_maxw="#line_maxw" fontsize="8" shadow="true" multi_line="true" multi_line_space="0" />
|
<view type="text" id="title" posref="ML ML" x="0" line_maxw="#line_maxw" fontsize="8" shadow="true" multi_line="true" multi_line_space="0" />
|
||||||
<view type="text" id="duration" posref="MR MR" x="0" fontsize="8" shadow="true" color="255 255 255 150" />
|
<view type="text" id="duration" posref="MR MR" x="0" fontsize="8" shadow="true" color="255 255 255 150" />
|
||||||
</group>
|
</group>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -50,6 +53,17 @@
|
||||||
<action handler="music_player" params="update_playlist" />
|
<action handler="music_player" params="update_playlist" />
|
||||||
</proc>
|
</proc>
|
||||||
|
|
||||||
|
<proc id="proc_mp3_update_tooltip">
|
||||||
|
<action handler="lua" params="getUI('ui:interface:mp3_player:controls:but_play').tooltip = i18n.get('uiMP3Play')" cond="eq(@UI:TEMP:MP3_PLAYING,0)" />
|
||||||
|
<action handler="lua" params="getUI('ui:interface:mp3_player:controls:but_play').tooltip = i18n.get('uiMP3Pause')" cond="eq(@UI:TEMP:MP3_PLAYING,1)" />
|
||||||
|
</proc>
|
||||||
|
|
||||||
|
<proc id="proc_mp3_but_play">
|
||||||
|
<action handler="set" params="dblink=UI:TEMP:MP3_PLAYING|value=not(@UI:TEMP:MP3_PLAYING)" />
|
||||||
|
<action handler="music_player" params="play" cond="eq(@UI:TEMP:MP3_PLAYING,1)" />
|
||||||
|
<action handler="music_player" params="pause" cond="eq(@UI:TEMP:MP3_PLAYING,0)" />
|
||||||
|
</proc>
|
||||||
|
|
||||||
<group type="modal"
|
<group type="modal"
|
||||||
id="playlist"
|
id="playlist"
|
||||||
posparent="mp3_player"
|
posparent="mp3_player"
|
||||||
|
@ -203,26 +217,30 @@
|
||||||
tooltip="uiMP3Prev" />
|
tooltip="uiMP3Prev" />
|
||||||
<ctrl type="button"
|
<ctrl type="button"
|
||||||
id="but_play"
|
id="but_play"
|
||||||
button_type="push_button"
|
button_type="toggle_button"
|
||||||
posref="MM MM"
|
posref="MM MM"
|
||||||
posparent="slot2"
|
posparent="slot2"
|
||||||
tx_normal="mp3_button_play.tga"
|
tx_normal="mp3_button_play.tga"
|
||||||
tx_pushed="mp3_button_play.tga"
|
tx_pushed="mp3_button_pause.tga"
|
||||||
tx_over="mp3_button_over.tga"
|
tx_over="mp3_button_over.tga"
|
||||||
onclick_l="music_player"
|
onclick_l="proc"
|
||||||
params_l="play"
|
params_l="proc_mp3_but_play"
|
||||||
tooltip="uiMP3Play" />
|
tooltip="uiMP3Play" />
|
||||||
|
<!-- TODO: but_stop is using placeholder texture -->
|
||||||
<ctrl type="button"
|
<ctrl type="button"
|
||||||
id="but_pause"
|
id="but_stop"
|
||||||
button_type="push_button"
|
button_type="push_button"
|
||||||
posref="MM MM"
|
posref="MM MM"
|
||||||
posparent="slot3"
|
posparent="slot3"
|
||||||
tx_normal="mp3_button_pause.tga"
|
tx_normal="w_button_10_choice.tga"
|
||||||
tx_pushed="mp3_button_pause.tga"
|
tx_pushed="w_button_10_choice.tga"
|
||||||
tx_over="mp3_button_over.tga"
|
tx_over="mp3_button_over.tga"
|
||||||
|
scale="true"
|
||||||
|
w="20"
|
||||||
|
h="16"
|
||||||
onclick_l="music_player"
|
onclick_l="music_player"
|
||||||
params_l="pause"
|
params_l="stop"
|
||||||
tooltip="uiMP3Pause" />
|
tooltip="uiMP3Stop" />
|
||||||
<ctrl type="button"
|
<ctrl type="button"
|
||||||
id="but_next"
|
id="but_next"
|
||||||
button_type="push_button"
|
button_type="push_button"
|
||||||
|
@ -312,6 +330,8 @@
|
||||||
posref="TL TL"
|
posref="TL TL"
|
||||||
w="48"
|
w="48"
|
||||||
h="20" />
|
h="20" />
|
||||||
|
|
||||||
|
<link expr="@UI:TEMP:MP3_PLAYING" target="but_play:pushed" action="proc" params="proc_mp3_update_tooltip" />
|
||||||
</group>
|
</group>
|
||||||
<!-- SCREEN -->
|
<!-- SCREEN -->
|
||||||
<group id="screen"
|
<group id="screen"
|
||||||
|
|
|
@ -174,6 +174,7 @@ void CMusicPlayer::play (sint index)
|
||||||
if(!SoundMngr)
|
if(!SoundMngr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
sint prevSongIndex = _CurrentSongIndex;
|
sint prevSongIndex = _CurrentSongIndex;
|
||||||
|
|
||||||
if (index >= 0 && index < (sint)_Songs.size())
|
if (index >= 0 && index < (sint)_Songs.size())
|
||||||
|
@ -208,6 +209,8 @@ void CMusicPlayer::play (sint index)
|
||||||
_CurrentSong = _Songs[_CurrentSongIndex];
|
_CurrentSong = _Songs[_CurrentSongIndex];
|
||||||
|
|
||||||
updatePlaylist(prevSongIndex);
|
updatePlaylist(prevSongIndex);
|
||||||
|
|
||||||
|
NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:MP3_PLAYING")->setValueBool(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,6 +220,7 @@ void CMusicPlayer::pause ()
|
||||||
{
|
{
|
||||||
if(!SoundMngr)
|
if(!SoundMngr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// pause the music only if we are really playing (else risk to pause a background music!)
|
// pause the music only if we are really playing (else risk to pause a background music!)
|
||||||
if(_State==Playing)
|
if(_State==Playing)
|
||||||
{
|
{
|
||||||
|
@ -225,6 +229,8 @@ void CMusicPlayer::pause ()
|
||||||
|
|
||||||
if (_PlayStart > 0)
|
if (_PlayStart > 0)
|
||||||
_PauseTime = CTime::getLocalTime() - _PlayStart;
|
_PauseTime = CTime::getLocalTime() - _PlayStart;
|
||||||
|
|
||||||
|
NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:MP3_PLAYING")->setValueBool(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,11 +240,14 @@ void CMusicPlayer::stop ()
|
||||||
{
|
{
|
||||||
if(!SoundMngr)
|
if(!SoundMngr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// stop the music only if we are really playing (else risk to stop a background music!)
|
// stop the music only if we are really playing (else risk to stop a background music!)
|
||||||
SoundMngr->stopMusic(0);
|
SoundMngr->stopMusic(0);
|
||||||
_State = Stopped;
|
_State = Stopped;
|
||||||
_PlayStart = 0;
|
_PlayStart = 0;
|
||||||
_PauseTime = 0;
|
_PauseTime = 0;
|
||||||
|
|
||||||
|
NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:MP3_PLAYING")->setValueBool(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -446,6 +455,8 @@ public:
|
||||||
MusicPlayer.previous();
|
MusicPlayer.previous();
|
||||||
else if (Params == "play")
|
else if (Params == "play")
|
||||||
MusicPlayer.play();
|
MusicPlayer.play();
|
||||||
|
else if (Params == "stop")
|
||||||
|
MusicPlayer.stop();
|
||||||
else if (Params == "pause")
|
else if (Params == "pause")
|
||||||
MusicPlayer.pause();
|
MusicPlayer.pause();
|
||||||
else if (Params == "next")
|
else if (Params == "next")
|
||||||
|
|
Loading…
Reference in a new issue