Commit 0876b490 authored by Cyril Deguet's avatar Cyril Deguet

* all: support of shuffle from the skins2 interface:

    - created a bool variable "playlist.isRandom" and 2 commands
    "playlist.setRandom(true)" and "playlist.setRandom(false)"
    - known bug: the playlist doesn't scroll automatically when the
    stream changes
parent e8be53de
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* cmd_playlist.cpp * cmd_playlist.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: cmd_playlist.cpp,v 1.2 2004/01/10 03:36:03 hartman Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
*****************************************************************************/ *****************************************************************************/
#include "cmd_playlist.hpp" #include "cmd_playlist.hpp"
#include "../src/vlcproc.hpp"
#include "../utils/var_bool.hpp"
void CmdPlaylistDel::execute() void CmdPlaylistDel::execute()
...@@ -61,3 +63,16 @@ void CmdPlaylistPrevious::execute() ...@@ -61,3 +63,16 @@ void CmdPlaylistPrevious::execute()
playlist_Prev( pPlaylist ); playlist_Prev( pPlaylist );
} }
} }
void CmdPlaylistRandom::execute()
{
playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
if( pPlaylist != NULL )
{
vlc_value_t val;
val.b_bool = m_value;
var_Set( pPlaylist , "random", val);
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* cmd_playlist.hpp * cmd_playlist.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: cmd_playlist.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr> * Olivier Teulière <ipkiss@via.ecp.fr>
...@@ -59,4 +59,24 @@ DEFINE_COMMAND( PlaylistNext, "playlist next" ) ...@@ -59,4 +59,24 @@ DEFINE_COMMAND( PlaylistNext, "playlist next" )
DEFINE_COMMAND( PlaylistPrevious, "playlist previous" ) DEFINE_COMMAND( PlaylistPrevious, "playlist previous" )
/// Command to set the random state
class CmdPlaylistRandom: public CmdGeneric
{
public:
CmdPlaylistRandom( intf_thread_t *pIntf, bool value ):
CmdGeneric( pIntf ), m_value( value ) {}
virtual ~CmdPlaylistRandom() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist random"; }
private:
/// Random state
bool m_value;
};
#endif #endif
...@@ -59,6 +59,10 @@ Interpreter::Interpreter( intf_thread_t *pIntf ): SkinObject( pIntf ) ...@@ -59,6 +59,10 @@ Interpreter::Interpreter( intf_thread_t *pIntf ): SkinObject( pIntf )
REGISTER_CMD( "playlist.next()", CmdPlaylistNext ) REGISTER_CMD( "playlist.next()", CmdPlaylistNext )
REGISTER_CMD( "playlist.previous()", CmdPlaylistPrevious ) REGISTER_CMD( "playlist.previous()", CmdPlaylistPrevious )
REGISTER_CMD( "playlist.sort()", CmdPlaylistSort ) REGISTER_CMD( "playlist.sort()", CmdPlaylistSort )
m_commandMap["playlist.setRandom(true)"] =
CmdGenericPtr( new CmdPlaylistRandom( getIntf(), true ) );
m_commandMap["playlist.setRandom(false)"] =
CmdGenericPtr( new CmdPlaylistRandom( 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 )
......
...@@ -71,6 +71,7 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ) ...@@ -71,6 +71,7 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf )
REGISTER_VAR( m_cPlaylist, Playlist, "playlist" ) REGISTER_VAR( m_cPlaylist, Playlist, "playlist" )
pVarManager->registerVar( getPlaylistVar().getPositionVarPtr(), pVarManager->registerVar( getPlaylistVar().getPositionVarPtr(),
"playlist.slider" ); "playlist.slider" );
REGISTER_VAR( m_cVarRandom, VarBoolImpl, "playlist.isRandom" )
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" )
...@@ -123,6 +124,7 @@ void VlcProc::manage() ...@@ -123,6 +124,7 @@ void VlcProc::manage()
VarBoolImpl *pVarStopped = (VarBoolImpl*)m_cVarStopped.get(); VarBoolImpl *pVarStopped = (VarBoolImpl*)m_cVarStopped.get();
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();
// Refresh sound volume // Refresh sound volume
audio_volume_t volume; audio_volume_t volume;
...@@ -177,6 +179,11 @@ void VlcProc::manage() ...@@ -177,6 +179,11 @@ void VlcProc::manage()
pVarSeekable->set( false ); pVarSeekable->set( false );
pTime->set( 0, false ); pTime->set( 0, false );
} }
// Refresh the random variable
vlc_value_t val;
var_Get( getIntf()->p_sys->p_playlist, "random", &val );
pVarRandom->set( val.b_bool );
} }
......
...@@ -48,6 +48,9 @@ class VlcProc: public SkinObject ...@@ -48,6 +48,9 @@ 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())); }
...@@ -82,6 +85,7 @@ class VlcProc: public SkinObject ...@@ -82,6 +85,7 @@ class VlcProc: public SkinObject
OSTimer *m_pTimer; OSTimer *m_pTimer;
/// Playlist variable /// Playlist variable
VariablePtr m_cPlaylist; VariablePtr m_cPlaylist;
VariablePtr m_cVarRandom;
/// 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