diff --git a/src/libtomahawk/LatchManager.cpp b/src/libtomahawk/LatchManager.cpp index fa8e61227..9073429ca 100644 --- a/src/libtomahawk/LatchManager.cpp +++ b/src/libtomahawk/LatchManager.cpp @@ -81,7 +81,7 @@ LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr ) DatabaseCommand_SocialAction* cmd = new DatabaseCommand_SocialAction(); cmd->setSource( SourceList::instance()->getLocal() ); cmd->setAction( "latchOn"); - cmd->setComment( m_latchedOnTo->userName() ); + cmd->setComment( m_latchedOnTo->nodeId() ); cmd->setTimestamp( QDateTime::currentDateTime().toTime_t() ); Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) ); @@ -101,7 +101,7 @@ LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr ) DatabaseCommand_SocialAction* cmd = new DatabaseCommand_SocialAction(); cmd->setSource( SourceList::instance()->getLocal() ); cmd->setAction( "latchOff"); - cmd->setComment( source->userName() ); + cmd->setComment( source->nodeId() ); cmd->setTimestamp( QDateTime::currentDateTime().toTime_t() ); Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) ); diff --git a/src/libtomahawk/Source.cpp b/src/libtomahawk/Source.cpp index d4ca75ee1..0425c9361 100644 --- a/src/libtomahawk/Source.cpp +++ b/src/libtomahawk/Source.cpp @@ -46,11 +46,11 @@ using namespace Tomahawk; -Source::Source( int id, const QString& username ) +Source::Source( int id, const QString& nodeId ) : QObject() , m_isLocal( false ) , m_online( false ) - , m_username( username ) + , m_nodeId( nodeId ) , m_id( id ) , m_updateIndexWhenSynced( false ) , m_state( DBSyncConnection::UNKNOWN ) @@ -125,7 +125,7 @@ QString Source::friendlyName() const { if ( m_friendlyname.isEmpty() ) - return m_username; + return m_nodeId; //TODO: this is a terrible assumption, help me clean this up, mighty muesli! if ( m_friendlyname.contains( "@conference." ) ) @@ -228,7 +228,7 @@ Source::setOnline() if ( !isLocal() ) { // ensure username is in the database - DatabaseCommand_addSource* cmd = new DatabaseCommand_addSource( m_username, friendlyName() ); + DatabaseCommand_addSource* cmd = new DatabaseCommand_addSource( m_nodeId, friendlyName() ); connect( cmd, SIGNAL( done( unsigned int, QString ) ), SLOT( dbLoaded( unsigned int, const QString& ) ) ); Database::instance()->enqueue( QSharedPointer(cmd) ); diff --git a/src/libtomahawk/Source.h b/src/libtomahawk/Source.h index 4943ebed2..1645c61eb 100644 --- a/src/libtomahawk/Source.h +++ b/src/libtomahawk/Source.h @@ -55,13 +55,13 @@ friend class ::DatabaseCommand_DeleteFiles; friend class ::MusicScanner; public: - explicit Source( int id, const QString& username = QString() ); + explicit Source( int id, const QString& nodeId = QString() ); virtual ~Source(); bool isLocal() const { return m_isLocal; } bool isOnline() const { return m_online || m_isLocal; } - QString userName() const { return m_username; } + QString nodeId() const { return m_nodeId; } QString friendlyName() const; void setFriendlyName( const QString& fname ); @@ -101,7 +101,6 @@ signals: void collectionRemoved( const collection_ptr& collection ); void stats( const QVariantMap& ); - void usernameChanged( const QString& ); void playbackStarted( const Tomahawk::query_ptr& query ); void playbackFinished( const Tomahawk::query_ptr& query ); @@ -143,7 +142,7 @@ private: bool m_isLocal; bool m_online; - QString m_username; + QString m_nodeId; QString m_friendlyname; int m_id; bool m_scrubFriendlyName; diff --git a/src/libtomahawk/SourceList.cpp b/src/libtomahawk/SourceList.cpp index 842730cfe..e31dc7af2 100644 --- a/src/libtomahawk/SourceList.cpp +++ b/src/libtomahawk/SourceList.cpp @@ -111,7 +111,7 @@ SourceList::setLocal( const Tomahawk::source_ptr& localSrc ) { QMutexLocker lock( &m_mut ); - m_sources.insert( localSrc->userName(), localSrc ); + m_sources.insert( localSrc->nodeId(), localSrc ); m_local = localSrc; } @@ -127,11 +127,11 @@ SourceList::add( const source_ptr& source ) { Q_ASSERT( m_isReady ); -// qDebug() << "Adding to sources:" << source->userName() << source->id(); - m_sources.insert( source->userName(), source ); +// qDebug() << "Adding to sources:" << source->nodeId() << source->id(); + m_sources.insert( source->nodeId(), source ); if ( source->id() > 0 ) - m_sources_id2name.insert( source->id(), source->userName() ); + m_sources_id2name.insert( source->id(), source->nodeId() ); connect( source.data(), SIGNAL( syncedWithDatabase() ), SLOT( sourceSynced() ) ); collection_ptr coll( new RemoteCollection( source ) ); @@ -239,7 +239,7 @@ SourceList::sourceSynced() { Source* src = qobject_cast< Source* >( sender() ); - m_sources_id2name.insert( src->id(), src->userName() ); + m_sources_id2name.insert( src->id(), src->nodeId() ); } @@ -254,7 +254,7 @@ void SourceList::latchedOff( const source_ptr& to ) { Source* s = qobject_cast< Source* >( sender() ); - const source_ptr source = m_sources[ s->userName() ]; + const source_ptr source = m_sources[ s->nodeId() ]; emit sourceLatchedOff( source, to ); } @@ -264,7 +264,7 @@ SourceList::latchedOn( const source_ptr& to ) { Source* s = qobject_cast< Source* >( sender() ); - const source_ptr source = m_sources[ s->userName() ]; + const source_ptr source = m_sources[ s->nodeId() ]; emit sourceLatchedOn( source, to ); } diff --git a/src/libtomahawk/database/DatabaseCollection.cpp b/src/libtomahawk/database/DatabaseCollection.cpp index 9744b428e..5f2624ffe 100644 --- a/src/libtomahawk/database/DatabaseCollection.cpp +++ b/src/libtomahawk/database/DatabaseCollection.cpp @@ -33,7 +33,7 @@ using namespace Tomahawk; DatabaseCollection::DatabaseCollection( const source_ptr& src, QObject* parent ) - : Collection( src, QString( "dbcollection:%1" ).arg( src->userName() ), parent ) + : Collection( src, QString( "dbcollection:%1" ).arg( src->nodeId() ), parent ) { } diff --git a/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp b/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp index 47d2c4aba..ee887b3d0 100644 --- a/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp +++ b/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp @@ -112,7 +112,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi ) continue; } - url = QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url ); + url = QString( "servent://%1\t%2" ).arg( s->nodeId() ).arg( url ); } QString artist, track, album, composer; diff --git a/src/libtomahawk/database/DatabaseCommand_Resolve.cpp b/src/libtomahawk/database/DatabaseCommand_Resolve.cpp index ec5a05fdb..72609f60a 100644 --- a/src/libtomahawk/database/DatabaseCommand_Resolve.cpp +++ b/src/libtomahawk/database/DatabaseCommand_Resolve.cpp @@ -140,7 +140,7 @@ DatabaseCommand_Resolve::resolve( DatabaseImpl* lib ) continue; } - url = QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url ); + url = QString( "servent://%1\t%2" ).arg( s->nodeId() ).arg( url ); } bool cached = Tomahawk::Result::isCached( url ); @@ -279,7 +279,7 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib ) continue; } - url = QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url ); + url = QString( "servent://%1\t%2" ).arg( s->nodeId() ).arg( url ); } bool cached = Tomahawk::Result::isCached( url ); diff --git a/src/libtomahawk/database/DatabaseImpl.cpp b/src/libtomahawk/database/DatabaseImpl.cpp index f3ddd95dc..9db5da4a3 100644 --- a/src/libtomahawk/database/DatabaseImpl.cpp +++ b/src/libtomahawk/database/DatabaseImpl.cpp @@ -293,7 +293,7 @@ DatabaseImpl::file( int fid ) return r; } - url = QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url ); + url = QString( "servent://%1\t%2" ).arg( s->nodeId() ).arg( url ); } r = Tomahawk::Result::get( url ); @@ -691,7 +691,7 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery ) return res; } - url = QString( "servent://%1\t%2" ).arg( s->userName() ).arg( url ); + url = QString( "servent://%1\t%2" ).arg( s->nodeId() ).arg( url ); } res = Tomahawk::Result::get( url ); diff --git a/src/libtomahawk/jobview/LatchedStatusItem.cpp b/src/libtomahawk/jobview/LatchedStatusItem.cpp index 39700f617..b30ed4457 100644 --- a/src/libtomahawk/jobview/LatchedStatusItem.cpp +++ b/src/libtomahawk/jobview/LatchedStatusItem.cpp @@ -82,7 +82,7 @@ LatchedStatusManager::latchedOn( const Tomahawk::source_ptr& from, const Tomahaw { #ifndef ENABLE_HEADLESS LatchedStatusItem* item = new LatchedStatusItem( from, to, this ); - m_jobs[ from->userName() ] = item; + m_jobs[ from->nodeId() ] = item; JobStatusView::instance()->model()->addJob( item ); #endif @@ -96,9 +96,9 @@ LatchedStatusManager::sourceOffline() Tomahawk::Source* s = qobject_cast< Tomahawk::Source* >( sender() ); Q_ASSERT( s ); - if ( m_jobs.contains( s->userName() ) ) + if ( m_jobs.contains( s->nodeId() ) ) { - QPointer< LatchedStatusItem> job = m_jobs.take( s->userName() ).data(); + QPointer< LatchedStatusItem> job = m_jobs.take( s->nodeId() ).data(); if ( !job.isNull() ) job.data()->stop(); } @@ -111,9 +111,9 @@ LatchedStatusManager::latchedOff( const Tomahawk::source_ptr& from, const Tomaha if ( from.isNull() || to.isNull() ) return; - if ( to->isLocal() && m_jobs.contains( from->userName() ) ) + if ( to->isLocal() && m_jobs.contains( from->nodeId() ) ) { - QPointer< LatchedStatusItem > item = m_jobs.take( from->userName() ); + QPointer< LatchedStatusItem > item = m_jobs.take( from->nodeId() ); if ( !item.isNull() ) item.data()->stop(); } diff --git a/src/libtomahawk/playlist/AlbumModel.cpp b/src/libtomahawk/playlist/AlbumModel.cpp index d7d82f98a..69488c4f1 100644 --- a/src/libtomahawk/playlist/AlbumModel.cpp +++ b/src/libtomahawk/playlist/AlbumModel.cpp @@ -51,7 +51,7 @@ AlbumModel::addCollection( const collection_ptr& collection, bool overwrite ) { qDebug() << Q_FUNC_INFO << collection->name() << collection->source()->id() - << collection->source()->userName(); + << collection->source()->nodeId(); DatabaseCommand_AllAlbums* cmd = new DatabaseCommand_AllAlbums( collection ); m_overwriteOnAdd = overwrite; @@ -88,7 +88,7 @@ AlbumModel::addFilteredCollection( const collection_ptr& collection, unsigned in { /* qDebug() << Q_FUNC_INFO << collection->name() << collection->source()->id() - << collection->source()->userName() + << collection->source()->nodeId() << amount << order;*/ DatabaseCommand_AllAlbums* cmd = new DatabaseCommand_AllAlbums( collection ); diff --git a/src/libtomahawk/playlist/TreeModel.cpp b/src/libtomahawk/playlist/TreeModel.cpp index 688255e51..ec21f8f4d 100644 --- a/src/libtomahawk/playlist/TreeModel.cpp +++ b/src/libtomahawk/playlist/TreeModel.cpp @@ -246,7 +246,7 @@ TreeModel::addCollection( const collection_ptr& collection ) { qDebug() << Q_FUNC_INFO << collection->name() << collection->source()->id() - << collection->source()->userName(); + << collection->source()->nodeId(); startLoading(); @@ -275,7 +275,7 @@ TreeModel::addFilteredCollection( const collection_ptr& collection, unsigned int { qDebug() << Q_FUNC_INFO << collection->name() << collection->source()->id() - << collection->source()->userName() + << collection->source()->nodeId() << amount << order; DatabaseCommand_AllArtists* cmd = new DatabaseCommand_AllArtists( collection ); diff --git a/src/sourcetree/items/LovedTracksItem.cpp b/src/sourcetree/items/LovedTracksItem.cpp index 6d40ffbad..0c6e6c5b4 100644 --- a/src/sourcetree/items/LovedTracksItem.cpp +++ b/src/sourcetree/items/LovedTracksItem.cpp @@ -95,7 +95,7 @@ LovedTracksItem::activate() else raModel->setDescription( tr( "All of %1's loved tracks" ).arg( par->source()->friendlyName() ) ); - pv->setGuid( QString( "lovedtracks/%1" ).arg( par->source()->userName() ) ); + pv->setGuid( QString( "lovedtracks/%1" ).arg( par->source()->nodeId() ) ); } pv->setPlayableModel( raModel ); diff --git a/src/sourcetree/items/SourceItem.cpp b/src/sourcetree/items/SourceItem.cpp index daf2f5bad..a49424bbb 100644 --- a/src/sourcetree/items/SourceItem.cpp +++ b/src/sourcetree/items/SourceItem.cpp @@ -555,7 +555,7 @@ SourceItem::latestAdditionsClicked() pv->setEmptyTip( tr( "Sorry, we could not find any recent additions!" ) ); raModel->setSource( m_source ); - pv->setGuid( QString( "latestadditions/%1" ).arg( m_source->userName() ) ); + pv->setGuid( QString( "latestadditions/%1" ).arg( m_source->nodeId() ) ); m_latestAdditionsPage = pv; } @@ -596,7 +596,7 @@ SourceItem::recentPlaysClicked() pv->setEmptyTip( tr( "Sorry, we could not find any recent plays!" ) ); raModel->setSource( m_source ); - pv->setGuid( QString( "recentplays/%1" ).arg( m_source->userName() ) ); + pv->setGuid( QString( "recentplays/%1" ).arg( m_source->nodeId() ) ); m_recentPlaysPage = pv; }