Changeset View
Changeset View
Standalone View
Standalone View
src/musiclistenersmanager.cpp
Show All 21 Lines | |||||
22 | #if defined UPNPQT_FOUND && UPNPQT_FOUND | 22 | #if defined UPNPQT_FOUND && UPNPQT_FOUND | ||
23 | #include "upnp/upnplistener.h" | 23 | #include "upnp/upnplistener.h" | ||
24 | #endif | 24 | #endif | ||
25 | 25 | | |||
26 | #if defined KF5Baloo_FOUND && KF5Baloo_FOUND | 26 | #if defined KF5Baloo_FOUND && KF5Baloo_FOUND | ||
27 | #include "baloo/baloolistener.h" | 27 | #include "baloo/baloolistener.h" | ||
28 | #endif | 28 | #endif | ||
29 | 29 | | |||
30 | #if defined Qt5AndroidExtras_FOUND && Qt5AndroidExtras_FOUND | ||||
31 | #include "android/androidmusiclistener.h" | ||||
32 | #endif | ||||
33 | | ||||
30 | #include "databaseinterface.h" | 34 | #include "databaseinterface.h" | ||
31 | #include "mediaplaylist.h" | 35 | #include "mediaplaylist.h" | ||
32 | #include "file/filelistener.h" | 36 | #include "file/filelistener.h" | ||
33 | #include "file/localfilelisting.h" | 37 | #include "file/localfilelisting.h" | ||
34 | #include "trackslistener.h" | 38 | #include "trackslistener.h" | ||
35 | #include "notificationitem.h" | 39 | #include "notificationitem.h" | ||
36 | #include "elisaapplication.h" | 40 | #include "elisaapplication.h" | ||
37 | #include "elisa_settings.h" | 41 | #include "elisa_settings.h" | ||
Show All 28 Lines | |||||
66 | #endif | 70 | #endif | ||
67 | 71 | | |||
68 | #if defined KF5Baloo_FOUND && KF5Baloo_FOUND | 72 | #if defined KF5Baloo_FOUND && KF5Baloo_FOUND | ||
69 | std::unique_ptr<BalooListener> mBalooListener; | 73 | std::unique_ptr<BalooListener> mBalooListener; | ||
70 | #endif | 74 | #endif | ||
71 | 75 | | |||
72 | std::list<std::unique_ptr<FileListener>> mFileListener; | 76 | std::list<std::unique_ptr<FileListener>> mFileListener; | ||
73 | 77 | | |||
78 | #if defined Qt5AndroidExtras_FOUND && Qt5AndroidExtras_FOUND | ||||
79 | std::unique_ptr<AndroidMusicListener> mAndroidMusicListener; | ||||
80 | #endif | ||||
81 | | ||||
74 | DatabaseInterface mDatabaseInterface; | 82 | DatabaseInterface mDatabaseInterface; | ||
75 | 83 | | |||
76 | std::unique_ptr<TracksListener> mTracksListener; | 84 | std::unique_ptr<TracksListener> mTracksListener; | ||
77 | 85 | | |||
78 | QFileSystemWatcher mConfigFileWatcher; | 86 | QFileSystemWatcher mConfigFileWatcher; | ||
79 | 87 | | |||
80 | ElisaApplication *mElisaApplication = nullptr; | 88 | ElisaApplication *mElisaApplication = nullptr; | ||
81 | 89 | | |||
▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Line(s) | |||||
266 | #endif | 274 | #endif | ||
267 | #if defined UPNPQT_FOUND && UPNPQT_FOUND | 275 | #if defined UPNPQT_FOUND && UPNPQT_FOUND | ||
268 | d->mUpnpListener.setDatabaseInterface(&d->mDatabaseInterface); | 276 | d->mUpnpListener.setDatabaseInterface(&d->mDatabaseInterface); | ||
269 | d->mUpnpListener.moveToThread(&d->mDatabaseThread); | 277 | d->mUpnpListener.moveToThread(&d->mDatabaseThread); | ||
270 | connect(this, &MusicListenersManager::applicationIsTerminating, | 278 | connect(this, &MusicListenersManager::applicationIsTerminating, | ||
271 | &d->mUpnpListener, &UpnpListener::applicationAboutToQuit, Qt::DirectConnection); | 279 | &d->mUpnpListener, &UpnpListener::applicationAboutToQuit, Qt::DirectConnection); | ||
272 | #endif | 280 | #endif | ||
273 | 281 | | |||
282 | #if defined Qt5AndroidExtras_FOUND && Qt5AndroidExtras_FOUND | ||||
283 | if (!d->mAndroidMusicListener) { | ||||
284 | d->mAndroidMusicListener = std::make_unique<AndroidMusicListener>(); | ||||
285 | d->mAndroidMusicListener->moveToThread(&d->mListenerThread); | ||||
286 | d->mAndroidMusicListener->setDatabaseInterface(&d->mDatabaseInterface); | ||||
287 | connect(this, &MusicListenersManager::applicationIsTerminating, | ||||
288 | d->mAndroidMusicListener.get(), &AndroidMusicListener::applicationAboutToQuit, Qt::DirectConnection); | ||||
289 | connect(d->mAndroidMusicListener.get(), &AndroidMusicListener::indexingStarted, | ||||
290 | this, &MusicListenersManager::monitorStartingListeners); | ||||
291 | connect(d->mAndroidMusicListener.get(), &AndroidMusicListener::indexingFinished, | ||||
292 | this, &MusicListenersManager::monitorEndingListeners); | ||||
293 | connect(d->mAndroidMusicListener.get(), &AndroidMusicListener::clearDatabase, | ||||
294 | &d->mDatabaseInterface, &DatabaseInterface::removeAllTracksFromSource); | ||||
295 | connect(d->mAndroidMusicListener.get(), &AndroidMusicListener::newNotification, | ||||
296 | this, &MusicListenersManager::newNotification); | ||||
297 | connect(d->mAndroidMusicListener.get(), &AndroidMusicListener::closeNotification, | ||||
298 | this, &MusicListenersManager::closeNotification); | ||||
299 | } | ||||
300 | #endif | ||||
301 | | ||||
274 | if (currentConfiguration->elisaFilesIndexer()) | 302 | if (currentConfiguration->elisaFilesIndexer()) | ||
275 | { | 303 | { | ||
276 | const auto &allRootPaths = currentConfiguration->rootPath(); | 304 | const auto &allRootPaths = currentConfiguration->rootPath(); | ||
277 | for (auto itFileListener = d->mFileListener.begin(); itFileListener != d->mFileListener.end(); ) { | 305 | for (auto itFileListener = d->mFileListener.begin(); itFileListener != d->mFileListener.end(); ) { | ||
278 | const auto ¤tRootPath = (*itFileListener)->localFileIndexer().rootPath(); | 306 | const auto ¤tRootPath = (*itFileListener)->localFileIndexer().rootPath(); | ||
279 | auto itPath = std::find(allRootPaths.begin(), allRootPaths.end(), currentRootPath); | 307 | auto itPath = std::find(allRootPaths.begin(), allRootPaths.end(), currentRootPath); | ||
280 | 308 | | |||
281 | if (itPath == allRootPaths.end()) { | 309 | if (itPath == allRootPaths.end()) { | ||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |