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

* Make artist & album names clickable on track page.

This commit is contained in:
Christian Muehlhaeuser 2012-06-07 13:07:11 +02:00
parent 197dda1ff7
commit f174afbd56
3 changed files with 34 additions and 4 deletions

View File

@ -37,6 +37,7 @@ TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* par
, ui( new Ui::TrackInfoWidget )
{
ui->setupUi( this );
QPalette pal = palette();
pal.setColor( QPalette::Window, QColor( "#323435" ) );
@ -83,6 +84,9 @@ TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* par
ui->lyricsView->setPalette( p );
// ui->similarTracksLabel->setPalette( p );
ui->artistLabel->setType( QueryLabel::Artist );
ui->albumLabel->setType( QueryLabel::Album );
m_relatedTracksModel = new PlayableModel( ui->similarTracksView );
ui->similarTracksView->setPlayableModel( m_relatedTracksModel );
ui->similarTracksView->proxyModel()->sort( -1 );
@ -91,6 +95,9 @@ TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* par
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::ScaledCover, QSize( 48, 48 ) );
load( query );
connect( ui->artistLabel, SIGNAL( clickedArtist() ), SLOT( onArtistClicked() ) );
connect( ui->albumLabel, SIGNAL( clickedAlbum() ), SLOT( onAlbumClicked() ) );
}
@ -150,8 +157,8 @@ TrackInfoWidget::load( const query_ptr& query )
onCoverUpdated();
ui->trackLabel->setText( query->track() );
ui->artistLabel->setText( query->artist() );
ui->albumLabel->setText( query->album() );
ui->artistLabel->setQuery( query );
ui->albumLabel->setQuery( query );
ui->fromLabel->setVisible( !query->album().isEmpty() );
m_relatedTracksModel->clear();
@ -223,6 +230,21 @@ TrackInfoWidget::onLyricsLoaded()
}
void
TrackInfoWidget::onArtistClicked()
{
ViewManager::instance()->show( Artist::get( m_query->artist(), false ) );
}
void
TrackInfoWidget::onAlbumClicked()
{
artist_ptr artist = Artist::get( m_query->artist(), false );
ViewManager::instance()->show( Album::get( artist, m_query->album(), false ) );
}
void
TrackInfoWidget::changeEvent( QEvent* e )
{

View File

@ -82,6 +82,9 @@ private slots:
void onSimilarTracksLoaded();
void onLyricsLoaded();
void onArtistClicked();
void onAlbumClicked();
private:
Ui::TrackInfoWidget *ui;

View File

@ -83,7 +83,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="artistLabel">
<widget class="QueryLabel" name="artistLabel">
<property name="text">
<string>Artist</string>
</property>
@ -107,7 +107,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="albumLabel">
<widget class="QueryLabel" name="albumLabel">
<property name="text">
<string>Album</string>
</property>
@ -233,6 +233,11 @@
<extends>QLabel</extends>
<header>widgets/HeaderLabel.h</header>
</customwidget>
<customwidget>
<class>QueryLabel</class>
<extends>QLabel</extends>
<header>widgets/QueryLabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>