diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp index 55b36bcd4..5f511a23d 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp @@ -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', "
" ) ); } @@ -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 ) { diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h index a3b91f2a8..0e2b46ae1 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h @@ -98,6 +98,8 @@ private slots: void onTracksFound( const QList& queries, Tomahawk::ModelMode mode ); void onSimilarArtistsLoaded(); + void onBiographyLinkClicked( const QUrl& url ); + private: Ui::ArtistInfoWidget *ui; diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui index 70d7304c6..22118b5e9 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui @@ -7,7 +7,7 @@ 0 0 965 - 912 + 1179 @@ -30,6 +30,106 @@ + + + + 16 + + + 0 + + + + + 0 + + + + + + 0 + 0 + + + + + 220 + 220 + + + + Cover + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 4 + + + + + + + + Artist + + + Qt::AlignCenter + + + + + + + + + + 0 + 0 + + + + + 0 + 240 + + + + Qt::ScrollBarAlwaysOff + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 16 + + + + @@ -264,7 +364,7 @@ - 16 + 0 0 @@ -276,7 +376,7 @@ 0 - + 0 @@ -307,14 +407,14 @@ - 20 + 1 8 - + Artist @@ -333,14 +433,14 @@ - 20 + 1 12 - + 0