mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 03:45:56 +01:00
Create GS's favorites item at beggining
This commit is contained in:
parent
867a072579
commit
f8ff785932
@ -484,8 +484,18 @@ void GroovesharkService::EnsureItemsCreated() {
|
|||||||
tr("Search Grooveshark (opens a new tab)"));
|
tr("Search Grooveshark (opens a new tab)"));
|
||||||
search_->setData(Type_SearchResults, InternetModel::Role_Type);
|
search_->setData(Type_SearchResults, InternetModel::Role_Type);
|
||||||
search_->setData(InternetModel::PlayBehaviour_DoubleClickAction,
|
search_->setData(InternetModel::PlayBehaviour_DoubleClickAction,
|
||||||
InternetModel::Role_PlayBehaviour);
|
InternetModel::Role_PlayBehaviour);
|
||||||
root_->appendRow(search_);
|
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();
|
RetrieveUserFavorites();
|
||||||
RetrieveUserPlaylists();
|
RetrieveUserPlaylists();
|
||||||
}
|
}
|
||||||
@ -595,18 +605,7 @@ void GroovesharkService::UserFavoritesRetrieved() {
|
|||||||
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
bool favorites_item_already_exists = false;
|
favorites_->removeRows(0, favorites_->rowCount());
|
||||||
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);
|
QVariantMap result = ExtractResult(reply);
|
||||||
SongList songs = ExtractSongs(result);
|
SongList songs = ExtractSongs(result);
|
||||||
@ -620,9 +619,6 @@ void GroovesharkService::UserFavoritesRetrieved() {
|
|||||||
|
|
||||||
favorites_->appendRow(child);
|
favorites_->appendRow(child);
|
||||||
}
|
}
|
||||||
if (!favorites_item_already_exists) {
|
|
||||||
root_->appendRow(favorites_);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroovesharkService::MarkStreamKeyOver30Secs(const QString& stream_key,
|
void GroovesharkService::MarkStreamKeyOver30Secs(const QString& stream_key,
|
||||||
|
Loading…
Reference in New Issue
Block a user