1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

TWK-414: Fix selecting newly created playlists and stations.

God this was a PITA. What is going on:

Playlists are created by collection item. SourcesModel::linkSourceItemToPage is called from *constructor* of PlaylistItem, so BEFORE
the CollectionItem calls endRowsAdded(). This means when the SourcesProxyModel does the mapFromSource() during the activateIndex() call
(from linkSourceItemToPage) it won't have the new index in the mapping yet as endRowsAdded() hasn't been called. So that will fail.

We have to queue the signal *from the source model to the proxy* not from the proxy to the view.

EUGH.

Also, fix a few logic errors from teh ViewManager/WeakPointer refactor that had bad logic
This commit is contained in:
Leo Franchi
2011-08-20 00:47:53 -04:00
parent 6521198127
commit 9737f765e5
9 changed files with 34 additions and 30 deletions

View File

@@ -174,7 +174,7 @@ ViewManager::show( const Tomahawk::playlist_ptr& playlist )
{
PlaylistView* view;
if ( !m_playlistViews.contains( playlist ) || !m_playlistViews.value( playlist ).isNull() )
if ( !m_playlistViews.contains( playlist ) || m_playlistViews.value( playlist ).isNull() )
{
view = createPageForPlaylist( playlist );
}
@@ -747,11 +747,11 @@ ViewManager::onWidgetDestroyed( QWidget* widget )
{
ViewPage* page = m_pageHistory.at( i );
if ( !playlistForInterface( page->playlistInterface() ).isNull() )
if ( playlistForInterface( page->playlistInterface() ).isNull() )
{
m_playlistViews.remove( playlistForInterface( page->playlistInterface() ) );
}
if ( !dynamicPlaylistForInterface( page->playlistInterface() ).isNull() )
if ( dynamicPlaylistForInterface( page->playlistInterface() ).isNull() )
{
m_dynamicWidgets.remove( dynamicPlaylistForInterface( page->playlistInterface() ) );
}