- 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.

This commit is contained in:
Andreas 2013-03-20 15:57:22 +01:00
parent 329a91c265
commit ed86c7b09b
2 changed files with 12 additions and 4 deletions

View File

@ -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;
}

View File

@ -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) {