Playing Magnatune tracks now works
This commit is contained in:
parent
ff8c024692
commit
7ef82ef9c1
|
@ -49,6 +49,9 @@ class LibraryBackend : public QObject {
|
|||
};
|
||||
typedef QList<Album> AlbumList;
|
||||
|
||||
QString songs_table() const { return songs_table_; }
|
||||
QString dirs_table() const { return dirs_table_; }
|
||||
QString subdirs_table() const { return subdirs_table_; }
|
||||
|
||||
// Get a list of directories in the library. Emits DirectoriesDiscovered.
|
||||
void LoadDirectoriesAsync();
|
||||
|
|
|
@ -679,6 +679,8 @@ QMimeData* LibraryModel::mimeData(const QModelIndexList& indexes) const {
|
|||
QList<QUrl> urls;
|
||||
QSet<int> song_ids;
|
||||
|
||||
data->backend = backend_;
|
||||
|
||||
foreach (const QModelIndex& index, indexes) {
|
||||
GetChildSongs(IndexToItem(index), &urls, &data->songs, &song_ids);
|
||||
}
|
||||
|
|
|
@ -140,9 +140,10 @@ Song MagnatuneService::ReadTrack(QXmlStreamReader& reader) {
|
|||
attributes.value("artist").toString(),
|
||||
attributes.value("album").toString(),
|
||||
attributes.value("seconds").toString().toInt());
|
||||
song.set_track(attributes.value("track").toString().toInt());
|
||||
song.set_track(attributes.value("tracknum").toString().toInt());
|
||||
song.set_year(attributes.value("year").toString().toInt());
|
||||
song.set_filename(attributes.value("url").toString());
|
||||
song.set_filetype(Song::Type_Stream);
|
||||
|
||||
// We need to set these to satisfy the database constraints
|
||||
song.set_directory_id(0);
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "playlistbackend.h"
|
||||
#include "libraryplaylistitem.h"
|
||||
#include "playlistundocommands.h"
|
||||
#include "library.h"
|
||||
#include "librarybackend.h"
|
||||
|
||||
#include <QtDebug>
|
||||
#include <QMimeData>
|
||||
|
@ -350,8 +352,13 @@ bool Playlist::dropMimeData(const QMimeData* data, Qt::DropAction action, int ro
|
|||
return false;
|
||||
|
||||
if (const SongMimeData* song_data = qobject_cast<const SongMimeData*>(data)) {
|
||||
// Dragged from the library
|
||||
InsertLibraryItems(song_data->songs, row);
|
||||
// Dragged from a library
|
||||
// We want to check if these songs are from the actual local file backend,
|
||||
// if they are we treat them differently.
|
||||
if (song_data->backend->songs_table() == Library::kSongsTable)
|
||||
InsertLibraryItems(song_data->songs, row);
|
||||
else
|
||||
InsertSongs(song_data->songs, row);
|
||||
} else if (const RadioMimeData* radio_data = qobject_cast<const RadioMimeData*>(data)) {
|
||||
// Dragged from the Radio pane
|
||||
InsertRadioStations(radio_data->items, row);
|
||||
|
|
|
@ -21,10 +21,15 @@
|
|||
|
||||
#include "song.h"
|
||||
|
||||
class LibraryBackend;
|
||||
|
||||
class SongMimeData : public QMimeData {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SongMimeData() : backend(NULL) {}
|
||||
|
||||
LibraryBackend* backend;
|
||||
SongList songs;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue