From 917f904cbf078ed6e84efe64d2c54786b5da922b Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Tue, 17 May 2011 16:25:49 +0200 Subject: [PATCH] hide queue whenever it is emptied, manually or by play progressing --- src/libtomahawk/playlist/queueproxymodel.cpp | 11 +++++++++-- src/libtomahawk/playlist/queueproxymodel.h | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libtomahawk/playlist/queueproxymodel.cpp b/src/libtomahawk/playlist/queueproxymodel.cpp index 0c8253fb7..28bb5a203 100644 --- a/src/libtomahawk/playlist/queueproxymodel.cpp +++ b/src/libtomahawk/playlist/queueproxymodel.cpp @@ -29,6 +29,8 @@ QueueProxyModel::QueueProxyModel( QObject* parent ) : PlaylistProxyModel( parent ) { qDebug() << Q_FUNC_INFO; + + connect( this, SIGNAL( sourceTrackCountChanged( unsigned int ) ), this, SLOT( onTrackCountChanged( unsigned int ) ) ); } @@ -46,10 +48,15 @@ QueueProxyModel::siblingItem( int itemsAway ) Tomahawk::result_ptr res = PlaylistProxyModel::siblingItem( itemsAway ); qDebug() << "new rowcount:" << rowCount( QModelIndex() ); - if ( rowCount( QModelIndex() ) == 1 ) - ViewManager::instance()->hideQueue(); removeIndex( currentItem() ); return res; } + +void +QueueProxyModel::onTrackCountChanged( unsigned int count ) +{ + if ( count == 0 ) + ViewManager::instance()->hideQueue(); +} diff --git a/src/libtomahawk/playlist/queueproxymodel.h b/src/libtomahawk/playlist/queueproxymodel.h index fd240dfb8..e7fc1826d 100644 --- a/src/libtomahawk/playlist/queueproxymodel.h +++ b/src/libtomahawk/playlist/queueproxymodel.h @@ -34,6 +34,9 @@ public: ~QueueProxyModel(); virtual Tomahawk::result_ptr siblingItem( int itemsAway ); + +private slots: + void onTrackCountChanged( unsigned int count ); }; #endif // QUEUEPROXYMODEL_H