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

* Respect results' online state when displaying.

This commit is contained in:
Christian Muehlhaeuser
2013-06-20 10:01:57 +02:00
parent 54966422c4
commit a79b6633de
4 changed files with 7 additions and 7 deletions

View File

@@ -103,7 +103,7 @@ ColumnItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option
}
else if ( !item->result().isNull() || !item->query().isNull() )
{
float opacity = item->result().isNull() ? 0.0 : item->result()->score();
float opacity = item->result() && item->result()->isOnline() ? item->result()->score() : 0.0;
opacity = qMax( (float)0.3, opacity );
QColor textColor = TomahawkUtils::alphaBlend( option.palette.color( QPalette::Foreground ), option.palette.color( QPalette::Background ), opacity );

View File

@@ -321,25 +321,25 @@ PlayableProxyModel::lessThan( int column, const Tomahawk::query_ptr& q1, const T
if ( q1->numResults() )
{
const Tomahawk::result_ptr& r = q1->results().at( 0 );
Tomahawk::result_ptr r = q1->results().first();
bitrate1 = r->bitrate();
duration1 = r->track()->duration();
mtime1 = r->modificationTime();
size1 = r->size();
year1 = r->track()->year();
score1 = r->score();
score1 = r->isOnline() ? r->score() : 0.0;
origin1 = r->friendlySource().toLower();
id1 = (qint64)&r;
}
if ( q2->numResults() )
{
const Tomahawk::result_ptr& r = q2->results().at( 0 );
Tomahawk::result_ptr r = q2->results().first();
bitrate2 = r->bitrate();
duration2 = r->track()->duration();
mtime2 = r->modificationTime();
size2 = r->size();
year2 = r->track()->year();
score2 = r->score();
score2 = r->isOnline() ? r->score() : 0.0;
origin2 = r->friendlySource().toLower();
id2 = (qint64)&r;
}

View File

@@ -105,7 +105,7 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
}
else if ( !item->result().isNull() || !item->query().isNull() )
{
float opacity = item->result().isNull() ? 0.0 : item->result()->score();
float opacity = item->result() && item->result()->isOnline() ? item->result()->score() : 0.0;
opacity = qMax( (float)0.3, opacity );
QColor textColor = TomahawkUtils::alphaBlend( option.palette.color( QPalette::Foreground ), option.palette.color( QPalette::Background ), opacity );

View File

@@ -758,7 +758,7 @@ prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, Pl
else
{
float opacity = 0.0;
if ( !item->query()->results().isEmpty() )
if ( !item->query()->results().isEmpty() && item->query()->results().first()->isOnline() )
opacity = item->query()->results().first()->score();
opacity = qMax( (float)0.3, opacity );