CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
brightness_model.cpp
Go to the documentation of this file.
1
9#include <spdlog/spdlog.h>
10
12
14 : BaseAdjustmentModel(parent)
15{
17 spdlog::debug("BrightnessModel: Created (inherits default value from BaseAdjustmentModel)");
18}
19
21{
23 descriptor.id = m_operation_id;
25 descriptor.name = "Brightness (" + std::to_string(static_cast<int>(m_params.value * 100)) + "%)";
26 descriptor.enabled = true;
27 descriptor.setParam<float>("value", m_params.value);
28 return descriptor;
29}
30
32{
33 spdlog::debug("BrightnessModel::reset: Resetting to default value ({})", Core::Operations::OperationRanges::getBrightnessDefaultValue());
35}
36
37// Handles successful operation completion from ImageControllerBase.
39{
40 spdlog::debug("BrightnessModel: Operation Completed successfully");
41 emit operationApplied();
42}
43
44// Handles operation failure from ImageControllerBase.
45void BrightnessModel::onOperationFailed(const QString& error)
46{
47 spdlog::error("BrightnessModel: Operation failed - {}", error.toStdString());
48 emit operationFailed(error);
49}
50
51} // namespace CaptureMoment::UI::Models::Operations
Brightness operation model inheriting from BaseAdjustmentModel.
Generic base class for operations with a single adjustable value (e.g., brightness,...
void setValue(float val)
Sets the adjustment value and triggers an update.
Domain::RelativeAdjustmentParams m_params
used for the value and activity state
void onOperationCompleted() override
Pure virtual slot to handle successful operation completion. Implementations in derived classes shoul...
Core::Operations::OperationDescriptor getDescriptor() const override
Creates and returns an OperationDescriptor representing the current state of this model....
void onOperationFailed(const QString &error) override
Pure virtual slot to handle operation failure. Implementations in derived classes should react to a f...
void operationApplied()
Signal emitted when an operation is applied successfully. Generic signal name, can be connected by UI...
void operationFailed(QString error)
Signal emitted when an operation fails. Generic signal name, can be connected by UI components or oth...
@ Brightness
Brightness adjustment (Additive). Adds a constant value to all pixels. Use sparingly as it can wash o...
A universal container for operation settings with unique identifier.
OperationType type
The operation type (e.g., Brightness, Contrast, Saturation). Used by the factory to create the approp...
void setParam(const std::string &key, const T &value)
Helper to set a parameter value.
uint64_t id
Unique identifier for this operation instance.
bool enabled
Whether this operation is currently active. Disabled operations are skipped during pipeline execution...
std::string name
Human-readable name for display purposes. May include parameter values, e.g., "Brightness (100%)".
static consteval float getBrightnessDefaultValue()
Gets the default value for the Brightness operation.
CaptureMoment — footer