From 61e16382286d1b9749556438831e6a0df962762c Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Wed, 16 Jul 2014 07:04:47 +0100 Subject: [PATCH] Only connect slots if needed --- src/libtomahawk/playlist/PlayableModel.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libtomahawk/playlist/PlayableModel.cpp b/src/libtomahawk/playlist/PlayableModel.cpp index 802f45781..2b88246cd 100644 --- a/src/libtomahawk/playlist/PlayableModel.cpp +++ b/src/libtomahawk/playlist/PlayableModel.cpp @@ -682,8 +682,18 @@ PlayableModel::insertInternal( const QList< T >& items, int row, const QList< To plitem->index = createIndex( row + i, 0, plitem ); if ( plitem->query() ) { - connect( plitem->query().data(), SIGNAL( playableStateChanged( bool ) ), SLOT( onQueryBecamePlayable( bool ) ), Qt::UniqueConnection ); - connect( plitem->query().data(), SIGNAL( resolvingFinished( bool ) ), SLOT( onQueryResolved( bool ) ), Qt::UniqueConnection ); + if ( !plitem->query()->playable() ) + { + connect( plitem->query().data(), SIGNAL( playableStateChanged( bool ) ), + SLOT( onQueryBecamePlayable( bool ) ), + Qt::UniqueConnection ); + } + if ( !plitem->query()->resolvingFinished() ) + { + connect( plitem->query().data(), SIGNAL( resolvingFinished( bool ) ), + SLOT( onQueryResolved( bool ) ), + Qt::UniqueConnection ); + } } if ( logs.count() > i )