Skip to content

Commit

Permalink
dev: Rename ImportFoldersLogic to ImportFoldersService.
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmin42 committed Sep 24, 2024
1 parent 1a5b3e3 commit d2e2f03
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions PB/.clang-uml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ diagrams:
type: class
generate_packages: true
glob:
- src/ImportFoldersLogic.cpp
- src/ImportFoldersService.cpp
include:
namespaces:
- PB
Expand Down Expand Up @@ -153,12 +153,12 @@ diagrams:
top_level_class_diagram:
type: class
glob:
- src/ImportFoldersLogic.cpp
- src/ImportFoldersService.cpp
include:
context:
- match:
radius: 1
pattern: PB::ImportFoldersLogic
pattern: PB::ImportFoldersService
access:
- public
exclude:
Expand Down
4 changes: 2 additions & 2 deletions PB/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ add_library(${PBLIB_LIBRARY_NAME} STATIC
include/pb/ImportImageTask.h
include/pb/ImageMonitor.h
include/pb/ImageProcessingData.h
include/pb/ImportFoldersLogic.h
include/pb/ImportFoldersService.h
include/pb/ImageToPaperService.h
include/pb/ImageToPaperTask.h
include/pb/image/ImageFactory.h
Expand Down Expand Up @@ -173,7 +173,7 @@ add_library(${PBLIB_LIBRARY_NAME} STATIC
src/ImageToPaperService.cpp
src/ImageToPaperTask.cpp
src/ImportImageTask.cpp
src/ImportFoldersLogic.cpp
src/ImportFoldersService.cpp
src/Jpg.cpp
src/LutService.cpp
src/LutIconsPreprocessingJob.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@

namespace PB {

class ImportFoldersLogicListener {
class ImportFoldersServiceListener {
public:
virtual ~ImportFoldersLogicListener() = default;
virtual ~ImportFoldersServiceListener() = default;

virtual void onMappingFinished(Path root, std::vector<Path> newFolders) = 0;
virtual void onImageProcessed(Path key, Path root,
ImageResources imageResources) = 0;
};

class ImportFoldersLogic final : public PicturesSearchConfigListener,
class ImportFoldersService final : public PicturesSearchConfigListener,
public ThumbnailsJobListener {
public:
~ImportFoldersLogic() = default;
~ImportFoldersService() = default;

void configureListener(ImportFoldersLogicListener *listener)
void configureListener(ImportFoldersServiceListener *listener)
{
mListener = listener;
}
Expand Down Expand Up @@ -64,7 +64,7 @@ class ImportFoldersLogic final : public PicturesSearchConfigListener,
std::tuple<Path, Path, Path> thumbnailPaths) override;

private:
ImportFoldersLogicListener *mListener = nullptr;
ImportFoldersServiceListener *mListener = nullptr;
PBDev::ThreadScheduler *mScheduler = nullptr;
std::shared_ptr<TaskCruncher> mTaskCruncher = nullptr;
std::shared_ptr<PlatformInfo> mPlatformInfo = nullptr;
Expand Down
6 changes: 3 additions & 3 deletions PB/include/pb/PhotoBook.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <pb/DirectoryInspectionService.h>
#include <pb/DurableHashService.h>
#include <pb/ImageToPaperService.h>
#include <pb/ImportFoldersLogic.h>
#include <pb/ImportFoldersService.h>
#include <pb/LutService.h>
#include <pb/OGLEngine.h>
#include <pb/PhotobookListener.h>
Expand All @@ -32,7 +32,7 @@

namespace PB {

class Photobook final : public ImportFoldersLogicListener,
class Photobook final : public ImportFoldersServiceListener,
public PBDev::ThreadScheduler,
public ProgressManagerListener,
public ExportListener,
Expand Down Expand Up @@ -131,7 +131,7 @@ class Photobook final : public ImportFoldersLogicListener,
std::shared_ptr<ProjectManagementSystem> mProjectManagementSystem = nullptr;
std::shared_ptr<ImageFactory> mImageFactory = nullptr;

std::shared_ptr<ImportFoldersLogic> mImportLogic = nullptr;
std::shared_ptr<ImportFoldersService> mImportLogic = nullptr;
CommandStack mCommandStack;
bool mMarkProjectForDeletion = false;
ExportLogic mExportLogic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <pb/ImportFoldersLogic.h>
#include <pb/ImportFoldersService.h>

#include <pb/util/FileInfo.h>

namespace PB {

std::optional<PBDev::Error> ImportFoldersLogic::addImportFolder(Path path)
std::optional<PBDev::Error> ImportFoldersService::addImportFolder(Path path)
{
auto errorOrPath = PBDev::FileInfo::validInputRootPath(path);
if (std::holds_alternative<PBDev::Error>(errorOrPath)) {
Expand All @@ -30,7 +30,7 @@ std::optional<PBDev::Error> ImportFoldersLogic::addImportFolder(Path path)
return std::nullopt;
}

void ImportFoldersLogic::startThumbnailsCreation(
void ImportFoldersService::startThumbnailsCreation(
PBDev::ThumbnailsJobId jobId, std::vector<Path> searchResults)
{
mThumbnailsJobs.emplace(jobId, ThumbnailsJob(jobId, searchResults));
Expand All @@ -44,7 +44,7 @@ void ImportFoldersLogic::startThumbnailsCreation(
PBDev::ProgressJobName{"thumbnails"});
}

void ImportFoldersLogic::onPicturesSearchFinished(
void ImportFoldersService::onPicturesSearchFinished(
PBDev::ThumbnailsJobId jobId, Path root, std::vector<Path> searchResults)
{
mScheduler->post(
Expand All @@ -56,9 +56,9 @@ void ImportFoldersLogic::onPicturesSearchFinished(
});
}

void ImportFoldersLogic::onPicturesSearchAborted(Path root) {}
void ImportFoldersService::onPicturesSearchAborted(Path root) {}

void ImportFoldersLogic::imageProcessed(
void ImportFoldersService::imageProcessed(
PBDev::ThumbnailsJobId jobId, std::tuple<Path, Path, Path> thumbnailPaths)
{
auto root = mRootPaths.at(jobId);
Expand Down
8 changes: 4 additions & 4 deletions PB/src/PhotoBook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ Photobook::Photobook(Path localStatePath, Path installationPath,

initLogger();

auto importFoldersLogicListener =
dynamic_cast<ImportFoldersLogicListener *>(this);
PBDev::basicAssert(importFoldersLogicListener != nullptr);
auto importFoldersServiceListener =
dynamic_cast<ImportFoldersServiceListener *>(this);
PBDev::basicAssert(importFoldersServiceListener != nullptr);

auto threadScheduler = dynamic_cast<PBDev::ThreadScheduler *>(this);
PBDev::basicAssert(threadScheduler != nullptr);
Expand Down Expand Up @@ -90,7 +90,7 @@ Photobook::Photobook(Path localStatePath, Path installationPath,
mImportLogic->configureTaskCruncher(mTaskCruncher);
mImportLogic->configurePlatformInfo(mPlatformInfo);
mImportLogic->configureProjectManagementSystem(mProjectManagementSystem);
mImportLogic->configureListener(importFoldersLogicListener);
mImportLogic->configureListener(importFoldersServiceListener);

mExportLogic.setTaskCruncher(mTaskCruncher);
mCollageTemplateManager->setTaskCruncher(mTaskCruncher);
Expand Down

0 comments on commit d2e2f03

Please sign in to comment.