Commit 55837a58 authored by Cyril Deguet's avatar Cyril Deguet

* all: support of playlist loop in skins2

   (new variable playlist.isLoop, new commands playlist.setLoop(true)
   and playlist.setLoop(false) in the xml)
parent a2edf517
...@@ -76,3 +76,15 @@ void CmdPlaylistRandom::execute() ...@@ -76,3 +76,15 @@ void CmdPlaylistRandom::execute()
} }
} }
void CmdPlaylistLoop::execute()
{
playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
if( pPlaylist != NULL )
{
vlc_value_t val;
val.b_bool = m_value;
var_Set( pPlaylist , "loop", val);
}
}
...@@ -78,5 +78,25 @@ class CmdPlaylistRandom: public CmdGeneric ...@@ -78,5 +78,25 @@ class CmdPlaylistRandom: public CmdGeneric
bool m_value; bool m_value;
}; };
/// Command to set the loop state
class CmdPlaylistLoop: public CmdGeneric
{
public:
CmdPlaylistLoop( intf_thread_t *pIntf, bool value ):
CmdGeneric( pIntf ), m_value( value ) {}
virtual ~CmdPlaylistLoop() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist loop"; }
private:
/// Loop state
bool m_value;
};
#endif #endif
...@@ -63,6 +63,10 @@ Interpreter::Interpreter( intf_thread_t *pIntf ): SkinObject( pIntf ) ...@@ -63,6 +63,10 @@ Interpreter::Interpreter( intf_thread_t *pIntf ): SkinObject( pIntf )
CmdGenericPtr( new CmdPlaylistRandom( getIntf(), true ) ); CmdGenericPtr( new CmdPlaylistRandom( getIntf(), true ) );
m_commandMap["playlist.setRandom(false)"] = m_commandMap["playlist.setRandom(false)"] =
CmdGenericPtr( new CmdPlaylistRandom( getIntf(), false ) ); CmdGenericPtr( new CmdPlaylistRandom( getIntf(), false ) );
m_commandMap["playlist.setLoop(true)"] =
CmdGenericPtr( new CmdPlaylistLoop( getIntf(), true ) );
m_commandMap["playlist.setLoop(false)"] =
CmdGenericPtr( new CmdPlaylistLoop( getIntf(), false ) );
REGISTER_CMD( "vlc.fullscreen()", CmdFullscreen ) REGISTER_CMD( "vlc.fullscreen()", CmdFullscreen )
REGISTER_CMD( "vlc.play()", CmdPlay ) REGISTER_CMD( "vlc.play()", CmdPlay )
REGISTER_CMD( "vlc.pause()", CmdPause ) REGISTER_CMD( "vlc.pause()", CmdPause )
......
...@@ -72,6 +72,7 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ) ...@@ -72,6 +72,7 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf )
pVarManager->registerVar( getPlaylistVar().getPositionVarPtr(), pVarManager->registerVar( getPlaylistVar().getPositionVarPtr(),
"playlist.slider" ); "playlist.slider" );
REGISTER_VAR( m_cVarRandom, VarBoolImpl, "playlist.isRandom" ) REGISTER_VAR( m_cVarRandom, VarBoolImpl, "playlist.isRandom" )
REGISTER_VAR( m_cVarLoop, VarBoolImpl, "playlist.isLoop" )
REGISTER_VAR( m_cVarTime, Time, "time" ) REGISTER_VAR( m_cVarTime, Time, "time" )
REGISTER_VAR( m_cVarVolume, Volume, "volume" ) REGISTER_VAR( m_cVarVolume, Volume, "volume" )
REGISTER_VAR( m_cVarStream, Stream, "stream" ) REGISTER_VAR( m_cVarStream, Stream, "stream" )
...@@ -130,6 +131,7 @@ void VlcProc::manage() ...@@ -130,6 +131,7 @@ void VlcProc::manage()
VarBoolImpl *pVarPaused = (VarBoolImpl*)m_cVarPaused.get(); VarBoolImpl *pVarPaused = (VarBoolImpl*)m_cVarPaused.get();
VarBoolImpl *pVarSeekable = (VarBoolImpl*)m_cVarSeekable.get(); VarBoolImpl *pVarSeekable = (VarBoolImpl*)m_cVarSeekable.get();
VarBoolImpl *pVarRandom = (VarBoolImpl*)m_cVarRandom.get(); VarBoolImpl *pVarRandom = (VarBoolImpl*)m_cVarRandom.get();
VarBoolImpl *pVarLoop = (VarBoolImpl*)m_cVarLoop.get();
// Refresh sound volume // Refresh sound volume
audio_volume_t volume; audio_volume_t volume;
...@@ -189,6 +191,10 @@ void VlcProc::manage() ...@@ -189,6 +191,10 @@ void VlcProc::manage()
vlc_value_t val; vlc_value_t val;
var_Get( getIntf()->p_sys->p_playlist, "random", &val ); var_Get( getIntf()->p_sys->p_playlist, "random", &val );
pVarRandom->set( val.b_bool ); pVarRandom->set( val.b_bool );
// Refresh the loop variable
var_Get( getIntf()->p_sys->p_playlist, "loop", &val );
pVarLoop->set( val.b_bool );
} }
......
...@@ -48,9 +48,6 @@ class VlcProc: public SkinObject ...@@ -48,9 +48,6 @@ class VlcProc: public SkinObject
/// Getter for the playlist variable /// Getter for the playlist variable
Playlist &getPlaylistVar() { return *((Playlist*)m_cPlaylist.get()); } Playlist &getPlaylistVar() { return *((Playlist*)m_cPlaylist.get()); }
/// Getter for the random variable
VarBool &getIsRandomVar() { return *((VarBool*)m_cVarRandom.get()); }
/// Getter for the time variable /// Getter for the time variable
Time &getTimeVar() { return *((Time*)(m_cVarTime.get())); } Time &getTimeVar() { return *((Time*)(m_cVarTime.get())); }
...@@ -86,6 +83,7 @@ class VlcProc: public SkinObject ...@@ -86,6 +83,7 @@ class VlcProc: public SkinObject
/// Playlist variable /// Playlist variable
VariablePtr m_cPlaylist; VariablePtr m_cPlaylist;
VariablePtr m_cVarRandom; VariablePtr m_cVarRandom;
VariablePtr m_cVarLoop;
/// Variable for current position of the stream /// Variable for current position of the stream
VariablePtr m_cVarTime; VariablePtr m_cVarTime;
/// Variable for audio volume /// Variable for audio volume
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment