#ifndef NEEDLEBARSETWIDGET_H
#define NEEDLEBARSETWIDGET_H

#include <QWidget>
#include <QPushButton>
#include <QDir>
#include <QFile>
#include "numerinputdialog.h"
#include "mybutton.h"
#include "setcontrolstyle.h"
#include <QMouseEvent>
#include <QDateTime>
#include "mctype/mainwidgetfunction.h"

enum SET_TYPE {
    SET_TYPE_NEEDLE_EMB = 1,  //绣花针杆设置
    SET_TYPE_SEQUIN_COLOR,    //亮片颜色设置
    SET_TYPE_BEAD_COLOR,       //散珠颜色设置
    SET_TYPE_BEAD_TOWEL,     //毛巾针杆设置
    SET_TYPE_BEAD_CHAIN      //毛巾链式针杆设置
};

namespace Ui {
class NeedleBarSetWidget;
}

class NeedleBarSetWidget : public QWidget
{
    Q_OBJECT

public:
    explicit NeedleBarSetWidget(QWidget *parent = 0);
    ~NeedleBarSetWidget();

private:
    Ui::NeedleBarSetWidget *ui;
    QList<QPushButton*> m_embNeedleBtnList;
    QList<QPushButton*> m_colorBtnList;
    QPushButton *m_pEmbNeedleBtn;
    QPushButton *m_pColorBtn;

    QRgb *m_pColorBuf;
    QString m_buttonStyle1;
    QString m_buttonStyle2;

    QString m_configFile;
    s16 m_setType;  //针杆设置类型

private:
    void initWidget();
    void initControl();//初始化窗体控件，包括位置、尺寸、样式
    void initResolution1910();//初始化窗体控件为1920x1080分辨率
    void initResolution1006();
    void initControlStyle();//初始化窗体控件样式
    void refreshNeedleColorShow();//刷新针杆数量及颜色
    void initArabControlPos();//设置阿拉伯语时控件对齐方式

public:
    void setTypeLogo(QString tStyle);//设置类型图标
    void setMainTitle(QString str);//设置主title
    void setSubTitle(QString str);//设置副title
    void initNeedleBar();//初始化针杆
    void refreshTypeBtnShow();//刷新右上方按钮的显示,包括选中状态

private slots:
    void embNeedleBtnClick();
    void colorBtnClick();
    void on_buttonEmbNeedleNum_clicked();
    void on_buttonOk_clicked();
    void on_buttonBeadSet_clicked();
    void on_buttonSequinSet_clicked();
    void on_buttonEmbSet_clicked();
    void on_buttonTowelSet_clicked();

signals:
    void siNeedlebarSet();//针杆设置后需要重新刷新图形的信号

 //鼠标事件
protected:
    void mousePressEvent(QMouseEvent *e);
    void mouseReleaseEvent(QMouseEvent *e);

private:
    int m_mousePressX;
    int m_mousePressY;
    int m_mouseReleaseX;
    int m_mouseReleaseY;

};

#endif // NEEDLEBARSETWIDGET_H
