run make format

This commit is contained in:
Arnaud Bienner 2015-01-14 22:55:20 +01:00
parent 7039c2a2bf
commit e1139e731f
5 changed files with 38 additions and 30 deletions

View File

@ -372,7 +372,8 @@ void SpotifyClient::PlaylistContainerLoadedCallback(sp_playlistcontainer* pc,
SpotifyClient* me = reinterpret_cast<SpotifyClient*>(userdata); SpotifyClient* me = reinterpret_cast<SpotifyClient*>(userdata);
// Install callbacks on all the playlists // Install callbacks on all the playlists
sp_playlist_add_callbacks(sp_session_starred_create(me->session_), &me->get_playlists_callbacks_, me); sp_playlist_add_callbacks(sp_session_starred_create(me->session_),
&me->get_playlists_callbacks_, me);
const int count = sp_playlistcontainer_num_playlists(pc); const int count = sp_playlistcontainer_num_playlists(pc);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
sp_playlist* playlist = sp_playlistcontainer_playlist(pc, i); sp_playlist* playlist = sp_playlistcontainer_playlist(pc, i);
@ -612,10 +613,11 @@ void SpotifyClient::PlaylistStateChangedForGetPlaylists(sp_playlist* pl,
void SpotifyClient::AddTracksToPlaylist( void SpotifyClient::AddTracksToPlaylist(
const pb::spotify::AddTracksToPlaylistRequest& req) { const pb::spotify::AddTracksToPlaylistRequest& req) {
// Get the playlist we want to update // Get the playlist we want to update
sp_playlist* playlist = GetPlaylist(req.playlist_type(), req.playlist_index()); sp_playlist* playlist =
GetPlaylist(req.playlist_type(), req.playlist_index());
if (!playlist) { if (!playlist) {
qLog(Error) << "Playlist " << req.playlist_type() << "," << qLog(Error) << "Playlist " << req.playlist_type() << ","
req.playlist_index() << "not found"; << req.playlist_index() << "not found";
return; return;
} }
@ -653,8 +655,8 @@ void SpotifyClient::RemoveTracksFromPlaylist(
sp_playlist* playlist = sp_playlist* playlist =
GetPlaylist(req.playlist_type(), req.playlist_index()); GetPlaylist(req.playlist_type(), req.playlist_index());
if (!playlist) { if (!playlist) {
qLog(Error) << "Playlist " << req.playlist_type() << "," << qLog(Error) << "Playlist " << req.playlist_type() << ","
req.playlist_index() << "not found"; << req.playlist_index() << "not found";
return; return;
} }

View File

@ -219,9 +219,9 @@ void SpotifyServer::AddSongsToUserPlaylist(int playlist_index,
AddSongsToPlaylist(pb::spotify::UserPlaylist, songs_urls, playlist_index); AddSongsToPlaylist(pb::spotify::UserPlaylist, songs_urls, playlist_index);
} }
void SpotifyServer::AddSongsToPlaylist(const pb::spotify::PlaylistType playlist_type, void SpotifyServer::AddSongsToPlaylist(
const QList<QUrl>& songs_urls, const pb::spotify::PlaylistType playlist_type,
int playlist_index) { const QList<QUrl>& songs_urls, int playlist_index) {
pb::spotify::Message message; pb::spotify::Message message;
pb::spotify::AddTracksToPlaylistRequest* req = pb::spotify::AddTracksToPlaylistRequest* req =
message.mutable_add_tracks_to_playlist(); message.mutable_add_tracks_to_playlist();
@ -233,13 +233,15 @@ void SpotifyServer::AddSongsToPlaylist(const pb::spotify::PlaylistType playlist_
SendOrQueueMessage(message); SendOrQueueMessage(message);
} }
void SpotifyServer::RemoveSongsFromStarred(const QList<int>& songs_indices_to_remove) { void SpotifyServer::RemoveSongsFromStarred(
const QList<int>& songs_indices_to_remove) {
RemoveSongsFromPlaylist(pb::spotify::Starred, songs_indices_to_remove); RemoveSongsFromPlaylist(pb::spotify::Starred, songs_indices_to_remove);
} }
void SpotifyServer::RemoveSongsFromUserPlaylist(int playlist_index, void SpotifyServer::RemoveSongsFromUserPlaylist(
const QList<int>& songs_indices_to_remove) { int playlist_index, const QList<int>& songs_indices_to_remove) {
RemoveSongsFromPlaylist(pb::spotify::UserPlaylist, songs_indices_to_remove, playlist_index); RemoveSongsFromPlaylist(pb::spotify::UserPlaylist, songs_indices_to_remove,
playlist_index);
} }
void SpotifyServer::RemoveSongsFromPlaylist( void SpotifyServer::RemoveSongsFromPlaylist(

View File

@ -48,7 +48,8 @@ class SpotifyServer : public AbstractMessageHandler<pb::spotify::Message> {
void LoadUserPlaylist(int index); void LoadUserPlaylist(int index);
void SyncUserPlaylist(int index); void SyncUserPlaylist(int index);
void AddSongsToStarred(const QList<QUrl>& songs_urls); void AddSongsToStarred(const QList<QUrl>& songs_urls);
void AddSongsToUserPlaylist(int playlist_index, const QList<QUrl>& songs_urls); void AddSongsToUserPlaylist(int playlist_index,
const QList<QUrl>& songs_urls);
void RemoveSongsFromUserPlaylist(int playlist_index, void RemoveSongsFromUserPlaylist(int playlist_index,
const QList<int>& songs_indices_to_remove); const QList<int>& songs_indices_to_remove);
void RemoveSongsFromStarred(const QList<int>& songs_indices_to_remove); void RemoveSongsFromStarred(const QList<int>& songs_indices_to_remove);

View File

@ -471,7 +471,8 @@ void SpotifyService::PlaylistsUpdated(const pb::spotify::Playlists& response) {
item->setData(msg.is_mine(), InternetModel::Role_CanBeModified); item->setData(msg.is_mine(), InternetModel::Role_CanBeModified);
item->setData(InternetModel::PlayBehaviour_MultipleItems, item->setData(InternetModel::PlayBehaviour_MultipleItems,
InternetModel::Role_PlayBehaviour); InternetModel::Role_PlayBehaviour);
item->setData(QUrl(QStringFromStdString(msg.uri())), InternetModel::Role_Url); item->setData(QUrl(QStringFromStdString(msg.uri())),
InternetModel::Role_Url);
root_->appendRow(item); root_->appendRow(item);
playlists_ << item; playlists_ << item;
@ -605,8 +606,8 @@ QList<QAction*> SpotifyService::playlistitem_actions(const Song& song) {
delete action; delete action;
} }
QAction* add_to_starred = new QAction(QIcon(":/star-on.png"), QAction* add_to_starred =
tr("Add to Spotify starred"), this); new QAction(QIcon(":/star-on.png"), tr("Add to Spotify starred"), this);
connect(add_to_starred, SIGNAL(triggered()), connect(add_to_starred, SIGNAL(triggered()),
SLOT(AddCurrentSongToStarredPlaylist())); SLOT(AddCurrentSongToStarredPlaylist()));
playlistitem_actions_.append(add_to_starred); playlistitem_actions_.append(add_to_starred);
@ -660,9 +661,9 @@ void SpotifyService::EnsureMenuCreated() {
playlist_sync_action_ = playlist_context_menu_->addAction( playlist_sync_action_ = playlist_context_menu_->addAction(
IconLoader::Load("view-refresh"), tr("Make playlist available offline"), IconLoader::Load("view-refresh"), tr("Make playlist available offline"),
this, SLOT(SyncPlaylist())); this, SLOT(SyncPlaylist()));
get_url_to_share_playlist_ = get_url_to_share_playlist_ = playlist_context_menu_->addAction(
playlist_context_menu_->addAction(tr("Get a URL to share this playlist"), tr("Get a URL to share this playlist"), this,
this, SLOT(GetCurrentPlaylistUrlToShare())); SLOT(GetCurrentPlaylistUrlToShare()));
playlist_context_menu_->addSeparator(); playlist_context_menu_->addSeparator();
playlist_context_menu_->addAction(GetNewShowConfigAction()); playlist_context_menu_->addAction(GetNewShowConfigAction());
@ -798,7 +799,8 @@ void SpotifyService::ShowContextMenu(const QPoint& global_pos) {
playlist_sync_action_->setData(qVariantFromValue(item)); playlist_sync_action_->setData(qVariantFromValue(item));
playlist_context_menu_->popup(global_pos); playlist_context_menu_->popup(global_pos);
current_playlist_url_ = item->data(InternetModel::Role_Url).toUrl(); current_playlist_url_ = item->data(InternetModel::Role_Url).toUrl();
get_url_to_share_playlist_->setVisible(type == InternetModel::Type_UserPlaylist); get_url_to_share_playlist_->setVisible(type ==
InternetModel::Type_UserPlaylist);
return; return;
} else if (type == InternetModel::Type_Track) { } else if (type == InternetModel::Type_Track) {
current_song_url_ = item->data(InternetModel::Role_Url).toUrl(); current_song_url_ = item->data(InternetModel::Role_Url).toUrl();

View File

@ -112,7 +112,8 @@ class SpotifyService : public InternetService {
const google::protobuf::RepeatedPtrField<pb::spotify::Track>& tracks); const google::protobuf::RepeatedPtrField<pb::spotify::Track>& tracks);
void FillPlaylist(QStandardItem* item, void FillPlaylist(QStandardItem* item,
const pb::spotify::LoadPlaylistResponse& response); const pb::spotify::LoadPlaylistResponse& response);
void AddSongsToUserPlaylist(int playlist_index, const QList<QUrl>& songs_urls); void AddSongsToUserPlaylist(int playlist_index,
const QList<QUrl>& songs_urls);
void AddSongsToStarred(const QList<QUrl>& songs_urls); void AddSongsToStarred(const QList<QUrl>& songs_urls);
void EnsureMenuCreated(); void EnsureMenuCreated();
// Create a new "show config" action. The caller is responsible for deleting // Create a new "show config" action. The caller is responsible for deleting