From 842cdbe6ca66a6151f8da4cc82b9aacab20dbd27 Mon Sep 17 00:00:00 2001 From: Maciej Janicki Date: Fri, 5 Nov 2021 13:10:20 +0100 Subject: [PATCH] [BH-1125] Add file indexer Add file indexer --- .../ApplicationMusicPlayer.cpp | 14 +++-- .../application-music-player/CMakeLists.txt | 5 -- .../ApplicationMusicPlayer.hpp | 3 +- .../models/SongsModel.cpp | 14 ++--- .../models/SongsModel.hpp | 10 +-- .../presenters/SongsPresenter.cpp | 31 +++++----- .../presenters/SongsPresenter.hpp | 30 ++++----- .../tests/MockSongsRepository.hpp | 6 +- .../tests/MockTagsFetcher.hpp | 6 +- .../tests/unittest_songsmodel.cpp | 6 +- module-apps/apps-common/CMakeLists.txt | 6 ++ .../models/SongContext.cpp | 4 +- .../models/SongContext.hpp | 6 +- .../models/SongsModelInterface.hpp | 35 +++++------ .../models/SongsRepository.cpp | 14 +++-- .../models/SongsRepository.hpp | 22 ++++--- module-db/Interface/MultimediaFilesRecord.cpp | 14 ++++- module-db/Interface/MultimediaFilesRecord.hpp | 3 + module-db/Tables/MultimediaFilesTable.cpp | 9 +++ module-db/Tables/MultimediaFilesTable.hpp | 1 + .../QueryMultimediaFilesGetLimited.cpp | 9 +++ .../QueryMultimediaFilesGetLimited.hpp | 11 ++++ .../tests/MultimediaFilesTable_tests.cpp | 24 +++++++ module-services/CMakeLists.txt | 1 + .../service-fileindexer/CMakeLists.txt | 0 .../service-fileindexer/Common.hpp | 0 .../service-fileindexer/InotifyHandler.cpp | 0 .../ServiceFileIndexer.cpp | 5 +- .../service-fileindexer/StartupIndexer.cpp | 6 +- .../include/service-fileindexer/Constants.hpp | 0 .../service-fileindexer/InotifyHandler.hpp | 0 .../ServiceFileIndexer.hpp | 2 +- .../service-fileindexer/StartupIndexer.hpp | 5 +- products/BellHybrid/BellHybridMain.cpp | 7 +++ products/BellHybrid/CMakeLists.txt | 1 + .../ApplicationBellBackgroundSounds.cpp | 14 ++++- .../CMakeLists.txt | 2 - .../data/BGSoundsAudioData.hpp | 9 +-- .../ApplicationBellBackgroundSounds.hpp | 1 + .../models/BGSoundsRepository.cpp | 62 +++++++++---------- .../models/BGSoundsRepository.hpp | 24 ++++--- .../presenter/BGSoundsMainWindowPresenter.cpp | 28 ++++++--- .../presenter/BGSoundsMainWindowPresenter.hpp | 12 ++-- .../presenter/BGSoundsProgressPresenter.cpp | 6 +- .../presenter/BGSoundsProgressPresenter.hpp | 19 +++--- .../windows/BGSoundsMainWindow.cpp | 16 ++--- .../windows/BGSoundsMainWindow.hpp | 4 +- .../windows/BGSoundsProgressWindow.cpp | 4 +- products/BellHybrid/services/db/ServiceDB.cpp | 11 +++- .../services/db/include/db/ServiceDB.hpp | 8 +++ products/PurePhone/PurePhoneMain.cpp | 4 +- products/PurePhone/services/CMakeLists.txt | 1 - 52 files changed, 341 insertions(+), 194 deletions(-) rename module-apps/{application-music-player => apps-common}/models/SongContext.cpp (92%) rename module-apps/{application-music-player => apps-common}/models/SongContext.hpp (83%) rename module-apps/{application-music-player => apps-common}/models/SongsModelInterface.hpp (68%) rename module-apps/{application-music-player => apps-common}/models/SongsRepository.cpp (96%) rename module-apps/{application-music-player => apps-common}/models/SongsRepository.hpp (92%) rename {products/PurePhone/services => module-services}/service-fileindexer/CMakeLists.txt (100%) rename {products/PurePhone/services => module-services}/service-fileindexer/Common.hpp (100%) rename {products/PurePhone/services => module-services}/service-fileindexer/InotifyHandler.cpp (100%) rename {products/PurePhone/services => module-services}/service-fileindexer/ServiceFileIndexer.cpp (88%) rename {products/PurePhone/services => module-services}/service-fileindexer/StartupIndexer.cpp (97%) rename {products/PurePhone/services => module-services}/service-fileindexer/include/service-fileindexer/Constants.hpp (100%) rename {products/PurePhone/services => module-services}/service-fileindexer/include/service-fileindexer/InotifyHandler.hpp (100%) rename {products/PurePhone/services => module-services}/service-fileindexer/include/service-fileindexer/ServiceFileIndexer.hpp (94%) rename {products/PurePhone/services => module-services}/service-fileindexer/include/service-fileindexer/StartupIndexer.hpp (90%) diff --git a/module-apps/application-music-player/ApplicationMusicPlayer.cpp b/module-apps/application-music-player/ApplicationMusicPlayer.cpp index a0902b8615aab768b0f9dc54a1af82787d44d754..0b1adfadd1ebff1c86964f3b33c73d6855a9bd48 100644 --- a/module-apps/application-music-player/ApplicationMusicPlayer.cpp +++ b/module-apps/application-music-player/ApplicationMusicPlayer.cpp @@ -27,7 +27,7 @@ namespace app class MusicPlayerPriv { public: - std::shared_ptr songsModel; + std::shared_ptr songsModel; std::shared_ptr songsPresenter; }; } // namespace music_player::internal @@ -46,15 +46,19 @@ namespace app bus.channels.push_back(sys::BusChannel::ServiceAudioNotifications); - auto tagsFetcher = std::make_unique(this); - auto songsRepository = std::make_unique(this, std::move(tagsFetcher)); - priv->songsModel = std::make_unique(this, std::move(songsRepository)); + auto tagsFetcher = std::make_unique(this); + + const auto musicPlayerFilesPath = purefs::createPath(purefs::dir::getUserDiskPath(), "music").string(); + auto songsRepository = + std::make_unique(this, std::move(tagsFetcher), musicPlayerFilesPath); + + priv->songsModel = std::make_unique(this, std::move(songsRepository)); auto audioOperations = std::make_unique(this); priv->songsPresenter = std::make_unique(this, priv->songsModel, std::move(audioOperations)); // callback used when playing state is changed - using SongState = app::music_player::SongState; + using SongState = app::music::SongState; std::function autolockCallback = [this](SongState isPlaying) { if (isPlaying == SongState::Playing) { LOG_DEBUG("Preventing autolock while playing track."); diff --git a/module-apps/application-music-player/CMakeLists.txt b/module-apps/application-music-player/CMakeLists.txt index ed7438f8634d24c408efb71a30a784f7df161741..ddc0e7deca88eeb31989e27a313bb7338707c65b 100644 --- a/module-apps/application-music-player/CMakeLists.txt +++ b/module-apps/application-music-player/CMakeLists.txt @@ -14,9 +14,7 @@ target_sources(application-music-player PRIVATE ApplicationMusicPlayer.cpp AudioNotificationsHandler.cpp - models/SongContext.cpp models/SongsModel.cpp - models/SongsRepository.cpp presenters/SongsPresenter.cpp widgets/SongItem.cpp windows/MusicPlayerMainWindow.cpp @@ -24,10 +22,7 @@ target_sources(application-music-player PRIVATE AudioNotificationsHandler.hpp data/MusicPlayerStyle.hpp - models/SongContext.hpp models/SongsModel.hpp - models/SongsRepository.hpp - models/SongsModelInterface.hpp presenters/SongsPresenter.hpp widgets/SongItem.hpp windows/MusicPlayerMainWindow.cpp diff --git a/module-apps/application-music-player/include/application-music-player/ApplicationMusicPlayer.hpp b/module-apps/application-music-player/include/application-music-player/ApplicationMusicPlayer.hpp index 64642729473b3fbae0b183f257ae83540e6fde1c..1d97fa710c80ce6572cf9016c0a7b6c5da0495af 100644 --- a/module-apps/application-music-player/include/application-music-player/ApplicationMusicPlayer.hpp +++ b/module-apps/application-music-player/include/application-music-player/ApplicationMusicPlayer.hpp @@ -5,6 +5,7 @@ #include #include