1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-19 23:41:51 +02:00

make use of new icons

This commit is contained in:
Michael Zanetti 2011-08-22 01:44:42 +02:00
parent e7cd5bddc4
commit 71a5888cba
2 changed files with 12 additions and 103 deletions

View File

@ -109,5 +109,8 @@
<file>data/sql/dbmigrate-25_to_26.sql</file>
<file>data/js/tomahawk.js</file>
<file>data/images/avatar_frame.png</file>
<file>data/images/drop-all-songs.png</file>
<file>data/images/drop-local-songs.png</file>
<file>data/images/drop-top-songs.png</file>
</qresource>
</RCC>

View File

@ -203,7 +203,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
QString text;
QRect textRect;
QPixmap icon = QPixmap( ":/data/images/new-additions.png" ).scaledToHeight( 32, Qt::SmoothTransformation );
QPixmap icon;
QMap< int, SourceTreeItem::DropType > dropTypeMap;
dropTypeMap.insert( 0, SourceTreeItem::DropTypeThisTrack );
@ -219,6 +219,13 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
dropTypeTextMap.insert( 3, "Local" );
dropTypeTextMap.insert( 4, "Top 10" );
QMap< int, QString > dropTypeImageMap;
dropTypeImageMap.insert( 0, ":/data/images/new-additions.png" );
dropTypeImageMap.insert( 1, ":/data/images/new-additions.png" );
dropTypeImageMap.insert( 2, ":/data/images/drop-all-songs.png" );
dropTypeImageMap.insert( 3, ":/data/images/drop-local-songs.png" );
dropTypeImageMap.insert( 4, ":/data/images/drop-top-songs.png" );
SourceTreeItem::DropTypes dropTypes = item->supportedDropTypes( m_dropMimeData );
for ( int i = 0; i < 5; ++i )
@ -241,7 +248,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
painter->setFont( font );
textRect = itemsRect.adjusted( 0, 4, 0, 0 );
painter->drawPixmap( textRect.x() + iconSpacing, textRect.y(), icon );
painter->drawPixmap( textRect.x() + iconSpacing, textRect.y(), QPixmap( dropTypeImageMap.value( i ) ).scaledToWidth( 32, Qt::SmoothTransformation ) );
int textSpacing = ( itemWidth - painter->fontMetrics().width( text ) ) / 2;
textRect.adjust( textSpacing, 32 + 4, 0, 0 );
@ -250,107 +257,6 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
}
// if ( dropTypes.testFlag( SourceTreeItem::DropTypeThisTrack ) )
// {
// text = tr( "Track" );
// itemsRect.adjust( itemWidth * count, 0, itemWidth * count, 0 );
// if ( itemRect.contains( cursorPos ) )
// {
// painter->setFont( fontBold );
// m_hoveredDropType = SourceTreeItem::DropTypeThisTrack;
// }
// else
// painter->setFont( font );
// textRect = itemsRect.adjusted( 0, 4, 0, 0 );
// painter->drawPixmap( textRect.x() + iconSpacing, textRect.y(), icon );
// int textSpacing = ( itemWidth - painter->fontMetrics().width( text ) ) / 2;
// textRect.adjust( textSpacing, 32 + 4, 0, 0 );
// painter->drawText( textRect, text );
// count++;
// }
// if ( dropTypes.testFlag( SourceTreeItem::DropTypeThisAlbum ) )
// {
// text = tr( "Album" );
// itemsRect.adjust( itemWidth * count, 0, itemWidth * count, 0 );
// if ( itemRect.contains( cursorPos ) )
// {
// painter->setFont( fontBold );
// m_hoveredDropType = SourceTreeItem::DropTypeThisTrack;
// }
// else
// painter->setFont( font );
// textRect = itemsRect.adjusted( 0, 4, 0, 0 );
// painter->drawPixmap( textRect.x() + iconSpacing, textRect.y(), icon );
// int textSpacing = ( itemWidth - painter->fontMetrics().width( text ) ) / 2;
// textRect.adjust( textSpacing, 32 + 4, 0, 0 );
// painter->drawText( textRect, text );
// count++;
// }
// if ( dropTypes.testFlag( SourceTreeItem::DropTypeAllFromArtist ) )
// {
// text = tr( "Artist" );
// textRect = itemsRect.adjusted( itemWidth * count, 4, itemWidth * count, 0 );
// painter->drawPixmap( textRect.x() + iconSpacing, textRect.y(), icon );
// if ( itemRect.contains( cursorPos ) )
// {
// painter->setFont( fontBold );
// m_hoveredDropType = SourceTreeItem::DropTypeAllFromArtist;
// }
// else
// painter->setFont( font );
// int textSpacing = ( itemWidth - painter->fontMetrics().width( text ) ) / 2;
// textRect.adjust( textSpacing, 32 + 4, 0, 0 );
// painter->drawText( textRect, text );
// count++;
// }
// if ( dropTypes.testFlag( SourceTreeItem::DropTypeLocalItems ) )
// {
// text = tr( "Local" );
// textRect = itemsRect.adjusted( itemWidth * count, 4, itemWidth * count, 0 );
// painter->drawPixmap( textRect.x() + iconSpacing, textRect.y(), icon );
// if ( itemRect.contains( cursorPos ) )
// {
// painter->setFont( fontBold );
// m_hoveredDropType = SourceTreeItem::DropTypeLocalItems;
// }
// else
// painter->setFont( font );
// int textSpacing = ( itemWidth - painter->fontMetrics().width( text ) ) / 2;
// textRect.adjust( textSpacing, 32 + 4, 0, 0 );
// painter->drawText( textRect, text );
// count++;
// }
// if ( dropTypes.testFlag( SourceTreeItem::DropTypeTop50 ) )
// {
// text = tr( "Top 10" );
// textRect = itemsRect.adjusted( itemWidth * count, 4, itemWidth * count, 0 );
// painter->drawPixmap( textRect.x() + iconSpacing, textRect.y(), icon );
// if ( itemRect.contains( cursorPos ) )
// {
// painter->setFont( fontBold );
// m_hoveredDropType = SourceTreeItem::DropTypeTop50;
// }
// else
// painter->setFont( font );
// int textSpacing = ( itemWidth - painter->fontMetrics().width( text ) ) / 2;
// textRect.adjust( textSpacing, 32 + 4, 0, 0 );
// painter->drawText( textRect, text );
// count++;
// }
// QFont bold = painter->font();
// bold.setBold( true );