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:
@@ -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();
|
||||||
|
}
|
||||||
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user