From ed86c7b09b874dc07049008953e68d5382e095e5 Mon Sep 17 00:00:00 2001 From: Andreas Date: Wed, 20 Mar 2013 15:57:22 +0100 Subject: [PATCH] - New protocol buffer type: ACTIVE_PLAYLIST_CHANGED. This type is sent when the currenly active playlist changes instead of sending all playlists to the clients. --- ext/libclementine-remote/remotecontrolmessages.proto | 8 +++++++- src/networkremote/outgoingdatacreator.cpp | 8 +++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ext/libclementine-remote/remotecontrolmessages.proto b/ext/libclementine-remote/remotecontrolmessages.proto index deed1149b..1e355c01b 100644 --- a/ext/libclementine-remote/remotecontrolmessages.proto +++ b/ext/libclementine-remote/remotecontrolmessages.proto @@ -33,6 +33,7 @@ enum MsgType { ENGINE_STATE_CHANGED = 44; KEEP_ALIVE = 45; UPDATE_TRACK_POSITION = 46; + ACTIVE_PLAYLIST_CHANGED = 47; } // Valid Engine states @@ -161,6 +162,10 @@ message ResponseDisconnect { optional ReasonDisconnect reason_disconnect = 1; } +message ResponseActiveChanged { + optional int32 id = 1; +} + // A client requests a new track position // position in seconds! message RequestSetTrackPosition { @@ -169,7 +174,7 @@ message RequestSetTrackPosition { // The message itself message Message { - optional int32 version = 1 [default=3]; + optional int32 version = 1 [default=4]; optional MsgType type = 2 [default=UNKNOWN]; // What data is in the message? optional RequestConnect request_connect = 21; @@ -188,4 +193,5 @@ message Message { optional ResponseEngineStateChanged response_engine_state_changed = 19; optional ResponseUpdateTrackPosition response_update_track_position = 20; optional ResponseDisconnect response_disconnect = 22; + optional ResponseActiveChanged response_active_changed = 24; } diff --git a/src/networkremote/outgoingdatacreator.cpp b/src/networkremote/outgoingdatacreator.cpp index c381c4489..a6099a978 100644 --- a/src/networkremote/outgoingdatacreator.cpp +++ b/src/networkremote/outgoingdatacreator.cpp @@ -124,9 +124,11 @@ void OutgoingDataCreator::SendAllPlaylists() { SendDataToClients(&msg); } -void OutgoingDataCreator::ActiveChanged(Playlist*) { - // When a playlist was changed, send the new list - SendAllPlaylists(); +void OutgoingDataCreator::ActiveChanged(Playlist* playlist) { + pb::remote::Message msg; + msg.set_type(pb::remote::ACTIVE_PLAYLIST_CHANGED); + msg.mutable_response_active_changed()->set_id(playlist->id()); + SendDataToClients(&msg); } void OutgoingDataCreator::PlaylistAdded(int id, const QString& name) {