[vlc-devel] commit: skins2: add support for tracking current playing item correctly ( Erwan Tulou )
git version control
git at videolan.org
Sat Feb 13 16:31:57 CET 2010
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Sat Feb 13 11:43:50 2010 +0100| [5a07a426d315847c4e6968f9ca8d809f7fb61e5d] | committer: Erwan Tulou
skins2: add support for tracking current playing item correctly
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5a07a426d315847c4e6968f9ca8d809f7fb61e5d
---
modules/gui/skins2/vars/playtree.cpp | 32 ++++++++++++++++++++++++++++----
modules/gui/skins2/vars/playtree.hpp | 6 ++++++
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index 28a8735..4e96808 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -36,6 +36,7 @@ Playtree::Playtree( intf_thread_t *pIntf ): VarTree( pIntf )
{
// Get the VLC playlist object
m_pPlaylist = pIntf->p_sys->p_playlist;
+ m_playingIt = end();
i_items_to_append = 0;
@@ -133,10 +134,6 @@ void Playtree::onUpdateItem( int id )
playlist_item_t* pNode = (playlist_item_t*)(it->m_pData);
UString *pName = new UString( getIntf(), pNode->p_input->psz_name );
it->m_cString = UStringPtr( pName );
- playlist_Lock( m_pPlaylist );
- it->m_playing = playlist_CurrentPlayingItem( m_pPlaylist ) == pNode;
- playlist_Unlock( m_pPlaylist );
- if( it->m_playing ) descr.b_active_item = true;
}
else
{
@@ -146,6 +143,33 @@ void Playtree::onUpdateItem( int id )
notify( &descr );
}
+
+void Playtree::onUpdateCurrent()
+{
+ playlist_Lock( m_pPlaylist );
+
+ playlist_item_t* current = playlist_CurrentPlayingItem( m_pPlaylist );
+ if( !current )
+ {
+ playlist_Unlock( m_pPlaylist );
+ return;
+ }
+
+ Iterator it = findById( current->i_id );
+ it->m_playing = true;
+ if( m_playingIt != end() )
+ m_playingIt->m_playing = false;
+ m_playingIt = it;
+
+ playlist_Unlock( m_pPlaylist );
+
+ tree_update descr;
+ descr.b_active_item = true;
+ descr.i_type = 0;
+ notify( &descr );
+}
+
+
/// \todo keep a list of "recently removed" to avoid looking up if we
// already removed it
void Playtree::onDelete( int i_id )
diff --git a/modules/gui/skins2/vars/playtree.hpp b/modules/gui/skins2/vars/playtree.hpp
index 07eadd3..0c1a2ad 100644
--- a/modules/gui/skins2/vars/playtree.hpp
+++ b/modules/gui/skins2/vars/playtree.hpp
@@ -46,6 +46,9 @@ public:
/// Function called to notify playlist item update
void onUpdateItem( int id );
+ /// Function called to notify about current playing item
+ void onUpdateCurrent( );
+
/// Function called to notify playlist item append
void onAppend( playlist_add_t * );
@@ -64,6 +67,9 @@ private:
/// Update Node's children
void buildNode( playlist_item_t *p_node, VarTree &m_pNode );
+
+ /// keep track of item being played
+ Iterator m_playingIt;
};
#endif
More information about the vlc-devel
mailing list