From 9935aca12734997b072f0a774fadd060e316b903 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 13 Jun 2012 08:48:38 +0200 Subject: [PATCH] * New artist page. Tweaks, shadows etc. coming. --- .../widgets/infowidgets/ArtistInfoWidget.cpp | 62 ++++- .../widgets/infowidgets/ArtistInfoWidget.h | 1 + .../widgets/infowidgets/ArtistInfoWidget.ui | 239 ++++++++++++------ 3 files changed, 217 insertions(+), 85 deletions(-) diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp index 8bbcda7bb..72519dd2b 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp @@ -21,6 +21,8 @@ #include "ArtistInfoWidget_p.h" #include "ui_ArtistInfoWidget.h" +#include + #include "audio/AudioEngine.h" #include "playlist/PlayableModel.h" #include "playlist/TreeModel.h" @@ -31,12 +33,11 @@ #include "database/DatabaseCommand_AllTracks.h" #include "database/DatabaseCommand_AllAlbums.h" +#include "Pipeline.h" #include "utils/StyleHelper.h" #include "utils/TomahawkUtilsGui.h" #include "utils/Logger.h" -#include "Pipeline.h" - using namespace Tomahawk; @@ -45,15 +46,15 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* , ui( new Ui::ArtistInfoWidget ) , m_artist( artist ) { - ui->setupUi( this ); + QWidget* widget = new QWidget; + ui->setupUi( widget ); m_plInterface = Tomahawk::playlistinterface_ptr( new MetaPlaylistInterface( this ) ); - TomahawkUtils::unmarginLayout( layout() ); - TomahawkUtils::unmarginLayout( ui->layoutWidget->layout() ); +/* TomahawkUtils::unmarginLayout( ui->layoutWidget->layout() ); TomahawkUtils::unmarginLayout( ui->layoutWidget1->layout() ); TomahawkUtils::unmarginLayout( ui->layoutWidget2->layout() ); - TomahawkUtils::unmarginLayout( ui->albumHeader->layout() ); + TomahawkUtils::unmarginLayout( ui->albumHeader->layout() );*/ m_albumsModel = new PlayableModel( ui->albums ); ui->albums->setPlayableModel( m_albumsModel ); @@ -70,11 +71,56 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* ui->topHits->setSortingEnabled( false ); ui->topHits->setEmptyTip( tr( "Sorry, we could not find any top hits for this artist!" ) ); + ui->relatedArtists->setAutoFitItems( false ); + ui->relatedArtists->setWrapping( false ); + ui->relatedArtists->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); + ui->relatedArtists->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded ); + m_relatedModel->setItemSize( QSize( 170, 170 ) ); + ui->albums->setAutoFitItems( false ); + ui->albums->setWrapping( false ); + ui->albums->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); + ui->albums->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded ); + m_albumsModel->setItemSize( QSize( 170, 170 ) ); + + ui->topHits->setFrameShape( QFrame::StyledPanel ); + ui->topHits->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( 48, 48 ) ); + ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( ui->cover->sizeHint() ) ) ); connect( m_albumsModel, SIGNAL( loadingStarted() ), SLOT( onLoadingStarted() ) ); connect( m_albumsModel, SIGNAL( loadingFinished() ), SLOT( onLoadingFinished() ) ); + ui->biography->setStyleSheet( "QTextBrowser#biography { background-color: transparent; }" ); + ui->biography->setFrameShape( QFrame::NoFrame ); + ui->biography->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + + QPalette p = ui->biography->palette(); + p.setColor( QPalette::Foreground, Qt::white ); + p.setColor( QPalette::Text, Qt::white ); + + ui->biography->setPalette( p ); + ui->label->setPalette( p ); + ui->label_2->setPalette( p ); + ui->label_3->setPalette( p ); + + ui->label->setContentsMargins( 0, 0, 0, 0 ); + ui->label_2->setContentsMargins( 0, 16, 0, 0 ); + ui->label_3->setContentsMargins( 0, 16, 0, 0 ); + + QScrollArea* area = new QScrollArea(); + area->setWidgetResizable( true ); + area->setWidget( widget ); + + area->setStyleSheet( "QScrollArea { background-color: #323435; }" ); + area->setFrameShape( QFrame::NoFrame ); + area->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + + QVBoxLayout* layout = new QVBoxLayout(); + layout->addWidget( area ); + setLayout( layout ); + TomahawkUtils::unmarginLayout( layout ); + load( artist ); } @@ -207,6 +253,8 @@ ArtistInfoWidget::onBiographyLoaded() { m_longDescription = m_artist->biography(); emit longDescriptionChanged( m_longDescription ); + + ui->biography->setHtml( m_artist->biography() ); } @@ -218,6 +266,8 @@ ArtistInfoWidget::onArtistImageUpdated() m_pixmap = m_artist->cover( QSize( 0, 0 ) ); emit pixmapChanged( m_pixmap ); + + ui->cover->setPixmap( m_artist->cover( ui->cover->sizeHint() ) ); } diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h index 6c00ab0f2..9e1ac0279 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h @@ -76,6 +76,7 @@ public: virtual bool isTemporaryPage() const { return true; } virtual bool showStatsBar() const { return false; } + virtual bool showInfoBar() const { return false; } virtual bool jumpToCurrentTrack(); virtual bool isBeingPlayed() const; diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui index 246a3e593..ee1003bb8 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui @@ -6,84 +6,180 @@ 0 0 - 902 - 696 + 965 + 812 Form - + - - - Qt::Vertical + + + 16 - - 1 + + 12 - - - Qt::Horizontal - - - 1 - - - - - - - Top Hits - - - - - - - true - - - - - - - - - - - Related Artists - - - - - - - - - - - - + + 16 + + + - - - - - - Albums - - - - + + + + 20 + 75 + true + + + + Top Hits + + + 0 + - + + + + 0 + 300 + + + + true + + + + + + + + Arial + 20 + 75 + true + + + + Related Artists + + + 0 + + + + + + + + 0 + 0 + + + + + 0 + 190 + + + + + + + + + Arial + 20 + 75 + true + true + + + + Albums + + + 0 + + + + + + + + 0 + 0 + + + + + 0 + 190 + + + - - + + + + + 16 + + + + + + 0 + 0 + + + + + 220 + 220 + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 240 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + @@ -93,21 +189,6 @@ QTreeView
playlist/PlaylistView.h
- - HeaderLabel - QLabel -
widgets/HeaderLabel.h
-
- - HeaderWidget - QWidget -
widgets/HeaderWidget.h
-
- - ToggleButton - QPushButton -
widgets/ToggleButton.h
-
GridView QListView