-
-
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
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,12 +210,14 @@ bool CrateFeature::dropAcceptChild(const QModelIndex& index, QList<QUrl> urls, | |
|
||
// 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. getAndEnsureTrackIds(), does not insert duplicates and handles | ||
// unremove logic. | ||
// playlist. | ||
// pSource != nullptr it is a drop from inside Mixxx and indicates all | ||
// tracks already in the DB | ||
bool addMissingTracks = (pSource == nullptr); | ||
QList<TrackId> trackIds = m_pTrackCollection->getAndEnsureTrackIds(files, addMissingTracks); | ||
TrackDAO::ResolveTrackIdOptions options = TrackDAO::ResolveTrackIdOption::UnhideHidden; | ||
if (pSource == nullptr) { | ||
options |= TrackDAO::ResolveTrackIdOption::AddMissing; | ||
} | ||
QList<TrackId> trackIds = m_pTrackCollection->resolveTrackIds(files, options); | ||
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 |
---|---|---|
|
@@ -24,6 +24,14 @@ class LibraryHashDAO; | |
class TrackDAO : public QObject, public virtual DAO, public virtual GlobalTrackCacheRelocator { | ||
Q_OBJECT | ||
public: | ||
|
||
enum class ResolveTrackIdOption : int { | ||
ResolveOnly = 0, | ||
UnhideHidden = 1, | ||
AddMissing = 2 | ||
}; | ||
Q_DECLARE_FLAGS(ResolveTrackIdOptions, ResolveTrackIdOption) | ||
|
||
// The 'config object' is necessary because users decide ID3 tags get | ||
// synchronized on track metadata change | ||
TrackDAO( | ||
|
@@ -40,7 +48,7 @@ class TrackDAO : public QObject, public virtual DAO, public virtual GlobalTrackC | |
void finish(); | ||
|
||
TrackId getTrackId(const QString& absoluteFilePath); | ||
QList<TrackId> getTrackIds(const QList<QFileInfo>& files, bool addMissingTracks); | ||
QList<TrackId> resolveTrackIds(const QList<QFileInfo>& files, ResolveTrackIdOptions options); | ||
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. Should we add the default option = ResolveTrackIdOption::ResolveOnly? Would make sense here. 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 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. It is not obvious that options contains a mask of flags. Maybe a renaming could help (.h/.cpp)? |
||
QList<TrackId> getTrackIds(const QDir& dir); | ||
|
||
// WARNING: Only call this from the main thread instance of TrackDAO. | ||
|
@@ -157,4 +165,7 @@ class TrackDAO : public QObject, public virtual DAO, public virtual GlobalTrackC | |
DISALLOW_COPY_AND_ASSIGN(TrackDAO); | ||
}; | ||
|
||
|
||
Q_DECLARE_OPERATORS_FOR_FLAGS(TrackDAO::ResolveTrackIdOptions) | ||
|
||
#endif //TRACKDAO_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,12 +114,14 @@ bool PlaylistFeature::dropAcceptChild(const QModelIndex& index, QList<QUrl> urls | |
|
||
// 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. getAndEnsureTrackIds(), does not insert duplicates and handles | ||
// unremove logic. | ||
// playlist. | ||
// pSource != nullptr it is a drop from inside Mixxx and indicates all | ||
// tracks already in the DB | ||
bool addMissingTracks = (pSource == nullptr); | ||
QList<TrackId> trackIds = m_pTrackCollection->getAndEnsureTrackIds(files, addMissingTracks); | ||
TrackDAO::ResolveTrackIdOptions options = TrackDAO::ResolveTrackIdOption::UnhideHidden; | ||
if (pSource == nullptr) { | ||
options |= TrackDAO::ResolveTrackIdOption::AddMissing; | ||
} | ||
QList<TrackId> trackIds = m_pTrackCollection->resolveTrackIds(files, options); | ||
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.
isEmpty()
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.
ping