mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-16 11:19:18 +01:00
Create GS's favorites item at beggining
This commit is contained in:
parent
867a072579
commit
f8ff785932
@ -486,6 +486,16 @@ void GroovesharkService::EnsureItemsCreated() {
|
||||
search_->setData(InternetModel::PlayBehaviour_DoubleClickAction,
|
||||
InternetModel::Role_PlayBehaviour);
|
||||
root_->appendRow(search_);
|
||||
|
||||
favorites_ = new QStandardItem(QIcon(":/last.fm/love.png"), tr("Favorites"));
|
||||
favorites_->setData(InternetModel::Type_UserPlaylist, InternetModel::Role_Type);
|
||||
favorites_->setData(UserFavorites, Role_PlaylistType);
|
||||
favorites_->setData(true, InternetModel::Role_CanLazyLoad);
|
||||
favorites_->setData(true, InternetModel::Role_CanBeModified);
|
||||
favorites_->setData(InternetModel::PlayBehaviour_SingleItem,
|
||||
InternetModel::Role_PlayBehaviour);
|
||||
root_->appendRow(favorites_);
|
||||
|
||||
RetrieveUserFavorites();
|
||||
RetrieveUserPlaylists();
|
||||
}
|
||||
@ -595,18 +605,7 @@ void GroovesharkService::UserFavoritesRetrieved() {
|
||||
|
||||
reply->deleteLater();
|
||||
|
||||
bool favorites_item_already_exists = false;
|
||||
if (favorites_) {
|
||||
favorites_item_already_exists = true;
|
||||
favorites_->removeRows(0, favorites_->rowCount());
|
||||
} else {
|
||||
favorites_ = new QStandardItem(QIcon(":/last.fm/love.png"), tr("Favorites"));
|
||||
favorites_->setData(InternetModel::Type_UserPlaylist, InternetModel::Role_Type);
|
||||
favorites_->setData(UserFavorites, Role_PlaylistType);
|
||||
favorites_->setData(true, InternetModel::Role_CanLazyLoad);
|
||||
favorites_->setData(true, InternetModel::Role_CanBeModified);
|
||||
favorites_->setData(InternetModel::PlayBehaviour_SingleItem, InternetModel::Role_PlayBehaviour);
|
||||
}
|
||||
|
||||
QVariantMap result = ExtractResult(reply);
|
||||
SongList songs = ExtractSongs(result);
|
||||
@ -620,9 +619,6 @@ void GroovesharkService::UserFavoritesRetrieved() {
|
||||
|
||||
favorites_->appendRow(child);
|
||||
}
|
||||
if (!favorites_item_already_exists) {
|
||||
root_->appendRow(favorites_);
|
||||
}
|
||||
}
|
||||
|
||||
void GroovesharkService::MarkStreamKeyOver30Secs(const QString& stream_key,
|
||||
|
Loading…
Reference in New Issue
Block a user