diff --git a/src/libtomahawk/LatchManager.cpp b/src/libtomahawk/LatchManager.cpp index 39e6357d7..5e5f3649c 100644 --- a/src/libtomahawk/LatchManager.cpp +++ b/src/libtomahawk/LatchManager.cpp @@ -34,7 +34,7 @@ LatchManager::LatchManager( QObject* parent ) : QObject( parent ) , m_state( NotLatched ) { - connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistChanged( Tomahawk::PlaylistInterface* ) ) ); + connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( playlistChanged( Tomahawk::playlistinterface_ptr ) ) ); } LatchManager::~LatchManager() @@ -62,7 +62,7 @@ LatchManager::latchRequest( const source_ptr& source ) } void -LatchManager::playlistChanged( PlaylistInterface* ) +LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr ) { // If we were latched on and changed, send the listening along stop if ( m_latchedOnTo.isNull() ) @@ -108,7 +108,7 @@ LatchManager::playlistChanged( PlaylistInterface* ) m_latchedInterface.clear(); // call ourselves to hit the "create latch" condition - playlistChanged( 0 ); + playlistChanged( Tomahawk::playlistinterface_ptr() ); return; } m_latchedOnTo.clear(); diff --git a/src/libtomahawk/LatchManager.h b/src/libtomahawk/LatchManager.h index a52af5aef..26d8b8f8f 100644 --- a/src/libtomahawk/LatchManager.h +++ b/src/libtomahawk/LatchManager.h @@ -45,8 +45,8 @@ public slots: void catchUpRequest(); private slots: - - void playlistChanged( Tomahawk::PlaylistInterface* ); + void playlistChanged( Tomahawk::playlistinterface_ptr ); + private: enum State { NotLatched = 0, diff --git a/src/libtomahawk/context/ContextPage.h b/src/libtomahawk/context/ContextPage.h index 6e19bf409..1c35b91a6 100644 --- a/src/libtomahawk/context/ContextPage.h +++ b/src/libtomahawk/context/ContextPage.h @@ -43,7 +43,7 @@ public: virtual ~ContextPage() {} virtual QGraphicsWidget* widget() = 0; - virtual Tomahawk::PlaylistInterface* playlistInterface() const = 0; + virtual Tomahawk::playlistinterface_ptr playlistInterface() const = 0; virtual QString title() const = 0; virtual QString description() const = 0; diff --git a/src/libtomahawk/context/pages/RelatedArtistsContext.h b/src/libtomahawk/context/pages/RelatedArtistsContext.h index 47f4ef138..971e3e595 100644 --- a/src/libtomahawk/context/pages/RelatedArtistsContext.h +++ b/src/libtomahawk/context/pages/RelatedArtistsContext.h @@ -42,7 +42,7 @@ public: virtual QGraphicsWidget* widget() { return m_proxy; } - virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; } + virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); } virtual QString title() const { return tr( "Related Artists" ); } virtual QString description() const { return QString(); } diff --git a/src/libtomahawk/context/pages/TopTracksContext.h b/src/libtomahawk/context/pages/TopTracksContext.h index d74abda7c..68f1b8a91 100644 --- a/src/libtomahawk/context/pages/TopTracksContext.h +++ b/src/libtomahawk/context/pages/TopTracksContext.h @@ -42,7 +42,7 @@ public: virtual QGraphicsWidget* widget() { return m_proxy; } - virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; } + virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); } virtual QString title() const { return tr( "Top Hits" ); } virtual QString description() const { return QString(); } diff --git a/src/libtomahawk/context/pages/WikipediaContext.h b/src/libtomahawk/context/pages/WikipediaContext.h index 54fe011e6..318e6bfb3 100644 --- a/src/libtomahawk/context/pages/WikipediaContext.h +++ b/src/libtomahawk/context/pages/WikipediaContext.h @@ -36,7 +36,7 @@ public: WikipediaContext() : WebContext() {} ~WikipediaContext() {} - virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; } + virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); } virtual QString title() const { return tr( "Wikipedia" ); } virtual QString description() const { return QString(); } @@ -61,7 +61,7 @@ public: LastfmContext() : WebContext() {} ~LastfmContext() {} - virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; } + virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); } virtual QString title() const { return tr( "Last.fm" ); } virtual QString description() const { return QString(); } diff --git a/src/libtomahawk/infosystem/infoplugins/unix/mprisplugin.cpp b/src/libtomahawk/infosystem/infoplugins/unix/mprisplugin.cpp index 837da0ed2..d446ce913 100644 --- a/src/libtomahawk/infosystem/infoplugins/unix/mprisplugin.cpp +++ b/src/libtomahawk/infosystem/infoplugins/unix/mprisplugin.cpp @@ -62,8 +62,8 @@ MprisPlugin::MprisPlugin() SLOT( onVolumeChanged( int ) ) ); // When the playlist changes, signals for several properties are sent - connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), - SLOT( onPlaylistChanged( Tomahawk::PlaylistInterface* ) ) ); + connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), + SLOT( onPlaylistChanged( Tomahawk::playlistinterface_ptr ) ) ); // When a track is added or removed, CanGoNext updated signal is sent Tomahawk::playlistinterface_ptr playlist = AudioEngine::instance()->playlist(); @@ -539,15 +539,15 @@ MprisPlugin::onVolumeChanged( int volume ) } void -MprisPlugin::onPlaylistChanged( Tomahawk::PlaylistInterface* playlist ) +MprisPlugin::onPlaylistChanged( Tomahawk::playlistinterface_ptr playlist ) { qDebug() << Q_FUNC_INFO; disconnect( this, SLOT( onTrackCountChanged( unsigned int ) ) ); qDebug() << "disconnected"; - if( playlist ) + if( !playlist.isNull() ) qDebug() << "playlist not null"; - if( playlist ) + if( !playlist.isNull() ) connect( playlist->object(), SIGNAL( trackCountChanged( unsigned int ) ), SLOT( onTrackCountChanged( unsigned int ) ) ); diff --git a/src/libtomahawk/infosystem/infoplugins/unix/mprisplugin.h b/src/libtomahawk/infosystem/infoplugins/unix/mprisplugin.h index 2ba684808..db87ca37c 100644 --- a/src/libtomahawk/infosystem/infoplugins/unix/mprisplugin.h +++ b/src/libtomahawk/infosystem/infoplugins/unix/mprisplugin.h @@ -146,7 +146,7 @@ protected slots: private slots: void stateChanged( AudioState newState, AudioState oldState ); void onVolumeChanged( int volume ); - void onPlaylistChanged( Tomahawk::PlaylistInterface* playlist); + void onPlaylistChanged( Tomahawk::playlistinterface_ptr ); void onTrackCountChanged( unsigned int tracks ); void onSeeked( qint64 ms ); diff --git a/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.cpp b/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.cpp index 104729c20..d9381d096 100644 --- a/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.cpp +++ b/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.cpp @@ -98,7 +98,7 @@ DynamicWidget::DynamicWidget( const Tomahawk::dynplaylist_ptr& playlist, QWidget connect( m_controls, SIGNAL( controlsChanged( bool ) ), this, SLOT( controlsChanged( bool ) ), Qt::QueuedConnection ); connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), this, SLOT( trackStarted() ) ); - connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistChanged( Tomahawk::PlaylistInterface* ) ) ); + connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( playlistChanged( Tomahawk::playlistinterface_ptr ) ) ); } @@ -241,9 +241,9 @@ DynamicWidget::layoutFloatingWidgets() void -DynamicWidget::playlistChanged( PlaylistInterface* pl ) +DynamicWidget::playlistChanged( Tomahawk::playlistinterface_ptr pl ) { - if( pl == static_cast< PlaylistInterface* >( m_view->proxyModel() ) ) { // same playlist + if( pl == m_view->proxyModel()->getSharedPointer() ) { // same playlist m_activePlaylist = true; } else { m_activePlaylist = false; diff --git a/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.h b/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.h index 28ebf8c5f..66f24022c 100644 --- a/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.h +++ b/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.h @@ -88,7 +88,7 @@ public slots: void trackStarted(); void stationFailed( const QString& ); - void playlistChanged( Tomahawk::PlaylistInterface* ); + void playlistChanged( Tomahawk::playlistinterface_ptr ); void tracksAdded(); signals: diff --git a/src/libtomahawk/viewmanager.cpp b/src/libtomahawk/viewmanager.cpp index 4937aad4f..5164b4cb0 100644 --- a/src/libtomahawk/viewmanager.cpp +++ b/src/libtomahawk/viewmanager.cpp @@ -105,7 +105,7 @@ ViewManager::ViewManager( QObject* parent ) m_widget->layout()->setMargin( 0 ); m_widget->layout()->setSpacing( 0 ); - connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistInterfaceChanged( Tomahawk::PlaylistInterface* ) ) ); + connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( playlistInterfaceChanged( Tomahawk::playlistinterface_ptr ) ) ); connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) ); connect( m_infobar, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) ); diff --git a/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp b/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp index f1f5147e3..6ea2adbea 100644 --- a/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp +++ b/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp @@ -37,7 +37,7 @@ RecentlyPlayedPlaylistsModel::RecentlyPlayedPlaylistsModel( QObject* parent ) connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), this, SLOT( onSourceAdded( Tomahawk::source_ptr ) ), Qt::QueuedConnection ); connect( TomahawkSettings::instance(), SIGNAL( recentlyPlayedPlaylistAdded( Tomahawk::playlist_ptr ) ), this, SLOT( plAdded( Tomahawk::playlist_ptr ) ) ); - connect( AudioEngine::instance(),SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistChanged( Tomahawk::PlaylistInterface* ) ), Qt::QueuedConnection ); + connect( AudioEngine::instance(),SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( playlistChanged( Tomahawk::playlistinterface_ptr ) ), Qt::QueuedConnection ); emit emptinessChanged( m_recplaylists.isEmpty() ); } @@ -229,10 +229,13 @@ RecentlyPlayedPlaylistsModel::plAdded( const playlist_ptr& pl ) void -RecentlyPlayedPlaylistsModel::playlistChanged( Tomahawk::PlaylistInterface* pli ) +RecentlyPlayedPlaylistsModel::playlistChanged( Tomahawk::playlistinterface_ptr pli ) { // ARG - if( Playlist* pl = dynamic_cast< Playlist* >( pli ) ) { + if ( pli.isNull() ) + return; + + if ( Playlist *pl = dynamic_cast< Playlist* >( pli.data() ) ) { // look for it, qsharedpointer fail playlist_ptr ptr; foreach( const playlist_ptr& test, m_recplaylists ) { diff --git a/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.h b/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.h index 2f0cad63d..7cd6fb169 100644 --- a/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.h +++ b/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.h @@ -44,8 +44,11 @@ public: signals: void emptinessChanged( bool isEmpty ); +public slots: + void sourceOnline(); + private slots: - void playlistChanged( Tomahawk::PlaylistInterface* ); + void playlistChanged( Tomahawk::playlistinterface_ptr ); void onSourceAdded( const Tomahawk::source_ptr& source ); void onPlaylistsRemoved( QList ); void loadFromSettings(); @@ -60,8 +63,6 @@ private: unsigned int m_maxPlaylists; bool m_waitingForSome; - public slots: - void sourceOnline(); }; #endif // RECENTLYPLAYEDPLAYLISTSMODEL_H diff --git a/src/libtomahawk/widgets/SocialPlaylistWidget.cpp b/src/libtomahawk/widgets/SocialPlaylistWidget.cpp index 56d7cef02..7cf54dd9e 100644 --- a/src/libtomahawk/widgets/SocialPlaylistWidget.cpp +++ b/src/libtomahawk/widgets/SocialPlaylistWidget.cpp @@ -85,7 +85,7 @@ SocialPlaylistWidget::SocialPlaylistWidget ( QWidget* parent ) connect( SourceList::instance(), SIGNAL( ready() ), SLOT( updateRecentTracks() ) ); connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) ); connect( ui->playlistWidget, SIGNAL( activated( QModelIndex ) ), SLOT( onPlaylistActivated( QModelIndex ) ) ); - connect( AudioEngine::instance() ,SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( updatePlaylists() ), Qt::QueuedConnection ); + connect( AudioEngine::instance() ,SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( updatePlaylists() ), Qt::QueuedConnection ); */ fetchFromDB(); } diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp index f24187c3b..0bdcb51de 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp @@ -46,7 +46,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* { ui->setupUi( this ); - m_plInterface = new MetaPlaylistInterface( this ); + m_plInterface = Tomahawk::playlistinterface_ptr( new MetaPlaylistInterface( this ) ); ui->albums->setFrameShape( QFrame::NoFrame ); ui->albums->setAttribute( Qt::WA_MacShowFocusRect, 0 ); @@ -97,7 +97,6 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* ArtistInfoWidget::~ArtistInfoWidget() { - delete m_plInterface; delete ui; } @@ -105,7 +104,7 @@ ArtistInfoWidget::~ArtistInfoWidget() Tomahawk::playlistinterface_ptr ArtistInfoWidget::playlistInterface() const { - return m_plInterface->getSharedPointer(); + return m_plInterface; } diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h index 3a3815088..b851a7325 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h @@ -107,7 +107,7 @@ private: TreeModel* m_relatedModel; TreeModel* m_albumsModel; PlaylistModel* m_topHitsModel; - MetaPlaylistInterface* m_plInterface; + Tomahawk::playlistinterface_ptr m_plInterface; OverlayButton* m_button; diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget_p.h b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget_p.h index 6a312b5e3..b4bd3c270 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget_p.h +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget_p.h @@ -64,7 +64,7 @@ public: virtual QList< Tomahawk::query_ptr > tracks() { return QList< Tomahawk::query_ptr >(); } virtual int unfilteredTrackCount() const { return 0; } - virtual bool hasChildInterface( PlaylistInterface* other ) + virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other ) { return ( m_w->ui->albums->playlistInterface() == other ) || ( m_w->ui->relatedArtists->playlistInterface() == other ) || diff --git a/src/libtomahawk/widgets/whatshotwidget_p.h b/src/libtomahawk/widgets/whatshotwidget_p.h index e4e3d8dc4..14fd48a90 100644 --- a/src/libtomahawk/widgets/whatshotwidget_p.h +++ b/src/libtomahawk/widgets/whatshotwidget_p.h @@ -61,7 +61,7 @@ public: virtual QList< Tomahawk::query_ptr > tracks() { return QList< Tomahawk::query_ptr >(); } virtual int unfilteredTrackCount() const { return 0; } - virtual bool hasChildInterface( PlaylistInterface* other ) + virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other ) { return m_w->ui->tracksViewLeft->playlistInterface() == other || m_w->ui->artistsViewLeft->playlistInterface() == other;