821 lines
28 KiB
C++
821 lines
28 KiB
C++
|
#include "rotacomwidget.h"
|
||
|
#include "ui_rotacomwidget.h"
|
||
|
|
||
|
#include <QDebug>
|
||
|
#include "main.h"
|
||
|
#include "numerinputdialog.h"
|
||
|
#include "items/cmdconfig.h"
|
||
|
|
||
|
RotaComWidget::RotaComWidget(QWidget *parent) :
|
||
|
QWidget(parent),
|
||
|
ui(new Ui::RotaComWidget)
|
||
|
{
|
||
|
ui->setupUi(this);
|
||
|
setWindowFlags (Qt::Window | Qt::FramelessWindowHint);
|
||
|
//setWindowModality(Qt::ApplicationModal);
|
||
|
|
||
|
ui->pushButtonZeroCom1->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom1").toFloat(),'f',2));
|
||
|
ui->pushButtonZeroCom2->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom2").toFloat(),'f',2));
|
||
|
ui->pushButtonZeroCom3->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom3").toFloat(),'f',2));
|
||
|
ui->pushButtonZeroCom4->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom4").toFloat(),'f',2));
|
||
|
ui->pushButtonZeroCom5->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom5").toFloat(),'f',2));
|
||
|
ui->pushButtonZeroCom6->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom6").toFloat(),'f',2));
|
||
|
|
||
|
ui->pushButtonZeroCom7->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom7").toFloat(),'f',2));
|
||
|
ui->pushButtonZeroCom8->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom8").toFloat(),'f',2));
|
||
|
ui->pushButtonZeroCom9->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom9").toFloat(),'f',2));
|
||
|
ui->pushButtonZeroCom10->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom10").toFloat(),'f',2));
|
||
|
ui->pushButtonZeroCom11->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom11").toFloat(),'f',2));
|
||
|
ui->pushButtonZeroCom12->setText(QString::number(g_pSettings->readFromIniFile("AUFUS/ZeroCom12").toFloat(),'f',2));
|
||
|
|
||
|
m_speedLevel = 0;
|
||
|
initControl();
|
||
|
}
|
||
|
|
||
|
RotaComWidget::~RotaComWidget()
|
||
|
{
|
||
|
delete ui;
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::initControl()//初始化窗体控件,包括位置、尺寸、样式
|
||
|
{
|
||
|
//根据不同分辨率设置控件的位置和尺寸
|
||
|
switch (g_emResolut)
|
||
|
{
|
||
|
case resolution1910:
|
||
|
initResolution1910();
|
||
|
break;
|
||
|
case resolution1006:
|
||
|
initResolution1006();
|
||
|
break;
|
||
|
default:
|
||
|
this->resize(1024,600);
|
||
|
break;
|
||
|
}
|
||
|
initControlStyle();//初始化窗体控件样式
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::initResolution1910()//初始化窗体控件为1920x1080分辨率
|
||
|
{
|
||
|
this->resize(1920,1080);
|
||
|
this->setGeometry(0,0,1920,1080);
|
||
|
ui->frameRota->setGeometry(0,0,1920,1080);
|
||
|
|
||
|
ui->labelTitle->setGeometry(9,8,560,60);
|
||
|
ui->frameNeedle->setGeometry( 37,70 ,1650 ,105);
|
||
|
ui->frameZeroCom->setGeometry( 37,190 ,1650 ,105);
|
||
|
ui->frameZeroCom_2->setGeometry( 37,310 ,1650 ,105);
|
||
|
|
||
|
ui->frameRotaZero->setGeometry( 37,430 ,1650 ,105);
|
||
|
ui->framePunchingSpindle1->setGeometry( 37,550 ,1650 ,105);
|
||
|
ui->framePunchingSpindle2->setGeometry( 37,670 ,1650 ,105);
|
||
|
ui->frameRotaryMotor1->setGeometry( 37,790 ,1650 ,105);
|
||
|
ui->frameRotaryMotor2->setGeometry( 37,910 ,1650 ,105);
|
||
|
|
||
|
ui->frameOkCancel->setGeometry( 1710,400 ,185 ,290);
|
||
|
|
||
|
ui->labelNeedle->setGeometry( 0,0 ,370 ,105);
|
||
|
ui->pushButtonNeedel1->setGeometry( 240,0 ,185 ,105);
|
||
|
ui->pushButtonNeedel2->setGeometry( 480,0 ,185 ,105);
|
||
|
ui->pushButtonNeedel3->setGeometry( 720,0 ,185 ,105);
|
||
|
ui->pushButtonNeedel4->setGeometry( 960,0 ,185 ,105);
|
||
|
ui->pushButtonNeedel5->setGeometry( 1200,0 ,185 ,105);
|
||
|
ui->pushButtonNeedel6->setGeometry( 1440,0 ,185 ,105);
|
||
|
|
||
|
ui->labelZeroCom->setGeometry( 0,0 ,370 ,105);
|
||
|
ui->pushButtonZeroCom1->setGeometry( 240,0 ,185 ,105);
|
||
|
ui->pushButtonZeroCom2->setGeometry( 480,0 ,185 ,105);
|
||
|
ui->pushButtonZeroCom3->setGeometry( 720,0 ,185 ,105);
|
||
|
ui->pushButtonZeroCom4->setGeometry( 960,0 ,185 ,105);
|
||
|
ui->pushButtonZeroCom5->setGeometry( 1200,0 ,185 ,105);
|
||
|
ui->pushButtonZeroCom6->setGeometry( 1440,0 ,185 ,105);
|
||
|
|
||
|
ui->labelZeroCom_2->setGeometry( 0,0 ,370 ,105);
|
||
|
ui->pushButtonZeroCom7->setGeometry( 240,0 ,185 ,105);
|
||
|
ui->pushButtonZeroCom8->setGeometry( 480,0 ,185 ,105);
|
||
|
ui->pushButtonZeroCom9->setGeometry( 720,0 ,185 ,105);
|
||
|
ui->pushButtonZeroCom10->setGeometry( 960,0 ,185 ,105);
|
||
|
ui->pushButtonZeroCom11->setGeometry( 1200,0 ,185 ,105);
|
||
|
ui->pushButtonZeroCom12->setGeometry( 1440,0 ,185 ,105);
|
||
|
|
||
|
ui->labelManual->setGeometry( 0,0 ,370 ,105);
|
||
|
ui->buttonChangeTool->setGeometry( 480,0 ,185 ,105);
|
||
|
ui->buttonSinglePunch->setGeometry( 720,0 ,185 ,105);
|
||
|
ui->buttonJog->setGeometry( 960,0 ,185 ,105);
|
||
|
ui->buttonManualChange->setGeometry( 1200,0 ,185 ,105);
|
||
|
ui->buttonRotaZero->setGeometry( 1440,0 ,185 ,105);
|
||
|
|
||
|
ui->labelPunchingSpindle1->setGeometry( 0,0 ,370 ,105);
|
||
|
ui->buttonChange->setGeometry( 480,0 ,185 ,105);
|
||
|
ui->buttonEnable->setGeometry( 720,0 ,185 ,105);
|
||
|
ui->buttonDisenable->setGeometry( 960,0 ,185 ,105);
|
||
|
ui->buttonForeward->setGeometry( 1200,0 ,185 ,105);
|
||
|
ui->buttonReversal->setGeometry( 1440,0 ,185 ,105);
|
||
|
|
||
|
ui->labelPunchingSpindle2->setGeometry( 0,0 ,370 ,105);
|
||
|
ui->buttonChange_2->setGeometry( 480,0 ,185 ,105);
|
||
|
ui->buttonEnable_2->setGeometry( 720,0 ,185 ,105);
|
||
|
ui->buttonDisenable_2->setGeometry( 960,0 ,185 ,105);
|
||
|
ui->buttonForeward_2->setGeometry( 1200,0 ,185 ,105);
|
||
|
ui->buttonReversal_2->setGeometry( 1440,0 ,185 ,105);
|
||
|
|
||
|
ui->labelRotaryMotor1->setGeometry( 0,0 ,370 ,105);
|
||
|
ui->buttonChange_3->setGeometry( 480,0 ,185 ,105);
|
||
|
ui->buttonEnable_3->setGeometry( 720,0 ,185 ,105);
|
||
|
ui->buttonDisenable_3->setGeometry( 960,0 ,185 ,105);
|
||
|
ui->buttonForeward_3->setGeometry( 1200,0 ,185 ,105);
|
||
|
ui->buttonReversal_3->setGeometry( 1440,0 ,185 ,105);
|
||
|
|
||
|
ui->labelRotaryMotor2->setGeometry( 0,0 ,370 ,105);
|
||
|
ui->buttonChange_4->setGeometry( 480,0 ,185 ,105);
|
||
|
ui->buttonEnable_4->setGeometry( 720,0 ,185 ,105);
|
||
|
ui->buttonDisenable_4->setGeometry( 960,0 ,185 ,105);
|
||
|
ui->buttonForeward_4->setGeometry( 1200,0 ,185 ,105);
|
||
|
ui->buttonReversal_4->setGeometry( 1440,0 ,185 ,105);
|
||
|
|
||
|
ui->buttonOk->setGeometry( 0,310 ,180 ,105);
|
||
|
ui->buttonCancel->setGeometry( 0,965 ,180 ,105);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::initResolution1006()//初始化窗体控件为1024x600分辨率
|
||
|
{
|
||
|
this->resize(1024,600);
|
||
|
this->setGeometry(0,0,1024,600);
|
||
|
ui->frameRota->setGeometry(0,0,1024,600);
|
||
|
|
||
|
ui->labelTitle->setGeometry(5,5,300,35);
|
||
|
ui->frameNeedle->setGeometry( 20,40 ,900 ,60);
|
||
|
ui->frameZeroCom->setGeometry( 20,110 ,900 ,60);
|
||
|
ui->frameZeroCom_2->setGeometry( 20,180 ,900 ,60);
|
||
|
|
||
|
ui->frameRotaZero->setGeometry( 20,250 ,900 ,60);
|
||
|
ui->framePunchingSpindle1->setGeometry( 20,320 ,900 ,60);
|
||
|
ui->framePunchingSpindle2->setGeometry( 20,390 ,900 ,60);
|
||
|
ui->frameRotaryMotor1->setGeometry( 20,460 ,900 ,60);
|
||
|
ui->frameRotaryMotor2->setGeometry( 20,530 ,900 ,60);
|
||
|
|
||
|
ui->frameOkCancel->setGeometry( 920,0 ,100 ,600);
|
||
|
|
||
|
ui->labelNeedle->setGeometry( 0,0 ,110 ,60);
|
||
|
ui->pushButtonNeedel1->setGeometry( 130,0 ,100 ,60);
|
||
|
ui->pushButtonNeedel2->setGeometry( 260,0 ,100 ,60);
|
||
|
ui->pushButtonNeedel3->setGeometry( 390,0 ,100 ,60);
|
||
|
ui->pushButtonNeedel4->setGeometry( 520,0 ,100 ,60);
|
||
|
ui->pushButtonNeedel5->setGeometry( 650,0 ,100 ,60);
|
||
|
ui->pushButtonNeedel6->setGeometry( 780,0 ,100 ,60);
|
||
|
|
||
|
ui->labelZeroCom->setGeometry( 0,0 ,110 ,60);
|
||
|
ui->pushButtonZeroCom1->setGeometry( 130,0 ,100 ,60);
|
||
|
ui->pushButtonZeroCom2->setGeometry( 260,0 ,100 ,60);
|
||
|
ui->pushButtonZeroCom3->setGeometry( 390,0 ,100 ,60);
|
||
|
ui->pushButtonZeroCom4->setGeometry( 520,0 ,100 ,60);
|
||
|
ui->pushButtonZeroCom5->setGeometry( 650,0 ,100 ,60);
|
||
|
ui->pushButtonZeroCom6->setGeometry( 780,0 ,100 ,60);
|
||
|
|
||
|
ui->labelZeroCom_2->setGeometry( 0,0 ,110 ,60);
|
||
|
ui->pushButtonZeroCom7->setGeometry( 130,0 ,100 ,60);
|
||
|
ui->pushButtonZeroCom8->setGeometry( 260,0 ,100 ,60);
|
||
|
ui->pushButtonZeroCom9->setGeometry( 390,0 ,100 ,60);
|
||
|
ui->pushButtonZeroCom10->setGeometry( 520,0 ,100 ,60);
|
||
|
ui->pushButtonZeroCom11->setGeometry( 650,0 ,100 ,60);
|
||
|
ui->pushButtonZeroCom12->setGeometry( 780,0 ,100 ,60);
|
||
|
|
||
|
ui->labelManual->setGeometry( 0,0 ,110 ,60);
|
||
|
ui->buttonChangeTool->setGeometry( 260,0 ,100 ,60);
|
||
|
ui->buttonSinglePunch->setGeometry( 390,0 ,100 ,60);
|
||
|
ui->buttonJog->setGeometry( 520,0 ,100 ,60);
|
||
|
ui->buttonManualChange->setGeometry( 650,0 ,100 ,60);
|
||
|
ui->buttonRotaZero->setGeometry( 780,0 ,100 ,60);
|
||
|
|
||
|
ui->labelPunchingSpindle1->setGeometry( 0,0 ,200 ,60);
|
||
|
ui->buttonChange->setGeometry( 260,0 ,100 ,60);
|
||
|
ui->buttonEnable->setGeometry( 390,0 ,100 ,60);
|
||
|
ui->buttonDisenable->setGeometry( 520,0 ,100 ,60);
|
||
|
ui->buttonForeward->setGeometry( 650,0 ,100 ,60);
|
||
|
ui->buttonReversal->setGeometry( 780,0 ,100 ,60);
|
||
|
|
||
|
ui->labelPunchingSpindle2->setGeometry( 0,0 ,200 ,60);
|
||
|
ui->buttonChange_2->setGeometry( 260,0 ,100 ,60);
|
||
|
ui->buttonEnable_2->setGeometry( 390,0 ,100 ,60);
|
||
|
ui->buttonDisenable_2->setGeometry( 520,0 ,100 ,60);
|
||
|
ui->buttonForeward_2->setGeometry( 650,0 ,100 ,60);
|
||
|
ui->buttonReversal_2->setGeometry( 780,0 ,100 ,60);
|
||
|
|
||
|
ui->labelRotaryMotor1->setGeometry( 0,0 ,200 ,60);
|
||
|
ui->buttonChange_3->setGeometry( 260,0 ,100 ,60);
|
||
|
ui->buttonEnable_3->setGeometry( 390,0 ,100 ,60);
|
||
|
ui->buttonDisenable_3->setGeometry( 520,0 ,100 ,60);
|
||
|
ui->buttonForeward_3->setGeometry( 650,0 ,100 ,60);
|
||
|
ui->buttonReversal_3->setGeometry( 780,0 ,100 ,60);
|
||
|
|
||
|
ui->labelRotaryMotor2->setGeometry( 0,0 ,200 ,60);
|
||
|
ui->buttonChange_4->setGeometry( 260,0 ,100 ,60);
|
||
|
ui->buttonEnable_4->setGeometry( 390,0 ,100 ,60);
|
||
|
ui->buttonDisenable_4->setGeometry( 520,0 ,100 ,60);
|
||
|
ui->buttonForeward_4->setGeometry( 650,0 ,100 ,60);
|
||
|
ui->buttonReversal_4->setGeometry( 780,0 ,100 ,60);
|
||
|
|
||
|
ui->buttonOk->setGeometry( 0,180,100 ,60);
|
||
|
ui->buttonCancel->setGeometry( 0,530 ,100 ,60);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::initControlStyle()//初始化窗体控件样式
|
||
|
{
|
||
|
QString orangeGradient = setOrangeGradientBottomStyle(BORDER_RADIUS2);
|
||
|
ui->frameRota->setStyleSheet("background-color: rgb(245, 245, 245);");
|
||
|
|
||
|
ui->frameNeedle->setStyleSheet(TRANSPARENTSTYLE);
|
||
|
ui->frameZeroCom->setStyleSheet(TRANSPARENTSTYLE);
|
||
|
ui->frameZeroCom_2->setStyleSheet(TRANSPARENTSTYLE);
|
||
|
ui->frameRotaZero->setStyleSheet(TRANSPARENTSTYLE);
|
||
|
ui->frameOkCancel->setStyleSheet(TRANSPARENTSTYLE);
|
||
|
|
||
|
ui->framePunchingSpindle1->setStyleSheet(TRANSPARENTSTYLE);
|
||
|
ui->framePunchingSpindle2->setStyleSheet(TRANSPARENTSTYLE);
|
||
|
ui->frameRotaryMotor1->setStyleSheet(TRANSPARENTSTYLE);
|
||
|
ui->frameRotaryMotor2->setStyleSheet(TRANSPARENTSTYLE);
|
||
|
|
||
|
//xcy 20230512 针杆固定6色
|
||
|
ui->pushButtonNeedel1->setStyleSheet("QPushButton{background-color:rgb(255, 255, 0); color:rgb(104, 0, 0)}");
|
||
|
ui->pushButtonNeedel2->setStyleSheet("QPushButton{background-color:rgb(0, 255, 0); color:black}");
|
||
|
ui->pushButtonNeedel3->setStyleSheet("QPushButton{background-color:rgb(0, 255, 255); color:rgb(0, 104, 104)}");
|
||
|
ui->pushButtonNeedel4->setStyleSheet("QPushButton{background-color:rgb(0, 0, 255); color:black}");
|
||
|
ui->pushButtonNeedel5->setStyleSheet("QPushButton{background-color:rgb(104, 0, 0); color:rgb(0, 104, 104)}");
|
||
|
ui->pushButtonNeedel6->setStyleSheet("QPushButton{background-color:rgb(0, 104, 104); color:black}");
|
||
|
ui->pushButtonZeroCom1->setStyleSheet(orangeGradient);
|
||
|
ui->pushButtonZeroCom2->setStyleSheet(orangeGradient);
|
||
|
ui->pushButtonZeroCom3->setStyleSheet(orangeGradient);
|
||
|
ui->pushButtonZeroCom4->setStyleSheet(orangeGradient);
|
||
|
ui->pushButtonZeroCom5->setStyleSheet(orangeGradient);
|
||
|
ui->pushButtonZeroCom6->setStyleSheet(orangeGradient);
|
||
|
ui->pushButtonZeroCom7->setStyleSheet(orangeGradient);
|
||
|
ui->pushButtonZeroCom8->setStyleSheet(orangeGradient);
|
||
|
ui->pushButtonZeroCom9->setStyleSheet(orangeGradient);
|
||
|
ui->pushButtonZeroCom10->setStyleSheet(orangeGradient);
|
||
|
ui->pushButtonZeroCom11->setStyleSheet(orangeGradient);
|
||
|
ui->pushButtonZeroCom12->setStyleSheet(orangeGradient);
|
||
|
|
||
|
ui->buttonOk->setStyleSheet(orangeGradient);
|
||
|
ui->buttonCancel->setStyleSheet(orangeGradient);
|
||
|
|
||
|
//此界面要求字体略大
|
||
|
int size = 14;
|
||
|
if(g_emResolut == resolution1910)
|
||
|
{
|
||
|
size = 16;
|
||
|
}
|
||
|
QFont fontNormal(FONTTYPE,size,FONTNORMAL);//微软雅黑常规
|
||
|
|
||
|
//label样式
|
||
|
ui->labelNeedle->setFont(fontNormal);
|
||
|
ui->labelNeedle->setStyleSheet(LABELBLACKSTYLE);
|
||
|
ui->labelZeroCom->setFont(fontNormal);
|
||
|
ui->labelZeroCom->setStyleSheet(LABELBLACKSTYLE);
|
||
|
ui->labelZeroCom_2->setFont(fontNormal);
|
||
|
ui->labelZeroCom_2->setStyleSheet(LABELBLACKSTYLE);
|
||
|
ui->pushButtonNeedel1->setFont(fontNormal);
|
||
|
ui->pushButtonNeedel2->setFont(fontNormal);
|
||
|
ui->pushButtonNeedel3->setFont(fontNormal);
|
||
|
ui->pushButtonNeedel4->setFont(fontNormal);
|
||
|
ui->pushButtonNeedel5->setFont(fontNormal);
|
||
|
ui->pushButtonNeedel6->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom1->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom2->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom3->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom4->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom5->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom6->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom7->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom8->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom9->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom10->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom11->setFont(fontNormal);
|
||
|
ui->pushButtonZeroCom12->setFont(fontNormal);
|
||
|
|
||
|
ui->buttonOk->setFont(fontNormal);
|
||
|
ui->buttonCancel->setFont(fontNormal);
|
||
|
|
||
|
ui->labelTitle->setFont(fontNormal);
|
||
|
ui->labelTitle->setStyleSheet(LABELBLACKSTYLE);
|
||
|
ui->labelManual->setFont(fontNormal);
|
||
|
ui->labelManual->setStyleSheet(LABELBLACKSTYLE);
|
||
|
ui->labelPunchingSpindle1->setFont(fontNormal);
|
||
|
ui->labelPunchingSpindle1->setStyleSheet(LABELBLACKSTYLE);
|
||
|
ui->labelPunchingSpindle2->setFont(fontNormal);
|
||
|
ui->labelPunchingSpindle2->setStyleSheet(LABELBLACKSTYLE);
|
||
|
ui->labelRotaryMotor1->setFont(fontNormal);
|
||
|
ui->labelRotaryMotor1->setStyleSheet(LABELBLACKSTYLE);
|
||
|
ui->labelRotaryMotor2->setFont(fontNormal);
|
||
|
ui->labelRotaryMotor2->setStyleSheet(LABELBLACKSTYLE);
|
||
|
|
||
|
ui->buttonChangeTool->setStyleSheet(orangeGradient);
|
||
|
ui->buttonSinglePunch->setStyleSheet(orangeGradient);
|
||
|
ui->buttonJog->setStyleSheet(orangeGradient);
|
||
|
ui->buttonManualChange->setStyleSheet(orangeGradient);
|
||
|
ui->buttonRotaZero->setStyleSheet(orangeGradient);
|
||
|
|
||
|
ui->buttonChange->setStyleSheet(orangeGradient);
|
||
|
ui->buttonEnable->setStyleSheet(orangeGradient);
|
||
|
ui->buttonDisenable->setStyleSheet(orangeGradient);
|
||
|
ui->buttonForeward->setStyleSheet(orangeGradient);
|
||
|
ui->buttonReversal->setStyleSheet(orangeGradient);
|
||
|
|
||
|
ui->buttonChange_2->setStyleSheet(orangeGradient);
|
||
|
ui->buttonEnable_2->setStyleSheet(orangeGradient);
|
||
|
ui->buttonDisenable_2->setStyleSheet(orangeGradient);
|
||
|
ui->buttonForeward_2->setStyleSheet(orangeGradient);
|
||
|
ui->buttonReversal_2->setStyleSheet(orangeGradient);
|
||
|
|
||
|
ui->buttonChange_3->setStyleSheet(orangeGradient);
|
||
|
ui->buttonEnable_3->setStyleSheet(orangeGradient);
|
||
|
ui->buttonDisenable_3->setStyleSheet(orangeGradient);
|
||
|
ui->buttonForeward_3->setStyleSheet(orangeGradient);
|
||
|
ui->buttonReversal_3->setStyleSheet(orangeGradient);
|
||
|
|
||
|
ui->buttonChange_4->setStyleSheet(orangeGradient);
|
||
|
ui->buttonEnable_4->setStyleSheet(orangeGradient);
|
||
|
ui->buttonDisenable_4->setStyleSheet(orangeGradient);
|
||
|
ui->buttonForeward_4->setStyleSheet(orangeGradient);
|
||
|
ui->buttonReversal_4->setStyleSheet(orangeGradient);
|
||
|
|
||
|
ui->buttonChangeTool->setFont(fontNormal);
|
||
|
ui->buttonSinglePunch->setFont(fontNormal);
|
||
|
ui->buttonJog->setFont(fontNormal);
|
||
|
ui->buttonManualChange->setFont(fontNormal);
|
||
|
ui->buttonRotaZero->setFont(fontNormal);
|
||
|
|
||
|
ui->buttonChange->setFont(fontNormal);
|
||
|
ui->buttonEnable->setFont(fontNormal);
|
||
|
ui->buttonDisenable->setFont(fontNormal);
|
||
|
ui->buttonForeward->setFont(fontNormal);
|
||
|
ui->buttonReversal->setFont(fontNormal);
|
||
|
|
||
|
ui->buttonChange_2->setFont(fontNormal);
|
||
|
ui->buttonEnable_2->setFont(fontNormal);
|
||
|
ui->buttonDisenable_2->setFont(fontNormal);
|
||
|
ui->buttonForeward_2->setFont(fontNormal);
|
||
|
ui->buttonReversal_2->setFont(fontNormal);
|
||
|
|
||
|
ui->buttonChange_3->setFont(fontNormal);
|
||
|
ui->buttonEnable_3->setFont(fontNormal);
|
||
|
ui->buttonDisenable_3->setFont(fontNormal);
|
||
|
ui->buttonForeward_3->setFont(fontNormal);
|
||
|
ui->buttonReversal_3->setFont(fontNormal);
|
||
|
|
||
|
ui->buttonChange_4->setFont(fontNormal);
|
||
|
ui->buttonEnable_4->setFont(fontNormal);
|
||
|
ui->buttonDisenable_4->setFont(fontNormal);
|
||
|
ui->buttonForeward_4->setFont(fontNormal);
|
||
|
ui->buttonReversal_4->setFont(fontNormal);
|
||
|
}
|
||
|
|
||
|
QString RotaComWidget::setOrangeGradientBottomStyle(QString str)
|
||
|
{
|
||
|
//橙色渐变
|
||
|
QString style = "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(253, 231, 140), stop:1 rgb(240,119,12));border-radius:"+str+"px;color:rgb(0,0,0);}";
|
||
|
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(222, 196, 128), stop:1 rgb(213,125,54));color:rgb(0,0,0);}";
|
||
|
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(227, 227, 227), stop:1 rgb(177,177,177));color:rgb(0,0,0);}";
|
||
|
return style;
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::setCompensationAngle(QPushButton *button, int idx)
|
||
|
{
|
||
|
NumerInputDialog numberInputDlg;
|
||
|
numberInputDlg.setTitleStr(tr("Zero compensation angle"));//归零补偿角度
|
||
|
numberInputDlg.setUnitStr("");
|
||
|
numberInputDlg.setValueAndRange(0, -36000, 36000, 2);//默认0,0~360
|
||
|
if(numberInputDlg.exec() == 1)
|
||
|
{
|
||
|
double val = (double)numberInputDlg.getValue() / 100;
|
||
|
QString str = "AUFUS/ZeroCom" + QString::number(idx);
|
||
|
g_pSettings->writeToIniFile(str,QString::number(val,'f',2));
|
||
|
button->setText(QString::number(val,'f',2));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonOk_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
if(g_pMachine->isConnected() != Connected)
|
||
|
{
|
||
|
PromptDialog dlg(this);
|
||
|
dlg.initDialog(PromptDialog::BTN_OK);
|
||
|
dlg.setTitleStr(tr("Network error"));
|
||
|
dlg.setContentStr(tr("No connection"));
|
||
|
dlg.exec();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
ParaStruct wkParaValues;
|
||
|
wkParaValues = g_pMachine->getWkPara();
|
||
|
|
||
|
//修改旋转归零补偿角度参数
|
||
|
int zeroCom1 = g_pSettings->readFromIniFile("AUFUS/ZeroCom1").toFloat() * 100;
|
||
|
int zeroCom2 = g_pSettings->readFromIniFile("AUFUS/ZeroCom2").toFloat() * 100;
|
||
|
int zeroCom3 = g_pSettings->readFromIniFile("AUFUS/ZeroCom3").toFloat() * 100;
|
||
|
int zeroCom4 = g_pSettings->readFromIniFile("AUFUS/ZeroCom4").toFloat() * 100;
|
||
|
int zeroCom5 = g_pSettings->readFromIniFile("AUFUS/ZeroCom5").toFloat() * 100;
|
||
|
int zeroCom6 = g_pSettings->readFromIniFile("AUFUS/ZeroCom6").toFloat() * 100;
|
||
|
|
||
|
int zeroCom7 = g_pSettings->readFromIniFile("AUFUS/ZeroCom7").toFloat() * 100;
|
||
|
int zeroCom8 = g_pSettings->readFromIniFile("AUFUS/ZeroCom8").toFloat() * 100;
|
||
|
int zeroCom9 = g_pSettings->readFromIniFile("AUFUS/ZeroCom9").toFloat() * 100;
|
||
|
int zeroCom10 = g_pSettings->readFromIniFile("AUFUS/ZeroCom10").toFloat() * 100;
|
||
|
int zeroCom11 = g_pSettings->readFromIniFile("AUFUS/ZeroCom11").toFloat() * 100;
|
||
|
int zeroCom12 = g_pSettings->readFromIniFile("AUFUS/ZeroCom12").toFloat() * 100;
|
||
|
|
||
|
wkParaValues.buf[233] = zeroCom1; //冲孔1旋转角度补偿
|
||
|
wkParaValues.buf[234] = zeroCom2; //
|
||
|
wkParaValues.buf[235] = zeroCom3; //
|
||
|
wkParaValues.buf[236] = zeroCom4; //
|
||
|
wkParaValues.buf[237] = zeroCom5; //
|
||
|
wkParaValues.buf[238] = zeroCom6; //
|
||
|
|
||
|
wkParaValues.buf[245] = zeroCom7; //冲孔2旋转角度补偿
|
||
|
wkParaValues.buf[246] = zeroCom8; //
|
||
|
wkParaValues.buf[247] = zeroCom9; //
|
||
|
wkParaValues.buf[248] = zeroCom10; //
|
||
|
wkParaValues.buf[249] = zeroCom11; //
|
||
|
wkParaValues.buf[250] = zeroCom12; //
|
||
|
|
||
|
//设置工作参数
|
||
|
g_pMachine->setWkPara(&wkParaValues);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonCancel_clicked()
|
||
|
{
|
||
|
this->hide();
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom1_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom1,1);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom2_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom2,2);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom3_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom3,3);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom4_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom4,4);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom5_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom5,5);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom6_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom6,6);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonRotaZero_clicked()
|
||
|
{
|
||
|
PromptDialog promptDlg;
|
||
|
promptDlg.initDialog(PromptDialog::BTN_OK_CANCEL);
|
||
|
promptDlg.setTitleStr(tr("Rotate to zero"));//旋转归零
|
||
|
|
||
|
QString str;
|
||
|
str = tr("The machine is about to move, please pay attention to safety!");//机器即将运动,请注意安全!
|
||
|
promptDlg.setContentStr(str);
|
||
|
|
||
|
if(promptDlg.exec() == 1)
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->punchRotToZero();//冲孔旋转去零位
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonSinglePunch_clicked()
|
||
|
{
|
||
|
PromptDialog promptDlg;
|
||
|
promptDlg.initDialog(PromptDialog::BTN_OK_CANCEL);
|
||
|
promptDlg.setTitleStr(tr("Single punch"));//单次冲孔
|
||
|
|
||
|
QString str;
|
||
|
str = tr("The machine is about to move, please pay attention to safety!");//机器即将运动,请注意安全!
|
||
|
promptDlg.setContentStr(str);
|
||
|
|
||
|
if(promptDlg.exec() == 1)
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->singlePunch();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonChangeTool_clicked()
|
||
|
{
|
||
|
PromptDialog promptDlg;
|
||
|
promptDlg.initDialog(PromptDialog::BTN_OK_CANCEL);
|
||
|
promptDlg.setTitleStr(tr("Change tool position"));//换刀位
|
||
|
|
||
|
QString str;
|
||
|
str = tr("The machine is about to move, please pay attention to safety!");//机器即将运动,请注意安全!
|
||
|
promptDlg.setContentStr(str);
|
||
|
|
||
|
if(promptDlg.exec() == 1)
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->punchJog();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonJog_clicked()
|
||
|
{
|
||
|
PromptDialog promptDlg;
|
||
|
promptDlg.initDialog(PromptDialog::BTN_OK_CANCEL);
|
||
|
promptDlg.setTitleStr(tr("Spindle jog"));//主轴点动
|
||
|
|
||
|
QString str;
|
||
|
str = tr("The machine is about to move, please pay attention to safety!");//机器即将运动,请注意安全!
|
||
|
promptDlg.setContentStr(str);
|
||
|
|
||
|
if(promptDlg.exec() == 1)
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->punchJog();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonManualChange_clicked()
|
||
|
{
|
||
|
emit signalManualColorChange();
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonChange_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoToZero(MT_LPM);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonEnable_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoServoCtrl(MT_LPM, UP_OPEN_ON);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonDisenable_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoServoCtrl(MT_LPM, DOWN_CLOSE_OFF);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonChange_2_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoToZero(MT_LP2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonEnable_2_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoServoCtrl(MT_LP2, UP_OPEN_ON);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonDisenable_2_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoServoCtrl(MT_LP2, DOWN_CLOSE_OFF);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonChange_3_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoToZero(MT_PR1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonEnable_3_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoServoCtrl(MT_PR1, UP_OPEN_ON);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonDisenable_3_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoServoCtrl(MT_PR1, DOWN_CLOSE_OFF);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonChange_4_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoToZero(MT_PR2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonEnable_4_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoServoCtrl(MT_PR2, UP_OPEN_ON);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonDisenable_4_clicked()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoServoCtrl(MT_PR2, DOWN_CLOSE_OFF);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonForeward_pressed()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_LPM, MT_MOVE_DIR_POSI, m_speedLevel);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonForeward_released()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_LPM, MT_MOVE_DIR_STOP, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonReversal_pressed()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_LPM, MT_MOVE_DIR_NEGA, m_speedLevel);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonReversal_released()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_LPM, MT_MOVE_DIR_STOP, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonForeward_2_pressed()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_LP2, MT_MOVE_DIR_POSI, m_speedLevel);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonForeward_2_released()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_LP2, MT_MOVE_DIR_STOP, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonReversal_2_pressed()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_LP2, MT_MOVE_DIR_NEGA, m_speedLevel);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonReversal_2_released()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_LP2, MT_MOVE_DIR_STOP, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonForeward_3_pressed()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_PR1, MT_MOVE_DIR_POSI, m_speedLevel);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonForeward_3_released()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_PR1, MT_MOVE_DIR_STOP, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonReversal_3_pressed()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_PR1, MT_MOVE_DIR_NEGA, m_speedLevel);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonReversal_3_released()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_PR1, MT_MOVE_DIR_STOP, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonForeward_4_pressed()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_PR2, MT_MOVE_DIR_POSI, m_speedLevel);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonForeward_4_released()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_PR2, MT_MOVE_DIR_STOP, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonReversal_4_pressed()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_PR2, MT_MOVE_DIR_NEGA, m_speedLevel);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_buttonReversal_4_released()
|
||
|
{
|
||
|
if(g_pMachine != NULL)
|
||
|
{
|
||
|
g_pMachine->motoMove(MT_PR2, MT_MOVE_DIR_STOP, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom7_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom7,7);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom8_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom8,8);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom9_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom9,9);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom10_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom10,10);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom11_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom11,11);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::on_pushButtonZeroCom12_clicked()
|
||
|
{
|
||
|
setCompensationAngle(ui->pushButtonZeroCom12,12);
|
||
|
}
|
||
|
|
||
|
void RotaComWidget::slotSpeedLevel(int speedLevel)
|
||
|
{
|
||
|
m_speedLevel = speedLevel;
|
||
|
}
|