@@ -2449,6 +2449,23 @@ void WTrackMenu::slotClearAllMetadata() {
24492449 applyTrackPointerOperation (
24502450 progressLabelText,
24512451 &trackOperator);
2452+
2453+ // Also clear fingerprint data — this is not covered by TrackPointerOperation
2454+ // because clearFingerprintData works on TrackId + DAO directly (no Track object
2455+ // needed), and mixing the two paradigms inside a TrackPointerOperation would
2456+ // require injecting the DAO into it unnecessarily.
2457+ const TrackIdList trackIds = getTrackIds ();
2458+ TrackFingerprintDao& dao = m_pLibrary->trackCollectionManager ()
2459+ ->internalCollection ()
2460+ ->getTrackFingerprintDAO ();
2461+
2462+ // TODO(XXX): This loop runs after the progress dialog closes. For very large
2463+ // selections it may block the main thread briefly (DB + file deletions, no
2464+ // audio). A future PR should fold this into a TrackPointerOperation so it
2465+ // stays inside the progress modal.
2466+ for (const TrackId& id : std::as_const (trackIds)) {
2467+ dao.clearFingerprintData (id);
2468+ }
24522469}
24532470
24542471void WTrackMenu::slotClearFingerprint () {
@@ -2461,9 +2478,6 @@ void WTrackMenu::slotClearFingerprint() {
24612478 ->internalCollection ()
24622479 ->getTrackFingerprintDAO ();
24632480
2464- const auto progressLabelText =
2465- tr (" Clearing fingerprint data of %n track(s)" , " " , getTrackCount ());
2466-
24672481 // We use a simple loop here rather than TrackPointerOperation because
24682482 // clearFingerprintData() works directly on TrackId and does not need an
24692483 // in-memory TrackPointer — it only touches the DB and the .chroma file.
@@ -2475,7 +2489,10 @@ void WTrackMenu::slotClearFingerprint() {
24752489 ++cleared;
24762490 }
24772491 }
2478- Q_UNUSED (progressLabelText); // progress dialog not used for this simple loop
2492+
2493+ // TODO(XXX): Add a progress dialog when
2494+ // fingerprint clearing moves into a TrackPointerOperation.
2495+
24792496 Q_UNUSED (cleared);
24802497}
24812498
0 commit comments