mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 23:39:42 +01:00
* Use a textual score representation instead of the bar.
This commit is contained in:
parent
491060d5bc
commit
130a8e7917
@ -47,7 +47,7 @@ PlayableModel::PlayableModel( QObject* parent, bool loading )
|
||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection );
|
||||
|
||||
m_header << tr( "Artist" ) << tr( "Title" ) << tr( "Composer" ) << tr( "Album" ) << tr( "Track" ) << tr( "Duration" )
|
||||
<< tr( "Bitrate" ) << tr( "Age" ) << tr( "Year" ) << tr( "Size" ) << tr( "Origin" ) << tr( "Score" ) << tr( "Name" );
|
||||
<< tr( "Bitrate" ) << tr( "Age" ) << tr( "Year" ) << tr( "Size" ) << tr( "Origin" ) << tr( "Accuracy" ) << tr( "Name" );
|
||||
}
|
||||
|
||||
|
||||
@ -235,8 +235,22 @@ PlayableModel::queryData( const query_ptr& query, int column, int role ) const
|
||||
break;
|
||||
|
||||
case Score:
|
||||
return query->results().first()->score();
|
||||
{
|
||||
float score = query->results().first()->score();
|
||||
if ( score == 1.0 )
|
||||
return tr( "Perfect match" );
|
||||
if ( score > 0.9 )
|
||||
return tr( "Very good match" );
|
||||
if ( score > 0.7 )
|
||||
return tr( "Good match" );
|
||||
if ( score > 0.5 )
|
||||
return tr( "Vague match" );
|
||||
if ( score > 0.3 )
|
||||
return tr( "Bad match" );
|
||||
|
||||
return tr( "Not available" );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
@ -679,6 +693,7 @@ PlayableModel::columnAlignment( int column ) const
|
||||
case Bitrate:
|
||||
case Duration:
|
||||
case Filesize:
|
||||
case Score:
|
||||
case Year:
|
||||
return Qt::AlignHCenter;
|
||||
break;
|
||||
|
@ -240,11 +240,11 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
|
||||
|
||||
painter->save();
|
||||
|
||||
if ( index.column() == PlayableModel::Score )
|
||||
/* if ( index.column() == PlayableModel::Score )
|
||||
{
|
||||
QColor barColor( 167, 183, 211 ); // This matches the sidebar (sourcetreeview.cpp:672)
|
||||
if ( opt.state & QStyle::State_Selected )
|
||||
painter->setPen( opt.palette.brightText().color() );
|
||||
if ( opt.state & QStyle::State_Selected && !item->isPlaying() )
|
||||
painter->setPen( Qt::white );
|
||||
else
|
||||
painter->setPen( barColor );
|
||||
|
||||
@ -255,14 +255,14 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
|
||||
int fillerWidth = (int)( index.data().toFloat() * (float)fillR.width() );
|
||||
fillR.adjust( 0, 0, -( fillR.width() - fillerWidth ), 0 );
|
||||
|
||||
if ( opt.state & QStyle::State_Selected )
|
||||
painter->setBrush( opt.palette.brightText().color() );
|
||||
if ( opt.state & QStyle::State_Selected && !item->isPlaying() )
|
||||
painter->setBrush( TomahawkUtils::Colors::NOW_PLAYING_ITEM.lighter() );
|
||||
else
|
||||
painter->setBrush( barColor );
|
||||
|
||||
painter->drawRect( fillR );
|
||||
}
|
||||
else if ( item->isPlaying() )
|
||||
else */ if ( item->isPlaying() )
|
||||
{
|
||||
QRect r = opt.rect.adjusted( 3, 0, 0, 0 );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user