1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-13 12:31:52 +02:00

* Wordwrap caption in header when needed. Fixed balance spaer.

This commit is contained in:
Christian Muehlhaeuser 2014-09-05 07:04:36 +02:00
parent 0068a078c4
commit c2be5c8bfb
5 changed files with 16 additions and 4 deletions

View File

@ -50,6 +50,7 @@ BasicHeader::BasicHeader( QWidget* parent )
ui->captionLabel->setFont( f );
ui->captionLabel->setPalette( p );
ui->captionLabel->setWordWrap( true );
ui->iconLabel->hide();
@ -87,6 +88,7 @@ void
BasicHeader::setCaption( const QString& s )
{
ui->captionLabel->setText( s.toUpper() );
resizeEvent( 0 );
}
@ -112,3 +114,11 @@ BasicHeader::setPixmap( const QPixmap& pixmap, bool tinted )
if ( !p.isNull() )
ui->iconLabel->show();
}
void
BasicHeader::resizeEvent( QResizeEvent* /* event */)
{
ui->captionLabel->setFixedWidth( width() * 0.33 );
ui->balanceSpacer->changeSize( ui->captionLabel->width(), 1, QSizePolicy::Expanding, QSizePolicy::Fixed );
}

View File

@ -43,6 +43,9 @@ public slots:
virtual void setCaption( const QString& s );
virtual void setDescription( const QString& s );
virtual void setPixmap( const QPixmap& p, bool tinted = true );
protected:
virtual void resizeEvent( QResizeEvent* event );
};
#endif // BASICHEADER_H

View File

@ -234,7 +234,7 @@ SearchWidget::SearchWidget( const QString& search, QWidget* parent )
m_resultsModel->startLoading();
m_queries << Tomahawk::Query::get( search, uuid() );
headerWidget->ui->captionLabel->setText( title().toUpper() );
headerWidget->setCaption( title() );
foreach ( const Tomahawk::query_ptr& query, m_queries )
{

View File

@ -149,7 +149,7 @@ AlbumInfoWidget::load( const album_ptr& album )
connect( m_album.data(), SIGNAL( updated() ), SLOT( onAlbumImageUpdated() ) );
m_headerWidget->ui->captionLabel->setText( album->artist()->name().toUpper() );
m_headerWidget->setCaption( album->artist()->name() );
m_tracksModel->startLoading();
m_tracksModel->addTracks( album, QModelIndex(), true );

View File

@ -309,8 +309,7 @@ ArtistInfoWidget::load( const artist_ptr& artist )
m_artist = artist;
m_title = artist->name();
m_headerWidget->ui->captionLabel->setText( artist->name().toUpper() );
m_headerWidget->ui->balanceSpacer->changeSize( m_headerWidget->ui->captionLabel->sizeHint().width(), 1, QSizePolicy::Fixed, QSizePolicy::Fixed );
m_headerWidget->setCaption( artist->name() );
connect( m_artist.data(), SIGNAL( biographyLoaded() ), SLOT( onBiographyLoaded() ) );
connect( m_artist.data(), SIGNAL( similarArtistsLoaded() ), SLOT( onSimilarArtistsLoaded() ) );