#ifndef COLORDIALOG_H
#define COLORDIALOG_H

#include <QRadioButton>
#include <QDebug>
#include <QGraphicsDropShadowEffect>
#include <QSpinBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QSpacerItem>
#include <QRegExp>
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include "colorsquare.h"
#include "gradientslider.h"
#include "view/sizedate.h"
#include "customdialog.h"
#include "maskwidget.h"

class ColorDialog : public CustomDialog
{
    Q_OBJECT

public:
    explicit ColorDialog(QWidget *parent = nullptr);
    ~ColorDialog();

    QColor color() const;

protected:


private:
    QVBoxLayout *m_Layout;
    QFrame *m_frame;
    QHBoxLayout *m_hLayout1;
    QSpacerItem *m_hSpacer;
    QPushButton *closeBtn;
    QSpacerItem *m_vSpacer;
    QFrame *m_frame2;
    QHBoxLayout *m_hLayout2;
    QHBoxLayout *m_hLayout3;
    QSpacerItem *m_vSpacer2;
    QFrame *m_frame3;
    QHBoxLayout *m_hLayout4;
    QHBoxLayout *m_hLayout5;
    QHBoxLayout *m_hLayout6;
    QVBoxLayout *m_vLayout;
    QLabel *m_label;
    QLineEdit *colorLineEdit;
    QHBoxLayout *m_hLayout7;
    QLabel *m_label2;
    QSpinBox *m_spinBoxR;
    QSpinBox *m_spinBoxB;
    QSpinBox *m_spinBoxG;

    ColorSquare         *colorSquare;
    GradientSlider      *gradientSlider;

    enum CheckedColor
    {
        H,S,V,R,G,B
    }checkedColor;

    QSpinBox*           spinAlpha;
    GradientSlider*     sliderAlpha;

    QRadioButton*       radioHue;
    QSpinBox*           spinHue;
    GradientSlider*     sliderHue;

    QRadioButton*       radioSat;
    QSpinBox*           spinSat;
    GradientSlider*     sliderSat;

    QRadioButton*       radioVal;
    QSpinBox*           spinVal;
    GradientSlider*     sliderVal;

    QRadioButton*       radioRed;
    QSpinBox*           spinRed;
    GradientSlider*     sliderRed;

    QRadioButton*       radioGreen;
    QSpinBox*           spinGreen;
    GradientSlider*     sliderGreen;

    QRadioButton*       radioBlue;
    QSpinBox*           spinBlue;
    GradientSlider*     sliderBlue;

    void initLayout();
    void setupInit();
    void signalsBind();
    void drawSlider();
    void SetVerticalSlider();
    void SetColor(QColor color);

private Q_SLOTS:
    void updateWidgetsSlot();
    void setRgbSlot();
    void SetHsvSlot();
    void colorSelectedSolt();

Q_SIGNALS:
    void colorChanged(QColor);
    void checkedChanged(char);
    void colorSelected(QColor);
};

#endif // COLORDIALOG_H
