CollectionWatcher: Monitoring always on for devices

This commit is contained in:
Jonas Kvinge 2024-10-18 19:58:04 +02:00
parent 7b2d8ac1a2
commit 34e2e01992
1 changed files with 15 additions and 7 deletions

View File

@ -197,8 +197,14 @@ void CollectionWatcher::ReloadSettings() {
const bool was_monitoring_before = monitor_; const bool was_monitoring_before = monitor_;
Settings s; Settings s;
s.beginGroup(CollectionSettingsPage::kSettingsGroup); s.beginGroup(CollectionSettingsPage::kSettingsGroup);
if (source_ == Song::Source::Collection) {
scan_on_startup_ = s.value("startup_scan", true).toBool(); scan_on_startup_ = s.value("startup_scan", true).toBool();
monitor_ = s.value("monitor", true).toBool(); monitor_ = s.value("monitor", true).toBool();
}
else {
scan_on_startup_ = true;
monitor_ = true;
}
const QStringList filters = s.value("cover_art_patterns", QStringList() << QStringLiteral("front") << QStringLiteral("cover")).toStringList(); const QStringList filters = s.value("cover_art_patterns", QStringList() << QStringLiteral("front") << QStringLiteral("cover")).toStringList();
if (source_ == Song::Source::Collection) { if (source_ == Song::Source::Collection) {
song_tracking_ = s.value("song_tracking", false).toBool(); song_tracking_ = s.value("song_tracking", false).toBool();
@ -234,12 +240,14 @@ void CollectionWatcher::ReloadSettings() {
} }
} }
if (source_ == Song::Source::Collection) {
if (monitor_ && scan_on_startup_ && mark_songs_unavailable_ && !periodic_scan_timer_->isActive()) { if (monitor_ && scan_on_startup_ && mark_songs_unavailable_ && !periodic_scan_timer_->isActive()) {
periodic_scan_timer_->start(); periodic_scan_timer_->start();
} }
else if ((!monitor_ || !scan_on_startup_ || !mark_songs_unavailable_) && periodic_scan_timer_->isActive()) { else if ((!monitor_ || !scan_on_startup_ || !mark_songs_unavailable_) && periodic_scan_timer_->isActive()) {
periodic_scan_timer_->stop(); periodic_scan_timer_->stop();
} }
}
} }