1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01: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/PlaylistModel.h"
#include "playlist/TreeProxyModel.h"
#include "Source.h"
#include "database/DatabaseCommand_AllTracks.h"
#include "database/DatabaseCommand_AllAlbums.h"
#include "Source.h"
#include "GlobalActionManager.h"
#include "Pipeline.h"
#include "utils/StyleHelper.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->albumHeader->layout() );*/
ui->artistLabel_2->setVisible( false );
ui->biography_2->setVisible( false );
ui->cover_2->setVisible( false );
m_albumsModel = new PlayableModel( ui->albums );
ui->albums->setPlayableModel( m_albumsModel );
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 ) );
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->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->biography->setFont( f );
TomahawkUtils::styleScrollBar( ui->biography->verticalScrollBar() );
QFont f = font();
f.setBold( true );
f.setPointSize( TomahawkUtils::defaultFontSize() + 5 );
ui->artistLabel->setFont( f );
@ -134,6 +141,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
TomahawkUtils::styleScrollBar( ui->relatedArtists->horizontalScrollBar() );
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->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-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 );
}
@ -293,7 +303,7 @@ ArtistInfoWidget::onBiographyLoaded()
m_longDescription = m_artist->biography();
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
ArtistInfoWidget::changeEvent( QEvent* e )
{

View File

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

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>965</width>
<height>912</height>
<height>1179</height>
</rect>
</property>
<property name="windowTitle">
@ -30,6 +30,106 @@
</property>
<item>
<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>
<widget class="QFrame" name="trackFrame">
<property name="minimumSize">
@ -264,7 +364,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>16</number>
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
@ -276,7 +376,7 @@
<number>0</number>
</property>
<item>
<widget class="PlayableCover" name="cover">
<widget class="PlayableCover" name="cover_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -307,14 +407,14 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<width>1</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="artistLabel">
<widget class="QLabel" name="artistLabel_2">
<property name="text">
<string>Artist</string>
</property>
@ -333,14 +433,14 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<width>1</width>
<height>12</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QTextBrowser" name="biography">
<widget class="QTextBrowser" name="biography_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>