mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Route (almost) all artists/albums/tracks requests through Collections.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -132,14 +133,23 @@ AlbumPlaylistInterface::tracks() const
|
|||||||
}
|
}
|
||||||
else if ( m_mode == DatabaseMode && !m_databaseLoaded )
|
else if ( m_mode == DatabaseMode && !m_databaseLoaded )
|
||||||
{
|
{
|
||||||
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( m_collection );
|
if ( m_collection.isNull() ) //we do a dbcmd directly, for the SuperCollection I guess?
|
||||||
cmd->setAlbum( m_album->weakRef() );
|
{
|
||||||
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
|
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( m_collection );
|
||||||
|
cmd->setAlbum( m_album->weakRef() );
|
||||||
|
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
|
||||||
|
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
|
||||||
|
SLOT( onTracksLoaded( QList<Tomahawk::query_ptr> ) ) );
|
||||||
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
connect( m_collection.data(), SIGNAL( tracksResult( QList< Tomahawk::query_ptr > ) ),
|
||||||
|
SLOT( onTracksLoaded( QList< Tomahawk::query_ptr > ) ), Qt::UniqueConnection );
|
||||||
|
|
||||||
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
|
Tomahawk::album_ptr ap = Album::get( m_album->id(), m_album->name(), m_album->artist() );
|
||||||
SLOT( onTracksLoaded( QList<Tomahawk::query_ptr> ) ) );
|
m_collection->tracks( ap );
|
||||||
|
}
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,15 +228,23 @@ AlbumPlaylistInterface::infoSystemFinished( const QString& infoId )
|
|||||||
|
|
||||||
if ( m_queries.isEmpty() && m_mode == Mixed )
|
if ( m_queries.isEmpty() && m_mode == Mixed )
|
||||||
{
|
{
|
||||||
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( m_collection );
|
if ( m_collection.isNull() ) //we do a dbcmd directly, for the SuperCollection I guess?
|
||||||
cmd->setAlbum( m_album->weakRef() );
|
{
|
||||||
//this takes discnumber into account as well
|
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( m_collection );
|
||||||
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
|
cmd->setAlbum( m_album->weakRef() );
|
||||||
|
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
|
||||||
|
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
|
||||||
|
SLOT( onTracksLoaded( QList<Tomahawk::query_ptr> ) ) );
|
||||||
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
connect( m_collection.data(), SIGNAL( tracksResult( QList< Tomahawk::query_ptr > ) ),
|
||||||
|
SLOT( onTracksLoaded( QList< Tomahawk::query_ptr > ) ), Qt::UniqueConnection );
|
||||||
|
|
||||||
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
|
Tomahawk::album_ptr ap = Album::get( m_album->id(), m_album->name(), m_album->artist() );
|
||||||
SLOT( onTracksLoaded( QList<Tomahawk::query_ptr> ) ) );
|
m_collection->tracks( ap );
|
||||||
|
}
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -165,13 +166,23 @@ Artist::albums( ModelMode mode, const Tomahawk::collection_ptr& collection ) con
|
|||||||
|
|
||||||
if ( ( mode == DatabaseMode || mode == Mixed ) && !dbLoaded )
|
if ( ( mode == DatabaseMode || mode == Mixed ) && !dbLoaded )
|
||||||
{
|
{
|
||||||
DatabaseCommand_AllAlbums* cmd = new DatabaseCommand_AllAlbums( collection, artist );
|
if ( collection.isNull() )
|
||||||
cmd->setData( QVariant( collection.isNull() ) );
|
{
|
||||||
|
DatabaseCommand_AllAlbums* cmd = new DatabaseCommand_AllAlbums( collection, artist );
|
||||||
|
cmd->setData( QVariant( collection.isNull() ) );
|
||||||
|
|
||||||
connect( cmd, SIGNAL( albums( QList<Tomahawk::album_ptr>, QVariant ) ),
|
connect( cmd, SIGNAL( albums( QList<Tomahawk::album_ptr>, QVariant ) ),
|
||||||
SLOT( onAlbumsFound( QList<Tomahawk::album_ptr>, QVariant ) ) );
|
SLOT( onAlbumsFound( QList<Tomahawk::album_ptr>, QVariant ) ) );
|
||||||
|
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//collection is *surely* not null
|
||||||
|
connect( collection.data(), SIGNAL( albumsResult( QList< Tomahawk::album_ptr > ) ),
|
||||||
|
SLOT( onAlbumsFound( QList<Tomahawk::album_ptr> ) ), Qt::UniqueConnection );
|
||||||
|
collection->albums( artist );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( mode == InfoSystemMode || mode == Mixed ) && !infoLoaded )
|
if ( ( mode == InfoSystemMode || mode == Mixed ) && !infoLoaded )
|
||||||
@@ -376,9 +387,9 @@ Artist::playbackCount( const source_ptr& source )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Artist::onAlbumsFound( const QList< album_ptr >& albums, const QVariant& data )
|
Artist::onAlbumsFound( const QList< album_ptr >& albums, const QVariant& collectionIsNull )
|
||||||
{
|
{
|
||||||
if ( data.toBool() )
|
if ( collectionIsNull.toBool() )
|
||||||
{
|
{
|
||||||
m_databaseAlbums << albums;
|
m_databaseAlbums << albums;
|
||||||
m_albumsLoaded.insert( DatabaseMode, true );
|
m_albumsLoaded.insert( DatabaseMode, true );
|
||||||
|
@@ -89,8 +89,7 @@ signals:
|
|||||||
void statsLoaded();
|
void statsLoaded();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTracksLoaded( Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
|
void onAlbumsFound( const QList<Tomahawk::album_ptr>& albums, const QVariant& collectionIsNull = QVariant( false ) );
|
||||||
void onAlbumsFound( const QList<Tomahawk::album_ptr>& albums, const QVariant& data );
|
|
||||||
|
|
||||||
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||||
void infoSystemFinished( QString target );
|
void infoSystemFinished( QString target );
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -75,14 +76,19 @@ public:
|
|||||||
virtual QList< Tomahawk::dynplaylist_ptr > autoPlaylists() { return m_autoplaylists.values(); }
|
virtual QList< Tomahawk::dynplaylist_ptr > autoPlaylists() { return m_autoplaylists.values(); }
|
||||||
virtual QList< Tomahawk::dynplaylist_ptr > stations() { return m_stations.values(); }
|
virtual QList< Tomahawk::dynplaylist_ptr > stations() { return m_stations.values(); }
|
||||||
|
|
||||||
|
// Async requests. Emit artists/albums/tracksResult in subclasses when finished.
|
||||||
virtual void artists() = 0;
|
virtual void artists() = 0;
|
||||||
virtual void albums( const Tomahawk::artist_ptr& artist ) = 0;
|
virtual void albums( const Tomahawk::artist_ptr& artist ) = 0;
|
||||||
virtual void tracks( const Tomahawk::artist_ptr& artist, const Tomahawk::album_ptr& album ) = 0;
|
virtual void tracks( const Tomahawk::album_ptr& album ) = 0;
|
||||||
|
|
||||||
const source_ptr& source() const;
|
const source_ptr& source() const;
|
||||||
unsigned int lastmodified() const { return m_lastmodified; }
|
unsigned int lastmodified() const { return m_lastmodified; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void artistsResult( const QList< Tomahawk::artist_ptr >& artists );
|
||||||
|
void albumsResult( const QList< Tomahawk::album_ptr >& albums );
|
||||||
|
void tracksResult( const QList< Tomahawk::query_ptr >& queries );
|
||||||
|
|
||||||
void tracksAdded( const QList<unsigned int>& fileids );
|
void tracksAdded( const QList<unsigned int>& fileids );
|
||||||
void tracksRemoved( const QList<unsigned int>& fileids );
|
void tracksRemoved( const QList<unsigned int>& fileids );
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||||
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,6 +21,8 @@
|
|||||||
#include "DatabaseCollection.h"
|
#include "DatabaseCollection.h"
|
||||||
|
|
||||||
#include "database/Database.h"
|
#include "database/Database.h"
|
||||||
|
#include "DatabaseCommand_AllArtists.h"
|
||||||
|
#include "DatabaseCommand_AllAlbums.h"
|
||||||
#include "DatabaseCommand_AllTracks.h"
|
#include "DatabaseCommand_AllTracks.h"
|
||||||
#include "DatabaseCommand_AddFiles.h"
|
#include "DatabaseCommand_AddFiles.h"
|
||||||
#include "DatabaseCommand_DeleteFiles.h"
|
#include "DatabaseCommand_DeleteFiles.h"
|
||||||
@@ -130,6 +133,83 @@ DatabaseCollection::stations()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DatabaseCollection::artists()
|
||||||
|
{
|
||||||
|
//FIXME: assuming there's only one dbcollection per source, and that this is the one
|
||||||
|
Tomahawk::collection_ptr thisCollection = source()->dbCollection();
|
||||||
|
if ( thisCollection->name() != this->name() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
DatabaseCommand_AllArtists* cmd = new DatabaseCommand_AllArtists( thisCollection );
|
||||||
|
|
||||||
|
connect( cmd, SIGNAL( artists( QList< Tomahawk::artist_ptr > ) ),
|
||||||
|
SLOT( onArtistsFetched( QList< Tomahawk::artist_ptr > ) ) );
|
||||||
|
|
||||||
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DatabaseCollection::onArtistsFetched( const QList< Tomahawk::artist_ptr >& artists )
|
||||||
|
{
|
||||||
|
emit artistsResult( artists );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DatabaseCollection::albums( const Tomahawk::artist_ptr& artist )
|
||||||
|
{
|
||||||
|
//FIXME: assuming there's only one dbcollection per source, and that this is the one
|
||||||
|
Tomahawk::collection_ptr thisCollection = source()->dbCollection();
|
||||||
|
if ( thisCollection->name() != this->name() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
DatabaseCommand_AllAlbums* cmd = new DatabaseCommand_AllAlbums( thisCollection, artist );
|
||||||
|
|
||||||
|
// The QVariant might carry a bool that says whether the dbcmd was executed for a null collection
|
||||||
|
// but here we know for a fact that the collection is not null, so we'll happily ignore it
|
||||||
|
connect( cmd, SIGNAL( albums( QList<Tomahawk::album_ptr>, QVariant ) ),
|
||||||
|
SLOT( onAlbumsFetched( QList<Tomahawk::album_ptr>, QVariant ) ) );
|
||||||
|
|
||||||
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DatabaseCollection::onAlbumsFetched( const QList< album_ptr >& albums, const QVariant& data )
|
||||||
|
{
|
||||||
|
Q_UNUSED( data );
|
||||||
|
emit albumsResult( albums );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DatabaseCollection::tracks( const Tomahawk::album_ptr& album )
|
||||||
|
{
|
||||||
|
//FIXME: assuming there's only one dbcollection per source, and that this is the one
|
||||||
|
Tomahawk::collection_ptr thisCollection = source()->dbCollection();
|
||||||
|
if ( thisCollection->name() != this->name() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( thisCollection );
|
||||||
|
cmd->setAlbum( album->weakRef() );
|
||||||
|
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
|
||||||
|
|
||||||
|
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
|
||||||
|
SLOT( onTracksFetched( QList<Tomahawk::query_ptr> ) ) );
|
||||||
|
|
||||||
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DatabaseCollection::onTracksFetched( const QList< query_ptr >& tracks )
|
||||||
|
{
|
||||||
|
emit tracksResult( tracks );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QVariantList& data )
|
DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QVariantList& data )
|
||||||
{
|
{
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||||
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -49,11 +50,19 @@ public:
|
|||||||
virtual QList< Tomahawk::dynplaylist_ptr > autoPlaylists();
|
virtual QList< Tomahawk::dynplaylist_ptr > autoPlaylists();
|
||||||
virtual QList< Tomahawk::dynplaylist_ptr > stations();
|
virtual QList< Tomahawk::dynplaylist_ptr > stations();
|
||||||
|
|
||||||
|
virtual void artists();
|
||||||
|
virtual void albums( const Tomahawk::artist_ptr& artist );
|
||||||
|
virtual void tracks( const Tomahawk::album_ptr& album );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void addTracks( const QList<QVariant>& newitems );
|
virtual void addTracks( const QList<QVariant>& newitems );
|
||||||
virtual void removeTracks( const QDir& dir );
|
virtual void removeTracks( const QDir& dir );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void onArtistsFetched( const QList< Tomahawk::artist_ptr >& artists );
|
||||||
|
void onAlbumsFetched( const QList< Tomahawk::album_ptr >& albums, const QVariant& data );
|
||||||
|
void onTracksFetched( const QList< Tomahawk::query_ptr >& tracks );
|
||||||
|
|
||||||
void stationCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
|
void stationCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
|
||||||
void autoPlaylistCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
|
void autoPlaylistCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
|
||||||
};
|
};
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
* Copyright 2012, Leo Franchi <lfranchi@kde.org>
|
* Copyright 2012, Leo Franchi <lfranchi@kde.org>
|
||||||
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -251,12 +252,10 @@ TreeModel::addCollection( const collection_ptr& collection )
|
|||||||
startLoading();
|
startLoading();
|
||||||
|
|
||||||
m_collection = collection;
|
m_collection = collection;
|
||||||
DatabaseCommand_AllArtists* cmd = new DatabaseCommand_AllArtists( collection );
|
|
||||||
|
|
||||||
connect( cmd, SIGNAL( artists( QList<Tomahawk::artist_ptr> ) ),
|
connect( m_collection.data(), SIGNAL( artistsResult( QList<Tomahawk::artist_ptr> ) ),
|
||||||
SLOT( onArtistsAdded( QList<Tomahawk::artist_ptr> ) ) );
|
SLOT( onArtistsAdded( QList<Tomahawk::artist_ptr> ) ), Qt::UniqueConnection );
|
||||||
|
m_collection->artists();
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
|
||||||
|
|
||||||
connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
|
connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
|
||||||
|
|
||||||
@@ -270,29 +269,28 @@ TreeModel::addCollection( const collection_ptr& collection )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
//void
|
||||||
TreeModel::addFilteredCollection( const collection_ptr& collection, unsigned int amount, DatabaseCommand_AllArtists::SortOrder order )
|
//TreeModel::addFilteredCollection( const collection_ptr& collection, unsigned int amount, DatabaseCommand_AllArtists::SortOrder order )
|
||||||
{
|
//{
|
||||||
qDebug() << Q_FUNC_INFO << collection->name()
|
// qDebug() << Q_FUNC_INFO << collection->name()
|
||||||
<< collection->source()->id()
|
// << collection->source()->id()
|
||||||
<< collection->source()->nodeId()
|
// << collection->source()->nodeId()
|
||||||
<< amount << order;
|
// << amount << order;
|
||||||
|
// DatabaseCommand_AllArtists* cmd = new DatabaseCommand_AllArtists( collection );
|
||||||
|
// cmd->setLimit( amount );
|
||||||
|
// cmd->setSortOrder( order );
|
||||||
|
// cmd->setSortDescending( true );
|
||||||
|
|
||||||
DatabaseCommand_AllArtists* cmd = new DatabaseCommand_AllArtists( collection );
|
// connect( cmd, SIGNAL( artists( QList<Tomahawk::artist_ptr>, Tomahawk::collection_ptr ) ),
|
||||||
cmd->setLimit( amount );
|
// SLOT( onArtistsAdded( QList<Tomahawk::artist_ptr>, Tomahawk::collection_ptr ) ) );
|
||||||
cmd->setSortOrder( order );
|
|
||||||
cmd->setSortDescending( true );
|
|
||||||
|
|
||||||
connect( cmd, SIGNAL( artists( QList<Tomahawk::artist_ptr>, Tomahawk::collection_ptr ) ),
|
// Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
SLOT( onArtistsAdded( QList<Tomahawk::artist_ptr>, Tomahawk::collection_ptr ) ) );
|
|
||||||
|
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
// if ( collection->source()->isLocal() )
|
||||||
|
// setTitle( tr( "My Collection" ) );
|
||||||
if ( collection->source()->isLocal() )
|
// else
|
||||||
setTitle( tr( "My Collection" ) );
|
// setTitle( tr( "Collection of %1" ).arg( collection->source()->friendlyName() ) );
|
||||||
else
|
//}
|
||||||
setTitle( tr( "Collection of %1" ).arg( collection->source()->friendlyName() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -53,7 +53,8 @@ public:
|
|||||||
|
|
||||||
void addAllCollections();
|
void addAllCollections();
|
||||||
void addCollection( const Tomahawk::collection_ptr& collection );
|
void addCollection( const Tomahawk::collection_ptr& collection );
|
||||||
void addFilteredCollection( const Tomahawk::collection_ptr& collection, unsigned int amount, DatabaseCommand_AllArtists::SortOrder order );
|
//TODO: Unused, but will be useful for supporting filtered queries. - Teo 1/2013
|
||||||
|
//void addFilteredCollection( const Tomahawk::collection_ptr& collection, unsigned int amount, DatabaseCommand_AllArtists::SortOrder order );
|
||||||
|
|
||||||
void addArtists( const Tomahawk::artist_ptr& artist );
|
void addArtists( const Tomahawk::artist_ptr& artist );
|
||||||
void addTracks( const Tomahawk::album_ptr& album, const QModelIndex& parent, bool autoRefetch = false );
|
void addTracks( const Tomahawk::album_ptr& album, const QModelIndex& parent, bool autoRefetch = false );
|
||||||
|
@@ -64,3 +64,25 @@ ScriptCollection::icon() const
|
|||||||
}
|
}
|
||||||
return QIcon();
|
return QIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ScriptCollection::artists()
|
||||||
|
{
|
||||||
|
//TODO: implement!
|
||||||
|
emit artistsResult( QList< Tomahawk::artist_ptr >() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ScriptCollection::albums( const Tomahawk::artist_ptr& artist )
|
||||||
|
{
|
||||||
|
emit albumsResult( QList< Tomahawk::album_ptr >() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ScriptCollection::tracks( const Tomahawk::album_ptr& album )
|
||||||
|
{
|
||||||
|
emit tracksResult( QList< Tomahawk::query_ptr >() );
|
||||||
|
}
|
||||||
|
@@ -46,6 +46,10 @@ public:
|
|||||||
|
|
||||||
virtual ExternalResolver* resolver() { return m_resolver; }
|
virtual ExternalResolver* resolver() { return m_resolver; }
|
||||||
|
|
||||||
|
virtual void artists();
|
||||||
|
virtual void albums( const Tomahawk::artist_ptr& artist );
|
||||||
|
virtual void tracks( const Tomahawk::album_ptr& album );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ExternalResolver* m_resolver;
|
ExternalResolver* m_resolver;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user