From 83922512807658b54beb473cd9de2050cce0b998 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Mon, 30 Apr 2012 22:41:37 -0400 Subject: [PATCH] remove usage of smartpointerlist --- src/accounts/spotify/SpotifyAccount.cpp | 4 ++-- src/libtomahawk/Playlist.h | 5 ++--- src/libtomahawk/ViewPage.h | 3 +-- src/libtomahawk/infobar/InfoBar.cpp | 2 +- src/libtomahawk/infobar/InfoBar.h | 5 ++--- src/libtomahawk/playlist/PlaylistView.cpp | 4 ++-- src/libtomahawk/playlist/PlaylistView.h | 2 +- src/libtomahawk/utils/SmartPointerList.h | 5 +++++ src/sourcetree/items/PlaylistItems.h | 3 +-- 9 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/accounts/spotify/SpotifyAccount.cpp b/src/accounts/spotify/SpotifyAccount.cpp index 873af1846..a15047d44 100644 --- a/src/accounts/spotify/SpotifyAccount.cpp +++ b/src/accounts/spotify/SpotifyAccount.cpp @@ -124,7 +124,7 @@ SpotifyAccount::aboutToShow( QAction* action, const playlist_ptr& playlist ) // If it's not being synced, allow the option to sync bool found = false; - SmartPointerList updaters = playlist->updaters(); + QList updaters = playlist->updaters(); foreach ( PlaylistUpdaterInterface* updater, updaters ) { if ( SpotifyPlaylistUpdater* spotifyUpdater = qobject_cast< SpotifyPlaylistUpdater* >( updater ) ) @@ -163,7 +163,7 @@ SpotifyAccount::syncActionTriggered( bool checked ) } SpotifyPlaylistUpdater* updater = 0; - SmartPointerList updaters = playlist->updaters(); + QList updaters = playlist->updaters(); foreach ( PlaylistUpdaterInterface* u, updaters ) { if ( SpotifyPlaylistUpdater* spotifyUpdater = qobject_cast< SpotifyPlaylistUpdater* >( u ) ) diff --git a/src/libtomahawk/Playlist.h b/src/libtomahawk/Playlist.h index ce62e5d67..649468086 100644 --- a/src/libtomahawk/Playlist.h +++ b/src/libtomahawk/Playlist.h @@ -34,7 +34,6 @@ #include "Query.h" #include "DllMacro.h" -#include "utils/SmartPointerList.h" class DatabaseCommand_LoadAllPlaylists; class DatabaseCommand_LoadAllSortedPlaylists; @@ -192,7 +191,7 @@ public: void addUpdater( PlaylistUpdaterInterface* updater ); void removeUpdater( PlaylistUpdaterInterface* updater ); - SmartPointerList updaters() const { return m_updaters; } + QList updaters() const { return m_updaters; } Tomahawk::playlistinterface_ptr playlistInterface(); @@ -302,7 +301,7 @@ private: QQueue m_revisionQueue; QQueue m_updateQueue; - SmartPointerList m_updaters; + QList m_updaters; bool m_locallyChanged; bool m_deleted; diff --git a/src/libtomahawk/ViewPage.h b/src/libtomahawk/ViewPage.h index c63e5ebd8..2398c9e04 100644 --- a/src/libtomahawk/ViewPage.h +++ b/src/libtomahawk/ViewPage.h @@ -25,7 +25,6 @@ #include "Artist.h" #include "Album.h" #include "utils/TomahawkUtils.h" -#include "utils/SmartPointerList.h" #include "playlist/PlaylistUpdaterInterface.h" #include @@ -70,7 +69,7 @@ public: virtual bool isTemporaryPage() const { return false; } virtual bool isBeingPlayed() const { return false; } - virtual SmartPointerList updaters() const { return SmartPointerList(); } + virtual QList updaters() const { return QList(); } /** subclasses implementing ViewPage can emit the following signals: * nameChanged( const QString& ) diff --git a/src/libtomahawk/infobar/InfoBar.cpp b/src/libtomahawk/infobar/InfoBar.cpp index b3e5ed91e..0f999e5f7 100644 --- a/src/libtomahawk/infobar/InfoBar.cpp +++ b/src/libtomahawk/infobar/InfoBar.cpp @@ -201,7 +201,7 @@ InfoBar::setFilterAvailable( bool b ) void -InfoBar::setUpdaters( const SmartPointerList& updaters ) +InfoBar::setUpdaters( const QList& updaters ) { QList< QWidget* > newUpdaterWidgets; foreach ( PlaylistUpdaterInterface* updater, updaters ) diff --git a/src/libtomahawk/infobar/InfoBar.h b/src/libtomahawk/infobar/InfoBar.h index e3cecf775..b69aed592 100644 --- a/src/libtomahawk/infobar/InfoBar.h +++ b/src/libtomahawk/infobar/InfoBar.h @@ -24,7 +24,6 @@ #include "DllMacro.h" #include "Artist.h" -#include class QueryLabel; class QCheckBox; @@ -64,7 +63,7 @@ public slots: void setFilter( const QString& filter ); void setFilterAvailable( bool b ); - void setUpdaters( const SmartPointerList& updaters ); + void setUpdaters( const QList& updaters ); signals: void filterTextChanged( const QString& filter ); @@ -84,7 +83,7 @@ private: QPixmap m_bgTile; QPalette m_whitePal; - SmartPointerList m_updaters;; + QList m_updaters;; QList m_updaterConfigurations; QSearchField* m_searchWidget; diff --git a/src/libtomahawk/playlist/PlaylistView.cpp b/src/libtomahawk/playlist/PlaylistView.cpp index 4fc140cf4..92d6ebe41 100644 --- a/src/libtomahawk/playlist/PlaylistView.cpp +++ b/src/libtomahawk/playlist/PlaylistView.cpp @@ -109,13 +109,13 @@ PlaylistView::deleteItems() } -SmartPointerList +QList PlaylistView::updaters() const { if ( !m_model->playlist().isNull() ) return m_model->playlist()->updaters(); - return SmartPointerList(); + return QList(); } diff --git a/src/libtomahawk/playlist/PlaylistView.h b/src/libtomahawk/playlist/PlaylistView.h index 65d3d6995..978e4e15f 100644 --- a/src/libtomahawk/playlist/PlaylistView.h +++ b/src/libtomahawk/playlist/PlaylistView.h @@ -43,7 +43,7 @@ public: virtual bool showFilter() const { return true; } - virtual SmartPointerList updaters() const; + virtual QList updaters() const; virtual QString title() const { return playlistModel()->title(); } virtual QString description() const { return m_model->description(); } diff --git a/src/libtomahawk/utils/SmartPointerList.h b/src/libtomahawk/utils/SmartPointerList.h index aeb2c0898..16e9ae6b7 100644 --- a/src/libtomahawk/utils/SmartPointerList.h +++ b/src/libtomahawk/utils/SmartPointerList.h @@ -55,6 +55,11 @@ private slots: * Exposed clear. This class doesn't have a QPtrList autodelete functionality * ever, so if people think that, they're really confused! -- Ian Monroe * + * NOTE: + * This class is NOT implicitly shared like QList. Passing it around + * ***will*** cause it to iterate and copy all the elements in the copy + * constructor! + * */ template class SmartPointerList : private QList { diff --git a/src/sourcetree/items/PlaylistItems.h b/src/sourcetree/items/PlaylistItems.h index bd1902e58..31198e778 100644 --- a/src/sourcetree/items/PlaylistItems.h +++ b/src/sourcetree/items/PlaylistItems.h @@ -21,7 +21,6 @@ #include "SourceTreeItem.h" #include "playlist/dynamic/DynamicPlaylist.h" -#include "utils/SmartPointerList.h" class PlaylistItem : public SourceTreeItem { @@ -62,7 +61,7 @@ private: bool m_loaded; Tomahawk::playlist_ptr m_playlist; QIcon m_icon, m_overlaidIcon; - SmartPointerList m_overlaidUpdaters; + QList m_overlaidUpdaters; }; Q_DECLARE_OPERATORS_FOR_FLAGS(PlaylistItem::DropTypes)