1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-01 18:04:05 +02:00

Support linkUrl for results to allow clicking on source icon

This commit is contained in:
Leo Franchi
2012-09-18 11:36:12 -04:00
parent 2a2b918772
commit b65f414695
4 changed files with 11 additions and 6 deletions

View File

@@ -263,7 +263,7 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
ui->ownerButton->setToolTip( QString( tr( "Playing from %1" ) ).arg( result->friendlySource() ) ); ui->ownerButton->setToolTip( QString( tr( "Playing from %1" ) ).arg( result->friendlySource() ) );
QPixmap sourceIcon = result->sourceIcon().scaled( ui->ownerButton->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); QPixmap sourceIcon = result->sourceIcon().scaled( ui->ownerButton->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
ui->ownerButton->setPixmap( sourceIcon ); ui->ownerButton->setPixmap( sourceIcon );
if ( QUrl( result->purchaseUrl() ).isValid() || !result->collection().isNull() ) if ( QUrl( result->linkUrl() ).isValid() || !result->collection().isNull() )
ui->ownerButton->setCursor( Qt::PointingHandCursor ); ui->ownerButton->setCursor( Qt::PointingHandCursor );
else else
ui->ownerButton->setCursor( Qt::ArrowCursor ); ui->ownerButton->setCursor( Qt::ArrowCursor );
@@ -675,7 +675,7 @@ AudioControls::onOwnerButtonClicked()
{ {
if ( m_currentTrack->collection().isNull() ) if ( m_currentTrack->collection().isNull() )
{ {
QUrl url = QUrl( m_currentTrack->purchaseUrl() ); QUrl url = QUrl( m_currentTrack->linkUrl() );
if ( url.isValid() ) if ( url.isValid() )
QDesktopServices::openUrl( url ); QDesktopServices::openUrl( url );
} }

View File

@@ -74,6 +74,7 @@ public:
QString friendlySource() const; QString friendlySource() const;
QPixmap sourceIcon() const; QPixmap sourceIcon() const;
QString purchaseUrl() const { return m_purchaseUrl; } QString purchaseUrl() const { return m_purchaseUrl; }
QString linkUrl() const { return m_linkUrl; }
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; }
@@ -90,6 +91,7 @@ public:
void setCollection( const Tomahawk::collection_ptr& collection ); void setCollection( const Tomahawk::collection_ptr& collection );
void setFriendlySource( const QString& s ) { m_friendlySource = s; } void setFriendlySource( const QString& s ) { m_friendlySource = s; }
void setPurchaseUrl( const QString& u ) { m_purchaseUrl = u; } void setPurchaseUrl( const QString& u ) { m_purchaseUrl = u; }
void setLinkUrl( const QString& u ) { m_linkUrl = u; }
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 setComposer( const Tomahawk::artist_ptr& composer ); void setComposer( const Tomahawk::artist_ptr& composer );
@@ -143,6 +145,7 @@ private:
QString m_track; QString m_track;
QString m_url; QString m_url;
QString m_purchaseUrl; QString m_purchaseUrl;
QString m_linkUrl;
QString m_mimetype; QString m_mimetype;
QString m_friendlySource; QString m_friendlySource;

View File

@@ -434,6 +434,7 @@ QtScriptResolver::parseResultVariantList( const QVariantList& reslist )
rp->setFriendlySource( name() ); rp->setFriendlySource( name() );
rp->setSourceIcon( new QPixmap( icon() ) ); rp->setSourceIcon( new QPixmap( icon() ) );
rp->setPurchaseUrl( m.value( "purchaseUrl" ).toString() ); rp->setPurchaseUrl( m.value( "purchaseUrl" ).toString() );
rp->setLinkUrl( m.value( "linkUrl" ).toString() );
rp->setScore( m.value( "score" ).toFloat() ); rp->setScore( m.value( "score" ).toFloat() );
rp->setDiscNumber( m.value( "discnumber" ).toUInt() ); rp->setDiscNumber( m.value( "discnumber" ).toUInt() );

View File

@@ -284,6 +284,7 @@ ScriptResolver::handleMsg( const QByteArray& msg )
rp->setFriendlySource( m_name ); rp->setFriendlySource( m_name );
rp->setSourceIcon( new QPixmap( m_icon ) ); rp->setSourceIcon( new QPixmap( m_icon ) );
rp->setPurchaseUrl( m.value( "purchaseUrl" ).toString() ); rp->setPurchaseUrl( m.value( "purchaseUrl" ).toString() );
rp->setLinkUrl( m.value( "linkUrl" ).toString() );
rp->setYear( m.value( "year").toUInt() ); rp->setYear( m.value( "year").toUInt() );
rp->setDiscNumber( m.value( "discnumber" ).toUInt() ); rp->setDiscNumber( m.value( "discnumber" ).toUInt() );