1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-04 13:17:34 +02:00

Ignore results without download options.

This commit is contained in:
Christian Muehlhaeuser
2015-03-11 06:48:48 +01:00
parent 36cd708517
commit a2fbe4aaed

View File

@@ -283,13 +283,14 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
} }
else */ else */
if ( index.column() == PlayableModel::Download ) if ( index.column() == PlayableModel::Download )
{
if ( item->result() && !item->result()->downloadFormats().isEmpty() )
{ {
QStyleOptionComboBox optc; QStyleOptionComboBox optc;
optc.rect = opt.rect.adjusted( 4, 0, -4, 0 ); optc.rect = opt.rect.adjusted( 4, 0, -4, 0 );
optc.editable = false; optc.editable = false;
// sDebug() << item->track()->currentFormat() << item->track()->formats().count();
optc.currentText = tr( "Download %1" ).arg( item->result()->downloadFormats().first().extension ); optc.currentText = tr( "Download %1" ).arg( item->result()->downloadFormats().first().extension );
// optc.palette = m_view->palette(); optc.palette = m_view->palette();
if ( option.state & QStyle::State_Selected && option.state & QStyle::State_Active ) if ( option.state & QStyle::State_Selected && option.state & QStyle::State_Active )
optc.state = QStyle::State_Active | QStyle::State_Selected | QStyle::State_Enabled; optc.state = QStyle::State_Active | QStyle::State_Selected | QStyle::State_Enabled;
@@ -317,7 +318,7 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
optp.minimum = 0; optp.minimum = 0;
optp.maximum = 100; optp.maximum = 100;
optp.progress = item->result()->downloadJob()->progressPercentage(); optp.progress = item->result()->downloadJob()->progressPercentage();
// optp.palette = m_view->palette(); optp.palette = m_view->palette();
if ( option.state & QStyle::State_Selected && option.state & QStyle::State_Active ) if ( option.state & QStyle::State_Selected && option.state & QStyle::State_Active )
optp.state = QStyle::State_Active | QStyle::State_Selected | QStyle::State_Enabled; optp.state = QStyle::State_Active | QStyle::State_Selected | QStyle::State_Enabled;
@@ -328,6 +329,7 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
} }
} }
} }
}
else if ( item->isPlaying() ) else if ( item->isPlaying() )
{ {
QRect r = opt.rect.adjusted( 3, 0, 0, 0 ); QRect r = opt.rect.adjusted( 3, 0, 0, 0 );