#pragma once #include "Document/EditorSession.h" #include class CurvesControls; class PickerField; class QButtonGroup; class QCheckBox; class QLabel; class QProgressBar; class QPushButton; class QSlider; class QVBoxLayout; class SwatchButton; // Swift's GradientMapControls: the gradient, both ends, Reverse. class GradientMapControls : public QWidget { Q_OBJECT public: // `pick` opens the picker: false for Shadows, true for Highlights. GradientMapControls(std::function value, std::function change, std::function pick, QWidget *parent = nullptr); // Shows the settings as they now stand. void synchronize(); private: QWidget *swatch(const QString &title, bool highlights, const std::function &pick); const std::function m_value; const std::function m_change; QWidget *const m_gradient; QCheckBox *const m_reverse; std::vector m_swatches; }; // Swift's FilterSheet: the kind's settings, Preview, Cancel and OK. class FilterSheet : public QWidget { Q_OBJECT public: explicit FilterSheet(EditorSession &session, QWidget *parent = nullptr); private: // Swift's control: a slider, an exact field and its unit. struct Control { std::function key; double low; double high; int decimals; bool logarithmic; QSlider *slider; PickerField *field; }; void control(const QString &title, std::function key, double low, double high, const QString &unit, int decimals, bool logarithmic); void noise(); // Remove Background's words, Quality, and Advanced's three rows. void background(); // Black & White's six families and Tint; Color Balance's nine. void blackWhite(); void colorBalance(); // Swift's Toggle over a flag, with its help. void flag(const QString &title, const QString &help, std::function key); // Swift's headline over a group of rows. void headline(const QString &title); // Swift's `settings` and `update`: the defaults once the edit goes. FilterSettings settings() const; void update(const std::function &change); void synchronize(); EditorSession &m_session; QVBoxLayout *const m_column; std::vector m_controls; CurvesControls *m_curves = nullptr; GradientMapControls *m_gradientMap = nullptr; QButtonGroup *m_distribution = nullptr; QCheckBox *m_monochromatic = nullptr; QButtonGroup *m_quality = nullptr; std::vector>> m_flags; // Rows under Swift's `if`: Advanced's, Tint's. std::vector>> m_shownWhen; QCheckBox *const m_preview; QLabel *const m_error; QLabel *const m_limited; QProgressBar *const m_spinner; QLabel *const m_activity; QPushButton *const m_cancel; QPushButton *const m_ok; // The picker's colour as last seen, Swift's onChange. std::optional m_pickerColour; };