/** * called whenever metadata of the current track has changed */ void TabsEngine::update() { DEBUG_BLOCK // get the current track Meta::TrackPtr track = The::engineController()->currentTrack(); if( !track ) { debug() << "no track"; m_titleName.clear(); m_artistName.clear(); removeAllData( "tabs" ); setData( "tabs", "state", "Stopped" ); return; } m_currentTrack = track; Meta::ArtistPtr artistPtr = track->artist(); QString newArtist; if( artistPtr ) { if( ( track->playableUrl().protocol() == "lastfm" ) || ( track->playableUrl().protocol() == "daap" ) || !The::engineController()->isStream() ) newArtist = artistPtr->name(); else newArtist = artistPtr->prettyName(); } QString newTitle = track->name(); if( newTitle.isEmpty() ) newTitle = track->prettyName(); // check if something changed if( newTitle == m_titleName && newArtist == m_artistName ) { debug() << "nothing changed"; return; } // stop fetching for unknown artists or titles if( newTitle.isEmpty() || newArtist.isEmpty() ) { setData("tabs", "state", "noTabs" ); return; } requestTab( newArtist, newTitle ); }
AmarokUrl NavigationUrlGenerator::urlFromArtist( Meta::ArtistPtr artist ) { DEBUG_BLOCK AmarokUrl url; QScopedPointer<Capabilities::BookmarkThisCapability> btc( artist->create<Capabilities::BookmarkThisCapability>() ); if( btc ) { if( btc->isBookmarkable() ) { QString artistName = artist->prettyName(); url.setCommand( "navigate" ); QString path = btc->browserName(); if ( !btc->collectionName().isEmpty() ) path += ( '/' + btc->collectionName() ); url.setPath( path ); //debug() << "Path: " << url.path(); QString filter; if ( btc->simpleFiltering() ) { //for services only supporting simple filtering, do not try to set the sorting mode filter = "\"" + artistName + "\""; } else { url.setArg( "levels", "artist-album" ); filter = ( "artist:\"" + artistName + "\"" ); } url.setArg( "filter", filter ); if ( !btc->collectionName().isEmpty() ) url.setName( i18n( "Artist \"%1\" from %2", artistName, btc->collectionName() ) ); else url.setName( i18n( "Artist \"%1\"", artistName ) ); } } return url; }
ArtistItem( QTreeWidget *parent, Meta::ArtistPtr artist ) : QTreeWidgetItem( parent ) , m_artist( artist ) { setText( 0, artist->prettyName() ); }