mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-29 16:50:11 +02:00
Can't access score via Result anymore.
This commit is contained in:
@@ -105,7 +105,7 @@ Api_v1_5::playback( QxtWebRequestEvent* event, const QString& command )
|
|||||||
} else {
|
} else {
|
||||||
trackInfo.insert( "resolvedBy", "<unknown resolver>" );
|
trackInfo.insert( "resolvedBy", "<unknown resolver>" );
|
||||||
}
|
}
|
||||||
trackInfo.insert( "score", currentTrack->score() );
|
//FIXME? trackInfo.insert( "score", currentTrack->score() );
|
||||||
trackInfo.insert( "album", currentTrack->track()->album() );
|
trackInfo.insert( "album", currentTrack->track()->album() );
|
||||||
trackInfo.insert( "albumpos", currentTrack->track()->albumpos() );
|
trackInfo.insert( "albumpos", currentTrack->track()->albumpos() );
|
||||||
trackInfo.insert( "artist", currentTrack->track()->artist() );
|
trackInfo.insert( "artist", currentTrack->track()->artist() );
|
||||||
|
@@ -387,8 +387,7 @@ Pipeline::addResultsToQuery( const query_ptr& query, const QList< result_ptr >&
|
|||||||
QList< result_ptr > cleanResults;
|
QList< result_ptr > cleanResults;
|
||||||
foreach ( const result_ptr& r, results )
|
foreach ( const result_ptr& r, results )
|
||||||
{
|
{
|
||||||
r->setScore( query->howSimilar( r ) );
|
if ( !query->isFullTextQuery() && query->howSimilar( r ) < MINSCORE )
|
||||||
if ( !query->isFullTextQuery() && r->score() < MINSCORE )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cleanResults << r;
|
cleanResults << r;
|
||||||
|
@@ -39,6 +39,8 @@ private:
|
|||||||
QList< Tomahawk::artist_ptr > artists;
|
QList< Tomahawk::artist_ptr > artists;
|
||||||
QList< Tomahawk::album_ptr > albums;
|
QList< Tomahawk::album_ptr > albums;
|
||||||
QList< Tomahawk::result_ptr > results;
|
QList< Tomahawk::result_ptr > results;
|
||||||
|
|
||||||
|
float score;
|
||||||
bool solved;
|
bool solved;
|
||||||
bool playable;
|
bool playable;
|
||||||
bool resolveFinished;
|
bool resolveFinished;
|
||||||
|
@@ -866,7 +866,7 @@ AudioEngine::play( const QUrl& url )
|
|||||||
result->setMimetype( tags["mimetype"].toString() );
|
result->setMimetype( tags["mimetype"].toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
result->setScore( 1.0 );
|
// result->setScore( 1.0 );
|
||||||
result->setResolvedByCollection( SourceList::instance()->getLocal()->collections().first(), false );
|
result->setResolvedByCollection( SourceList::instance()->getLocal()->collections().first(), false );
|
||||||
|
|
||||||
// Tomahawk::query_ptr qry = Tomahawk::Query::get( t );
|
// Tomahawk::query_ptr qry = Tomahawk::Query::get( t );
|
||||||
|
@@ -161,7 +161,6 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
|||||||
result->setBitrate( bitrate );
|
result->setBitrate( bitrate );
|
||||||
result->setModificationTime( modificationTime );
|
result->setModificationTime( modificationTime );
|
||||||
result->setMimetype( mimetype );
|
result->setMimetype( mimetype );
|
||||||
result->setScore( 1.0f );
|
|
||||||
result->setResolvedByCollection( s->dbCollection(), false );
|
result->setResolvedByCollection( s->dbCollection(), false );
|
||||||
|
|
||||||
ql << Tomahawk::Query::getFixed( t, result );
|
ql << Tomahawk::Query::getFixed( t, result );
|
||||||
|
@@ -283,7 +283,7 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib )
|
|||||||
{
|
{
|
||||||
if ( trackPairs.at( k ).first == (int)track->trackId() )
|
if ( trackPairs.at( k ).first == (int)track->trackId() )
|
||||||
{
|
{
|
||||||
result->setScore( trackPairs.at( k ).second );
|
//FIXME: result->setScore( trackPairs.at( k ).second );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -323,7 +323,6 @@ Tomahawk::DatabaseImpl::file( int fid )
|
|||||||
r->setMimetype( query.value( 4 ).toString() );
|
r->setMimetype( query.value( 4 ).toString() );
|
||||||
r->setBitrate( query.value( 6 ).toUInt() );
|
r->setBitrate( query.value( 6 ).toUInt() );
|
||||||
r->setResolvedByCollection( s->dbCollection() );
|
r->setResolvedByCollection( s->dbCollection() );
|
||||||
r->setScore( 1.0 );
|
|
||||||
r->setFileId( fid );
|
r->setFileId( fid );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -642,7 +641,6 @@ Tomahawk::DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
|
|||||||
// Return http resulthint directly
|
// Return http resulthint directly
|
||||||
res = Tomahawk::Result::get( url, track );
|
res = Tomahawk::Result::get( url, track );
|
||||||
res->setRID( uuid() );
|
res->setRID( uuid() );
|
||||||
res->setScore( 1.0 );
|
|
||||||
const QUrl u = QUrl::fromUserInput( url );
|
const QUrl u = QUrl::fromUserInput( url );
|
||||||
res->setFriendlySource( u.host() );
|
res->setFriendlySource( u.host() );
|
||||||
|
|
||||||
@@ -722,7 +720,6 @@ Tomahawk::DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
|
|||||||
res->setSize( query.value( 2 ).toUInt() );
|
res->setSize( query.value( 2 ).toUInt() );
|
||||||
res->setMimetype( query.value( 4 ).toString() );
|
res->setMimetype( query.value( 4 ).toString() );
|
||||||
res->setBitrate( query.value( 6 ).toInt() );
|
res->setBitrate( query.value( 6 ).toInt() );
|
||||||
res->setScore( 1.0 );
|
|
||||||
res->setRID( uuid() );
|
res->setRID( uuid() );
|
||||||
res->setResolvedByCollection( s->dbCollection() );
|
res->setResolvedByCollection( s->dbCollection() );
|
||||||
}
|
}
|
||||||
|
@@ -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() && item->result()->isOnline() ? item->result()->score() : 0.0;
|
float opacity = item->query() && item->result()->isOnline() ? item->query()->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 );
|
||||||
|
|
||||||
|
@@ -286,13 +286,7 @@ PlayableModel::queryData( const query_ptr& query, int column, int role ) const
|
|||||||
|
|
||||||
case Score:
|
case Score:
|
||||||
{
|
{
|
||||||
float score;
|
return scoreText( query->score() );
|
||||||
if ( query->results().first()->isOnline() )
|
|
||||||
score = query->results().first()->score();
|
|
||||||
else
|
|
||||||
score = 0.0;
|
|
||||||
|
|
||||||
return scoreText( score );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -470,7 +470,7 @@ PlayableProxyModel::lessThan( int column, const Tomahawk::query_ptr& q1, const T
|
|||||||
mtime1 = r->modificationTime();
|
mtime1 = r->modificationTime();
|
||||||
size1 = r->size();
|
size1 = r->size();
|
||||||
year1 = r->track()->year();
|
year1 = r->track()->year();
|
||||||
score1 = r->score();
|
score1 = q1->score();
|
||||||
origin1 = r->friendlySource().toLower();
|
origin1 = r->friendlySource().toLower();
|
||||||
}
|
}
|
||||||
if ( !q2->results().isEmpty() )
|
if ( !q2->results().isEmpty() )
|
||||||
@@ -480,7 +480,7 @@ PlayableProxyModel::lessThan( int column, const Tomahawk::query_ptr& q1, const T
|
|||||||
mtime2 = r->modificationTime();
|
mtime2 = r->modificationTime();
|
||||||
size2 = r->size();
|
size2 = r->size();
|
||||||
year2 = r->track()->year();
|
year2 = r->track()->year();
|
||||||
score2 = r->score();
|
score2 = q2->score();
|
||||||
origin2 = r->friendlySource().toLower();
|
origin2 = r->friendlySource().toLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -294,7 +294,7 @@ ScriptAccount::parseResultVariantList( const QVariantList& reslist )
|
|||||||
rp->setRID( uuid() );
|
rp->setRID( uuid() );
|
||||||
rp->setPurchaseUrl( m.value( "purchaseUrl" ).toString() );
|
rp->setPurchaseUrl( m.value( "purchaseUrl" ).toString() );
|
||||||
rp->setLinkUrl( m.value( "linkUrl" ).toString() );
|
rp->setLinkUrl( m.value( "linkUrl" ).toString() );
|
||||||
rp->setScore( m.value( "score" ).toFloat() );
|
//FIXME? rp->setScore( m.value( "score" ).toFloat() );
|
||||||
rp->setChecked( m.value( "checked" ).toBool() );
|
rp->setChecked( m.value( "checked" ).toBool() );
|
||||||
|
|
||||||
//FIXME
|
//FIXME
|
||||||
|
@@ -122,7 +122,6 @@ ScriptCommand_AllTracks::onTracksJobDone( const QVariantMap& result )
|
|||||||
QList< Tomahawk::query_ptr > queries;
|
QList< Tomahawk::query_ptr > queries;
|
||||||
foreach ( const Tomahawk::result_ptr& result, t )
|
foreach ( const Tomahawk::result_ptr& result, t )
|
||||||
{
|
{
|
||||||
result->setScore( 1.0 );
|
|
||||||
result->setResolvedByCollection( m_collection );
|
result->setResolvedByCollection( m_collection );
|
||||||
queries.append( result->toQuery() );
|
queries.append( result->toQuery() );
|
||||||
}
|
}
|
||||||
|
@@ -835,7 +835,7 @@ prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, Pl
|
|||||||
{
|
{
|
||||||
float opacity = 0.0;
|
float opacity = 0.0;
|
||||||
if ( item->query() && !item->query()->results().isEmpty() && item->query()->results().first()->isOnline() )
|
if ( item->query() && !item->query()->results().isEmpty() && item->query()->results().first()->isOnline() )
|
||||||
opacity = item->query()->results().first()->score();
|
opacity = item->query()->score();
|
||||||
|
|
||||||
opacity = qMax( (float)0.3, opacity );
|
opacity = qMax( (float)0.3, opacity );
|
||||||
QColor textColor = alphaBlend( option->palette.color( QPalette::Text ), option->palette.color( QPalette::BrightText ), opacity );
|
QColor textColor = alphaBlend( option->palette.color( QPalette::Text ), option->palette.color( QPalette::BrightText ), opacity );
|
||||||
|
@@ -324,7 +324,7 @@ SearchWidget::onResultsFound( const QList<Tomahawk::result_ptr>& results )
|
|||||||
|
|
||||||
if ( !found )
|
if ( !found )
|
||||||
{
|
{
|
||||||
m_results.insert( query, result->score() );
|
m_results.insert( query, /*FIXME*/ query->score() );
|
||||||
queries << query;
|
queries << query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +344,7 @@ SearchWidget::onResultsFound( const QList<Tomahawk::result_ptr>& results )
|
|||||||
PlayableItem* item = m_resultsModel->itemFromIndex( m_resultsModel->index( i, 0, QModelIndex() ) );
|
PlayableItem* item = m_resultsModel->itemFromIndex( m_resultsModel->index( i, 0, QModelIndex() ) );
|
||||||
if ( item && item->query() && item->query()->numResults( true ) )
|
if ( item && item->query() && item->query()->numResults( true ) )
|
||||||
{
|
{
|
||||||
if ( item->query()->results().first()->score() < q->results().first()->score() )
|
if ( item->query()->score() < q->score() )
|
||||||
{
|
{
|
||||||
m_resultsModel->insertQuery( q, i );
|
m_resultsModel->insertQuery( q, i );
|
||||||
done = true;
|
done = true;
|
||||||
|
Reference in New Issue
Block a user