-
-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
af5a36f
Remove unused unremove flag from addMultipleTracks()
daschuer 5ad6d78
Remove superfluid transaction around a single sql statment, which was…
daschuer 901095c
introduce new function getAndEnsureTrackIds()
daschuer 0e9b727
Use a temp table to keep sorting unchanged in TrackDAO::getTrackIds()
daschuer af85c1c
Improve query in TrackDAO::unhideTracks()
daschuer 5eb8ac0
Add the addMissingTracks fature to TrackDAO::getTrackIds() and make u…
daschuer acb8444
Completely replace obsolete TrackDAO::addMultipleTracks() calls by ge…
daschuer 29b81a7
Renamed resolveTrackIds() and add enum fag option parameter
daschuer 2916740
Add new functions resolveTrackIdsFromUrls() and resolveTrackIdsFromLo…
daschuer ea855d6
rename options -> flags
daschuer ad73dba
predefere isEmpty() over !size()
daschuer ec0b354
rename onHideTracks to hideTracks
daschuer 04b26e4
change remaining !size() to isEmpty()
daschuer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,26 +200,20 @@ void updateTreeItemForTrackSelection( | |
bool CrateFeature::dropAcceptChild(const QModelIndex& index, QList<QUrl> urls, | ||
QObject* pSource) { | ||
CrateId crateId(crateIdFromIndex(index)); | ||
if (!crateId.isValid()) { | ||
VERIFY_OR_DEBUG_ASSERT(crateId.isValid()) { | ||
return false; | ||
} | ||
QList<QFileInfo> files = DragAndDropHelper::supportedTracksFromUrls(urls, false, true); | ||
QList<TrackId> trackIds; | ||
if (pSource) { | ||
trackIds = m_pTrackCollection->getTrackDAO().getTrackIds(files); | ||
m_pTrackCollection->unhideTracks(trackIds); | ||
} else { | ||
// Adds track, does not insert duplicates, handles unremoving logic. | ||
trackIds = m_pTrackCollection->getTrackDAO().addMultipleTracks(files, true); | ||
} | ||
qDebug() << "CrateFeature::dropAcceptChild adding tracks" | ||
<< trackIds.size() << " to crate "<< crateId; | ||
// remove tracks that could not be added | ||
for (int trackIdIndex = 0; trackIdIndex < trackIds.size(); ++trackIdIndex) { | ||
if (!trackIds.at(trackIdIndex).isValid()) { | ||
trackIds.removeAt(trackIdIndex--); | ||
} | ||
// 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 | ||
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; | ||
} | ||
|
||
m_pTrackCollection->addCrateTracks(crateId, trackIds); | ||
return true; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?