1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-01-18 20:40:43 +01:00

Make saved radio streams use the song loader when dragged to the playlist

This commit is contained in:
David Sansome 2010-06-16 16:11:23 +00:00
parent 7f3c0b853a
commit 357f229e02
4 changed files with 16 additions and 3 deletions

View File

@ -639,13 +639,23 @@ QModelIndex Playlist::InsertSongs(const SongList& songs, int pos) {
QModelIndex Playlist::InsertRadioStations(const QList<RadioItem*>& items, int pos) {
PlaylistItemList playlist_items;
QList<QUrl> song_urls;
foreach (RadioItem* item, items) {
if (!item->playable)
continue;
playlist_items << shared_ptr<PlaylistItem>(
new RadioPlaylistItem(item->service, item->Url(), item->Title(), item->Artist()));
if (item->use_song_loader) {
song_urls << item->Url();
} else {
playlist_items << shared_ptr<PlaylistItem>(
new RadioPlaylistItem(item->service, item->Url(), item->Title(), item->Artist()));
}
}
if (!song_urls.isEmpty()) {
InsertUrls(song_urls, false, pos);
}
return InsertItems(playlist_items, pos);
}

View File

@ -19,7 +19,8 @@
RadioItem::RadioItem(SimpleTreeModel<RadioItem> *model)
: SimpleTreeItem<RadioItem>(Type_Root, model),
service(NULL)
service(NULL),
use_song_loader(false)
{
}

View File

@ -43,6 +43,7 @@ class RadioItem : public SimpleTreeItem<RadioItem> {
QString artist;
RadioService* service;
bool playable;
bool use_song_loader;
};
#endif // RADIOITEM_H

View File

@ -137,6 +137,7 @@ RadioItem* SavedRadio::ItemForStream(const Stream& stream, RadioItem* parent) {
s->lazy_loaded = true;
s->icon = QIcon(":last.fm/icon_radio.png");
s->playable = true;
s->use_song_loader = true;
return s;
}