mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-21 00:12:06 +02:00
Pimple Playlist
This commit is contained in:
parent
5c7868f4fe
commit
91223c45e0
@ -19,17 +19,18 @@
|
||||
|
||||
#include "Album.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "AlbumPlaylistInterface.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseImpl.h"
|
||||
#include "database/IdThreadWorker.h"
|
||||
#include "Query.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "AlbumPlaylistInterface.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Query.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QReadWriteLock>
|
||||
#include <QPixmapCache>
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include "Artist.h"
|
||||
|
||||
#include "ArtistPlaylistInterface.h"
|
||||
#include "collection/Collection.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseImpl.h"
|
||||
@ -28,11 +27,13 @@
|
||||
#include "database/DatabaseCommand_ArtistStats.h"
|
||||
#include "database/DatabaseCommand_TrackStats.h"
|
||||
#include "database/IdThreadWorker.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "ArtistPlaylistInterface.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QReadWriteLock>
|
||||
#include <QPixmapCache>
|
||||
|
||||
|
@ -79,6 +79,7 @@ set( libGuiSources
|
||||
playlist/PlaylistChartItemDelegate.cpp
|
||||
playlist/PlayableItem.cpp
|
||||
playlist/SingleTrackPlaylistInterface.cpp
|
||||
playlist/RevisionQueueItem.cpp
|
||||
|
||||
playlist/dynamic/DynamicPlaylist.cpp
|
||||
playlist/dynamic/DynamicView.cpp
|
||||
|
@ -27,11 +27,13 @@
|
||||
#include "database/DatabaseCommand_GenericSelect.h"
|
||||
#include "database/DatabaseCommand_SetCollectionAttributes.h"
|
||||
#include "database/DatabaseCommand_LoadFiles.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "SourceList.h"
|
||||
#include "Query.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Query.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
#include <echonest/CatalogUpdateEntry.h>
|
||||
#include <echonest/Config.h>
|
||||
|
||||
|
@ -20,11 +20,6 @@
|
||||
|
||||
#include "GlobalActionManager.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "SourceList.h"
|
||||
#include "Pipeline.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "audio/AudioEngine.h"
|
||||
#include "database/LocalCollection.h"
|
||||
#include "playlist/dynamic/GeneratorInterface.h"
|
||||
@ -41,6 +36,13 @@
|
||||
#include "utils/ShortenedLinkParser.h"
|
||||
#include "utils/RdioParser.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "Artist.h"
|
||||
#include "Pipeline.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
#include <qjson/parser.h>
|
||||
#include <qjson/serializer.h>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Playlist.h"
|
||||
#include "Playlist_p.h"
|
||||
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseCommand_LoadPlaylistEntries.h"
|
||||
@ -26,27 +26,26 @@
|
||||
#include "database/DatabaseCommand_CreatePlaylist.h"
|
||||
#include "database/DatabaseCommand_DeletePlaylist.h"
|
||||
#include "database/DatabaseCommand_RenamePlaylist.h"
|
||||
|
||||
#include "TomahawkSettings.h"
|
||||
#include "Pipeline.h"
|
||||
#include "Source.h"
|
||||
#include "SourceList.h"
|
||||
#include "PlaylistPlaylistInterface.h"
|
||||
|
||||
#include "playlist/PlaylistUpdaterInterface.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "playlist/PlaylistUpdaterInterface.h"
|
||||
#include "widgets/SourceTreePopupDialog.h"
|
||||
|
||||
#include <QtXml/QDomDocument>
|
||||
#include <QtXml/QDomElement>
|
||||
#include "Pipeline.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "PlaylistPlaylistInterface.h"
|
||||
#include "Source.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
#include <QDomDocument>
|
||||
#include <QDomElement>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
Playlist::Playlist( const source_ptr& author )
|
||||
: m_source( author )
|
||||
, m_lastmodified( 0 )
|
||||
: d_ptr( new PlaylistPrivate( this, author ) )
|
||||
{
|
||||
}
|
||||
|
||||
@ -62,15 +61,7 @@ Playlist::Playlist( const source_ptr& src,
|
||||
int lastmod,
|
||||
const QString& guid )
|
||||
: QObject()
|
||||
, m_source( src )
|
||||
, m_currentrevision( currentrevision )
|
||||
, m_guid( guid == "" ? uuid() : guid )
|
||||
, m_title( title )
|
||||
, m_info( info )
|
||||
, m_creator( creator )
|
||||
, m_lastmodified( lastmod )
|
||||
, m_createdOn( createdOn )
|
||||
, m_shared( shared )
|
||||
, d_ptr( new PlaylistPrivate( this, src, currentrevision, title, info, creator, createdOn, shared, lastmod, guid ) )
|
||||
{
|
||||
init();
|
||||
}
|
||||
@ -84,15 +75,19 @@ Playlist::Playlist( const source_ptr& author,
|
||||
bool shared,
|
||||
const QList< Tomahawk::plentry_ptr >& entries )
|
||||
: QObject()
|
||||
, m_source( author )
|
||||
, m_guid( guid )
|
||||
, m_title( title )
|
||||
, m_info ( info )
|
||||
, m_creator( creator )
|
||||
, m_lastmodified( 0 )
|
||||
, m_createdOn( 0 ) // will be set by db command
|
||||
, m_shared( shared )
|
||||
, m_initEntries( entries )
|
||||
, d_ptr( new PlaylistPrivate( this, author, guid, title, info, creator, shared, entries ) )
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
Playlist::Playlist( const source_ptr& author,
|
||||
const QString& guid,
|
||||
const QString& title,
|
||||
const QString& info,
|
||||
const QString& creator,
|
||||
bool shared)
|
||||
: QObject()
|
||||
, d_ptr( new PlaylistPrivate( this, author, guid, title, info, creator, shared, QList< Tomahawk::plentry_ptr >() ) )
|
||||
{
|
||||
init();
|
||||
}
|
||||
@ -101,10 +96,12 @@ Playlist::Playlist( const source_ptr& author,
|
||||
void
|
||||
Playlist::init()
|
||||
{
|
||||
m_busy = false;
|
||||
m_deleted = false;
|
||||
m_locallyChanged = false;
|
||||
m_loaded = false;
|
||||
Q_D( Playlist );
|
||||
|
||||
d->busy = false;
|
||||
d->deleted = false;
|
||||
d->locallyChanged = false;
|
||||
d->loaded = false;
|
||||
|
||||
connect( Pipeline::instance(), SIGNAL( idle() ), SLOT( onResolvingFinished() ) );
|
||||
}
|
||||
@ -112,6 +109,7 @@ Playlist::init()
|
||||
|
||||
Playlist::~Playlist()
|
||||
{
|
||||
delete d_ptr;
|
||||
}
|
||||
|
||||
|
||||
@ -204,37 +202,45 @@ Playlist::rename( const QString& title )
|
||||
void
|
||||
Playlist::setTitle( const QString& title )
|
||||
{
|
||||
if ( title == m_title )
|
||||
Q_D( Playlist );
|
||||
|
||||
if ( title == d->title )
|
||||
return;
|
||||
|
||||
const QString oldTitle = m_title;
|
||||
m_title = title;
|
||||
const QString oldTitle = d->title;
|
||||
d->title = title;
|
||||
|
||||
emit changed();
|
||||
emit renamed( m_title, oldTitle );
|
||||
emit renamed( d->title, oldTitle );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::reportCreated( const playlist_ptr& self )
|
||||
{
|
||||
Q_D( Playlist );
|
||||
|
||||
Q_ASSERT( self.data() == this );
|
||||
m_source->dbCollection()->addPlaylist( self );
|
||||
d->source->dbCollection()->addPlaylist( self );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::reportDeleted( const Tomahawk::playlist_ptr& self )
|
||||
{
|
||||
Q_D( Playlist );
|
||||
|
||||
Q_ASSERT( self.data() == this );
|
||||
if ( !m_updaters.isEmpty() )
|
||||
if ( !d->updaters.isEmpty() )
|
||||
{
|
||||
foreach( PlaylistUpdaterInterface* updater, m_updaters )
|
||||
foreach( PlaylistUpdaterInterface* updater, d->updaters )
|
||||
{
|
||||
updater->remove();
|
||||
}
|
||||
}
|
||||
|
||||
m_deleted = true;
|
||||
m_source->dbCollection()->deletePlaylist( self );
|
||||
d->deleted = true;
|
||||
d->source->dbCollection()->deletePlaylist( self );
|
||||
|
||||
emit deleted( self );
|
||||
}
|
||||
@ -243,7 +249,8 @@ Playlist::reportDeleted( const Tomahawk::playlist_ptr& self )
|
||||
void
|
||||
Playlist::addUpdater( PlaylistUpdaterInterface* updater )
|
||||
{
|
||||
m_updaters << updater;
|
||||
Q_D( Playlist );
|
||||
d->updaters << updater;
|
||||
|
||||
connect( updater, SIGNAL( changed() ), this, SIGNAL( changed() ), Qt::UniqueConnection );
|
||||
connect( updater, SIGNAL( destroyed( QObject* ) ), this, SIGNAL( changed() ), Qt::QueuedConnection );
|
||||
@ -255,7 +262,8 @@ Playlist::addUpdater( PlaylistUpdaterInterface* updater )
|
||||
void
|
||||
Playlist::removeUpdater( PlaylistUpdaterInterface* updater )
|
||||
{
|
||||
m_updaters.removeAll( updater );
|
||||
Q_D( Playlist );
|
||||
d->updaters.removeAll( updater );
|
||||
|
||||
disconnect( updater, SIGNAL( changed() ), this, SIGNAL( changed() ) );
|
||||
disconnect( updater, SIGNAL( destroyed( QObject* ) ), this, SIGNAL( changed() ) );
|
||||
@ -267,7 +275,8 @@ Playlist::removeUpdater( PlaylistUpdaterInterface* updater )
|
||||
bool
|
||||
Playlist::hasCustomDeleter() const
|
||||
{
|
||||
foreach ( PlaylistUpdaterInterface* updater, m_updaters )
|
||||
Q_D( const Playlist );
|
||||
foreach ( PlaylistUpdaterInterface* updater, d->updaters )
|
||||
{
|
||||
if ( updater->hasCustomDeleter() )
|
||||
return true;
|
||||
@ -280,11 +289,12 @@ Playlist::hasCustomDeleter() const
|
||||
void
|
||||
Playlist::customDelete( const QPoint& leftCenter )
|
||||
{
|
||||
Q_D( Playlist );
|
||||
if ( !hasCustomDeleter() )
|
||||
return;
|
||||
|
||||
Tomahawk::PlaylistDeleteQuestions questions;
|
||||
foreach ( PlaylistUpdaterInterface* updater, m_updaters )
|
||||
foreach ( PlaylistUpdaterInterface* updater, d->updaters )
|
||||
{
|
||||
if ( updater->deleteQuestions().isEmpty() )
|
||||
continue;
|
||||
@ -308,6 +318,7 @@ Playlist::customDelete( const QPoint& leftCenter )
|
||||
void
|
||||
Playlist::onDeleteResult( SourceTreePopupDialog* dialog )
|
||||
{
|
||||
Q_D( Playlist );
|
||||
dialog->deleteLater();
|
||||
|
||||
const bool ret = dialog->resultValue();
|
||||
@ -315,7 +326,7 @@ Playlist::onDeleteResult( SourceTreePopupDialog* dialog )
|
||||
if ( !ret )
|
||||
return;
|
||||
|
||||
playlist_ptr p = m_weakSelf.toStrongRef();
|
||||
playlist_ptr p = d->weakSelf.toStrongRef();
|
||||
if ( p.isNull() )
|
||||
{
|
||||
qWarning() << "Got null m_weakSelf weak ref in Playlsit::onDeleteResult!!";
|
||||
@ -324,7 +335,7 @@ Playlist::onDeleteResult( SourceTreePopupDialog* dialog )
|
||||
}
|
||||
|
||||
const QMap< int, bool > questionResults = dialog->questionResults();
|
||||
foreach ( PlaylistUpdaterInterface* updater, m_updaters )
|
||||
foreach ( PlaylistUpdaterInterface* updater, d->updaters )
|
||||
{
|
||||
updater->setQuestionResults( questionResults );
|
||||
}
|
||||
@ -371,12 +382,13 @@ Playlist::loadRevision( const QString& rev )
|
||||
void
|
||||
Playlist::createNewRevision( const QString& newrev, const QString& oldrev, const QList< plentry_ptr >& entries )
|
||||
{
|
||||
Q_D( Playlist );
|
||||
tDebug() << Q_FUNC_INFO << newrev << oldrev << entries.count();
|
||||
Q_ASSERT( m_source->isLocal() || newrev == oldrev );
|
||||
Q_ASSERT( d->source->isLocal() || newrev == oldrev );
|
||||
|
||||
if ( busy() )
|
||||
{
|
||||
m_revisionQueue.enqueue( RevisionQueueItem( newrev, oldrev, entries, oldrev == currentrevision() ) );
|
||||
d->revisionQueue.enqueue( RevisionQueueItem( newrev, oldrev, entries, oldrev == currentrevision() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -415,12 +427,13 @@ Playlist::createNewRevision( const QString& newrev, const QString& oldrev, const
|
||||
void
|
||||
Playlist::updateEntries( const QString& newrev, const QString& oldrev, const QList< plentry_ptr >& entries )
|
||||
{
|
||||
Q_D( Playlist );
|
||||
tDebug() << Q_FUNC_INFO << newrev << oldrev << entries.count();
|
||||
Q_ASSERT( m_source->isLocal() || newrev == oldrev );
|
||||
Q_ASSERT( d->source->isLocal() || newrev == oldrev );
|
||||
|
||||
if ( busy() )
|
||||
{
|
||||
m_updateQueue.enqueue( RevisionQueueItem( newrev, oldrev, entries, oldrev == currentrevision() ) );
|
||||
d->updateQueue.enqueue( RevisionQueueItem( newrev, oldrev, entries, oldrev == currentrevision() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -428,8 +441,10 @@ Playlist::updateEntries( const QString& newrev, const QString& oldrev, const QLi
|
||||
setBusy( true );
|
||||
|
||||
QStringList orderedguids;
|
||||
foreach( const plentry_ptr& p, m_entries )
|
||||
foreach( const plentry_ptr& p, d->entries )
|
||||
{
|
||||
orderedguids << p->guid();
|
||||
}
|
||||
|
||||
qDebug() << "Updating playlist metadata:" << entries;
|
||||
DatabaseCommand_SetPlaylistRevision* cmd =
|
||||
@ -454,6 +469,7 @@ Playlist::setRevision( const QString& rev,
|
||||
const QMap< QString, Tomahawk::plentry_ptr >& addedmap,
|
||||
bool applied )
|
||||
{
|
||||
Q_D( Playlist );
|
||||
if ( QThread::currentThread() != thread() )
|
||||
{
|
||||
QMetaObject::invokeMethod( this,
|
||||
@ -473,10 +489,10 @@ Playlist::setRevision( const QString& rev,
|
||||
|
||||
Q_ASSERT( applied );
|
||||
if ( applied )
|
||||
m_currentrevision = rev;
|
||||
d->currentrevision = rev;
|
||||
pr.applied = applied;
|
||||
|
||||
foreach( const plentry_ptr& entry, m_entries )
|
||||
foreach( const plentry_ptr& entry, d->entries )
|
||||
{
|
||||
connect( entry.data(), SIGNAL( resultChanged() ), SLOT( onResultsChanged() ), Qt::UniqueConnection );
|
||||
}
|
||||
@ -484,11 +500,11 @@ Playlist::setRevision( const QString& rev,
|
||||
setBusy( false );
|
||||
setLoaded( true );
|
||||
|
||||
if ( m_initEntries.count() && currentrevision().isEmpty() )
|
||||
if ( d->initEntries.count() && currentrevision().isEmpty() )
|
||||
{
|
||||
// add initial tracks
|
||||
createNewRevision( uuid(), currentrevision(), m_initEntries );
|
||||
m_initEntries.clear();
|
||||
createNewRevision( uuid(), currentrevision(), d->initEntries );
|
||||
d->initEntries.clear();
|
||||
}
|
||||
else
|
||||
emit revisionLoaded( pr );
|
||||
@ -504,30 +520,31 @@ Playlist::setNewRevision( const QString& rev,
|
||||
bool is_newest_rev,
|
||||
const QMap< QString, Tomahawk::plentry_ptr >& addedmap )
|
||||
{
|
||||
Q_D( Playlist );
|
||||
Q_UNUSED( oldorderedguids );
|
||||
Q_UNUSED( is_newest_rev );
|
||||
|
||||
// build up correctly ordered new list of plentry_ptrs from
|
||||
// existing ones, and the ones that have been added
|
||||
QMap<QString, plentry_ptr> entriesmap;
|
||||
foreach ( const plentry_ptr& p, m_entries )
|
||||
foreach ( const plentry_ptr& p, d->entries )
|
||||
{
|
||||
tDebug() << p->guid() << p->query()->toString();
|
||||
entriesmap.insert( p->guid(), p );
|
||||
}
|
||||
|
||||
// re-build m_entries from neworderedguids. plentries come either from the old m_entries OR addedmap.
|
||||
m_entries.clear();
|
||||
d->entries.clear();
|
||||
|
||||
foreach ( const QString& id, neworderedguids )
|
||||
{
|
||||
if ( entriesmap.contains( id ) )
|
||||
{
|
||||
m_entries.append( entriesmap.value( id ) );
|
||||
d->entries.append( entriesmap.value( id ) );
|
||||
}
|
||||
else if ( addedmap.contains( id ) )
|
||||
{
|
||||
m_entries.append( addedmap.value( id ) );
|
||||
d->entries.append( addedmap.value( id ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -535,7 +552,7 @@ Playlist::setNewRevision( const QString& rev,
|
||||
tDebug() << "newordered:" << neworderedguids.count() << neworderedguids;
|
||||
tDebug() << "entriesmap:" << entriesmap.count() << entriesmap;
|
||||
tDebug() << "addedmap:" << addedmap.count() << addedmap;
|
||||
tDebug() << "m_entries" << m_entries;
|
||||
tDebug() << "m_entries" << d->entries;
|
||||
|
||||
tLog() << "Playlist error for playlist with guid" << guid() << "from source" << author()->friendlyName();
|
||||
// Q_ASSERT( false ); // XXX
|
||||
@ -543,27 +560,35 @@ Playlist::setNewRevision( const QString& rev,
|
||||
}
|
||||
|
||||
PlaylistRevision pr;
|
||||
pr.oldrevisionguid = m_currentrevision;
|
||||
pr.oldrevisionguid = d->currentrevision;
|
||||
pr.revisionguid = rev;
|
||||
pr.added = addedmap.values();
|
||||
pr.newlist = m_entries;
|
||||
pr.newlist = d->entries;
|
||||
|
||||
return pr;
|
||||
}
|
||||
|
||||
Playlist::Playlist( PlaylistPrivate *d )
|
||||
: d_ptr( d )
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
source_ptr
|
||||
Playlist::author() const
|
||||
{
|
||||
return m_source;
|
||||
Q_D( const Playlist );
|
||||
return d->source;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::resolve()
|
||||
{
|
||||
Q_D( Playlist );
|
||||
QList< query_ptr > qlist;
|
||||
foreach( const plentry_ptr& p, m_entries )
|
||||
foreach( const plentry_ptr& p, d->entries )
|
||||
{
|
||||
qlist << p->query();
|
||||
}
|
||||
@ -575,17 +600,19 @@ Playlist::resolve()
|
||||
void
|
||||
Playlist::onResultsChanged()
|
||||
{
|
||||
m_locallyChanged = true;
|
||||
Q_D( Playlist );
|
||||
d->locallyChanged = true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::onResolvingFinished()
|
||||
{
|
||||
if ( m_locallyChanged && !m_deleted )
|
||||
Q_D( Playlist );
|
||||
if ( d->locallyChanged && !d->deleted )
|
||||
{
|
||||
m_locallyChanged = false;
|
||||
createNewRevision( currentrevision(), currentrevision(), m_entries );
|
||||
d->locallyChanged = false;
|
||||
createNewRevision( currentrevision(), currentrevision(), d->entries );
|
||||
}
|
||||
}
|
||||
|
||||
@ -603,19 +630,20 @@ Playlist::addEntry( const query_ptr& query )
|
||||
void
|
||||
Playlist::addEntries( const QList<query_ptr>& queries )
|
||||
{
|
||||
if ( !m_loaded )
|
||||
Q_D( Playlist );
|
||||
if ( !d->loaded )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "Queueing addEntries call!";
|
||||
loadRevision();
|
||||
m_queuedOps << NewClosure( 0, "", this, SLOT( addEntries( QList<Tomahawk::query_ptr> ) ), queries );
|
||||
d->queuedOps << NewClosure( 0, "", this, SLOT( addEntries( QList<Tomahawk::query_ptr> ) ), queries );
|
||||
return;
|
||||
}
|
||||
|
||||
const QList<plentry_ptr> el = entriesFromQueries( queries );
|
||||
const int prevSize = m_entries.size();
|
||||
const int prevSize = d->entries.size();
|
||||
|
||||
QString newrev = uuid();
|
||||
createNewRevision( newrev, m_currentrevision, el );
|
||||
createNewRevision( newrev, d->currentrevision, el );
|
||||
|
||||
// We are appending at end, so notify listeners.
|
||||
// PlaylistModel also emits during appends, but since we call
|
||||
@ -629,19 +657,20 @@ Playlist::addEntries( const QList<query_ptr>& queries )
|
||||
void
|
||||
Playlist::insertEntries( const QList< query_ptr >& queries, const int position )
|
||||
{
|
||||
if ( !m_loaded )
|
||||
Q_D( Playlist );
|
||||
if ( !d->loaded )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "Queueing insertEntries call!";
|
||||
loadRevision();
|
||||
m_queuedOps << NewClosure( 0, "", this, SLOT( insertEntries( QList<Tomahawk::query_ptr>, int ) ), queries, position );
|
||||
d->queuedOps << NewClosure( 0, "", this, SLOT( insertEntries( QList<Tomahawk::query_ptr>, int ) ), queries, position );
|
||||
return;
|
||||
}
|
||||
|
||||
QList<plentry_ptr> toInsert = entriesFromQueries( queries, true );
|
||||
QList<plentry_ptr> entries = m_entries;
|
||||
QList<plentry_ptr> entries = d->entries;
|
||||
|
||||
Q_ASSERT( position <= m_entries.size() );
|
||||
if ( position > m_entries.size() )
|
||||
Q_ASSERT( position <= d->entries.size() );
|
||||
if ( position > d->entries.size() )
|
||||
{
|
||||
tDebug() << "ERROR trying to insert tracks past end of playlist! Appending!";
|
||||
addEntries( queries );
|
||||
@ -651,7 +680,7 @@ Playlist::insertEntries( const QList< query_ptr >& queries, const int position )
|
||||
for ( int i = toInsert.size()-1; i >= 0; --i )
|
||||
entries.insert( position, toInsert.at(i) );
|
||||
|
||||
createNewRevision( uuid(), m_currentrevision, entries );
|
||||
createNewRevision( uuid(), d->currentrevision, entries );
|
||||
|
||||
// We are appending at end, so notify listeners.
|
||||
// PlaylistModel also emits during appends, but since we call
|
||||
@ -690,8 +719,9 @@ Playlist::entriesFromQueries( const QList<Tomahawk::query_ptr>& queries, bool cl
|
||||
QList< plentry_ptr >
|
||||
Playlist::newEntries( const QList< plentry_ptr >& entries )
|
||||
{
|
||||
Q_D( Playlist );
|
||||
QSet<QString> currentguids;
|
||||
foreach( const plentry_ptr& p, m_entries )
|
||||
foreach( const plentry_ptr& p, d->entries )
|
||||
currentguids.insert( p->guid() ); // could be cached as member?
|
||||
|
||||
// calc list of newly added entries:
|
||||
@ -708,7 +738,8 @@ Playlist::newEntries( const QList< plentry_ptr >& entries )
|
||||
void
|
||||
Playlist::setBusy( bool b )
|
||||
{
|
||||
m_busy = b;
|
||||
Q_D( Playlist );
|
||||
d->busy = b;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
@ -716,16 +747,18 @@ Playlist::setBusy( bool b )
|
||||
void
|
||||
Playlist::setLoaded( bool b )
|
||||
{
|
||||
m_loaded = b;
|
||||
Q_D( Playlist );
|
||||
d->loaded = b;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::checkRevisionQueue()
|
||||
{
|
||||
if ( !m_revisionQueue.isEmpty() )
|
||||
Q_D( Playlist );
|
||||
if ( !d->revisionQueue.isEmpty() )
|
||||
{
|
||||
RevisionQueueItem item = m_revisionQueue.dequeue();
|
||||
RevisionQueueItem item = d->revisionQueue.dequeue();
|
||||
|
||||
if ( item.oldRev != currentrevision() && item.applyToTip )
|
||||
{
|
||||
@ -740,9 +773,9 @@ Playlist::checkRevisionQueue()
|
||||
}
|
||||
createNewRevision( item.newRev, item.oldRev, item.entries );
|
||||
}
|
||||
if ( !m_updateQueue.isEmpty() )
|
||||
if ( !d->updateQueue.isEmpty() )
|
||||
{
|
||||
RevisionQueueItem item = m_updateQueue.dequeue();
|
||||
RevisionQueueItem item = d->updateQueue.dequeue();
|
||||
|
||||
if ( item.oldRev != currentrevision() && item.applyToTip )
|
||||
{
|
||||
@ -758,9 +791,9 @@ Playlist::checkRevisionQueue()
|
||||
updateEntries( item.newRev, item.oldRev, item.entries );
|
||||
}
|
||||
|
||||
if ( !m_queuedOps.isEmpty() )
|
||||
if ( !d->queuedOps.isEmpty() )
|
||||
{
|
||||
_detail::Closure* next = m_queuedOps.dequeue();
|
||||
_detail::Closure* next = d->queuedOps.dequeue();
|
||||
next->forceInvoke();
|
||||
}
|
||||
}
|
||||
@ -769,143 +802,163 @@ Playlist::checkRevisionQueue()
|
||||
void
|
||||
Playlist::setWeakSelf( QWeakPointer< Playlist > self )
|
||||
{
|
||||
m_weakSelf = self;
|
||||
Q_D( Playlist );
|
||||
d->weakSelf = self;
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::playlistinterface_ptr
|
||||
Playlist::playlistInterface()
|
||||
{
|
||||
if ( m_playlistInterface.isNull() )
|
||||
Q_D( Playlist );
|
||||
if ( d->playlistInterface.isNull() )
|
||||
{
|
||||
m_playlistInterface = Tomahawk::playlistinterface_ptr( new Tomahawk::PlaylistPlaylistInterface( this ) );
|
||||
d->playlistInterface = Tomahawk::playlistinterface_ptr( new Tomahawk::PlaylistPlaylistInterface( this ) );
|
||||
}
|
||||
|
||||
return m_playlistInterface;
|
||||
return d->playlistInterface;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Playlist::currentrevision() const
|
||||
{
|
||||
return m_currentrevision;
|
||||
Q_D( const Playlist );
|
||||
return d->currentrevision;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Playlist::title() const
|
||||
{
|
||||
return m_title;
|
||||
Q_D( const Playlist );
|
||||
return d->title;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Playlist::info() const
|
||||
{
|
||||
return m_info;
|
||||
Q_D( const Playlist );
|
||||
return d->info;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Playlist::creator() const
|
||||
{
|
||||
return m_creator;
|
||||
Q_D( const Playlist );
|
||||
return d->creator;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Playlist::guid() const
|
||||
{
|
||||
return m_guid;
|
||||
Q_D( const Playlist );
|
||||
return d->guid;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Playlist::shared() const
|
||||
{
|
||||
return m_shared;
|
||||
Q_D( const Playlist );
|
||||
return d->shared;
|
||||
}
|
||||
|
||||
|
||||
unsigned int
|
||||
Playlist::lastmodified() const
|
||||
{
|
||||
return m_lastmodified;
|
||||
Q_D( const Playlist );
|
||||
return d->lastmodified;
|
||||
}
|
||||
|
||||
|
||||
uint
|
||||
Playlist::createdOn() const
|
||||
{
|
||||
return m_createdOn;
|
||||
Q_D( const Playlist );
|
||||
return d->createdOn;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Playlist::busy() const
|
||||
{
|
||||
return m_busy;
|
||||
Q_D( const Playlist );
|
||||
return d->busy;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Playlist::loaded() const
|
||||
{
|
||||
return m_loaded;
|
||||
Q_D( const Playlist );
|
||||
return d->loaded;
|
||||
}
|
||||
|
||||
|
||||
const QList<plentry_ptr>&
|
||||
Playlist::entries()
|
||||
{
|
||||
return m_entries;
|
||||
Q_D( const Playlist );
|
||||
return d->entries;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::setCurrentrevision( const QString& s )
|
||||
{
|
||||
m_currentrevision = s;
|
||||
Q_D( Playlist );
|
||||
d->currentrevision = s;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::setInfo( const QString& s )
|
||||
{
|
||||
m_info = s;
|
||||
Q_D( Playlist );
|
||||
d->info = s;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::setCreator( const QString& s )
|
||||
{
|
||||
m_creator = s;
|
||||
Q_D( Playlist );
|
||||
d->creator = s;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::setGuid( const QString& s )
|
||||
{
|
||||
m_guid = s;
|
||||
Q_D( Playlist );
|
||||
d->guid = s;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::setShared( bool b )
|
||||
{
|
||||
m_shared = b;
|
||||
Q_D( Playlist );
|
||||
d->shared = b;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::setCreatedOn( uint createdOn )
|
||||
{
|
||||
m_createdOn = createdOn;
|
||||
Q_D( Playlist );
|
||||
d->createdOn = createdOn;
|
||||
}
|
||||
|
||||
|
||||
QList<PlaylistUpdaterInterface *>
|
||||
Playlist::updaters() const
|
||||
{
|
||||
return m_updaters;
|
||||
Q_D( const Playlist );
|
||||
return d->updaters;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
* Copyright 2013 , Uwe L. Korn <uwelk@xhochy.com>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -48,6 +49,7 @@ namespace _detail
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
class PlaylistPrivate;
|
||||
class PlaylistUpdaterInterface;
|
||||
|
||||
struct PlaylistRevision
|
||||
@ -60,18 +62,6 @@ struct PlaylistRevision
|
||||
bool applied; // false if conflict
|
||||
};
|
||||
|
||||
struct RevisionQueueItem
|
||||
{
|
||||
public:
|
||||
QString newRev;
|
||||
QString oldRev;
|
||||
QList< plentry_ptr > entries;
|
||||
bool applyToTip;
|
||||
|
||||
RevisionQueueItem( const QString& nRev, const QString& oRev, const QList< plentry_ptr >& e, bool latest ) :
|
||||
newRev( nRev ), oldRev( oRev), entries( e ), applyToTip( latest ) {}
|
||||
};
|
||||
|
||||
|
||||
class DLLEXPORT Playlist : public QObject
|
||||
{
|
||||
@ -246,7 +236,14 @@ protected:
|
||||
const QString& info,
|
||||
const QString& creator,
|
||||
bool shared,
|
||||
const QList< Tomahawk::plentry_ptr >& entries = QList< Tomahawk::plentry_ptr >() );
|
||||
const QList< Tomahawk::plentry_ptr >& entries );
|
||||
|
||||
explicit Playlist( const source_ptr& author,
|
||||
const QString& guid,
|
||||
const QString& title,
|
||||
const QString& info,
|
||||
const QString& creator,
|
||||
bool shared);
|
||||
|
||||
QList< plentry_ptr > newEntries( const QList< plentry_ptr >& entries );
|
||||
PlaylistRevision setNewRevision( const QString& rev,
|
||||
@ -254,7 +251,9 @@ protected:
|
||||
const QList<QString>& oldorderedguids,
|
||||
bool is_newest_rev,
|
||||
const QMap< QString, Tomahawk::plentry_ptr >& addedmap );
|
||||
Playlist( PlaylistPrivate* d );
|
||||
|
||||
Tomahawk::PlaylistPrivate* d_ptr;
|
||||
private slots:
|
||||
void onResultsChanged();
|
||||
void onResolvingFinished();
|
||||
@ -269,29 +268,7 @@ private:
|
||||
void setLoaded( bool b );
|
||||
void checkRevisionQueue();
|
||||
|
||||
QWeakPointer< Playlist > m_weakSelf;
|
||||
source_ptr m_source;
|
||||
QString m_currentrevision;
|
||||
QString m_guid, m_title, m_info, m_creator;
|
||||
unsigned int m_lastmodified;
|
||||
unsigned int m_createdOn;
|
||||
bool m_shared;
|
||||
bool m_loaded;
|
||||
|
||||
QQueue<_detail::Closure*> m_queuedOps;
|
||||
QList< plentry_ptr > m_initEntries;
|
||||
QList< plentry_ptr > m_entries;
|
||||
|
||||
QQueue<RevisionQueueItem> m_revisionQueue;
|
||||
QQueue<RevisionQueueItem> m_updateQueue;
|
||||
|
||||
QList<PlaylistUpdaterInterface*> m_updaters;
|
||||
|
||||
bool m_locallyChanged;
|
||||
bool m_deleted;
|
||||
bool m_busy;
|
||||
|
||||
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
||||
Q_DECLARE_PRIVATE( Tomahawk::Playlist )
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -19,11 +19,12 @@
|
||||
|
||||
#include "PlaylistPlaylistInterface.h"
|
||||
|
||||
#include "Playlist.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Playlist.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
|
124
src/libtomahawk/Playlist_p.h
Normal file
124
src/libtomahawk/Playlist_p.h
Normal file
@ -0,0 +1,124 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
* Copyright 2013 , Uwe L. Korn <uwelk@xhochy.com>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PLAYLIST_P_H
|
||||
#define PLAYLIST_P_H
|
||||
|
||||
#include "Playlist.h"
|
||||
|
||||
#include "playlist/RevisionQueueItem.h"
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
class PlaylistPrivate
|
||||
{
|
||||
friend class DynamicPlaylist;
|
||||
public:
|
||||
PlaylistPrivate( Playlist* q )
|
||||
: q_ptr( q )
|
||||
{
|
||||
}
|
||||
|
||||
PlaylistPrivate( Playlist* q, const source_ptr& _author )
|
||||
: q_ptr( q )
|
||||
, source( _author )
|
||||
, lastmodified( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
PlaylistPrivate( Playlist* q, const source_ptr& _src,
|
||||
const QString& _currentrevision,
|
||||
const QString& _title,
|
||||
const QString& _info,
|
||||
const QString& _creator,
|
||||
uint _createdOn,
|
||||
bool _shared,
|
||||
int _lastmod,
|
||||
const QString& _guid )
|
||||
: q_ptr( q )
|
||||
, source( _src )
|
||||
, currentrevision( _currentrevision )
|
||||
, guid( _guid == "" ? uuid() : _guid )
|
||||
, title( _title )
|
||||
, info( _info )
|
||||
, creator( _creator )
|
||||
, lastmodified( _lastmod )
|
||||
, createdOn( _createdOn )
|
||||
, shared( _shared )
|
||||
{
|
||||
}
|
||||
|
||||
PlaylistPrivate( Playlist* q, const source_ptr& _author,
|
||||
const QString& _guid,
|
||||
const QString& _title,
|
||||
const QString& _info,
|
||||
const QString& _creator,
|
||||
bool _shared,
|
||||
const QList< Tomahawk::plentry_ptr >& _entries )
|
||||
: q_ptr( q )
|
||||
, source( _author )
|
||||
, guid( _guid )
|
||||
, title( _title )
|
||||
, info ( _info )
|
||||
, creator( _creator )
|
||||
, lastmodified( 0 )
|
||||
, createdOn( 0 ) // will be set by db command
|
||||
, shared( _shared )
|
||||
, initEntries( _entries )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Playlist* q_ptr;
|
||||
Q_DECLARE_PUBLIC ( Playlist )
|
||||
private:
|
||||
QWeakPointer< Playlist > weakSelf;
|
||||
source_ptr source;
|
||||
QString currentrevision;
|
||||
QString guid;
|
||||
QString title;
|
||||
QString info;
|
||||
QString creator;
|
||||
unsigned int lastmodified;
|
||||
unsigned int createdOn;
|
||||
bool shared;
|
||||
bool loaded;
|
||||
|
||||
QQueue<_detail::Closure*> queuedOps;
|
||||
QList< plentry_ptr > initEntries;
|
||||
QList< plentry_ptr > entries;
|
||||
|
||||
QQueue<RevisionQueueItem> revisionQueue;
|
||||
QQueue<RevisionQueueItem> updateQueue;
|
||||
|
||||
QList<PlaylistUpdaterInterface*> updaters;
|
||||
|
||||
bool locallyChanged;
|
||||
bool deleted;
|
||||
bool busy;
|
||||
|
||||
Tomahawk::playlistinterface_ptr playlistInterface;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // PLAYLIST_P_H
|
@ -20,16 +20,16 @@
|
||||
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
#include "Source.h"
|
||||
#include "PlaylistInterface.h"
|
||||
|
||||
#include "database/DatabaseCommand_UpdateSearchIndex.h"
|
||||
#include "database/Database.h"
|
||||
#include "infosystem/InfoSystemCache.h"
|
||||
#include "playlist/PlaylistUpdaterInterface.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
|
||||
#include "database/DatabaseCommand_UpdateSearchIndex.h"
|
||||
#include "database/Database.h"
|
||||
#include "playlist/PlaylistUpdaterInterface.h"
|
||||
#include "infosystem/InfoSystemCache.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "PlaylistInterface.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <qtkeychain/keychain.h>
|
||||
#include <QDir>
|
||||
|
@ -22,19 +22,21 @@
|
||||
#include <QtAlgorithms>
|
||||
#include <QReadWriteLock>
|
||||
|
||||
#include "audio/AudioEngine.h"
|
||||
#include "collection/Collection.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseImpl.h"
|
||||
#include "database/DatabaseCommand_LogPlayback.h"
|
||||
#include "database/DatabaseCommand_ModifyInboxEntry.h"
|
||||
#include "Album.h"
|
||||
#include "collection/Collection.h"
|
||||
#include "Pipeline.h"
|
||||
#include "resolvers/Resolver.h"
|
||||
#include "SourceList.h"
|
||||
#include "audio/AudioEngine.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "Pipeline.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
QHash< QString, track_wptr > Track::s_tracksByName = QHash< QString, track_wptr >();
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include <QtAlgorithms>
|
||||
#include <QReadWriteLock>
|
||||
|
||||
#include "audio/AudioEngine.h"
|
||||
#include "collection/Collection.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseImpl.h"
|
||||
#include "database/DatabaseCommand_LogPlayback.h"
|
||||
@ -31,14 +33,13 @@
|
||||
#include "database/DatabaseCommand_SocialAction.h"
|
||||
#include "database/DatabaseCommand_TrackStats.h"
|
||||
#include "database/IdThreadWorker.h"
|
||||
#include "Album.h"
|
||||
#include "collection/Collection.h"
|
||||
#include "resolvers/Resolver.h"
|
||||
#include "SourceList.h"
|
||||
#include "audio/AudioEngine.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
QHash< QString, trackdata_wptr > TrackData::s_trackDatasByName = QHash< QString, trackdata_wptr >();
|
||||
|
@ -19,22 +19,25 @@
|
||||
|
||||
#include "ResolverAccount.h"
|
||||
|
||||
#include "AccountManager.h"
|
||||
#include "AtticaManager.h"
|
||||
#include "resolvers/ExternalResolver.h"
|
||||
#include "resolvers/ExternalResolverGui.h"
|
||||
#include "Pipeline.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "Source.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "qjson/parser.h"
|
||||
#include "jobview/JobStatusView.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
#include "jobview/ErrorStatusMessage.h"
|
||||
#include "resolvers/ExternalResolver.h"
|
||||
#include "resolvers/ExternalResolverGui.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "Artist.h"
|
||||
#include "AccountManager.h"
|
||||
#include "AtticaManager.h"
|
||||
#include "Pipeline.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "TomahawkVersion.h"
|
||||
|
||||
#include "qjson/parser.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
@ -18,20 +18,23 @@
|
||||
*/
|
||||
|
||||
#include "SpotifyAccount.h"
|
||||
#include "Playlist.h"
|
||||
|
||||
#include "accounts/AccountManager.h"
|
||||
#include "infosystem/InfoSystem.h"
|
||||
#include "playlist/PlaylistUpdaterInterface.h"
|
||||
#include "SourceList.h"
|
||||
#include "SpotifyAccountConfig.h"
|
||||
#include "SpotifyPlaylistUpdater.h"
|
||||
#include "resolvers/ScriptResolver.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
|
||||
#include "ActionCollection.h"
|
||||
#include "Pipeline.h"
|
||||
#include "accounts/AccountManager.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "Playlist.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
#include "SpotifyAccountConfig.h"
|
||||
#include "SpotifyInfoPlugin.h"
|
||||
#include "infosystem/InfoSystem.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "SpotifyPlaylistUpdater.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
|
@ -23,19 +23,20 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "TomahawkSettings.h"
|
||||
#include "network/Servent.h"
|
||||
#include "utils/Qnr_IoDeviceStream.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "Pipeline.h"
|
||||
#include "jobview/JobStatusView.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
#include "jobview/ErrorStatusMessage.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
#include "network/Servent.h"
|
||||
#include "playlist/SingleTrackPlaylistInterface.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Qnr_IoDeviceStream.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "Artist.h"
|
||||
#include "Pipeline.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
|
@ -19,13 +19,14 @@
|
||||
|
||||
#include "collection/Collection.h"
|
||||
|
||||
#include "Source.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
#include "playlist/PlaylistUpdaterInterface.h"
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "accounts/AccountManager.h"
|
||||
#include "playlist/PlaylistUpdaterInterface.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QMetaObject>
|
||||
#include <QGenericArgument>
|
||||
|
@ -19,11 +19,14 @@
|
||||
|
||||
#include "Database.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseCommand.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "DatabaseWorker.h"
|
||||
#include "IdThreadWorker.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "PlaylistEntry.h"
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
#define DEFAULT_WORKER_THREADS 4
|
||||
|
@ -21,17 +21,18 @@
|
||||
#include "DatabaseCollection.h"
|
||||
|
||||
#include "database/Database.h"
|
||||
#include "DatabaseCommand_AllArtists.h"
|
||||
#include "DatabaseCommand_AllAlbums.h"
|
||||
#include "DatabaseCommand_AllTracks.h"
|
||||
#include "DatabaseCommand_AddFiles.h"
|
||||
#include "DatabaseCommand_DeleteFiles.h"
|
||||
#include "DatabaseCommand_LoadAllPlaylists.h"
|
||||
#include "DatabaseCommand_LoadAllAutoPlaylists.h"
|
||||
#include "DatabaseCommand_LoadAllStations.h"
|
||||
|
||||
#include "database/DatabaseCommand_AllArtists.h"
|
||||
#include "database/DatabaseCommand_AllAlbums.h"
|
||||
#include "database/DatabaseCommand_AllTracks.h"
|
||||
#include "database/DatabaseCommand_AddFiles.h"
|
||||
#include "database/DatabaseCommand_DeleteFiles.h"
|
||||
#include "database/DatabaseCommand_LoadAllPlaylists.h"
|
||||
#include "database/DatabaseCommand_LoadAllAutoPlaylists.h"
|
||||
#include "database/DatabaseCommand_LoadAllStations.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
|
@ -18,18 +18,19 @@
|
||||
|
||||
#include "DatabaseCommand_AddFiles.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "collection/Collection.h"
|
||||
#include "database/Database.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "network/DbSyncConnection.h"
|
||||
#include "network/Servent.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "Artist.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
#include <QSqlQuery>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
@ -20,12 +20,14 @@
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "Artist.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "Source.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
|
||||
DatabaseCommand_AllAlbums::DatabaseCommand_AllAlbums( const Tomahawk::collection_ptr& collection, const Tomahawk::artist_ptr& artist, QObject* parent )
|
||||
: DatabaseCommand( parent )
|
||||
|
@ -18,14 +18,15 @@
|
||||
|
||||
#include "DatabaseCommand_AllArtists.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "Artist.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "Source.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
DatabaseCommand_AllArtists::DatabaseCommand_AllArtists( const Tomahawk::collection_ptr& collection, QObject* parent )
|
||||
: DatabaseCommand( parent )
|
||||
|
@ -18,10 +18,12 @@
|
||||
|
||||
#include "DatabaseCommand_ArtistStats.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
// Forward Declarations breaking QSharedPointer
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
|
||||
|
@ -18,16 +18,17 @@
|
||||
|
||||
#include "DatabaseCommand_CreateDynamicPlaylist.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "TomahawkSqlQuery.h"
|
||||
#include "playlist/dynamic/DynamicPlaylist.h"
|
||||
#include "playlist/dynamic/DynamicControl.h"
|
||||
#include "playlist/dynamic/GeneratorInterface.h"
|
||||
|
||||
#include "SourceList.h"
|
||||
#include "network/Servent.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSqlQuery.h"
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
#include "ViewManager.h"
|
||||
#endif
|
||||
|
@ -21,16 +21,18 @@
|
||||
|
||||
#include <QtSql/QSqlQuery>
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "collection/Collection.h"
|
||||
#include "Source.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseImpl.h"
|
||||
#include "network/Servent.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
|
@ -18,13 +18,15 @@
|
||||
|
||||
#include "DatabaseCommand_GenericSelect.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "SourceList.h"
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "Pipeline.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "Artist.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "Pipeline.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
|
@ -18,11 +18,12 @@
|
||||
|
||||
#include "DatabaseCommand_LoadAllAutoPlaylists.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "Source.h"
|
||||
#include "playlist/dynamic/DynamicPlaylist.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
|
@ -19,13 +19,15 @@
|
||||
|
||||
#include "DatabaseCommand_LoadAllPlaylists.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "Playlist.h"
|
||||
#include "Source.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "Playlist.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
|
@ -18,12 +18,13 @@
|
||||
|
||||
#include "DatabaseCommand_LoadAllStations.h"
|
||||
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "Source.h"
|
||||
#include "playlist/dynamic/DynamicPlaylist.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
@ -18,10 +18,11 @@
|
||||
|
||||
#include "DatabaseCommand_LoadDynamicPlaylist.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "Source.h"
|
||||
#include "playlist/dynamic/DynamicPlaylist.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
@ -18,14 +18,17 @@
|
||||
|
||||
#include "DatabaseCommand_LoadDynamicPlaylistEntries.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "TomahawkSqlQuery.h"
|
||||
#include "playlist/dynamic/DynamicControl.h"
|
||||
#include "playlist/dynamic/GeneratorInterface.h"
|
||||
#include "playlist/dynamic/GeneratorFactory.h"
|
||||
#include "qjson/parser.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
#include "TomahawkSqlQuery.h"
|
||||
|
||||
#include "qjson/parser.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
#include <QString>
|
||||
|
@ -18,9 +18,11 @@
|
||||
|
||||
#include "DatabaseCommand_LoadFiles.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "collection/Collection.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
|
||||
|
@ -18,14 +18,17 @@
|
||||
|
||||
#include "DatabaseCommand_LoadPlaylistEntries.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Query.h"
|
||||
#include "qjson/parser.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include "qjson/parser.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
@ -131,3 +134,10 @@ DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
|
||||
|
||||
// qDebug() << Q_FUNC_INFO << "entrymap:" << m_entrymap;
|
||||
}
|
||||
|
||||
DatabaseCommand_LoadPlaylistEntries::DatabaseCommand_LoadPlaylistEntries( QString revision_guid, QObject *parent )
|
||||
: DatabaseCommand( parent )
|
||||
, m_islatest( true )
|
||||
, m_revguid( revision_guid )
|
||||
{
|
||||
}
|
||||
|
@ -33,9 +33,7 @@ class DLLEXPORT DatabaseCommand_LoadPlaylistEntries : public DatabaseCommand
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DatabaseCommand_LoadPlaylistEntries( QString revision_guid, QObject* parent = 0 )
|
||||
: DatabaseCommand( parent ), m_islatest( true ), m_revguid( revision_guid )
|
||||
{}
|
||||
explicit DatabaseCommand_LoadPlaylistEntries( QString revision_guid, QObject* parent = 0 );
|
||||
|
||||
virtual void exec( DatabaseImpl* );
|
||||
virtual bool doesMutates() const { return false; }
|
||||
|
@ -21,11 +21,13 @@
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "database/Database.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "network/Servent.h"
|
||||
#include "Result.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Result.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
|
@ -21,11 +21,13 @@
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "database/Database.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "network/Servent.h"
|
||||
#include "Result.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Result.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
|
@ -23,10 +23,12 @@
|
||||
|
||||
#include "collection/Collection.h"
|
||||
#include "database/Database.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "network/Servent.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
|
||||
#define STARTED_THRESHOLD 600 // Don't advertise tracks older than X seconds as currently playing
|
||||
#define FINISHED_THRESHOLD 10 // Don't store tracks played less than X seconds in the playback log
|
||||
#define SUBMISSION_THRESHOLD 20 // Don't broadcast playback logs when a track was played less than X seconds
|
||||
|
@ -20,7 +20,9 @@
|
||||
#include "DatabaseCommand_ModifyPlaylist.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Playlist.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
@ -18,14 +18,15 @@
|
||||
|
||||
#include "DatabaseCommand_PlaybackCharts.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "Artist.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "Source.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
DatabaseCommand_PlaybackCharts::DatabaseCommand_PlaybackCharts( const Tomahawk::source_ptr& source, QObject* parent )
|
||||
: DatabaseCommand( parent )
|
||||
|
@ -18,14 +18,16 @@
|
||||
|
||||
#include "DatabaseCommand_RenamePlaylist.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "collection/Collection.h"
|
||||
#include "Source.h"
|
||||
#include "network/Servent.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
|
@ -18,12 +18,14 @@
|
||||
|
||||
#include "DatabaseCommand_Resolve.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "Pipeline.h"
|
||||
#include "SourceList.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "Artist.h"
|
||||
#include "Pipeline.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
#include "TomahawkSqlQuery.h"
|
||||
#include "Track.h"
|
||||
@ -279,3 +280,34 @@ DatabaseCommand_SetPlaylistRevision::exec( DatabaseImpl* lib )
|
||||
Q_ASSERT( !source()->isLocal() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DatabaseCommand_SetPlaylistRevision::setAddedentriesV( const QVariantList& vlist )
|
||||
{
|
||||
m_addedentries.clear();
|
||||
foreach( const QVariant& v, vlist )
|
||||
{
|
||||
PlaylistEntry* pep = new PlaylistEntry;
|
||||
QJson::QObjectHelper::qvariant2qobject( v.toMap(), pep );
|
||||
|
||||
if ( pep->isValid() )
|
||||
m_addedentries << plentry_ptr( pep );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QVariantList
|
||||
DatabaseCommand_SetPlaylistRevision::addedentriesV() const
|
||||
{
|
||||
QVariantList vlist;
|
||||
foreach( const plentry_ptr& pe, m_addedentries )
|
||||
{
|
||||
if ( !pe->isValid() )
|
||||
continue;
|
||||
|
||||
QVariant v = QJson::QObjectHelper::qobject2qvariant( pe.data() );
|
||||
vlist << v;
|
||||
}
|
||||
return vlist;
|
||||
}
|
||||
|
@ -72,32 +72,9 @@ public:
|
||||
virtual bool localOnly() const { return m_localOnly; }
|
||||
virtual bool groupable() const { return true; }
|
||||
|
||||
void setAddedentriesV( const QVariantList& vlist )
|
||||
{
|
||||
m_addedentries.clear();
|
||||
foreach( const QVariant& v, vlist )
|
||||
{
|
||||
PlaylistEntry* pep = new PlaylistEntry;
|
||||
QJson::QObjectHelper::qvariant2qobject( v.toMap(), pep );
|
||||
void setAddedentriesV( const QVariantList& vlist );
|
||||
|
||||
if ( pep->isValid() )
|
||||
m_addedentries << plentry_ptr( pep );
|
||||
}
|
||||
}
|
||||
|
||||
QVariantList addedentriesV() const
|
||||
{
|
||||
QVariantList vlist;
|
||||
foreach( const plentry_ptr& pe, m_addedentries )
|
||||
{
|
||||
if ( !pe->isValid() )
|
||||
continue;
|
||||
|
||||
QVariant v = QJson::QObjectHelper::qobject2qvariant( pe.data() );
|
||||
vlist << v;
|
||||
}
|
||||
return vlist;
|
||||
}
|
||||
QVariantList addedentriesV() const;
|
||||
|
||||
void setPlaylistguid( const QString& s ) { m_playlistguid = s; }
|
||||
|
||||
|
@ -18,15 +18,18 @@
|
||||
|
||||
#include "DatabaseCommand_ShareTrack.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Database.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "network/Servent.h"
|
||||
#include "ViewManager.h"
|
||||
#include "playlist/InboxModel.h"
|
||||
#include "jobview/JobStatusView.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
#include "jobview/InboxJobItem.h"
|
||||
#include "playlist/InboxModel.h"
|
||||
#include "network/Servent.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Database.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "ViewManager.h"
|
||||
|
||||
|
||||
DatabaseCommand_ShareTrack::DatabaseCommand_ShareTrack( QObject* parent )
|
||||
: DatabaseCommand_SocialAction( parent )
|
||||
|
@ -18,13 +18,15 @@
|
||||
|
||||
#include "DatabaseCommand_SocialAction.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "database/Database.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "network/Servent.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
|
@ -18,10 +18,12 @@
|
||||
|
||||
#include "DatabaseCommand_TrackStats.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
// Forward Declarations breaking QSharedPointer
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
|
||||
|
@ -20,6 +20,17 @@
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
|
||||
#include "database/Database.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "Artist.h"
|
||||
#include "FuzzyIndex.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Result.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
#include <QtAlgorithms>
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
@ -27,15 +38,6 @@
|
||||
#include <QStringList>
|
||||
#include <QTimer>
|
||||
|
||||
#include "database/Database.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "Album.h"
|
||||
#include "Artist.h"
|
||||
#include "FuzzyIndex.h"
|
||||
#include "Result.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
/* !!!! You need to manually generate Schema.sql.h when the schema changes:
|
||||
cd src/libtomahawk/database
|
||||
./gen_schema.h.sh ./Schema.sql tomahawk > Schema.sql.h
|
||||
|
@ -18,14 +18,15 @@
|
||||
|
||||
#include "DatabaseResolver.h"
|
||||
|
||||
#include "Pipeline.h"
|
||||
#include "network/Servent.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseCommand_Resolve.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include "network/Servent.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Pipeline.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
|
||||
DatabaseResolver::DatabaseResolver( int weight )
|
||||
: Resolver()
|
||||
|
@ -19,16 +19,18 @@
|
||||
|
||||
#include "DatabaseWorker.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
#include <QSqlQuery>
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Source.h"
|
||||
#include "Database.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "DatabaseCommandLoggable.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
#include "TomahawkSqlQuery.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
#include <QSqlQuery>
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
//#define DEBUG_TIMING TRUE
|
||||
|
@ -18,6 +18,14 @@
|
||||
|
||||
#include "FuzzyIndex.h"
|
||||
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "Database.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QTime>
|
||||
#include <QTimer>
|
||||
@ -25,12 +33,6 @@
|
||||
#include <CLucene.h>
|
||||
#include <CLucene/queryParser/MultiFieldQueryParser.h>
|
||||
|
||||
#include "DatabaseImpl.h"
|
||||
#include "Database.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "Source.h"
|
||||
|
||||
using namespace lucene::analysis;
|
||||
using namespace lucene::analysis::standard;
|
||||
using namespace lucene::document;
|
||||
|
@ -18,12 +18,14 @@
|
||||
|
||||
#include "IdThreadWorker.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "Database.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#define ID_THREAD_DEBUG 0
|
||||
|
||||
|
@ -20,11 +20,13 @@
|
||||
|
||||
#include "LocalCollection.h"
|
||||
|
||||
#include "SourceList.h"
|
||||
#include <TomahawkSettings.h>
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
#include <TomahawkSettings.h>
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
#include "ViewManager.h"
|
||||
#endif
|
||||
|
@ -20,21 +20,23 @@
|
||||
#include "MetadataEditor.h"
|
||||
#include "ui_MetadataEditor.h"
|
||||
|
||||
#include "Source.h"
|
||||
#include "Result.h"
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "Typedefs.h"
|
||||
#include "ScanManager.h"
|
||||
#include "PlaylistInterface.h"
|
||||
#include "AlbumPlaylistInterface.h"
|
||||
|
||||
#include "filemetadata/taghandlers/tag.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "taglib/fileref.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "AlbumPlaylistInterface.h"
|
||||
#include "Artist.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "PlaylistInterface.h"
|
||||
#include "Result.h"
|
||||
#include "ScanManager.h"
|
||||
#include "Source.h"
|
||||
#include "Typedefs.h"
|
||||
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFileInfo>
|
||||
|
@ -19,11 +19,6 @@
|
||||
|
||||
#include "MusicScanner.h"
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "SourceList.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseCommand_DirMtimes.h"
|
||||
#include "database/DatabaseCommand_FileMTimes.h"
|
||||
@ -31,8 +26,15 @@
|
||||
#include "database/DatabaseCommand_AddFiles.h"
|
||||
#include "database/DatabaseCommand_DeleteFiles.h"
|
||||
#include "taghandlers/tag.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
|
||||
void
|
||||
DirLister::go()
|
||||
|
@ -19,16 +19,16 @@
|
||||
|
||||
#include "ScanManager.h"
|
||||
|
||||
#include "MusicScanner.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseCommand_FileMTimes.h"
|
||||
#include "database/DatabaseCommand_DeleteFiles.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
|
||||
#include "MusicScanner.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
#include <QThread>
|
||||
#include <QCoreApplication>
|
||||
|
@ -20,11 +20,13 @@
|
||||
|
||||
#include "InfoSystemWorker.h"
|
||||
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "InfoSystemCache.h"
|
||||
#include "GlobalActionManager.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
|
||||
|
@ -18,18 +18,19 @@
|
||||
|
||||
#include "ConnectionManager_p.h"
|
||||
|
||||
#include "ControlConnection.h"
|
||||
#include "network/Msg.h"
|
||||
#include "QTcpSocketExtra.h"
|
||||
#include "Servent.h"
|
||||
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseImpl.h"
|
||||
#include "network/Msg.h"
|
||||
#include "sip/SipInfo.h"
|
||||
#include "sip/SipPlugin.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/WeakObjectHash.h"
|
||||
|
||||
#include "ControlConnection.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "QTcpSocketExtra.h"
|
||||
#include "Servent.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <qtconcurrentrun.h>
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "sip/PeerInfo.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
#include "StreamConnection.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
|
@ -22,11 +22,13 @@
|
||||
#include "database/DatabaseCommand_LoadInboxEntries.h"
|
||||
#include "database/DatabaseCommand_DeleteInboxEntry.h"
|
||||
#include "database/DatabaseCommand_ModifyInboxEntry.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
|
||||
InboxModel::InboxModel( QObject* parent )
|
||||
|
@ -21,14 +21,16 @@
|
||||
#include <QMimeData>
|
||||
#include <QTreeView>
|
||||
|
||||
#include "Source.h"
|
||||
#include "SourceList.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseCommand_GenericSelect.h"
|
||||
#include "PlayableItem.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "PlayableItem.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#define LOVED_TRACK_ITEMS 25
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Query.h"
|
||||
#include "Result.h"
|
||||
#include "Source.h"
|
||||
|
@ -23,18 +23,20 @@
|
||||
#include <QMimeData>
|
||||
#include <QTreeView>
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Album.h"
|
||||
#include "Pipeline.h"
|
||||
#include "Source.h"
|
||||
#include "SourceList.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseCommand_PlaybackHistory.h"
|
||||
#include "dynamic/GeneratorInterface.h"
|
||||
#include "DropJob.h"
|
||||
#include "PlayableItem.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "playlist/dynamic/GeneratorInterface.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "Artist.h"
|
||||
#include "DropJob.h"
|
||||
#include "Pipeline.h"
|
||||
#include "PlayableItem.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
37
src/libtomahawk/playlist/RevisionQueueItem.cpp
Normal file
37
src/libtomahawk/playlist/RevisionQueueItem.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
* Copyright 2013 , Uwe L. Korn <uwelk@xhochy.com>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "RevisionQueueItem.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
RevisionQueueItem::RevisionQueueItem( const QString& nRev, const QString& oRev, const QList<plentry_ptr>& e, bool latest)
|
||||
: newRev( nRev )
|
||||
, oldRev( oRev)
|
||||
, entries( e )
|
||||
, applyToTip( latest )
|
||||
{
|
||||
}
|
||||
|
||||
} // Tomahawk
|
42
src/libtomahawk/playlist/RevisionQueueItem.h
Normal file
42
src/libtomahawk/playlist/RevisionQueueItem.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
* Copyright 2013 , Uwe L. Korn <uwelk@xhochy.com>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef REVISIONQUEUEITEM_H
|
||||
#define REVISIONQUEUEITEM_H
|
||||
|
||||
#include "Typedefs.h"
|
||||
|
||||
namespace Tomahawk {
|
||||
|
||||
struct RevisionQueueItem
|
||||
{
|
||||
public:
|
||||
QString newRev;
|
||||
QString oldRev;
|
||||
QList< plentry_ptr > entries;
|
||||
bool applyToTip;
|
||||
|
||||
RevisionQueueItem( const QString& nRev, const QString& oRev, const QList< plentry_ptr >& e, bool latest );
|
||||
};
|
||||
|
||||
} // Tomahawk
|
||||
|
||||
#endif // REVISIONQUEUEITEM_H
|
@ -18,13 +18,15 @@
|
||||
|
||||
#include "XspfUpdater.h"
|
||||
|
||||
#include "Playlist.h"
|
||||
#include "Pipeline.h"
|
||||
#include "Source.h"
|
||||
#include "utils/XspfLoader.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Pipeline.h"
|
||||
#include "Playlist.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
|
@ -17,10 +17,8 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "DynamicPlaylist.h"
|
||||
#include "DynamicPlaylist_p.h"
|
||||
|
||||
#include "SourceList.h"
|
||||
#include "GeneratorFactory.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseCommand.h"
|
||||
#include "database/DatabaseCommand_CreateDynamicPlaylist.h"
|
||||
@ -30,14 +28,20 @@
|
||||
#include "TomahawkSettings.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "GeneratorFactory.h"
|
||||
#include "Playlist_p.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "SourceList.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
DynamicPlaylist::DynamicPlaylist( const Tomahawk::source_ptr& author, const QString& type )
|
||||
: Playlist( author )
|
||||
: Playlist( new DynamicPlaylistPrivate( this, author ) )
|
||||
{
|
||||
Q_D( DynamicPlaylist );
|
||||
qDebug() << Q_FUNC_INFO << "JSON";
|
||||
m_generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
||||
d->generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
||||
}
|
||||
|
||||
|
||||
@ -59,13 +63,12 @@ DynamicPlaylist::DynamicPlaylist ( const Tomahawk::source_ptr& src,
|
||||
bool shared,
|
||||
int lastmod,
|
||||
const QString& guid )
|
||||
: Playlist( src, currentrevision, title, info, creator, createdOn, shared, lastmod, guid )
|
||||
, m_autoLoad( false )
|
||||
: Playlist( new DynamicPlaylistPrivate( this, src, currentrevision, title, info, creator, createdOn, shared, lastmod, guid, false ) )
|
||||
{
|
||||
// qDebug() << "Creating Dynamic Playlist 1";
|
||||
// TODO instantiate generator
|
||||
m_generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
||||
m_generator->setMode( mode );
|
||||
Q_D( DynamicPlaylist );
|
||||
d->generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
||||
d->generator->setMode( mode );
|
||||
}
|
||||
|
||||
|
||||
@ -79,47 +82,51 @@ DynamicPlaylist::DynamicPlaylist( const Tomahawk::source_ptr& author,
|
||||
GeneratorMode mode,
|
||||
bool shared,
|
||||
bool autoLoad )
|
||||
: Playlist ( author, guid, title, info, creator, shared )
|
||||
, m_autoLoad( autoLoad )
|
||||
: Playlist( new DynamicPlaylistPrivate( this, author, QString(), title, info, creator, 0, shared, 0, guid, autoLoad ) )
|
||||
{
|
||||
// qDebug() << "Creating Dynamic Playlist 2";
|
||||
m_generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
||||
m_generator->setMode( mode );
|
||||
Q_D( DynamicPlaylist );
|
||||
d->generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
||||
d->generator->setMode( mode );
|
||||
}
|
||||
|
||||
|
||||
geninterface_ptr
|
||||
DynamicPlaylist::generator() const
|
||||
{
|
||||
return m_generator;
|
||||
Q_D( const DynamicPlaylist );
|
||||
return d->generator;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
DynamicPlaylist::mode() const
|
||||
{
|
||||
return m_generator->mode();
|
||||
Q_D( const DynamicPlaylist );
|
||||
return d->generator->mode();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DynamicPlaylist::setGenerator( const Tomahawk::geninterface_ptr& gen_ptr )
|
||||
{
|
||||
m_generator = gen_ptr;
|
||||
Q_D( DynamicPlaylist );
|
||||
d->generator = gen_ptr;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
DynamicPlaylist::type() const
|
||||
{
|
||||
return m_generator->type();
|
||||
Q_D( const DynamicPlaylist );
|
||||
return d->generator->type();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DynamicPlaylist::setMode( int mode )
|
||||
{
|
||||
m_generator->setMode( (GeneratorMode)mode );
|
||||
Q_D( DynamicPlaylist );
|
||||
d->generator->setMode( (GeneratorMode)mode );
|
||||
}
|
||||
|
||||
|
||||
@ -188,11 +195,12 @@ DynamicPlaylist::createNewRevision( const QString& newrev,
|
||||
const QList< dyncontrol_ptr>& controls,
|
||||
const QList< plentry_ptr >& entries )
|
||||
{
|
||||
Q_ASSERT( m_source->isLocal() || newrev == oldrev );
|
||||
Q_D( DynamicPlaylist );
|
||||
Q_ASSERT( Playlist::d_func()->source->isLocal() || newrev == oldrev );
|
||||
|
||||
if ( busy() )
|
||||
{
|
||||
m_revisionQueue.enqueue( DynQueueItem( newrev, oldrev, type, controls, (int)Static, entries, oldrev == currentrevision() ) );
|
||||
d->revisionQueue.enqueue( DynQueueItem( newrev, oldrev, type, controls, (int)Static, entries, oldrev == currentrevision() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -221,7 +229,7 @@ DynamicPlaylist::createNewRevision( const QString& newrev,
|
||||
type,
|
||||
Static,
|
||||
controls );
|
||||
if ( !m_autoLoad )
|
||||
if ( !d->autoLoad )
|
||||
cmd->setPlaylist( this );
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
@ -235,11 +243,12 @@ DynamicPlaylist::createNewRevision( const QString& newrev,
|
||||
const QString& type,
|
||||
const QList< dyncontrol_ptr>& controls )
|
||||
{
|
||||
Q_ASSERT( m_source->isLocal() || newrev == oldrev );
|
||||
Q_D( DynamicPlaylist );
|
||||
Q_ASSERT( Playlist::d_func()->source->isLocal() || newrev == oldrev );
|
||||
|
||||
if ( busy() )
|
||||
{
|
||||
m_revisionQueue.enqueue( DynQueueItem( newrev, oldrev, type, controls, (int)OnDemand, QList< plentry_ptr >(), oldrev == currentrevision() ) );
|
||||
d->revisionQueue.enqueue( DynQueueItem( newrev, oldrev, type, controls, (int)OnDemand, QList< plentry_ptr >(), oldrev == currentrevision() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -256,7 +265,7 @@ DynamicPlaylist::createNewRevision( const QString& newrev,
|
||||
type,
|
||||
OnDemand,
|
||||
controls );
|
||||
if ( !m_autoLoad )
|
||||
if ( !d->autoLoad )
|
||||
cmd->setPlaylist( this );
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
@ -266,12 +275,13 @@ DynamicPlaylist::createNewRevision( const QString& newrev,
|
||||
void
|
||||
DynamicPlaylist::loadRevision( const QString& rev )
|
||||
{
|
||||
Q_D( DynamicPlaylist );
|
||||
//tDebug() << Q_FUNC_INFO << "Loading with:" << ( rev.isEmpty() ? currentrevision() : rev );
|
||||
|
||||
setBusy( true );
|
||||
DatabaseCommand_LoadDynamicPlaylistEntries* cmd = new DatabaseCommand_LoadDynamicPlaylistEntries( rev.isEmpty() ? currentrevision() : rev );
|
||||
|
||||
if ( m_generator->mode() == OnDemand ) {
|
||||
if ( d->generator->mode() == OnDemand ) {
|
||||
connect( cmd, SIGNAL( done( QString,
|
||||
bool,
|
||||
QString,
|
||||
@ -282,7 +292,7 @@ DynamicPlaylist::loadRevision( const QString& rev )
|
||||
QString,
|
||||
QList< QVariantMap >,
|
||||
bool) ) );
|
||||
} else if ( m_generator->mode() == Static ) {
|
||||
} else if ( d->generator->mode() == Static ) {
|
||||
connect( cmd, SIGNAL( done( QString,
|
||||
QList< QString >,
|
||||
QList< QString >,
|
||||
@ -352,12 +362,13 @@ DynamicPlaylist::reportDeleted( const Tomahawk::dynplaylist_ptr& self )
|
||||
void
|
||||
DynamicPlaylist::addEntries( const QList< query_ptr >& queries )
|
||||
{
|
||||
Q_ASSERT( m_generator->mode() == Static );
|
||||
Q_D( DynamicPlaylist );
|
||||
Q_ASSERT( d->generator->mode() == Static );
|
||||
|
||||
QList<plentry_ptr> el = entriesFromQueries( queries );
|
||||
|
||||
QString newrev = uuid();
|
||||
createNewRevision( newrev, m_currentrevision, m_generator->type(), m_generator->controls(), el );
|
||||
createNewRevision( newrev, Playlist::d_func()->currentrevision, d->generator->type(), d->generator->controls(), el );
|
||||
}
|
||||
|
||||
|
||||
@ -381,6 +392,7 @@ DynamicPlaylist::setRevision( const QString& rev,
|
||||
const QMap< QString, plentry_ptr >& addedmap,
|
||||
bool applied )
|
||||
{
|
||||
Q_D( DynamicPlaylist );
|
||||
// we're probably being called by a database worker thread
|
||||
if ( QThread::currentThread() != thread() )
|
||||
{
|
||||
@ -398,12 +410,12 @@ DynamicPlaylist::setRevision( const QString& rev,
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_generator->type() != type ) { // new generator needed
|
||||
m_generator = GeneratorFactory::create( type );
|
||||
if ( d->generator->type() != type ) { // new generator needed
|
||||
d->generator = GeneratorFactory::create( type );
|
||||
}
|
||||
|
||||
m_generator->setControls( controls );
|
||||
m_generator->setMode( Static );
|
||||
d->generator->setControls( controls );
|
||||
d->generator->setMode( Static );
|
||||
|
||||
DynamicPlaylistRevision dpr = setNewRevision( rev, neworderedguids, oldorderedguids, is_newest_rev, addedmap );
|
||||
dpr.applied = applied;
|
||||
@ -459,6 +471,7 @@ DynamicPlaylist::setRevision( const QString& rev,
|
||||
const QList< dyncontrol_ptr >& controls,
|
||||
bool applied )
|
||||
{
|
||||
Q_D( DynamicPlaylist );
|
||||
if ( QThread::currentThread() != thread() )
|
||||
{
|
||||
QMetaObject::invokeMethod( this,
|
||||
@ -472,14 +485,14 @@ DynamicPlaylist::setRevision( const QString& rev,
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_generator->type() != type )
|
||||
if ( d->generator->type() != type )
|
||||
{
|
||||
// new generator needed
|
||||
m_generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
||||
d->generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
||||
}
|
||||
|
||||
m_generator->setControls( controls );
|
||||
m_generator->setMode( OnDemand );
|
||||
d->generator->setControls( controls );
|
||||
d->generator->setMode( OnDemand );
|
||||
|
||||
DynamicPlaylistRevision dpr;
|
||||
dpr.oldrevisionguid = currentrevision();
|
||||
@ -540,9 +553,10 @@ DynamicPlaylist::variantsToControl( const QList< QVariantMap >& controlsV )
|
||||
void
|
||||
DynamicPlaylist::checkRevisionQueue()
|
||||
{
|
||||
if ( !m_revisionQueue.isEmpty() )
|
||||
Q_D( DynamicPlaylist );
|
||||
if ( !d->revisionQueue.isEmpty() )
|
||||
{
|
||||
DynQueueItem item = m_revisionQueue.dequeue();
|
||||
DynQueueItem item = d->revisionQueue.dequeue();
|
||||
if ( item.oldRev != currentrevision() && item.applyToTip )
|
||||
{
|
||||
// this was applied to the then-latest, but the already-running operation changed it so it's out of date now. fix it
|
||||
@ -561,3 +575,11 @@ DynamicPlaylist::checkRevisionQueue()
|
||||
createNewRevision( item.newRev, item.oldRev, item.type, item.controls );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DynamicPlaylist::autoLoad() const
|
||||
{
|
||||
Q_D( const DynamicPlaylist );
|
||||
return d->autoLoad;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
*
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
* Copyright 2013, Uwe L. Korn <uwelk@xhochy.com>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,16 +21,17 @@
|
||||
#ifndef DYNAMIC_PLAYLIST_H
|
||||
#define DYNAMIC_PLAYLIST_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include "Typedefs.h"
|
||||
#include "Playlist.h"
|
||||
#include "playlist/dynamic/DynamicControl.h"
|
||||
#include "playlist/dynamic/DynamicPlaylistRevision.h"
|
||||
|
||||
#include "DllMacro.h"
|
||||
#include "Playlist.h"
|
||||
#include "Typedefs.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QSharedPointer>
|
||||
|
||||
|
||||
class DatabaseCommand_LoadAllDynamicPlaylists;
|
||||
class DatabaseCommand_SetDynamicPlaylistRevision;
|
||||
@ -40,21 +42,7 @@ class DatabaseCollection;
|
||||
namespace Tomahawk {
|
||||
|
||||
class DatabaseCommand_LoadDynamicPlaylist;
|
||||
|
||||
/**
|
||||
* Subclass of playlist that adds the information needed to store a dynamic playlist.
|
||||
* It uses normal PlaylistEntries but also has a mode, a generator, and a list of controls
|
||||
*/
|
||||
|
||||
struct DynQueueItem : RevisionQueueItem
|
||||
{
|
||||
QString type;
|
||||
QList <dyncontrol_ptr> controls;
|
||||
int mode;
|
||||
|
||||
DynQueueItem( const QString& nRev, const QString& oRev, const QString& typ, const QList< dyncontrol_ptr >& ctrls, int m, const QList< plentry_ptr >& e, bool latest ) :
|
||||
RevisionQueueItem( nRev, oRev, e, latest ), type( typ ), controls( ctrls ), mode( m ) {}
|
||||
};
|
||||
class DynamicPlaylistPrivate;
|
||||
|
||||
class DLLEXPORT DynamicPlaylist : public Tomahawk::Playlist
|
||||
{
|
||||
@ -95,7 +83,7 @@ public:
|
||||
int mode() const;
|
||||
QString type() const;
|
||||
geninterface_ptr generator() const;
|
||||
bool autoLoad() const { return m_autoLoad; }
|
||||
bool autoLoad() const;
|
||||
|
||||
// Creates a new revision from the playlist in memory. Use this is you change the controls or
|
||||
// mode of a playlist and want to save it to db/others.
|
||||
@ -194,13 +182,10 @@ private:
|
||||
|
||||
QList< dyncontrol_ptr > variantsToControl( const QList< QVariantMap >& controlsV );
|
||||
|
||||
geninterface_ptr m_generator;
|
||||
bool m_autoLoad;
|
||||
|
||||
QQueue<DynQueueItem> m_revisionQueue;
|
||||
Q_DECLARE_PRIVATE( DynamicPlaylist )
|
||||
};
|
||||
|
||||
}; // namespace
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE( QSharedPointer< Tomahawk::DynamicPlaylist > )
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "DynamicPlaylistRevision.h"
|
||||
|
||||
#include "playlist/dynamic/DynamicControl.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
83
src/libtomahawk/playlist/dynamic/DynamicPlaylist_p.h
Normal file
83
src/libtomahawk/playlist/dynamic/DynamicPlaylist_p.h
Normal file
@ -0,0 +1,83 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
* Copyright 2013, Uwe L. Korn <uwelk@xhochy.com>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DYNAMICPLAYLIST_P_H
|
||||
#define DYNAMICPLAYLIST_P_H
|
||||
|
||||
#include "DynamicPlaylist.h"
|
||||
|
||||
#include "playlist/RevisionQueueItem.h"
|
||||
|
||||
#include "Playlist_p.h"
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
/**
|
||||
* Subclass of playlist that adds the information needed to store a dynamic playlist.
|
||||
* It uses normal PlaylistEntries but also has a mode, a generator, and a list of controls
|
||||
*/
|
||||
|
||||
struct DynQueueItem : RevisionQueueItem
|
||||
{
|
||||
QString type;
|
||||
QList <dyncontrol_ptr> controls;
|
||||
int mode;
|
||||
|
||||
DynQueueItem( const QString& nRev, const QString& oRev, const QString& typ, const QList< dyncontrol_ptr >& ctrls, int m, const QList< plentry_ptr >& e, bool latest ) :
|
||||
RevisionQueueItem( nRev, oRev, e, latest ), type( typ ), controls( ctrls ), mode( m ) {}
|
||||
};
|
||||
|
||||
class DynamicPlaylistPrivate : public PlaylistPrivate
|
||||
{
|
||||
public:
|
||||
DynamicPlaylistPrivate( DynamicPlaylist* q, const source_ptr& _author )
|
||||
: PlaylistPrivate( q, _author )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DynamicPlaylistPrivate( DynamicPlaylist* q, const source_ptr& _src,
|
||||
const QString& _currentrevision,
|
||||
const QString& _title,
|
||||
const QString& _info,
|
||||
const QString& _creator,
|
||||
uint _createdOn,
|
||||
bool _shared,
|
||||
int _lastmod,
|
||||
const QString& _guid,
|
||||
bool _autoload )
|
||||
: PlaylistPrivate( q, _src, _currentrevision, _title, _info, _creator, _createdOn, _shared, _lastmod, _guid )
|
||||
, autoLoad( _autoload )
|
||||
{
|
||||
}
|
||||
|
||||
Q_DECLARE_PUBLIC( DynamicPlaylist )
|
||||
|
||||
private:
|
||||
geninterface_ptr generator;
|
||||
bool autoLoad;
|
||||
|
||||
QQueue<DynQueueItem> revisionQueue;
|
||||
};
|
||||
|
||||
} // Tomahawk;
|
||||
|
||||
#endif // DYNAMICPLAYLIST_P_H
|
@ -18,11 +18,13 @@
|
||||
|
||||
#include "DatabaseGenerator.h"
|
||||
|
||||
#include "DatabaseControl.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "Source.h"
|
||||
#include "database/DatabaseCommand_GenericSelect.h"
|
||||
#include "database/Database.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "DatabaseControl.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Source.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "ExternalResolver.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
Tomahawk::ExternalResolver::ErrorState
|
||||
|
@ -18,12 +18,13 @@
|
||||
|
||||
#include "ScriptCommand_AllAlbums.h"
|
||||
|
||||
#include "ExternalResolver.h"
|
||||
#include "ScriptCollection.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "Artist.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
#include "ExternalResolver.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "ScriptCollection.h"
|
||||
|
||||
ScriptCommand_AllAlbums::ScriptCommand_AllAlbums( const Tomahawk::collection_ptr& collection,
|
||||
const Tomahawk::artist_ptr& artist,
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ScriptCommand_AllTracks.h"
|
||||
|
||||
#include "ExternalResolver.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "ScriptCollection.h"
|
||||
|
||||
ScriptCommand_AllTracks::ScriptCommand_AllTracks( const Tomahawk::collection_ptr& collection,
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include "ScriptCommand_LookupUrl_p.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
|
||||
ScriptCommand_LookupUrl::ScriptCommand_LookupUrl( Tomahawk::ExternalResolver* resolver, const QString& url, QObject* parent )
|
||||
: ScriptCommand( parent )
|
||||
, d_ptr( new ScriptCommand_LookupUrlPrivate( this, resolver, url ) )
|
||||
|
@ -20,7 +20,9 @@
|
||||
#include "XspfGenerator.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Playlist.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "Query.h"
|
||||
#include "Source.h"
|
||||
#include "Track.h"
|
||||
|
@ -19,15 +19,17 @@
|
||||
|
||||
#include "RecentPlaylistsModel.h"
|
||||
|
||||
#include "TomahawkSettings.h"
|
||||
#include "audio/AudioEngine.h"
|
||||
#include "SourceList.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "playlist/dynamic/DynamicPlaylist.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseCommand_LoadAllSortedPlaylists.h"
|
||||
#include "RecentlyPlayedPlaylistsModel.h"
|
||||
#include "network/Servent.h"
|
||||
#include "playlist/dynamic/DynamicPlaylist.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "PlaylistEntry.h"
|
||||
#include "RecentlyPlayedPlaylistsModel.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
#define REFRESH_TIMEOUT 1000
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include "Playlist.h"
|
||||
#include "PlaylistEntry.h"
|
||||
#include "PlaylistInterface.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "widgets/SourceTreePopupDialog.h"
|
||||
#include "PlaylistEntry.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
|
Loading…
x
Reference in New Issue
Block a user