Skip to content

Commit 02d0e04

Browse files
committed
Address review comments for #10209
- Rephrase comment: 'free tracks' -> 'independently added tracks' - Simplify block comment in early-return path - Fix order: changeScannerState(IDLE) before emit scanSummary() - Add default constructor to LibraryScanResultSummary instead of using in-class initializer for noDirectoriesConfigured
1 parent be259ce commit 02d0e04

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

src/library/library_decl.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ enum class FocusWidget {
2121
};
2222

2323
struct LibraryScanResultSummary {
24+
LibraryScanResultSummary()
25+
: autoscan(false),
26+
numNewTracks(0),
27+
numMovedTracks(0),
28+
numMissingTracks(0),
29+
numNewMissingTracks(0),
30+
numRediscoveredTracks(0),
31+
tracksTotal(0),
32+
noDirectoriesConfigured(false) {
33+
}
34+
2435
QString durationString;
2536
bool autoscan;
2637
int numNewTracks;
@@ -29,5 +40,5 @@ struct LibraryScanResultSummary {
2940
int numNewMissingTracks;
3041
int numRediscoveredTracks;
3142
int tracksTotal;
32-
bool noDirectoriesConfigured = false;
43+
bool noDirectoriesConfigured;
3344
};

src/library/scanner/libraryscanner.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,26 +192,17 @@ void LibraryScanner::slotStartScan() {
192192

193193
// Recursively scan each directory in the directories table.
194194
m_libraryRootDirs = m_directoryDao.loadAllDirectories();
195-
// If there are no directories then we still have to scan free tracks.
195+
// If there are no directories then we still have to scan independently added tracks.
196196
QSet<QString> trackLocations = m_trackDao.getAllTrackLocations();
197197

198198
if (m_libraryRootDirs.isEmpty() && trackLocations.isEmpty()) {
199-
// Show the "no dirs" message if m_libraryRootDirs and trackLocations
200-
// are both empty. m_libraryRootDirs includes missing tracks, so if that
201-
// is empty, there's indeed nothing to do.
199+
// Nothing to do. noDirectoriesConfigured == true will show the "no dirs" message.
202200
LibraryScanResultSummary result;
203-
result.durationString = ""; // Explicitly kept empty as no scan was performed.
204-
result.numNewTracks = 0;
205-
result.numMovedTracks = m_numRelocatedTracks;
206-
result.numNewMissingTracks = 0;
207-
result.numMissingTracks = 0;
208-
result.numRediscoveredTracks = 0;
209-
result.tracksTotal = 0;
210201
result.autoscan = m_manualScan;
211202
result.noDirectoriesConfigured = true;
212203

213-
emit scanSummary(result);
214204
changeScannerState(IDLE);
205+
emit scanSummary(result);
215206
return;
216207
}
217208
changeScannerState(SCANNING);

0 commit comments

Comments
 (0)