mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
show source icon in now-playing widget
This commit is contained in:
@@ -87,9 +87,11 @@ AudioControls::AudioControls( QWidget* parent )
|
||||
ui->socialButton->setPixmap( RESPATH "images/share.png" );
|
||||
ui->loveButton->setPixmap( RESPATH "images/not-loved.png" );
|
||||
ui->loveButton->setCheckable( true );
|
||||
ui->ownerButton->setPixmap( RESPATH "images/resolver-default.png" );
|
||||
|
||||
ui->socialButton->setFixedSize( QSize( 20, 20 ) );
|
||||
ui->loveButton->setFixedSize( QSize( 20, 20 ) );
|
||||
ui->ownerButton->setFixedSize( QSize( 20, 20 ) );
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
ui->ownerLabel->setForegroundRole( QPalette::Text );
|
||||
@@ -254,6 +256,8 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
|
||||
ui->loveButton->setVisible( true );
|
||||
ui->socialButton->setEnabled( true );
|
||||
ui->socialButton->setVisible( true );
|
||||
ui->ownerButton->setEnabled( true );
|
||||
ui->ownerButton->setVisible( true );
|
||||
|
||||
ui->timeLabel->setToolTip( tr( "Time Elapsed" ) );
|
||||
ui->timeLeftLabel->setToolTip( tr( "Time Remaining" ) );
|
||||
@@ -262,6 +266,9 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
|
||||
ui->repeatButton->setToolTip( tr( "Repeat" ) );
|
||||
ui->socialButton->setToolTip( tr( "Share" ) );
|
||||
ui->loveButton->setToolTip( tr( "Love" ) );
|
||||
ui->ownerButton->setToolTip( QString( tr( "Playing from %1" ) ).arg( result->friendlySource() ) );
|
||||
QPixmap sourceIcon = result->sourceIcon().scaled( ui->ownerButton->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
ui->ownerButton->setPixmap( sourceIcon );
|
||||
|
||||
setCover();
|
||||
setSocialActions();
|
||||
@@ -362,12 +369,15 @@ AudioControls::onPlaybackStopped()
|
||||
m_sliderTimeLine.stop();
|
||||
m_sliderTimeLine.setCurrentTime( 0 );
|
||||
m_phononTickCheckTimer.stop();
|
||||
ui->ownerButton->setPixmap( RESPATH "images/resolver-default.png" );
|
||||
|
||||
ui->stackedLayout->setCurrentWidget( ui->playPauseButton );
|
||||
ui->loveButton->setEnabled( false );
|
||||
ui->loveButton->setVisible( false );
|
||||
ui->socialButton->setEnabled( false );
|
||||
ui->socialButton->setVisible( false );
|
||||
ui->ownerButton->setEnabled( false );
|
||||
ui->ownerButton->setVisible( false );
|
||||
|
||||
ui->timeLabel->setToolTip( "" );
|
||||
ui->timeLeftLabel->setToolTip( "" );
|
||||
@@ -376,6 +386,7 @@ AudioControls::onPlaybackStopped()
|
||||
ui->repeatButton->setToolTip( "" );
|
||||
ui->socialButton->setToolTip( "" );
|
||||
ui->loveButton->setToolTip( "" );
|
||||
ui->ownerButton->setToolTip( "" );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -331,6 +331,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ImageButton" name="ownerButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>resolver</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@@ -178,6 +178,7 @@ Result::toVariant() const
|
||||
m.insert( "album", album()->name() );
|
||||
m.insert( "track", track() );
|
||||
m.insert( "source", friendlySource() );
|
||||
m.insert( "sourceIcon", sourceIcon() );
|
||||
m.insert( "mimetype", mimetype() );
|
||||
m.insert( "size", size() );
|
||||
m.insert( "bitrate", bitrate() );
|
||||
@@ -294,6 +295,20 @@ Result::friendlySource() const
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
Result::sourceIcon() const
|
||||
{
|
||||
if ( collection().isNull() )
|
||||
{
|
||||
return m_sourceIcon;
|
||||
}
|
||||
else
|
||||
{
|
||||
return collection()->source()->avatar( Source::FancyStyle );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::Resolver*
|
||||
Result::resolvedBy() const
|
||||
{
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#define RESULT_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
@@ -71,6 +72,7 @@ public:
|
||||
QString url() const { return m_url; }
|
||||
QString mimetype() const { return m_mimetype; }
|
||||
QString friendlySource() const;
|
||||
QPixmap sourceIcon() const;
|
||||
|
||||
unsigned int duration() const { return m_duration; }
|
||||
unsigned int bitrate() const { return m_bitrate; }
|
||||
@@ -86,6 +88,7 @@ public:
|
||||
void setRID( RID id ) { m_rid = id; }
|
||||
void setCollection( const Tomahawk::collection_ptr& collection );
|
||||
void setFriendlySource( const QString& s ) { m_friendlySource = s; }
|
||||
void setSourceIcon( const QPixmap& i ) { m_sourceIcon = i; }
|
||||
void setArtist( const Tomahawk::artist_ptr& artist );
|
||||
void setAlbum( const Tomahawk::album_ptr& album );
|
||||
void setComposer( const Tomahawk::artist_ptr& composer );
|
||||
@@ -137,6 +140,7 @@ private:
|
||||
QString m_url;
|
||||
QString m_mimetype;
|
||||
QString m_friendlySource;
|
||||
QPixmap m_sourceIcon;
|
||||
|
||||
unsigned int m_duration;
|
||||
unsigned int m_bitrate;
|
||||
|
Reference in New Issue
Block a user