[vlc-commits] skins2: ensure that skins2 displays items exactly as qt4 does
Erwan Tulou
git at videolan.org
Sat Feb 9 09:33:34 CET 2013
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Sat Feb 9 09:03:00 2013 +0100| [af7899e86b74b01af86fc2b521d0a9aa40a98387] | committer: Erwan Tulou
skins2: ensure that skins2 displays items exactly as qt4 does
This patch copies qt4 getTitle function so that user can read the same
wording from skins2 as he/she reads from the qt4 interface.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af7899e86b74b01af86fc2b521d0a9aa40a98387
---
modules/gui/skins2/vars/playtree.cpp | 28 ++++++++++++++++++++--------
modules/gui/skins2/vars/playtree.hpp | 3 +++
2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index 88905e0..7a2655c 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -116,9 +116,7 @@ void Playtree::onUpdateItem( int id )
return;
}
- char *psz_name = input_item_GetTitleFbName( pNode->p_input );
- UString *pName = new UString( getIntf(), psz_name );
- free(psz_name);
+ UString *pName = getTitle( pNode->p_input );
playlist_Unlock( m_pPlaylist );
if( *pName != *(it->getString()) )
@@ -219,10 +217,7 @@ void Playtree::onAppend( playlist_add_t *p_add )
for( pos = 0; pos < pItem->p_parent->i_children; pos++ )
if( pItem->p_parent->pp_children[pos] == pItem ) break;
- char *psz_name = input_item_GetTitleFbName( pItem->p_input );
- UString *pName = new UString( getIntf(), psz_name );
- free( psz_name );
-
+ UString *pName = getTitle( pItem->p_input );
playlist_item_t* current = playlist_CurrentPlayingItem( m_pPlaylist );
Iterator it = it_node->add(
@@ -242,7 +237,7 @@ void Playtree::onAppend( playlist_add_t *p_add )
void Playtree::buildNode( playlist_item_t *pNode, VarTree &rTree )
{
- UString *pName = new UString( getIntf(), pNode->p_input->psz_name );
+ UString *pName = getTitle( pNode->p_input );
Iterator it = rTree.add(
pNode->i_id, UStringPtr( pName ), false,
playlist_CurrentPlayingItem(m_pPlaylist) == pNode,
@@ -354,6 +349,23 @@ fin:
playlist_Unlock( m_pPlaylist );
}
+
+UString* Playtree::getTitle( input_item_t *pItem )
+{
+ char *psz_name = input_item_GetTitle( pItem );
+ if( EMPTY_STR( psz_name ) )
+ {
+ free( psz_name );
+ psz_name = input_item_GetName( pItem );
+ }
+ if( !psz_name )
+ psz_name = strdup ( "" );
+ UString *pTitle = new UString( getIntf(), psz_name );
+ free( psz_name );
+ return pTitle;
+}
+
+
VarTree::Iterator Playtree::findById( int id )
{
map<int,VarTree*>::iterator it = m_allItems.find( id );
diff --git a/modules/gui/skins2/vars/playtree.hpp b/modules/gui/skins2/vars/playtree.hpp
index 78d33fe..cb952e5 100644
--- a/modules/gui/skins2/vars/playtree.hpp
+++ b/modules/gui/skins2/vars/playtree.hpp
@@ -79,6 +79,9 @@ private:
/// Update Node's children
void buildNode( playlist_item_t *p_node, VarTree &m_pNode );
+
+ /// title for an item
+ UString* getTitle( input_item_t *pItem );
};
#endif
More information about the vlc-commits
mailing list