mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
only keep one playlistview and playlist model in memory at once
This commit is contained in:
@@ -64,6 +64,10 @@ PlaylistManager::PlaylistManager( QObject* parent )
|
|||||||
m_stack->addWidget( m_superAlbumView );
|
m_stack->addWidget( m_superAlbumView );
|
||||||
m_currentInterface = m_superCollectionView->proxyModel();
|
m_currentInterface = m_superCollectionView->proxyModel();
|
||||||
|
|
||||||
|
m_playlistView = new PlaylistView();
|
||||||
|
m_stack->addWidget( m_playlistView );
|
||||||
|
m_playlistModel = new PlaylistModel();
|
||||||
|
|
||||||
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
|
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,28 +90,22 @@ PlaylistManager::show( const Tomahawk::playlist_ptr& playlist )
|
|||||||
{
|
{
|
||||||
unlinkPlaylist();
|
unlinkPlaylist();
|
||||||
|
|
||||||
if ( !m_playlistViews.contains( playlist ) )
|
m_playlistModel->loadPlaylist( playlist );
|
||||||
{
|
m_playlistView->setModel( m_playlistModel );
|
||||||
PlaylistView* view = new PlaylistView();
|
|
||||||
PlaylistModel* model = new PlaylistModel();
|
|
||||||
view->setModel( model );
|
|
||||||
|
|
||||||
model->loadPlaylist( playlist );
|
if ( !m_loadedPlaylists.contains( playlist ) )
|
||||||
|
{
|
||||||
playlist->resolve();
|
playlist->resolve();
|
||||||
|
|
||||||
m_currentInterface = view->proxyModel();
|
|
||||||
m_playlistViews.insert( playlist, view );
|
|
||||||
|
|
||||||
m_stack->addWidget( view );
|
|
||||||
m_stack->setCurrentWidget( view );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PlaylistView* view = m_playlistViews.value( playlist );
|
m_loadedPlaylists << playlist;
|
||||||
m_stack->setCurrentWidget( view );
|
|
||||||
m_currentInterface = view->proxyModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_currentInterface = m_playlistView->proxyModel();
|
||||||
|
m_stack->setCurrentWidget( m_playlistView );
|
||||||
|
|
||||||
m_superCollectionVisible = false;
|
m_superCollectionVisible = false;
|
||||||
m_statsAvailable = true;
|
m_statsAvailable = true;
|
||||||
m_modesAvailable = false;
|
m_modesAvailable = false;
|
||||||
@@ -124,25 +122,10 @@ PlaylistManager::show( const Tomahawk::album_ptr& album )
|
|||||||
qDebug() << Q_FUNC_INFO << &album << album.data();
|
qDebug() << Q_FUNC_INFO << &album << album.data();
|
||||||
unlinkPlaylist();
|
unlinkPlaylist();
|
||||||
|
|
||||||
if ( !m_albumViews.contains( album ) )
|
m_playlistModel->loadAlbum( album );
|
||||||
{
|
m_stack->setCurrentWidget( m_playlistView );
|
||||||
PlaylistView* view = new PlaylistView();
|
|
||||||
PlaylistModel* model = new PlaylistModel();
|
|
||||||
view->setModel( model );
|
|
||||||
model->loadAlbum( album );
|
|
||||||
|
|
||||||
m_currentInterface = view->proxyModel();
|
m_currentInterface = m_playlistView->proxyModel();
|
||||||
m_albumViews.insert( album, view );
|
|
||||||
|
|
||||||
m_stack->addWidget( view );
|
|
||||||
m_stack->setCurrentWidget( view );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PlaylistView* view = m_albumViews.value( album );
|
|
||||||
m_stack->setCurrentWidget( view );
|
|
||||||
m_currentInterface = view->proxyModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_superCollectionVisible = false;
|
m_superCollectionVisible = false;
|
||||||
m_statsAvailable = false;
|
m_statsAvailable = false;
|
||||||
|
@@ -86,14 +86,14 @@ private:
|
|||||||
AlbumView* m_superAlbumView;
|
AlbumView* m_superAlbumView;
|
||||||
CollectionFlatModel* m_superCollectionFlatModel;
|
CollectionFlatModel* m_superCollectionFlatModel;
|
||||||
CollectionView* m_superCollectionView;
|
CollectionView* m_superCollectionView;
|
||||||
|
PlaylistView* m_playlistView;
|
||||||
|
|
||||||
|
QList<Tomahawk::playlist_ptr> m_loadedPlaylists;
|
||||||
QList< Tomahawk::collection_ptr > m_superCollections;
|
QList< Tomahawk::collection_ptr > m_superCollections;
|
||||||
|
PlaylistModel* m_playlistModel;
|
||||||
|
|
||||||
QHash< Tomahawk::collection_ptr, CollectionView* > m_collectionViews;
|
QHash< Tomahawk::collection_ptr, CollectionView* > m_collectionViews;
|
||||||
QHash< Tomahawk::collection_ptr, AlbumView* > m_collectionAlbumViews;
|
QHash< Tomahawk::collection_ptr, AlbumView* > m_collectionAlbumViews;
|
||||||
|
|
||||||
QHash< Tomahawk::playlist_ptr, PlaylistView* > m_playlistViews;
|
|
||||||
QHash< Tomahawk::album_ptr, PlaylistView* > m_albumViews;
|
|
||||||
QHash< Tomahawk::source_ptr, SourceInfoWidget* > m_sourceViews;
|
QHash< Tomahawk::source_ptr, SourceInfoWidget* > m_sourceViews;
|
||||||
|
|
||||||
PlaylistInterface* m_currentInterface;
|
PlaylistInterface* m_currentInterface;
|
||||||
|
Reference in New Issue
Block a user