mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
Hide red latch headphones on local source if the source you are latched on to goes offline
This commit is contained in:
@@ -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
|
void
|
||||||
CollectionItem::latchedOff( const source_ptr& from, const source_ptr& to )
|
CollectionItem::latchedOff( const source_ptr& from, const source_ptr& to )
|
||||||
{
|
{
|
||||||
if ( from->isLocal() && ( m_source == to || m_source == from ) )
|
if ( from->isLocal() && ( m_source == to || m_source == from ) )
|
||||||
{
|
{
|
||||||
m_latchedOn = false;
|
m_latchedOn = false;
|
||||||
|
m_latchedOnTo.clear();
|
||||||
emit updated();
|
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 ) )
|
if ( from->isLocal() && ( m_source == to || m_source == from ) )
|
||||||
{
|
{
|
||||||
m_latchedOn = true;
|
m_latchedOn = true;
|
||||||
|
m_latchedOnTo = to;
|
||||||
emit updated();
|
emit updated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
virtual int peerSortValue() const;
|
virtual int peerSortValue() const;
|
||||||
virtual int IDValue() const;
|
virtual int IDValue() const;
|
||||||
|
|
||||||
virtual bool localLatchedOn() const { return m_latchedOn; }
|
virtual bool localLatchedOn() const;
|
||||||
|
|
||||||
Tomahawk::source_ptr source() const;
|
Tomahawk::source_ptr source() const;
|
||||||
|
|
||||||
@@ -85,7 +85,9 @@ private:
|
|||||||
QPixmap m_superCol, m_defaultAvatar;
|
QPixmap m_superCol, m_defaultAvatar;
|
||||||
CategoryItem* m_playlists;
|
CategoryItem* m_playlists;
|
||||||
CategoryItem* m_stations;
|
CategoryItem* m_stations;
|
||||||
|
|
||||||
bool m_latchedOn;
|
bool m_latchedOn;
|
||||||
|
Tomahawk::source_ptr m_latchedOnTo;
|
||||||
|
|
||||||
QList< TemporaryPageItem* > m_tempItems;
|
QList< TemporaryPageItem* > m_tempItems;
|
||||||
GenericPageItem* m_sourceInfoItem;
|
GenericPageItem* m_sourceInfoItem;
|
||||||
|
Reference in New Issue
Block a user