1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 06:36:55 +02:00
This commit is contained in:
Leo Franchi
2012-04-08 20:29:39 -04:00
parent 1dda0371b5
commit 6ffaa1450e
2 changed files with 9 additions and 12 deletions

View File

@@ -96,7 +96,6 @@ PlaylistEntry::setLastSource( source_ptr s )
Playlist::Playlist( const source_ptr& author ) Playlist::Playlist( const source_ptr& author )
: m_source( author ) : m_source( author )
, m_lastmodified( 0 ) , m_lastmodified( 0 )
, m_updater( 0 )
{ {
} }
@@ -121,7 +120,6 @@ Playlist::Playlist( const source_ptr& src,
, m_lastmodified( lastmod ) , m_lastmodified( lastmod )
, m_createdOn( createdOn ) , m_createdOn( createdOn )
, m_shared( shared ) , m_shared( shared )
, m_updater( 0 )
{ {
init(); init();
} }
@@ -144,7 +142,6 @@ Playlist::Playlist( const source_ptr& author,
, m_createdOn( 0 ) // will be set by db command , m_createdOn( 0 ) // will be set by db command
, m_shared( shared ) , m_shared( shared )
, m_initEntries( entries ) , m_initEntries( entries )
, m_updater( 0 )
{ {
init(); init();
} }
@@ -273,8 +270,8 @@ void
Playlist::reportDeleted( const Tomahawk::playlist_ptr& self ) Playlist::reportDeleted( const Tomahawk::playlist_ptr& self )
{ {
Q_ASSERT( self.data() == this ); Q_ASSERT( self.data() == this );
if ( m_updater ) if ( !m_updater.isNull() )
m_updater->remove(); m_updater.data()->remove();
m_deleted = true; m_deleted = true;
m_source->collection()->deletePlaylist( self ); m_source->collection()->deletePlaylist( self );
@@ -285,12 +282,12 @@ Playlist::reportDeleted( const Tomahawk::playlist_ptr& self )
void void
Playlist::setUpdater( PlaylistUpdaterInterface* pluinterface ) Playlist::setUpdater( PlaylistUpdaterInterface* pluinterface )
{ {
if ( m_updater ) if ( !m_updater.isNull() )
disconnect( m_updater, SIGNAL( changed() ), this, SIGNAL( changed() ) ); disconnect( m_updater.data(), SIGNAL( changed() ), this, SIGNAL( changed() ) );
m_updater = pluinterface; m_updater = QWeakPointer< PlaylistUpdaterInterface >( pluinterface );
connect( m_updater, SIGNAL( changed() ), this, SIGNAL( changed() ), Qt::UniqueConnection ); connect( m_updater.data(), SIGNAL( changed() ), this, SIGNAL( changed() ), Qt::UniqueConnection );
emit changed(); emit changed();
} }

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
* *
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org> * Copyright 2011920-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org> * Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org> * Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* *
@@ -189,7 +189,7 @@ public:
QList<plentry_ptr> entriesFromQueries( const QList<Tomahawk::query_ptr>& queries, bool clearFirst = false ); QList<plentry_ptr> entriesFromQueries( const QList<Tomahawk::query_ptr>& queries, bool clearFirst = false );
void setUpdater( PlaylistUpdaterInterface* pluinterface ); void setUpdater( PlaylistUpdaterInterface* pluinterface );
PlaylistUpdaterInterface* updater() const { return m_updater; } PlaylistUpdaterInterface* updater() const { return m_updater.data(); }
Tomahawk::playlistinterface_ptr playlistInterface(); Tomahawk::playlistinterface_ptr playlistInterface();
@@ -295,7 +295,7 @@ private:
QQueue<RevisionQueueItem> m_revisionQueue; QQueue<RevisionQueueItem> m_revisionQueue;
QQueue<RevisionQueueItem> m_updateQueue; QQueue<RevisionQueueItem> m_updateQueue;
PlaylistUpdaterInterface* m_updater; QWeakPointer<PlaylistUpdaterInterface> m_updater;
bool m_locallyChanged; bool m_locallyChanged;
bool m_deleted; bool m_deleted;