diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp index c5c30251f..1a0b4ece7 100644 --- a/src/libtomahawk/ViewManager.cpp +++ b/src/libtomahawk/ViewManager.cpp @@ -568,7 +568,7 @@ ViewManager::setPage( ViewPage* page, bool trackHistory ) emit historyBackAvailable( m_pageHistoryBack.count() ); emit historyForwardAvailable( m_pageHistoryFwd.count() ); - qDebug() << "View page shown:" << page->title(); + tDebug() << "View page shown:" << page->title(); emit viewPageActivated( page ); if ( page->isTemporaryPage() ) @@ -581,25 +581,25 @@ ViewManager::setPage( ViewPage* page, bool trackHistory ) if ( QObject* obj = dynamic_cast< QObject* >( currentPage() ) ) { // if the signal exists (just to hide the qobject runtime warning...) - if( obj->metaObject()->indexOfSignal( "descriptionChanged(QString)" ) > -1 ) + if ( obj->metaObject()->indexOfSignal( "descriptionChanged(QString)" ) > -1 ) connect( obj, SIGNAL( descriptionChanged( QString ) ), m_infobar, SLOT( setDescription( QString ) ), Qt::UniqueConnection ); - if( obj->metaObject()->indexOfSignal( "descriptionChanged(Tomahawk::artist_ptr)" ) > -1 ) + if ( obj->metaObject()->indexOfSignal( "descriptionChanged(Tomahawk::artist_ptr)" ) > -1 ) connect( obj, SIGNAL( descriptionChanged( Tomahawk::artist_ptr ) ), m_infobar, SLOT( setDescription( Tomahawk::artist_ptr ) ), Qt::UniqueConnection ); - if( obj->metaObject()->indexOfSignal( "descriptionChanged(Tomahawk::album_ptr)" ) > -1 ) + if ( obj->metaObject()->indexOfSignal( "descriptionChanged(Tomahawk::album_ptr)" ) > -1 ) connect( obj, SIGNAL( descriptionChanged( Tomahawk::album_ptr ) ), m_infobar, SLOT( setDescription( Tomahawk::album_ptr ) ), Qt::UniqueConnection ); - if( obj->metaObject()->indexOfSignal( "longDescriptionChanged(QString)" ) > -1 ) + if ( obj->metaObject()->indexOfSignal( "longDescriptionChanged(QString)" ) > -1 ) connect( obj, SIGNAL( longDescriptionChanged( QString ) ), m_infobar, SLOT( setLongDescription( QString ) ), Qt::UniqueConnection ); - if( obj->metaObject()->indexOfSignal( "nameChanged(QString)" ) > -1 ) + if ( obj->metaObject()->indexOfSignal( "nameChanged(QString)" ) > -1 ) connect( obj, SIGNAL( nameChanged( QString ) ), m_infobar, SLOT( setCaption( QString ) ), Qt::UniqueConnection ); - if( obj->metaObject()->indexOfSignal( "pixmapChanged(QPixmap)" ) > -1 ) + if ( obj->metaObject()->indexOfSignal( "pixmapChanged(QPixmap)" ) > -1 ) connect( obj, SIGNAL( pixmapChanged( QPixmap ) ), m_infobar, SLOT( setPixmap( QPixmap ) ), Qt::UniqueConnection ); - if( obj->metaObject()->indexOfSignal( "destroyed(QWidget*)" ) > -1 ) + if ( obj->metaObject()->indexOfSignal( "destroyed(QWidget*)" ) > -1 ) connect( obj, SIGNAL( destroyed( QWidget* ) ), SLOT( onWidgetDestroyed( QWidget* ) ), Qt::UniqueConnection ); } diff --git a/src/tomahawk/sourcetree/SourcesModel.cpp b/src/tomahawk/sourcetree/SourcesModel.cpp index e6130ffd0..be13a3257 100644 --- a/src/tomahawk/sourcetree/SourcesModel.cpp +++ b/src/tomahawk/sourcetree/SourcesModel.cpp @@ -436,12 +436,13 @@ SourcesModel::viewPageActivated( Tomahawk::ViewPage* page ) { Q_ASSERT( m_sourceTreeLinks[ page ] ); tDebug() << "Got view page activated for item:" << m_sourceTreeLinks[ page ]->text(); - QModelIndex idx = indexFromItem( m_sourceTreeLinks[ page ] ); + QPersistentModelIndex idx = indexFromItem( m_sourceTreeLinks[ page ] ); + tDebug() << "Got view page activated for index:" << idx; if ( !idx.isValid() ) m_sourceTreeLinks.remove( page ); else - emit selectRequest( QPersistentModelIndex( idx ) ); + emit selectRequest( idx ); } else { @@ -683,7 +684,7 @@ void SourcesModel::onWidgetDestroyed( QWidget* w ) { int ret = m_sourceTreeLinks.remove( dynamic_cast< Tomahawk::ViewPage* > ( w ) ); - qDebug() << "REMOVED STALE SOURCE PAGE?" << ret; + tDebug() << "Removed stale source page:" << ret; } diff --git a/src/tomahawk/sourcetree/items/SourceTreeItem.cpp b/src/tomahawk/sourcetree/items/SourceTreeItem.cpp index 84aa13632..6eb95d8db 100644 --- a/src/tomahawk/sourcetree/items/SourceTreeItem.cpp +++ b/src/tomahawk/sourcetree/items/SourceTreeItem.cpp @@ -274,9 +274,13 @@ SourceTreeItem::removeFromList() void SourceTreeItem::pageDestroyed() { + //FIXME: this seems to be triggered twice for temporary pages model()->removeSourceItemLink( this ); int idx = parent()->children().indexOf( this ); + if ( idx < 0 ) + return; + parent()->beginRowsRemoved( idx, idx ); parent()->removeChild( this ); parent()->endRowsRemoved(); @@ -284,5 +288,3 @@ SourceTreeItem::pageDestroyed() emit removed(); deleteLater(); } - -