293 lines
8.8 KiB
C++
293 lines
8.8 KiB
C++
#include "dialogcutline.h"
|
||
#include "ui_dialogcutline.h"
|
||
|
||
DialogCutLine::DialogCutLine(QWidget *parent) :
|
||
DebugDialog(parent),
|
||
ui(new Ui::DialogCutLine)
|
||
{
|
||
ui->setupUi(this);
|
||
initControl();
|
||
connect(this,SIGNAL(siWkParaChange()),this,SLOT(slotWkParaChangeValue()));
|
||
}
|
||
|
||
DialogCutLine::~DialogCutLine()
|
||
{
|
||
delete ui;
|
||
}
|
||
void DialogCutLine::initControl()
|
||
{
|
||
this->setTitleStr(tr("CuttingLine debug"));//剪线调试
|
||
//根据不同分辨率设置控件的位置和尺寸
|
||
switch (g_emResolut)
|
||
{
|
||
case resolution1910:
|
||
initResolution1910();
|
||
break;
|
||
case resolution1006:
|
||
initResolution1006();
|
||
break;
|
||
default:
|
||
this->resize(1920,1080);
|
||
break;
|
||
}
|
||
initControlStyle();//初始化窗体控件样式
|
||
}
|
||
void DialogCutLine::initResolution1910()
|
||
{
|
||
this->resizeUI(1146,1040);
|
||
this->move((1920-this->width())/2,(1080-this->height())/2);
|
||
this->resizeTittle(40,50,946,60);
|
||
this->resizeCancelBtn(918,856,174,70);
|
||
this->resizeOkBtn(736,856,174,70);
|
||
ui->groupBoxAction->setGeometry(40,100,1256,750);
|
||
//主轴电机
|
||
ui->label1->setGeometry(20,50,310,54);
|
||
ui->buttonJogP->setGeometry(360,50,120,54);
|
||
ui->buttonJogN->setGeometry(500,50,120,54);
|
||
ui->buttonZero->setGeometry(640,50,120,54);
|
||
ui->buttonEnable->setGeometry(780,50,120,54);
|
||
ui->buttonDisable->setGeometry(920,50,120,54);
|
||
//下剪刀剪线
|
||
ui->label2->setGeometry(20,140,310,54);
|
||
ui->buttonOpen1->setGeometry(360,140,120,54);//90
|
||
ui->buttonClose1->setGeometry(500,140,120,54);
|
||
//照明
|
||
ui->label3->setGeometry(20,230,310,54);
|
||
ui->buttonOpen2->setGeometry(360,230,120,54);//90
|
||
ui->buttonClose2->setGeometry(500,230,120,54);
|
||
//手动操作
|
||
ui->label4->setGeometry(20,320,310,54);
|
||
ui->buttonFunction1->setGeometry(360,320,160,54);//90
|
||
ui->buttonFunction2->setGeometry(540,320,160,54);
|
||
|
||
ui->labelPara1->setGeometry(20,410,510,40);
|
||
ui->buttonPara1->setGeometry(590,410,180,54);
|
||
ui->labelUnit1->setGeometry(780,410,100,40);
|
||
|
||
ui->labelPara2->setGeometry(20,500,510,40);
|
||
ui->buttonPara2->setGeometry(590,500,180,54);
|
||
ui->labelUnit2->setGeometry(780,500,100,40);
|
||
|
||
ui->labelPara3->setGeometry(20,590,510,40);
|
||
ui->buttonPara3->setGeometry(590,590,180,54);
|
||
ui->labelUnit3->setGeometry(780,590,100,40);
|
||
}
|
||
void DialogCutLine::initResolution1006()
|
||
{
|
||
this->resizeUI(660,600);
|
||
this->move((1024-this->width())/2,(600-this->height())/2);
|
||
this->resizeTittle(40,36,600,20);
|
||
this->resizeOkBtn(420,500,96,40);
|
||
this->resizeCancelBtn(525,500,96,40);
|
||
ui->groupBoxAction->setGeometry(40,80,600,420);
|
||
//主轴电机
|
||
ui->label1->setGeometry(0,10,90,30);
|
||
ui->buttonJogP->setGeometry(90,10,90,36);
|
||
ui->buttonJogN->setGeometry(190,10,90,36);
|
||
ui->buttonZero->setGeometry(290,10,90,36);
|
||
ui->buttonEnable->setGeometry(390,10,90,36);
|
||
ui->buttonDisable->setGeometry(490,10,90,36);
|
||
//下剪刀剪线
|
||
ui->label2->setGeometry(0,70,90,36);
|
||
ui->buttonOpen1->setGeometry(90,70,90,36);//60
|
||
ui->buttonClose1->setGeometry(190,70,90,36);
|
||
//照明
|
||
ui->label3->setGeometry(0,130,90,36);
|
||
ui->buttonOpen2->setGeometry(90,130,90,36);//60
|
||
ui->buttonClose2->setGeometry(190,130,90,36);
|
||
//手动操作
|
||
ui->label4->setGeometry(0,190,90,36);
|
||
ui->buttonFunction1->setGeometry(90,190,90,36);//60
|
||
ui->buttonFunction2->setGeometry(190,190,90,36);
|
||
|
||
ui->labelPara1->setGeometry(0,250,200,36);
|
||
ui->buttonPara1->setGeometry(300,250,120,36);
|
||
ui->labelUnit1->setGeometry(440,250,30,36);
|
||
|
||
ui->labelPara2->setGeometry(0,300,200,36);
|
||
ui->buttonPara2->setGeometry(300,300,120,36);//50
|
||
ui->labelUnit2->setGeometry(440,300,30,36);
|
||
|
||
ui->labelPara3->setGeometry(0,350,200,36);
|
||
ui->buttonPara3->setGeometry(300,350,120,36);
|
||
ui->labelUnit3->setGeometry(440,350,30,36);
|
||
}
|
||
void DialogCutLine::initControlStyle()
|
||
{
|
||
ui->groupBoxAction->setStyleSheet(TRANSPARENTSTYLE);
|
||
ui->groupBoxAction->setFont(fontNormal_1);
|
||
ui->label1->setStyleSheet(LABELGREYSTYLE);
|
||
ui->label1->setFont(fontNormal_1);
|
||
ui->label2->setStyleSheet(LABELGREYSTYLE);
|
||
ui->label2->setFont(fontNormal_1);
|
||
ui->label3->setStyleSheet(LABELGREYSTYLE);
|
||
ui->label3->setFont(fontNormal_1);
|
||
ui->label4->setStyleSheet(LABELGREYSTYLE);
|
||
ui->label4->setFont(fontNormal_1);
|
||
|
||
ui->buttonJogP->setFont(fontNormal_1);
|
||
ui->buttonJogN->setFont(fontNormal_1);
|
||
ui->buttonZero->setFont(fontNormal_1);
|
||
ui->buttonEnable->setFont(fontNormal_1);
|
||
ui->buttonDisable->setFont(fontNormal_1);
|
||
|
||
ui->buttonOpen1->setFont(fontNormal_1);
|
||
ui->buttonClose1->setFont(fontNormal_1);
|
||
|
||
ui->buttonOpen2->setFont(fontNormal_1);
|
||
ui->buttonClose2->setFont(fontNormal_1);
|
||
|
||
ui->buttonFunction1->setFont(fontNormal_1);
|
||
ui->buttonFunction2->setFont(fontNormal_1);
|
||
|
||
|
||
ui->labelPara1->setStyleSheet(LABELGREYSTYLE);
|
||
ui->labelPara1->setFont(fontNormal_1);
|
||
ui->buttonPara1->setFont(fontNormal_1);
|
||
ui->labelUnit1->setStyleSheet(LABELGREYSTYLE);
|
||
ui->labelUnit1->setFont(fontNormal_1);
|
||
|
||
ui->labelPara2->setStyleSheet(LABELGREYSTYLE);
|
||
ui->labelPara2->setFont(fontNormal_1);
|
||
ui->buttonPara2->setFont(fontNormal_1);
|
||
ui->labelUnit2->setStyleSheet(LABELGREYSTYLE);
|
||
ui->labelUnit2->setFont(fontNormal_1);
|
||
|
||
ui->labelPara3->setStyleSheet(LABELGREYSTYLE);
|
||
ui->labelPara3->setFont(fontNormal_1);
|
||
ui->buttonPara3->setFont(fontNormal_1);
|
||
ui->labelUnit3->setStyleSheet(LABELGREYSTYLE);
|
||
ui->labelUnit3->setFont(fontNormal_1);
|
||
}
|
||
//参数改变刷新 参数值
|
||
void DialogCutLine::slotWkParaChangeValue()
|
||
{
|
||
int mcParaFlag = this->getMcParaChange();
|
||
if(mcParaFlag == 1)
|
||
{
|
||
s32 para1 =this->getWkPara(11);
|
||
float paraValue1 = para1*0.01;
|
||
QString paraValueStr1;
|
||
paraValueStr1.sprintf("%.2f",paraValue1);
|
||
ui->buttonPara1->setText(paraValueStr1);
|
||
|
||
s32 para2 =this->getWkPara(12);
|
||
float paraValue2 = para2*0.01;
|
||
QString paraValueStr2;
|
||
paraValueStr2.sprintf("%.2f",paraValue2);
|
||
ui->buttonPara2->setText(paraValueStr2);
|
||
}
|
||
}
|
||
|
||
//主轴电机
|
||
void DialogCutLine::on_buttonJogP_pressed()
|
||
{
|
||
this->excuteOrder(MT_LM,OUTCONTROL_JOGP);
|
||
}
|
||
void DialogCutLine::on_buttonJogP_released()
|
||
{
|
||
this->excuteOrder(MT_LM,OUTCONTROL_STOP);
|
||
}
|
||
|
||
void DialogCutLine::on_buttonJogN_pressed()
|
||
{
|
||
this->excuteOrder(MT_LM,OUTCONTROL_JOGN);
|
||
}
|
||
void DialogCutLine::on_buttonJogN_released()
|
||
{
|
||
this->excuteOrder(MT_LM,OUTCONTROL_STOP);
|
||
}
|
||
|
||
void DialogCutLine::on_buttonZero_clicked()
|
||
{
|
||
this->excuteOrder(MT_LM,OUTCONTROL_ZERO);//锯齿电机归零
|
||
}
|
||
|
||
void DialogCutLine::on_buttonEnable_clicked()
|
||
{
|
||
this->excuteOrder(MT_LM,OUTCONTROL_ENABLE);
|
||
}
|
||
|
||
void DialogCutLine::on_buttonDisable_clicked()
|
||
{
|
||
this->excuteOrder(MT_LM,OUTCONTROL_DISABLE);
|
||
}
|
||
//下剪刀剪线 打开
|
||
void DialogCutLine::on_buttonOpen1_clicked()
|
||
{
|
||
this->excuteOrder(OT_DCUT_THREAD,OUTCONTROL_OPEN);
|
||
}
|
||
//下剪刀剪线 关闭
|
||
void DialogCutLine::on_buttonClose1_clicked()
|
||
{
|
||
this->excuteOrder(OT_DCUT_THREAD,OUTCONTROL_CLOSE);
|
||
}
|
||
//照明 打开
|
||
void DialogCutLine::on_buttonOpen2_clicked()
|
||
{
|
||
this->excuteOrder(OT_LIGHT,OUTCONTROL_OPEN);
|
||
}
|
||
//照明 关闭
|
||
void DialogCutLine::on_buttonClose2_clicked()
|
||
{
|
||
this->excuteOrder(OT_LIGHT,OUTCONTROL_CLOSE);
|
||
}
|
||
//手动操作 缝纫机头升降
|
||
void DialogCutLine::on_buttonFunction1_clicked()
|
||
{
|
||
g_pMachine->manualAction(SEW_HEAD_LIFT, 0, 0);
|
||
}
|
||
//手动操作 缝纫剪线
|
||
void DialogCutLine::on_buttonFunction2_clicked()
|
||
{
|
||
g_pMachine->manualAction(CUT_THREAD, 0, 0);
|
||
}
|
||
|
||
void DialogCutLine::on_buttonPara1_clicked()
|
||
{
|
||
// 剪线分线角度, 范围 0--36000,默认 20000 0.01度
|
||
QTextCodec *cod = QTextCodec::codecForLocale();
|
||
int rslt;
|
||
NumerInputDialog ndlg(this);
|
||
ndlg.setTitleStr(tr("Trimming line angle"));
|
||
ndlg.setUnitStr(cod->toUnicode("°"));
|
||
ndlg.setValueAndRange(ui->buttonPara1->text().toFloat()*100, 0, 36000, 2);
|
||
rslt = ndlg.exec();
|
||
if (rslt == 1)
|
||
{
|
||
s32 val = ndlg.getValue();
|
||
float value = val*0.01;
|
||
QString valueStr;
|
||
valueStr.sprintf("%.2f",value);
|
||
ui->buttonPara1->setText(valueStr);
|
||
this->setWkPara(11,val);
|
||
}
|
||
}
|
||
|
||
void DialogCutLine::on_buttonPara2_clicked()
|
||
{
|
||
//剪线完成角度
|
||
QTextCodec *cod = QTextCodec::codecForLocale();
|
||
int rslt;
|
||
NumerInputDialog ndlg(this);
|
||
ndlg.setTitleStr(tr("Trimming completion angle"));
|
||
ndlg.setUnitStr(cod->toUnicode("°"));
|
||
ndlg.setValueAndRange(ui->buttonPara1->text().toFloat()*100, 0, 36000, 2);
|
||
rslt = ndlg.exec();
|
||
if (rslt == 1)
|
||
{
|
||
s32 val = ndlg.getValue();
|
||
float value = val*0.01;
|
||
QString valueStr;
|
||
valueStr.sprintf("%.2f",value);
|
||
ui->buttonPara1->setText(valueStr);
|
||
this->setWkPara(12,val);
|
||
}
|
||
}
|
||
|
||
void DialogCutLine::on_buttonPara3_clicked()
|
||
{
|
||
//剪线行程
|
||
|
||
}
|