1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

Hide red latch headphones on local source if the source you are latched on to goes offline

This commit is contained in:
Leo Franchi 2011-11-11 16:57:35 -05:00
parent 96fe10cc9f
commit d49a43709d
2 changed files with 20 additions and 1 deletions

View File

@ -200,12 +200,28 @@ CollectionItem::icon() const
}
}
bool
CollectionItem::localLatchedOn() const
{
// Don't show a listen icon if this is the local collection and we are latched on to someone who went offline
// we are technically still latched on (if they come back online we'll be still listening along) but it's not visible
// in the UI and confusing to the user why the red headphones are still there
if ( !m_source.isNull() && m_source->isLocal() &&
!m_latchedOnTo.isNull() && !m_latchedOnTo->isOnline() )
return false;
return m_latchedOn;
}
void
CollectionItem::latchedOff( const source_ptr& from, const source_ptr& to )
{
if ( from->isLocal() && ( m_source == to || m_source == from ) )
{
m_latchedOn = false;
m_latchedOnTo.clear();
emit updated();
}
}
@ -216,6 +232,7 @@ CollectionItem::latchedOn( const source_ptr& from, const source_ptr& to )
if ( from->isLocal() && ( m_source == to || m_source == from ) )
{
m_latchedOn = true;
m_latchedOnTo = to;
emit updated();
}
}

View File

@ -42,7 +42,7 @@ public:
virtual int peerSortValue() const;
virtual int IDValue() const;
virtual bool localLatchedOn() const { return m_latchedOn; }
virtual bool localLatchedOn() const;
Tomahawk::source_ptr source() const;
@ -85,7 +85,9 @@ private:
QPixmap m_superCol, m_defaultAvatar;
CategoryItem* m_playlists;
CategoryItem* m_stations;
bool m_latchedOn;
Tomahawk::source_ptr m_latchedOnTo;
QList< TemporaryPageItem* > m_tempItems;
GenericPageItem* m_sourceInfoItem;