Commit 6987493d authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: PLSelector: add customized icons

parent b30df008
...@@ -134,10 +134,20 @@ DEPS_res = \ ...@@ -134,10 +134,20 @@ DEPS_res = \
pixmaps/playlist/shuffle_off.png \ pixmaps/playlist/shuffle_off.png \
pixmaps/playlist/shuffle_on.png \ pixmaps/playlist/shuffle_on.png \
pixmaps/playlist/dropzone.png \ pixmaps/playlist/dropzone.png \
pixmaps/playlist/sidebar-icons/sidebar-movie.png \ pixmaps/playlist/sidebar-icons/capture.png \
pixmaps/playlist/sidebar-icons/sidebar-pictures.png \ pixmaps/playlist/sidebar-icons/pictures.png \
pixmaps/playlist/sidebar-icons/sidebar-music.png \ pixmaps/playlist/sidebar-icons/disc.png \
pixmaps/playlist/sidebar-icons/sidebar-podcast.png \ pixmaps/playlist/sidebar-icons/playlist.png \
pixmaps/playlist/sidebar-icons/lan.png \
pixmaps/playlist/sidebar-icons/podcast.png \
pixmaps/playlist/sidebar-icons/library.png \
pixmaps/playlist/sidebar-icons/screen.png \
pixmaps/playlist/sidebar-icons/movie.png \
pixmaps/playlist/sidebar-icons/mtp.png \
pixmaps/playlist/sidebar-icons/music.png \
pixmaps/playlist/sidebar-icons/network.png \
pixmaps/playlist/sidebar-icons/sd/appletrailers.png \
pixmaps/playlist/sidebar-icons/sd/icecast.png \
pixmaps/prefs/advprefs_audio.png \ pixmaps/prefs/advprefs_audio.png \
pixmaps/prefs/advprefs_codec.png \ pixmaps/prefs/advprefs_codec.png \
pixmaps/prefs/advprefs_extended.png \ pixmaps/prefs/advprefs_extended.png \
......
...@@ -225,35 +225,25 @@ void PLSelector::updateTotalDuration( PLSelItem* item, const char* prefix ) ...@@ -225,35 +225,25 @@ void PLSelector::updateTotalDuration( PLSelItem* item, const char* prefix )
item->setText( qs_timeLabel ); item->setText( qs_timeLabel );
} }
/* Helper until we get proper icons */
static QIcon orangify( QString resource )
{
QPixmap pix( resource );
QPainter painter( &pix );
painter.setCompositionMode( QPainter::CompositionMode_SourceAtop );
painter.fillRect( pix.rect(), QColor( 255, 157, 62, 128 ) );
return QIcon( pix );
}
void PLSelector::createItems() void PLSelector::createItems()
{ {
/* PL */ /* PL */
playlistItem = putPLData( addItem( PL_ITEM_TYPE, N_("Playlist"), true ), playlistItem = putPLData( addItem( PL_ITEM_TYPE, N_("Playlist"), true ),
THEPL->p_playing ); THEPL->p_playing );
playlistItem->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_PL ) ); playlistItem->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_PL ) );
playlistItem->treeItem()->setData( 0, Qt::DecorationRole, orangify( ":/type/playlist" ) ); playlistItem->treeItem()->setData( 0, Qt::DecorationRole, QIcon( ":/sidebar/playlist" ) );
setCurrentItem( playlistItem->treeItem() ); setCurrentItem( playlistItem->treeItem() );
/* ML */ /* ML */
PLSelItem *ml = putPLData( addItem( PL_ITEM_TYPE, N_("Media Library"), true ), PLSelItem *ml = putPLData( addItem( PL_ITEM_TYPE, N_("Media Library"), true ),
THEPL->p_media_library ); THEPL->p_media_library );
ml->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_ML ) ); ml->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_ML ) );
ml->treeItem()->setData( 0, Qt::DecorationRole, orangify( ":/type/playlist" ) ); ml->treeItem()->setData( 0, Qt::DecorationRole, QIcon( ":/sidebar/library" ) );
#ifdef MEDIA_LIBRARY #ifdef MEDIA_LIBRARY
/* SQL ML */ /* SQL ML */
ml = addItem( SQL_ML_TYPE, "SQL Media Library" )->treeItem(); ml = addItem( SQL_ML_TYPE, "SQL Media Library" )->treeItem();
ml->treeItem()->setData( 0, Qt::DecorationRole, orangify( ":/type/playlist" ) ); ml->treeItem()->setData( 0, Qt::DecorationRole, QIcon( ":/sidebar/library" ) );
#endif #endif
/* SD nodes */ /* SD nodes */
...@@ -303,10 +293,10 @@ void PLSelector::createItems() ...@@ -303,10 +293,10 @@ void PLSelector::createItems()
int i_head = name.indexOf( "sd='" ) + 4; int i_head = name.indexOf( "sd='" ) + 4;
int i_tail = name.indexOf( '\'', i_head ); int i_tail = name.indexOf( '\'', i_head );
name.mid( i_head, i_tail - i_head ); name.mid( i_head, i_tail - i_head );
QString iconname = QString( ":/sidebar/sd/%1" ).arg( name.mid( i_head, i_tail - i_head + 1 ) ); QString iconname = QString( ":/sidebar/sd/%1" ).arg( name.mid( i_head, i_tail - i_head ) );
QResource resource( iconname ); QResource resource( iconname );
if ( !resource.isValid() ) if ( !resource.isValid() )
icon = orangify( ":/type/net" ); icon = QIcon( ":/sidebar/network" );
else else
icon = QIcon( iconname ); icon = QIcon( iconname );
} }
...@@ -315,16 +305,18 @@ void PLSelector::createItems() ...@@ -315,16 +305,18 @@ void PLSelector::createItems()
case SD_CAT_DEVICES: case SD_CAT_DEVICES:
name = name.mid( 0, name.indexOf( '{' ) ); name = name.mid( 0, name.indexOf( '{' ) );
selItem = addItem( SD_TYPE, *ppsz_longname, false, false, devices ); selItem = addItem( SD_TYPE, *ppsz_longname, false, false, devices );
if ( name == "xcb_app" ) if ( name == "xcb_apps" )
icon = QIcon( ":/sidebar/pictures" ); icon = QIcon( ":/sidebar/screen" );
else if ( name == "mtp" )
icon = QIcon( ":/sidebar/mtp" );
else if ( name == "disc" ) else if ( name == "disc" )
icon = orangify( ":/type/disc" ); icon = QIcon( ":/sidebar/disc" );
else else
icon = orangify( ":/type/capture-card" ); icon = QIcon( ":/sidebar/capture" );
break; break;
case SD_CAT_LAN: case SD_CAT_LAN:
selItem = addItem( SD_TYPE, *ppsz_longname, false, false, lan ); selItem = addItem( SD_TYPE, *ppsz_longname, false, false, lan );
icon = orangify( ":/type/network" ); icon = QIcon( ":/sidebar/lan" );
break; break;
case SD_CAT_MYCOMPUTER: case SD_CAT_MYCOMPUTER:
name = name.mid( 0, name.indexOf( '{' ) ); name = name.mid( 0, name.indexOf( '{' ) );
...@@ -336,7 +328,7 @@ void PLSelector::createItems() ...@@ -336,7 +328,7 @@ void PLSelector::createItems()
else if ( name == "picture_dir" ) else if ( name == "picture_dir" )
icon = QIcon( ":/sidebar/pictures" ); icon = QIcon( ":/sidebar/pictures" );
else else
icon = orangify( ":/type/folder-grey" ); icon = QIcon( ":/sidebar/movie" );
break; break;
default: default:
selItem = addItem( SD_TYPE, *ppsz_longname ); selItem = addItem( SD_TYPE, *ppsz_longname );
......
...@@ -128,10 +128,21 @@ ...@@ -128,10 +128,21 @@
<file alias="next">pixmaps/win7/win7thumbnail_next.png</file> <file alias="next">pixmaps/win7/win7thumbnail_next.png</file>
</qresource> </qresource>
<qresource prefix="/sidebar"> <qresource prefix="/sidebar">
<file alias="podcast">pixmaps/playlist/sidebar-icons/sidebar-podcast.png</file> <file alias="disc">pixmaps/playlist/sidebar-icons/disc.png</file>
<file alias="movie">pixmaps/playlist/sidebar-icons/sidebar-movie.png</file> <file alias="playlist">pixmaps/playlist/sidebar-icons/playlist.png</file>
<file alias="music">pixmaps/playlist/sidebar-icons/sidebar-music.png</file> <file alias="mtp">pixmaps/playlist/sidebar-icons/mtp.png</file>
<file alias="pictures">pixmaps/playlist/sidebar-icons/sidebar-pictures.png</file> <file alias="network">pixmaps/playlist/sidebar-icons/network.png</file>
<file alias="movie">pixmaps/playlist/sidebar-icons/movie.png</file>
<file alias="podcast">pixmaps/playlist/sidebar-icons/podcast.png</file>
<file alias="music">pixmaps/playlist/sidebar-icons/music.png</file>
<file alias="pictures">pixmaps/playlist/sidebar-icons/pictures.png</file>
<file alias="screen">pixmaps/playlist/sidebar-icons/screen.png</file>
<file alias="library">pixmaps/playlist/sidebar-icons/library.png</file>
<file alias="capture">pixmaps/playlist/sidebar-icons/capture.png</file>
<file alias="lan">pixmaps/playlist/sidebar-icons/lan.png</file>
</qresource>
<qresource prefix="/sidebar/sd">
<file alias="icecast">pixmaps/playlist/sidebar-icons/sd/icecast.png</file>
<file alias="appletrailers">pixmaps/playlist/sidebar-icons/sd/appletrailers.png</file>
</qresource> </qresource>
<qresource prefix="/sidebar/sd"/>
</RCC> </RCC>
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