mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Make artist & album names clickable on track page.
This commit is contained in:
@@ -37,6 +37,7 @@ TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* par
|
|||||||
, ui( new Ui::TrackInfoWidget )
|
, ui( new Ui::TrackInfoWidget )
|
||||||
{
|
{
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
|
|
||||||
QPalette pal = palette();
|
QPalette pal = palette();
|
||||||
pal.setColor( QPalette::Window, QColor( "#323435" ) );
|
pal.setColor( QPalette::Window, QColor( "#323435" ) );
|
||||||
|
|
||||||
@@ -83,6 +84,9 @@ TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* par
|
|||||||
ui->lyricsView->setPalette( p );
|
ui->lyricsView->setPalette( p );
|
||||||
// ui->similarTracksLabel->setPalette( p );
|
// ui->similarTracksLabel->setPalette( p );
|
||||||
|
|
||||||
|
ui->artistLabel->setType( QueryLabel::Artist );
|
||||||
|
ui->albumLabel->setType( QueryLabel::Album );
|
||||||
|
|
||||||
m_relatedTracksModel = new PlayableModel( ui->similarTracksView );
|
m_relatedTracksModel = new PlayableModel( ui->similarTracksView );
|
||||||
ui->similarTracksView->setPlayableModel( m_relatedTracksModel );
|
ui->similarTracksView->setPlayableModel( m_relatedTracksModel );
|
||||||
ui->similarTracksView->proxyModel()->sort( -1 );
|
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 ) );
|
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::ScaledCover, QSize( 48, 48 ) );
|
||||||
|
|
||||||
load( query );
|
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();
|
onCoverUpdated();
|
||||||
|
|
||||||
ui->trackLabel->setText( query->track() );
|
ui->trackLabel->setText( query->track() );
|
||||||
ui->artistLabel->setText( query->artist() );
|
ui->artistLabel->setQuery( query );
|
||||||
ui->albumLabel->setText( query->album() );
|
ui->albumLabel->setQuery( query );
|
||||||
ui->fromLabel->setVisible( !query->album().isEmpty() );
|
ui->fromLabel->setVisible( !query->album().isEmpty() );
|
||||||
|
|
||||||
m_relatedTracksModel->clear();
|
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
|
void
|
||||||
TrackInfoWidget::changeEvent( QEvent* e )
|
TrackInfoWidget::changeEvent( QEvent* e )
|
||||||
{
|
{
|
||||||
|
@@ -82,6 +82,9 @@ private slots:
|
|||||||
void onSimilarTracksLoaded();
|
void onSimilarTracksLoaded();
|
||||||
void onLyricsLoaded();
|
void onLyricsLoaded();
|
||||||
|
|
||||||
|
void onArtistClicked();
|
||||||
|
void onAlbumClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::TrackInfoWidget *ui;
|
Ui::TrackInfoWidget *ui;
|
||||||
|
|
||||||
|
@@ -83,7 +83,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="artistLabel">
|
<widget class="QueryLabel" name="artistLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Artist</string>
|
<string>Artist</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="albumLabel">
|
<widget class="QueryLabel" name="albumLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Album</string>
|
<string>Album</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -233,6 +233,11 @@
|
|||||||
<extends>QLabel</extends>
|
<extends>QLabel</extends>
|
||||||
<header>widgets/HeaderLabel.h</header>
|
<header>widgets/HeaderLabel.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>QueryLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>widgets/QueryLabel.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
Reference in New Issue
Block a user