1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-13 20:39:57 +01:00

* Fixed TWK-362: Only display other albums on album page.

This commit is contained in:
Christian Muehlhaeuser 2011-08-13 22:56:40 +02:00
parent 999b9bae22
commit a7a4b97df8
5 changed files with 24 additions and 7 deletions

View File

@ -38,7 +38,7 @@ public:
ModificationTime = 1
};
explicit DatabaseCommand_AllAlbums( const Tomahawk::collection_ptr& collection, const Tomahawk::artist_ptr& artist = Tomahawk::artist_ptr(), QObject* parent = 0 )
explicit DatabaseCommand_AllAlbums( const Tomahawk::collection_ptr& collection = Tomahawk::collection_ptr(), const Tomahawk::artist_ptr& artist = Tomahawk::artist_ptr(), QObject* parent = 0 )
: DatabaseCommand( parent )
, m_collection( collection )
, m_artist( artist )
@ -55,6 +55,7 @@ public:
void execForCollection( DatabaseImpl* );
void execForArtist( DatabaseImpl* );
void setArtist( const Tomahawk::artist_ptr& artist ) { m_artist = artist; }
void setLimit( unsigned int amount ) { m_amount = amount; }
void setSortOrder( DatabaseCommand_AllAlbums::SortOrder order ) { m_sortOrder = order; }
void setSortDescending( bool descending ) { m_sortDescending = descending; }

View File

@ -355,7 +355,6 @@ void
AlbumModel::infoSystemFinished( QString target )
{
Q_UNUSED( target );
// qDebug() << Q_FUNC_INFO;
}

View File

@ -20,6 +20,7 @@
#include "ui_AlbumInfoWidget.h"
#include "viewmanager.h"
#include "database/database.h"
#include "playlist/treemodel.h"
#include "playlist/albummodel.h"
@ -39,7 +40,6 @@ using namespace Tomahawk;
AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* parent )
: QWidget( parent )
, ui( new Ui::AlbumInfoWidget )
, m_album( album )
{
ui->setupUi( this );
@ -77,13 +77,18 @@ AlbumInfoWidget::~AlbumInfoWidget()
void
AlbumInfoWidget::load( const album_ptr& album )
{
m_album = album;
m_title = album->name();
m_description = album->artist()->name();
m_tracksModel->addTracks( album, QModelIndex() );
QList<album_ptr> al;
al << album;
m_albumsModel->addAlbums( al );
DatabaseCommand_AllAlbums* cmd = new DatabaseCommand_AllAlbums();
cmd->setArtist( album->artist() );
connect( cmd, SIGNAL( albums( QList<Tomahawk::album_ptr>, QVariant ) ),
SLOT( gotAlbums( QList<Tomahawk::album_ptr> ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
Tomahawk::InfoSystem::InfoCriteriaHash trackInfo;
trackInfo["artist"] = album->artist()->name();
@ -99,6 +104,17 @@ AlbumInfoWidget::load( const album_ptr& album )
}
void
AlbumInfoWidget::gotAlbums( const QList<Tomahawk::album_ptr>& albums )
{
QList<Tomahawk::album_ptr> al = albums;
if ( al.contains( m_album ) )
al.removeAll( m_album );
m_albumsModel->addAlbums( al );
}
void
AlbumInfoWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{

View File

@ -86,6 +86,8 @@ protected:
void changeEvent( QEvent* e );
private slots:
void gotAlbums( const QList<Tomahawk::album_ptr>& albums );
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
void infoSystemFinished( QString target );

View File

@ -294,7 +294,6 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
painter->restore();
}
QPixmap avatar = index.data( WelcomePlaylistModel::PlaylistRole ).value< Tomahawk::playlist_ptr >()->author()->avatar( Source::FancyStyle );
if ( avatar.isNull() )
avatar = m_defaultAvatar;