mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-30 17:20:26 +02:00
Support linkUrl for results to allow clicking on source icon
This commit is contained in:
@@ -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 );
|
||||||
@@ -390,15 +390,15 @@ void
|
|||||||
AudioControls::onPlaybackTimer( qint64 msElapsed )
|
AudioControls::onPlaybackTimer( qint64 msElapsed )
|
||||||
{
|
{
|
||||||
//tDebug() << Q_FUNC_INFO;
|
//tDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
m_phononTickCheckTimer.stop();
|
m_phononTickCheckTimer.stop();
|
||||||
|
|
||||||
if ( m_currentTrack.isNull() )
|
if ( m_currentTrack.isNull() )
|
||||||
{
|
{
|
||||||
m_sliderTimeLine.stop();
|
m_sliderTimeLine.stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int seconds = msElapsed / 1000;
|
const int seconds = msElapsed / 1000;
|
||||||
if ( seconds != m_lastTextSecondShown )
|
if ( seconds != m_lastTextSecondShown )
|
||||||
{
|
{
|
||||||
@@ -414,7 +414,7 @@ AudioControls::onPlaybackTimer( qint64 msElapsed )
|
|||||||
|
|
||||||
int currentTime = m_sliderTimeLine.currentTime();
|
int currentTime = m_sliderTimeLine.currentTime();
|
||||||
//tDebug( LOGEXTRA ) << Q_FUNC_INFO << "msElapsed =" << msElapsed << "and timer current time =" << m_sliderTimeLine.currentTime();
|
//tDebug( LOGEXTRA ) << Q_FUNC_INFO << "msElapsed =" << msElapsed << "and timer current time =" << m_sliderTimeLine.currentTime();
|
||||||
|
|
||||||
// First condition checks for the common case where
|
// First condition checks for the common case where
|
||||||
// 1) the track has been started
|
// 1) the track has been started
|
||||||
// 2) we haven't seeked,
|
// 2) we haven't seeked,
|
||||||
@@ -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 );
|
||||||
}
|
}
|
||||||
|
@@ -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;
|
||||||
|
|
||||||
|
@@ -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() );
|
||||||
|
|
||||||
|
@@ -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() );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user