EmbHMI/sharedviews/colorordersetwidget.h

157 lines
5.5 KiB
C
Raw Permalink Normal View History

2024-02-06 06:27:07 +00:00
#ifndef COLORORDERSETWIDGET_H
#define COLORORDERSETWIDGET_H
#include <QWidget>
#include <QDir>
#include <QMouseEvent>
#include "promptdialog.h"
#include "mybutton.h"
#include "setcontrolstyle.h"
//#include "Include/datafiledst.h"
#include "datafile/datafiledst.h"
#include "datafile/datafiledsr.h"
#include "mctype/mainwidgetfunction.h"
#include <QDateTime>
#include <QDebug>
#define TOWELHIGHRANGE 10 //毛巾高度取值范围1-10
#define TYPE_COLORSET 0 //色序设定
#define TYPE_TOWELHIGHSET 1 //毛巾高度设定
#define FILE_TYPE_DST 0 //dst文件类型
#define FILE_TYPE_DSR 1 //dsr文件类型
namespace Ui {
class ColorOrderSetWidget;
}
class ColorOrderSetWidget : public QWidget
{
Q_OBJECT
public:
explicit ColorOrderSetWidget(QWidget *parent = 0);
~ColorOrderSetWidget();
private:
Ui::ColorOrderSetWidget *ui;
int m_itemPerPage;//界面每页条目数
private:
EmbData *m_pCurEmbData;
QList<MyButton*> m_buttonColorOrderList;
QList<QPushButton*> m_buttonEmbNeedleList;
QPushButton *m_pEmbNeedleBtn;
MyButton *m_pColorBtn;
u8 m_colorBeginStepCtrl;//换色后起始针步属性(除偏移、跳针等)
u8 m_colorEndStepCtrl; //换色后结束针步属性(除偏移、跳针等)
int m_greyBeginStep;//灰色起始
int m_greyEndStep; //灰色结束
QRgb *m_pColorBuf;
QString m_buttonStyle1;
QString m_buttonStyle2;
QByteArray m_beforeColorTable;//变换之前的色序表
QByteArray m_colorTable;//变换之后的色序表
int m_curSelectColor;
int m_curPages;//当前页
int m_pageNums;//总页数
s16 m_combineEmbFirst;//最初的双头组合绣的标志
s16 m_threeCombineEmbFirst;//最初的三头组合绣的标志
s16 m_combineEmb;//双头组合绣的标志 -1:组合绣模式 1:非组合绣模式
s16 m_threeCombineEmb;//三头组合绣的标志 -1:组合绣模式 1:非组合绣模式
s16 m_colorOrderLimitFlag;//针位超出限制的标志,若是非组合模式针位超出针杆会报错
u8 m_headBuf[HEADBUF];
s16 m_colorSetBtnLockFlag;//色序设定可切换按钮是否锁住1锁住 -1解锁
s16 m_setType;//设置类型 0色序设定 1毛巾高度设置
s16 m_fileType;//文件类型 0dst 1dsr
int m_refreshColorOrder;//-1,不刷新
2024-02-06 06:27:07 +00:00
private:
void initWidget();
void initControl();//初始化窗体控件,包括位置、尺寸、样式
void initResolution1910();//初始化窗体控件为1920x1080分辨率
void initResolution1006();//初始化窗体控件为1024x600分辨率
void initControlStyle();//初始化窗体控件样式
void initArabControlPos();//设置阿拉伯语时控件对齐方式
void initNeedleBar();//初始化针杆
void switchNeedleBar();//切换针杆
void refreshColorShow(int colorInPage = -1);//刷新色序显示
void refreshPatternCurColorShow();//刷新花样选中的色序显示(刷新花样部分线迹)
void getNeedleNum(int & num);//获取配置文件针杆数量
void switchNeedleNum(int & num);//针杆数量
QString getNeedleColorStr(s16 idx);//获取配置文件针杆颜色索引字符
void refreshLockBtn();//刷新色序锁定按钮
void initTowelHeightValue();//初始化毛巾高度值
void refreshTowelHeightShow();//刷新毛巾高度显示
void refreshPatternCurTowelHeightShow();//刷新花样选中的毛巾高度显示(刷新花样部分线迹)
QString getCurColorTabStr(s16 needleIdx);
void getCurColorTabValue(s16 &colorInTab);
public:
void setTypeLogo(QString tStyle);//设置类型图标
void setMainTitle(QString str);//设置主title
void setSubTitle(QString str);//设置副title
void show(QString filePath);
void showTowelHeight(QString filePath);
void setColorTable(QByteArray table,s16 combineMode);
void setTowelHighTable(QByteArray table);
void setThreeColorTable(QByteArray table,s16 threeCombineMode);
void initHeadBuf(QString filePath);//初始化隔头绣数据
public:
inline u8* getHeadBuf(){return m_headBuf;}
signals:
void siChangeColorTable(int selColor,int colorIdx);
void siChangeTowelHighTable(int selColor,int colorIdx);
void siBackHome(s16 combineMode,s16 threeCombineMode);//组合模式
void siTowelHighBackHome();
void siCancelChangeColor(QByteArray table);
void siCancelChangeTowelHigh(QByteArray table);
void siHeadEmb();
void siSetHeadEmbBtnEnable(bool bl);
public slots:
void slotResetHeadBuf(u8* buf);//重置隔头绣数据
void slotSetEmbDatNeedleTable();//设置针杆颜色
private slots:
void colorOrderBtnClick();
void embNeedleBtnPressed();//针杆按钮被按下
void embNeedleBtnReleased();//针杆按钮抬起
void on_buttonPgUp_clicked();
void on_buttonPgDn_clicked();
void on_buttonOk_clicked();
void on_buttonCancel_clicked();
void on_buttonColorOrderCycle_clicked();
void on_buttonColorOrderClear_clicked();
void on_buttonHeadEmb_clicked();
void on_buttonCombineEmb_clicked();
void on_buttonColorSetLock_clicked();
void on_buttonNeedle_clicked();
void on_buttonExplanation_clicked();
void on_buttonColorLaser_clicked();
void on_buttonThreeCombineEmb_clicked();
void on_buttonRefreshColorOrder_clicked();
protected:
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
private:
int m_mousePressX;
int m_mousePressY;
int m_mouseReleaseX;
int m_mouseReleaseY;
};
#endif // COLORORDERSETWIDGET_H