1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 05:37:29 +02:00

* Work on artist page. Better layout / design?

This commit is contained in:
Christian Muehlhaeuser
2013-06-07 08:58:47 +02:00
parent 3c0f65c6fa
commit 3383a93e4b
3 changed files with 177 additions and 123 deletions

View File

@@ -36,7 +36,9 @@
#include "Source.h" #include "Source.h"
#include "GlobalActionManager.h" #include "GlobalActionManager.h"
#include "Pipeline.h" #include "Pipeline.h"
#include "SourceList.h"
#include "MetaPlaylistInterface.h" #include "MetaPlaylistInterface.h"
#include "widgets/StatsGauge.h"
#include "utils/TomahawkStyle.h" #include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
@@ -52,11 +54,8 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
QWidget* widget = new QWidget; QWidget* widget = new QWidget;
ui->setupUi( widget ); ui->setupUi( widget );
QPalette pal = palette(); artist->loadStats();
pal.setColor( QPalette::Window, TomahawkStyle::PAGE_BACKGROUND ); connect( artist.data(), SIGNAL( statsLoaded() ), SLOT( onArtistStatsLoaded() ) );
widget->setPalette( pal );
widget->setAutoFillBackground( true );
/* TomahawkUtils::unmarginLayout( ui->layoutWidget->layout() ); /* TomahawkUtils::unmarginLayout( ui->layoutWidget->layout() );
TomahawkUtils::unmarginLayout( ui->layoutWidget1->layout() ); TomahawkUtils::unmarginLayout( ui->layoutWidget1->layout() );
@@ -82,10 +81,10 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
AlbumItemDelegate* del = new AlbumItemDelegate( ui->topHits, ui->topHits->proxyModel() ); AlbumItemDelegate* del = new AlbumItemDelegate( ui->topHits, ui->topHits->proxyModel() );
ui->topHits->setPlaylistItemDelegate( del ); ui->topHits->setPlaylistItemDelegate( del );
ui->relatedArtists->setAutoFitItems( false ); /* ui->relatedArtists->setAutoFitItems( true );
ui->relatedArtists->setWrapping( false ); ui->relatedArtists->setWrapping( false );
ui->relatedArtists->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); ui->relatedArtists->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
ui->relatedArtists->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded ); ui->relatedArtists->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );*/
ui->relatedArtists->delegate()->setItemSize( QSize( 170, 170 ) ); ui->relatedArtists->delegate()->setItemSize( QSize( 170, 170 ) );
ui->albums->setAutoFitItems( false ); ui->albums->setAutoFitItems( false );
@@ -95,15 +94,32 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
ui->albums->delegate()->setItemSize( QSize( 170, 170 ) ); ui->albums->delegate()->setItemSize( QSize( 170, 170 ) );
ui->albums->proxyModel()->setHideDupeItems( true ); ui->albums->proxyModel()->setHideDupeItems( true );
ui->topHits->setFrameShape( QFrame::StyledPanel ); QPalette trackViewPal = ui->topHits->palette();
trackViewPal.setColor( QPalette::Foreground, Qt::white );
trackViewPal.setColor( QPalette::Text, Qt::white );
trackViewPal.setColor( QPalette::Highlight, QColor( "#252020" ) );
trackViewPal.setColor( QPalette::HighlightedText, Qt::white );
ui->topHits->setPalette( trackViewPal );
ui->topHits->setAlternatingRowColors( false );
ui->topHits->setFrameShape( QFrame::NoFrame );
ui->topHits->setAttribute( Qt::WA_MacShowFocusRect, 0 ); ui->topHits->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QHBoxLayout* l = new QHBoxLayout( ui->statsWidget );
m_playStatsGauge = new StatsGauge( ui->statsWidget );
m_playStatsGauge->setText( tr( "CHART #" ) );
l->addSpacerItem( new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) );
l->addWidget( m_playStatsGauge );
l->addSpacerItem( new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) );
ui->statsWidget->setLayout( l );
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Original, QSize( 48, 48 ) ); m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Original, QSize( 48, 48 ) );
ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Grid, ui->cover->size() ) ); ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Grid, ui->cover->size() ) );
ui->cover->setShowText( true ); ui->cover->setShowText( true );
QFont f = font(); QFont f = font();
f.setPointSize( f.pointSize() + 1 ); f.setPointSize( f.pointSize() + 3 );
ui->biography->setOpenLinks( false ); ui->biography->setOpenLinks( false );
ui->biography->setOpenExternalLinks( true ); ui->biography->setOpenExternalLinks( true );
ui->biography->setFrameShape( QFrame::NoFrame ); ui->biography->setFrameShape( QFrame::NoFrame );
@@ -125,7 +141,10 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget ); area->setWidget( widget );
area->setStyleSheet( "QScrollArea { background-color: #454e59; }" ); QPalette pal = palette();
pal.setBrush( backgroundRole(), QColor( "#1e1e1e" ) ); //QBrush( QImage( ":/data/images/grey_wash_wall.png" ) ) );
area->setPalette( pal );
area->setAutoFillBackground( true );
area->setFrameShape( QFrame::NoFrame ); area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 ); area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
@@ -152,7 +171,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
"border-image: url(" RESPATH "images/widget-border.png) 3 3 3 3 stretch stretch;" "border-image: url(" RESPATH "images/widget-border.png) 3 3 3 3 stretch stretch;"
"border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" ); "border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" );
// ui->topHits->setStyleSheet( "QTreeView#topHits { background-color: transparent; }" ); ui->topHits->setStyleSheet( "QTreeView#topHits { background-color: transparent; }" );
ui->trackFrame->setStyleSheet( "QFrame#trackFrame { background-color: transparent; }" ui->trackFrame->setStyleSheet( "QFrame#trackFrame { background-color: transparent; }"
"QFrame#trackFrame { " "QFrame#trackFrame { "
"border-image: url(" RESPATH "images/widget-border.png) 3 3 3 3 stretch stretch;" "border-image: url(" RESPATH "images/widget-border.png) 3 3 3 3 stretch stretch;"
@@ -309,6 +328,17 @@ ArtistInfoWidget::onBiographyLoaded()
} }
void
ArtistInfoWidget::onArtistStatsLoaded()
{
/* m_playStatsGauge->setValue( m_artist->playbackCount( SourceList::instance()->getLocal() ) );
m_playStatsGauge->setMaximum( SourceList::instance()->getLocal()->playbackCount() ); */
m_playStatsGauge->setMaximum( m_artist->chartCount() );
m_playStatsGauge->setValue( m_artist->chartPosition() );
}
void void
ArtistInfoWidget::onArtistImageUpdated() ArtistInfoWidget::onArtistImageUpdated()
{ {

View File

@@ -40,6 +40,7 @@
class PlayableModel; class PlayableModel;
class PlaylistModel; class PlaylistModel;
class StatsGauge;
namespace Ui namespace Ui
{ {
@@ -91,6 +92,7 @@ protected:
void changeEvent( QEvent* e ); void changeEvent( QEvent* e );
private slots: private slots:
void onArtistStatsLoaded();
void onArtistImageUpdated(); void onArtistImageUpdated();
void onBiographyLoaded(); void onBiographyLoaded();
@@ -110,6 +112,8 @@ private:
PlaylistModel* m_topHitsModel; PlaylistModel* m_topHitsModel;
Tomahawk::playlistinterface_ptr m_plInterface; Tomahawk::playlistinterface_ptr m_plInterface;
StatsGauge* m_playStatsGauge;
QString m_title; QString m_title;
QString m_description; QString m_description;
QString m_longDescription; QString m_longDescription;

View File

@@ -13,7 +13,7 @@
<property name="windowTitle"> <property name="windowTitle">
<string notr="true" extracomment="not translatable because not shown to the user">Form</string> <string notr="true" extracomment="not translatable because not shown to the user">Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,1"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing"> <property name="spacing">
<number>16</number> <number>16</number>
</property> </property>
@@ -69,64 +69,145 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QWidget" name="statsWidget" native="true">
<property name="minimumSize">
<size>
<width>220</width>
<height>240</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QFrame" name="trackFrame"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="frameShape"> <item>
<enum>QFrame::StyledPanel</enum> <widget class="QFrame" name="trackFrame">
</property> <property name="frameShape">
<property name="frameShadow"> <enum>QFrame::StyledPanel</enum>
<enum>QFrame::Raised</enum> </property>
</property> <property name="frameShadow">
<layout class="QVBoxLayout" name="verticalLayout_6"> <enum>QFrame::Raised</enum>
<property name="spacing"> </property>
<number>4</number> <layout class="QVBoxLayout" name="verticalLayout_6">
</property> <property name="spacing">
<property name="leftMargin"> <number>4</number>
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>8</number>
</property>
<property name="bottomMargin">
<number>8</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property> </property>
<property name="text"> <property name="leftMargin">
<string>Top Hits</string> <number>8</number>
</property> </property>
<property name="margin"> <property name="topMargin">
<number>0</number> <number>4</number>
</property> </property>
</widget> <property name="rightMargin">
</item> <number>8</number>
<item>
<widget class="PlaylistView" name="topHits">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="headerHidden"> <property name="bottomMargin">
<bool>true</bool> <number>8</number>
</property> </property>
</widget> <item>
</item> <widget class="QLabel" name="label">
</layout> <property name="font">
</widget> <font>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Top Hits</string>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="PlaylistView" name="topHits">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="artistFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing">
<number>4</number>
</property>
<property name="leftMargin">
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>8</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Arial</family>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Related Artists</string>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="GridView" name="relatedArtists">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>190</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QFrame" name="albumFrame"> <widget class="QFrame" name="albumFrame">
@@ -189,67 +270,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QFrame" name="artistFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing">
<number>4</number>
</property>
<property name="leftMargin">
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>8</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Arial</family>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Related Artists</string>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="GridView" name="relatedArtists">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>190</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">