1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-13 20:39:57 +01:00

* PlayableCover can now be used with and without labels & controls.

This commit is contained in:
Christian Muehlhaeuser 2014-08-13 00:56:44 +02:00
parent e21be6a4c3
commit 573fbc8fc4
2 changed files with 15 additions and 4 deletions

View File

@ -38,6 +38,7 @@ using namespace Tomahawk;
PlayableCover::PlayableCover( QWidget* parent )
: QLabel( parent )
, m_showText( false )
, m_showControls( true )
{
setMouseTracking( true );
@ -67,7 +68,8 @@ PlayableCover::enterEvent( QEvent* event )
{
QLabel::enterEvent( event );
m_button->show();
if ( m_showControls )
m_button->show();
}
@ -204,7 +206,7 @@ PlayableCover::contextMenuEvent( QContextMenuEvent* event )
void
PlayableCover::setPixmap( const QPixmap& pixmap )
{
m_pixmap = TomahawkUtils::createRoundedImage( pixmap, size() );
m_pixmap = pixmap; // TomahawkUtils::createRoundedImage( pixmap, size() );
repaint();
}
@ -386,3 +388,10 @@ void PlayableCover::setShowText( bool b )
m_showText = b;
repaint();
}
void PlayableCover::setShowControls( bool b )
{
m_showControls = b;
repaint();
}

View File

@ -47,7 +47,6 @@ public:
virtual ~PlayableCover();
bool showText() const { return m_showText; }
void setShowText( bool b );
QPixmap pixmap() const { return m_pixmap; }
@ -56,6 +55,8 @@ public slots:
virtual void setAlbum( const Tomahawk::album_ptr& album );
virtual void setQuery( const Tomahawk::query_ptr& query );
void setShowText( bool b );
void setShowControls( bool b );
void setPixmap( const QPixmap& pixmap );
protected:
@ -67,7 +68,7 @@ protected:
virtual void mouseReleaseEvent( QMouseEvent* event );
virtual void contextMenuEvent( QContextMenuEvent* event );
void leaveEvent( QEvent* event );
void enterEvent( QEvent* event );
@ -90,6 +91,7 @@ private:
QRect m_hoveredRect;
bool m_showText;
bool m_showControls;
};
#endif