Files
OmaPhoto/src/UI/HueSaturationSheet.h
T
雷电芽衣andClaude c864304695
Release / deb (push) Canceled after 0s
Release / rpm (push) Canceled after 0s
Release / arch (push) Canceled after 0s
Release / publish (push) Canceled after 0s
OmaPhoto 1.0.0: the Linux port of Compositor
A layered image editor for Linux and Omarchy, ported from Compositor
(github.com/robbietilton/Compositor), whose Swift source is its
specification. It reads and writes Compositor's .comp projects.

Packages for Ubuntu, Fedora and Arch come from the release workflow;
scripts/install/ holds one install script per distribution family,
and flake.nix serves NixOS.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-26 00:44:52 -04:00

68 lines
2.1 KiB
C++

#pragma once
#include "Document/EditorSession.h"
#include <QWidget>
#include <array>
#include <functional>
#include <optional>
class PickerField;
class QCheckBox;
class QComboBox;
class QLabel;
class QPushButton;
class QSlider;
class QToolButton;
// Swift's SpectrumEditor: the hues, the band's handles, the hues after.
class SpectrumEditor : public QWidget {
Q_OBJECT
public:
// Swift's binding: the settings read, and written back.
SpectrumEditor(std::function<HueSaturationSettings()> value, std::function<void(const HueSaturationSettings &)> change, QWidget *parent = nullptr);
// Shows the settings as they now stand.
void synchronize();
private:
// Swift's drag: the held handle, else the nearest.
void drag(double x, double width, bool pressed);
const std::function<HueSaturationSettings()> m_value;
const std::function<void(const HueSaturationSettings &)> m_change;
std::optional<int> m_dragging;
QWidget *const m_handles;
QWidget *const m_after;
QLabel *const m_readout;
};
// Swift's HueSaturationSheet: range, samples, sliders, spectrum, toggles.
class HueSaturationSheet : public QWidget {
Q_OBJECT
public:
explicit HueSaturationSheet(EditorSession &session, QWidget *parent = nullptr);
private:
// Swift's settings binding: changed, then handed to the session.
void change(const std::function<void(HueSaturationSettings &)> &edit);
// Swift's slider row: title, slider, field and unit.
QWidget *row(size_t index);
void synchronize();
EditorSession &m_session;
QComboBox *const m_range;
const std::array<QToolButton *, 3> m_samples;
QWidget *const m_divider;
QToolButton *const m_targeting;
// Hue, Saturation, Lightness; the rows make them.
std::array<QSlider *, 3> m_sliders{};
std::array<PickerField *, 3> m_fields{};
const std::array<QWidget *, 3> m_rows;
SpectrumEditor *const m_spectrum;
QCheckBox *const m_invert;
QCheckBox *const m_colorize;
QCheckBox *const m_preview;
QPushButton *const m_reset;
QLabel *const m_limited;
QPushButton *const m_cancel;
QPushButton *const m_ok;
};