1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 03:40:16 +02:00

* Auto resize OverlayButton and adjust helper texts.

This commit is contained in:
Christian Muehlhaeuser
2011-10-19 03:13:45 +02:00
parent b32b84f8c7
commit d3d29acf09
3 changed files with 10 additions and 3 deletions

View File

@@ -26,6 +26,7 @@
#include "utils/tomahawkutils.h" #include "utils/tomahawkutils.h"
#include "utils/logger.h" #include "utils/logger.h"
DatabaseCommand_AllAlbums::DatabaseCommand_AllAlbums( const Tomahawk::collection_ptr &collection, const Tomahawk::artist_ptr &artist, QObject *parent ) DatabaseCommand_AllAlbums::DatabaseCommand_AllAlbums( const Tomahawk::collection_ptr &collection, const Tomahawk::artist_ptr &artist, QObject *parent )
: DatabaseCommand( parent ) : DatabaseCommand( parent )
, m_collection( collection ) , m_collection( collection )
@@ -35,15 +36,18 @@ DatabaseCommand_AllAlbums::DatabaseCommand_AllAlbums( const Tomahawk::collection
, m_sortDescending( false ) , m_sortDescending( false )
{} {}
DatabaseCommand_AllAlbums::~DatabaseCommand_AllAlbums() DatabaseCommand_AllAlbums::~DatabaseCommand_AllAlbums()
{} {}
void void
DatabaseCommand_AllAlbums::setArtist( const Tomahawk::artist_ptr &artist ) DatabaseCommand_AllAlbums::setArtist( const Tomahawk::artist_ptr &artist )
{ {
m_artist = artist; m_artist = artist;
} }
void void
DatabaseCommand_AllAlbums::execForArtist( DatabaseImpl* dbi ) DatabaseCommand_AllAlbums::execForArtist( DatabaseImpl* dbi )
{ {

View File

@@ -34,7 +34,7 @@ OverlayButton::OverlayButton( QWidget* parent )
, m_opacity( 0.0 ) , m_opacity( 0.0 )
, m_parent( parent ) , m_parent( parent )
{ {
resize( 160, 26 ); resize( 0, 26 );
setAttribute( Qt::WA_TranslucentBackground, true ); setAttribute( Qt::WA_TranslucentBackground, true );
setOpacity( m_opacity ); setOpacity( m_opacity );
@@ -77,6 +77,9 @@ void
OverlayButton::setText( const QString& text ) OverlayButton::setText( const QString& text )
{ {
m_text = text; m_text = text;
QFontMetrics fm( font() );
resize( fm.width( text ) + 16, height() );
} }

View File

@@ -64,7 +64,7 @@ AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* par
m_pixmap = QPixmap( RESPATH "images/no-album-art-placeholder.png" ).scaledToWidth( 48, Qt::SmoothTransformation ); m_pixmap = QPixmap( RESPATH "images/no-album-art-placeholder.png" ).scaledToWidth( 48, Qt::SmoothTransformation );
m_button = new OverlayButton( ui->tracksView ); m_button = new OverlayButton( ui->tracksView );
m_button->setText( tr( "Click to show All Tracks" ) ); m_button->setText( tr( "Click to show Super Collection Tracks" ) );
m_button->setCheckable( true ); m_button->setCheckable( true );
m_button->setChecked( true ); m_button->setChecked( true );
@@ -96,7 +96,7 @@ AlbumInfoWidget::onModeToggle()
m_tracksModel->addTracks( m_album, QModelIndex() ); m_tracksModel->addTracks( m_album, QModelIndex() );
if ( m_button->isChecked() ) if ( m_button->isChecked() )
m_button->setText( tr( "Click to show All Tracks" ) ); m_button->setText( tr( "Click to show Super Collection Tracks" ) );
else else
m_button->setText( tr( "Click to show Official Tracks" ) ); m_button->setText( tr( "Click to show Official Tracks" ) );
} }