mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-14 18:14:50 +02:00
* Respect results' online state when displaying.
This commit is contained in:
@@ -103,7 +103,7 @@ ColumnItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option
|
|||||||
}
|
}
|
||||||
else if ( !item->result().isNull() || !item->query().isNull() )
|
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 );
|
opacity = qMax( (float)0.3, opacity );
|
||||||
QColor textColor = TomahawkUtils::alphaBlend( option.palette.color( QPalette::Foreground ), option.palette.color( QPalette::Background ), opacity );
|
QColor textColor = TomahawkUtils::alphaBlend( option.palette.color( QPalette::Foreground ), option.palette.color( QPalette::Background ), opacity );
|
||||||
|
|
||||||
|
@@ -321,25 +321,25 @@ PlayableProxyModel::lessThan( int column, const Tomahawk::query_ptr& q1, const T
|
|||||||
|
|
||||||
if ( q1->numResults() )
|
if ( q1->numResults() )
|
||||||
{
|
{
|
||||||
const Tomahawk::result_ptr& r = q1->results().at( 0 );
|
Tomahawk::result_ptr r = q1->results().first();
|
||||||
bitrate1 = r->bitrate();
|
bitrate1 = r->bitrate();
|
||||||
duration1 = r->track()->duration();
|
duration1 = r->track()->duration();
|
||||||
mtime1 = r->modificationTime();
|
mtime1 = r->modificationTime();
|
||||||
size1 = r->size();
|
size1 = r->size();
|
||||||
year1 = r->track()->year();
|
year1 = r->track()->year();
|
||||||
score1 = r->score();
|
score1 = r->isOnline() ? r->score() : 0.0;
|
||||||
origin1 = r->friendlySource().toLower();
|
origin1 = r->friendlySource().toLower();
|
||||||
id1 = (qint64)&r;
|
id1 = (qint64)&r;
|
||||||
}
|
}
|
||||||
if ( q2->numResults() )
|
if ( q2->numResults() )
|
||||||
{
|
{
|
||||||
const Tomahawk::result_ptr& r = q2->results().at( 0 );
|
Tomahawk::result_ptr r = q2->results().first();
|
||||||
bitrate2 = r->bitrate();
|
bitrate2 = r->bitrate();
|
||||||
duration2 = r->track()->duration();
|
duration2 = r->track()->duration();
|
||||||
mtime2 = r->modificationTime();
|
mtime2 = r->modificationTime();
|
||||||
size2 = r->size();
|
size2 = r->size();
|
||||||
year2 = r->track()->year();
|
year2 = r->track()->year();
|
||||||
score2 = r->score();
|
score2 = r->isOnline() ? r->score() : 0.0;
|
||||||
origin2 = r->friendlySource().toLower();
|
origin2 = r->friendlySource().toLower();
|
||||||
id2 = (qint64)&r;
|
id2 = (qint64)&r;
|
||||||
}
|
}
|
||||||
|
@@ -105,7 +105,7 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
}
|
}
|
||||||
else if ( !item->result().isNull() || !item->query().isNull() )
|
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 );
|
opacity = qMax( (float)0.3, opacity );
|
||||||
QColor textColor = TomahawkUtils::alphaBlend( option.palette.color( QPalette::Foreground ), option.palette.color( QPalette::Background ), opacity );
|
QColor textColor = TomahawkUtils::alphaBlend( option.palette.color( QPalette::Foreground ), option.palette.color( QPalette::Background ), opacity );
|
||||||
|
|
||||||
|
@@ -758,7 +758,7 @@ prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, Pl
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
float opacity = 0.0;
|
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 = item->query()->results().first()->score();
|
||||||
|
|
||||||
opacity = qMax( (float)0.3, opacity );
|
opacity = qMax( (float)0.3, opacity );
|
||||||
|
Reference in New Issue
Block a user