From 352dd7588d13a90263419392474d5b862e6ca6d2 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Sun, 13 Jan 2013 17:46:14 +0100 Subject: [PATCH] Add PeerInfo to Source and SourceItem tooltips. --- src/libtomahawk/Source.cpp | 8 ++++++++ src/libtomahawk/Source.h | 2 ++ src/sourcetree/items/SourceItem.cpp | 19 ++++++++++++++++--- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/Source.cpp b/src/libtomahawk/Source.cpp index 732a914f7..d286b9d11 100644 --- a/src/libtomahawk/Source.cpp +++ b/src/libtomahawk/Source.cpp @@ -85,6 +85,14 @@ Source::setControlConnection( ControlConnection* cc ) m_cc = cc; } +const QSet +Source::peerInfos() const +{ + if( controlConnection() ) + return controlConnection()->peerInfos(); + return QSet< Tomahawk::peerinfo_ptr >(); +} + collection_ptr Source::collection() const diff --git a/src/libtomahawk/Source.h b/src/libtomahawk/Source.h index 97368ed70..4943ebed2 100644 --- a/src/libtomahawk/Source.h +++ b/src/libtomahawk/Source.h @@ -77,6 +77,8 @@ public: ControlConnection* controlConnection() const { return m_cc; } void setControlConnection( ControlConnection* cc ); + const QSet< Tomahawk::peerinfo_ptr > peerInfos() const; + void scanningProgress( unsigned int files ); void scanningFinished( bool updateGUI ); diff --git a/src/sourcetree/items/SourceItem.cpp b/src/sourcetree/items/SourceItem.cpp index 50f4234d0..b6771f328 100644 --- a/src/sourcetree/items/SourceItem.cpp +++ b/src/sourcetree/items/SourceItem.cpp @@ -1,6 +1,7 @@ /* * Copyright 2010-2011, Leo Franchi * Copyright 2010-2012, Jeff Mitchell + * Copyright 2013, Teo Mrnjavac * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +34,7 @@ #include "playlist/RecentlyAddedModel.h" #include "playlist/RecentlyPlayedModel.h" #include "playlist/PlaylistLargeItemDelegate.h" +#include "sip/PeerInfo.h" #include "utils/ImageRegistry.h" #include "utils/TomahawkUtilsGui.h" #include "utils/Logger.h" @@ -143,10 +145,21 @@ SourceItem::text() const QString SourceItem::tooltip() const { - if ( !m_source.isNull() && !m_source->currentTrack().isNull() ) - return m_source->textStatus(); + if ( m_source.isNull() || m_source->peerInfos().isEmpty() ) + return QString(); - return QString(); + QString t; + + // This is kind of debug output for now. + foreach( Tomahawk::peerinfo_ptr p, m_source->peerInfos() ) + { + t.append( p->id() + "
" ); + } + + if ( !m_source->currentTrack().isNull() ) + t.append( m_source->textStatus() ); + + return t; }