1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

* Make sure image on artist-page doesn't get squashed and reacts to resize events.

This commit is contained in:
Christian Muehlhaeuser 2014-10-02 18:00:53 +02:00
parent 5ce643850b
commit b09089773c
3 changed files with 42 additions and 8 deletions

View File

@ -60,9 +60,6 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
m_headerWidget = new BasicHeader;
ui->setupUi( m_widget );
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Original, scaled( QSize( 48, 48 ) ) );
ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Grid, ui->cover->size() ) );
{
ui->relatedArtists->setAutoResize( true );
ui->relatedArtists->setAutoFitItems( true );
@ -95,7 +92,6 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
ui->albums->proxyModel()->sort( -1 );
ui->albums->setEmptyTip( tr( "Sorry, we could not find any albums for this artist!" ) );
ui->albums->setStyleSheet( QString( "QListView { background-color: white; }" ) );
TomahawkStyle::stylePageFrame( ui->albumFrame );
TomahawkStyle::styleScrollBar( ui->albums->verticalScrollBar() );
TomahawkStyle::styleScrollBar( ui->albums->horizontalScrollBar() );
@ -116,7 +112,6 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
ui->topHits->proxyModel()->sort( -1 );
ui->topHits->setEmptyTip( tr( "Sorry, we could not find any top hits for this artist!" ) );
ui->topHits->setStyleSheet( QString( "QListView { background-color: white; }" ) );
TomahawkStyle::stylePageFrame( ui->trackFrame );
}
@ -238,9 +233,11 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
m_plInterface = playlistinterface_ptr( mpl );
onSliderValueChanged( 0 );
load( artist );
TomahawkUtils::fixMargins( this );
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Original, scaled( QSize( 48, 48 ) ) );
load( artist );
}
@ -559,3 +556,22 @@ ArtistInfoWidget::eventFilter( QObject* obj, QEvent* event )
else
return QObject::eventFilter( obj, event );
}
void
ArtistInfoWidget::resizeEvent( QResizeEvent* event )
{
QWidget::resizeEvent( event );
const QSize coverSize = QSize( ui->cover->width(), ui->cover->width() );
if ( !m_artist || m_artist->cover( QSize( 0, 0 ) ).isNull() )
{
ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Grid, coverSize ) );
}
else
{
ui->cover->setPixmap( m_artist->cover( coverSize ) );
}
ui->biography->setFixedHeight( ui->cover->width() );
}

View File

@ -92,6 +92,7 @@ signals:
void pixmapChanged( const QPixmap& pixmap );
protected:
void resizeEvent( QResizeEvent* event );
void changeEvent( QEvent* e );
bool eventFilter( QObject* obj, QEvent* event );

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>796</width>
<height>1132</height>
<height>1455</height>
</rect>
</property>
<property name="windowTitle">
@ -210,14 +210,26 @@
<item>
<widget class="QLabel" name="cover">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>192</width>
<height>192</height>
</size>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
</widget>
</item>
</layout>
@ -281,6 +293,11 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
<customwidget>
<class>ClickableLabel</class>
<extends>QLabel</extends>