mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 22:56:42 +02:00
* Silly style cleanups.
This commit is contained in:
@@ -245,6 +245,7 @@ Playlist::rename( const QString& title )
|
|||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Playlist::setTitle( const QString& title )
|
Playlist::setTitle( const QString& title )
|
||||||
{
|
{
|
||||||
@@ -258,6 +259,7 @@ Playlist::setTitle( const QString& title )
|
|||||||
emit renamed( m_title, oldTitle );
|
emit renamed( m_title, oldTitle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Playlist::reportCreated( const playlist_ptr& self )
|
Playlist::reportCreated( const playlist_ptr& self )
|
||||||
{
|
{
|
||||||
@@ -282,6 +284,7 @@ Playlist::reportDeleted( const Tomahawk::playlist_ptr& self )
|
|||||||
emit deleted( self );
|
emit deleted( self );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Playlist::addUpdater( PlaylistUpdaterInterface* updater )
|
Playlist::addUpdater( PlaylistUpdaterInterface* updater )
|
||||||
{
|
{
|
||||||
@@ -419,7 +422,7 @@ Playlist::setRevision( const QString& rev,
|
|||||||
const QMap< QString, Tomahawk::plentry_ptr >& addedmap,
|
const QMap< QString, Tomahawk::plentry_ptr >& addedmap,
|
||||||
bool applied )
|
bool applied )
|
||||||
{
|
{
|
||||||
if( QThread::currentThread() != thread() )
|
if ( QThread::currentThread() != thread() )
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod( this,
|
QMetaObject::invokeMethod( this,
|
||||||
"setRevision",
|
"setRevision",
|
||||||
@@ -586,6 +589,7 @@ Playlist::addEntries( const QList<query_ptr>& queries, const QString& oldrev )
|
|||||||
emit tracksInserted( added, prevSize );
|
emit tracksInserted( added, prevSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Playlist::insertEntries( const QList< query_ptr >& queries, const int position, const QString& oldrev )
|
Playlist::insertEntries( const QList< query_ptr >& queries, const int position, const QString& oldrev )
|
||||||
{
|
{
|
||||||
@@ -650,7 +654,7 @@ Playlist::newEntries( const QList< plentry_ptr >& entries )
|
|||||||
QList<plentry_ptr> added;
|
QList<plentry_ptr> added;
|
||||||
foreach( const plentry_ptr& p, entries )
|
foreach( const plentry_ptr& p, entries )
|
||||||
{
|
{
|
||||||
if( !currentguids.contains( p->guid() ) )
|
if ( !currentguids.contains( p->guid() ) )
|
||||||
added << p;
|
added << p;
|
||||||
}
|
}
|
||||||
return added;
|
return added;
|
||||||
|
@@ -70,15 +70,15 @@ DynamicPlaylist::DynamicPlaylist ( const Tomahawk::source_ptr& src,
|
|||||||
|
|
||||||
|
|
||||||
// called when a new playlist is created (no currentrevision, new guid)
|
// called when a new playlist is created (no currentrevision, new guid)
|
||||||
DynamicPlaylist::DynamicPlaylist ( const Tomahawk::source_ptr& author,
|
DynamicPlaylist::DynamicPlaylist( const Tomahawk::source_ptr& author,
|
||||||
const QString& guid,
|
const QString& guid,
|
||||||
const QString& title,
|
const QString& title,
|
||||||
const QString& info,
|
const QString& info,
|
||||||
const QString& creator,
|
const QString& creator,
|
||||||
const QString& type,
|
const QString& type,
|
||||||
GeneratorMode mode,
|
GeneratorMode mode,
|
||||||
bool shared,
|
bool shared,
|
||||||
bool autoLoad )
|
bool autoLoad )
|
||||||
: Playlist ( author, guid, title, info, creator, shared )
|
: Playlist ( author, guid, title, info, creator, shared )
|
||||||
, m_autoLoad( autoLoad )
|
, m_autoLoad( autoLoad )
|
||||||
{
|
{
|
||||||
@@ -122,6 +122,7 @@ DynamicPlaylist::setMode( int mode )
|
|||||||
m_generator->setMode( (GeneratorMode)mode );
|
m_generator->setMode( (GeneratorMode)mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dynplaylist_ptr
|
dynplaylist_ptr
|
||||||
DynamicPlaylist::load( const QString& guid )
|
DynamicPlaylist::load( const QString& guid )
|
||||||
{
|
{
|
||||||
@@ -133,7 +134,7 @@ DynamicPlaylist::load( const QString& guid )
|
|||||||
if ( p.isNull() )
|
if ( p.isNull() )
|
||||||
p = source->collection()->station( guid );
|
p = source->collection()->station( guid );
|
||||||
|
|
||||||
if( !p.isNull() )
|
if ( !p.isNull() )
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +159,7 @@ DynamicPlaylist::create( const Tomahawk::source_ptr& author,
|
|||||||
DatabaseCommand_CreateDynamicPlaylist* cmd = new DatabaseCommand_CreateDynamicPlaylist( author, dynplaylist, autoLoad );
|
DatabaseCommand_CreateDynamicPlaylist* cmd = new DatabaseCommand_CreateDynamicPlaylist( author, dynplaylist, autoLoad );
|
||||||
connect( cmd, SIGNAL(finished()), dynplaylist.data(), SIGNAL(created()) );
|
connect( cmd, SIGNAL(finished()), dynplaylist.data(), SIGNAL(created()) );
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||||
if( autoLoad )
|
if ( autoLoad )
|
||||||
dynplaylist->reportCreated( dynplaylist );
|
dynplaylist->reportCreated( dynplaylist );
|
||||||
return dynplaylist;
|
return dynplaylist;
|
||||||
}
|
}
|
||||||
@@ -167,11 +168,11 @@ DynamicPlaylist::create( const Tomahawk::source_ptr& author,
|
|||||||
void
|
void
|
||||||
DynamicPlaylist::createNewRevision( const QString& newUuid )
|
DynamicPlaylist::createNewRevision( const QString& newUuid )
|
||||||
{
|
{
|
||||||
if( mode() == Static )
|
if ( mode() == Static )
|
||||||
{
|
{
|
||||||
createNewRevision( newUuid.isEmpty() ? uuid() : newUuid, currentrevision(), type(), generator()->controls(), entries() );
|
createNewRevision( newUuid.isEmpty() ? uuid() : newUuid, currentrevision(), type(), generator()->controls(), entries() );
|
||||||
}
|
}
|
||||||
else if( mode() == OnDemand )
|
else if ( mode() == OnDemand )
|
||||||
{
|
{
|
||||||
createNewRevision( newUuid.isEmpty() ? uuid() : newUuid, currentrevision(), type(), generator()->controls() );
|
createNewRevision( newUuid.isEmpty() ? uuid() : newUuid, currentrevision(), type(), generator()->controls() );
|
||||||
}
|
}
|
||||||
@@ -219,7 +220,7 @@ DynamicPlaylist::createNewRevision( const QString& newrev,
|
|||||||
type,
|
type,
|
||||||
Static,
|
Static,
|
||||||
controls );
|
controls );
|
||||||
if( !m_autoLoad )
|
if ( !m_autoLoad )
|
||||||
cmd->setPlaylist( this );
|
cmd->setPlaylist( this );
|
||||||
|
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
@@ -254,7 +255,7 @@ DynamicPlaylist::createNewRevision( const QString& newrev,
|
|||||||
type,
|
type,
|
||||||
OnDemand,
|
OnDemand,
|
||||||
controls );
|
controls );
|
||||||
if( !m_autoLoad )
|
if ( !m_autoLoad )
|
||||||
cmd->setPlaylist( this );
|
cmd->setPlaylist( this );
|
||||||
|
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
@@ -269,7 +270,7 @@ DynamicPlaylist::loadRevision( const QString& rev )
|
|||||||
setBusy( true );
|
setBusy( true );
|
||||||
DatabaseCommand_LoadDynamicPlaylistEntries* cmd = new DatabaseCommand_LoadDynamicPlaylistEntries( rev.isEmpty() ? currentrevision() : rev );
|
DatabaseCommand_LoadDynamicPlaylistEntries* cmd = new DatabaseCommand_LoadDynamicPlaylistEntries( rev.isEmpty() ? currentrevision() : rev );
|
||||||
|
|
||||||
if( m_generator->mode() == OnDemand ) {
|
if ( m_generator->mode() == OnDemand ) {
|
||||||
connect( cmd, SIGNAL( done( QString,
|
connect( cmd, SIGNAL( done( QString,
|
||||||
bool,
|
bool,
|
||||||
QString,
|
QString,
|
||||||
@@ -280,7 +281,7 @@ DynamicPlaylist::loadRevision( const QString& rev )
|
|||||||
QString,
|
QString,
|
||||||
QList< QVariantMap >,
|
QList< QVariantMap >,
|
||||||
bool) ) );
|
bool) ) );
|
||||||
} else if( m_generator->mode() == Static ) {
|
} else if ( m_generator->mode() == Static ) {
|
||||||
connect( cmd, SIGNAL( done( QString,
|
connect( cmd, SIGNAL( done( QString,
|
||||||
QList< QString >,
|
QList< QString >,
|
||||||
QList< QString >,
|
QList< QString >,
|
||||||
@@ -325,7 +326,7 @@ DynamicPlaylist::reportCreated( const Tomahawk::dynplaylist_ptr& self )
|
|||||||
// will emit Collection::playlistCreated(...)
|
// will emit Collection::playlistCreated(...)
|
||||||
// qDebug() << "Creating dynplaylist belonging to:" << author().data() << author().isNull();
|
// qDebug() << "Creating dynplaylist belonging to:" << author().data() << author().isNull();
|
||||||
// qDebug() << "REPORTING DYNAMIC PLAYLIST CREATED:" << this << author()->friendlyName();
|
// qDebug() << "REPORTING DYNAMIC PLAYLIST CREATED:" << this << author()->friendlyName();
|
||||||
if( self->mode() == Static )
|
if ( self->mode() == Static )
|
||||||
author()->collection()->addAutoPlaylist( self );
|
author()->collection()->addAutoPlaylist( self );
|
||||||
else
|
else
|
||||||
author()->collection()->addStation( self );
|
author()->collection()->addStation( self );
|
||||||
@@ -338,7 +339,7 @@ DynamicPlaylist::reportDeleted( const Tomahawk::dynplaylist_ptr& self )
|
|||||||
// qDebug() << Q_FUNC_INFO;
|
// qDebug() << Q_FUNC_INFO;
|
||||||
Q_ASSERT( self.data() == this );
|
Q_ASSERT( self.data() == this );
|
||||||
// will emit Collection::playlistDeleted(...)
|
// will emit Collection::playlistDeleted(...)
|
||||||
if( self->mode() == Static )
|
if ( self->mode() == Static )
|
||||||
author()->collection()->deleteAutoPlaylist( self );
|
author()->collection()->deleteAutoPlaylist( self );
|
||||||
else
|
else
|
||||||
author()->collection()->deleteStation( self );
|
author()->collection()->deleteStation( self );
|
||||||
@@ -348,7 +349,7 @@ DynamicPlaylist::reportDeleted( const Tomahawk::dynplaylist_ptr& self )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DynamicPlaylist::addEntries(const QList< query_ptr >& queries, const QString& oldrev)
|
DynamicPlaylist::addEntries( const QList< query_ptr >& queries, const QString& oldrev )
|
||||||
{
|
{
|
||||||
Q_ASSERT( m_generator->mode() == Static );
|
Q_ASSERT( m_generator->mode() == Static );
|
||||||
|
|
||||||
@@ -360,7 +361,7 @@ DynamicPlaylist::addEntries(const QList< query_ptr >& queries, const QString& ol
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DynamicPlaylist::addEntry(const Tomahawk::query_ptr& query, const QString& oldrev)
|
DynamicPlaylist::addEntry( const Tomahawk::query_ptr& query, const QString& oldrev )
|
||||||
{
|
{
|
||||||
QList<query_ptr> queries;
|
QList<query_ptr> queries;
|
||||||
queries << query;
|
queries << query;
|
||||||
@@ -380,7 +381,7 @@ DynamicPlaylist::setRevision( const QString& rev,
|
|||||||
bool applied )
|
bool applied )
|
||||||
{
|
{
|
||||||
// we're probably being called by a database worker thread
|
// we're probably being called by a database worker thread
|
||||||
if( QThread::currentThread() != thread() )
|
if ( QThread::currentThread() != thread() )
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod( this,
|
QMetaObject::invokeMethod( this,
|
||||||
"setRevision",
|
"setRevision",
|
||||||
@@ -395,7 +396,8 @@ DynamicPlaylist::setRevision( const QString& rev,
|
|||||||
Q_ARG( bool, applied ) );
|
Q_ARG( bool, applied ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( m_generator->type() != type ) { // new generator needed
|
|
||||||
|
if ( m_generator->type() != type ) { // new generator needed
|
||||||
m_generator = GeneratorFactory::create( type );
|
m_generator = GeneratorFactory::create( type );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +410,7 @@ DynamicPlaylist::setRevision( const QString& rev,
|
|||||||
dpr.type = type;
|
dpr.type = type;
|
||||||
dpr.mode = Static;
|
dpr.mode = Static;
|
||||||
|
|
||||||
if( applied )
|
if ( applied )
|
||||||
setCurrentrevision( rev );
|
setCurrentrevision( rev );
|
||||||
|
|
||||||
// qDebug() << "EMITTING REVISION LOADED 1!";
|
// qDebug() << "EMITTING REVISION LOADED 1!";
|
||||||
@@ -427,7 +429,7 @@ DynamicPlaylist::setRevision( const QString& rev,
|
|||||||
const QMap< QString, Tomahawk::plentry_ptr >& addedmap,
|
const QMap< QString, Tomahawk::plentry_ptr >& addedmap,
|
||||||
bool applied )
|
bool applied )
|
||||||
{
|
{
|
||||||
if( QThread::currentThread() != thread() )
|
if ( QThread::currentThread() != thread() )
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod( this,
|
QMetaObject::invokeMethod( this,
|
||||||
"setRevision",
|
"setRevision",
|
||||||
@@ -455,7 +457,7 @@ DynamicPlaylist::setRevision( const QString& rev,
|
|||||||
const QList< dyncontrol_ptr >& controls,
|
const QList< dyncontrol_ptr >& controls,
|
||||||
bool applied )
|
bool applied )
|
||||||
{
|
{
|
||||||
if( QThread::currentThread() != thread() )
|
if ( QThread::currentThread() != thread() )
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod( this,
|
QMetaObject::invokeMethod( this,
|
||||||
"setRevision",
|
"setRevision",
|
||||||
@@ -467,7 +469,10 @@ DynamicPlaylist::setRevision( const QString& rev,
|
|||||||
Q_ARG( bool, applied ) );
|
Q_ARG( bool, applied ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( m_generator->type() != type ) { // new generator needed
|
|
||||||
|
if ( m_generator->type() != type )
|
||||||
|
{
|
||||||
|
// new generator needed
|
||||||
m_generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
m_generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,7 +486,7 @@ DynamicPlaylist::setRevision( const QString& rev,
|
|||||||
dpr.type = type;
|
dpr.type = type;
|
||||||
dpr.mode = OnDemand;
|
dpr.mode = OnDemand;
|
||||||
|
|
||||||
if( applied )
|
if ( applied )
|
||||||
setCurrentrevision( rev );
|
setCurrentrevision( rev );
|
||||||
|
|
||||||
// qDebug() << "EMITTING REVISION LOADED 2!";
|
// qDebug() << "EMITTING REVISION LOADED 2!";
|
||||||
@@ -497,7 +502,7 @@ DynamicPlaylist::setRevision( const QString& rev,
|
|||||||
const QList< QVariantMap >& controlsV,
|
const QList< QVariantMap >& controlsV,
|
||||||
bool applied )
|
bool applied )
|
||||||
{
|
{
|
||||||
if( QThread::currentThread() != thread() )
|
if ( QThread::currentThread() != thread() )
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod( this,
|
QMetaObject::invokeMethod( this,
|
||||||
"setRevision",
|
"setRevision",
|
||||||
@@ -547,7 +552,7 @@ DynamicPlaylist::checkRevisionQueue()
|
|||||||
item.oldRev = currentrevision();
|
item.oldRev = currentrevision();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( item.mode == Static )
|
if ( item.mode == Static )
|
||||||
createNewRevision( item.newRev, item.oldRev, item.type, item.controls, item.entries );
|
createNewRevision( item.newRev, item.oldRev, item.type, item.controls, item.entries );
|
||||||
else
|
else
|
||||||
createNewRevision( item.newRev, item.oldRev, item.type, item.controls );
|
createNewRevision( item.newRev, item.oldRev, item.type, item.controls );
|
||||||
|
Reference in New Issue
Block a user