CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
operation_model_manager.cpp
Go to the documentation of this file.
1
15
16#include <spdlog/spdlog.h>
17
19
21{
22 spdlog::debug("OperationModelManager: Constructed.");
23}
24
26{
27 spdlog::info("OperationModelManager::createBasicAdjustmentModels: Creating basic adjustment models...");
28
29 // Create instances of basic adjustment models
30 if (!createAndAddModel<UI::Models::Operations::BrightnessModel>() ||
31 !createAndAddModel<UI::Models::Operations::ContrastModel>() ||
32 !createAndAddModel<UI::Models::Operations::HighlightsModel>() ||
33 !createAndAddModel<UI::Models::Operations::ShadowsModel>() ||
34 !createAndAddModel<UI::Models::Operations::WhitesModel>() ||
35 !createAndAddModel<UI::Models::Operations::BlacksModel>())
36 {
37 spdlog::error("OperationModelManager::createBasicAdjustmentModels: Failed to create one or more basic adjustment models.");
38 return false;
39 }
40
41 spdlog::info("OperationModelManager::createBasicAdjustmentModels: Successfully created {} basic adjustment models.", m_operation_models.size());
42 return true;
43}
44
46{
47 if (!context) {
48 spdlog::error("OperationModelManager::registerModelsToQml: QML Context is null!");
49 return false;
50 }
51
52 spdlog::info("OperationModelManager::registerModelsToQml: Registering {} models to QML...", m_operation_models.size());
53
54 for (const auto& model : m_operation_models) {
55 if (!model) {
56 spdlog::warn("OperationModelManager::registerModelsToQml: Found null model in list, skipping.");
57 continue;
58 }
59
60 QString qml_name = model->name().toLower() + "Control";
61 context->setContextProperty(qml_name, model.get());
62 spdlog::debug("OperationModelManager::registerModelsToQml: Registered model '{}' as '{}' in QML.", model->name().toStdString(), qml_name.toStdString());
63 }
64
65 spdlog::info("OperationModelManager::registerModelsToQml: Successfully registered {} models to QML.", m_operation_models.size());
66 return true;
67}
68
69} // namespace CaptureMoment::UI::Models::Manager
Blacks operation model inheriting from BaseAdjustmentModel.
Brightness operation model inheriting from BaseAdjustmentModel.
bool registerModelsToQml(QQmlContext *context)
Registers the created operation models to the QML context. Makes the models available under their gen...
bool createBasicAdjustmentModels()
Creates instances of basic adjustment operation models. This method typically creates models like Bri...
OperationModelManager()
Constructs an OperationModelManager. Initializes the manager without requiring external dependencies ...
Contrast operation model inheriting from BaseAdjustmentModel.
Highlights operation model inheriting from BaseAdjustmentModel.
Shadows operation model inheriting from BaseAdjustmentModel.
Whites operation model inheriting from BaseAdjustmentModel.
CaptureMoment — footer