mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
* Changed various classes to use the new itemCountChanged() signal.
This commit is contained in:
@@ -84,7 +84,7 @@ MprisPlugin::init()
|
|||||||
Tomahawk::playlistinterface_ptr playlist = AudioEngine::instance()->playlist();
|
Tomahawk::playlistinterface_ptr playlist = AudioEngine::instance()->playlist();
|
||||||
if ( !playlist.isNull() )
|
if ( !playlist.isNull() )
|
||||||
{
|
{
|
||||||
connect( playlist.data(), SIGNAL( trackCountChanged( unsigned int ) ),
|
connect( playlist.data(), SIGNAL( itemCountChanged( unsigned int ) ),
|
||||||
SLOT( onTrackCountChanged( unsigned int ) ) );
|
SLOT( onTrackCountChanged( unsigned int ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,7 +551,7 @@ MprisPlugin::onPlaylistChanged( Tomahawk::playlistinterface_ptr playlist )
|
|||||||
disconnect( this, SLOT( onTrackCountChanged( unsigned int ) ) );
|
disconnect( this, SLOT( onTrackCountChanged( unsigned int ) ) );
|
||||||
|
|
||||||
if ( !playlist.isNull() )
|
if ( !playlist.isNull() )
|
||||||
connect( playlist.data(), SIGNAL( trackCountChanged( unsigned int ) ),
|
connect( playlist.data(), SIGNAL( itemCountChanged( unsigned int ) ),
|
||||||
SLOT( onTrackCountChanged( unsigned int ) ) );
|
SLOT( onTrackCountChanged( unsigned int ) ) );
|
||||||
|
|
||||||
// Notify relevant changes
|
// Notify relevant changes
|
||||||
|
@@ -538,7 +538,6 @@ PlayableModel::insertInternal( const QList< T >& items, int row )
|
|||||||
{
|
{
|
||||||
if ( !items.count() )
|
if ( !items.count() )
|
||||||
{
|
{
|
||||||
emit trackCountChanged( rowCount( QModelIndex() ) );
|
|
||||||
emit itemCountChanged( rowCount( QModelIndex() ) );
|
emit itemCountChanged( rowCount( QModelIndex() ) );
|
||||||
|
|
||||||
finishLoading();
|
finishLoading();
|
||||||
@@ -567,7 +566,7 @@ PlayableModel::insertInternal( const QList< T >& items, int row )
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit endInsertRows();
|
emit endInsertRows();
|
||||||
emit trackCountChanged( rowCount( QModelIndex() ) );
|
emit itemCountChanged( rowCount( QModelIndex() ) );
|
||||||
finishLoading();
|
finishLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,7 +602,7 @@ PlayableModel::removeIndex( const QModelIndex& index, bool moreToCome )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !moreToCome )
|
if ( !moreToCome )
|
||||||
emit trackCountChanged( rowCount( QModelIndex() ) );
|
emit itemCountChanged( rowCount( QModelIndex() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -115,7 +115,6 @@ signals:
|
|||||||
void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode );
|
void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode );
|
||||||
void shuffleModeChanged( bool enabled );
|
void shuffleModeChanged( bool enabled );
|
||||||
|
|
||||||
void trackCountChanged( unsigned int tracks );
|
|
||||||
void itemCountChanged( unsigned int items );
|
void itemCountChanged( unsigned int items );
|
||||||
|
|
||||||
void loadingStarted();
|
void loadingStarted();
|
||||||
|
@@ -106,6 +106,7 @@ PlayableProxyModel::setSourcePlayableModel( PlayableModel* sourceModel )
|
|||||||
{
|
{
|
||||||
disconnect( m_model, SIGNAL( loadingStarted() ), this, SIGNAL( loadingStarted() ) );
|
disconnect( m_model, SIGNAL( loadingStarted() ), this, SIGNAL( loadingStarted() ) );
|
||||||
disconnect( m_model, SIGNAL( loadingFinished() ), this, SIGNAL( loadingFinished() ) );
|
disconnect( m_model, SIGNAL( loadingFinished() ), this, SIGNAL( loadingFinished() ) );
|
||||||
|
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 ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +116,7 @@ PlayableProxyModel::setSourcePlayableModel( PlayableModel* sourceModel )
|
|||||||
{
|
{
|
||||||
connect( m_model, SIGNAL( loadingStarted() ), SIGNAL( loadingStarted() ) );
|
connect( m_model, SIGNAL( loadingStarted() ), SIGNAL( loadingStarted() ) );
|
||||||
connect( m_model, SIGNAL( loadingFinished() ), SIGNAL( loadingFinished() ) );
|
connect( m_model, SIGNAL( loadingFinished() ), SIGNAL( loadingFinished() ) );
|
||||||
|
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 ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -96,6 +96,8 @@ signals:
|
|||||||
void indexPlayable( const QModelIndex& index );
|
void indexPlayable( const QModelIndex& index );
|
||||||
void currentIndexChanged();
|
void currentIndexChanged();
|
||||||
|
|
||||||
|
void itemCountChanged( unsigned int items );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const;
|
virtual bool filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const;
|
||||||
virtual bool lessThan( const QModelIndex& left, const QModelIndex& right ) const;
|
virtual bool lessThan( const QModelIndex& left, const QModelIndex& right ) const;
|
||||||
|
@@ -41,7 +41,7 @@ PlayableProxyModelPlaylistInterface::PlayableProxyModelPlaylistInterface( Playab
|
|||||||
connect( proxyModel, SIGNAL( currentIndexChanged() ), SLOT( onModelChanged() ) );
|
connect( proxyModel, SIGNAL( currentIndexChanged() ), SLOT( onModelChanged() ) );
|
||||||
connect( proxyModel, SIGNAL( indexPlayable( QModelIndex ) ), SLOT( onModelChanged() ) );
|
connect( proxyModel, SIGNAL( indexPlayable( QModelIndex ) ), SLOT( onModelChanged() ) );
|
||||||
connect( proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onModelChanged() ) );
|
connect( proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onModelChanged() ) );
|
||||||
// connect( proxyModel, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( onModelChanged() ) );
|
connect( proxyModel, SIGNAL( itemCountChanged( unsigned int ) ), SLOT( onModelChanged() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -242,7 +242,7 @@ PlaylistModel::insertEntries( const QList< Tomahawk::plentry_ptr >& entries, int
|
|||||||
{
|
{
|
||||||
if ( !entries.count() )
|
if ( !entries.count() )
|
||||||
{
|
{
|
||||||
emit trackCountChanged( rowCount( QModelIndex() ) );
|
emit itemCountChanged( rowCount( QModelIndex() ) );
|
||||||
finishLoading();
|
finishLoading();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ PlaylistModel::insertEntries( const QList< Tomahawk::plentry_ptr >& entries, int
|
|||||||
finishLoading();
|
finishLoading();
|
||||||
|
|
||||||
emit endInsertRows();
|
emit endInsertRows();
|
||||||
emit trackCountChanged( rowCount( QModelIndex() ) );
|
emit itemCountChanged( rowCount( QModelIndex() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@ QueueView::QueueView( AnimatedSplitter* parent )
|
|||||||
// ui->queue->setEmptyTip( tr( "The queue is currently empty. Drop something to enqueue it!" ) );
|
// ui->queue->setEmptyTip( tr( "The queue is currently empty. Drop something to enqueue it!" ) );
|
||||||
ui->queue->setEmptyTip( QString() );
|
ui->queue->setEmptyTip( QString() );
|
||||||
|
|
||||||
connect( queueModel, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( updateLabel() ) );
|
connect( queueModel, SIGNAL( itemCountChanged( unsigned int ) ), SLOT( updateLabel() ) );
|
||||||
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) );
|
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) );
|
||||||
connect( this, SIGNAL( animationFinished() ), SLOT( onAnimationFinished() ) );
|
connect( this, SIGNAL( animationFinished() ), SLOT( onAnimationFinished() ) );
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ DynamicModel::loadPlaylist( const Tomahawk::dynplaylist_ptr& playlist, bool load
|
|||||||
PlaylistModel::loadPlaylist( m_playlist, m_playlist->mode() == Static );
|
PlaylistModel::loadPlaylist( m_playlist, m_playlist->mode() == Static );
|
||||||
|
|
||||||
if ( m_playlist->mode() == OnDemand && oldCount != rowCount( QModelIndex() ) )
|
if ( m_playlist->mode() == OnDemand && oldCount != rowCount( QModelIndex() ) )
|
||||||
emit trackCountChanged( rowCount( QModelIndex() ) );
|
emit itemCountChanged( rowCount( QModelIndex() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -76,7 +76,7 @@ DynamicView::setDynamicModel( DynamicModel* model )
|
|||||||
m_model = model;
|
m_model = model;
|
||||||
PlaylistView::setPlaylistModel( m_model );
|
PlaylistView::setPlaylistModel( m_model );
|
||||||
|
|
||||||
connect( m_model, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( onTrackCountChanged( unsigned int ) ) );
|
connect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), SLOT( onTrackCountChanged( unsigned int ) ) );
|
||||||
connect( m_model, SIGNAL( checkForOverflow() ), SLOT( checkForOverflow() ) );
|
connect( m_model, SIGNAL( checkForOverflow() ), SLOT( checkForOverflow() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user