]> git.sesse.net Git - vlc/commitdiff
* all: support of playlist loop in skins2
authorCyril Deguet <asmax@videolan.org>
Sun, 11 Apr 2004 16:34:04 +0000 (16:34 +0000)
committerCyril Deguet <asmax@videolan.org>
Sun, 11 Apr 2004 16:34:04 +0000 (16:34 +0000)
   (new variable playlist.isLoop, new commands playlist.setLoop(true)
   and playlist.setLoop(false) in the xml)

modules/gui/skins2/commands/cmd_playlist.cpp
modules/gui/skins2/commands/cmd_playlist.hpp
modules/gui/skins2/parser/interpreter.cpp
modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/src/vlcproc.hpp

index 7382268300720f4a4e93069cc6fe7b0173d90444..b5a772d2562deb6fef08149a67ddc76e06ccf369 100755 (executable)
@@ -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);
+    }
+}
+
index a1ff8aa4e4ba2d17467881bef5ef25efbb4dc2c8..8c663e3dc1da748da4859a7b757dfd109ca362f0 100755 (executable)
@@ -78,5 +78,25 @@ class CmdPlaylistRandom: public CmdGeneric
         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
index 62edf3c86a4b0509fd22fd0be5e0ad7b4c8dd8f9..419e78cc8c45daa9fbc46b26a87f927b39e4a1e6 100644 (file)
@@ -63,6 +63,10 @@ Interpreter::Interpreter( intf_thread_t *pIntf ): SkinObject( pIntf )
         CmdGenericPtr( new CmdPlaylistRandom( getIntf(), true ) );
     m_commandMap["playlist.setRandom(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.play()", CmdPlay )
     REGISTER_CMD( "vlc.pause()", CmdPause )
index 5b5f0156ed490d37e491a04b2d153889ff9a4d6e..29ae317ce54e3300655fa0fd7dabc7584ffd7f9f 100755 (executable)
@@ -72,6 +72,7 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf )
     pVarManager->registerVar( getPlaylistVar().getPositionVarPtr(),
                               "playlist.slider" );
     REGISTER_VAR( m_cVarRandom, VarBoolImpl, "playlist.isRandom" )
+    REGISTER_VAR( m_cVarLoop, VarBoolImpl, "playlist.isLoop" )
     REGISTER_VAR( m_cVarTime, Time, "time" )
     REGISTER_VAR( m_cVarVolume, Volume, "volume" )
     REGISTER_VAR( m_cVarStream, Stream, "stream" )
@@ -130,6 +131,7 @@ void VlcProc::manage()
     VarBoolImpl *pVarPaused = (VarBoolImpl*)m_cVarPaused.get();
     VarBoolImpl *pVarSeekable = (VarBoolImpl*)m_cVarSeekable.get();
     VarBoolImpl *pVarRandom = (VarBoolImpl*)m_cVarRandom.get();
+    VarBoolImpl *pVarLoop = (VarBoolImpl*)m_cVarLoop.get();
 
     // Refresh sound volume
     audio_volume_t volume;
@@ -189,6 +191,10 @@ void VlcProc::manage()
     vlc_value_t val;
     var_Get( getIntf()->p_sys->p_playlist, "random", &val );
     pVarRandom->set( val.b_bool );
+
+    // Refresh the loop variable
+    var_Get( getIntf()->p_sys->p_playlist, "loop", &val );
+    pVarLoop->set( val.b_bool );
 }
 
 
index 1d1ea4e46aa7e7daa274b38f335f40c9b93ae833..2af81ec3b5f658cfbd4ec56313590af46b121dcb 100755 (executable)
@@ -48,9 +48,6 @@ class VlcProc: public SkinObject
         /// Getter for the playlist variable
         Playlist &getPlaylistVar() { return *((Playlist*)m_cPlaylist.get()); }
 
-        /// Getter for the random variable
-        VarBool &getIsRandomVar() { return *((VarBool*)m_cVarRandom.get()); }
-
         /// Getter for the time variable
         Time &getTimeVar() { return *((Time*)(m_cVarTime.get())); }
 
@@ -86,6 +83,7 @@ class VlcProc: public SkinObject
         /// Playlist variable
         VariablePtr m_cPlaylist;
         VariablePtr m_cVarRandom;
+        VariablePtr m_cVarLoop;
         /// Variable for current position of the stream
         VariablePtr m_cVarTime;
         /// Variable for audio volume