Files
newspark110/device/ui/devicecontrolpanelwidget.cpp

2785 lines
121 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "devicecontrolpanelwidget.h"
#include "deviceinfo.h"
#include <QVector>
#include <QDebug>
#include <QFileDialog>
#include "rs_settings.h"
#include <QDateTime>
#include "deviceproxy.h"
#include "exceptioncode.h"
#include "bridgesgl.h"
#include "modbustcp.h"
#include "login.h"
#include "IPG_laser.h"
#include "specificareaswidget.h"
#include "qc_applicationwindow.h"
#include <string>
#include "cppcodec/base64_default_rfc4648.hpp"
std::string base64_encode(const std::string& input) {
return cppcodec::base64_rfc4648::encode(input);
}
DeviceControlPanelWidget::DeviceControlPanelWidget(QWidget *parent)
:QFrame(parent)
,ui(new Ui::DeviceControlPanelWidget)
{
ui->setupUi(this);
init();
ui->pbGetRFID->setVisible(true);
ui->pbCompenTestPos->setVisible(false);
ui->pbLaserMarking->setVisible(false);
ui->pushButton->setVisible(false);
//ui->pbCompenTestPos->setVisible(false);
}
DeviceControlPanelWidget::~DeviceControlPanelWidget()
{
delete ui;
}
void DeviceControlPanelWidget::init()
{
// 禁用加工代码路径编辑
//ui->leMachCodeFileName->setFocusPolicy(Qt::NoFocus);
loadSet();
connect(DEV,SIGNAL(exceptSGL_lhc(MyException)),this,SLOT(exceptionHandl(MyException)),Qt::BlockingQueuedConnection);
connect(DEV,SIGNAL(exceptSGL(MyException)),this,SLOT(exceptionHandl(MyException)));
connect(DEV,SIGNAL(AutoExceptSGL(MyException)),this,SLOT(AutoExceptionHandl(MyException)),Qt::BlockingQueuedConnection);
connect(DEV,SIGNAL(ShowSmallAreasSGL()),this,SLOT(ShowSmallAreasDialog()),Qt::BlockingQueuedConnection);
connect(DEV,SIGNAL(AutoExceptSGL_laser(MyException)),this,SLOT(AutoExceptionHandl(MyException)));
updateXAxisEnablePBStyleSheet(false);
updateYAxisEnablePBStyleSheet(false);
updateZAxisEnablePBStyleSheet(false);
updateZAAxisEnablePBStyleSheet(false);
// 使能状态变化信号和槽连接
connect(DEV,SIGNAL(XAxisEnableStateSGL(bool)),this,SLOT(updateXAxisEnablePBStyleSheet(bool)));
connect(DEV,SIGNAL(YAxisEnableStateSGL(bool)),this,SLOT(updateYAxisEnablePBStyleSheet(bool)));
connect(DEV,SIGNAL(ZAxisEnableStateSGL(bool)),this,SLOT(updateZAxisEnablePBStyleSheet(bool)));
connect(DEV,SIGNAL(ZAAxisEnableStateSGL(bool)),this,SLOT(updateZAAxisEnablePBStyleSheet(bool)));
connect(DEV,SIGNAL(MsgLogInSuccess(bool)),this,SLOT(updateLogInPower(bool)));
// 限位状态变化信号和槽连接
connect(DEV,SIGNAL(XAxisLimitStateSGL(LIMIT_STATE)),this,SLOT(updateXAxisPBStyleSheet(LIMIT_STATE)));
connect(DEV,SIGNAL(YAxisLimitStateSGL(LIMIT_STATE)),this,SLOT(updateYAxisPBStyleSheet(LIMIT_STATE)));
connect(DEV,SIGNAL(ZAxisLimitStateSGL(LIMIT_STATE)),this,SLOT(updateZAxisPBStyleSheet(LIMIT_STATE)));
connect(DEV,SIGNAL(ZAAxisLimitStateSGL(LIMIT_STATE)),this,SLOT(updateZAAxisPBStyleSheet(LIMIT_STATE)));
//加工状态信号和槽连接
connect(DEV,SIGNAL(AutoSmachStateSGL(bool)),this,SLOT(updatePbSemiAutoMachStyleSheet(bool)));
connect(DEV,SIGNAL(StopStateSGL(bool)),this,SLOT(updatePbStopStyleSheet(bool)));
connect(DEV,SIGNAL(SmachTypeStateSGL(bool)),this,SLOT(updateCmbType(bool)));
connect(DEV,SIGNAL(VacuumSuckerOnOrOffStateSGL(bool)),this,SLOT(updateVacuumSuckerOnOrOff(bool)));
connect(DEV,SIGNAL(GetRunTypeState()),this,SLOT(GetRunType()));
// 急停状态信号和槽连接
connect(DEV,SIGNAL(EStopSGL(bool)),this,SLOT(updateEStopPBStyleSheet(bool)));
// 记录设置
connect(ui->rbContinued,&QRadioButton::clicked,this,&DeviceControlPanelWidget::rbContinuedOrRbSingleStepClickedHandl);
connect(ui->rbSingleStep,&QRadioButton::clicked,this,&DeviceControlPanelWidget::rbContinuedOrRbSingleStepClickedHandl);
// 设备初始化按钮样式表初值
updateDEVInitPBStyleSheet(false);
//updateResetPBStyleSheet(false);
connect(DEV,SIGNAL(DEVInitStateChangedSGL(bool)),this,SLOT(updateDEVInitPBStyleSheet(bool)));
//connect(DEV,SIGNAL(DEVResetStateChangedSGL(bool)),this,SLOT(updateResetPBStyleSheet(bool)));
//connect(BDGSGL,SIGNAL(addZAAxisCPosSGL(QString,double)),this,SLOT(addCbZAAxisCPItem(const QString&,double)));
//connect(ui->cbZAAxisCP,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbZAAxisCPCtTextChangedHandl(const QString &)));
connect(DEV,SIGNAL(vacuumSuckerOpenFSGL()),this,SLOT(vacuumSuckerOpenFHandl()));
connect(DEV,SIGNAL(vacuumSuckerCloseFSGL()),this,SLOT(vacuumSuckerCloseFHandl()));
connect(DEV,SIGNAL(laserOpenFSGL()),this,SLOT(laserOpenFHandl()));
connect(DEV,SIGNAL(laserCloseFSGL()),this,SLOT(laserCloseFHandl()));
connect(DEV,SIGNAL(MHCompOpenFSGL()),this,SLOT(MHCompOpenFHandl()));
connect(DEV,SIGNAL(MHCompCloseFSGL()),this,SLOT(MHCompCloseFHandl()));
connect(DEV,SIGNAL(MotionCompCloseFSGL()),this,SLOT(MotionCompCloseFHandl()));
connect(DEV,SIGNAL(MotionCompOpenFSGL()),this,SLOT(MotionCompOpenFHandl()));
connect(DEV,SIGNAL(SETRfidText(char *)),this,SLOT(SETRfidTextFHandl(char *)));
connect(DEV,SIGNAL(XAxisCtPosSGL(double)),this,SLOT(setXAxisCtPos(double)));
connect(DEV,SIGNAL(YAxisCtPosSGL(double)),this,SLOT(setYAxisCtPos(double)));
connect(DEV,SIGNAL(ZAxisCtPosSGL(double)),this,SLOT(setZAxisCtPos(double)));
connect(DEV,SIGNAL(ZAAxisCtPosSGL(double)),this,SLOT(setZAAxisCtPos(double)));
connect(DEV,SIGNAL(ShangLiaoFSGL(bool)),this,SLOT(ShangliaoSolt(bool)));
connect(DEV,SIGNAL(XiaLiaoFSGL(bool)),this,SLOT(XialiaoSolt(bool)));
//connect(DEV,SIGNAL(suspendBufferFSGL()),this,SLOT(suspendBufferFHandl()));
//connect(DEV,SIGNAL(continueBufferFSGL()),this,SLOT(continueBufferFHandl()));
emit DEV->AutoSmachStateSGL(false);
emit DEV->SmachTypeStateSGL(true);
//ui->pbReset->setVisible(false);
DEV->MsgLogInSuccess(false);
//emit DEV->StopStateSGL(!DEV->SuspendFlag);
}
void DeviceControlPanelWidget::loadSet()
{
// 加载点动步距设置
RS_SETTINGS->beginGroup("device/RMove");
double dsbRMoveStepDist = RS_SETTINGS->readNumDEntry("/stepDist");
RS_SETTINGS->endGroup();
ui->dsbRMoveStepDist->setValue(dsbRMoveStepDist);
RS_SETTINGS->beginGroup("device/Rposition");
double Palletheight = RS_SETTINGS->readNumDEntry("/Palletheight");
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/Rposition");
int RFIDCount = RS_SETTINGS->readNumEntry("/RFIDCount");
RS_SETTINGS->endGroup();
DEV->RFIDCount = RFIDCount;
DEV->Palletheight = Palletheight;
DEV->workpieceHeight = Palletheight + MAXHEIGHT;
// 加载PTP位置设置
RS_SETTINGS->beginGroup("device/ABSMove/Pos");
double XAxisABSPos = RS_SETTINGS->readNumDEntry("/XAxis");
double YAxisABSPos = RS_SETTINGS->readNumDEntry("/YAxis");
double ZAxisABSPos = RS_SETTINGS->readNumDEntry("/ZAxis");
double ZAAxisABSPos = RS_SETTINGS->readNumDEntry("/ZAAxis");
RS_SETTINGS->endGroup();
ui->dsbXAxisABSPos->setValue(XAxisABSPos);
ui->dsbYAxisABSPos->setValue(YAxisABSPos);
ui->dsbZAxisABSPos->setValue(ZAxisABSPos);
ui->dsbZAAxisABSPos->setValue(ZAAxisABSPos);
// 加载速度设置
RS_SETTINGS->beginGroup("device/RMove/Vel");
double XAxisVel = RS_SETTINGS->readNumDEntry("/XAxis");
double YAxisVel = RS_SETTINGS->readNumDEntry("/YAxis");
double ZAxisVel = RS_SETTINGS->readNumDEntry("/ZAxis");
double ZAAxisVel = RS_SETTINGS->readNumDEntry("/ZAAxis");
RS_SETTINGS->endGroup();
ui->dsbXAxisRMoveVel->setValue(XAxisVel);
ui->dsbYAxisRMoveVel->setValue(YAxisVel);
ui->dsbZAxisRMoveVel->setValue(ZAxisVel);
ui->dsbZAAxisRMoveVel->setValue(ZAAxisVel);
// 加载PTP轴选择设置
RS_SETTINGS->beginGroup("device/ABSMove/isMove");
int XAxisIsMove = RS_SETTINGS->readNumEntry("/XAxis",1);
int YAxisIsMove = RS_SETTINGS->readNumEntry("/YAxis",1);
int ZAxisIsMove = RS_SETTINGS->readNumEntry("/ZAxis",1);
int ZAAxisIsMove = RS_SETTINGS->readNumEntry("/ZAAxis",1);
RS_SETTINGS->endGroup();
ui->cbABSXAxisIsMove->setChecked(XAxisIsMove);
ui->cbABSYAxisIsMove->setChecked(YAxisIsMove);
ui->cbABSZAxisIsMove->setChecked(ZAxisIsMove);
ui->cbABSZAAxisIsMove->setChecked(ZAAxisIsMove);
// 加载JOG 连续/单步设置
RS_SETTINGS->beginGroup("device/RMove/mode");
int continued = RS_SETTINGS->readNumEntry("/continued",1);
int singleStep = RS_SETTINGS->readNumEntry("/singleStep",1);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/WorkFile"); //?path读不到
QString aFileName = RS_SETTINGS->readEntry("/workfilename");
ui->leMachCodeFileName->setCurrentText(aFileName);
RS_SETTINGS->endGroup();
ui->rbContinued->setChecked(continued);
ui->rbSingleStep->setChecked(singleStep);
// 加载加工代码路径
// RS_SETTINGS->beginGroup("device/Mach");
// QString machCodeFilePath = RS_SETTINGS->readEntry("/codeFilePath");
// RS_SETTINGS->endGroup();
// QFileInfo fileInfo(machCodeFilePath);
// ui->leMachCodeFileName->setText(fileInfo.fileName());
// 加载Z轴常用位置
// RS_SETTINGS->beginGroup("device");
// QMap<QString,double> ZAAxisCPosMapTemp;
// ZAAxisCPosMapTemp = RS_SETTINGS->readQMapQStringDoubleEntry("/ZAAxisCPosMap", ZAAxisCPosMapTemp);
// RS_SETTINGS->endGroup();
// ZAAxisCPosMap = ZAAxisCPosMapTemp;
// ui->cbZAAxisCP->addItems(ZAAxisCPosMapTemp.keys());
// 加载Z轴当前常用位置
// RS_SETTINGS->beginGroup("device");
// QString cbZAAxisCPCtText = RS_SETTINGS->readEntry("/ZAAxisCPCtText");
// RS_SETTINGS->endGroup();
// ui->cbZAAxisCP->setCurrentText(cbZAAxisCPCtText);
RS_SETTINGS->beginGroup("device/Type");
QString strType = RS_SETTINGS->readEntry("/value");
RS_SETTINGS->endGroup();
ui->cmbType->setCurrentText(strType);
ui->chkAuto->setVisible(false);
ui->pbMotionCompOnOrOff->setVisible(false);
ui->pbCameraToRH->setVisible(false);
ui->pbRHToCamera->setVisible(false);
ui->pbMHToCamera->setVisible(false);
ui->pbCameraToMH->setVisible(false);
//ui->chkAuto->setCheckState(Qt::Checked);
//ui->cbZAAxisCP->setVisible(false);
//ui->pbZAAxisCPMove->setVisible(false);
//ui->pbHeightFindPos->setVisible(false);
}
void DeviceControlPanelWidget::on_pbXEnable_clicked()
{
DEV->enableDisableXAxis();
}
void DeviceControlPanelWidget::on_pbYEnable_clicked()
{
DEV->enableDisableYAxis();
}
void DeviceControlPanelWidget::on_pbZEnable_clicked()
{
DEV->enableDisableZAxis();
}
void DeviceControlPanelWidget::on_pbZAEnable_clicked()
{
DEV->enableDisableZAAxis();
}
void DeviceControlPanelWidget::on_dsbXAxisRMoveVel_valueChanged(double vel)
{
RS_SETTINGS->beginGroup("device/RMove/Vel");
RS_SETTINGS->writeEntry("/XAxis", vel);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("X轴速度改变完成当前速度为%1mm/s").arg(vel));
}
void DeviceControlPanelWidget::on_dsbYAxisRMoveVel_valueChanged(double vel)
{
RS_SETTINGS->beginGroup("device/RMove/Vel");
RS_SETTINGS->writeEntry("/YAxis", vel);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Y轴速度改变完成当前速度为%1mm/s").arg(vel));
}
void DeviceControlPanelWidget::on_dsbZAxisRMoveVel_valueChanged(double vel)
{
RS_SETTINGS->beginGroup("device/RMove/Vel");
RS_SETTINGS->writeEntry("/ZAxis", vel);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z1轴速度改变完成当前速度为%1mm/s").arg(vel));
}
void DeviceControlPanelWidget::on_dsbZAAxisRMoveVel_valueChanged(double vel)
{
RS_SETTINGS->beginGroup("device/RMove/Vel");
RS_SETTINGS->writeEntry("/ZAAxis", vel);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z轴速度改变完成当前速度为%1mm/s").arg(vel));
}
void DeviceControlPanelWidget::rbContinuedOrRbSingleStepClickedHandl()
{
RS_SETTINGS->beginGroup("device/RMove/mode");
RS_SETTINGS->writeEntry("/continued", ui->rbContinued->isChecked());
RS_SETTINGS->writeEntry("/singleStep", ui->rbSingleStep->isChecked());
RS_SETTINGS->endGroup();
if(ui->rbContinued->isChecked())
DEVICE_INFO->printDeviceSystemInfo("相对运动模式改变为连续");
if(ui->rbSingleStep->isChecked())
DEVICE_INFO->printDeviceSystemInfo("相对运动模式改变为点动");
}
void DeviceControlPanelWidget::on_dsbRMoveStepDist_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/RMove");
RS_SETTINGS->writeEntry("/stepDist", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("相对运动步距改变为:%1mm").arg(value));
}
void DeviceControlPanelWidget::on_pbXAxisP_pressed()
{
if(ui->rbContinued->isChecked())
{
connect(ui->pbXAxisP,SIGNAL(released()),this,SLOT(pbXAxisPReleasedHandl()));
DEV->XAxisCMoveP();
}
if(ui->rbSingleStep->isChecked())
{
DEV->XAxisSMoveP();
}
}
void DeviceControlPanelWidget::on_pbXAxisN_pressed()
{
if(ui->rbContinued->isChecked())
{
connect(ui->pbXAxisN,SIGNAL(released()),this,SLOT(pbXAxisNReleasedHandl()));
DEV->XAxisCMoveN();
}
if(ui->rbSingleStep->isChecked())
{
DEV->XAxisSMoveN();
}
}
void DeviceControlPanelWidget::on_pbYAxisP_pressed()
{
if(ui->rbContinued->isChecked())
{
connect(ui->pbYAxisP,SIGNAL(released()),this,SLOT(pbYAxisPReleasedHandl()));
DEV->YAxisCMoveP();
}
if(ui->rbSingleStep->isChecked())
{
DEV->YAxisSMoveP();
}
}
void DeviceControlPanelWidget::on_pbYAxisN_pressed()
{
if(ui->rbContinued->isChecked())
{
connect(ui->pbYAxisN,SIGNAL(released()),this,SLOT(pbYAxisNReleasedHandl()));
DEV->YAxisCMoveN();
}
if(ui->rbSingleStep->isChecked())
{
DEV->YAxisSMoveN();
}
}
void DeviceControlPanelWidget::on_pbZAxisP_pressed()
{
if(ui->rbContinued->isChecked())
{
connect(ui->pbZAxisP,SIGNAL(released()),this,SLOT(pbZAxisPReleasedHandl()));
DEV->ZAxisCMoveP();
}
if(ui->rbSingleStep->isChecked())
{
DEV->ZAxisSMoveP();
}
}
void DeviceControlPanelWidget::on_pbZAxisN_pressed()
{
if(ui->rbContinued->isChecked())
{
connect(ui->pbZAxisN,SIGNAL(released()),this,SLOT(pbZAxisNReleasedHandl()));
DEV->ZAxisCMoveN();
}
if(ui->rbSingleStep->isChecked())
{
DEV->ZAxisSMoveN();
}
}
void DeviceControlPanelWidget::on_pbZAAxisP_pressed()
{
if(ui->rbContinued->isChecked())
{
connect(ui->pbZAAxisP,SIGNAL(released()),this,SLOT(pbZAAxisPReleasedHandl()));
DEV->ZAAxisCMoveP();
}
if(ui->rbSingleStep->isChecked())
{
DEV->ZAAxisSMoveP();
}
}
void DeviceControlPanelWidget::on_pbZAAxisN_pressed()
{
if(ui->rbContinued->isChecked())
{
connect(ui->pbZAAxisN,SIGNAL(released()),this,SLOT(pbZAAxisNReleasedHandl()));
DEV->ZAAxisCMoveN();
}
if(ui->rbSingleStep->isChecked())
{
DEV->ZAAxisSMoveN();
}
}
void DeviceControlPanelWidget::pbXAxisPReleasedHandl()
{
disconnect(ui->pbXAxisP,SIGNAL(released()),this,SLOT(pbXAxisPReleasedHandl()));
DEV->XAxisCMovePEnd();
}
void DeviceControlPanelWidget::pbXAxisNReleasedHandl()
{
disconnect(ui->pbXAxisN,SIGNAL(released()),this,SLOT(pbXAxisNReleasedHandl()));
DEV->XAxisCMoveNEnd();
}
void DeviceControlPanelWidget::pbYAxisPReleasedHandl()
{
disconnect(ui->pbYAxisP,SIGNAL(released()),this,SLOT(pbYAxisPReleasedHandl()));
DEV->YAxisCMovePEnd();
}
void DeviceControlPanelWidget::pbYAxisNReleasedHandl()
{
disconnect(ui->pbYAxisN,SIGNAL(released()),this,SLOT(pbYAxisNReleasedHandl()));
DEV->YAxisCMoveNEnd();
}
void DeviceControlPanelWidget::pbZAxisPReleasedHandl()
{
disconnect(ui->pbZAxisP,SIGNAL(released()),this,SLOT(pbZAxisPReleasedHandl()));
DEV->ZAxisCMovePEnd();
}
void DeviceControlPanelWidget::pbZAxisNReleasedHandl()
{
disconnect(ui->pbZAxisN,SIGNAL(released()),this,SLOT(pbZAxisNReleasedHandl()));
DEV->ZAxisCMoveNEnd();
}
void DeviceControlPanelWidget::pbZAAxisPReleasedHandl()
{
disconnect(ui->pbZAAxisP,SIGNAL(released()),this,SLOT(pbZAAxisPReleasedHandl()));
DEV->ZAAxisCMovePEnd();
}
void DeviceControlPanelWidget::pbZAAxisNReleasedHandl()
{
disconnect(ui->pbZAAxisN,SIGNAL(released()),this,SLOT(pbZAAxisNReleasedHandl()));
DEV->ZAAxisCMoveNEnd();
}
void DeviceControlPanelWidget::on_cbABSXAxisIsMove_clicked()
{
RS_SETTINGS->beginGroup("device/ABSMove/isMove");
RS_SETTINGS->writeEntry("/XAxis", ui->cbABSXAxisIsMove->isChecked());
RS_SETTINGS->endGroup();
if(ui->cbABSXAxisIsMove->isChecked())
DEVICE_INFO->printDeviceSystemInfo("X轴绝对运动启用");
else
DEVICE_INFO->printDeviceSystemInfo("X轴绝对运动禁用");
}
void DeviceControlPanelWidget::on_cbABSYAxisIsMove_clicked()
{
RS_SETTINGS->beginGroup("device/ABSMove/isMove");
RS_SETTINGS->writeEntry("/YAxis", ui->cbABSYAxisIsMove->isChecked());
RS_SETTINGS->endGroup();
if(ui->cbABSYAxisIsMove->isChecked())
DEVICE_INFO->printDeviceSystemInfo("Y轴绝对运动启用");
else
DEVICE_INFO->printDeviceSystemInfo("Y轴绝对运动禁用");
}
void DeviceControlPanelWidget::on_cbABSZAxisIsMove_clicked()
{
RS_SETTINGS->beginGroup("device/ABSMove/isMove");
RS_SETTINGS->writeEntry("/ZAxis", ui->cbABSZAxisIsMove->isChecked());
RS_SETTINGS->endGroup();
if(ui->cbABSZAxisIsMove->isChecked())
DEVICE_INFO->printDeviceSystemInfo("Z1轴绝对运动启用");
else
DEVICE_INFO->printDeviceSystemInfo("Z1轴绝对运动禁用");
}
void DeviceControlPanelWidget::on_cbABSZAAxisIsMove_clicked()
{
RS_SETTINGS->beginGroup("device/ABSMove/isMove");
RS_SETTINGS->writeEntry("/ZAAxis", ui->cbABSZAAxisIsMove->isChecked());
RS_SETTINGS->endGroup();
if(ui->cbABSZAAxisIsMove->isChecked())
DEVICE_INFO->printDeviceSystemInfo("Z轴绝对运动启用");
else
DEVICE_INFO->printDeviceSystemInfo("Z轴绝对运动禁用");
}
void DeviceControlPanelWidget::on_dsbXAxisABSPos_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Pos");
RS_SETTINGS->writeEntry("/XAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("X轴绝对运动定位值改变为%1mm").arg(value));
}
void DeviceControlPanelWidget::on_dsbYAxisABSPos_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Pos");
RS_SETTINGS->writeEntry("/YAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Y轴绝对运动定位值改变为%1mm").arg(value));
}
void DeviceControlPanelWidget::on_dsbZAxisABSPos_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Pos");
RS_SETTINGS->writeEntry("/ZAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z1轴绝对运动定位值改变为%1mm").arg(value));
}
void DeviceControlPanelWidget::on_dsbZAAxisABSPos_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Pos");
RS_SETTINGS->writeEntry("/ZAAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z轴绝对运动定位值改变为%1mm").arg(value));
}
void DeviceControlPanelWidget::on_pbABSMove_clicked()
{
DEV->ABSMove();
}
void DeviceControlPanelWidget::on_pbMHToCamera_clicked()
{
DEV->MHToCamera();
}
void DeviceControlPanelWidget::on_pbRHToCamera_clicked()
{
DEV->RHToCamera();
}
void DeviceControlPanelWidget::on_pbCameraToMH_clicked()
{
DEV->CameraToMH();
}
void DeviceControlPanelWidget::on_pbCameraToRH_clicked()
{
DEV->CameraToRH();
}
void DeviceControlPanelWidget::on_pbRHToMH_clicked()
{
DEV->RHToMH();
}
void DeviceControlPanelWidget::on_pbMHToRH_clicked()
{
DEV->MHToRH();
}
void DeviceControlPanelWidget::on_pbDEVInit_clicked()
{
DEV->DEVInit();
bool isdevIsInit = DEV->getDevIsInit();
if (isdevIsInit == false)
return;
DEV->laserCtlCnn();
DEV->AirValveClose();
DEV->CuCeGaoOpen();
bool isreset = DEV->getDevIsReset();
if (isreset == false)
DEV->reset();
if (MODBUSTCP->PLCSts[1] == 1)
{
MODBUSTCP->SeparatePLCRun(MODBUSTCP->InitAddr,10000);
}
else
QMessageBox::information(this, "提示", "分离PLC不在 待机 状态,不能执行 初始化 操作!");
if (MODBUSTCP->PLCSts[0] == 1)
MODBUSTCP->TransferPLCRun(MODBUSTCP->InitAddr,10000);
else
QMessageBox::information(this, "提示", "传输PLC不在 待机 状态,不能执行 初始化 操作!");
}
//void DeviceControlPanelWidget::on_pbReset_clicked()
//{
// DEV->reset();
//}
void DeviceControlPanelWidget::on_pbEStop_clicked()
{
LogIn * login = new(LogIn);
login->exec();
\
}
void DeviceControlPanelWidget::on_pbStop_clicked()
{
// int kkk = 168;
// char buf[10];
// sprintf_s(buf,10,"%04d",kkk);
if (DEV->bUserPower)
{
DEV->stop();
DEVICE_INFO->printDeviceSystemInfo("界面停止按钮按下!");
}
else
{
if (DEV->SuspendFlag)
DEV->SuspendFlag = false;
else
DEV->SuspendFlag = true;
emit DEV->StopStateSGL(!DEV->SuspendFlag);
}
}
extern bool bReadApFlag;
void DeviceControlPanelWidget::on_pbSemiAutoMach_clicked()
{
//AutoShowExceptionInfoDialog("补偿面扫描数据校验失败,是否手动开启补偿、加工?");
// QString machCodeFilePath = "6";
// int index = 5;
// machCodeFilePath = machCodeFilePath + QString("_%1.txt").arg(index);
//DEV->bRunning = true;
//ShowSmallAreasDialog();
bReadApFlag = false;
if (ui->chkAuto->checkState() == Qt::Checked)
{
DEV->runType = 1;
}
else
{
DEV->runType = 0;
}
DEV->checkZaxisAlarmFlag = true;
// QString str = ui->leMachCodeFileName->text();
// char *code;
// QByteArray byCode = str.toLatin1();
// code = byCode.data();
// memcpy_s(MODBUSTCP->RFID,50,code,strlen(code));
IPGLASER->getIPGLaerPara("IPGLaser");
bool ret = IPGLASER->OpenComm();
if (!ret)
{
QMessageBox msg(this);
DEVICE_INFO->printDeviceSalamInfo("激光器串口占用,打开错误!");
msg.setWindowTitle("异常提示");
msg.setText("激光器串口打开错误!");
msg.setIcon(QMessageBox::Critical);
msg.exec();
return;
}
DEV->semiAutoMach();
}
void DeviceControlPanelWidget::on_pbRangeSensorToZero_clicked()
{
//qDebug() << "lihongchang\n";
//qDebug() << "lihongchang";
//qDebug()<< "findedgeflag:"<<findedgeflag;
DEV->RSToZero();
}
void DeviceControlPanelWidget::on_pbCompSurfaceScan_clicked()
{
DEV->compSScan();
}
//void DeviceControlPanelWidget::on_pbSurfaceScan_clicked()
//{
// DEV->SScan();
//}
void DeviceControlPanelWidget::on_pbMHCompOnOrOff_clicked()
{
//if(ui->pbMHCompOnOrOff->text() == "面扫描补偿开")
if (DEV->devPlaneScanCompState == 0)
{
//开补偿
DEV->MHCompOpen();
DEV->devPlaneScanCompState = 1;
}
else
{
DEV->compClose();
DEV->devPlaneScanCompState = 0;
}
}
void DeviceControlPanelWidget::MHCompOpenFHandl()
{
//ui->pbMHCompOnOrOff->setText("面扫描补偿关");
ui->pbMHCompOnOrOff->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 1px solid #555;\n"
" border-radius: 2px;\n"
" border-style: outset; \n"
" \n"
" \n"
" background-color: rgb(0, 178, 0);\n"
" padding: 5px;\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" \n"
" \n"
" \n"
" background-color: rgb(0, 140, 0);\n"
" \n"
" }"));
}
void DeviceControlPanelWidget::MotionCompOpenFHandl()
{
//ui->pbMotionCompOnOrOff->setText("运动补偿关");
ui->pbMotionCompOnOrOff->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 1px solid #555;\n"
" border-radius: 2px;\n"
" border-style: outset; \n"
" \n"
" \n"
" background-color: rgb(0, 178, 0);\n"
" padding: 5px;\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" \n"
" \n"
" \n"
" background-color: rgb(0, 140, 0);\n"
" \n"
" }"));
}
void DeviceControlPanelWidget::setXAxisCtPos(double value)
{
XAxisCtPos = value;
}
void DeviceControlPanelWidget::setYAxisCtPos(double value)
{
YAxisCtPos = value;
}
void DeviceControlPanelWidget::setZAxisCtPos(double value)
{
ZAxisCtPos = value;
}
void DeviceControlPanelWidget::setZAAxisCtPos(double value)
{
ZAAxisCtPos = value;
}
void DeviceControlPanelWidget::SETRfidTextFHandl(char * str)
{
//ui->leMachCodeFileName->setText(str);
}
void DeviceControlPanelWidget::MHCompCloseFHandl()
{
//ui->pbMHCompOnOrOff->setText("面扫描补偿开");
ui->pbMHCompOnOrOff->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 1px solid #555;\n"
" border-radius: 2px;\n"
" border-style: outset; \n"
" \n"
" \n"
" background-color: rgb(214, 143, 29);\n"
" padding: 5px;\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" \n"
" \n"
" \n"
" background-color: rgb(191, 128, 26);\n"
" \n"
" }"));
}
void DeviceControlPanelWidget::MotionCompCloseFHandl()
{
//ui->pbMotionCompOnOrOff->setText("运动补偿开");
ui->pbMotionCompOnOrOff->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 1px solid #555;\n"
" border-radius: 2px;\n"
" border-style: outset; \n"
" \n"
" \n"
" background-color: rgb(214, 143, 29);\n"
" padding: 5px;\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" \n"
" \n"
" \n"
" background-color: rgb(191, 128, 26);\n"
" \n"
" }"));
}
void DeviceControlPanelWidget::on_pbVacuumSuckerOnOrOff_clicked()
{
//if(ui->pbVacuumSuckerOnOrOff->text() == "真空吸盘开")
if (DEV->devWorkpieceLockState == 0)
{
DEV->vacuumSuckerOpen();
DEV->VacuumBreakClose();
}
else
{
DEV->vacuumSuckerClose();
DEV->VacuumBreakOpen();
}
DEV->workpieceHeight = DEV->Palletheight + MAXHEIGHT;
}
void DeviceControlPanelWidget::vacuumSuckerCloseFHandl()
{
//ui->pbVacuumSuckerOnOrOff->setText("真空吸盘开");
ui->pbVacuumSuckerOnOrOff->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 1px solid #555;\n"
" border-radius: 2px;\n"
" border-style: outset; \n"
" \n"
" \n"
" background-color: rgb(214, 143, 29);\n"
" padding: 5px;\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" \n"
" \n"
" \n"
" background-color: rgb(191, 128, 26);\n"
" \n"
" }"));
}
void DeviceControlPanelWidget::vacuumSuckerOpenFHandl()
{
//ui->pbVacuumSuckerOnOrOff->setText("真空吸盘关");
ui->pbVacuumSuckerOnOrOff->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 1px solid #555;\n"
" border-radius: 2px;\n"
" border-style: outset; \n"
" \n"
" \n"
" background-color: rgb(0, 178, 0);\n"
" padding: 5px;\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" \n"
" \n"
" \n"
" background-color: rgb(0, 140, 0);\n"
" \n"
" }"));
}
void DeviceControlPanelWidget::on_pbLaserOnOrOff_clicked()
{
if(DEV->devLaserState == 0)
{
DEV->laserOpen();
}
else
{
DEV->laserClose();
}
}
void DeviceControlPanelWidget::laserOpenFHandl()
{
ui->pbLaserOnOrOff->setText("激光");
ui->pbLaserOnOrOff->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 1px solid #555;\n"
" border-radius: 2px;\n"
" border-style: outset; \n"
" \n"
" \n"
" background-color: rgb(0, 178, 0);\n"
" padding: 5px;\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" \n"
" \n"
" \n"
" background-color: rgb(0, 140, 0);\n"
" \n"
" }"));
}
void DeviceControlPanelWidget::laserCloseFHandl()
{
ui->pbLaserOnOrOff->setText("激光");
ui->pbLaserOnOrOff->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 1px solid #555;\n"
" border-radius: 2px;\n"
" border-style: outset; \n"
" \n"
" \n"
" background-color: rgb(214, 143, 29);\n"
" padding: 5px;\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" \n"
" \n"
" \n"
" background-color: rgb(191, 128, 26);\n"
" \n"
" }"));
}
void DeviceControlPanelWidget::updateXAxisEnablePBStyleSheet(bool state)
{
if(state)
{
ui->pbXEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.772727 rgba(0, 178, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.392045 rgba(0, 160, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"));
}
else
{
ui->pbXEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(159, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(195, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
}
}
void DeviceControlPanelWidget::updateYAxisEnablePBStyleSheet(bool state)
{
if(state)
{
ui->pbYEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.772727 rgba(0, 178, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.392045 rgba(0, 160, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"));
}
else
{
ui->pbYEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(159, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(195, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
}
}
void DeviceControlPanelWidget::updateZAxisEnablePBStyleSheet(bool state)
{
if(state)
{
ui->pbZEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.772727 rgba(0, 178, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.392045 rgba(0, 160, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"));
}
else
{
ui->pbZEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(159, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(195, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
}
}
void DeviceControlPanelWidget::updateZAAxisEnablePBStyleSheet(bool state)
{
if(state)
{
ui->pbZAEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.772727 rgba(0, 178, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.392045 rgba(0, 160, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"));
}
else
{
ui->pbZAEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(159, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(195, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
}
}
void DeviceControlPanelWidget::updateXAxisPBStyleSheet(LIMIT_STATE state)
{
switch (state)
{
case LEFT_LIMIT:
ui->pbXAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(197, 25, 9);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 10, 2);\n"
"}"));
break;
case RIGHT_LIMIT:
ui->pbXAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(197, 25, 9);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 10, 2);\n"
"}"));
break;
case LEFT_SLIMIT:
ui->pbXAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(255, 235, 12);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 255, 127);\n"
"}\n"));
break;
case RIGHT_SLIMIT:
ui->pbXAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(255, 235, 12);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 255, 127);\n"
"}\n"));
break;
case NORMAL:
ui->pbXAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->pbXAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
break;
}
}
void DeviceControlPanelWidget::updateYAxisPBStyleSheet(LIMIT_STATE state)
{
switch (state)
{
case LEFT_LIMIT:
ui->pbYAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(197, 25, 9);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 10, 2);\n"
"}"));
break;
case RIGHT_LIMIT:
ui->pbYAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(197, 25, 9);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 10, 2);\n"
"}"));
break;
case LEFT_SLIMIT:
ui->pbYAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(255, 235, 12);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 255, 127);\n"
"}\n"));
break;
case RIGHT_SLIMIT:
ui->pbYAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(255, 235, 12);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 255, 127);\n"
"}\n"));
break;
case NORMAL:
ui->pbYAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->pbYAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
break;
}
}
void DeviceControlPanelWidget::updateZAxisPBStyleSheet(LIMIT_STATE state)
{
switch (state)
{
case LEFT_LIMIT:
ui->pbZAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(197, 25, 9);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 10, 2);\n"
"}"));
break;
case RIGHT_LIMIT:
ui->pbZAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(197, 25, 9);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 10, 2);\n"
"}"));
break;
case LEFT_SLIMIT:
ui->pbZAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(255, 235, 12);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 255, 127);\n"
"}\n"));
break;
case RIGHT_SLIMIT:
ui->pbZAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(255, 235, 12);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 255, 127);\n"
"}\n"));
break;
case NORMAL:
ui->pbZAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->pbZAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
break;
}
}
void DeviceControlPanelWidget::updateZAAxisPBStyleSheet(LIMIT_STATE state)
{
switch (state)
{
case LEFT_LIMIT:
ui->pbZAAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(197, 25, 9);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 10, 2);\n"
"}"));
break;
case RIGHT_LIMIT:
ui->pbZAAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(197, 25, 9);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 10, 2);\n"
"}"));
break;
case LEFT_SLIMIT:
ui->pbZAAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(255, 235, 12);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 255, 127);\n"
"}\n"));
break;
case RIGHT_SLIMIT:
ui->pbZAAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(255, 235, 12);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 255, 127);\n"
"}\n"));
break;
case NORMAL:
ui->pbZAAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->pbZAAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
break;
}
}
void DeviceControlPanelWidget::updatePBStyleSheet(bool state)
{
if (state)
{
//初始化轴状态
ui->pbZAEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(159, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(195, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
ui->pbZEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(159, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(195, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
ui->pbYEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(159, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(195, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
ui->pbXEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(159, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(195, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
ui->pbZAAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->pbZAAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->pbZAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->pbZAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->pbYAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->pbYAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->pbXAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->pbXAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(16, 121, 31);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 160, 0);\n"
"}\n"));
ui->rbSingleStep->setStyleSheet(QString::fromUtf8("QRadioButton::checked{\n"
"color:rgb(255, 255, 255);\n"
"background-color: rgb(16, 121, 31);\n"
"}\n"
"QRadioButton::unchecked{\n"
"color:rgb(0, 0, 0;\n"
"}\n"));
ui->rbContinued->setStyleSheet(QString::fromUtf8("QRadioButton::checked{\n"
"color:rgb(255, 255, 255);\n"
"background-color: rgb(16, 121, 31);\n"
"}\n"
"QRadioButton::unchecked{\n"
"color:rgb(0, 0, 0);\n"
"}\n"));
DEV->setAxisState();
}
else
{
ui->rbSingleStep->setStyleSheet(QString::fromUtf8("QRadioButton::checked{\n"
"color:rgb(0, 0, 0);\n"
"background-color: rgb(255, 255, 255);\n"
"}\n"
"QRadioButton::unchecked{\n"
"color:rgb(0, 0, 0);\n"
"}\n"));
ui->rbContinued->setStyleSheet(QString::fromUtf8("QRadioButton::checked{\n"
"color:rgb(0, 0, 0);\n"
"background-color: rgb(255, 255, 255);\n"
"}\n"
"QRadioButton::unchecked{\n"
"color:rgb(0, 0, 0);\n"
"}\n"));
ui->pbZAEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(214, 214, 214, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(214, 214, 214, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
ui->pbZEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(214, 214, 214, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(214, 214, 214, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
ui->pbYEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(214, 214, 214, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(214, 214, 214, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
ui->pbXEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 15px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(214, 214, 214, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(214, 214, 214, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
ui->pbZAAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(214, 214, 214);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(214, 214, 214);\n"
"}\n"));
ui->pbZAAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(214, 214, 214);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(214, 214, 214);\n"
"}\n"));
ui->pbZAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(214, 214, 214);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(214, 214, 214);\n"
"}\n"));
ui->pbZAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(214, 214, 214);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(214, 214, 214);\n"
"}\n"));
ui->pbYAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(214, 214, 214);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(214, 214, 214);\n"
"}\n"));
ui->pbYAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(214, 214, 214);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(214, 214, 214);\n"
"}\n"));
ui->pbXAxisP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(214, 214, 214);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(214, 214, 214);\n"
"}\n"));
ui->pbXAxisN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(214, 214, 214);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(214, 214, 214);\n"
"}\n"));
}
}
void DeviceControlPanelWidget::updateEStopPBStyleSheet(bool state)
{
if(state)
{
ui->pbEStop->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 20px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.6, fx:0.6, fy:0.6, stop:0.772727 rgba(16, 121, 31, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.7, fx:0.5, fy:0.5, stop:0.392045 rgba(0, 160, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"));
}
else
{
ui->pbEStop->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 20px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.8, fx:0.6, fy:0.6, stop:0.772727 rgba(136, 9, 21, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.7, fx:0.5, fy:0.5, stop:0.392045 rgba(140, 53, 21, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"
));
}
}
void DeviceControlPanelWidget::GetRunType()
{
if (ui->chkAuto->checkState() == Qt::Checked)
{
DEV->runType = 1;
}
else
{
DEV->runType = 0;
}
}
void DeviceControlPanelWidget::updateVacuumSuckerOnOrOff(bool state)
{
//if(state)
{
ui->pbVacuumSuckerOnOrOff->setEnabled(state);
}
}
void DeviceControlPanelWidget::updateCmbType(bool state)
{
//if(state)
{
ui->cmbType->setEnabled(state);
ui->leMachCodeFileName->setEnabled(state);
}
}
void DeviceControlPanelWidget::updatePbSemiAutoMachStyleSheet(bool state)
{
if(state)
{
ui->pbSemiAutoMach->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 20px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.6, fx:0.6, fy:0.6, stop:0.772727 rgba(16, 121, 31, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.7, fx:0.5, fy:0.5, stop:0.392045 rgba(0, 160, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"));
}
else
{
ui->pbSemiAutoMach->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 20px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.8, fx:0.6, fy:0.6, stop:0.772727 rgba(136, 9, 21, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.7, fx:0.5, fy:0.5, stop:0.392045 rgba(140, 53, 21, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"
));
}
}
void DeviceControlPanelWidget::updatePbStopStyleSheet(bool state)
{
if(state)
{
ui->pbStop->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 20px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.6, fx:0.6, fy:0.6, stop:0.772727 rgba(16, 121, 31, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.7, fx:0.5, fy:0.5, stop:0.392045 rgba(0, 160, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"));
}
else
{
ui->pbStop->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 20px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.8, fx:0.6, fy:0.6, stop:0.772727 rgba(136, 9, 21, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.7, fx:0.5, fy:0.5, stop:0.392045 rgba(140, 53, 21, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"
));
}
}
void DeviceControlPanelWidget::updateDEVInitPBStyleSheet(bool state)
{
if(state)
{
ui->pbDEVInit->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 20px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.6, fx:0.6, fy:0.6, stop:0.772727 rgba(16, 121, 31, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.7, fx:0.5, fy:0.5, stop:0.392045 rgba(0, 160, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"));
}
else
{
ui->pbDEVInit->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 20px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.8, fx:0.6, fy:0.6, stop:0.772727 rgba(136, 9, 21, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.7, fx:0.5, fy:0.5, stop:0.392045 rgba(140, 53, 21, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"
));
}
}
//void DeviceControlPanelWidget::updateResetPBStyleSheet(bool state)
//{
// if(state)
// {
// ui->pbReset->setStyleSheet(QString::fromUtf8("QPushButton {\n"
// " color: #333;\n"
// " border: 2px solid #555;\n"
// " border-radius: 30px;\n"
// " border-style: outset; \n"
// " background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.6, fx:0.6, fy:0.6, stop:0.772727 rgba(0, 178, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
// " padding: 5px;\n"
// " color: rgb(255, 255, 255);\n"
// " }\n"
// "\n"
// "QPushButton:hover {\n"
// " \n"
// " background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.7, fx:0.5, fy:0.5, stop:0.392045 rgba(0, 160, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
// " \n"
// " }"));
// }
// else
// {
// ui->pbReset->setStyleSheet(QString::fromUtf8("QPushButton {\n"
// " color: #333;\n"
// " border: 2px solid #555;\n"
// " border-radius: 30px;\n"
// " border-style: outset; \n"
// " background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.6, fx:0.6, fy:0.6, stop:0.772727 rgba(180, 53, 21, 255), stop:1 rgba(255, 255, 255, 255));\n"
// " padding: 5px;\n"
// " color: rgb(255, 255, 255);\n"
// " }\n"
// "\n"
// "QPushButton:hover {\n"
// " \n"
// " background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.7, fx:0.5, fy:0.5, stop:0.392045 rgba(140, 53, 21, 255), stop:1 rgba(255, 255, 255, 255));\n"
// " \n"
// " }"
// ));
// }
//}
//void DeviceControlPanelWidget::on_pbMachCodeBrowse_clicked()
//{
// QString machCodeFilePath = QFileDialog::getOpenFileName(this,"选择加工代码");
// RS_SETTINGS->beginGroup("device/Mach");
// RS_SETTINGS->writeEntry("/codeFilePath", machCodeFilePath);
// RS_SETTINGS->endGroup();
// QFileInfo fileInfo(machCodeFilePath);
// ui->leMachCodeFileName->setText(fileInfo.fileName());
//}
void DeviceControlPanelWidget::on_pbLoadAndUnloadPos_clicked()
{
DEV->toLoadAndUnloadPos();
}
//void DeviceControlPanelWidget::on_pbSScanStartPos_clicked()
//{
// DEV->toSScanStartPos();
//}
void DeviceControlPanelWidget::on_pbRSToZeroPos_clicked()
{
DEV->toRSToZeroPos();
}
//void DeviceControlPanelWidget::on_pbMachStartPos_clicked()
//{
// DEV->toMachStartPos();
//}
// Z轴到常用位置
//void DeviceControlPanelWidget::on_pbZAAxisCPMove_clicked()
//{
// DEV->toZAAxisCPos();
//}
void DeviceControlPanelWidget::on_pbXAxisRMoveVelM10_clicked()
{
ui->dsbXAxisRMoveVel->setValue(ui->dsbXAxisRMoveVel->value()*10);
}
void DeviceControlPanelWidget::on_pbXAxisRMoveVelD10_clicked()
{
ui->dsbXAxisRMoveVel->setValue(ui->dsbXAxisRMoveVel->value()/10);
}
void DeviceControlPanelWidget::on_pbYAxisRMoveVelM10_clicked()
{
ui->dsbYAxisRMoveVel->setValue(ui->dsbYAxisRMoveVel->value()*10);
}
void DeviceControlPanelWidget::on_pbYAxisRMoveVelD10_clicked()
{
ui->dsbYAxisRMoveVel->setValue(ui->dsbYAxisRMoveVel->value()/10);
}
void DeviceControlPanelWidget::on_pbZAxisRMoveVelM10_clicked()
{
ui->dsbZAxisRMoveVel->setValue(ui->dsbZAxisRMoveVel->value()*10);
}
void DeviceControlPanelWidget::on_pbZAxisRMoveVelD10_clicked()
{
ui->dsbZAxisRMoveVel->setValue(ui->dsbZAxisRMoveVel->value()/10);
}
void DeviceControlPanelWidget::on_pbZAAxisRMoveVelM10_clicked()
{
ui->dsbZAAxisRMoveVel->setValue(ui->dsbZAAxisRMoveVel->value()*10);
}
void DeviceControlPanelWidget::on_pbZAAxisRMoveVelD10_clicked()
{
ui->dsbZAAxisRMoveVel->setValue(ui->dsbZAAxisRMoveVel->value()/10);
}
void DeviceControlPanelWidget::on_pbRMoveStepDistM10_clicked()
{
ui->dsbRMoveStepDist->setValue(ui->dsbRMoveStepDist->value()*10);
}
void DeviceControlPanelWidget::on_pbRMoveStepDistD10_clicked()
{
ui->dsbRMoveStepDist->setValue(ui->dsbRMoveStepDist->value()/10);
}
//void DeviceControlPanelWidget::addCbZAAxisCPItem(const QString& textValue,double value)
//{
// ui->cbZAAxisCP->addItem(textValue);
// ZAAxisCPosMap[textValue] = value;
// RS_SETTINGS->beginGroup("device");
// RS_SETTINGS->writeEntry("/ZAAxisCPosMap", ZAAxisCPosMap);
// RS_SETTINGS->endGroup();
//}
//void DeviceControlPanelWidget::cbZAAxisCPCtTextChangedHandl(const QString &text)
//{
// RS_SETTINGS->beginGroup("device");
// RS_SETTINGS->writeEntry("/ZAAxisCPCtText", text);
// RS_SETTINGS->endGroup();
//}
void DeviceControlPanelWidget::showExceptionInfoDialog(const QString& text,QMessageBox::Icon value)
{
QMessageBox msg(this);
msg.setWindowTitle("异常提示");
msg.setText(text);
msg.setIcon(value);
msg.exec();
}
void DeviceControlPanelWidget::AutoShowExceptionInfoDialog(const QString& text)
{
QMessageBox msg(this);
int ret;
msg.setWindowTitle("信息");
msg.setText(text);
msg.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
msg.setIcon(QMessageBox::Question);
ret = msg.exec();
if (ret == QMessageBox::Yes)
DEV->setDataCheck(true);
else
DEV->setDataCheck(false);
}
void DeviceControlPanelWidget::ShowSmallAreasDialog()
{
SpecificAreasWidget * specificAreasWidget = new(SpecificAreasWidget);
specificAreasWidget->exec();
//这还有其他东西
}
void DeviceControlPanelWidget::AutoExceptionHandl(MyException mye)
{
DEV->setAlarm(true);
AutoShowExceptionInfoDialog(mye.getExceptInfo());
DEV->setAlarm(false);
}
void DeviceControlPanelWidget::exceptionHandl(MyException mye)
{
if(MY_CRITICAL == mye.getExceptLevel())
{
DEV->setAlarm(true);
if(mye.getExceptInfo()=="网络连接断开。")
{
DEVICE_INFO->printDeviceSalamInfo("网络连接断开。");
showExceptionInfoDialog("网络连接断开。");
}
else
{
DEVICE_INFO->printDeviceSalamInfo(mye.getExceptInfoWithExceptCode());
showExceptionInfoDialog(mye.getExceptInfoWithExceptCode());
}
DEV->setAlarm(false);
}
if(MY_WARN == mye.getExceptLevel())
{
DEV->setAlarm(true);
DEVICE_INFO->printDeviceSalamInfo(mye.getExceptInfo(),D_WARNING);
showExceptionInfoDialog(mye.getExceptInfo(),QMessageBox::Warning);
DEV->setAlarm(false);
}
}
void DeviceControlPanelWidget::on_pbLaserApTestPos_clicked()
{
DEV->toLaserApTestPos();
}
//void DeviceControlPanelWidget::on_pbHeightFindPos_clicked()
//{
// DEV->toHeightFindPos();
//}
void DeviceControlPanelWidget::on_pbEdgeSearchPos_clicked()
{
DEV->toEdgeSearchPos();
}
void DeviceControlPanelWidget::on_pbCompenTestPos_clicked()
{
// DEV->bAutoLoadUnloadFlag = false;
// DEV->toCompenTestPos();
DEV->toRecordPos();
}
void DeviceControlPanelWidget::on_pbFindEdge_clicked()
{
DEV->RSToZero_Z0();
//DEV->reset_z();
//DEV->FindEdge();
}
void DeviceControlPanelWidget::on_cmbType_currentTextChanged(const QString &strValue)
{
RS_SETTINGS->beginGroup("device/Type");
RS_SETTINGS->writeEntry("/value", strValue);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS");
double XRange = RS_SETTINGS->readNumDEntry("/XRange",1.0);
double YRange = RS_SETTINGS->readNumDEntry("/YRange",1.0);
RS_SETTINGS->endGroup();
QString machCodeFilePath;
QString machCodeFilePath2;
QString machCodeFilePath3;
QString machCodeFilePath4;
QString machCodeFilePath5;
if (strValue == "6寸")
{
XRange = INCHES6 * 2;
YRange = INCHES6 * 2;
machCodeFilePath =".\\WorkFile\\6";
machCodeFilePath2 =".\\WorkFile\\6_2.txt";
machCodeFilePath3 =".\\WorkFile\\6_3.txt";
machCodeFilePath4 =".\\WorkFile\\6_4.txt";
machCodeFilePath5 =".\\WorkFile\\6_5.txt";
}
else if (strValue == "8寸")
{
XRange = INCHES8 * 2;
YRange = INCHES8 * 2;
machCodeFilePath =".\\WorkFile\\8";
machCodeFilePath2 =".\\WorkFile\\8_2.txt";
machCodeFilePath3 =".\\WorkFile\\8_3.txt";
machCodeFilePath4 =".\\WorkFile\\8_4.txt";
machCodeFilePath5 =".\\WorkFile\\8_5.txt";
}
else if (strValue == "4寸")
{
XRange = INCHES4 * 2;
YRange = INCHES4 * 2;
machCodeFilePath =".\\WorkFile\\4";
machCodeFilePath2 =".\\WorkFile\\4_2.txt";
machCodeFilePath3 =".\\WorkFile\\4_3.txt";
machCodeFilePath4 =".\\WorkFile\\4_4.txt";
machCodeFilePath5 =".\\WorkFile\\4_5.txt";
}
else
{
machCodeFilePath =".\\WorkFile\\M.txt";
machCodeFilePath2 =".\\WorkFile\\M_2.txt";
machCodeFilePath3 =".\\WorkFile\\M_3.txt";
machCodeFilePath4 =".\\WorkFile\\M_4.txt";
machCodeFilePath5 =".\\WorkFile\\M_5.txt";
}
RS_SETTINGS->beginGroup("device/Mach");
RS_SETTINGS->writeEntry("/codeFilePath", machCodeFilePath);
RS_SETTINGS->writeEntry("/codeFilePath2", machCodeFilePath2);
RS_SETTINGS->writeEntry("/codeFilePath3", machCodeFilePath3);
RS_SETTINGS->writeEntry("/codeFilePath4", machCodeFilePath4);
RS_SETTINGS->writeEntry("/codeFilePath5", machCodeFilePath5);
RS_SETTINGS->endGroup();
//ui->leMachCodeFileName->setText(machCodeFilePath);
RS_SETTINGS->beginGroup("device/SSCS");
RS_SETTINGS->writeEntry("/XRange",XRange);
RS_SETTINGS->writeEntry("/YRange",YRange);
RS_SETTINGS->endGroup();
}
void DeviceControlPanelWidget::on_pbLaserMarking_clicked()
{
DEV->strLaserMark_test = ui->leMachCodeFileName->currentText();
DEV->toLaserMarkPos();
}
//void DeviceControlPanelWidget::on_pbSuspend_clicked()
//{
//// if(ui->pbSuspend->text() == "暂停")
//// {
//// DEV->Suspend();
//// }
//// else
//// {
//// DEV->ContinueBuffer();
//// }
// //DEV->pLaserMark->SetParam();
//}
//void DeviceControlPanelWidget::suspendBufferFHandl()
//{
// ui->pbSuspend->setText("继续运行");
//}
//void DeviceControlPanelWidget::continueBufferFHandl()
//{
// ui->pbSuspend->setText("暂停");
//}
void DeviceControlPanelWidget::on_pushButton_clicked()
{
//strcpy_s(MODBUSTCP->RFID,"123456");
//MODBUSTCP->ModbusWrite_force(MODBUSTCP->RFID,strlen(MODBUSTCP->RFID));
RS_SETTINGS->beginGroup("device/RecordPos");
RS_SETTINGS->writeEntry("/XAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/YAxis", YAxisCtPos);
RS_SETTINGS->writeEntry("/ZAAxis", ZAAxisCtPos);
RS_SETTINGS->writeEntry("/ZAxis", ZAxisCtPos);
RS_SETTINGS->endGroup();
}
void DeviceControlPanelWidget::on_chkAuto_clicked()
{
bool flag;
flag = ui->chkAuto->isChecked();
if (flag)
{
DEV->runType = 1;
}
else
DEV->runType = 0;
}
//void DeviceControlPanelWidget::on_cbCheckAlarm_clicked()
//{
// bool flag;
// flag = ui->cbCheckAlarm->isChecked();
// if (flag)
// {
// DEV->checkZaxisAlarmFlag = true;
// }
// else
// DEV->checkZaxisAlarmFlag = false;
//}
void DeviceControlPanelWidget::updateLogInPower(bool state)
{
DEV->bUserPower = state;
updatePBStyleSheet(state);
ui->cmbType->setEnabled(state);
ui->pbLaserOnOrOff->setEnabled(state);
ui->pbCompSurfaceScan->setEnabled(state);
ui->pbMHCompOnOrOff->setEnabled(state);
ui->pbRangeSensorToZero->setEnabled(state);
//ui->chkAuto->setEnabled(state);
//ui->pbSemiAutoMach->setEnabled(state);
//ui->pbSuspend->setEnabled(state);
ui->dsbXAxisABSPos->setEnabled(state);
ui->cbABSXAxisIsMove->setEnabled(state);
ui->dsbYAxisABSPos->setEnabled(state);
ui->cbABSYAxisIsMove->setEnabled(state);
ui->dsbZAAxisABSPos->setEnabled(state);
ui->cbABSZAAxisIsMove->setEnabled(state);
ui->dsbZAxisABSPos->setEnabled(state);
ui->cbABSZAxisIsMove->setEnabled(state);
ui->pbABSMove->setEnabled(state);
//ui->cbZAAxisCP->setEnabled(state);
//ui->cbCheckAlarm->setEnabled(state);
//ui->pbZAAxisCPMove->setEnabled(state);
//ui->pbHeightFindPos->setEnabled(state);
ui->pbLaserApTestPos->setEnabled(state);
//ui->pbLoadAndUnloadPos->setEnabled(state);
ui->pbRSToZeroPos->setEnabled(state);
ui->pushButton->setEnabled(state);
ui->pbEdgeSearchPos->setEnabled(state);
ui->pbCompenTestPos->setEnabled(state);
ui->pbLaserMarking->setEnabled(state);
ui->pbFindEdge->setEnabled(state);
//ui->leMachCodeFileName->setEnabled(state);
ui->cmbType->setEnabled(state);
ui->dsbXAxisRMoveVel->setEnabled(state);
ui->pbXAxisRMoveVelM10->setEnabled(state);
ui->pbXAxisRMoveVelD10->setEnabled(state);
ui->dsbYAxisRMoveVel->setEnabled(state);
ui->pbYAxisRMoveVelM10->setEnabled(state);
ui->pbYAxisRMoveVelD10->setEnabled(state);
ui->dsbZAxisRMoveVel->setEnabled(state);
ui->pbZAxisRMoveVelM10->setEnabled(state);
ui->pbZAxisRMoveVelD10->setEnabled(state);
ui->dsbZAAxisRMoveVel->setEnabled(state);
ui->pbZAAxisRMoveVelM10->setEnabled(state);
ui->pbZAAxisRMoveVelD10->setEnabled(state);
ui->pbXEnable->setEnabled(state);
ui->pbZAEnable->setEnabled(state);
ui->pbYEnable->setEnabled(state);
ui->pbZEnable->setEnabled(state);
ui->pbMHToCamera->setEnabled(state);
ui->pbMHToRH->setEnabled(state);
ui->pbRHToCamera->setEnabled(state);
ui->pbCameraToMH->setEnabled(state);
ui->pbCameraToRH->setEnabled(state);
ui->pbRHToMH->setEnabled(state);
ui->rbSingleStep->setEnabled(state);
ui->rbContinued->setEnabled(state);
ui->dsbRMoveStepDist->setEnabled(state);
ui->pbRMoveStepDistM10->setEnabled(state);
ui->pbRMoveStepDistD10->setEnabled(state);
ui->pbYAxisP->setEnabled(state);
ui->pbZAAxisP->setEnabled(state);
ui->pbZAxisP->setEnabled(state);
ui->pbZAxisN->setEnabled(state);
ui->pbXAxisN->setEnabled(state);
ui->pbXAxisP->setEnabled(state);
ui->pbYAxisN->setEnabled(state);
ui->pbZAAxisN->setEnabled(state);
}
void DeviceControlPanelWidget::ShangliaoSolt(bool state)
{
if (!state)
{
showExceptionInfoDialog("手动上料失败!");
}
else
{
showExceptionInfoDialog("手动上料完成!");
}
}
void DeviceControlPanelWidget::XialiaoSolt(bool state)
{
if (!state)
{
showExceptionInfoDialog("手动下料失败!");
}
else
{
showExceptionInfoDialog("手动下料完成!");
}
}
void DeviceControlPanelWidget::on_pbGetRFID_clicked()
{
DEV->ElectricResistanceCheck();
//DEV->pLaserMark->SetParam();
/*
//ModbusRead(,20);
int ret;
ui->leMachCodeFileName->setText("");
ret = MODBUSTCP->ModbusRead(MODBUSTCP->xiaReadStsAddr, 1);//shangReadRFIDAddr
//MODBUSTCP->RFID[DEV->RFIDCount] = 0;
QString str;
str = QString::number(ret);
//ui->leMachCodeFileName->setText(MODBUSTCP->RFID);
ui->leMachCodeFileName->setText(str);
*/
// QString machCodeFilePath = QFileDialog::getOpenFileName(this,"选择加工代码");
// RS_SETTINGS->beginGroup("device/Mach");
// RS_SETTINGS->writeEntry("/codeFilePath", machCodeFilePath);
// RS_SETTINGS->endGroup();
// QFileInfo fileInfo(machCodeFilePath);
// ui->leMachCodeFileName->setText(fileInfo.fileName());
/* //解密测试
//QFile f(".\\WorkFile\\4_en.txt");
QFile f(".\\Data\\work2.txt");
if(!f.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug() << ("打开文件失败!");
return ;
}
QTextStream txtInput(&f);
QString lineStr;
while(!txtInput.atEnd())
{
lineStr += txtInput.readLine();
}
//qDebug() << (lineStr);
f.close();
std::string cstr;
cstr = std::string((const char *)lineStr.toLocal8Bit());
using base64 = cppcodec::base64_rfc4648;
std::vector<uint8_t> decoded = base64::decode(cstr);
std::string deStr(decoded.begin(), decoded.end());
QString qstring;
qstring = QString(QString::fromLocal8Bit(deStr.c_str()));
// 写txt文件
{
// 文件位置
QFile file(".\\Data\\work2_decode.txt");
if(!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
return;
}
// 文件流
QTextStream stream(&file);
// 输入内容
stream << qstring;
file.close();
}
*/
}
/*
QFile f(".\\WorkFile\\4_en.txt");
//QFile f(".\\Data\\Data_en.ini");
if(!f.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug() << ("打开文件失败!");
return ;
}
QTextStream txtInput(&f);
QString lineStr;
while(!txtInput.atEnd())
{
lineStr += txtInput.readLine();
}
//qDebug() << (lineStr);
f.close();
std::string cstr;
cstr = std::string((const char *)lineStr.toLocal8Bit());
using base64 = cppcodec::base64_rfc4648;
std::vector<uint8_t> decoded = base64::decode(cstr);
std::string deStr(decoded.begin(), decoded.end());
QString qstring;
qstring = QString(QString::fromLocal8Bit(deStr.c_str()));
// 写txt文件
{
// 文件位置
QFile file(".\\WorkFile\\4_en_de.txt");
if(!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
return;
}
// 文件流
QTextStream stream(&file);
// 输入内容
stream << qstring;
file.close();
}
*/
/*
//QFile f(".\\WorkFile\\4.txt");
QFile f(".\\Data\\Data.ini");
if(!f.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug() << ("打开文件失败!");
return ;
}
QTextStream txtInput(&f);
QString lineStr;
while(!txtInput.atEnd())
{
lineStr += txtInput.readLine()+"\n";
}
//qDebug() << (lineStr);
f.close();
std::string cstr;
cstr = std::string((const char *)lineStr.toLocal8Bit());
std::string enStr = base64_encode(cstr);
QString qstring;
qstring = QString(QString::fromLocal8Bit(enStr.c_str()));
// 写txt文件
{
// 文件位置
QFile file(".\\Data\\Data_en.ini");
if(!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
return;
}
// 文件流
QTextStream stream(&file);
// 输入内容
stream << qstring;
file.close();
}
*/
/*
std::string cstr;
QString qstring;
//从std::string 到QString
qstring = QString(QString::fromLocal8Bit(cstr.c_str()));
//从QString 到 std::string
cstr = string((const char *)qstring.toLocal8Bit());
//不需要从gbk转到utf8
QString value_content = QString::fromStdString(vec[i].content);
QString value_classname = QString::fromStdString(vec[i].classname);
std::vector<uint8_t> vecLogHeader
std::string s(vecLogHeader.begin(), vecLogHeader.end());
std::cout << s << std::endl; // C++
*/
/* 解码文件
*
QFile f(".\\WorkFile\\4_en.txt");
//QFile f(".\\Data\\Data_en.ini");
if(!f.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug() << ("打开文件失败!");
return ;
}
QTextStream txtInput(&f);
QString lineStr;
while(!txtInput.atEnd())
{
lineStr += txtInput.readLine();
}
//qDebug() << (lineStr);
f.close();
std::string cstr;
cstr = std::string((const char *)lineStr.toLocal8Bit());
using base64 = cppcodec::base64_rfc4648;
std::vector<uint8_t> decoded = base64::decode(cstr);
std::string deStr(decoded.begin(), decoded.end());
QString qstring;
qstring = QString(QString::fromLocal8Bit(deStr.c_str()));
*/
void DeviceControlPanelWidget::on_pbMotionCompOnOrOff_clicked()
{
//if(ui->pbMotionCompOnOrOff->text() == "运动补偿开")
if (DEV->devMotionCompState == 0)
{
//开补偿
DEV->MotionCompOpen(true,nullptr);
}
else
{
DEV->MotionCompClose();
}
}
void DeviceControlPanelWidget::on_pbGlobalCameraPos_clicked()
{
DEV->toGloblaCameraPos();
}
void DeviceControlPanelWidget::on_pbXiaoJiaGong_clicked()
{
DEV->MachSmallArea();
}
void DeviceControlPanelWidget::on_pbGetGlobalCamera_clicked()
{
DEV->GetGlobalPhoto();
}
//void DeviceControlPanelWidget::on_pbSelectFile_clicked()
//{
// QString curPath=QCoreApplication::applicationDirPath(); //获取应用程序的路径
// QString aFileName=QFileDialog::getOpenFileName(this,"选择文件",curPath, "数据文件(*.WI);;所有文件(*.*)");
// if (aFileName == "")
// return;
// ui->leMachCodeFileName->setText(aFileName);
// RS_SETTINGS->beginGroup("device/WorkFile");
// RS_SETTINGS->writeEntry("/workfilename",aFileName);
// RS_SETTINGS->endGroup();
//}
void DeviceControlPanelWidget::on_leMachCodeFileName_currentTextChanged(const QString &arg1)
{
RS_SETTINGS->beginGroup("device/WorkFile");
RS_SETTINGS->writeEntry("/workfilename",arg1);
RS_SETTINGS->endGroup();
}
void DeviceControlPanelWidget::on_spbPowerAdjust_valueChanged(int arg1)
{
QString strPower;
strPower = QString::number(DEV->ApPercentage + (DEV->ApPercentage * arg1),'f',2);
int ret = IPGLASER->SetSingleParam("32",strPower);
Sleep(50);
}
void DeviceControlPanelWidget::on_pbReset_clicked()
{
// DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴工作位置改变完成1231242"));
// double value = 2.333;
// DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴工作位置改变完成当前位置为%1mm").arg(value));
int choose= QMessageBox::question(this, tr("强制复位"),
QString(tr("是否强制复位?")),
QMessageBox::Yes | QMessageBox::No);
if (choose== QMessageBox::No)
{
}
else if (choose== QMessageBox::Yes)
{
DEV->reset();
}
}