1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-28 16:20:01 +02:00

TWK-1045: Alphabetize spotify playlists in settings widget

This commit is contained in:
Leo Franchi
2012-08-18 18:42:18 -04:00
parent 785403d2c2
commit b55851feec
2 changed files with 10 additions and 2 deletions

View File

@@ -71,7 +71,6 @@ enum ActionType {
}; };
} }
Account* Account*
SpotifyAccountFactory::createAccount( const QString& accountId ) SpotifyAccountFactory::createAccount( const QString& accountId )
{ {

View File

@@ -30,6 +30,11 @@
using namespace Tomahawk; using namespace Tomahawk;
using namespace Accounts; using namespace Accounts;
bool InfoSorter( const SpotifyPlaylistInfo* left, const SpotifyPlaylistInfo* right )
{
return left->name < right->name;
}
SpotifyAccountConfig::SpotifyAccountConfig( SpotifyAccount *account ) SpotifyAccountConfig::SpotifyAccountConfig( SpotifyAccount *account )
: QWidget( 0 ) : QWidget( 0 )
, m_ui( new Ui::SpotifyConfig ) , m_ui( new Ui::SpotifyConfig )
@@ -135,7 +140,11 @@ SpotifyAccountConfig::setPlaylists( const QList<SpotifyPlaylistInfo *>& playlist
m_playlistsLoading->fadeOut(); m_playlistsLoading->fadeOut();
m_ui->playlistList->clear(); m_ui->playlistList->clear();
foreach ( SpotifyPlaylistInfo* pl, playlists )
QList<SpotifyPlaylistInfo *> myList = playlists;
qSort( myList.begin(), myList.end(), InfoSorter );
foreach ( SpotifyPlaylistInfo* pl, myList )
{ {
QListWidgetItem* item = new QListWidgetItem( pl->name, m_ui->playlistList ); QListWidgetItem* item = new QListWidgetItem( pl->name, m_ui->playlistList );
item->setData( Qt::UserRole, QVariant::fromValue< SpotifyPlaylistInfo* >( pl ) ); item->setData( Qt::UserRole, QVariant::fromValue< SpotifyPlaylistInfo* >( pl ) );