2100 lines
74 KiB
C++
2100 lines
74 KiB
C++
#include "promptdialog.h"
|
||
#include "ui_promptdialog.h"
|
||
#include <bitset>
|
||
#include <QDebug>
|
||
|
||
PromptDialog::PromptDialog(QWidget *parent) :
|
||
QDialog(parent),
|
||
ui(new Ui::PromptDialog)
|
||
{
|
||
ui->setupUi(this);
|
||
|
||
setWindowFlags (Qt::Window | Qt::FramelessWindowHint);
|
||
setWindowModality(Qt::ApplicationModal);
|
||
|
||
setAttribute(Qt::WA_TranslucentBackground, true);
|
||
connect(g_pMachine, SIGNAL(siMcInfoChange()), this, SLOT(slotMCInfoChange()));
|
||
|
||
connect(ui->pushButton_BValue,SIGNAL(clicked(bool)),this,SLOT(slot_BladePressure_Clicked()));
|
||
|
||
initDialog();
|
||
initControl();
|
||
}
|
||
|
||
PromptDialog::~PromptDialog()
|
||
{
|
||
delete ui;
|
||
}
|
||
|
||
//初始化窗体
|
||
void PromptDialog::initDialog(int sel)
|
||
{
|
||
m_funType = sel;
|
||
m_filePath.clear();
|
||
|
||
m_spindleAngle = 0;//主轴旋转角度值
|
||
m_length = 0;// 自动拉料长度
|
||
m_area = 0;
|
||
m_time = 0;//主轴研车-时间
|
||
m_speed = 0;//主轴研车-速度
|
||
|
||
setTitleStr("");
|
||
setContentStr("");
|
||
setContentProcessStr("");
|
||
ui->labelContentInfo->setText("");
|
||
ui->labeBreakHead->setText("");
|
||
ui->buttonOk->setEnabled(true);
|
||
|
||
ui->frameDetecBtn->hide();
|
||
ui->frameTwo->hide();
|
||
ui->frameThree->hide();
|
||
ui->frameProcessBtn->hide();
|
||
ui->frameWarrantBtn->hide();
|
||
ui->frameProcess->hide();
|
||
ui->frameChangePassword->hide();
|
||
ui->frameSpindleRotate->hide();
|
||
ui->frameWorkArea->hide();
|
||
ui->frameHMIDecrypt->hide();
|
||
ui->frameKnifePressure->hide();
|
||
ui->frameFanArea->hide();
|
||
ui->frameSpdSelect->hide();
|
||
|
||
ui->labelContentInfo->hide();
|
||
ui->labeBreakHead->hide();
|
||
ui->labelContentProcess->hide();
|
||
ui->labelContentWarrant->hide();
|
||
|
||
ui->frame_Force->hide();//刀压设置弹窗
|
||
ui->frame_FileTransfer->hide();//文件传输弹窗
|
||
ui->frame_KnifeAndPenSd->hide();//铣切机--速度选择
|
||
ui->frameWorkHeadSet->hide();//工作机头设置
|
||
|
||
ui->buttonForward->hide();//隐藏正转按钮
|
||
ui->buttonReverse->hide();//隐藏反转按钮
|
||
|
||
if (sel == BTN_OK_CANCEL)//确定、取消
|
||
{
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonCancel->show();
|
||
ui->buttonOk->move(m_btnOkPoint);
|
||
ui->buttonCancel->move(m_btnCancelPoint);
|
||
}
|
||
else if (sel == BTN_OK)//确定
|
||
{
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonOk->move(m_btnCancelPoint);
|
||
}
|
||
else if (sel == BTN_R_R_S || sel == BTN_O_S_C)//重命名、替换、跳过 覆盖、另存为、关闭
|
||
{
|
||
ui->frameThree->show();
|
||
ui->buttonClose->hide();
|
||
ui->buttonOverWrite->hide();
|
||
ui->buttonRename->hide();
|
||
ui->buttonReplace->hide();
|
||
ui->buttonSaveAs->hide();
|
||
ui->buttonSkip->hide();
|
||
|
||
if(sel == BTN_R_R_S)
|
||
{
|
||
ui->buttonRename->show();
|
||
ui->buttonReplace->show();
|
||
ui->buttonSkip->show();
|
||
}
|
||
else
|
||
{
|
||
ui->buttonClose->show();
|
||
ui->buttonOverWrite->show();
|
||
ui->buttonSaveAs->show();
|
||
}
|
||
}
|
||
else if (sel == BTN_RESTART)//重启
|
||
{
|
||
ui->frameProcessBtn->show();
|
||
ui->buttonRestart->show();
|
||
ui->buttonUpdataCancel->hide();
|
||
ui->buttonRestart->move(m_btnCancelPoint);
|
||
}
|
||
else if (sel == BTN_UCANCEL)//升级取消
|
||
{
|
||
ui->frameProcessBtn->show();
|
||
ui->buttonRestart->hide();
|
||
ui->buttonUpdataCancel->show();
|
||
}
|
||
else if (sel == BTN_WARRANT)//授权按钮
|
||
{
|
||
ui->frameWarrantBtn->show();
|
||
}
|
||
// 底线检测,面线检测
|
||
else if(sel == BTN_BOTTOM || sel == BTN_FACE)
|
||
{
|
||
ui->frameDetecBtn->show();
|
||
}
|
||
else if(sel == BTN_NONE)//无按钮
|
||
{
|
||
}
|
||
else if(sel == BTN_P_NONE)//无按钮
|
||
{
|
||
}
|
||
else if(sel == BTN_HMI_DECRYPT)//界面解密
|
||
{
|
||
ui->frameHMIDecrypt->show();
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonCancel->show();
|
||
ui->buttonOk->move(m_btnOkPoint);
|
||
ui->buttonCancel->move(m_btnCancelPoint);
|
||
}
|
||
else if(sel == BTN_CHANGE_PASSWORD)//修改一级密码
|
||
{
|
||
ui->frameChangePassword->show();
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonCancel->show();
|
||
ui->buttonOk->move(m_btnOkPoint);
|
||
ui->buttonCancel->move(m_btnCancelPoint);
|
||
}
|
||
else if(sel == BTN_SPINDLE_ROTATE)//主轴旋转角度
|
||
{
|
||
ui->frameSpindleRotate->show();
|
||
float angle = m_spindleAngle*0.01;
|
||
QString angleStr;
|
||
angleStr.sprintf("%.2f",angle);
|
||
ui->buttonSpindleAngleValue->setText(angleStr);
|
||
ui->labelSpindleAngle->setText(tr("Spindle angle"));
|
||
ui->labelSpindleAngleUnit->setText(tr("deg"));
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonCancel->show();
|
||
// ui->buttonForward->show();//显示正转按钮
|
||
// ui->buttonReverse->show();//显示反转按钮
|
||
ui->buttonOk->move(m_btnOkPoint);
|
||
ui->buttonCancel->move(m_btnCancelPoint);
|
||
}
|
||
else if(sel == BTN_ROTATE_ROTATE)//旋转电机旋转
|
||
{
|
||
ui->frameSpindleRotate->show();
|
||
ui->buttonSpindleAngleValue->setText("0.00");
|
||
ui->labelSpindleAngle->setText(tr("Rotate angle"));
|
||
ui->labelSpindleAngleUnit->setText(tr("deg"));
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonCancel->show();
|
||
// ui->buttonForward->show();//显示正转按钮
|
||
// ui->buttonReverse->show();//显示反转按钮
|
||
ui->buttonOk->move(m_btnOkPoint);
|
||
ui->buttonCancel->move(m_btnCancelPoint);
|
||
}
|
||
else if(sel == BTN_SPINDLE_GRANDE)//主轴研车
|
||
{
|
||
ui->frameSpindleRotate->show();
|
||
ui->buttonSpindleAngleValue->setText("0");
|
||
ui->labelSpindleAngle->setText(tr("Spindle time"));
|
||
ui->labelSpindleAngleUnit->setText(tr("s"));
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonCancel->show();
|
||
ui->buttonOk->move(m_btnOkPoint);
|
||
ui->buttonCancel->move(m_btnCancelPoint);
|
||
}
|
||
else if(sel == BTN_AUTOMATIC_PULLMA)//自动拉料
|
||
{
|
||
ui->frameSpindleRotate->show();
|
||
ui->buttonSpindleAngleValue->setText("0");
|
||
ui->labelSpindleAngle->setText(tr("autoPull"));
|
||
ui->labelSpindleAngleUnit->setText(tr("mm"));
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonCancel->show();
|
||
// ui->buttonForward->show();//显示正转按钮
|
||
// ui->buttonReverse->show();//显示反转按钮
|
||
ui->buttonOk->move(m_btnOkPoint);
|
||
ui->buttonCancel->move(m_btnCancelPoint);
|
||
}
|
||
else if(sel == BTN_WORK_AREA)//设置可工作区域
|
||
{
|
||
ui->frameWorkArea->show();
|
||
|
||
ui->buttonX1->setText("X +");
|
||
ui->buttonX2->setText("X -");
|
||
ui->buttonY1->setText("Y +");
|
||
ui->buttonY2->setText("Y -");
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonCancel->show();
|
||
ui->buttonOk->move(m_btnOkPoint);
|
||
ui->buttonCancel->move(m_btnCancelPoint);
|
||
}
|
||
else if(sel == BTN_KNIFE_PRESSURE)//刀压设置
|
||
{
|
||
ui->frameKnifePressure->show();
|
||
ui->buttonUp->hide();
|
||
ui->buttonDn->hide();
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonOk->move(m_btnCancelPoint);
|
||
refreshMcPara();
|
||
}
|
||
else if(sel == BTN_FAN_AREA)//风机区域
|
||
{
|
||
ui->frameFanArea->show();
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonOk->move(m_btnCancelPoint);
|
||
refreshWkPara();
|
||
}
|
||
else if(sel == BTN_SPD_SELECT)//平板切割速度选择
|
||
{
|
||
ui->frameSpdSelect->show();
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonOk->move(m_btnCancelPoint);
|
||
|
||
//发送下位机
|
||
ParaStruct mcPara = g_pMachine->getMcPara();
|
||
//写数据
|
||
ui->buttonKn2_MaxSpd->setText(tr("Kn2Max:")+QString::number(mcPara.buf[171]));//刀2最大
|
||
ui->buttonKn2_MinSpd->setText(tr("Kn2Min:")+QString::number(mcPara.buf[170]));//刀2最小
|
||
ui->buttonKn2_AccSpd->setText(tr("Kn2Acc:")+QString::number(mcPara.buf[172]));//刀2加速
|
||
|
||
if(!g_pSettings->ifKeyExists("FlatPanelSpd/Model")){
|
||
g_pSettings->writeOneToIniFile("FlatPanelSpd/Model",QVariant(1));
|
||
|
||
for(int i = 1; i<6; i++){
|
||
g_pSettings->writeOneToIniFile("FlatPanelSpd/M"+ QString::number(i)+"Kn1Min",QVariant(10));
|
||
g_pSettings->writeOneToIniFile("FlatPanelSpd/M"+ QString::number(i)+"Kn1Max",QVariant(600));
|
||
g_pSettings->writeOneToIniFile("FlatPanelSpd/M"+ QString::number(i)+"Kn1Acc",QVariant(500));
|
||
g_pSettings->writeOneToIniFile("FlatPanelSpd/M"+ QString::number(i)+"Kn2Min",QVariant(10));
|
||
g_pSettings->writeOneToIniFile("FlatPanelSpd/M"+ QString::number(i)+"Kn2Max",QVariant(600));
|
||
g_pSettings->writeOneToIniFile("FlatPanelSpd/M"+ QString::number(i)+"Kn2Acc",QVariant(500));
|
||
}
|
||
}
|
||
|
||
int model = g_pSettings->readFromIniFile("FlatPanelSpd/Model").toInt();
|
||
// 根据名称查找指针id
|
||
QRadioButton *searchedButton = this->findChild<QRadioButton *>("radioButtonSpd_" + QString::number(model));
|
||
searchedButton->click();
|
||
}
|
||
else if(sel == BTN_FORCE)//铣切机--刀压
|
||
{
|
||
ui->frame_Force->show();
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonCancel->show();
|
||
ui->buttonOk->move(m_btnOkPoint);
|
||
ui->buttonCancel->move(m_btnCancelPoint);
|
||
|
||
ui->pushButton_collect->setText(tr("Collect"));//刀压采集
|
||
ui->pushButton_collect_bit->setText(tr("Positioning"));//去采集位
|
||
ui->pushButton_test->setText(tr("Testing"));//刀压测试
|
||
ui->pushButton_Blade->setText("4");
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle4());
|
||
|
||
refreshMcPara();
|
||
}
|
||
else if(sel == BTN_FILETRANSFER)//铣切机--文件传输
|
||
{
|
||
ui->frame_FileTransfer->show();
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonCancel->show();
|
||
ui->buttonOk->move(m_btnOkPoint);
|
||
ui->buttonCancel->move(m_btnCancelPoint);
|
||
|
||
ui->button_USB->setText(tr("USB"));
|
||
ui->button_Local->setText(tr("Local"));
|
||
}
|
||
else if(sel == BTN_WORKHEADSET)//工作机头设置
|
||
{
|
||
g_pMachine->getParasFromMachine();//读取参数
|
||
delay(100);
|
||
int readValue = g_pMachine->getMcPara().buf[PARA_HEADSET];
|
||
|
||
unsigned int data1 = 0, data2 = 0, data = 0;
|
||
//int readValue = /* 你的读数,假设 ≥ 0 */;
|
||
data1 |= (1U << 0); // data == 1
|
||
data2 |= (1U << 1);
|
||
data |= 0b11; // 二进制写法更直观
|
||
if (static_cast<unsigned int>(readValue) == data1) //机头1
|
||
{
|
||
ui->check_WorkHead_1->setChecked(true);
|
||
ui->check_WorkHead_2->setChecked(false);
|
||
}
|
||
else if (static_cast<unsigned int>(readValue) == data2) //机头2
|
||
{
|
||
ui->check_WorkHead_1->setChecked(false);
|
||
ui->check_WorkHead_2->setChecked(true);
|
||
}
|
||
else if (static_cast<unsigned int>(readValue) == data) //机头12
|
||
{
|
||
ui->check_WorkHead_1->setChecked(true);
|
||
ui->check_WorkHead_2->setChecked(true);
|
||
}
|
||
|
||
ui->frameWorkHeadSet->show();
|
||
ui->frameTwo->show();
|
||
ui->buttonOk->show();
|
||
ui->buttonCancel->show();
|
||
ui->buttonOk->move(m_btnOkPoint);
|
||
ui->buttonCancel->move(m_btnCancelPoint);
|
||
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
|
||
//初始化窗体控件,包括位置、尺寸、样式
|
||
void PromptDialog::initControl()
|
||
{
|
||
//根据不同分辨率设置控件的位置和尺寸
|
||
initResolution();
|
||
initControlStyle();//初始化窗体控件样式
|
||
}
|
||
|
||
//初始化窗体控件为任意分辨率
|
||
void PromptDialog::initResolution()
|
||
{
|
||
int frameLeft = 259;
|
||
int frameTop = 156;
|
||
int frameWight = 513;
|
||
int frameHeight = 291;
|
||
int titleHeight = 50;
|
||
|
||
double factoryX = getFactoryX();
|
||
double factoryY = getFactoryY();
|
||
|
||
//上状态栏
|
||
this->resize(GLB_SCR_WIGHT*factoryX,GLB_SCR_HEIGHT*factoryY);
|
||
this->move((GLB_SCR_WIGHT*factoryX-this->width())/2+g_mainWidgetPos.x(),(GLB_SCR_HEIGHT*factoryY-this->height())/2+g_mainWidgetPos.y());
|
||
|
||
ui->frameBack->setGeometry(0*factoryX,0*factoryY,GLB_SCR_WIGHT*factoryX,GLB_SCR_HEIGHT*factoryY);
|
||
ui->labelTitle->setGeometry((frameLeft+GLB_EDGE_WIGHT)*factoryX,(frameTop+(titleHeight-GLB_TEXT_HEIGHT)/2)*factoryY,(frameWight-GLB_TAB_WIGHT*2)*factoryX,(GLB_TEXT_HEIGHT+4)*factoryY);
|
||
ui->labelContent->setGeometry((frameLeft+GLB_TAB_WIGHT)*factoryX ,(frameTop+GLB_EDGE_HEIGHT)*factoryY,
|
||
(frameWight-GLB_TAB_WIGHT*2)*factoryX,(frameHeight-GLB_LBUT_HEIGHT-GLB_EDGE_HEIGHT*2)*factoryY);//(46,40,340,285)
|
||
ui->labelContentInfo->setGeometry((frameLeft+GLB_TAB_WIGHT)*factoryX ,(frameTop+GLB_EDGE_HEIGHT)*factoryY,
|
||
(frameWight-GLB_TAB_WIGHT*2)*factoryX,(frameHeight-GLB_LBUT_HEIGHT-GLB_EDGE_HEIGHT*2)*factoryY);//(46,40,350,285)
|
||
|
||
ui->labeBreakHead->setGeometry(40*factoryX,40*factoryY,380*factoryX,285*factoryY);
|
||
ui->labelContentWarrant->setGeometry(302*factoryX,193*factoryY,300*factoryX,225*factoryY);
|
||
ui->frameProcess->setGeometry(145*factoryX,150*factoryY,800*factoryX,280*factoryY);//(20,70,480,130)
|
||
ui->labelContentProcess->setGeometry(150*factoryX,80*factoryY,398*factoryX,40*factoryY);//(10,10,398,40)
|
||
ui->progressBar->setGeometry(150*factoryX,120*factoryY,446*factoryX,26*factoryY);//进度条(10,50,446,26)
|
||
|
||
|
||
ui->frameTwo->setGeometry(frameLeft*factoryX,
|
||
(frameTop+frameHeight-GLB_LBUT_HEIGHT-GLB_EDGE_HEIGHT)*factoryY,
|
||
frameWight*factoryX,
|
||
(GLB_LBUT_HEIGHT+GLB_EDGE_HEIGHT)*factoryY);
|
||
ui->buttonForward->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*3)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonReverse->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*2)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonOk->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*1)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonCancel->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
|
||
m_btnOkPoint.setX((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*1)*factoryX);//ok按钮位置(284)
|
||
m_btnOkPoint.setY(0*factoryY);
|
||
m_btnCancelPoint.setX((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT)*factoryX);//cancel按钮位置(390)
|
||
m_btnCancelPoint.setY(0*factoryY);
|
||
|
||
|
||
ui->frameProcessBtn->setGeometry(frameLeft*factoryX,
|
||
(frameTop+frameHeight-GLB_LBUT_HEIGHT-GLB_EDGE_HEIGHT)*factoryY,
|
||
frameWight*factoryX,
|
||
(GLB_LBUT_HEIGHT+GLB_EDGE_HEIGHT)*factoryY);
|
||
ui->buttonRestart->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*1)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonUpdataCancel->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
|
||
ui->frameWarrantBtn->setGeometry(frameLeft*factoryX,
|
||
(frameTop+frameHeight-GLB_LBUT_HEIGHT-GLB_EDGE_HEIGHT)*factoryY,
|
||
frameWight*factoryX,
|
||
(GLB_LBUT_HEIGHT+GLB_EDGE_HEIGHT)*factoryY);
|
||
ui->buttonWarrant->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*1)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonWarrantCancel->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
|
||
ui->frameSpdSelect->setGeometry((frameLeft+25)*factoryX,(frameTop+58)*factoryY,455*factoryX,161*factoryY);
|
||
|
||
// ui->buttonKn1_AccSpd->setSizePolicy();
|
||
QString strSpd = tr("Spd");
|
||
ui->radioButtonSpd_1->setText(strSpd + "1");//速度1
|
||
ui->radioButtonSpd_2->setText(strSpd + "2");//速度2
|
||
ui->radioButtonSpd_3->setText(strSpd + "3");//速度3
|
||
ui->radioButtonSpd_4->setText(strSpd + "4");//速度4
|
||
ui->radioButtonSpd_5->setText(strSpd + "5");//速度5
|
||
|
||
connect(ui->radioButtonSpd_1,SIGNAL(clicked(bool)),this,SLOT(slot_SpdSelect_clicked()));
|
||
connect(ui->radioButtonSpd_2,SIGNAL(clicked(bool)),this,SLOT(slot_SpdSelect_clicked()));
|
||
connect(ui->radioButtonSpd_3,SIGNAL(clicked(bool)),this,SLOT(slot_SpdSelect_clicked()));
|
||
connect(ui->radioButtonSpd_4,SIGNAL(clicked(bool)),this,SLOT(slot_SpdSelect_clicked()));
|
||
connect(ui->radioButtonSpd_5,SIGNAL(clicked(bool)),this,SLOT(slot_SpdSelect_clicked()));
|
||
|
||
connect(ui->buttonKn1_MaxSpd,SIGNAL(clicked(bool)),this,SLOT(slot_buttonSpdParaModify_clicked()));
|
||
connect(ui->buttonKn1_MinSpd,SIGNAL(clicked(bool)),this,SLOT(slot_buttonSpdParaModify_clicked()));
|
||
connect(ui->buttonKn1_AccSpd,SIGNAL(clicked(bool)),this,SLOT(slot_buttonSpdParaModify_clicked()));
|
||
connect(ui->buttonKn2_MaxSpd,SIGNAL(clicked(bool)),this,SLOT(slot_buttonSpdParaModify_clicked()));
|
||
connect(ui->buttonKn2_MinSpd,SIGNAL(clicked(bool)),this,SLOT(slot_buttonSpdParaModify_clicked()));
|
||
connect(ui->buttonKn2_AccSpd,SIGNAL(clicked(bool)),this,SLOT(slot_buttonSpdParaModify_clicked()));
|
||
|
||
ui->frameWorkArea->setGeometry((frameLeft+25)*factoryX,(frameTop+58)*factoryY,455*factoryX,161*factoryY);
|
||
ui->buttonX1->setGeometry(170*factoryX,60*factoryY,70*factoryX,38*factoryY);
|
||
ui->buttonX2->setGeometry(10*factoryX,60*factoryY,70*factoryX,38*factoryY);
|
||
ui->buttonY1->setGeometry(90*factoryX,10*factoryY,70*factoryX,38*factoryY);//y+
|
||
ui->buttonY2->setGeometry(90*factoryX,120*factoryY,70*factoryX,38*factoryY);
|
||
|
||
ui->frameKnifePressure->setGeometry((frameLeft+25)*factoryX,(frameTop+58)*factoryY,455*factoryX,161*factoryY);
|
||
|
||
int btny = 70;
|
||
int btnwidth = 80;
|
||
int btnheight = 38;
|
||
|
||
ui->label_LKPara->setGeometry(10*factoryX,20*factoryY,200*factoryX,btnheight*factoryY);
|
||
ui->buttonLKParaModify->setGeometry(10*factoryX,btny*factoryY,btnwidth*factoryX,btnheight*factoryY);
|
||
ui->buttonLKTest->setGeometry(110*factoryX,btny*factoryY,btnwidth*factoryX,btnheight*factoryY);
|
||
|
||
ui->label_RKPara->setGeometry(260*factoryX,20*factoryY,200*factoryX,btnheight*factoryY);
|
||
ui->buttonRKParaModify->setGeometry(260*factoryX,btny*factoryY,btnwidth*factoryX,btnheight*factoryY);
|
||
ui->buttonRKTest->setGeometry(360*factoryX,btny*factoryY,btnwidth*factoryX,btnheight*factoryY);
|
||
|
||
ui->buttonUp->setGeometry(260*factoryX,btny*factoryY,btnwidth*factoryX,btnheight*factoryY);
|
||
ui->buttonDn->setGeometry(360*factoryX,btny*factoryY,btnwidth*factoryX,btnheight*factoryY);
|
||
|
||
ui->buttonLKParaModify->setText("U1" + tr("Modify"));//U1修改
|
||
ui->buttonLKTest->setText("U1" + tr("Test"));//U1测试
|
||
ui->buttonRKParaModify->setText("U2" + tr("Modify"));//U2修改
|
||
ui->buttonRKTest->setText("U2" + tr("Test"));//U2测试
|
||
|
||
ui->buttonLKParaModify->setStyleSheet(textButtonStyle());
|
||
ui->buttonLKTest->setStyleSheet(textButtonStyle());
|
||
ui->buttonRKParaModify->setStyleSheet(textButtonStyle());
|
||
ui->buttonRKTest->setStyleSheet(textButtonStyle());
|
||
|
||
ui->buttonUp->setStyleSheet(textButtonStyle());
|
||
ui->buttonUp->setText(tr("Up"));//上升
|
||
ui->buttonDn->setStyleSheet(textButtonStyle());
|
||
ui->buttonDn->setText(tr("Down"));//下降
|
||
|
||
ui->label_LKPara->setText("U1:");//U1:
|
||
ui->label_RKPara->setText("U2:");//U2:
|
||
|
||
QFont size = fontSize_L();
|
||
QString pSize = QString::number(size.pointSize() + 5);
|
||
QString style = "QLabel{border-radius:" + borderRadius() + "px;font-size:"+ pSize +"px;font-family:"+ "Microsoft YaHei"+";}";
|
||
|
||
ui->label_LKPara->setStyleSheet(style);
|
||
ui->label_RKPara->setStyleSheet(style);
|
||
|
||
ui->frameFanArea->setGeometry((frameLeft+25)*factoryX,(frameTop+58)*factoryY,455*factoryX,161*factoryY);
|
||
|
||
if(g_emMacType == MACHINE_CUTTINGWALK){
|
||
ui->buttonFanOpen5->setGeometry(70*factoryX,25*factoryY,150*factoryX,80*factoryY);
|
||
ui->buttonFanClose5->setGeometry(250*factoryX,25*factoryY,150*factoryX,80*factoryY);
|
||
ui->buttonFanSet4->setVisible(false);
|
||
ui->buttonFanSet2->setVisible(false);
|
||
ui->buttonFanSet3->setVisible(false);
|
||
ui->buttonFanSet1->setVisible(false);
|
||
ui->buttonFanSet5->setVisible(false);
|
||
}else{
|
||
ui->buttonFanOpen5->setGeometry(270*factoryX,25*factoryY,80*factoryX,38*factoryY);
|
||
ui->buttonFanClose5->setGeometry(370*factoryX,25*factoryY,80*factoryX,38*factoryY);
|
||
|
||
int gapx = 80;
|
||
int y = 25;
|
||
int x = 60;
|
||
ui->buttonFanSet4->setGeometry((x)*factoryX,y*factoryY,70*factoryX,38*factoryY);
|
||
ui->buttonFanSet2->setGeometry((x+=gapx)*factoryX,y*factoryY,70*factoryX,38*factoryY);
|
||
y+=45;
|
||
x = 60;
|
||
ui->buttonFanSet3->setGeometry(x*factoryX,y*factoryY,70*factoryX,38*factoryY);
|
||
ui->buttonFanSet1->setGeometry((x+=gapx)*factoryX,y*factoryY,70*factoryX,38*factoryY);
|
||
ui->buttonFanSet5->setGeometry((270)*factoryX,y*factoryY,80*factoryX,38*factoryY);
|
||
}
|
||
|
||
connect(ui->buttonFanOpen5,SIGNAL(clicked(bool)),this,SLOT(slot_FanArea_clicked()));
|
||
connect(ui->buttonFanClose5,SIGNAL(clicked(bool)),this,SLOT(slot_FanArea_clicked()));
|
||
connect(ui->buttonFanSet1,SIGNAL(clicked(bool)),this,SLOT(slot_FanArea_clicked()));
|
||
connect(ui->buttonFanSet2,SIGNAL(clicked(bool)),this,SLOT(slot_FanArea_clicked()));
|
||
connect(ui->buttonFanSet3,SIGNAL(clicked(bool)),this,SLOT(slot_FanArea_clicked()));
|
||
connect(ui->buttonFanSet4,SIGNAL(clicked(bool)),this,SLOT(slot_FanArea_clicked()));
|
||
connect(ui->buttonFanSet5,SIGNAL(clicked(bool)),this,SLOT(slot_FanArea_clicked()));
|
||
ui->buttonFanOpen5->setText(tr("Ctrl Open"));//控制开启
|
||
ui->buttonFanClose5->setText(tr("Ctrl Close"));//控制关闭
|
||
ui->buttonFanClose5->setStyleSheet(textButtonStyle());
|
||
ui->buttonFanOpen5->setStyleSheet(textButtonStyle());
|
||
|
||
//主轴角度旋转
|
||
ui->frameSpindleRotate->setGeometry(180*factoryX,178*factoryY,440*factoryX,161*factoryY);
|
||
ui->labelSpindleAngle->setGeometry(150*factoryX,112*factoryY,120*factoryX,40*factoryY);
|
||
ui->buttonSpindleAngleValue->setGeometry(275*factoryX,110*factoryY,78*factoryX,40*factoryY);
|
||
ui->labelSpindleAngleUnit->setGeometry(364*factoryX,112*factoryY,91*factoryX,40*factoryY);
|
||
|
||
//界面解密
|
||
ui->frameHMIDecrypt->setGeometry(40*factoryX,78*factoryY,440*factoryX,161*factoryY);
|
||
ui->labelNetworkCardID->setGeometry(10*factoryX,12*factoryY,110*factoryX,40*factoryY);
|
||
ui->labelNetworkCardIDValue->setGeometry(130*factoryX,12*factoryY,200*factoryX,40*factoryY);
|
||
ui->labelHMIPassword->setGeometry(10*factoryX,52*factoryY,110*factoryX,40*factoryY);
|
||
ui->buttonHMIPassword->setGeometry(130*factoryX,50*factoryY,200*factoryX,40*factoryY);
|
||
ui->labelDecryptInfo->setGeometry(10*factoryX,92*factoryY,110*factoryX,40*factoryY);
|
||
ui->labelDecryptInfoValue->setGeometry(130*factoryX,92*factoryY,200*factoryX,40*factoryY);
|
||
|
||
//修改一级密码
|
||
ui->frameChangePassword->setGeometry(0*factoryX,78*factoryY,440*factoryX,161*factoryY);
|
||
ui->labelNewPassword->setGeometry(0*factoryX,0*factoryY,140*factoryX,GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonNewPassword->setGeometry(180*factoryX,0*factoryY,200*factoryX,GLB_LBUT_HEIGHT*factoryY);
|
||
ui->labelConfirmPassword->setGeometry(0*factoryX,52*factoryY,140*factoryX,GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonConfirmPassword->setGeometry(180*factoryX,52*factoryY,200*factoryX,GLB_LBUT_HEIGHT*factoryY);
|
||
|
||
ui->frameThree->setGeometry(frameLeft*factoryX,
|
||
(frameTop+frameHeight-GLB_LBUT_HEIGHT-GLB_EDGE_HEIGHT)*factoryY,
|
||
frameWight*factoryX,
|
||
(GLB_LBUT_HEIGHT+GLB_EDGE_HEIGHT)*factoryY);
|
||
ui->buttonRename->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*2)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonReplace->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*1)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonSkip->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonOverWrite->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*2)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonSaveAs->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*1)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonClose->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
|
||
ui->frameDetecBtn->setGeometry(frameLeft*factoryX,
|
||
(frameTop+frameHeight-GLB_LBUT_HEIGHT-GLB_EDGE_HEIGHT)*factoryY,
|
||
frameWight*factoryX,
|
||
(GLB_LBUT_HEIGHT+GLB_EDGE_HEIGHT)*factoryY);
|
||
ui->buttonDetectBegin->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*2)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonDetectEnd->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT-(GLB_BAS_WIGHT+GLB_LBUT_WIGHT)*1)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
ui->buttonDetectClose->setGeometry((frameWight-GLB_EDGE_WIGHT-GLB_LBUT_WIGHT)*factoryX,
|
||
0*factoryY,
|
||
GLB_LBUT_WIGHT*factoryX,
|
||
GLB_LBUT_HEIGHT*factoryY);
|
||
|
||
ui->frame_Force->setGeometry(256*factoryX,188*factoryY,512*factoryX,200*factoryY);
|
||
ui->pushButton_collect->setGeometry(104*factoryX,24*factoryY,98*factoryX,48*factoryY);
|
||
ui->pushButton_collect_bit->setGeometry(20*factoryX,24*factoryY,70*factoryX,48*factoryY);
|
||
ui->pushButton_test->setGeometry(310*factoryX,24*factoryY,98*factoryX,48*factoryY);
|
||
ui->pushButton_Pre->setGeometry(52*factoryX,100*factoryY,48*factoryX,64*factoryY);
|
||
ui->pushButton_Next->setGeometry(206*factoryX,100*factoryY,48*factoryX,64*factoryY);
|
||
ui->pushButton_Blade->setGeometry(104*factoryX,100*factoryY,98*factoryX,64*factoryY);
|
||
ui->pushButton_BValue->setGeometry(310*factoryX,100*factoryY,98*factoryX,64*factoryY);
|
||
|
||
ui->frame_KnifeAndPenSd->setGeometry(256*factoryX,188*factoryY,512*factoryX,200*factoryY);
|
||
ui->label_SpdPen->setGeometry(20*factoryX,10*factoryY,482*factoryX,30*factoryY);
|
||
ui->label_SpdKnife->setGeometry(20*factoryX,110*factoryY,482*factoryX,30*factoryY);
|
||
ui->frame_Pen->setGeometry(0*factoryX,0*factoryY,512*factoryX,100*factoryY);
|
||
ui->frame_Knife->setGeometry(0*factoryX,100*factoryY,512*factoryX,100*factoryY);
|
||
ui->radioButton_KMax->setGeometry(80*factoryX,50*factoryY,80*factoryX,40*factoryY);
|
||
ui->radioButton_KMid->setGeometry(230*factoryX,50*factoryY,80*factoryX,40*factoryY);
|
||
ui->radioButton_KMin->setGeometry(380*factoryX,50*factoryY,80*factoryX,40*factoryY);
|
||
ui->radioButton_PMax->setGeometry(80*factoryX,50*factoryY,80*factoryX,40*factoryY);
|
||
ui->radioButton_PMid->setGeometry(230*factoryX,50*factoryY,80*factoryX,40*factoryY);
|
||
ui->radioButton_PMin->setGeometry(380*factoryX,50*factoryY,80*factoryX,40*factoryY);
|
||
|
||
ui->frame_FileTransfer->setGeometry(256*factoryX,188*factoryY,512*factoryX,200*factoryY);
|
||
ui->button_USB->setGeometry(100*factoryX,64*factoryY,106*factoryX,68*factoryY);
|
||
ui->button_Local->setGeometry(306*factoryX,64*factoryY,106*factoryX,68*factoryY);
|
||
|
||
ui->frameWorkHeadSet->setGeometry(216*factoryX,158*factoryY,512*factoryX,200*factoryY);
|
||
ui->check_WorkHead_1->setGeometry(100*factoryX,64*factoryY,106*factoryX,68*factoryY);
|
||
ui->check_WorkHead_2->setGeometry(286*factoryX,64*factoryY,106*factoryX,68*factoryY);
|
||
|
||
}
|
||
|
||
//初始化窗体控件样式
|
||
void PromptDialog::initControlStyle()
|
||
{
|
||
SetStyle setControlStyle;
|
||
setControlStyle.setUiName(this->objectName());
|
||
|
||
//设置控件图标
|
||
//背景图
|
||
this->setStyleSheet(titleTextColour());
|
||
ui->frameBack->setStyleSheet(setControlStyle.getStyleSheet(this->objectName()));
|
||
if(g_emTheme == theme2)
|
||
{
|
||
ui->labelTitle->setStyleSheet(titleTextColour2());
|
||
}else
|
||
{
|
||
ui->labelTitle->setStyleSheet(transparentStyle());
|
||
}
|
||
ui->labelTitle->setFont(fontSize_L());
|
||
ui->labelTitle->setAlignment(Qt::AlignLeft);
|
||
ui->labelTitle->setAlignment(Qt::AlignVCenter);
|
||
|
||
ui->frameProcess->setStyleSheet(transparentStyle());
|
||
ui->progressBar->setFont(fontSize_M());
|
||
|
||
ui->labelContent->setStyleSheet(warnTextColour());
|
||
ui->labelContent->setFont(fontSize_L());
|
||
ui->labelContent->setAlignment(Qt::AlignLeft);
|
||
ui->labelContent->setAlignment(Qt::AlignVCenter);
|
||
|
||
ui->labeBreakHead->setStyleSheet(warnTextColour()); // 断线机头 红色 字体加大 -rq
|
||
ui->labeBreakHead->setFont(fontSize_L());
|
||
ui->labeBreakHead->setAlignment(Qt::AlignLeft);
|
||
ui->labeBreakHead->setAlignment(Qt::AlignVCenter);
|
||
|
||
ui->labelContentInfo->setStyleSheet(warnTextColour());
|
||
ui->labelContentInfo->setFont(fontSize_M());
|
||
ui->labelContentInfo->setAlignment(Qt::AlignLeft);
|
||
ui->labelContentInfo->setAlignment(Qt::AlignVCenter);
|
||
|
||
ui->labelContentProcess->setStyleSheet(numButtonStyle());
|
||
|
||
ui->labelContentProcess->setFont(fontSize_M());
|
||
ui->labelContentProcess->setAlignment(Qt::AlignLeft);
|
||
ui->labelContentProcess->setAlignment(Qt::AlignVCenter);
|
||
|
||
ui->labelContentWarrant->setStyleSheet(warnTextColour());
|
||
ui->labelContentWarrant->setFont(fontSize_M());
|
||
ui->labelContentWarrant->setAlignment(Qt::AlignLeft);
|
||
ui->labelContentWarrant->setAlignment(Qt::AlignVCenter);
|
||
|
||
ui->frameTwo->setStyleSheet(transparentStyle());
|
||
ui->buttonOk->setStyleSheet(confirmIconStyle());
|
||
ui->buttonCancel->setStyleSheet(confirmIconStyle());
|
||
if(g_emTheme == theme2)
|
||
{
|
||
ui->buttonOk->setTopImage(setControlStyle.getSharedTopStyleSheet("buttonOk_1"));
|
||
ui->buttonCancel->setTopImage(setControlStyle.getSharedTopStyleSheet("buttonCancel_1"));
|
||
}else
|
||
{
|
||
ui->buttonOk->setTopImage(setControlStyle.getSharedTopStyleSheet("buttonOk"));
|
||
ui->buttonCancel->setTopImage(setControlStyle.getSharedTopStyleSheet("buttonCancel"));
|
||
}
|
||
|
||
ui->buttonOverWrite->setStyleSheet(confirmIconStyle());
|
||
ui->buttonSaveAs->setStyleSheet(confirmIconStyle());
|
||
ui->buttonClose->setStyleSheet(confirmIconStyle());
|
||
ui->buttonOverWrite->setTopImage(setControlStyle.getSharedTopStyleSheet("buttonOk"));
|
||
ui->buttonSaveAs->setTopImage(setControlStyle.getSharedTopStyleSheet(ui->buttonSaveAs->objectName()));
|
||
ui->buttonClose->setTopImage(setControlStyle.getSharedTopStyleSheet("buttonCancel"));
|
||
|
||
ui->buttonForward->setBottomImage(setControlStyle.getSharedBottomStyleSheet("frameBtn"));
|
||
ui->buttonForward->setTopImage(setControlStyle.getSharedTopStyleSheet(ui->buttonForward->objectName()));
|
||
ui->buttonReverse->setBottomImage(setControlStyle.getSharedBottomStyleSheet("frameBtn"));
|
||
ui->buttonReverse->setTopImage(setControlStyle.getSharedTopStyleSheet(ui->buttonReverse->objectName()));
|
||
|
||
ui->frameThree->setStyleSheet(transparentStyle());
|
||
ui->buttonRename->setBottomImage(setControlStyle.getSharedBottomStyleSheet("frameBtn"));
|
||
ui->buttonReplace->setBottomImage(setControlStyle.getSharedBottomStyleSheet("frameBtn"));
|
||
ui->buttonSkip->setBottomImage(setControlStyle.getSharedBottomStyleSheet("frameBtn"));
|
||
ui->buttonRename->setTopImage(setControlStyle.getTopStyleSheet(ui->buttonRename->objectName()));
|
||
ui->buttonReplace->setTopImage(setControlStyle.getTopStyleSheet(ui->buttonReplace->objectName()));
|
||
ui->buttonSkip->setTopImage(setControlStyle.getTopStyleSheet(ui->buttonSkip->objectName()));
|
||
|
||
ui->frameDetecBtn->setStyleSheet(transparentStyle());
|
||
ui->buttonDetectBegin->setBottomImage(setControlStyle.getSharedBottomStyleSheet("frameBtn"));
|
||
ui->buttonDetectBegin->setTopImage(setControlStyle.getTopStyleSheet(ui->buttonDetectBegin->objectName()));
|
||
ui->buttonDetectEnd->setBottomImage(setControlStyle.getSharedBottomStyleSheet("frameBtn"));
|
||
ui->buttonDetectEnd->setTopImage(setControlStyle.getTopStyleSheet(ui->buttonDetectEnd->objectName()));
|
||
ui->buttonDetectClose->setBottomImage(setControlStyle.getSharedBottomStyleSheet("frameBtn"));
|
||
ui->buttonDetectClose->setTopImage(setControlStyle.getSharedTopStyleSheet(ui->buttonCancel->objectName()+"_1"));
|
||
|
||
ui->frameProcessBtn->setStyleSheet(transparentStyle());
|
||
ui->buttonRestart->setBottomImage(setControlStyle.getSharedBottomStyleSheet("frameBtn"));
|
||
ui->buttonRestart->setTopImage(setControlStyle.getTopStyleSheet(ui->buttonRestart->objectName()));
|
||
ui->buttonUpdataCancel->setBottomImage(setControlStyle.getSharedBottomStyleSheet("frameBtn"));
|
||
ui->buttonUpdataCancel->setTopImage(setControlStyle.getSharedTopStyleSheet(ui->buttonCancel->objectName()+"_1"));
|
||
|
||
//设置可工作区域
|
||
ui->frameWorkArea->setStyleSheet(transparentStyle());
|
||
ui->buttonX1->setFont(fontSize_M());
|
||
ui->buttonX2->setFont(fontSize_M());
|
||
ui->buttonY1->setFont(fontSize_M());
|
||
ui->buttonY2->setFont(fontSize_M());
|
||
|
||
ui->frameKnifePressure->setStyleSheet(transparentStyle());
|
||
|
||
ui->frameFanArea->setStyleSheet(transparentStyle());
|
||
ui->frameSpdSelect->setStyleSheet(transparentStyle());
|
||
|
||
ui->buttonKn1_MaxSpd->setStyleSheet(flippingStyle());
|
||
ui->buttonKn1_MinSpd->setStyleSheet(flippingStyle());
|
||
ui->buttonKn1_AccSpd->setStyleSheet(flippingStyle());
|
||
|
||
ui->buttonKn2_MaxSpd->setStyleSheet(flippingStyle());
|
||
ui->buttonKn2_MinSpd->setStyleSheet(flippingStyle());
|
||
ui->buttonKn2_AccSpd->setStyleSheet(flippingStyle());
|
||
|
||
//主轴角度旋转
|
||
ui->frameSpindleRotate->setStyleSheet(transparentStyle());
|
||
ui->labelSpindleAngle->setStyleSheet(titleTextColour());
|
||
ui->labelSpindleAngle->setFont(fontSize_M());
|
||
ui->labelSpindleAngleUnit->setStyleSheet(titleTextColour());
|
||
ui->labelSpindleAngleUnit->setFont(fontSize_M());
|
||
ui->buttonSpindleAngleValue->setFont(fontSize_M());
|
||
|
||
//界面解密
|
||
ui->frameHMIDecrypt->setStyleSheet(transparentStyle());
|
||
ui->labelNetworkCardID->setStyleSheet(titleTextColour());
|
||
ui->labelNetworkCardID->setFont(fontSize_M());
|
||
ui->labelNetworkCardIDValue->setStyleSheet(titleTextColour());
|
||
ui->labelNetworkCardIDValue->setFont(fontSize_M());
|
||
ui->labelHMIPassword->setStyleSheet(titleTextColour());
|
||
ui->labelHMIPassword->setFont(fontSize_M());
|
||
ui->buttonHMIPassword->setFont(fontSize_M());
|
||
ui->labelDecryptInfo->setStyleSheet(titleTextColour());
|
||
ui->labelDecryptInfo->setFont(fontSize_M());
|
||
ui->labelDecryptInfoValue->setStyleSheet(titleTextColour());
|
||
ui->labelDecryptInfoValue->setFont(fontSize_M());
|
||
|
||
//修改一级密码
|
||
ui->frameChangePassword->setStyleSheet(transparentStyle());
|
||
ui->labelNewPassword->setStyleSheet(titleTextColour());
|
||
ui->labelNewPassword->setFont(fontSize_M());
|
||
ui->labelConfirmPassword->setStyleSheet(titleTextColour());
|
||
ui->labelConfirmPassword->setFont(fontSize_M());
|
||
ui->buttonNewPassword->setFont(fontSize_M());
|
||
ui->buttonConfirmPassword->setFont(fontSize_M());
|
||
|
||
ui->frameWarrantBtn->setStyleSheet(transparentStyle());
|
||
ui->buttonWarrant->setStyleSheet(confirmIconStyle());
|
||
ui->buttonWarrantCancel->setStyleSheet(confirmIconStyle());
|
||
ui->buttonWarrant->setTopImage(setControlStyle.getSharedTopStyleSheet("buttonOk_1"));
|
||
ui->buttonWarrantCancel->setTopImage(setControlStyle.getSharedTopStyleSheet("buttonCancel_1"));
|
||
|
||
//铣切机--刀压设置
|
||
ui->frame_Force->setStyleSheet(transparentStyle());
|
||
ui->pushButton_collect->setFont(fontSize_M());
|
||
ui->pushButton_collect_bit->setFont(fontSize_M());
|
||
ui->pushButton_test->setFont(fontSize_M());
|
||
ui->pushButton_collect->setStyleSheet(confirmIconStyle());
|
||
ui->pushButton_collect_bit->setStyleSheet(confirmIconStyle());
|
||
ui->pushButton_test->setStyleSheet(confirmIconStyle());
|
||
ui->pushButton_Blade->setFont(fontSize_L());
|
||
ui->pushButton_BValue->setFont(fontSize_L());
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle4());
|
||
ui->pushButton_BValue->setStyleSheet(confirmIconStyle());
|
||
ui->pushButton_Pre->setText("");
|
||
ui->pushButton_Next->setText("");
|
||
ui->pushButton_Pre->setRevDirectionButtonStyle();
|
||
ui->pushButton_Next->setRevDirectionButtonStyle();
|
||
ui->pushButton_Pre->setTopImage(setControlStyle.getSharedTopStyleSheet(ui->pushButton_Pre->objectName()));
|
||
ui->pushButton_Next->setTopImage(setControlStyle.getSharedTopStyleSheet(ui->pushButton_Next->objectName()));
|
||
|
||
//文件传输方式选择
|
||
ui->frame_FileTransfer->setStyleSheet(transparentStyle());
|
||
ui->button_Local->setStyleSheet(confirmIconStyle());
|
||
ui->button_USB->setStyleSheet(confirmIconStyle());
|
||
ui->button_Local->setFont(fontSize_M());
|
||
ui->button_USB->setFont(fontSize_M());
|
||
|
||
// QPixmap p(32, 32)
|
||
ui->frameWorkHeadSet->setStyleSheet(transparentStyle());
|
||
ui->check_WorkHead_1->setFont(fontSize_M());
|
||
ui->check_WorkHead_1->setStyleSheet(R"(
|
||
QCheckBox::indicator {
|
||
background-color: white; /* 白色背景 */
|
||
width: 25px; /* 原默认约16px,按需调整(如24/32px) */
|
||
height: 25px;
|
||
margin-right: 0px; /* 可选:调整勾选框与文本的间距(适配原生布局) */
|
||
}
|
||
QCheckBox::indicator:checked {
|
||
image: url(:/images/MainWidget/checked.png); /* 替换为你的√图片路径 */
|
||
width: 25px; /* 图片宽度(与原生复选框尺寸匹配更佳) */
|
||
height: 25px; /* 图片高度 */
|
||
border: none; /* 去掉可能的额外边框,避免与原生样式冲突 */
|
||
}
|
||
)");
|
||
|
||
ui->check_WorkHead_2->setStyleSheet(R"(
|
||
QCheckBox::indicator {
|
||
background-color: white; /* 白色背景 */
|
||
width: 25px; /* 原默认约16px,按需调整(如24/32px) */
|
||
height: 25px;
|
||
margin-right: 0px; /* 可选:调整勾选框与文本的间距(适配原生布局) */
|
||
}
|
||
QCheckBox::indicator:checked {
|
||
image: url(:/images/MainWidget/checked.png); /* 替换为你的√图片路径 */
|
||
width: 25px; /* 图片宽度(与原生复选框尺寸匹配更佳) */
|
||
height: 25px; /* 图片高度 */
|
||
border: none; /* 去掉可能的额外边框,避免与原生样式冲突 */
|
||
}
|
||
)");
|
||
|
||
ui->check_WorkHead_2->setFont(fontSize_M());
|
||
}
|
||
|
||
///
|
||
/// \brief 刷新显示
|
||
///
|
||
void PromptDialog::refreshMcPara()
|
||
{
|
||
ParaStruct mcPara = g_pMachine->getMcPara();
|
||
//刀压测试
|
||
int LkHeight = 0;
|
||
int RkHeight = 0;
|
||
double Lkdouble = 0;
|
||
double Rkdouble = 0;
|
||
|
||
// 刀座1安装刀类型选择 0,无 1,圆刀 2,震刀 3,铣刀 4,偏心刀1 5,偏心刀2 6,画笔 7,尖刀 8,钻孔 9,压轮
|
||
if (mcPara.buf[10] == 1)
|
||
{//1,圆刀
|
||
LkHeight = mcPara.buf[87];
|
||
}
|
||
else if (mcPara.buf[10] == 2)
|
||
{//2,震刀
|
||
LkHeight = mcPara.buf[90];
|
||
}
|
||
else if (mcPara.buf[10] == 3)
|
||
{//3,铣刀
|
||
LkHeight = mcPara.buf[93];
|
||
}
|
||
else if (mcPara.buf[10] == 4)
|
||
{//4,偏心刀1
|
||
LkHeight = mcPara.buf[96];
|
||
}
|
||
else if (mcPara.buf[10] == 5)
|
||
{//5,偏心刀2
|
||
LkHeight = mcPara.buf[98];
|
||
}
|
||
else if (mcPara.buf[10] == 7)
|
||
{//7,尖刀
|
||
LkHeight = mcPara.buf[105];
|
||
}
|
||
else if (mcPara.buf[10] == 8)
|
||
{//8,钻孔
|
||
LkHeight = mcPara.buf[103];
|
||
}
|
||
else if (mcPara.buf[10] == 9)
|
||
{//9,压轮
|
||
LkHeight = mcPara.buf[100];
|
||
}
|
||
else
|
||
{//
|
||
LkHeight = 0;
|
||
}
|
||
|
||
// 刀座2安装刀类型选择 0,无 1,圆刀 2,震刀 3,铣刀 4,偏心刀1 5,偏心刀2 6,画笔 7,尖刀 8,钻孔 9,压轮
|
||
if (mcPara.buf[11] == 1)
|
||
{//1,圆刀
|
||
RkHeight = mcPara.buf[87];
|
||
}
|
||
else if (mcPara.buf[11] == 2)
|
||
{//2,震刀
|
||
RkHeight = mcPara.buf[90];
|
||
}
|
||
else if (mcPara.buf[11] == 3)
|
||
{//3,铣刀
|
||
RkHeight = mcPara.buf[93];
|
||
}
|
||
else if (mcPara.buf[11] == 4)
|
||
{//4,偏心刀1
|
||
RkHeight = mcPara.buf[96];
|
||
}
|
||
else if (mcPara.buf[11] == 5)
|
||
{//5,偏心刀2
|
||
RkHeight = mcPara.buf[98];
|
||
}
|
||
else if (mcPara.buf[11] == 7)
|
||
{//7,尖刀
|
||
RkHeight = mcPara.buf[105];
|
||
}
|
||
else if (mcPara.buf[11] == 8)
|
||
{//8,钻孔
|
||
RkHeight = mcPara.buf[103];
|
||
}
|
||
else if (mcPara.buf[11] == 9)
|
||
{//9,压轮
|
||
RkHeight = mcPara.buf[100];
|
||
}
|
||
else
|
||
{//
|
||
RkHeight = 0;
|
||
}
|
||
|
||
Lkdouble = LkHeight;
|
||
Rkdouble = RkHeight;
|
||
|
||
ui->label_LKPara->setText(("U1:") + QString::number(Lkdouble/100,'f',2));//U1:
|
||
ui->label_RKPara->setText(("U2:") + QString::number(Rkdouble/100,'f',2));//U2:
|
||
}
|
||
|
||
using namespace std;
|
||
void PromptDialog::refreshWkPara()
|
||
{
|
||
ParaStruct wkPara = g_pMachine->getWkPara();
|
||
//单独吸附区域
|
||
bitset<32> intbit(wkPara.buf[83]);
|
||
|
||
btnDisplay(ui->buttonFanSet1,intbit.test(0),"1");
|
||
btnDisplay(ui->buttonFanSet2,intbit.test(1),"2");
|
||
btnDisplay(ui->buttonFanSet3,intbit.test(2),"3");
|
||
btnDisplay(ui->buttonFanSet4,intbit.test(3),"4");
|
||
|
||
//手动自动
|
||
bitset<32> intbit2(wkPara.buf[102]);
|
||
if(intbit2.test(0))
|
||
ui->buttonFanSet5->setText(tr("Auto"));//自动
|
||
else
|
||
ui->buttonFanSet5->setText(tr("Manual"));//手动
|
||
}
|
||
|
||
void PromptDialog::btnDisplay(MyButton *btn, bool isTrue,QString str)
|
||
{
|
||
if(isTrue)
|
||
{
|
||
btn->setText(str + tr("Opened"));//已开启
|
||
btn->setStyleSheet(flippingStyle());
|
||
}
|
||
else
|
||
{
|
||
btn->setText(str + tr("Closed"));//已关闭
|
||
btn->setStyleSheet(confirmIconStyle());
|
||
}
|
||
}
|
||
|
||
//设置标题
|
||
void PromptDialog::setTitleStr(QString str)
|
||
{
|
||
ui->labelTitle->setText(str);
|
||
}
|
||
|
||
//设置断线机头字体颜色
|
||
void PromptDialog::setStrColor(QString str)
|
||
{
|
||
ui->frameProcess->hide();
|
||
ui->labelContentInfo->setText("");
|
||
ui->labelContentInfo->hide();
|
||
ui->labelContentWarrant->setText("");
|
||
ui->labelContentWarrant->hide();
|
||
ui->labelContent->setText("");
|
||
ui->labelContent->hide();
|
||
ui->labeBreakHead->setText(str);
|
||
ui->labeBreakHead->show();
|
||
}
|
||
|
||
//设置显示内容
|
||
void PromptDialog::setContentStr(QString str)
|
||
{
|
||
ui->frameProcess->hide();
|
||
ui->labelContentInfo->setText("");
|
||
ui->labelContentInfo->hide();
|
||
ui->labeBreakHead->setText("");//断线机头显示
|
||
ui->labeBreakHead->hide();
|
||
ui->labelContentWarrant->setText("");
|
||
ui->labelContentWarrant->hide();
|
||
ui->labelContent->setText(str);
|
||
ui->labelContent->show();
|
||
}
|
||
|
||
void PromptDialog::setContentProcessStr(QString str)
|
||
{
|
||
ui->frameProcess->show();
|
||
ui->labelContentInfo->setText("");
|
||
ui->labelContentInfo->hide();
|
||
ui->labeBreakHead->setText("");//断线机头显示
|
||
ui->labeBreakHead->hide();
|
||
ui->labelContent->setText("");
|
||
ui->labelContent->hide();
|
||
ui->labelContentWarrant->setText("");
|
||
ui->labelContentWarrant->hide();
|
||
ui->labelContentProcess->show();
|
||
ui->labelContentProcess->setText(str);
|
||
}
|
||
|
||
void PromptDialog::setContentInfoShow()
|
||
{
|
||
ui->labelContent->hide();
|
||
ui->labeBreakHead->hide();
|
||
ui->frameProcess->hide();
|
||
ui->labelContentWarrant->hide();
|
||
ui->labelContentInfo->show();
|
||
ui->labelContentInfo->raise();
|
||
}
|
||
|
||
void PromptDialog::setContentWarrantShow()
|
||
{
|
||
ui->labelContent->hide();
|
||
ui->labeBreakHead->hide();
|
||
ui->frameProcess->hide();
|
||
ui->labelContentInfo->hide();
|
||
ui->labelContentWarrant->show();
|
||
}
|
||
|
||
void PromptDialog::setContentHMIDecryptShow(QString id)
|
||
{
|
||
//将id中的冒号去掉
|
||
QStringList strlist = id.split(":", QString::SkipEmptyParts);
|
||
QString nId;
|
||
nId.clear();
|
||
for(int i = 0; i < strlist.size(); i++)
|
||
{
|
||
nId += strlist[i];
|
||
}
|
||
ui->labelNetworkCardIDValue->setText(nId);
|
||
ui->buttonHMIPassword->setText("");
|
||
|
||
QDir apppath(qApp->applicationDirPath());
|
||
QString HMIDecryptConfigfile;
|
||
HMIDecryptConfigfile = apppath.path() + apppath.separator() + "HMIDecryptConfig.ini";
|
||
QSettings iniSetting(HMIDecryptConfigfile, QSettings::IniFormat);
|
||
int decryptFlag = iniSetting.value("HMIDecrypt/ifdecrypt").toInt();
|
||
QFile iniFile(HMIDecryptConfigfile);
|
||
if(decryptFlag != 0 || !iniFile.exists())//等于1或者配置文件不存在
|
||
{
|
||
ui->labelDecryptInfoValue->setText("HMI decrypted");//界面已解密
|
||
}
|
||
else
|
||
{
|
||
ui->labelDecryptInfoValue->setText("HMI unresolved");//界面未解密
|
||
}
|
||
|
||
ui->buttonOk->setEnabled(false);
|
||
}
|
||
|
||
void PromptDialog::setContentChangePasswordShow()//修改一级用户密码内容显示
|
||
{
|
||
ui->buttonNewPassword->setText("");
|
||
ui->buttonConfirmPassword->setText("");
|
||
ui->buttonOk->setEnabled(false);
|
||
}
|
||
|
||
void PromptDialog::setValue(int progress)
|
||
{
|
||
ui->progressBar->setValue(progress);
|
||
}
|
||
|
||
void PromptDialog::setButtonUCancelStr(QString str)
|
||
{
|
||
ui->buttonUpdataCancel->setText(str);
|
||
}
|
||
|
||
void PromptDialog::setRange(int minimum, int maximum)
|
||
{
|
||
ui->progressBar->setRange(minimum,maximum);
|
||
}
|
||
|
||
QString PromptDialog::getNetworkCardID()
|
||
{
|
||
return ui->labelNetworkCardIDValue->text();
|
||
}
|
||
|
||
QString PromptDialog::getInputPassword()
|
||
{
|
||
return ui->buttonHMIPassword->text();
|
||
}
|
||
|
||
void PromptDialog::slotMCInfoChange()
|
||
{
|
||
QString strInfo;
|
||
MCInfo info;//机器信息
|
||
char softwareVerStr[48+1];//软件版本
|
||
char mBoardVerStr[16+1];//主板(n1)板卡版本
|
||
char exBoardVerStr[16+1];//主板(n1-1)板卡版本
|
||
char buildInfoStr[32+1];//编译日期信息
|
||
|
||
info = g_pMachine->getMcInfo();
|
||
memcpy(softwareVerStr, info.softwareVerStr, 48);
|
||
memcpy(mBoardVerStr, info.mBoardVerStr, 16);
|
||
memcpy(exBoardVerStr, info.exBoardVerStr, 16);
|
||
memcpy(buildInfoStr, info.buildInfoStr, 32);
|
||
|
||
softwareVerStr[48] = 0;
|
||
mBoardVerStr[16]= 0;
|
||
exBoardVerStr[16]= 0;
|
||
buildInfoStr[32]=0;
|
||
|
||
QString strBoardVer;
|
||
strBoardVer.sprintf("%s", softwareVerStr);
|
||
|
||
QString strMBoardVer;
|
||
strMBoardVer.sprintf("%s", mBoardVerStr);
|
||
|
||
QString strExBoardVer;
|
||
strExBoardVer.sprintf("%s", exBoardVerStr);
|
||
|
||
QString strBuildInfo;
|
||
strBuildInfo.sprintf("%s", buildInfoStr);
|
||
|
||
|
||
strInfo += tr("Board:") + " " + strBoardVer + "\n"+
|
||
strBuildInfo+ "\n" +
|
||
strMBoardVer + "\n" +
|
||
strExBoardVer + "\n" ;
|
||
|
||
QString verInfo = "\n" + strInfo;
|
||
ui->labelContentInfo->setText(verInfo);
|
||
|
||
//连接多块主板也是从g_pMachine[0](第一块)获取软件授权信息
|
||
MCStatus mcStatus;
|
||
mcStatus = g_pMachine->getMcStatus(); //读的一个主板的可工作时间计数器(分钟)
|
||
|
||
MCInfo infoID;//机器信息
|
||
infoID = g_pMachine->getMcInfo();
|
||
|
||
QString IDStr(infoID.boardId);
|
||
if(IDStr.indexOf(":") != -1)
|
||
{
|
||
QStringList list = IDStr.split(":");
|
||
IDStr = list.at(1);
|
||
}
|
||
|
||
QString passwordStr(infoID.installment);
|
||
if(passwordStr.indexOf(":") != -1)
|
||
{
|
||
QStringList list = passwordStr.split(":");
|
||
passwordStr = list.at(1);
|
||
}
|
||
|
||
int time = mcStatus.workableTimer;//只在上电的时候读取
|
||
QString timeStr;
|
||
if( time > TIMELIMITMIN && time < TIMELIMITMAX)
|
||
{
|
||
timeStr = (tr("Unlimited time")); // 无时间限制
|
||
}
|
||
if(time <= 0)
|
||
{
|
||
timeStr = (tr("Time has run out")); // 时间已用完
|
||
}
|
||
if(time > 0 && time < TIMELIMITMIN)
|
||
{
|
||
QString strDay;
|
||
QString strHour;
|
||
QString strSec;
|
||
|
||
strDay = QString::number(time/(60 *24) , 10);
|
||
strHour = QString::number((time%(60 *24))/60 , 10) ;
|
||
strSec = QString::number(time%60 , 10);
|
||
|
||
timeStr = strDay + " " + tr("Day") + " " + strHour + " " + tr("Hour") + " " + strSec + " " + tr("Minutes") ; // 天 小时 分钟
|
||
}
|
||
|
||
QString strBoardInfo;
|
||
strBoardInfo = QString(tr("ID: %1\n")).arg(IDStr);
|
||
strBoardInfo += QString(tr("Password: %1\n")).arg(passwordStr);
|
||
strBoardInfo += QString(tr("Time: %1")).arg(timeStr);
|
||
ui->labelContentWarrant->setText(strBoardInfo);
|
||
}
|
||
|
||
void PromptDialog::on_buttonOk_clicked()
|
||
{
|
||
if(m_funType == BTN_SPINDLE_ROTATE)
|
||
{
|
||
emit siSpindleRotate(m_spindleAngle);
|
||
done(0);
|
||
}
|
||
else if(m_funType == BTN_ROTATE_ROTATE)
|
||
{
|
||
emit siRotateRotate(m_spindleAngle);
|
||
done(0);
|
||
}
|
||
else if(m_funType == BTN_AUTOMATIC_PULLMA)
|
||
{
|
||
emit siAutoPull(m_length);
|
||
done(0);
|
||
}
|
||
else if(m_funType == BTN_SPINDLE_GRANDE)
|
||
{
|
||
emit siSpindleTime(m_time,m_speed);
|
||
done(0);
|
||
}
|
||
else if(m_funType == BTN_SPD_SELECT)
|
||
{
|
||
done(0);
|
||
}
|
||
else if(m_funType == BTN_FORCE)
|
||
{
|
||
done(0);
|
||
}
|
||
if(m_funType == BTN_WORKHEADSET)
|
||
{
|
||
unsigned int data1 = 0, data2 = 0, data = 0;
|
||
//int readValue = /* 你的读数,假设 ≥ 0 */;
|
||
data1 |= (1U << 0); // data == 1
|
||
data2 |= (1U << 1);
|
||
data |= 0b11; // 二进制写法
|
||
if (ui->check_WorkHead_1->isChecked() && ui->check_WorkHead_2->isChecked()) //机头12
|
||
{
|
||
g_pMachine->setAMcPara(PARA_HEADSET + 1, data);
|
||
}
|
||
else if (ui->check_WorkHead_1->isChecked()) //机头1
|
||
{
|
||
g_pMachine->setAMcPara(PARA_HEADSET + 1, data1);
|
||
}
|
||
else if (ui->check_WorkHead_2->isChecked()) //机头2
|
||
{
|
||
g_pMachine->setAMcPara(PARA_HEADSET + 1, data2);
|
||
}
|
||
done(0);
|
||
|
||
}
|
||
else
|
||
{
|
||
done(1);
|
||
}
|
||
}
|
||
void PromptDialog::on_buttonCancel_clicked()
|
||
{
|
||
done(0);
|
||
}
|
||
|
||
void PromptDialog::on_buttonRename_clicked()
|
||
{
|
||
done(1);
|
||
}
|
||
|
||
void PromptDialog::on_buttonReplace_clicked()
|
||
{
|
||
done(2);
|
||
}
|
||
|
||
void PromptDialog::on_buttonSkip_clicked()
|
||
{
|
||
done(0);
|
||
}
|
||
|
||
//重启
|
||
void PromptDialog::on_buttonRestart_clicked()
|
||
{
|
||
#ifdef Q_OS_WIN
|
||
qApp->exit();
|
||
#endif
|
||
|
||
#ifdef Q_OS_LINUX
|
||
system("reboot");
|
||
#endif
|
||
}
|
||
|
||
//升级中断
|
||
void PromptDialog::on_buttonUpdataCancel_clicked()
|
||
{
|
||
emit(siUpdataCancel());
|
||
done(0);
|
||
}
|
||
|
||
void PromptDialog::on_buttonWarrant_clicked()
|
||
{
|
||
//输入框
|
||
WordsInputDialog wordInputDlg;
|
||
wordInputDlg.clean();
|
||
wordInputDlg.setTitleStr(tr("Warrant"));
|
||
wordInputDlg.setOldWordsStr("");
|
||
if(wordInputDlg.exec() == 1)
|
||
{
|
||
QString textStr = wordInputDlg.getInputStr();
|
||
//连接多块主板也是从g_pMachine(第一块)获取软件授权信息,所以解锁也是通过第一块主板
|
||
g_pMachine->setMacKey(( unsigned char * ) textStr.toLatin1().data() ,textStr.toLatin1().size());
|
||
done(1);
|
||
}
|
||
}
|
||
|
||
void PromptDialog::on_buttonWarrantCancel_clicked()
|
||
{
|
||
done(0);
|
||
}
|
||
|
||
//开始检测
|
||
void PromptDialog::on_buttonDetectBegin_clicked()
|
||
{
|
||
if(m_funType == BTN_BOTTOM)//等于底线检测
|
||
{
|
||
return;
|
||
}
|
||
if(m_funType == BTN_FACE)//等于面线检测
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
|
||
//停止检测
|
||
void PromptDialog::on_buttonDetectEnd_clicked()
|
||
{
|
||
if(g_pMachine!= NULL)
|
||
{
|
||
g_pMachine->exitDetectTest();
|
||
}
|
||
}
|
||
|
||
//关闭检测窗体
|
||
void PromptDialog::on_buttonDetectClose_clicked()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->exitDetectTest();
|
||
}
|
||
done(0);
|
||
}
|
||
|
||
//界面解密ID号输入按钮
|
||
void PromptDialog::on_buttonHMIPassword_clicked()
|
||
{
|
||
//输入框
|
||
WordsInputDialog wordInputDlg;
|
||
wordInputDlg.clean();
|
||
wordInputDlg.setTitleStr(tr("HMI decrypt"));
|
||
wordInputDlg.setOldWordsStr("");
|
||
if(wordInputDlg.exec() == 1)
|
||
{
|
||
QString textStr = wordInputDlg.getInputStr();
|
||
ui->buttonHMIPassword->setText(textStr);
|
||
if(textStr.length() > 0)
|
||
{
|
||
ui->buttonOk->setEnabled(true);
|
||
}
|
||
}
|
||
}
|
||
|
||
void PromptDialog::on_buttonSpindleAngleValue_clicked()
|
||
{
|
||
if(m_funType == BTN_AUTOMATIC_PULLMA)
|
||
{
|
||
int rslt;
|
||
NumerInputDialog ndlg(this);
|
||
ndlg.setTitleStr(tr("autoPull"));//自动拉料
|
||
ndlg.setUnitStr(tr("mm"));
|
||
ndlg.setValueAndRange(ui->buttonSpindleAngleValue->text().toInt(), 0, 36000, 0);
|
||
rslt = ndlg.exec();
|
||
|
||
if (rslt == 1)//输入弹窗点击了确认
|
||
{
|
||
s32 val = ndlg.getValue();
|
||
m_length = val;
|
||
float angle = m_length;
|
||
QString angleStr;
|
||
angleStr.sprintf("%.0f",angle);
|
||
ui->buttonSpindleAngleValue->setText(angleStr);
|
||
}
|
||
}
|
||
else if(m_funType == BTN_SPINDLE_GRANDE)
|
||
{
|
||
//时间
|
||
int rslt;
|
||
NumerInputDialog ndlg(this);
|
||
ndlg.setTitleStr(tr("Research vehicle time"));//研车时间
|
||
ndlg.setUnitStr(tr("s"));
|
||
ndlg.setValueAndRange(ui->buttonSpindleAngleValue->text().toInt(), 0, 36000, 0);
|
||
rslt = ndlg.exec();
|
||
|
||
if (rslt == 1)//输入弹窗点击了确认
|
||
{
|
||
s32 val = ndlg.getValue();
|
||
m_time = val;
|
||
float time = m_time;
|
||
QString timeStr;
|
||
timeStr.sprintf("%.0f",time);
|
||
ui->buttonSpindleAngleValue->setText(timeStr);
|
||
}
|
||
|
||
// //速度
|
||
// int rosh;
|
||
// NumerInputDialog ndsh(this);
|
||
// ndsh.setTitleStr(tr("Research vehicle speed"));//研车速度
|
||
// ndsh.setUnitStr(tr("s"));
|
||
// ndsh.setValueAndRange(ui->buttonSpindleAngleValue->text().toInt(), 0, 36000, 0);
|
||
// rosh = ndsh.exec();
|
||
|
||
}
|
||
else
|
||
{
|
||
QTextCodec *cod = QTextCodec::codecForLocale();
|
||
int rslt;
|
||
NumerInputDialog ndlg(this);
|
||
if(m_funType == BTN_SPINDLE_ROTATE)
|
||
{
|
||
ndlg.setTitleStr(tr("Spindle angle rotation"));//主轴角度旋转
|
||
}
|
||
else if(m_funType == BTN_ROTATE_ROTATE)
|
||
{
|
||
ndlg.setTitleStr(tr("Rotation angle rotation"));//旋转角度旋转
|
||
}
|
||
else if(m_funType == BTN_SPINDLE_GRANDE)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
ndlg.setTitleStr(tr("Spindle angle rotation"));//主轴角度旋转
|
||
}
|
||
ndlg.setUnitStr(cod->toUnicode("°"));
|
||
ndlg.setValueAndRange(ui->buttonSpindleAngleValue->text().toInt()*100, 0, 36000, 2);
|
||
rslt = ndlg.exec();
|
||
|
||
if (rslt == 1)//输入弹窗点击了确认
|
||
{
|
||
s32 val = ndlg.getValue();
|
||
m_spindleAngle = val;
|
||
float angle = m_spindleAngle*0.01;
|
||
QString angleStr;
|
||
angleStr.sprintf("%.2f",angle);
|
||
ui->buttonSpindleAngleValue->setText(angleStr);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
//修改一级密码:新密码输入按钮
|
||
void PromptDialog::on_buttonNewPassword_clicked()
|
||
{
|
||
//密码输入框
|
||
PassWordDialog passWordDlg;
|
||
passWordDlg.setTitleStr(tr("New Password input"));//设置新密码输入的标题
|
||
if(passWordDlg.exec() == 1)//确认
|
||
{
|
||
m_newPassword = passWordDlg.getInputStr();//获取输入框里的密码
|
||
QString showStr("");
|
||
for (int var = 0; var < m_newPassword.size(); var++)
|
||
{
|
||
showStr = showStr + "*";
|
||
}
|
||
ui->buttonNewPassword->setText(showStr);//新密码框里显示获取的密码
|
||
}
|
||
}
|
||
//修改一级密码:确认新密码输入按钮
|
||
void PromptDialog::on_buttonConfirmPassword_clicked()
|
||
{
|
||
//密码输入框
|
||
PassWordDialog passWordDlg;
|
||
passWordDlg.setTitleStr(tr("Confirm Password input"));//设置确认密码输入的标题
|
||
if(passWordDlg.exec() == 1)//确认
|
||
{
|
||
m_confirmPassword = passWordDlg.getInputStr();//获取输入框里的密码
|
||
QString showStr("");
|
||
for (int var = 0; var < m_confirmPassword.size(); var++)
|
||
{
|
||
showStr = showStr + "*";
|
||
}
|
||
ui->buttonConfirmPassword->setText(showStr);//确认密码框里显示获取的密码
|
||
if(m_confirmPassword.length() > 0 )
|
||
{
|
||
ui->buttonOk->setEnabled(true);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
//主轴正转
|
||
void PromptDialog::on_buttonForward_pressed()
|
||
{
|
||
emit siSpindleAction(MT_MOVE_DIR_POSI);
|
||
}
|
||
|
||
//主轴正转停止
|
||
void PromptDialog::on_buttonForward_released()
|
||
{
|
||
emit siSpindleAction(MT_MOVE_DIR_STOP);
|
||
}
|
||
|
||
//主轴反转
|
||
void PromptDialog::on_buttonReverse_pressed()
|
||
{
|
||
emit siSpindleAction(MT_MOVE_DIR_NEGA);
|
||
}
|
||
|
||
//主轴反转停止
|
||
void PromptDialog::on_buttonReverse_released()
|
||
{
|
||
emit siSpindleAction(MT_MOVE_DIR_STOP);
|
||
}
|
||
|
||
void PromptDialog::on_buttonX1_pressed()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->manualAction(XY_MOVE_RIGHT, 2);//速度等级默认是2
|
||
}
|
||
}
|
||
|
||
void PromptDialog::on_buttonX1_released()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->motoMove(XY_MOVE_RIGHT, MT_MOVE_DIR_STOP, 0);
|
||
}
|
||
m_area = 2;
|
||
}
|
||
|
||
void PromptDialog::on_buttonX2_pressed()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->manualAction(XY_MOVE_LEFT, 2);
|
||
}
|
||
}
|
||
|
||
void PromptDialog::on_buttonX2_released()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->motoMove(XY_MOVE_LEFT, MT_MOVE_DIR_STOP, 0);
|
||
}
|
||
m_area = 1;
|
||
}
|
||
|
||
void PromptDialog::on_buttonY1_pressed()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->manualAction(XY_MOVE_FRONT, 2);
|
||
}
|
||
}
|
||
//Y+
|
||
void PromptDialog::on_buttonY1_released()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->motoMove(XY_MOVE_FRONT, MT_MOVE_DIR_STOP, 0);
|
||
}
|
||
m_area = 4;
|
||
}
|
||
|
||
void PromptDialog::on_buttonY2_pressed()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->manualAction(XY_MOVE_BACK, 2);
|
||
}
|
||
}
|
||
//Y-
|
||
void PromptDialog::on_buttonY2_released()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->motoMove(XY_MOVE_BACK, MT_MOVE_DIR_STOP, 0);
|
||
}
|
||
m_area = 3;
|
||
}
|
||
|
||
void PromptDialog::on_buttonLKTest_clicked()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->manualAction(KNIFE_U1_TEST);
|
||
}
|
||
}
|
||
|
||
void PromptDialog::on_buttonRKTest_clicked()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->manualAction(KNIFE_U2_TEST);
|
||
}
|
||
}
|
||
|
||
void PromptDialog::on_buttonLKParaModify_clicked()
|
||
{
|
||
ParaStruct mcPara = g_pMachine->getMcPara();
|
||
// 刀座1安装刀类型选择 0,无 1,圆刀 2,震刀 3,铣刀 4,偏心刀1 5,偏心刀2 6,画笔 7,尖刀 8,钻孔 9,压轮
|
||
if (mcPara.buf[10] == 1)
|
||
{//1,圆刀
|
||
slot_Modify_McPara_int(87,tr("Height of tool drop during circular cutting"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[10] == 2)
|
||
{//2,震刀
|
||
slot_Modify_McPara_int(90,tr("Height of tool drop Shock knife"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[10] == 3)
|
||
{//3,铣刀
|
||
slot_Modify_McPara_int(93,tr("Height of tool drop milling cutter"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[10] == 4)
|
||
{//4,偏心刀1
|
||
slot_Modify_McPara_int(96,tr("Eccentric knife") + " 1 " + tr("machining tool drop height"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[10] == 5)
|
||
{//5,偏心刀2
|
||
slot_Modify_McPara_int(98,tr("Eccentric knife") + " 2 " + tr("machining tool drop height"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[10] == 7)
|
||
{//7,尖刀
|
||
slot_Modify_McPara_int(105,tr("Knife and pen drop height"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[10] == 8)
|
||
{//8,钻孔
|
||
slot_Modify_McPara_int(103,tr("Cutting height of drilling tool during machining"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[10] == 9)
|
||
{//9,压轮
|
||
slot_Modify_McPara_int(100,tr("Height of tool drop during wheel pressing"),"mm",10000,-100,2);
|
||
}
|
||
else
|
||
{//
|
||
}
|
||
|
||
refreshMcPara();
|
||
}
|
||
|
||
void PromptDialog::on_buttonRKParaModify_clicked()
|
||
{
|
||
ParaStruct mcPara = g_pMachine->getMcPara();
|
||
// 刀座2安装刀类型选择 0,无 1,圆刀 2,震刀 3,铣刀 4,偏心刀1 5,偏心刀2 6,画笔 7,尖刀 8,钻孔 9,压轮
|
||
if (mcPara.buf[11] == 1)
|
||
{//1,圆刀
|
||
slot_Modify_McPara_int(87,tr("Height of tool drop during circular cutting"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[11] == 2)
|
||
{//2,震刀
|
||
slot_Modify_McPara_int(90,tr("Height of tool drop Shock knife"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[11] == 3)
|
||
{//3,铣刀
|
||
slot_Modify_McPara_int(93,tr("Height of tool drop milling cutter"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[11] == 4)
|
||
{//4,偏心刀1
|
||
slot_Modify_McPara_int(96,tr("Eccentric knife") + " 1 " + tr("machining tool drop height"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[11] == 5)
|
||
{//5,偏心刀2
|
||
slot_Modify_McPara_int(98,tr("Eccentric knife") + " 2 " + tr("machining tool drop height"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[11] == 7)
|
||
{//7,尖刀
|
||
slot_Modify_McPara_int(105,tr("Knife and pen drop height"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[11] == 8)
|
||
{//8,钻孔
|
||
slot_Modify_McPara_int(103,tr("Cutting height of drilling tool during machining"),"mm",10000,-100,2);
|
||
}
|
||
else if (mcPara.buf[11] == 9)
|
||
{//9,压轮
|
||
slot_Modify_McPara_int(100,tr("Height of tool drop during wheel pressing"),"mm",10000,-100,2);
|
||
}
|
||
else
|
||
{//
|
||
}
|
||
refreshMcPara();
|
||
}
|
||
|
||
///
|
||
/// \brief 速度选择界面点击修改速度按钮
|
||
/// 注意更新速度的范围
|
||
///
|
||
void PromptDialog::slot_buttonSpdParaModify_clicked()
|
||
{
|
||
MyButton *p = (MyButton*)this->sender();
|
||
QString btnName = p->objectName();
|
||
int model = g_pSettings->readFromIniFile("FlatPanelSpd/Model").toInt();
|
||
|
||
//不同模式 读数据 配置文件
|
||
if(btnName.contains("buttonKn1_MinSpd")){
|
||
}
|
||
else if(btnName.contains("buttonKn1_MaxSpd")){
|
||
}
|
||
else if(btnName.contains("buttonKn1_AccSpd")){
|
||
}
|
||
else if(btnName.contains("buttonKn2_MinSpd")){
|
||
//偏心刀2最小切割速度
|
||
int val = slot_Modify_McPara_int(170,tr("Minimum cutting speed of Eccentric knife2"),"mm/s", 100, 1, 0);
|
||
p->setText(tr("Kn2Min:")+QString::number(val));//刀2最小
|
||
g_pSettings->writeOneToIniFile("FlatPanelSpd/M"+ QString::number(model)+"Kn2Min",QVariant(val));
|
||
}
|
||
else if(btnName.contains("buttonKn2_MaxSpd")){
|
||
//偏心刀2最大切割速度
|
||
int val = slot_Modify_McPara_int(171,tr("Maximum cutting speed of Eccentric knife2"),"mm/s", 800, 1, 0);
|
||
p->setText(tr("Kn2Max:")+QString::number(val));//刀2最大
|
||
g_pSettings->writeOneToIniFile("FlatPanelSpd/M"+ QString::number(model)+"Kn2Max",QVariant(val));
|
||
}
|
||
else if(btnName.contains("buttonKn2_AccSpd")){
|
||
//偏心刀2切割加速度
|
||
int val = slot_Modify_McPara_int(172,tr("Eccentric knife") + (" 2 ")+tr("cutting acceleration"),"mm/s2", 5000, 1, 0);
|
||
p->setText(tr("Kn2Acc:")+QString::number(val));//刀2加速
|
||
g_pSettings->writeOneToIniFile("FlatPanelSpd/M"+ QString::number(model)+"Kn2Acc",QVariant(val));
|
||
}
|
||
|
||
}
|
||
|
||
///
|
||
/// \brief 修改int类型的机器参数
|
||
///
|
||
int PromptDialog::slot_Modify_McPara_int(int index, QString descStr, QString unitStr, int Max, int Min, int afterpoint)
|
||
{
|
||
int val = g_pMachine->getMcPara().buf[index];
|
||
NumerInputDialog ndlg(this);
|
||
ndlg.setTitleStr(descStr);
|
||
ndlg.setUnitStr(unitStr);
|
||
ndlg.setValueAndRange(val, Min, Max, afterpoint);
|
||
int rslt = ndlg.exec();
|
||
if (rslt == 1)//点了确认按钮
|
||
{
|
||
val = ndlg.getValue();
|
||
ParaStruct para = g_pMachine->getMcPara();
|
||
para.buf[index] = val;
|
||
g_pMachine->setMcPara(¶);//发送下位机
|
||
}
|
||
return val;
|
||
}
|
||
|
||
void PromptDialog::slot_FanArea_clicked()
|
||
{
|
||
MyButton *p = (MyButton*)this->sender();
|
||
QString btnName = p->objectName();
|
||
qDebug()<<btnName;
|
||
if(btnName.contains("FanOpen5"))
|
||
{
|
||
g_pMachine->outputCtrl(OT_MAINADSORB, UP_OPEN_ON, 0);
|
||
}
|
||
else if(btnName.contains("FanClose5"))
|
||
{
|
||
g_pMachine->outputCtrl(OT_MAINADSORB, DOWN_CLOSE_OFF, 0);
|
||
}
|
||
else if(btnName.contains("FanSet"))
|
||
{
|
||
int index = btnName.right(1).toInt();
|
||
ParaStruct wkPara = g_pMachine->getWkPara();
|
||
bitset<32> intbit(wkPara.buf[83]);//吸附区域 83 bit 0-3
|
||
if(index == 1)
|
||
{
|
||
bool val = intbit.test(0); //按位修改
|
||
intbit.set(0, !val);
|
||
wkPara.buf[83] = intbit.to_ulong();
|
||
}
|
||
else if(index == 2)
|
||
{
|
||
bool val = intbit.test(1);
|
||
intbit.set(1, !val);
|
||
wkPara.buf[83] = intbit.to_ulong();
|
||
}
|
||
else if(index == 3)
|
||
{
|
||
bool val = intbit.test(2);
|
||
intbit.set(2, !val);
|
||
wkPara.buf[83] = intbit.to_ulong();
|
||
}
|
||
else if(index == 4)
|
||
{
|
||
bool val = intbit.test(3);
|
||
intbit.set(3, !val);
|
||
wkPara.buf[83] = intbit.to_ulong();
|
||
}
|
||
else if(index == 5)
|
||
{//风机吸附开关 102 bit0
|
||
bitset<32> intAllBit(wkPara.buf[102]);
|
||
bool val = intAllBit.test(0);
|
||
intAllBit.set(0, !val);
|
||
wkPara.buf[102] = intAllBit.to_ulong();
|
||
}
|
||
g_pMachine->setWkPara(&wkPara);
|
||
refreshWkPara();
|
||
}
|
||
}
|
||
|
||
void PromptDialog::slot_SpdSelect_clicked()
|
||
{
|
||
MyButton *p = (MyButton*)this->sender();
|
||
QString btnName = p->objectName();
|
||
int kn1Min{0}, kn1Acc{0}, kn2Min{0}, kn2Acc{0};
|
||
|
||
for(int i = 1;i < 6; i++){
|
||
if(btnName.contains("radioButtonSpd_"+QString::number(i))){
|
||
g_pSettings->writeOneToIniFile("FlatPanelSpd/Model",QVariant(i));
|
||
kn1Min = g_pSettings->readFromIniFile("FlatPanelSpd/M"+ QString::number(i)+"Kn1Min").toInt();
|
||
kn1Acc = g_pSettings->readFromIniFile("FlatPanelSpd/M"+ QString::number(i)+"Kn1Acc").toInt();
|
||
kn2Min = g_pSettings->readFromIniFile("FlatPanelSpd/M"+ QString::number(i)+"Kn2Min").toInt();
|
||
kn2Acc = g_pSettings->readFromIniFile("FlatPanelSpd/M"+ QString::number(i)+"Kn2Acc").toInt();
|
||
}
|
||
}
|
||
|
||
//验证数据范围是否正确
|
||
if(kn1Min<1 || kn1Min>100)
|
||
kn1Min = 10;
|
||
if(kn2Min<1 || kn2Min>100)
|
||
kn2Min = 10;
|
||
|
||
if(kn1Acc<1 || kn1Acc>5000)
|
||
kn1Acc = 500;
|
||
if(kn2Acc<1 || kn2Acc>5000)
|
||
kn2Acc = 500;
|
||
}
|
||
|
||
void PromptDialog::on_buttonFanClose5_clicked()
|
||
{
|
||
|
||
}
|
||
|
||
//一键上升
|
||
void PromptDialog::on_buttonUp_clicked()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->outputCtrl(OT_U_LIFT, UP_OPEN_ON, 0);
|
||
}
|
||
}
|
||
|
||
//一键下降
|
||
void PromptDialog::on_buttonDn_clicked()
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->outputCtrl(OT_U_LIFT, DOWN_CLOSE_OFF, 0);
|
||
}
|
||
}
|
||
|
||
void PromptDialog::on_pushButton_collect_clicked()
|
||
{
|
||
emit siBladePressureCol();
|
||
return;
|
||
}
|
||
|
||
void PromptDialog::on_button_USB_clicked()
|
||
{
|
||
//文件传输方式--USB传输
|
||
emit siFileTransfer(0);
|
||
done(0);
|
||
}
|
||
|
||
void PromptDialog::on_button_Local_clicked()
|
||
{
|
||
//文件传输方式--本地文件传输
|
||
emit siFileTransfer(1);
|
||
done(0);
|
||
}
|
||
|
||
void PromptDialog::slot_BladePressure_Clicked()
|
||
{
|
||
//铣切机--刀压设置
|
||
int BladeVal = static_cast<int>(ui->pushButton_BValue->text().toDouble()*1000);
|
||
|
||
ParaStruct para = g_pMachine->getMcPara();
|
||
NumerInputDialog ndlg(this);
|
||
ndlg.setUnitStr("mm");
|
||
ndlg.setValueAndRange(BladeVal, -2000, 10000, 3);
|
||
int paramIndex = 0;
|
||
switch (ui->pushButton_Blade->text().toInt())
|
||
{
|
||
case 2:
|
||
ndlg.setTitleStr(tr("Custom Knife Pressure") + "2");
|
||
paramIndex = 80;
|
||
break;
|
||
case 3:
|
||
ndlg.setTitleStr(tr("Custom Knife Pressure") + "3");
|
||
paramIndex = 81;
|
||
break;
|
||
case 4:
|
||
ndlg.setTitleStr(tr("Custom Knife Pressure") + "4");
|
||
paramIndex = 82;
|
||
break;
|
||
case 5:
|
||
ndlg.setTitleStr(tr("Custom Knife Pressure") + "5");
|
||
paramIndex = 83;
|
||
break;
|
||
case 6:
|
||
ndlg.setTitleStr(tr("Custom Knife Pressure") + "6");
|
||
paramIndex = 84;
|
||
break;
|
||
case 7:
|
||
ndlg.setTitleStr(tr("Custom Knife Pressure") + "7");
|
||
paramIndex = 85;
|
||
break;
|
||
case 8:
|
||
ndlg.setTitleStr(tr("Custom Knife Pressure") + "8");
|
||
paramIndex = 86;
|
||
break;
|
||
case 9:
|
||
ndlg.setTitleStr(tr("Custom Knife Pressure") + "9");
|
||
paramIndex = 87;
|
||
break;
|
||
default:
|
||
return;
|
||
}
|
||
if (ndlg.exec())//点了确认按钮
|
||
{
|
||
ui->pushButton_BValue->setText(ndlg.getShowStringPublic(ndlg.getValue(),4));
|
||
para.buf[paramIndex] = static_cast<int>(ui->pushButton_BValue->text().toDouble()*1000);
|
||
g_pMachine->setAMcPara(paramIndex + 1, para.buf[paramIndex]);//发送下位机
|
||
}
|
||
}
|
||
|
||
void PromptDialog::on_pushButton_test_clicked()
|
||
{
|
||
int BladeNum = ui->pushButton_Blade->text().toInt();
|
||
double BladeVal = ui->pushButton_BValue->text().toDouble();
|
||
qDebug()<<"BladeVal:"<<BladeVal<<"BladeVal*1000:"<<BladeVal*1000;
|
||
|
||
if (BladeNum < 10 && BladeNum > 1)
|
||
{
|
||
PromptDialog pPromptDlg;
|
||
pPromptDlg.initDialog(PromptDialog::BTN_OK_CANCEL);
|
||
pPromptDlg.setTitleStr(tr("Back anchor point"));//回定位点
|
||
QString str;
|
||
str = tr("The machine is about to move, please pay attention to safety!");//机器即将运动,请注意安全!
|
||
pPromptDlg.setContentStr(str);
|
||
|
||
if(pPromptDlg.exec() == 1)
|
||
{
|
||
if(g_pMachine != NULL)
|
||
{
|
||
g_pMachine->manualAction(MILLING_TEST,(BladeNum),BladeVal*1000);
|
||
qDebug() << "button selected:"<<BladeNum;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
// 没有按钮被选中
|
||
qDebug() << "BladeNum Erro";
|
||
}
|
||
}
|
||
|
||
void PromptDialog::on_pushButton_Next_clicked()
|
||
{
|
||
int BladeNum = ui->pushButton_Blade->text().toInt();
|
||
BladeNum += 1;
|
||
if(BladeNum > 9)
|
||
{
|
||
BladeNum = 2;
|
||
}
|
||
ui->pushButton_Blade->setText(QString::number(BladeNum));
|
||
|
||
switch (BladeNum)
|
||
{
|
||
case 2:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle2());
|
||
break;
|
||
case 3:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle3());
|
||
break;
|
||
case 4:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle4());
|
||
break;
|
||
case 5:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle5());
|
||
break;
|
||
case 6:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle6());
|
||
break;
|
||
case 7:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle7());
|
||
break;
|
||
case 8:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle8());
|
||
break;
|
||
case 9:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle9());
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
ParaStruct mcPara = g_pMachine->getMcPara();
|
||
int pressureHighValue = mcPara.buf[78+BladeNum];
|
||
double dValue = static_cast<double>(pressureHighValue);
|
||
QString strVal = QString::number(dValue/1000,'f',3);
|
||
ui->pushButton_BValue->setText(strVal);
|
||
}
|
||
|
||
void PromptDialog::on_pushButton_Pre_clicked()
|
||
{
|
||
int BladeNum = ui->pushButton_Blade->text().toInt();
|
||
BladeNum -= 1;
|
||
if(BladeNum < 2)
|
||
{
|
||
BladeNum = 9;
|
||
}
|
||
ui->pushButton_Blade->setText(QString::number(BladeNum));
|
||
|
||
switch (BladeNum)
|
||
{
|
||
case 2:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle2());
|
||
break;
|
||
case 3:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle3());
|
||
break;
|
||
case 4:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle4());
|
||
break;
|
||
case 5:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle5());
|
||
break;
|
||
case 6:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle6());
|
||
break;
|
||
case 7:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle7());
|
||
break;
|
||
case 8:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle8());
|
||
break;
|
||
case 9:
|
||
ui->pushButton_Blade->setStyleSheet(knifeStyle9());
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
ParaStruct mcPara = g_pMachine->getMcPara();
|
||
int pressureHighValue = mcPara.buf[78+BladeNum];
|
||
double dValue = static_cast<double>(pressureHighValue);
|
||
QString strVal = QString::number(dValue/1000,'f',3);
|
||
ui->pushButton_BValue->setText(strVal);
|
||
}
|
||
|
||
void PromptDialog::on_pushButton_collect_bit_clicked()
|
||
{
|
||
PromptDialog promptDlg;
|
||
promptDlg.initDialog(PromptDialog::BTN_OK_CANCEL);
|
||
promptDlg.setTitleStr(tr("Go to the collection location"));//去采集位
|
||
promptDlg.setContentStr(tr("The machine is about to move, please pay attention to safety!"));//机器即将运动,请注意安全!
|
||
if(promptDlg.exec())
|
||
g_pMachine->manualAction(SET_KNIFETEST_DOT);
|
||
}
|
||
|
||
void PromptDialog::delay(int millisecondsToWait)
|
||
{
|
||
QEventLoop loop;
|
||
QTimer::singleShot(millisecondsToWait, &loop, SLOT(quit()));
|
||
loop.exec();
|
||
}
|
||
|
||
void PromptDialog::on_buttonOverWrite_clicked()
|
||
{
|
||
done(1);
|
||
}
|
||
|
||
void PromptDialog::on_buttonSaveAs_clicked()
|
||
{
|
||
done(2);
|
||
}
|
||
|
||
void PromptDialog::on_buttonClose_clicked()
|
||
{
|
||
done(0);
|
||
}
|