Commit 674d0ff4 authored by Matthieu Gallien's avatar Matthieu Gallien

should fix the infinite loop when config changed

parent 62e0513e
......@@ -217,17 +217,25 @@ bool MusicListenersManager::androidIndexerAvailable() const
return d->mAndroidIndexerAvailable;
}
auto MusicListenersManager::initializeRootPath()
{
auto initialRootPath = QStringList{};
auto systemMusicPaths = QStandardPaths::standardLocations(QStandardPaths::MusicLocation);
for (const auto &musicPath : qAsConst(systemMusicPaths)) {
initialRootPath.push_back(musicPath);
}
Elisa::ElisaConfiguration::setRootPath(initialRootPath);
Elisa::ElisaConfiguration::self()->save();
return initialRootPath;
}
void MusicListenersManager::databaseReady()
{
auto initialRootPath = Elisa::ElisaConfiguration::rootPath();
if (initialRootPath.isEmpty()) {
auto systemMusicPaths = QStandardPaths::standardLocations(QStandardPaths::MusicLocation);
for (const auto &musicPath : qAsConst(systemMusicPaths)) {
initialRootPath.push_back(musicPath);
}
Elisa::ElisaConfiguration::setRootPath(initialRootPath);
Elisa::ElisaConfiguration::self()->save();
initializeRootPath();
}
d->mConfigFileWatcher.addPath(Elisa::ElisaConfiguration::self()->config()->name());
......@@ -337,8 +345,10 @@ void MusicListenersManager::configChanged()
}
allRootPaths.push_back(directoryPath);
}
currentConfiguration->setRootPath(allRootPaths);
currentConfiguration->save();
}
if (allRootPaths.isEmpty()) {
allRootPaths = initializeRootPath();
}
d->mFileListener.setAllRootPaths(allRootPaths);
......
......@@ -183,6 +183,8 @@ private:
void startBalooIndexing();
auto initializeRootPath();
std::unique_ptr<MusicListenersManagerPrivate> d;
void createTracksListener();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment