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);
// 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);
for (int i = 0; i < count; ++i) {
sp_playlist* playlist = sp_playlistcontainer_playlist(pc, i);
@ -612,10 +613,11 @@ void SpotifyClient::PlaylistStateChangedForGetPlaylists(sp_playlist* pl,
void SpotifyClient::AddTracksToPlaylist(
const pb::spotify::AddTracksToPlaylistRequest& req) {
// 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) {
qLog(Error) << "Playlist " << req.playlist_type() << "," <<
req.playlist_index() << "not found";
qLog(Error) << "Playlist " << req.playlist_type() << ","
<< req.playlist_index() << "not found";
return;
}
@ -653,8 +655,8 @@ void SpotifyClient::RemoveTracksFromPlaylist(
sp_playlist* playlist =
GetPlaylist(req.playlist_type(), req.playlist_index());
if (!playlist) {
qLog(Error) << "Playlist " << req.playlist_type() << "," <<
req.playlist_index() << "not found";
qLog(Error) << "Playlist " << req.playlist_type() << ","
<< req.playlist_index() << "not found";
return;
}

View File

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

View File

@ -48,7 +48,8 @@ class SpotifyServer : public AbstractMessageHandler<pb::spotify::Message> {
void LoadUserPlaylist(int index);
void SyncUserPlaylist(int index);
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,
const QList<int>& songs_indices_to_remove);
void RemoveSongsFromStarred(const QList<int>& songs_indices_to_remove);
@ -67,7 +68,7 @@ class SpotifyServer : public AbstractMessageHandler<pb::spotify::Message> {
void StartPlayback(const QString& uri, quint16 port);
void Seek(qint64 offset_nsec);
signals:
signals:
void LoginCompleted(bool success, const QString& error,
pb::spotify::LoginResponse_Error error_code);
void PlaylistsUpdated(const pb::spotify::Playlists& playlists);

View File

@ -380,7 +380,7 @@ void SpotifyService::AddCurrentSongToUserPlaylist(QAction* action) {
}
void SpotifyService::AddSongsToUserPlaylist(int playlist_index,
const QList<QUrl>& songs_urls) {
const QList<QUrl>& songs_urls) {
EnsureServerCreated();
server_->AddSongsToUserPlaylist(playlist_index, songs_urls);
}
@ -471,7 +471,8 @@ void SpotifyService::PlaylistsUpdated(const pb::spotify::Playlists& response) {
item->setData(msg.is_mine(), InternetModel::Role_CanBeModified);
item->setData(InternetModel::PlayBehaviour_MultipleItems,
InternetModel::Role_PlayBehaviour);
item->setData(QUrl(QStringFromStdString(msg.uri())), InternetModel::Role_Url);
item->setData(QUrl(QStringFromStdString(msg.uri())),
InternetModel::Role_Url);
root_->appendRow(item);
playlists_ << item;
@ -605,8 +606,8 @@ QList<QAction*> SpotifyService::playlistitem_actions(const Song& song) {
delete action;
}
QAction* add_to_starred = new QAction(QIcon(":/star-on.png"),
tr("Add to Spotify starred"), this);
QAction* add_to_starred =
new QAction(QIcon(":/star-on.png"), tr("Add to Spotify starred"), this);
connect(add_to_starred, SIGNAL(triggered()),
SLOT(AddCurrentSongToStarredPlaylist()));
playlistitem_actions_.append(add_to_starred);
@ -660,9 +661,9 @@ void SpotifyService::EnsureMenuCreated() {
playlist_sync_action_ = playlist_context_menu_->addAction(
IconLoader::Load("view-refresh"), tr("Make playlist available offline"),
this, SLOT(SyncPlaylist()));
get_url_to_share_playlist_ =
playlist_context_menu_->addAction(tr("Get a URL to share this playlist"),
this, SLOT(GetCurrentPlaylistUrlToShare()));
get_url_to_share_playlist_ = playlist_context_menu_->addAction(
tr("Get a URL to share this playlist"), this,
SLOT(GetCurrentPlaylistUrlToShare()));
playlist_context_menu_->addSeparator();
playlist_context_menu_->addAction(GetNewShowConfigAction());
@ -671,7 +672,7 @@ void SpotifyService::EnsureMenuCreated() {
IconLoader::Load("list-remove"), tr("Remove from playlist"), this,
SLOT(RemoveCurrentFromPlaylist()));
song_context_menu_->addAction(tr("Get a URL to share this Spotify song"),
this, SLOT(GetCurrentSongUrlToShare()));
this, SLOT(GetCurrentSongUrlToShare()));
song_context_menu_->addAction(GetNewShowConfigAction());
}
@ -798,7 +799,8 @@ void SpotifyService::ShowContextMenu(const QPoint& global_pos) {
playlist_sync_action_->setData(qVariantFromValue(item));
playlist_context_menu_->popup(global_pos);
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;
} else if (type == InternetModel::Type_Track) {
current_song_url_ = item->data(InternetModel::Role_Url).toUrl();
@ -829,7 +831,7 @@ void SpotifyService::GetCurrentPlaylistUrlToShare() const {
// URLs we use can be opened with Spotify application, but I believe it's
// better to give website links instead.
url.replace(QRegExp("spotify:user:([^:]*):playlist:([^:]*)"),
"https://play.spotify.com/user/\\1/playlist/\\2");
"https://play.spotify.com/user/\\1/playlist/\\2");
InternetService::ShowUrlBox(tr("Spotify playlist's URL"), url);
}
@ -915,8 +917,8 @@ void SpotifyService::RemoveCurrentFromPlaylist() {
Type_StarredPlaylist) {
is_starred = true;
} else if (index.parent().data(InternetModel::Role_Type).toInt() !=
InternetModel::Type_UserPlaylist) {
continue;
InternetModel::Type_UserPlaylist) {
continue;
}
if (index.data(InternetModel::Role_Type).toInt() !=

View File

@ -95,7 +95,7 @@ class SpotifyService : public InternetService {
static void SongFromProtobuf(const pb::spotify::Track& track, Song* song);
signals:
signals:
void BlobStateChanged();
void LoginFinished(bool success);
void ImageLoaded(const QString& id, const QImage& image);
@ -112,7 +112,8 @@ class SpotifyService : public InternetService {
const google::protobuf::RepeatedPtrField<pb::spotify::Track>& tracks);
void FillPlaylist(QStandardItem* item,
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 EnsureMenuCreated();
// Create a new "show config" action. The caller is responsible for deleting
@ -133,7 +134,7 @@ class SpotifyService : public InternetService {
void AddCurrentSongToUserPlaylist(QAction* action);
void AddCurrentSongToStarredPlaylist();
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 PlaylistsUpdated(const pb::spotify::Playlists& response);
void InboxLoaded(const pb::spotify::LoadPlaylistResponse& response);