/*
    This file is part of Photoflare.

    Photoflare is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Photoflare is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Photoflare.  If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef HUEDIALOG_H
#define HUEDIALOG_H

#include <QDialog>

namespace Ui {
class HueDialog;
}

class HueDialog : public QDialog
{
    Q_OBJECT

public:
    explicit HueDialog(QWidget *parent, QImage preview);
    ~HueDialog() override;

    bool eventFilter(QObject *obj, QEvent *event) override;
    void showEvent(QShowEvent *event) override;
    void setPreviewImage(const QImage& image);
    QColor color() {return m_color;}
    int degrees() {return m_degrees;}
    bool isColorizeMethod() const;

private slots:
    void on_horizontalSlider_valueChanged(int value);
    void on_method1_toggled();
    void setColor(const QColor &color, QWidget *colorLabel);
    void showColorDialog(QWidget *colorLabel);
    QColor getColorFromLabel(QWidget *colorLabel) const;
    void writeSettings(QWidget* window);
    void readSettings(QWidget* window);

signals:
    void huePreviewChanged(QImage image, bool colorize, QColor color, int degrees);
private:
    Ui::HueDialog *ui;
    QImage m_preview;
    QColor m_color;
    int m_degrees = 0;
};

#endif // HUEDIALOG_H
