mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-14 01:54:07 +02:00
Clear and set source icon image
This commit is contained in:
@@ -70,6 +70,8 @@ AudioControls::AudioControls( QWidget* parent )
|
|||||||
|
|
||||||
font.setPointSize( TomahawkUtils::defaultFontSize() - 2 );
|
font.setPointSize( TomahawkUtils::defaultFontSize() - 2 );
|
||||||
|
|
||||||
|
m_defaultSourceIcon = QPixmap( RESPATH "images/resolver-default.png" );
|
||||||
|
|
||||||
ui->prevButton->setPixmap( RESPATH "images/back-rest.png" );
|
ui->prevButton->setPixmap( RESPATH "images/back-rest.png" );
|
||||||
ui->prevButton->setPixmap( RESPATH "images/back-pressed.png", QIcon::Off, QIcon::Active );
|
ui->prevButton->setPixmap( RESPATH "images/back-pressed.png", QIcon::Off, QIcon::Active );
|
||||||
ui->playPauseButton->setPixmap( RESPATH "images/play-rest.png" );
|
ui->playPauseButton->setPixmap( RESPATH "images/play-rest.png" );
|
||||||
@@ -87,7 +89,7 @@ AudioControls::AudioControls( QWidget* parent )
|
|||||||
ui->socialButton->setPixmap( RESPATH "images/share.png" );
|
ui->socialButton->setPixmap( RESPATH "images/share.png" );
|
||||||
ui->loveButton->setPixmap( RESPATH "images/not-loved.png" );
|
ui->loveButton->setPixmap( RESPATH "images/not-loved.png" );
|
||||||
ui->loveButton->setCheckable( true );
|
ui->loveButton->setCheckable( true );
|
||||||
ui->ownerButton->setPixmap( RESPATH "images/resolver-default.png" );
|
ui->ownerButton->setPixmap( m_defaultSourceIcon );
|
||||||
|
|
||||||
ui->socialButton->setFixedSize( QSize( 20, 20 ) );
|
ui->socialButton->setFixedSize( QSize( 20, 20 ) );
|
||||||
ui->loveButton->setFixedSize( QSize( 20, 20 ) );
|
ui->loveButton->setFixedSize( QSize( 20, 20 ) );
|
||||||
@@ -261,8 +263,16 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
|
|||||||
ui->socialButton->setToolTip( tr( "Share" ) );
|
ui->socialButton->setToolTip( tr( "Share" ) );
|
||||||
ui->loveButton->setToolTip( tr( "Love" ) );
|
ui->loveButton->setToolTip( tr( "Love" ) );
|
||||||
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 );
|
if ( !sourceIcon.isNull() )
|
||||||
|
ui->ownerButton->setPixmap( sourceIcon );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->ownerButton->clear();
|
||||||
|
ui->ownerButton->setPixmap( m_defaultSourceIcon );
|
||||||
|
}
|
||||||
|
|
||||||
if ( QUrl( result->linkUrl() ).isValid() || !result->collection().isNull() )
|
if ( QUrl( result->linkUrl() ).isValid() || !result->collection().isNull() )
|
||||||
ui->ownerButton->setCursor( Qt::PointingHandCursor );
|
ui->ownerButton->setCursor( Qt::PointingHandCursor );
|
||||||
else
|
else
|
||||||
@@ -366,7 +376,7 @@ AudioControls::onPlaybackStopped()
|
|||||||
m_sliderTimeLine.stop();
|
m_sliderTimeLine.stop();
|
||||||
m_sliderTimeLine.setCurrentTime( 0 );
|
m_sliderTimeLine.setCurrentTime( 0 );
|
||||||
m_phononTickCheckTimer.stop();
|
m_phononTickCheckTimer.stop();
|
||||||
ui->ownerButton->setPixmap( RESPATH "images/resolver-default.png" );
|
ui->ownerButton->setPixmap( m_defaultSourceIcon );
|
||||||
|
|
||||||
ui->stackedLayout->setCurrentWidget( ui->playPauseButton );
|
ui->stackedLayout->setCurrentWidget( ui->playPauseButton );
|
||||||
ui->loveButton->setEnabled( false );
|
ui->loveButton->setEnabled( false );
|
||||||
|
@@ -93,13 +93,15 @@ private:
|
|||||||
void setSocialActions();
|
void setSocialActions();
|
||||||
|
|
||||||
Ui::AudioControls* ui;
|
Ui::AudioControls* ui;
|
||||||
|
|
||||||
QWeakPointer<SocialWidget> m_socialWidget;
|
QWeakPointer<SocialWidget> m_socialWidget;
|
||||||
|
|
||||||
Tomahawk::result_ptr m_currentTrack;
|
Tomahawk::result_ptr m_currentTrack;
|
||||||
Tomahawk::PlaylistModes::RepeatMode m_repeatMode;
|
Tomahawk::PlaylistModes::RepeatMode m_repeatMode;
|
||||||
bool m_shuffled;
|
bool m_shuffled;
|
||||||
|
|
||||||
|
QPixmap m_defaultSourceIcon;
|
||||||
|
|
||||||
QTimer m_phononTickCheckTimer;
|
QTimer m_phononTickCheckTimer;
|
||||||
QTimeLine m_sliderTimeLine;
|
QTimeLine m_sliderTimeLine;
|
||||||
bool m_seeked;
|
bool m_seeked;
|
||||||
|
@@ -72,6 +72,12 @@ ImageButton::setPixmap( const QPixmap& pixmap )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ImageButton::clear()
|
||||||
|
{
|
||||||
|
setIcon( QIcon() );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ImageButton::paintEvent( QPaintEvent* event )
|
ImageButton::paintEvent( QPaintEvent* event )
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
@@ -35,18 +35,20 @@ public:
|
|||||||
explicit ImageButton( QWidget* parent = 0 );
|
explicit ImageButton( QWidget* parent = 0 );
|
||||||
explicit ImageButton( const QPixmap& pixmap, QWidget* parent = 0 );
|
explicit ImageButton( const QPixmap& pixmap, QWidget* parent = 0 );
|
||||||
explicit ImageButton( const QString& path, QWidget* parent = 0 );
|
explicit ImageButton( const QString& path, QWidget* parent = 0 );
|
||||||
|
|
||||||
void setPixmap( const QString& path );
|
void setPixmap( const QString& path );
|
||||||
void setPixmap( const QPixmap& pixmap );
|
void setPixmap( const QPixmap& pixmap );
|
||||||
|
|
||||||
void setPixmap( const QString&, const QIcon::State, QIcon::Mode = QIcon::Normal );
|
void setPixmap( const QString&, const QIcon::State, QIcon::Mode = QIcon::Normal );
|
||||||
void setPixmap( const QPixmap&, const QIcon::State, QIcon::Mode = QIcon::Normal );
|
void setPixmap( const QPixmap&, const QIcon::State, QIcon::Mode = QIcon::Normal );
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
virtual QSize sizeHint() const { return m_sizeHint; }
|
virtual QSize sizeHint() const { return m_sizeHint; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent( QPaintEvent* event );
|
virtual void paintEvent( QPaintEvent* event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init( const QPixmap& );
|
void init( const QPixmap& );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user