mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 06:36:55 +02:00
* Use a textual score representation instead of the bar.
This commit is contained in:
@@ -47,7 +47,7 @@ PlayableModel::PlayableModel( QObject* parent, bool loading )
|
|||||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection );
|
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection );
|
||||||
|
|
||||||
m_header << tr( "Artist" ) << tr( "Title" ) << tr( "Composer" ) << tr( "Album" ) << tr( "Track" ) << tr( "Duration" )
|
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;
|
break;
|
||||||
|
|
||||||
case Score:
|
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;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -679,6 +693,7 @@ PlayableModel::columnAlignment( int column ) const
|
|||||||
case Bitrate:
|
case Bitrate:
|
||||||
case Duration:
|
case Duration:
|
||||||
case Filesize:
|
case Filesize:
|
||||||
|
case Score:
|
||||||
case Year:
|
case Year:
|
||||||
return Qt::AlignHCenter;
|
return Qt::AlignHCenter;
|
||||||
break;
|
break;
|
||||||
|
@@ -240,11 +240,11 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
|
|||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
if ( index.column() == PlayableModel::Score )
|
/* if ( index.column() == PlayableModel::Score )
|
||||||
{
|
{
|
||||||
QColor barColor( 167, 183, 211 ); // This matches the sidebar (sourcetreeview.cpp:672)
|
QColor barColor( 167, 183, 211 ); // This matches the sidebar (sourcetreeview.cpp:672)
|
||||||
if ( opt.state & QStyle::State_Selected )
|
if ( opt.state & QStyle::State_Selected && !item->isPlaying() )
|
||||||
painter->setPen( opt.palette.brightText().color() );
|
painter->setPen( Qt::white );
|
||||||
else
|
else
|
||||||
painter->setPen( barColor );
|
painter->setPen( barColor );
|
||||||
|
|
||||||
@@ -255,14 +255,14 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
|
|||||||
int fillerWidth = (int)( index.data().toFloat() * (float)fillR.width() );
|
int fillerWidth = (int)( index.data().toFloat() * (float)fillR.width() );
|
||||||
fillR.adjust( 0, 0, -( fillR.width() - fillerWidth ), 0 );
|
fillR.adjust( 0, 0, -( fillR.width() - fillerWidth ), 0 );
|
||||||
|
|
||||||
if ( opt.state & QStyle::State_Selected )
|
if ( opt.state & QStyle::State_Selected && !item->isPlaying() )
|
||||||
painter->setBrush( opt.palette.brightText().color() );
|
painter->setBrush( TomahawkUtils::Colors::NOW_PLAYING_ITEM.lighter() );
|
||||||
else
|
else
|
||||||
painter->setBrush( barColor );
|
painter->setBrush( barColor );
|
||||||
|
|
||||||
painter->drawRect( fillR );
|
painter->drawRect( fillR );
|
||||||
}
|
}
|
||||||
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 );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user