mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-02 04:10:20 +02:00
* PlayableModel::currentIndexChanged signal now has two parameters: newIndex and oldIndex.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2011 Leo Franchi <lfranchi@kde.org>
|
* Copyright 2011 Leo Franchi <lfranchi@kde.org>
|
||||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
@@ -411,6 +411,8 @@ void
|
|||||||
PlayableModel::setCurrentIndex( const QModelIndex& index )
|
PlayableModel::setCurrentIndex( const QModelIndex& index )
|
||||||
{
|
{
|
||||||
Q_D( PlayableModel );
|
Q_D( PlayableModel );
|
||||||
|
|
||||||
|
const QModelIndex oldIndex = d->currentIndex;
|
||||||
PlayableItem* oldEntry = itemFromIndex( d->currentIndex );
|
PlayableItem* oldEntry = itemFromIndex( d->currentIndex );
|
||||||
if ( oldEntry )
|
if ( oldEntry )
|
||||||
{
|
{
|
||||||
@@ -430,7 +432,7 @@ PlayableModel::setCurrentIndex( const QModelIndex& index )
|
|||||||
d->currentUuid = QString();
|
d->currentUuid = QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit currentIndexChanged();
|
emit currentIndexChanged( d->currentIndex, oldIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2011 Leo Franchi <lfranchi@kde.org>
|
* Copyright 2011 Leo Franchi <lfranchi@kde.org>
|
||||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
* Copyright 2013, Uwe L. Korn <uwelk@xhochy.com>
|
* Copyright 2013, Uwe L. Korn <uwelk@xhochy.com>
|
||||||
@@ -145,7 +145,7 @@ signals:
|
|||||||
void indexPlayable( const QModelIndex& index );
|
void indexPlayable( const QModelIndex& index );
|
||||||
|
|
||||||
void changed();
|
void changed();
|
||||||
void currentIndexChanged();
|
void currentIndexChanged( const QModelIndex& newIndex, const QModelIndex& oldIndex );
|
||||||
|
|
||||||
void expandRequest( const QPersistentModelIndex& index );
|
void expandRequest( const QPersistentModelIndex& index );
|
||||||
void selectRequest( const QPersistentModelIndex& index );
|
void selectRequest( const QPersistentModelIndex& index );
|
||||||
|
@@ -120,7 +120,7 @@ PlayableProxyModel::setSourcePlayableModel( PlayableModel* sourceModel )
|
|||||||
disconnect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), this, SIGNAL( itemCountChanged( unsigned int ) ) );
|
disconnect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), this, SIGNAL( itemCountChanged( unsigned int ) ) );
|
||||||
disconnect( m_model, SIGNAL( indexPlayable( QModelIndex ) ), this, SLOT( onIndexPlayable( QModelIndex ) ) );
|
disconnect( m_model, SIGNAL( indexPlayable( QModelIndex ) ), this, SLOT( onIndexPlayable( QModelIndex ) ) );
|
||||||
disconnect( m_model, SIGNAL( indexResolved( QModelIndex ) ), this, SLOT( onIndexResolved( QModelIndex ) ) );
|
disconnect( m_model, SIGNAL( indexResolved( QModelIndex ) ), this, SLOT( onIndexResolved( QModelIndex ) ) );
|
||||||
disconnect( m_model, SIGNAL( currentIndexChanged() ), this, SIGNAL( currentIndexChanged() ) );
|
disconnect( m_model, SIGNAL( currentIndexChanged( QModelIndex, QModelIndex ) ), this, SLOT( onCurrentIndexChanged( QModelIndex, QModelIndex ) ) );
|
||||||
disconnect( m_model, SIGNAL( expandRequest( QPersistentModelIndex ) ), this, SLOT( expandRequested( QPersistentModelIndex ) ) );
|
disconnect( m_model, SIGNAL( expandRequest( QPersistentModelIndex ) ), this, SLOT( expandRequested( QPersistentModelIndex ) ) );
|
||||||
disconnect( m_model, SIGNAL( selectRequest( QPersistentModelIndex ) ), this, SLOT( selectRequested( QPersistentModelIndex ) ) );
|
disconnect( m_model, SIGNAL( selectRequest( QPersistentModelIndex ) ), this, SLOT( selectRequested( QPersistentModelIndex ) ) );
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ PlayableProxyModel::setSourcePlayableModel( PlayableModel* sourceModel )
|
|||||||
connect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), SIGNAL( itemCountChanged( unsigned int ) ) );
|
connect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), SIGNAL( itemCountChanged( unsigned int ) ) );
|
||||||
connect( m_model, SIGNAL( indexPlayable( QModelIndex ) ), SLOT( onIndexPlayable( QModelIndex ) ) );
|
connect( m_model, SIGNAL( indexPlayable( QModelIndex ) ), SLOT( onIndexPlayable( QModelIndex ) ) );
|
||||||
connect( m_model, SIGNAL( indexResolved( QModelIndex ) ), SLOT( onIndexResolved( QModelIndex ) ) );
|
connect( m_model, SIGNAL( indexResolved( QModelIndex ) ), SLOT( onIndexResolved( QModelIndex ) ) );
|
||||||
connect( m_model, SIGNAL( currentIndexChanged() ), SIGNAL( currentIndexChanged() ) );
|
connect( m_model, SIGNAL( currentIndexChanged( QModelIndex, QModelIndex ) ), SLOT( onCurrentIndexChanged( QModelIndex, QModelIndex ) ) );
|
||||||
connect( m_model, SIGNAL( expandRequest( QPersistentModelIndex ) ), SLOT( expandRequested( QPersistentModelIndex ) ) );
|
connect( m_model, SIGNAL( expandRequest( QPersistentModelIndex ) ), SLOT( expandRequested( QPersistentModelIndex ) ) );
|
||||||
connect( m_model, SIGNAL( selectRequest( QPersistentModelIndex ) ), SLOT( selectRequested( QPersistentModelIndex ) ) );
|
connect( m_model, SIGNAL( selectRequest( QPersistentModelIndex ) ), SLOT( selectRequested( QPersistentModelIndex ) ) );
|
||||||
}
|
}
|
||||||
@@ -689,3 +689,10 @@ PlayableProxyModel::selectRequested( const QPersistentModelIndex& idx )
|
|||||||
{
|
{
|
||||||
emit selectRequest( QPersistentModelIndex( mapFromSource( idx ) ) );
|
emit selectRequest( QPersistentModelIndex( mapFromSource( idx ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PlayableProxyModel::onCurrentIndexChanged( const QModelIndex& newIndex, const QModelIndex& oldIndex )
|
||||||
|
{
|
||||||
|
emit currentIndexChanged( mapFromSource( newIndex ), mapFromSource( oldIndex ) );
|
||||||
|
}
|
||||||
|
@@ -95,7 +95,7 @@ signals:
|
|||||||
|
|
||||||
void indexPlayable( const QModelIndex& index );
|
void indexPlayable( const QModelIndex& index );
|
||||||
void indexResolved( const QModelIndex& index );
|
void indexResolved( const QModelIndex& index );
|
||||||
void currentIndexChanged();
|
void currentIndexChanged( const QModelIndex& newIndex, const QModelIndex& oldIndex );
|
||||||
|
|
||||||
void itemCountChanged( unsigned int items );
|
void itemCountChanged( unsigned int items );
|
||||||
|
|
||||||
@@ -114,6 +114,7 @@ private slots:
|
|||||||
|
|
||||||
void expandRequested( const QPersistentModelIndex& index );
|
void expandRequested( const QPersistentModelIndex& index );
|
||||||
void selectRequested( const QPersistentModelIndex& index );
|
void selectRequested( const QPersistentModelIndex& index );
|
||||||
|
void onCurrentIndexChanged( const QModelIndex& newIndex, const QModelIndex& oldIndex );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool lessThan( int column, const Tomahawk::query_ptr& left, const Tomahawk::query_ptr& right ) const;
|
virtual bool lessThan( int column, const Tomahawk::query_ptr& left, const Tomahawk::query_ptr& right ) const;
|
||||||
|
Reference in New Issue
Block a user