mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
* Use proper sort order for Top Hits & Related Artists.
This commit is contained in:
@@ -489,15 +489,26 @@ LastFmPlugin::similarArtistsReturned()
|
|||||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
|
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
|
||||||
|
|
||||||
QMap< int, QString > similarArtists = lastfm::Artist::getSimilar( reply );
|
QMap< int, QString > similarArtists = lastfm::Artist::getSimilar( reply );
|
||||||
|
|
||||||
|
QStringList sortedArtists;
|
||||||
|
QStringList sortedScores;
|
||||||
QStringList al;
|
QStringList al;
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
|
|
||||||
foreach ( const QString& a, similarArtists.values() )
|
foreach ( const QString& artist, similarArtists.values() )
|
||||||
al << a;
|
al << artist;
|
||||||
|
foreach ( int score, similarArtists.keys() )
|
||||||
|
sl << QString::number( score );
|
||||||
|
|
||||||
|
for ( int i = al.count() - 1; i >= 0; i-- )
|
||||||
|
{
|
||||||
|
sortedArtists << al.at( i );
|
||||||
|
sortedScores << sl.at( i );
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap returnedData;
|
QVariantMap returnedData;
|
||||||
returnedData["artists"] = al;
|
returnedData["artists"] = sortedArtists;
|
||||||
returnedData["score"] = sl;
|
returnedData["score"] = sortedScores;
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >();
|
Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >();
|
||||||
|
|
||||||
@@ -682,25 +693,25 @@ LastFmPlugin::artistImagesReturned()
|
|||||||
void
|
void
|
||||||
LastFmPlugin::settingsChanged()
|
LastFmPlugin::settingsChanged()
|
||||||
{
|
{
|
||||||
if( !m_scrobbler && TomahawkSettings::instance()->scrobblingEnabled() )
|
if ( !m_scrobbler && TomahawkSettings::instance()->scrobblingEnabled() )
|
||||||
{ // can simply create the scrobbler
|
{ // can simply create the scrobbler
|
||||||
lastfm::ws::Username = TomahawkSettings::instance()->lastFmUsername();
|
lastfm::ws::Username = TomahawkSettings::instance()->lastFmUsername();
|
||||||
m_pw = TomahawkSettings::instance()->lastFmPassword();
|
m_pw = TomahawkSettings::instance()->lastFmPassword();
|
||||||
|
|
||||||
createScrobbler();
|
createScrobbler();
|
||||||
}
|
}
|
||||||
else if( m_scrobbler && !TomahawkSettings::instance()->scrobblingEnabled() )
|
else if ( m_scrobbler && !TomahawkSettings::instance()->scrobblingEnabled() )
|
||||||
{
|
{
|
||||||
delete m_scrobbler;
|
delete m_scrobbler;
|
||||||
m_scrobbler = 0;
|
m_scrobbler = 0;
|
||||||
}
|
}
|
||||||
else if( TomahawkSettings::instance()->lastFmUsername() != lastfm::ws::Username ||
|
else if ( TomahawkSettings::instance()->lastFmUsername() != lastfm::ws::Username ||
|
||||||
TomahawkSettings::instance()->lastFmPassword() != m_pw )
|
TomahawkSettings::instance()->lastFmPassword() != m_pw )
|
||||||
{
|
{
|
||||||
lastfm::ws::Username = TomahawkSettings::instance()->lastFmUsername();
|
lastfm::ws::Username = TomahawkSettings::instance()->lastFmUsername();
|
||||||
m_pw = TomahawkSettings::instance()->lastFmPassword();
|
m_pw = TomahawkSettings::instance()->lastFmPassword();
|
||||||
// credentials have changed, have to re-create scrobbler for them to take effect
|
// credentials have changed, have to re-create scrobbler for them to take effect
|
||||||
if( m_scrobbler )
|
if ( m_scrobbler )
|
||||||
{
|
{
|
||||||
delete m_scrobbler;
|
delete m_scrobbler;
|
||||||
m_scrobbler = 0;
|
m_scrobbler = 0;
|
||||||
@@ -715,17 +726,17 @@ void
|
|||||||
LastFmPlugin::onAuthenticated()
|
LastFmPlugin::onAuthenticated()
|
||||||
{
|
{
|
||||||
QNetworkReply* authJob = dynamic_cast<QNetworkReply*>( sender() );
|
QNetworkReply* authJob = dynamic_cast<QNetworkReply*>( sender() );
|
||||||
if( !authJob )
|
if ( !authJob )
|
||||||
{
|
{
|
||||||
tLog() << Q_FUNC_INFO << "Help! No longer got a last.fm auth job!";
|
tLog() << Q_FUNC_INFO << "Help! No longer got a last.fm auth job!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( authJob->error() == QNetworkReply::NoError )
|
if ( authJob->error() == QNetworkReply::NoError )
|
||||||
{
|
{
|
||||||
lastfm::XmlQuery lfm = lastfm::XmlQuery( authJob->readAll() );
|
lastfm::XmlQuery lfm = lastfm::XmlQuery( authJob->readAll() );
|
||||||
|
|
||||||
if( lfm.children( "error" ).size() > 0 )
|
if ( lfm.children( "error" ).size() > 0 )
|
||||||
{
|
{
|
||||||
tLog() << "Error from authenticating with Last.fm service:" << lfm.text();
|
tLog() << "Error from authenticating with Last.fm service:" << lfm.text();
|
||||||
TomahawkSettings::instance()->setLastFmSessionKey( QByteArray() );
|
TomahawkSettings::instance()->setLastFmSessionKey( QByteArray() );
|
||||||
@@ -737,7 +748,7 @@ LastFmPlugin::onAuthenticated()
|
|||||||
TomahawkSettings::instance()->setLastFmSessionKey( lastfm::ws::SessionKey.toLatin1() );
|
TomahawkSettings::instance()->setLastFmSessionKey( lastfm::ws::SessionKey.toLatin1() );
|
||||||
|
|
||||||
// qDebug() << "Got session key from last.fm";
|
// qDebug() << "Got session key from last.fm";
|
||||||
if( TomahawkSettings::instance()->scrobblingEnabled() )
|
if ( TomahawkSettings::instance()->scrobblingEnabled() )
|
||||||
m_scrobbler = new lastfm::Audioscrobbler( "thk" );
|
m_scrobbler = new lastfm::Audioscrobbler( "thk" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -753,7 +764,7 @@ LastFmPlugin::onAuthenticated()
|
|||||||
void
|
void
|
||||||
LastFmPlugin::createScrobbler()
|
LastFmPlugin::createScrobbler()
|
||||||
{
|
{
|
||||||
if( TomahawkSettings::instance()->lastFmSessionKey().isEmpty() ) // no session key, so get one
|
if ( TomahawkSettings::instance()->lastFmSessionKey().isEmpty() ) // no session key, so get one
|
||||||
{
|
{
|
||||||
qDebug() << "LastFmPlugin::createScrobbler Session key is empty";
|
qDebug() << "LastFmPlugin::createScrobbler Session key is empty";
|
||||||
QString authToken = TomahawkUtils::md5( ( lastfm::ws::Username.toLower() + TomahawkUtils::md5( m_pw.toUtf8() ) ).toUtf8() );
|
QString authToken = TomahawkUtils::md5( ( lastfm::ws::Username.toLower() + TomahawkUtils::md5( m_pw.toUtf8() ) ).toUtf8() );
|
||||||
@@ -780,14 +791,15 @@ QList<lastfm::Track>
|
|||||||
LastFmPlugin::parseTrackList( QNetworkReply* reply )
|
LastFmPlugin::parseTrackList( QNetworkReply* reply )
|
||||||
{
|
{
|
||||||
QList<lastfm::Track> tracks;
|
QList<lastfm::Track> tracks;
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
lastfm::XmlQuery lfm = reply->readAll();
|
lastfm::XmlQuery lfm = reply->readAll();
|
||||||
foreach ( lastfm::XmlQuery xq, lfm.children( "track" ) )
|
foreach ( lastfm::XmlQuery xq, lfm.children( "track" ) )
|
||||||
{
|
{
|
||||||
tracks.append( lastfm::Track( xq ) );
|
tracks.append( lastfm::Track( xq ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( lastfm::ws::ParseError& e )
|
catch ( lastfm::ws::ParseError& e )
|
||||||
{
|
{
|
||||||
qWarning() << e.what();
|
qWarning() << e.what();
|
||||||
}
|
}
|
||||||
|
@@ -132,9 +132,6 @@ TrackView::setTrackModel( TrackModel* model )
|
|||||||
m_proxyModel->setSourceTrackModel( m_model );
|
m_proxyModel->setSourceTrackModel( m_model );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_model && m_model->metaObject()->indexOfSignal( "itemSizeChanged(QModelIndex)" ) > -1 )
|
|
||||||
connect( m_model, SIGNAL( itemSizeChanged( QModelIndex ) ), SLOT( onItemResized( QModelIndex ) ) );
|
|
||||||
|
|
||||||
connect( m_model, SIGNAL( loadingStarted() ), m_loadingSpinner, SLOT( fadeIn() ) );
|
connect( m_model, SIGNAL( loadingStarted() ), m_loadingSpinner, SLOT( fadeIn() ) );
|
||||||
connect( m_model, SIGNAL( loadingFinished() ), m_loadingSpinner, SLOT( fadeOut() ) );
|
connect( m_model, SIGNAL( loadingFinished() ), m_loadingSpinner, SLOT( fadeOut() ) );
|
||||||
|
|
||||||
|
@@ -272,9 +272,9 @@ TreeModel::data( const QModelIndex& index, int role ) const
|
|||||||
{
|
{
|
||||||
const result_ptr& result = entry->result();
|
const result_ptr& result = entry->result();
|
||||||
unsigned int discnumber = 0;
|
unsigned int discnumber = 0;
|
||||||
if( !entry->query().isNull() )
|
if ( !entry->query().isNull() )
|
||||||
discnumber = entry->query()->discnumber();
|
discnumber = entry->query()->discnumber();
|
||||||
if( discnumber == 0 )
|
if ( discnumber == 0 )
|
||||||
discnumber = result->discnumber();
|
discnumber = result->discnumber();
|
||||||
|
|
||||||
unsigned int albumpos = 0;
|
unsigned int albumpos = 0;
|
||||||
@@ -294,18 +294,14 @@ TreeModel::data( const QModelIndex& index, int role ) const
|
|||||||
return TomahawkUtils::timeToString( result->duration() );
|
return TomahawkUtils::timeToString( result->duration() );
|
||||||
|
|
||||||
case Bitrate:
|
case Bitrate:
|
||||||
if ( result->bitrate() == 0 )
|
if ( result->bitrate() > 0 )
|
||||||
return QString();
|
|
||||||
else
|
|
||||||
return result->bitrate();
|
return result->bitrate();
|
||||||
|
|
||||||
case Age:
|
case Age:
|
||||||
return TomahawkUtils::ageToString( QDateTime::fromTime_t( result->modificationTime() ) );
|
return TomahawkUtils::ageToString( QDateTime::fromTime_t( result->modificationTime() ) );
|
||||||
|
|
||||||
case Year:
|
case Year:
|
||||||
if ( result->year() == 0 )
|
if ( result->year() != 0 )
|
||||||
return QString();
|
|
||||||
else
|
|
||||||
return result->year();
|
return result->year();
|
||||||
|
|
||||||
case Filesize:
|
case Filesize:
|
||||||
@@ -318,7 +314,8 @@ TreeModel::data( const QModelIndex& index, int role ) const
|
|||||||
return result->albumpos();
|
return result->albumpos();
|
||||||
|
|
||||||
case Composer:
|
case Composer:
|
||||||
return result->composer()->name();
|
if ( !result->composer().isNull() )
|
||||||
|
return result->composer()->name();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
@@ -41,6 +41,7 @@ TreeProxyModel::TreeProxyModel( QObject* parent )
|
|||||||
setSourceTreeModel( 0 );
|
setSourceTreeModel( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QPersistentModelIndex
|
QPersistentModelIndex
|
||||||
TreeProxyModel::currentIndex() const
|
TreeProxyModel::currentIndex() const
|
||||||
{
|
{
|
||||||
@@ -109,6 +110,7 @@ TreeProxyModel::onModelReset()
|
|||||||
m_albumsFilter.clear();
|
m_albumsFilter.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TreeProxyModel::newFilterFromPlaylistInterface( const QString &pattern )
|
TreeProxyModel::newFilterFromPlaylistInterface( const QString &pattern )
|
||||||
{
|
{
|
||||||
@@ -142,6 +144,7 @@ TreeProxyModel::newFilterFromPlaylistInterface( const QString &pattern )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TreeProxyModel::onFilterArtists( const QList<Tomahawk::artist_ptr>& artists )
|
TreeProxyModel::onFilterArtists( const QList<Tomahawk::artist_ptr>& artists )
|
||||||
{
|
{
|
||||||
@@ -288,25 +291,25 @@ TreeProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) co
|
|||||||
unsigned int albumpos2 = 0;
|
unsigned int albumpos2 = 0;
|
||||||
unsigned int discnumber1 = 0;
|
unsigned int discnumber1 = 0;
|
||||||
unsigned int discnumber2 = 0;
|
unsigned int discnumber2 = 0;
|
||||||
if( !p1->query().isNull() )
|
if ( !p1->query().isNull() )
|
||||||
{
|
{
|
||||||
albumpos1 = p1->query()->albumpos();
|
albumpos1 = p1->query()->albumpos();
|
||||||
discnumber1 = p1->query()->discnumber();
|
discnumber1 = p1->query()->discnumber();
|
||||||
}
|
}
|
||||||
if( !p2->query().isNull() )
|
if ( !p2->query().isNull() )
|
||||||
{
|
{
|
||||||
albumpos2 = p2->query()->albumpos();
|
albumpos2 = p2->query()->albumpos();
|
||||||
discnumber2 = p2->query()->discnumber();
|
discnumber2 = p2->query()->discnumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( albumpos1 == 0 && !p1->result().isNull() )
|
if ( albumpos1 == 0 && !p1->result().isNull() )
|
||||||
albumpos1 = p1->result()->albumpos();
|
albumpos1 = p1->result()->albumpos();
|
||||||
if( discnumber1 == 0 && !p1->result().isNull() )
|
if ( discnumber1 == 0 && !p1->result().isNull() )
|
||||||
discnumber1 = p1->result()->discnumber();
|
discnumber1 = p1->result()->discnumber();
|
||||||
|
|
||||||
if( albumpos2 == 0 && !p2->result().isNull() )
|
if ( albumpos2 == 0 && !p2->result().isNull() )
|
||||||
albumpos2 = p2->result()->albumpos();
|
albumpos2 = p2->result()->albumpos();
|
||||||
if( discnumber2 == 0 && !p2->result().isNull() )
|
if ( discnumber2 == 0 && !p2->result().isNull() )
|
||||||
discnumber2 = p2->result()->discnumber();
|
discnumber2 = p2->result()->discnumber();
|
||||||
|
|
||||||
const QString& lefts = textForItem( p1 );
|
const QString& lefts = textForItem( p1 );
|
||||||
|
@@ -140,13 +140,16 @@ ViewManager::createPageForPlaylist( const playlist_ptr& pl )
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
playlist_ptr
|
playlist_ptr
|
||||||
ViewManager::playlistForPage( ViewPage* page ) const
|
ViewManager::playlistForPage( ViewPage* page ) const
|
||||||
{
|
{
|
||||||
playlist_ptr p;
|
playlist_ptr p;
|
||||||
if ( dynamic_cast< PlaylistView* >( page ) && dynamic_cast< PlaylistView* >( page )->playlistModel() &&
|
if ( dynamic_cast< PlaylistView* >( page ) && dynamic_cast< PlaylistView* >( page )->playlistModel() &&
|
||||||
!dynamic_cast< PlaylistView* >( page )->playlistModel()->playlist().isNull() )
|
!dynamic_cast< PlaylistView* >( page )->playlistModel()->playlist().isNull() )
|
||||||
|
{
|
||||||
p = dynamic_cast< PlaylistView* >( page )->playlistModel()->playlist();
|
p = dynamic_cast< PlaylistView* >( page )->playlistModel()->playlist();
|
||||||
|
}
|
||||||
else if ( dynamic_cast< DynamicWidget* >( page ) )
|
else if ( dynamic_cast< DynamicWidget* >( page ) )
|
||||||
p = dynamic_cast< DynamicWidget* >( page )->playlist();
|
p = dynamic_cast< DynamicWidget* >( page )->playlist();
|
||||||
|
|
||||||
@@ -484,13 +487,15 @@ ViewManager::historyBack()
|
|||||||
delete oldPage;
|
delete oldPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewManager::removeFromHistory ( ViewPage* p )
|
ViewManager::removeFromHistory ( ViewPage* p )
|
||||||
{
|
{
|
||||||
if ( currentPage() == p )
|
if ( currentPage() == p )
|
||||||
{
|
{
|
||||||
historyBack();
|
historyBack();
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m_pageHistory.removeAll( p );
|
m_pageHistory.removeAll( p );
|
||||||
delete p;
|
delete p;
|
||||||
@@ -498,6 +503,7 @@ ViewManager::removeFromHistory ( ViewPage* p )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewManager::setFilter( const QString& filter )
|
ViewManager::setFilter( const QString& filter )
|
||||||
{
|
{
|
||||||
@@ -645,16 +651,16 @@ ViewManager::updateView()
|
|||||||
if ( currentPlaylistInterface() )
|
if ( currentPlaylistInterface() )
|
||||||
{
|
{
|
||||||
connect( currentPlaylistInterface().data(), SIGNAL( sourceTrackCountChanged( unsigned int ) ),
|
connect( currentPlaylistInterface().data(), SIGNAL( sourceTrackCountChanged( unsigned int ) ),
|
||||||
SIGNAL( numTracksChanged( unsigned int ) ) );
|
SIGNAL( numTracksChanged( unsigned int ) ) );
|
||||||
|
|
||||||
connect( currentPlaylistInterface().data(), SIGNAL( trackCountChanged( unsigned int ) ),
|
connect( currentPlaylistInterface().data(), SIGNAL( trackCountChanged( unsigned int ) ),
|
||||||
SIGNAL( numShownChanged( unsigned int ) ) );
|
SIGNAL( numShownChanged( unsigned int ) ) );
|
||||||
|
|
||||||
connect( currentPlaylistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ),
|
connect( currentPlaylistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ),
|
||||||
SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ) );
|
SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ) );
|
||||||
|
|
||||||
connect( currentPlaylistInterface().data(), SIGNAL( shuffleModeChanged( bool ) ),
|
connect( currentPlaylistInterface().data(), SIGNAL( shuffleModeChanged( bool ) ),
|
||||||
SIGNAL( shuffleModeChanged( bool ) ) );
|
SIGNAL( shuffleModeChanged( bool ) ) );
|
||||||
|
|
||||||
m_infobar->setFilter( currentPlaylistInterface()->filter() );
|
m_infobar->setFilter( currentPlaylistInterface()->filter() );
|
||||||
}
|
}
|
||||||
@@ -717,12 +723,17 @@ ViewManager::loadCurrentPlaylistSettings()
|
|||||||
{
|
{
|
||||||
TomahawkSettings* s = TomahawkSettings::instance();
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
Tomahawk::playlist_ptr pl = playlistForInterface( currentPlaylistInterface() );
|
Tomahawk::playlist_ptr pl = playlistForInterface( currentPlaylistInterface() );
|
||||||
if ( !pl.isNull() ) {
|
|
||||||
|
if ( !pl.isNull() )
|
||||||
|
{
|
||||||
currentPlaylistInterface()->setShuffled( s->shuffleState( pl->guid() ));
|
currentPlaylistInterface()->setShuffled( s->shuffleState( pl->guid() ));
|
||||||
currentPlaylistInterface()->setRepeatMode( s->repeatMode( pl->guid() ));
|
currentPlaylistInterface()->setRepeatMode( s->repeatMode( pl->guid() ));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Tomahawk::dynplaylist_ptr dynPl = dynamicPlaylistForInterface( currentPlaylistInterface() );
|
Tomahawk::dynplaylist_ptr dynPl = dynamicPlaylistForInterface( currentPlaylistInterface() );
|
||||||
if ( !dynPl.isNull() ) {
|
if ( !dynPl.isNull() )
|
||||||
|
{
|
||||||
currentPlaylistInterface()->setShuffled( s->shuffleState( dynPl->guid() ));
|
currentPlaylistInterface()->setShuffled( s->shuffleState( dynPl->guid() ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -783,8 +794,7 @@ ViewManager::setShuffled( bool enabled )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewManager::createPlaylist( const Tomahawk::source_ptr& src,
|
ViewManager::createPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents )
|
||||||
const QVariant& contents )
|
|
||||||
{
|
{
|
||||||
Tomahawk::playlist_ptr p = Tomahawk::playlist_ptr( new Tomahawk::Playlist( src ) );
|
Tomahawk::playlist_ptr p = Tomahawk::playlist_ptr( new Tomahawk::Playlist( src ) );
|
||||||
QJson::QObjectHelper::qvariant2qobject( contents.toMap(), p.data() );
|
QJson::QObjectHelper::qvariant2qobject( contents.toMap(), p.data() );
|
||||||
@@ -793,8 +803,7 @@ ViewManager::createPlaylist( const Tomahawk::source_ptr& src,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewManager::createDynamicPlaylist( const Tomahawk::source_ptr& src,
|
ViewManager::createDynamicPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents )
|
||||||
const QVariant& contents )
|
|
||||||
{
|
{
|
||||||
Tomahawk::dynplaylist_ptr p = Tomahawk::dynplaylist_ptr( new Tomahawk::DynamicPlaylist( src, contents.toMap().value( "type", QString() ).toString() ) );
|
Tomahawk::dynplaylist_ptr p = Tomahawk::dynplaylist_ptr( new Tomahawk::DynamicPlaylist( src, contents.toMap().value( "type", QString() ).toString() ) );
|
||||||
QJson::QObjectHelper::qvariant2qobject( contents.toMap(), p.data() );
|
QJson::QObjectHelper::qvariant2qobject( contents.toMap(), p.data() );
|
||||||
@@ -838,6 +847,7 @@ ViewManager::pageForInterface( Tomahawk::playlistinterface_ptr interface ) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Tomahawk::playlistinterface_ptr
|
Tomahawk::playlistinterface_ptr
|
||||||
ViewManager::currentPlaylistInterface() const
|
ViewManager::currentPlaylistInterface() const
|
||||||
{
|
{
|
||||||
@@ -854,6 +864,7 @@ ViewManager::currentPage() const
|
|||||||
return m_pageHistory.isEmpty() ? 0 : m_pageHistory.front();
|
return m_pageHistory.isEmpty() ? 0 : m_pageHistory.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Tomahawk::playlist_ptr
|
Tomahawk::playlist_ptr
|
||||||
ViewManager::playlistForInterface( Tomahawk::playlistinterface_ptr interface ) const
|
ViewManager::playlistForInterface( Tomahawk::playlistinterface_ptr interface ) const
|
||||||
{
|
{
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
#include "ui_ArtistInfoWidget.h"
|
#include "ui_ArtistInfoWidget.h"
|
||||||
|
|
||||||
#include "audio/audioengine.h"
|
#include "audio/audioengine.h"
|
||||||
|
#include "playlist/trackheader.h"
|
||||||
#include "playlist/treemodel.h"
|
#include "playlist/treemodel.h"
|
||||||
#include "playlist/playlistmodel.h"
|
#include "playlist/playlistmodel.h"
|
||||||
#include "playlist/treeproxymodel.h"
|
#include "playlist/treeproxymodel.h"
|
||||||
@@ -68,10 +69,13 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
|
|||||||
m_relatedModel = new TreeModel( ui->relatedArtists );
|
m_relatedModel = new TreeModel( ui->relatedArtists );
|
||||||
m_relatedModel->setColumnStyle( TreeModel::TrackOnly );
|
m_relatedModel->setColumnStyle( TreeModel::TrackOnly );
|
||||||
ui->relatedArtists->setTreeModel( m_relatedModel );
|
ui->relatedArtists->setTreeModel( m_relatedModel );
|
||||||
|
ui->relatedArtists->setSortingEnabled( false );
|
||||||
|
ui->relatedArtists->proxyModel()->sort( -1 );
|
||||||
|
|
||||||
m_topHitsModel = new PlaylistModel( ui->topHits );
|
m_topHitsModel = new PlaylistModel( ui->topHits );
|
||||||
m_topHitsModel->setStyle( TrackModel::Short );
|
m_topHitsModel->setStyle( TrackModel::Short );
|
||||||
ui->topHits->setTrackModel( m_topHitsModel );
|
ui->topHits->setTrackModel( m_topHitsModel );
|
||||||
|
ui->topHits->setSortingEnabled( false );
|
||||||
|
|
||||||
m_pixmap = QPixmap( RESPATH "images/no-album-no-case.png" ).scaledToWidth( 48, Qt::SmoothTransformation );
|
m_pixmap = QPixmap( RESPATH "images/no-album-no-case.png" ).scaledToWidth( 48, Qt::SmoothTransformation );
|
||||||
|
|
||||||
@@ -252,15 +256,17 @@ ArtistInfoWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestD
|
|||||||
{
|
{
|
||||||
const QStringList tracks = returnedData["tracks"].toStringList();
|
const QStringList tracks = returnedData["tracks"].toStringList();
|
||||||
|
|
||||||
|
QList< query_ptr > queries;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach ( const QString& track, tracks )
|
foreach ( const QString& track, tracks )
|
||||||
{
|
{
|
||||||
query_ptr query = Query::get( m_artist->name(), track, QString(), uuid() );
|
queries << Query::get( m_artist->name(), track, QString(), uuid() );
|
||||||
m_topHitsModel->append( query );
|
|
||||||
|
|
||||||
if ( ++i == 15 )
|
if ( ++i == 15 )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_topHitsModel->append( queries );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user