CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
base_adjustment_model.h
Go to the documentation of this file.
1
8#pragma once
9
12
13#include <QObject>
14#include <QString>
15
16namespace CaptureMoment::UI {
17
18namespace Models::Operations {
19
20
41 Q_OBJECT
42
43 // Expose the 'value' property to QML, allowing two-way binding.
44 // This property is backed by the 'value()' getter and 'setValue()' setter methods.
45 // Changes trigger the 'valueChanged' signal.
46 Q_PROPERTY(float value READ value WRITE setValue NOTIFY valueChanged)
47
48 // Expose the constant minimum value to QML.
49 // This property is backed by the 'minimum()' getter method and is marked as CONSTANT,
50 // meaning its value does not change during the lifetime of the object.
51 // This method is pure virtual and must be implemented by derived classes.
52 Q_PROPERTY(float minimum READ minimum CONSTANT)
53
54 // Expose the constant maximum value to QML.
55 // This property is backed by the 'maximum()' getter method and is marked as CONSTANT,
56 // meaning its value does not change during the lifetime of the object.
57 // This method is pure virtual and must be implemented by derived classes.
58 Q_PROPERTY(float maximum READ maximum CONSTANT)
59
60 // Expose the operation's name to QML.
61 // This property is backed by the 'name()' getter method and is marked as CONSTANT.
62 // Note: Uses the pure virtual name() method from derived classes.
63 Q_PROPERTY(QString name READ name CONSTANT)
64
65 // Expose the operation's activity state to QML.
66 // This property is backed by the 'isActive()' getter method and emits 'isActiveChanged' when it changes.
67 Q_PROPERTY(bool active READ isActive NOTIFY isActiveChanged)
68
69protected:
73 Domain::RelativeAdjustmentParams m_params;
74
79
80public:
85 explicit BaseAdjustmentModel(QObject* parent = nullptr);
86
90 virtual ~BaseAdjustmentModel() = default;
91
98 [[nodiscard]] bool isActive() const override { return m_params.isActive(); } // Implemented here
99
104 [[nodiscard]] float value() const { return m_params.value; }
105
111 [[nodiscard]] virtual float minimum() const = 0;
112
118 [[nodiscard]] virtual float maximum() const = 0;
119
120public slots:
130 void setValue(float val);
131
132signals:
139 void valueChanged(float value);
140};
141
142} // namespace Models::Operations
143
144} // namespace CaptureMoment::UI
Generic base class for operations with a single adjustable value (e.g., brightness,...
BaseAdjustmentModel(QObject *parent=nullptr)
Constructs a BaseAdjustmentModel.
bool isActive() const override
Checks if the adjustment operation is currently active. An operation is considered active if its inte...
virtual ~BaseAdjustmentModel()=default
Virtual destructor.
void setValue(float val)
Sets the adjustment value and triggers an update.
void valueChanged(float value)
Signal emitted when the adjustment value changes. QML can connect to this signal to react to value up...
float value() const
Gets the current adjustment value.
virtual float minimum() const =0
Gets the minimum allowed value for the UI slider.
Domain::RelativeAdjustmentParams m_params
used for the value and activity state
virtual float maximum() const =0
Gets the maximum allowed value for the UI slider.
Generic base class providing Qt signals/slots infrastructure for operation models.
void isActiveChanged()
Signal emitted when the operation's activity state changes. This signal is emitted by the operation m...
Generic parameter structures for common image operation types.
Generic Qt base class for operation models with QObject infrastructure.
static uint64_t generateId()
Generates a unique identifier for a new operation.
bool isActive() const
Checks if the parameter value indicates an active operation.
CaptureMoment — footer