1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-01 01:51:58 +02:00

* Now we can have temporary dynamic playlists.

This commit is contained in:
Christian Muehlhaeuser
2012-12-29 18:46:46 +01:00
parent edac0daa52
commit dc4035dd97
2 changed files with 14 additions and 10 deletions

View File

@@ -142,7 +142,7 @@ DynamicPlaylist::load( const QString& guid )
dynplaylist_ptr dynplaylist_ptr
DynamicPlaylist::create( const Tomahawk::source_ptr& author, DynamicPlaylist::create(const Tomahawk::source_ptr& author,
const QString& guid, const QString& guid,
const QString& title, const QString& title,
const QString& info, const QString& info,
@@ -150,17 +150,20 @@ DynamicPlaylist::create( const Tomahawk::source_ptr& author,
GeneratorMode mode, GeneratorMode mode,
bool shared, bool shared,
const QString& type, const QString& type,
bool autoLoad bool autoLoad,
) bool temporary )
{ {
dynplaylist_ptr dynplaylist = Tomahawk::dynplaylist_ptr( new DynamicPlaylist( author, guid, title, info, creator, type, mode, shared, autoLoad ), &QObject::deleteLater ); dynplaylist_ptr dynplaylist = Tomahawk::dynplaylist_ptr( new DynamicPlaylist( author, guid, title, info, creator, type, mode, shared, autoLoad ), &QObject::deleteLater );
dynplaylist->setWeakSelf( dynplaylist.toWeakRef() ); dynplaylist->setWeakSelf( dynplaylist.toWeakRef() );
DatabaseCommand_CreateDynamicPlaylist* cmd = new DatabaseCommand_CreateDynamicPlaylist( author, dynplaylist, autoLoad ); if ( !temporary )
connect( cmd, SIGNAL( finished() ), dynplaylist.data(), SIGNAL( created() ) ); {
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) ); DatabaseCommand_CreateDynamicPlaylist* cmd = new DatabaseCommand_CreateDynamicPlaylist( author, dynplaylist, autoLoad );
if ( autoLoad ) connect( cmd, SIGNAL( finished() ), dynplaylist.data(), SIGNAL( created() ) );
dynplaylist->reportCreated( dynplaylist ); Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
if ( autoLoad )
dynplaylist->reportCreated( dynplaylist );
}
return dynplaylist; return dynplaylist;
} }

View File

@@ -85,7 +85,8 @@ public:
GeneratorMode mode, GeneratorMode mode,
bool shared, bool shared,
const QString& type = QString(), const QString& type = QString(),
bool autoLoad = true bool autoLoad = true,
bool temporary = false
); );
static void remove( const dynplaylist_ptr& playlist ); static void remove( const dynplaylist_ptr& playlist );
@@ -95,7 +96,7 @@ public:
int mode() const; int mode() const;
QString type() const; QString type() const;
geninterface_ptr generator() const; geninterface_ptr generator() const;
bool autoLoad() const { return m_autoLoad; } bool autoLoad() const { return m_autoLoad; }
// Creates a new revision from the playlist in memory. Use this is you change the controls or // 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. // mode of a playlist and want to save it to db/others.