mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-25 15:01:11 +02:00
* Fixed selecting correct sidebar item after destroying temporary page.
This commit is contained in:
@@ -568,7 +568,7 @@ ViewManager::setPage( ViewPage* page, bool trackHistory )
|
|||||||
emit historyBackAvailable( m_pageHistoryBack.count() );
|
emit historyBackAvailable( m_pageHistoryBack.count() );
|
||||||
emit historyForwardAvailable( m_pageHistoryFwd.count() );
|
emit historyForwardAvailable( m_pageHistoryFwd.count() );
|
||||||
|
|
||||||
qDebug() << "View page shown:" << page->title();
|
tDebug() << "View page shown:" << page->title();
|
||||||
emit viewPageActivated( page );
|
emit viewPageActivated( page );
|
||||||
|
|
||||||
if ( page->isTemporaryPage() )
|
if ( page->isTemporaryPage() )
|
||||||
@@ -581,25 +581,25 @@ ViewManager::setPage( ViewPage* page, bool trackHistory )
|
|||||||
if ( QObject* obj = dynamic_cast< QObject* >( currentPage() ) )
|
if ( QObject* obj = dynamic_cast< QObject* >( currentPage() ) )
|
||||||
{
|
{
|
||||||
// if the signal exists (just to hide the qobject runtime warning...)
|
// 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 );
|
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 );
|
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 );
|
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 );
|
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 );
|
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 );
|
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 );
|
connect( obj, SIGNAL( destroyed( QWidget* ) ), SLOT( onWidgetDestroyed( QWidget* ) ), Qt::UniqueConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -436,12 +436,13 @@ SourcesModel::viewPageActivated( Tomahawk::ViewPage* page )
|
|||||||
{
|
{
|
||||||
Q_ASSERT( m_sourceTreeLinks[ page ] );
|
Q_ASSERT( m_sourceTreeLinks[ page ] );
|
||||||
tDebug() << "Got view page activated for item:" << m_sourceTreeLinks[ page ]->text();
|
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() )
|
if ( !idx.isValid() )
|
||||||
m_sourceTreeLinks.remove( page );
|
m_sourceTreeLinks.remove( page );
|
||||||
else
|
else
|
||||||
emit selectRequest( QPersistentModelIndex( idx ) );
|
emit selectRequest( idx );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -683,7 +684,7 @@ void
|
|||||||
SourcesModel::onWidgetDestroyed( QWidget* w )
|
SourcesModel::onWidgetDestroyed( QWidget* w )
|
||||||
{
|
{
|
||||||
int ret = m_sourceTreeLinks.remove( dynamic_cast< Tomahawk::ViewPage* > ( w ) );
|
int ret = m_sourceTreeLinks.remove( dynamic_cast< Tomahawk::ViewPage* > ( w ) );
|
||||||
qDebug() << "REMOVED STALE SOURCE PAGE?" << ret;
|
tDebug() << "Removed stale source page:" << ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -274,9 +274,13 @@ SourceTreeItem::removeFromList()
|
|||||||
void
|
void
|
||||||
SourceTreeItem::pageDestroyed()
|
SourceTreeItem::pageDestroyed()
|
||||||
{
|
{
|
||||||
|
//FIXME: this seems to be triggered twice for temporary pages
|
||||||
model()->removeSourceItemLink( this );
|
model()->removeSourceItemLink( this );
|
||||||
|
|
||||||
int idx = parent()->children().indexOf( this );
|
int idx = parent()->children().indexOf( this );
|
||||||
|
if ( idx < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
parent()->beginRowsRemoved( idx, idx );
|
parent()->beginRowsRemoved( idx, idx );
|
||||||
parent()->removeChild( this );
|
parent()->removeChild( this );
|
||||||
parent()->endRowsRemoved();
|
parent()->endRowsRemoved();
|
||||||
@@ -284,5 +288,3 @@ SourceTreeItem::pageDestroyed()
|
|||||||
emit removed();
|
emit removed();
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user