- Do not offer streams to download clients.

- Move Google Play logo and qr code to the middle of the settings screen.
This commit is contained in:
Andreas 2013-07-27 14:13:02 +02:00
parent b1c488ffea
commit 0785214949
3 changed files with 87 additions and 22 deletions

View File

@ -48,6 +48,7 @@ enum MsgType {
FIRST_DATA_SENT_COMPLETE = 48;
LYRICS = 49;
SONG_FILE_CHUNK = 50;
DOWNLOAD_QUEUE_EMPTY = 51;
}
// Valid Engine states

View File

@ -577,24 +577,27 @@ void OutgoingDataCreator::OfferNextSong(RemoteClient *client) {
if (!download_queue_.contains(client))
return;
if (download_queue_.value(client).isEmpty())
return;
// Get the item and send the single song
DownloadItem item = download_queue_[client].head();
pb::remote::Message msg;
msg.set_type(pb::remote::SONG_FILE_CHUNK);
pb::remote::ResponseSongFileChunk* chunk = msg.mutable_response_song_file_chunk();
// Song offer is chunk no 0
chunk->set_chunk_count(0);
chunk->set_chunk_number(0);
chunk->set_file_count(item.song_count_);
chunk->set_file_number(item.song_no_);
if (download_queue_.value(client).isEmpty()) {
// We sent all songs, tell the client the queue is empty
msg.set_type(pb::remote::DOWNLOAD_QUEUE_EMPTY);
} else {
// Get the item and send the single song
DownloadItem item = download_queue_[client].head();
CreateSong(item.song_, item.song_.image(), -1,
chunk->mutable_song_metadata());
msg.set_type(pb::remote::SONG_FILE_CHUNK);
pb::remote::ResponseSongFileChunk* chunk = msg.mutable_response_song_file_chunk();
// Song offer is chunk no 0
chunk->set_chunk_count(0);
chunk->set_chunk_number(0);
chunk->set_file_count(item.song_count_);
chunk->set_file_number(item.song_no_);
CreateSong(item.song_, item.song_.image(), -1,
chunk->mutable_song_metadata());
}
msg.set_version(msg.default_instance().version());
client->SendData(&msg);
@ -671,6 +674,10 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song,
}
void OutgoingDataCreator::SendAlbum(RemoteClient *client, const Song &song) {
// No streams!
if (song.url().scheme() != "file")
return;
SongList album = app_->library_backend()->GetSongsByAlbum(song.album());
foreach (Song s, album) {
@ -687,8 +694,19 @@ void OutgoingDataCreator::SendPlaylist(RemoteClient *client, int playlist_id) {
}
SongList song_list = playlist->GetAllSongs();
// Count the local songs
int count = 0;
foreach (Song s, song_list) {
DownloadItem item(s, song_list.indexOf(s)+1, song_list.size());
download_queue_[client].append(item);
if (s.url().scheme() == "file") {
count++;
}
}
foreach (Song s, song_list) {
// Only local files!
if (s.url().scheme() == "file") {
DownloadItem item(s, song_list.indexOf(s)+1, count);
download_queue_[client].append(item);
}
}
}

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>884</width>
<height>587</height>
<width>385</width>
<height>528</height>
</rect>
</property>
<property name="windowTitle">
@ -135,9 +135,52 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="play_store">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="play_store">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>or scan the QR code!</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
@ -146,6 +189,9 @@
<property name="pixmap">
<pixmap resource="../../data/data.qrc">:/clementine_remote_qr.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>