-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the track order during drag and drop Lp1829601 #2237
Changes from 1 commit
af5a36f
5ad6d78
901095c
0e9b727
af85c1c
5eb8ac0
acb8444
29b81a7
2916740
ea855d6
ad73dba
ec0b354
04b26e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…cations() to remove duplicates
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,21 +138,13 @@ void AutoDJFeature::activate() { | |
} | ||
|
||
bool AutoDJFeature::dropAccept(QList<QUrl> urls, QObject* pSource) { | ||
QList<QFileInfo> files = DragAndDropHelper::supportedTracksFromUrls(urls, false, true); | ||
if (!files.size()) { | ||
return false; | ||
} | ||
|
||
// If a track is dropped onto the Auto DJ tree node, but the track isn't in the | ||
// library, then add the track to the library before adding it to the | ||
// Auto DJ playlist. | ||
// pSource != nullptr it is a drop from inside Mixxx and indicates all | ||
// tracks already in the DB | ||
TrackDAO::ResolveTrackIdOptions options = TrackDAO::ResolveTrackIdOption::UnhideHidden; | ||
if (pSource == nullptr) { | ||
options |= TrackDAO::ResolveTrackIdOption::AddMissing; | ||
} | ||
QList<TrackId> trackIds = m_pTrackCollection->resolveTrackIds(files, options); | ||
QList<TrackId> trackIds = m_pTrackCollection->resolveTrackIdsFromUrls(urls, | ||
!pSource); | ||
if (!trackIds.size()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isEmpty() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ping |
||
return false; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,21 +203,13 @@ bool CrateFeature::dropAcceptChild(const QModelIndex& index, QList<QUrl> urls, | |
VERIFY_OR_DEBUG_ASSERT(crateId.isValid()) { | ||
return false; | ||
} | ||
QList<QFileInfo> files = DragAndDropHelper::supportedTracksFromUrls(urls, false, true); | ||
if (!files.size()) { | ||
return false; | ||
} | ||
|
||
// If a track is dropped onto a crate's name, but the track isn't in the | ||
// library, then add the track to the library before adding it to the | ||
// playlist. | ||
// pSource != nullptr it is a drop from inside Mixxx and indicates all | ||
// tracks already in the DB | ||
TrackDAO::ResolveTrackIdOptions options = TrackDAO::ResolveTrackIdOption::UnhideHidden; | ||
if (pSource == nullptr) { | ||
options |= TrackDAO::ResolveTrackIdOption::AddMissing; | ||
} | ||
QList<TrackId> trackIds = m_pTrackCollection->resolveTrackIds(files, options); | ||
QList<TrackId> trackIds = m_pTrackCollection->resolveTrackIdsFromUrls(urls, | ||
!pSource); | ||
if (!trackIds.size()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isEmpty() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ping |
||
return false; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,22 +106,13 @@ bool PlaylistFeature::dropAcceptChild(const QModelIndex& index, QList<QUrl> urls | |
VERIFY_OR_DEBUG_ASSERT(playlistId >= 0) { | ||
return false; | ||
} | ||
|
||
QList<QFileInfo> files = DragAndDropHelper::supportedTracksFromUrls(urls, false, true); | ||
if (!files.size()) { | ||
return false; | ||
} | ||
|
||
// If a track is dropped onto a playlist's name, but the track isn't in the | ||
// library, then add the track to the library before adding it to the | ||
// playlist. | ||
// pSource != nullptr it is a drop from inside Mixxx and indicates all | ||
// tracks already in the DB | ||
TrackDAO::ResolveTrackIdOptions options = TrackDAO::ResolveTrackIdOption::UnhideHidden; | ||
if (pSource == nullptr) { | ||
options |= TrackDAO::ResolveTrackIdOption::AddMissing; | ||
} | ||
QList<TrackId> trackIds = m_pTrackCollection->resolveTrackIds(files, options); | ||
QList<TrackId> trackIds = m_pTrackCollection->resolveTrackIdsFromUrls(urls, | ||
!pSource); | ||
if (!trackIds.size()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isEmpty() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ping |
||
return false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dropAccept()/dropAcceptChild() contain a lot of duplicated code (AutoDJ/Crates/Playlist). Is It possible to extract this code into a function?