mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-19 23:41:51 +02:00
* DynamicPlaylist needs to store its own weak-ptr so we can access the dynplaylist_ptr (instead of only the playlist_ptr) internally.
This commit is contained in:
parent
2244f23fde
commit
945942b18a
@ -50,7 +50,6 @@ DynamicPlaylist::DynamicPlaylist( const Tomahawk::source_ptr& author, const QStr
|
||||
|
||||
DynamicPlaylist::~DynamicPlaylist()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -172,10 +171,19 @@ DynamicPlaylist::create( const Tomahawk::source_ptr& author,
|
||||
Database::instance()->enqueue( Tomahawk::dbcmd_ptr(cmd) );
|
||||
if ( autoLoad )
|
||||
dynplaylist->reportCreated( dynplaylist );
|
||||
|
||||
return dynplaylist;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DynamicPlaylist::setWeakSelf( QWeakPointer< DynamicPlaylist > self )
|
||||
{
|
||||
Q_D( DynamicPlaylist );
|
||||
d->weakSelf = self;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DynamicPlaylist::createNewRevision( const QString& newUuid )
|
||||
{
|
||||
@ -505,8 +513,11 @@ DynamicPlaylist::setRevision( const QString& rev,
|
||||
void
|
||||
DynamicPlaylist::removeFromDatabase()
|
||||
{
|
||||
Q_D( DynamicPlaylist );
|
||||
|
||||
emit aboutToBeDeleted( d->weakSelf.toStrongRef() );
|
||||
DatabaseCommand_DeletePlaylist* cmd = new DatabaseCommand_DeleteDynamicPlaylist( author(), guid() ) ;
|
||||
Database::instance()->enqueue( Tomahawk::dbcmd_ptr(cmd) );
|
||||
Database::instance()->enqueue( Tomahawk::dbcmd_ptr( cmd ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,8 +32,6 @@
|
||||
#include <QList>
|
||||
#include <QSharedPointer>
|
||||
|
||||
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
@ -156,6 +154,8 @@ public slots:
|
||||
const QList< Tomahawk::dyncontrol_ptr>& controls,
|
||||
bool applied );
|
||||
|
||||
void setWeakSelf( QWeakPointer< DynamicPlaylist > self );
|
||||
|
||||
protected:
|
||||
virtual void removeFromDatabase();
|
||||
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
Q_DECLARE_PUBLIC( DynamicPlaylist )
|
||||
|
||||
private:
|
||||
QWeakPointer< DynamicPlaylist > weakSelf;
|
||||
|
||||
geninterface_ptr generator;
|
||||
bool autoLoad;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user