mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
* Show proper origin name for script-resolved results.
This commit is contained in:
@@ -236,7 +236,7 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
|
|||||||
|
|
||||||
ui->artistTrackLabel->setResult( result );
|
ui->artistTrackLabel->setResult( result );
|
||||||
ui->albumLabel->setResult( result );
|
ui->albumLabel->setResult( result );
|
||||||
ui->ownerLabel->setText( result->collection()->source()->friendlyName() );
|
ui->ownerLabel->setText( result->friendlySource() );
|
||||||
ui->coverImage->setPixmap( m_defaultCover );
|
ui->coverImage->setPixmap( m_defaultCover );
|
||||||
|
|
||||||
if ( ui->timeLabel->text().isEmpty() )
|
if ( ui->timeLabel->text().isEmpty() )
|
||||||
|
@@ -176,7 +176,7 @@ TrackModel::data( const QModelIndex& index, int role ) const
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Origin:
|
case Origin:
|
||||||
return query->results().first()->collection()->source()->friendlyName();
|
return query->results().first()->friendlySource();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -46,12 +46,18 @@ Result::collection() const
|
|||||||
float
|
float
|
||||||
Result::score() const
|
Result::score() const
|
||||||
{
|
{
|
||||||
if ( collection()->source()->isOnline() )
|
if ( !collection().isNull() && collection()->source()->isOnline() )
|
||||||
{
|
{
|
||||||
return m_score;
|
return m_score;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 0.0;
|
{
|
||||||
|
// check if this a valid collection-less result (e.g. from youtube, but ignore offline sources still)
|
||||||
|
if ( collection().isNull() )
|
||||||
|
return m_score;
|
||||||
|
else
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -144,3 +150,15 @@ Result::setCollection( const Tomahawk::collection_ptr& collection )
|
|||||||
connect( m_collection->source().data(), SIGNAL( online() ), SLOT( onOnline() ), Qt::QueuedConnection );
|
connect( m_collection->source().data(), SIGNAL( online() ), SLOT( onOnline() ), Qt::QueuedConnection );
|
||||||
connect( m_collection->source().data(), SIGNAL( offline() ), SLOT( onOffline() ), Qt::QueuedConnection );
|
connect( m_collection->source().data(), SIGNAL( offline() ), SLOT( onOffline() ), Qt::QueuedConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString
|
||||||
|
Result::friendlySource() const
|
||||||
|
{
|
||||||
|
if ( collection().isNull() )
|
||||||
|
{
|
||||||
|
return m_friendlySource;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return collection()->source()->friendlyName();
|
||||||
|
}
|
||||||
|
@@ -43,6 +43,7 @@ public:
|
|||||||
QString track() const { return m_track; }
|
QString track() const { return m_track; }
|
||||||
QString url() const { return m_url; }
|
QString url() const { return m_url; }
|
||||||
QString mimetype() const { return m_mimetype; }
|
QString mimetype() const { return m_mimetype; }
|
||||||
|
QString friendlySource() const;
|
||||||
|
|
||||||
unsigned int duration() const { return m_duration; }
|
unsigned int duration() const { return m_duration; }
|
||||||
unsigned int bitrate() const { return m_bitrate; }
|
unsigned int bitrate() const { return m_bitrate; }
|
||||||
@@ -55,6 +56,7 @@ public:
|
|||||||
void setId( unsigned int id ) { m_id = id; }
|
void setId( unsigned int id ) { m_id = id; }
|
||||||
void setRID( RID id ) { m_rid = id; }
|
void setRID( RID id ) { m_rid = id; }
|
||||||
void setCollection( const Tomahawk::collection_ptr& collection );
|
void setCollection( const Tomahawk::collection_ptr& collection );
|
||||||
|
void setFriendlySource( const QString& s ) { m_friendlySource = s; }
|
||||||
void setArtist( const Tomahawk::artist_ptr& artist );
|
void setArtist( const Tomahawk::artist_ptr& artist );
|
||||||
void setAlbum( const Tomahawk::album_ptr& album );
|
void setAlbum( const Tomahawk::album_ptr& album );
|
||||||
void setTrack( const QString& track ) { m_track = track; }
|
void setTrack( const QString& track ) { m_track = track; }
|
||||||
@@ -90,6 +92,7 @@ private:
|
|||||||
QString m_track;
|
QString m_track;
|
||||||
QString m_url;
|
QString m_url;
|
||||||
QString m_mimetype;
|
QString m_mimetype;
|
||||||
|
QString m_friendlySource;
|
||||||
|
|
||||||
unsigned int m_duration;
|
unsigned int m_duration;
|
||||||
unsigned int m_bitrate;
|
unsigned int m_bitrate;
|
||||||
|
@@ -134,7 +134,7 @@ ScriptResolver::handleMsg( const QByteArray& msg )
|
|||||||
rp->setSize( m.value( "size" ).toUInt() );
|
rp->setSize( m.value( "size" ).toUInt() );
|
||||||
rp->setScore( m.value( "score" ).toFloat() * ( (float)weight() / 100.0 ) );
|
rp->setScore( m.value( "score" ).toFloat() * ( (float)weight() / 100.0 ) );
|
||||||
rp->setRID( uuid() );
|
rp->setRID( uuid() );
|
||||||
rp->setCollection( coll );
|
rp->setFriendlySource( m_name );
|
||||||
results << rp;
|
results << rp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user