From b25cc538f7e34f0cc89f65ac852cd0a154739b22 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 13 Jun 2013 10:25:59 +0200 Subject: [PATCH] * When a track starts playing, check if we need to update the sidebar's speaker-icon. --- src/tomahawk/sourcetree/items/SourceTreeItem.cpp | 11 +++++++++++ src/tomahawk/sourcetree/items/SourceTreeItem.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/tomahawk/sourcetree/items/SourceTreeItem.cpp b/src/tomahawk/sourcetree/items/SourceTreeItem.cpp index 2225c6b09..f042b561a 100644 --- a/src/tomahawk/sourcetree/items/SourceTreeItem.cpp +++ b/src/tomahawk/sourcetree/items/SourceTreeItem.cpp @@ -18,6 +18,7 @@ #include "SourceTreeItem.h" +#include "audio/AudioEngine.h" #include "utils/Logger.h" using namespace Tomahawk; @@ -30,6 +31,8 @@ SourceTreeItem::SourceTreeItem( SourcesModel* model, SourceTreeItem* parent, Sou , m_model( model ) , m_peerSortValue( peerSortValue ) { + connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( checkPlayingStatus() ) ); + connect( this, SIGNAL( beginChildRowsAdded( int, int ) ), m_model, SLOT( onItemRowsAddedBegin( int, int ) ) ); connect( this, SIGNAL( beginChildRowsRemoved( int, int ) ), m_model, SLOT( onItemRowsRemovedBegin( int, int ) ) ); connect( this, SIGNAL( childRowsAdded() ), m_model, SLOT( onItemRowsAddedDone() ) ); @@ -56,6 +59,14 @@ SourceTreeItem::~SourceTreeItem() } +void +SourceTreeItem::checkPlayingStatus() +{ + if ( isBeingPlayed() ) + emit updated(); +} + + SourcesModel::RowType SourceTreeItem::type() const { diff --git a/src/tomahawk/sourcetree/items/SourceTreeItem.h b/src/tomahawk/sourcetree/items/SourceTreeItem.h index ea7dbe880..91a9c9e54 100644 --- a/src/tomahawk/sourcetree/items/SourceTreeItem.h +++ b/src/tomahawk/sourcetree/items/SourceTreeItem.h @@ -98,6 +98,9 @@ protected: void setRowType( SourcesModel::RowType t ); void setParentItem( SourceTreeItem* item ); +private slots: + void checkPlayingStatus(); + private: SourcesModel::RowType m_type;