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

* New artist page. Tweaks, shadows etc. coming.

This commit is contained in:
Christian Muehlhaeuser 2012-06-13 08:48:38 +02:00
parent 0bb74d949f
commit 9935aca127
3 changed files with 217 additions and 85 deletions

View File

@ -21,6 +21,8 @@
#include "ArtistInfoWidget_p.h"
#include "ui_ArtistInfoWidget.h"
#include <QScrollArea>
#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() ) );
}

View File

@ -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;

View File

@ -6,84 +6,180 @@
<rect>
<x>0</x>
<y>0</y>
<width>902</width>
<height>696</height>
<width>965</width>
<height>812</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QSplitter" name="splitter_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>16</number>
</property>
<property name="handleWidth">
<number>1</number>
<property name="topMargin">
<number>12</number>
</property>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="handleWidth">
<number>1</number>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="HeaderLabel" name="label">
<property name="text">
<string>Top Hits</string>
</property>
</widget>
</item>
<item>
<widget class="PlaylistView" name="topHits">
<property name="headerHidden">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget1">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="HeaderLabel" name="label_2">
<property name="text">
<string>Related Artists</string>
</property>
</widget>
</item>
<item>
<widget class="GridView" name="relatedArtists">
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget2">
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="rightMargin">
<number>16</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="HeaderWidget" name="albumHeader" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="HeaderLabel" name="label_3">
<property name="text">
<string>Albums</string>
</property>
</widget>
</item>
</layout>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>20</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="GridView" name="albums"/>
<widget class="PlaylistView" name="topHits">
<property name="minimumSize">
<size>
<width>0</width>
<height>300</height>
</size>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Arial</family>
<pointsize>20</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>
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<family>Arial</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Albums</string>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="GridView" name="albums">
<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>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>16</number>
</property>
<item>
<widget class="QLabel" name="cover">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>220</width>
<height>220</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="biography">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>240</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
@ -93,21 +189,6 @@
<extends>QTreeView</extends>
<header>playlist/PlaylistView.h</header>
</customwidget>
<customwidget>
<class>HeaderLabel</class>
<extends>QLabel</extends>
<header location="global">widgets/HeaderLabel.h</header>
</customwidget>
<customwidget>
<class>HeaderWidget</class>
<extends>QWidget</extends>
<header location="global">widgets/HeaderWidget.h</header>
</customwidget>
<customwidget>
<class>ToggleButton</class>
<extends>QPushButton</extends>
<header location="global">widgets/ToggleButton.h</header>
</customwidget>
<customwidget>
<class>GridView</class>
<extends>QListView</extends>