1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-30 17:20:26 +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
DynamicPlaylist::create( const Tomahawk::source_ptr& author,
DynamicPlaylist::create(const Tomahawk::source_ptr& author,
const QString& guid,
const QString& title,
const QString& info,
@@ -150,17 +150,20 @@ DynamicPlaylist::create( const Tomahawk::source_ptr& author,
GeneratorMode mode,
bool shared,
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->setWeakSelf( dynplaylist.toWeakRef() );
DatabaseCommand_CreateDynamicPlaylist* cmd = new DatabaseCommand_CreateDynamicPlaylist( author, dynplaylist, autoLoad );
connect( cmd, SIGNAL( finished() ), dynplaylist.data(), SIGNAL( created() ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
if ( autoLoad )
dynplaylist->reportCreated( dynplaylist );
if ( !temporary )
{
DatabaseCommand_CreateDynamicPlaylist* cmd = new DatabaseCommand_CreateDynamicPlaylist( author, dynplaylist, autoLoad );
connect( cmd, SIGNAL( finished() ), dynplaylist.data(), SIGNAL( created() ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
if ( autoLoad )
dynplaylist->reportCreated( dynplaylist );
}
return dynplaylist;
}

View File

@@ -85,7 +85,8 @@ public:
GeneratorMode mode,
bool shared,
const QString& type = QString(),
bool autoLoad = true
bool autoLoad = true,
bool temporary = false
);
static void remove( const dynplaylist_ptr& playlist );
@@ -95,7 +96,7 @@ public:
int mode() const;
QString type() 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
// mode of a playlist and want to save it to db/others.