Skip to content

Fix #10209: Show message when rescanning with no library folders - #15972

Merged
ronso0 merged 1 commit into
mixxxdj:mainfrom
Swarnadip-Kar:fix-10209-no-directories-message
Mar 4, 2026
Merged

Fix #10209: Show message when rescanning with no library folders#15972
ronso0 merged 1 commit into
mixxxdj:mainfrom
Swarnadip-Kar:fix-10209-no-directories-message

Conversation

@Swarnadip-Kar

Copy link
Copy Markdown
Contributor

Fixes #10209

Problem

Previously, when users clicked "Rescan Library" with no music folders configured, nothing happened. The scan would silently complete instantly without any feedback, leaving users confused about whether the feature was working.

Solution

This PR adds a helpful dialog that appears when users try to rescan with no folders configured. The dialog clearly explains:

  • No music directories are currently configured
  • Users should add directories in the library preferences

Screenshot

After this fix:

Screenshot

The dialog now provides clear feedback and guidance to users.

Implementation

  • Added noDirectoriesConfigured boolean flag to LibraryScanResultSummary struct
  • Set the flag in LibraryScanner::slotStartScan() when no directories are found
  • Modified MixxxMainWindow::slotLibraryScanSummaryDlg() to display a custom message when the flag is set
  • Used explicit flag instead of sentinel values for clarity.

Testing

Tested on macOS by:

  1. Removing all library folders in Preferences → Library
  2. Clicking Library → Rescan Library
  3. Verifying the new dialog appears with the helpful message
  4. Adding folders back and confirming normal scan behavior still works

Feedback welcome - this is my first contribution to Mixxx and I'm eager to learn!

@ronso0

ronso0 commented Feb 12, 2026

Copy link
Copy Markdown
Member

Welcome and thanks fo rthis PR!

Though, I think you overlooked the fact that the scanner is not only responsible for the selected directories and the tracks inside those, but also for checking the existence of "free" tracks. By that I mean tracks outside the dirs that have been added to the library implicitly by loading them to a player, eg. DnD from file browser. I think that also applies to played tracks from external features like Traktor and Rekordbox, but I'm not sure about that.

So the current "no dirs" early return is wrong. I think we should remove that throw that message (or different messages) only when trackLocations(m_trackDao.getAllTrackLocations()) is empty.

@Swarnadip-Kar

Copy link
Copy Markdown
Contributor Author

Thank you for the feedback. You're correct about the free tracks - I overlooked that case in my initial implementation.

Changes

I've updated the code to address this:

  • Removed the early return when m_libraryRootDirs.isEmpty()
  • The scan now runs to completion regardless of configured directories
  • The "no directories configured" message is displayed only when both conditions are met:
    • No directories are configured (noDirectoriesConfigured == true)
    • The library is empty (tracksTotal == 0)

This ensures tracks added via drag-and-drop or external features (Traktor, Rekordbox) are properly handled.

Testing

I tested both scenarios:

No directories configured, empty library

No free Tracks found and No Library Configured

The dialog displays the "no directories configured" message.

No directories configured, one free track present

Blank Library But Free Tracks Found

The dialog shows the standard summary ("1 track in total") without the no-directories message.

Please let me know if this addresses your concern.

@ronso0

ronso0 commented Feb 12, 2026

Copy link
Copy Markdown
Member

Please, don't move the conversation to commit messages (are you using AI for coding and/or responding??).
Also, you don't need to follow reviewer requests blindly. Instead, let's discuss pros/cons etc. here first.
Thank you!

@Swarnadip-Kar

Copy link
Copy Markdown
Contributor Author

Sorry About That. I should have discussed here first.

About AI - I wrote this PR msg in Code with AI for formatting and spellings.

Right Now - the only bug I see is that the user gets no response when he scans Library with no free tracks and library setup

I was thinking about letting the scan run and later check if no tracks are found also with no directories to scan - then we can probably be certain about showing a Response in the UI.

Comment thread src/library/scanner/libraryscanner.cpp Outdated
@Swarnadip-Kar

Swarnadip-Kar commented Feb 18, 2026

Copy link
Copy Markdown
Contributor Author

I’ve updated LibraryScanner::slotStartScan() to check both m_libraryRootDirs and trackLocations before early return, and emit a LibraryScanResultSummary with noDirectoriesConfigured = true when both are empty. MixxxMainWindow::slotLibraryScanSummaryDlg() now shows the no music directories configured dialog in that case. Could you please take another look when you have time, @ronso0?

@ronso0 ronso0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks good already, left some commenst.

Comment thread src/library/scanner/libraryscanner.cpp Outdated
Comment thread src/library/scanner/libraryscanner.cpp Outdated
Comment thread src/library/scanner/libraryscanner.cpp
Comment thread src/library/scanner/libraryscanner.cpp Outdated
result.autoscan = m_manualScan;
result.noDirectoriesConfigured = true;

emit scanSummary(result);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to set the scanner state first, then emit the signal

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed the order — changeScannerState(IDLE) now comes before emit scanSummary(result).

Comment thread src/library/library_decl.h Outdated
int numNewMissingTracks;
int numRediscoveredTracks;
int tracksTotal;
bool noDirectoriesConfigured = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above (do we need this?)
and if we want to have it false by default we should rather add a default constructor for this struct, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, added a default constructor to LibraryScanResultSummary that zero-initializes all fields. Removed the in-class initializer.

@Swarnadip-Kar

Copy link
Copy Markdown
Contributor Author

All review comments addressed:

  • Updated comment to "independently added tracks"
  • Simplified the condition comment to a single line
  • Kept noDirectoriesConfigured as an explicit flag (avoids false positives when dirs are configured but empty)
  • Fixed state order: changeScannerState(IDLE) now called before emit scanSummary(result)
  • Added default constructor to LibraryScanResultSummary with zero-initialized fields, removed in-class initializer

Thanks for the thorough review, @ronso0!

@Swarnadip-Kar
Swarnadip-Kar requested a review from ronso0 February 25, 2026 06:02
@ronso0

ronso0 commented Feb 25, 2026

Copy link
Copy Markdown
Member

Btw merging the base branch is usually only required if conflicts emerged, or when we need to pull urgent bugfixes that affect the feature that is being worked on.
The reason, or rather my reason, to avoid unneeded base merges is that in small bugfix/features PRs like this one we may want to squash small fixups just before merging the PR. In such cases the Compare view that's shown in the Conversation timeline is really helpful for both reviewers and contributors for verifying that no undesired changes slipped in. With base merges however these views may be quite large and undesired changes are hard(er) to spot.
-- doesn't matter here that much, but please keep it in mind. Thanks!

Comment thread src/mixxxmainwindow.cpp Outdated
@Swarnadip-Kar

Copy link
Copy Markdown
Contributor Author

Btw merging the base branch is usually only required if conflicts emerged, or when we need to pull urgent bugfixes that affect the feature that is being worked on. The reason, or rather my reason, to avoid unneeded base merges is that in small bugfix/features PRs like this one we may want to squash small fixups just before merging the PR. In such cases the Compare view that's shown in the Conversation timeline is really helpful for both reviewers and contributors for verifying that no undesired changes slipped in. With base merges however these views may be quite large and undesired changes are hard(er) to spot. -- doesn't matter here that much, but please keep it in mind. Thanks!

Understood, thanks for explaining. I merged base assuming it was required to keep the branch up to date — I'll avoid unnecessary base merges going forward and only rebase when there are actual conflicts.

@Swarnadip-Kar
Swarnadip-Kar requested a review from ronso0 February 25, 2026 16:36

@ronso0 ronso0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, great! LGTM and works as expected.

Please squash the commits and rebase onto the parent of the initial commit.
If you've never done that, this should work:
git rebase -i 5f07c48^1

  • remove all merge commits in the editor, only your commits shoudl remain
  • for your first commit replace pick with r (reword message)
  • for the others replace pick with f (fixup) for all of your commits
  • confirm, then edit the commit message. Something like this would suffice IMO (taken from your first commit):
    Show message when rescanning with no library folders or tracks
    
    When users try to rescan the library with no folders configured,
    show a helpful message guiding them to add folders instead of
    silently doing nothing.
    
  • confirm and proceed with squashing
  • force-push

Then hopefully the compare view wil be empty (thumbs pressed ; )

@Swarnadip-Kar
Swarnadip-Kar force-pushed the fix-10209-no-directories-message branch 2 times, most recently from 02d0e04 to 1fb4bb4 Compare February 26, 2026 05:07
@Swarnadip-Kar

Copy link
Copy Markdown
Contributor Author

Done, squashed and force-pushed to a single commit on top of upstream/main.
Quick note on what happened behind the scenes — I had accidentally done two base merges earlier which mixed upstream commits into my branch. To clean it up I had to reset my branch to upstream/main and cherry-pick my 5 commits back on top one by one. (which is why the hashes look different from the originals). Also used HEAD~5 instead of 5f07c48^1 as you suggested, since the original hash no longer existed after the cherry-pick — but the result is the same. Sorry for the mess, learned a lot about keeping branches clean from this!

@Swarnadip-Kar
Swarnadip-Kar requested a review from ronso0 February 26, 2026 05:10
@Swarnadip-Kar

Copy link
Copy Markdown
Contributor Author

Hi @ronso0, just a gentle ping — I've addressed all the feedback on both this PR and #16025 (BPM lock toggle). Let me know if there's anything else to fix!

Comment thread src/mixxxmainwindow.cpp Outdated
// reassign summary to avoid showing "Scan took <Empty String>"
// which is not relevant in this case - no scan was actually
// performed
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the more often we look at code, the better it gets over time : )
Just an idea to make this if/else flow a bit cleaner, and avoid the double re-assignment of summary:

  • move the QMessageBox instantiation up, below the if (result.autoscan && ... block
  • then comes the current if (result.noDirectoriesConfigured) {, plus
     pMsg->setText(summary);
     pMsg->show();
     return;
    
  • then continue with the other if/else

What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, agreed this is cleaner. Moved the QMessageBox instantiation up and made noDirectoriesConfigured an early return — the summary string is now only built when a scan actually ran, so the workaround comment is gone too. Updated.

@Swarnadip-Kar
Swarnadip-Kar requested a review from ronso0 March 3, 2026 14:29

@ronso0 ronso0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, LGTM and works nicely!
Thanks for your patience.

@ronso0

ronso0 commented Mar 4, 2026

Copy link
Copy Markdown
Member

Please squash the 2nd commit into the1st one (leave the commit message as is), then we can finally merge.

When users try to rescan the library with no folders configured,
show a helpful message guiding them to add folders instead of
silently doing nothing.
@Swarnadip-Kar
Swarnadip-Kar force-pushed the fix-10209-no-directories-message branch from d5a781e to 92010de Compare March 4, 2026 10:05
@Swarnadip-Kar

Copy link
Copy Markdown
Contributor Author

Please squash the 2nd commit into the1st one (leave the commit message as is), then we can finally merge.

Done, squashed and force-pushed.

@ronso0
ronso0 enabled auto-merge March 4, 2026 10:16
@ronso0

ronso0 commented Mar 4, 2026

Copy link
Copy Markdown
Member

Thank you! waiting for CI..

@ronso0
ronso0 merged commit 1844f0d into mixxxdj:main Mar 4, 2026
15 checks passed
@Swarnadip-Kar
Swarnadip-Kar deleted the fix-10209-no-directories-message branch March 28, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable Rescan library if no library has been configured

2 participants