From 393d3370d3fa0ed1e514e85e4c0288df6f258cd1 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 1 Jun 2012 09:05:30 +0200 Subject: [PATCH] * Set empty-tooltips for Artist-,Album- and TrackInfoWidgets. --- src/libtomahawk/playlist/TreeModel.cpp | 3 ++- .../widgets/infowidgets/AlbumInfoWidget.cpp | 5 ++++- .../widgets/infowidgets/ArtistInfoWidget.cpp | 15 ++++++++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/libtomahawk/playlist/TreeModel.cpp b/src/libtomahawk/playlist/TreeModel.cpp index 5b54db35a..9e9e57349 100644 --- a/src/libtomahawk/playlist/TreeModel.cpp +++ b/src/libtomahawk/playlist/TreeModel.cpp @@ -237,7 +237,8 @@ TreeModel::addTracks( const album_ptr& album, const QModelIndex& parent, bool au connect( album.data(), SIGNAL( tracksAdded( QList, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ), SLOT( onTracksFound( QList, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ) ); - onTracksAdded( album->tracks( m_mode, m_collection ), parent ); + if ( !album->tracks( m_mode, m_collection ).isEmpty() ) + onTracksAdded( album->tracks( m_mode, m_collection ), parent ); } diff --git a/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.cpp index 812e7dc04..3dc71d192 100644 --- a/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.cpp @@ -49,11 +49,13 @@ AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* par m_albumsModel = new PlayableModel( ui->albumsView ); ui->albumsView->setPlayableModel( m_albumsModel ); + ui->albumsView->setEmptyTip( tr( "Sorry, we could not find any other albums for this artist!" ) ); m_tracksModel = new TreeModel( ui->tracksView ); m_tracksModel->setMode( Mixed ); ui->tracksView->setTreeModel( m_tracksModel ); ui->tracksView->setRootIsDecorated( false ); + ui->tracksView->setEmptyTip( tr( "Sorry, we could not find any tracks for this album!" ) ); m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::ScaledCover, QSize( 48, 48 ) ); @@ -154,7 +156,8 @@ AlbumInfoWidget::loadAlbums( bool autoRefetch ) connect( m_album->artist().data(), SIGNAL( albumsAdded( QList, Tomahawk::ModelMode ) ), SLOT( gotAlbums( QList ) ) ); - gotAlbums( m_album->artist()->albums( Mixed ) ); + if ( !m_album->artist()->albums( Mixed ).isEmpty() ) + gotAlbums( m_album->artist()->albums( Mixed ) ); /* tDebug() << "Auto refetching"; m_buttonAlbums->setChecked( false ); diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp index 18e364e36..fe4edaa9d 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp @@ -58,15 +58,18 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* m_albumsModel = new PlayableModel( ui->albums ); ui->albums->setPlayableModel( m_albumsModel ); + ui->topHits->setEmptyTip( tr( "Sorry, we could not find any albums for this artist!" ) ); m_relatedModel = new PlayableModel( ui->relatedArtists ); ui->relatedArtists->setPlayableModel( m_relatedModel ); ui->relatedArtists->proxyModel()->sort( -1 ); + ui->topHits->setEmptyTip( tr( "Sorry, we could not find any related artists!" ) ); m_topHitsModel = new PlaylistModel( ui->topHits ); m_topHitsModel->setStyle( PlayableModel::Short ); ui->topHits->setPlayableModel( m_topHitsModel ); ui->topHits->setSortingEnabled( false ); + ui->topHits->setEmptyTip( tr( "Sorry, we could not find any top hits for this artist!" ) ); m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( 48, 48 ) ); @@ -161,9 +164,15 @@ ArtistInfoWidget::load( const artist_ptr& artist ) connect( m_artist.data(), SIGNAL( tracksAdded( QList, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ), SLOT( onTracksFound( QList, Tomahawk::ModelMode ) ) ); - onAlbumsFound( artist->albums( Mixed ), Mixed ); - onTracksFound( m_artist->tracks(), Mixed ); - onSimilarArtistsLoaded(); + if ( !m_artist->albums( Mixed ).isEmpty() ) + onAlbumsFound( m_artist->albums( Mixed ), Mixed ); + + if ( !m_artist->tracks().isEmpty() ) + onTracksFound( m_artist->tracks(), Mixed ); + + if ( !m_artist->similarArtists().isEmpty() ) + onSimilarArtistsLoaded(); + onArtistImageUpdated(); Tomahawk::InfoSystem::InfoStringHash artistInfo;