1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-16 19:14:06 +02: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 ) PlayableCover::PlayableCover( QWidget* parent )
: QLabel( parent ) : QLabel( parent )
, m_showText( false ) , m_showText( false )
, m_showControls( true )
{ {
setMouseTracking( true ); setMouseTracking( true );
@@ -67,7 +68,8 @@ PlayableCover::enterEvent( QEvent* event )
{ {
QLabel::enterEvent( event ); QLabel::enterEvent( event );
m_button->show(); if ( m_showControls )
m_button->show();
} }
@@ -204,7 +206,7 @@ PlayableCover::contextMenuEvent( QContextMenuEvent* event )
void void
PlayableCover::setPixmap( const QPixmap& pixmap ) PlayableCover::setPixmap( const QPixmap& pixmap )
{ {
m_pixmap = TomahawkUtils::createRoundedImage( pixmap, size() ); m_pixmap = pixmap; // TomahawkUtils::createRoundedImage( pixmap, size() );
repaint(); repaint();
} }
@@ -386,3 +388,10 @@ void PlayableCover::setShowText( bool b )
m_showText = b; m_showText = b;
repaint(); repaint();
} }
void PlayableCover::setShowControls( bool b )
{
m_showControls = b;
repaint();
}

View File

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