184 lines
5.2 KiB
C++
184 lines
5.2 KiB
C++
#ifndef PRINTSETTING_H
|
|
#define PRINTSETTING_H
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QPushButton>
|
|
#include <QXmlStreamWriter>
|
|
#include "PulseNumFix.h"
|
|
|
|
namespace Ui {
|
|
class PrintSetting;
|
|
}
|
|
|
|
/**
|
|
* @brief 从sysPara中提取的某些用于跟随工作文件保存的打印设置
|
|
*
|
|
*
|
|
* @remark
|
|
* 字段声明位置按照类型长度降序排列,用于在紧凑内存对齐的状态下尽量提升性能
|
|
* 所以看声明顺序有点奇怪
|
|
* 使用紧凑内存对齐的原因是为了方便直接映射为字符串,方便保存
|
|
*/
|
|
struct PrintSettingModel
|
|
{
|
|
int timeTriggerPrintMode = 0; // 间隔模式, 0: 行末-> 行首 1: 行首对行首 ,韩国人要求只保留一个,所以应该固定为 0
|
|
|
|
/**
|
|
* 触发间隔。
|
|
* 时延模式,指间隔多久打印一次。单位ms,
|
|
* 电眼 + 同步器模式: 根据 eleEyeRepeatCnt 设定的重复次数,确定重复间隔,单位长度mm
|
|
* 电眼模式:根据 eleEyeRepeatCnt 设定的重复次数,确定重复间隔,单位是时间 ms
|
|
* 同步器模式:重复间隔,单位长度 mm
|
|
* */
|
|
unsigned triggerInterval = 100;
|
|
|
|
unsigned eleEyeRepeatCnt = 1; // 电眼触发时,打印内容的次数,也就是重复数
|
|
|
|
unsigned triggerMode = 0; // 触发模式
|
|
|
|
float encoderPulsePerMm = 40; // 编码器的每毫米脉冲数
|
|
|
|
unsigned printColDelay = 6; // 打印列延迟,(字宽)
|
|
|
|
unsigned short volParaIndex = 0; // 喷印模式的索引, 决定选择哪组电压参数
|
|
|
|
unsigned short eleEyeTriggerPrintDelay = 0; // 0x38 电眼 + 同步器模式下,电眼触发后,同步打印延迟时间,单位:毫秒
|
|
|
|
unsigned short altMirrorGap = 0; // 镜像交替间隔, 单位:喷印个数
|
|
|
|
unsigned short eleMaskTime = 0; // 电眼封锁时间或距离 单位ms或mm
|
|
|
|
/**
|
|
* 同步器的正反转模式
|
|
* 0:正反转打印
|
|
* 1:只正转打印
|
|
* 2:只反转打印
|
|
* 3:带补偿的正转打印
|
|
* 4:带补偿的反转打印
|
|
*/
|
|
unsigned char syncTriggerMode = 0;
|
|
|
|
unsigned char mode0211 = 1; // 0211模式
|
|
|
|
unsigned char highVoltageAmplitude = 75; // 界面显示 字高,但是名字叫 高压振幅? 谁解释一下
|
|
|
|
unsigned char altMirrorType = 0; // 镜像交替模式
|
|
|
|
unsigned char pulseOutputEnable = 0; // 脉冲输出使能
|
|
|
|
unsigned int productCntPerOutputPulse = 0; // 多少个产品产生一个输出脉冲
|
|
|
|
unsigned short outputPulseDelayMs = 0; // 输出脉冲延时
|
|
|
|
unsigned short OuputPulseCol = 0; // 在第几列输出脉冲
|
|
|
|
unsigned short pulse_sinal_value = 0; // 脉冲信号值
|
|
|
|
bool leftRightInverse = false; // 信息左右颠倒
|
|
|
|
bool upDownInverse = false; // 信息上下颠倒
|
|
|
|
bool eleEyeTriggerSynPrintEn = false;
|
|
|
|
static void loadFromXml(PrintSettingModel& model, const QXmlStreamAttributes& attrs);
|
|
static void saveToXml(const PrintSettingModel& model, QXmlStreamWriter& writer);
|
|
|
|
static void applyToSysPara(const PrintSettingModel& model, SysPara* sysPara);
|
|
|
|
static PrintSettingModel fromSysPara(SysPara* sysPara);
|
|
|
|
static QString toString(const PrintSettingModel& model);
|
|
|
|
static PrintSettingModel defPrintSettingModel();
|
|
|
|
static void setDefPrintSettingModel(const PrintSettingModel& model);
|
|
};
|
|
|
|
class PrintSetting : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit PrintSetting(QWidget *parent = 0);
|
|
~PrintSetting();
|
|
|
|
QPushButton* m_closeBtn;
|
|
QPushButton* m_checkBtn;
|
|
|
|
void updateModelFromUI();
|
|
void updateModelToUI();
|
|
void bindSysPara(SysPara *sysPara);
|
|
void updateSysStatusToUI();
|
|
|
|
void setTriggerUI(int triggerMode);
|
|
|
|
void setSynPrintMode(int mode);
|
|
|
|
void on_pushButtonApply_pressed();
|
|
|
|
void TriggerupdateModelToUI();
|
|
|
|
void setEnableEleEyeSetting(bool);
|
|
|
|
void setEnableSynTriggerSetting(bool);
|
|
|
|
void applyPrintSettingsToSysPara(bool showTip = true);
|
|
|
|
PrintSettingModel model() const;
|
|
|
|
void setModel(const PrintSettingModel& model);
|
|
|
|
private slots:
|
|
void buttonClickedSlot();
|
|
|
|
void on_pushButtonApplyPulseFix_clicked();
|
|
|
|
void onPulseNumFixDone(float);
|
|
|
|
void on_lineEditTriggerPulsePerMm_textChanged(const QString &arg1);
|
|
|
|
void on_radioButtonSynTrigger_pressed();
|
|
|
|
void on_radioButtonDelayTrigger_pressed();
|
|
|
|
void on_radioButtonEleEyeEdgetTrigger_pressed();
|
|
|
|
void on_radioButtonEleEyeLevelTrigger_pressed();
|
|
|
|
void on_checkEyeTriggerSynPrintEn_clicked(bool checked);
|
|
|
|
void on_eleEyeEdgetTriggerInner_clicked();
|
|
|
|
void on_eleEyeEdgetTriggerExternal_clicked();
|
|
|
|
void on_radioButtonSynTriggerInner_clicked();
|
|
|
|
void on_radioButtonEleEyeEdgetTrigger_clicked();
|
|
|
|
void on_radioButtonEleEyeLevelTrigger_clicked();
|
|
|
|
void on_radioButtonSynTriggerExternal_clicked();
|
|
|
|
void on_checkBoxPulseOutputEnable_clicked(bool checked);
|
|
|
|
void on_cb_unlimited_clicked(bool checked);
|
|
|
|
private:
|
|
Ui::PrintSetting *ui;
|
|
|
|
PrintSettingModel m_model;
|
|
SysPara *sysPara = nullptr;
|
|
PulseNumFix *pulseNumFix;
|
|
|
|
bool isPulseEenable = false;
|
|
|
|
void init();
|
|
void applyStyleSheet(); // 应用样式表
|
|
|
|
signals:
|
|
void sendButtonClickedSignal(int index);
|
|
|
|
};
|
|
|
|
#endif // PRINTSETTING_H
|