PunchHMI/sharedviews/debugviews/dialogdiecutter.cpp

228 lines
6.2 KiB
C++
Raw Permalink Normal View History

2024-02-06 06:58:57 +00:00
#include "dialogdiecutter.h"
#include "ui_dialogdiecutter.h"
DialogDieCutter::DialogDieCutter(QWidget *parent) :
DebugDialog(parent),
ui(new Ui::DialogDieCutter)
{
ui->setupUi(this);
initControl();
}
DialogDieCutter::~DialogDieCutter()
{
delete ui;
}
void DialogDieCutter::initControl()
{
this->setTitleStr(tr("DieCutter debug"));//冲刀调试
//根据不同分辨率设置控件的位置和尺寸
switch (g_emResolut)
{
case resolution1910:
initResolution1910();
break;
case resolution1006:
initResolution1006();
break;
default:
this->resize(1920,1080);
break;
}
initControlStyle();//初始化窗体控件样式
}
void DialogDieCutter::initResolution1910()
{
this->resizeUI(1146,1040);
this->resizeTittle(40,50,946,60);
this->move((1920-this->width())/2,(1080-this->height())/2);
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->buttonJogP1->setGeometry(360,50,120,54);
ui->buttonJogN1->setGeometry(500,50,120,54);
ui->buttonZero1->setGeometry(640,50,120,54);
ui->buttonEnable1->setGeometry(780,50,120,54);
ui->buttonDisable1->setGeometry(920,50,120,54);
//冲孔旋转
ui->label2->setGeometry(20,140,310,54);
ui->buttonJogP2->setGeometry(360,140,120,54);//90
ui->buttonJogN2->setGeometry(500,140,120,54);
ui->buttonZero2->setGeometry(640,140,120,54);
ui->buttonEnable2->setGeometry(780,140,120,54);
ui->buttonDisable2->setGeometry(920,140,120,54);
//手动操作
ui->label3->setGeometry(20,230,310,54);
ui->buttonFunction1->setGeometry(360,230,160,54);//90
ui->buttonFunction2->setGeometry(540,230,160,54);
ui->buttonFunction3->setGeometry(720,230,160,54);
ui->buttonFunction4->setGeometry(900,230,160,54);
ui->buttonFunction5->setGeometry(360,320,160,54);
}
void DialogDieCutter::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->buttonJogP1->setGeometry(90,10,90,36);
ui->buttonJogN1->setGeometry(190,10,90,36);
ui->buttonZero1->setGeometry(290,10,90,36);
ui->buttonEnable1->setGeometry(390,10,90,36);
ui->buttonDisable1->setGeometry(490,10,90,36);
//冲孔旋转
ui->label2->setGeometry(0,70,90,30);
ui->buttonJogP2->setGeometry(90,70,90,30);//60
ui->buttonJogN2->setGeometry(190,70,90,30);
ui->buttonZero2->setGeometry(290,70,90,30);
ui->buttonEnable2->setGeometry(390,70,90,30);
ui->buttonDisable2->setGeometry(490,70,90,30);
//手动操作
ui->label3->setGeometry(0,130,90,30);
ui->buttonFunction1->setGeometry(90,130,90,30);//60
ui->buttonFunction2->setGeometry(190,130,90,30);
ui->buttonFunction3->setGeometry(290,130,90,30);
ui->buttonFunction4->setGeometry(390,130,90,30);
ui->buttonFunction5->setGeometry(490,130,90,30);
}
void DialogDieCutter::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->buttonJogP1->setFont(fontNormal_1);
ui->buttonJogN1->setFont(fontNormal_1);
ui->buttonZero1->setFont(fontNormal_1);
ui->buttonEnable1->setFont(fontNormal_1);
ui->buttonDisable1->setFont(fontNormal_1);
ui->buttonJogP2->setFont(fontNormal_1);
ui->buttonJogN2->setFont(fontNormal_1);
ui->buttonZero2->setFont(fontNormal_1);
ui->buttonEnable2->setFont(fontNormal_1);
ui->buttonDisable2->setFont(fontNormal_1);
ui->buttonFunction1->setFont(fontNormal_1);
ui->buttonFunction2->setFont(fontNormal_1);
ui->buttonFunction3->setFont(fontNormal_1);
ui->buttonFunction4->setFont(fontNormal_1);
ui->buttonFunction5->setFont(fontNormal_1);
}
void DialogDieCutter::on_buttonJogP1_pressed()
{
this->excuteOrder(MT_LPM,OUTCONTROL_JOGP);
}
void DialogDieCutter::on_buttonJogP1_released()
{
this->excuteOrder(MT_LPM,OUTCONTROL_STOP);
}
void DialogDieCutter::on_buttonJogN1_pressed()
{
this->excuteOrder(MT_LPM,OUTCONTROL_JOGN);
}
void DialogDieCutter::on_buttonJogN1_released()
{
this->excuteOrder(MT_LPM,OUTCONTROL_STOP);
}
void DialogDieCutter::on_buttonZero1_clicked()
{
this->excuteOrder(MT_LPM,OUTCONTROL_ZERO);//锯齿电机归零
}
void DialogDieCutter::on_buttonEnable1_clicked()
{
this->excuteOrder(MT_LPM,OUTCONTROL_ENABLE);
}
void DialogDieCutter::on_buttonDisable1_clicked()
{
this->excuteOrder(MT_LPM,OUTCONTROL_DISABLE);
}
void DialogDieCutter::on_buttonJogP2_pressed()
{
this->excuteOrder(MT_LPR,OUTCONTROL_JOGP);
}
void DialogDieCutter::on_buttonJogP2_released()
{
this->excuteOrder(MT_LPR,OUTCONTROL_STOP);
}
void DialogDieCutter::on_buttonJogN2_pressed()
{
this->excuteOrder(MT_LPR,OUTCONTROL_JOGN);
}
void DialogDieCutter::on_buttonJogN2_released()
{
this->excuteOrder(MT_LPR,OUTCONTROL_STOP);
}
void DialogDieCutter::on_buttonZero2_clicked()
{
this->excuteOrder(MT_LPR,OUTCONTROL_ZERO);//锯齿电机归零
}
void DialogDieCutter::on_buttonEnable2_clicked()
{
this->excuteOrder(MT_LPR,OUTCONTROL_ENABLE);
}
void DialogDieCutter::on_buttonDisable2_clicked()
{
this->excuteOrder(MT_LPR,OUTCONTROL_DISABLE);
}
//冲孔换杆归零
void DialogDieCutter::on_buttonFunction1_clicked()
{
g_pMachine->manualAction(PUNCH_CHANGE_ZERO);
}
//冲一个孔
void DialogDieCutter::on_buttonFunction2_clicked()
{
g_pMachine->manualAction(PUNCH_MS_POH);
}
//冲孔点动
void DialogDieCutter::on_buttonFunction3_clicked()
{
g_pMachine->manualAction(PUNCH_MS_JOG);
}
//冲孔换色
void DialogDieCutter::on_buttonFunction4_clicked()
{
}
//冲孔旋转去零位
void DialogDieCutter::on_buttonFunction5_clicked()
{
g_pMachine->manualAction(PUNCH_ROT_TO_ZERO);
}