1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 20:00:13 +02:00

* WIP: New artist page.

This commit is contained in:
Christian Muehlhaeuser
2012-12-09 06:44:02 +01:00
parent 14676071b9
commit 473ec61eda
3 changed files with 132 additions and 12 deletions

View File

@@ -30,11 +30,10 @@
#include "playlist/TreeModel.h" #include "playlist/TreeModel.h"
#include "playlist/PlaylistModel.h" #include "playlist/PlaylistModel.h"
#include "playlist/TreeProxyModel.h" #include "playlist/TreeProxyModel.h"
#include "Source.h"
#include "database/DatabaseCommand_AllTracks.h" #include "database/DatabaseCommand_AllTracks.h"
#include "database/DatabaseCommand_AllAlbums.h" #include "database/DatabaseCommand_AllAlbums.h"
#include "Source.h"
#include "GlobalActionManager.h"
#include "Pipeline.h" #include "Pipeline.h"
#include "utils/StyleHelper.h" #include "utils/StyleHelper.h"
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
@@ -64,6 +63,10 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
TomahawkUtils::unmarginLayout( ui->layoutWidget2->layout() ); TomahawkUtils::unmarginLayout( ui->layoutWidget2->layout() );
TomahawkUtils::unmarginLayout( ui->albumHeader->layout() );*/ TomahawkUtils::unmarginLayout( ui->albumHeader->layout() );*/
ui->artistLabel_2->setVisible( false );
ui->biography_2->setVisible( false );
ui->cover_2->setVisible( false );
m_albumsModel = new PlayableModel( ui->albums ); m_albumsModel = new PlayableModel( ui->albums );
ui->albums->setPlayableModel( m_albumsModel ); ui->albums->setPlayableModel( m_albumsModel );
ui->albums->setEmptyTip( tr( "Sorry, we could not find any albums for this artist!" ) ); ui->albums->setEmptyTip( tr( "Sorry, we could not find any albums for this artist!" ) );
@@ -98,11 +101,15 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( 48, 48 ) ); m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( 48, 48 ) );
ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( ui->cover->sizeHint() ) ) ); ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( ui->cover->sizeHint() ) ) );
QFont f = font();
f.setPointSize( f.pointSize() + 1 );
ui->biography->setOpenLinks( false );
ui->biography->setOpenExternalLinks( true );
ui->biography->setFrameShape( QFrame::NoFrame ); ui->biography->setFrameShape( QFrame::NoFrame );
ui->biography->setAttribute( Qt::WA_MacShowFocusRect, 0 ); ui->biography->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->biography->setFont( f );
TomahawkUtils::styleScrollBar( ui->biography->verticalScrollBar() ); TomahawkUtils::styleScrollBar( ui->biography->verticalScrollBar() );
QFont f = font();
f.setBold( true ); f.setBold( true );
f.setPointSize( TomahawkUtils::defaultFontSize() + 5 ); f.setPointSize( TomahawkUtils::defaultFontSize() + 5 );
ui->artistLabel->setFont( f ); ui->artistLabel->setFont( f );
@@ -134,6 +141,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
TomahawkUtils::styleScrollBar( ui->relatedArtists->horizontalScrollBar() ); TomahawkUtils::styleScrollBar( ui->relatedArtists->horizontalScrollBar() );
ui->biography->setStyleSheet( "QTextBrowser#biography { background-color: transparent; }" ); ui->biography->setStyleSheet( "QTextBrowser#biography { background-color: transparent; }" );
ui->biography->document()->setDefaultStyleSheet( "a { text-decoration: none; font-weight: bold; color: #ffffff; }" );
ui->albums->setStyleSheet( "QListView { background-color: transparent; }" ); ui->albums->setStyleSheet( "QListView { background-color: transparent; }" );
ui->albumFrame->setStyleSheet( "QFrame#albumFrame { background-color: transparent; }" ui->albumFrame->setStyleSheet( "QFrame#albumFrame { background-color: transparent; }"
@@ -153,6 +161,8 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
"border-image: url(" RESPATH "images/scrollbar-vertical-handle.png) 3 3 3 3 stretch stretch;" "border-image: url(" RESPATH "images/scrollbar-vertical-handle.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; }" );
connect( ui->biography, SIGNAL( anchorClicked( QUrl ) ), SLOT( onBiographyLinkClicked( QUrl ) ) );
load( artist ); load( artist );
} }
@@ -293,7 +303,7 @@ ArtistInfoWidget::onBiographyLoaded()
m_longDescription = m_artist->biography(); m_longDescription = m_artist->biography();
emit longDescriptionChanged( m_longDescription ); emit longDescriptionChanged( m_longDescription );
ui->biography->setHtml( m_artist->biography() ); ui->biography->setHtml( m_artist->biography().replace( '\n', "<br>" ) );
} }
@@ -310,6 +320,14 @@ ArtistInfoWidget::onArtistImageUpdated()
} }
void
ArtistInfoWidget::onBiographyLinkClicked( const QUrl& url )
{
tDebug() << Q_FUNC_INFO << url;
GlobalActionManager::instance()->parseTomahawkLink( url.toString() );
}
void void
ArtistInfoWidget::changeEvent( QEvent* e ) ArtistInfoWidget::changeEvent( QEvent* e )
{ {

View File

@@ -98,6 +98,8 @@ private slots:
void onTracksFound( const QList<Tomahawk::query_ptr>& queries, Tomahawk::ModelMode mode ); void onTracksFound( const QList<Tomahawk::query_ptr>& queries, Tomahawk::ModelMode mode );
void onSimilarArtistsLoaded(); void onSimilarArtistsLoaded();
void onBiographyLinkClicked( const QUrl& url );
private: private:
Ui::ArtistInfoWidget *ui; Ui::ArtistInfoWidget *ui;

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>965</width> <width>965</width>
<height>912</height> <height>1179</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -30,6 +30,106 @@
</property> </property>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<property name="spacing">
<number>16</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="PlayableCover" name="cover">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" 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>Cover</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>4</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="artistLabel">
<property name="text">
<string>Artist</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="biography">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>240</height>
</size>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_9">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QFrame" name="trackFrame"> <widget class="QFrame" name="trackFrame">
<property name="minimumSize"> <property name="minimumSize">
@@ -264,7 +364,7 @@
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin"> <property name="leftMargin">
<number>16</number> <number>0</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>0</number>
@@ -276,7 +376,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="PlayableCover" name="cover"> <widget class="PlayableCover" name="cover_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -307,14 +407,14 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>1</width>
<height>8</height> <height>8</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QLabel" name="artistLabel"> <widget class="QLabel" name="artistLabel_2">
<property name="text"> <property name="text">
<string>Artist</string> <string>Artist</string>
</property> </property>
@@ -333,14 +433,14 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>1</width>
<height>12</height> <height>12</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QTextBrowser" name="biography"> <widget class="QTextBrowser" name="biography_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>