72
72
QModelIndex /*index*/) {
75
bool AutoDJFeature::dropAccept(QUrl url) {
75
bool AutoDJFeature::dropAccept(QList<QUrl> urls) {
76
76
//TODO: Filter by supported formats regex and reject anything that doesn't match.
77
77
TrackDAO &trackDao = m_pTrackCollection->getTrackDAO();
79
79
//If a track is dropped onto a playlist's name, but the track isn't in the library,
80
80
//then add the track to the library before adding it to the playlist.
82
//XXX: See the note in PlaylistFeature::dropAccept() about using QUrl::toLocalFile()
83
// instead of toString()
84
QFileInfo file(url.toLocalFile());
86
if (!SoundSourceProxy::isFilenameSupported(file.fileName())) {
90
// Adds track, does not insert duplicates, handles unremoving logic.
91
int trackId = trackDao.addTrack(file, true);
97
// TODO(XXX) No feedback on whether this worked.
99
m_pAutoDJView->appendTrack(trackId);
101
int playlistId = m_playlistDao.getPlaylistIdFromName(AUTODJ_TABLE);
102
m_playlistDao.appendTrackToPlaylist(trackId, playlistId);
81
QList<QFileInfo> files;
82
foreach (QUrl url, urls) {
83
//XXX: See the note in PlaylistFeature::dropAccept() about using QUrl::toLocalFile()
84
// instead of toString()
85
QFileInfo file = url.toLocalFile();
86
if (SoundSourceProxy::isFilenameSupported(file.fileName())) {
90
QList<int> trackIds = trackDao.addTracks(files, true);
92
int playlistId = m_playlistDao.getPlaylistIdFromName(AUTODJ_TABLE);
93
// remove tracks that could not be added
94
for (int trackId =0; trackId<trackIds.size() ; trackId++) {
95
if (trackIds.at(trackId) < 0) {
96
trackIds.removeAt(trackId--);
99
m_playlistDao.appendTracksToPlaylist(trackIds, playlistId);
108
bool AutoDJFeature::dropAcceptChild(const QModelIndex& /*index*/, QUrl /*url*/) {
103
bool AutoDJFeature::dropAcceptChild(const QModelIndex& /*index*/, QList<QUrl> /*url*/) {