Send search provider icon to the remote when sending the search results.

This commit is contained in:
Andreas 2015-05-03 18:30:58 +02:00
parent 4c9f7e6a5e
commit d59e864947
2 changed files with 8 additions and 0 deletions

View File

@ -297,6 +297,7 @@ message ResponseGlobalSearch {
optional string query = 2;
optional string search_provider = 3;
repeated SongMetadata song_metadata = 4;
optional bytes search_provider_icon = 5;
}
message ResponseTranscoderStatus {

View File

@ -675,6 +675,13 @@ void OutgoingDataCreator::ResultsAvailable(int id, const SearchProvider::ResultL
response->set_query(DataCommaSizeFromQString(search_request.query_));
response->set_search_provider(DataCommaSizeFromQString(results.first().provider_->name()));
// Append the icon
QImage icon_image(results.first().provider_->icon().pixmap(48, 48).toImage());
QByteArray byte_array;
QBuffer buf(&byte_array);
icon_image.save(&buf, "PNG");
response->set_search_provider_icon(byte_array.data(), byte_array.size());
for (const SearchProvider::Result& result : results) {
pb::remote::SongMetadata* pb_song = response->add_song_metadata();
CreateSong(result.metadata_, null_img, 0, pb_song);