CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
contrast_model.cpp
Go to the documentation of this file.
1
9#include <spdlog/spdlog.h>
10
12
14 : BaseAdjustmentModel(parent)
15{
17 spdlog::debug("ContrastModel: Created (inherits default value from BaseAdjustmentModel)");
18}
19
21{
23 descriptor.id = m_operation_id;
25 descriptor.name = "Contrast (" + 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("ContrastModel::reset: Resetting to default value ({})", Core::Operations::OperationRanges::getContrastDefaultValue());
35}
36
37// Handles successful operation completion from ImageControllerBase.
39{
40 spdlog::debug("ContrastModel: Operation Completed successfully");
41 emit operationApplied();
42}
43
44// Handles operation failure from ImageControllerBase.
45void ContrastModel::onOperationFailed(const QString& error)
46{
47 spdlog::error("ContrastModel: Operation failed - {}", error.toStdString());
48 emit operationFailed(error);
49}
50
51} // namespace CaptureMoment::UI::Models::Operations
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...
void onOperationFailed(const QString &error) override
Pure virtual slot to handle operation failure. Implementations in derived classes should react to a f...
Core::Operations::OperationDescriptor getDescriptor() const override
Creates and returns an OperationDescriptor representing the current state of this model....
void reset() override
Reset to default state.
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...
Contrast operation model inheriting from BaseAdjustmentModel.
@ Contrast
Contrast adjustment (Multiplicative around a midpoint). Expands or compresses the dynamic range aroun...
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 getContrastDefaultValue()
Gets the default value for the Contrast operation.
CaptureMoment — footer