205 lines
8.0 KiB
C++
205 lines
8.0 KiB
C++
#include "SlowSpeedChannelSetting.h"
|
|
#include "ui_SlowSpeedChannelSetting.h"
|
|
#include <QListView>
|
|
|
|
CSlowSpeedChannelSetting::CSlowSpeedChannelSetting(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::CSlowSpeedChannelSetting)
|
|
{
|
|
ui->setupUi(this);
|
|
//slowChannelTypeList << "温度" << "过程变量" << "普通电压" ;
|
|
slowChannelTypeList << "低速电流" << "高速电流" << "气隙";
|
|
m_MapSlowChannelType.insert("TEMPERATURE","温度");
|
|
m_MapSlowChannelType.insert("SLOW_CURRENT","过程变量");
|
|
m_MapSlowChannelType.insert("SLOW_VOLTAGE","普通电压");
|
|
m_MapSlowChannelType.insert("AIRGAP","气隙");
|
|
//ui->comboBox_channelType->addItems(slowChannelTypeList);
|
|
this->setWindowTitle("通道配置");
|
|
ui->comboBox_sampleRate->setView(new QListView());
|
|
|
|
QRegExp exp("[0-9\\.-]+$");
|
|
QValidator *Validator = new QRegExpValidator(exp);
|
|
ui->lineEdit_fullScalePosition->setValidator(Validator);
|
|
ui->lineEdit_zeroScalePosition->setValidator(Validator);
|
|
ui->lineEdit_xfullScalePosition->setValidator(Validator);
|
|
ui->lineEdit_xzeroScalePosition->setValidator(Validator);
|
|
ui->lineEdit_upper->setValidator(Validator);
|
|
ui->lineEdit_lower->setValidator(Validator);
|
|
|
|
m_itemList << "是" << "否" ;
|
|
ui->comboBox_check->clear();
|
|
ui->comboBox_check->addItems(m_itemList);
|
|
|
|
QStringList m_DisPlayerList;
|
|
m_DisPlayerList << "平均值" << "最小值" << "最大值";
|
|
ui->comboBox_defaultDisplay->clear();
|
|
ui->comboBox_defaultDisplay->addItems(m_DisPlayerList);
|
|
}
|
|
|
|
CSlowSpeedChannelSetting::~CSlowSpeedChannelSetting()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void CSlowSpeedChannelSetting::displayChannelSetting()
|
|
{
|
|
|
|
ui->comboBox_channelType->clear();
|
|
QMap<QString,QString>::Iterator iter = g_MapChannelType.begin();
|
|
for (; iter != g_MapChannelType.end(); iter++) {
|
|
qDebug() <<"iter.value()" << iter.value() <<endl;
|
|
if(iter.key() == channelSetting.sensorType){
|
|
|
|
ui->comboBox_channelType->addItem(iter.value());
|
|
ui->comboBox_channelType->setCurrentText(iter.value());
|
|
}
|
|
|
|
}
|
|
if(channelSetting.sensorType == "PULSE_CURRENT"){
|
|
ui->comboBox_channelType->addItem("气隙");
|
|
}
|
|
if(channelSetting.sensorType == "AIRGAP"){
|
|
ui->comboBox_channelType->addItem("高速电流");
|
|
}
|
|
QString string_modelNo = QString("%1").arg(channelSetting.sensorModuleNo);
|
|
ui->label_modelNo->setText(string_modelNo);
|
|
QString string_sensorNo = QString("%1").arg(channelSetting.sensorNo);
|
|
ui->label_channelNo->setText(string_sensorNo);
|
|
|
|
ui->lineEdit_channelName->setText(channelSetting.channelName);
|
|
ui->lineEdit_engineeringUnit->setText(channelSetting.sensorEngineeringUnit);
|
|
|
|
ui->label_unit1->setText(channelSetting.sensorEngineeringUnit);
|
|
ui->label_unit2->setText(channelSetting.sensorEngineeringUnit);
|
|
ui->lineEdit_sensorType->setText(channelSetting.channelSensorType);
|
|
|
|
ui->lineEdit_poleNum->setText(channelSetting.firstPoleNum);
|
|
QString ChUnitDot = QString("%1").arg(channelSetting.ChUnitDot);
|
|
ui->lineEdit_ChUnitDot->setText(ChUnitDot);
|
|
|
|
|
|
if(channelSetting.sensorRangeCheck)
|
|
ui->comboBox_check->setCurrentText("是");
|
|
else
|
|
ui->comboBox_check->setCurrentText("否");
|
|
|
|
ui->lineEdit_lower->setText(channelSetting.sensorRangeMin);
|
|
ui->lineEdit_upper->setText(channelSetting.sensorRangeMax);
|
|
|
|
ui->lineEdit_zeroScalePosition->setText(channelSetting.zeroScalePosition);
|
|
QString str = QString("%1").arg(channelSetting.fullScalePosition);
|
|
ui->lineEdit_fullScalePosition->setText(str);
|
|
|
|
ui->lineEdit_xzeroScalePosition->setText(channelSetting.xZeroScalePosition);
|
|
ui->lineEdit_xfullScalePosition->setText(channelSetting.xFullScalePosition);
|
|
|
|
ui->textEdit_comment->setText(channelSetting.comments);
|
|
QStringList strListFs ;
|
|
|
|
if(channelSetting.sensorType == "PULSE_CURRENT" || channelSetting.sensorType == "AIRGAP")
|
|
strListFs << "1kHz" << "2kHz" << "4kHz" << "8kHz" << "16kHz";
|
|
else if(channelSetting.sensorType == "SLOW_CURRENT")
|
|
strListFs << "1Hz"<<"8Hz" << "16Hz" << "32Hz" << "64Hz";
|
|
|
|
ui->comboBox_defaultDisplay->setCurrentText(channelSetting.defaultDisplay);
|
|
channelSetting.isEnable = 1;
|
|
channelSetting.isWork = 1;
|
|
ui->comboBox_sampleRate->clear();
|
|
ui->comboBox_sampleRate->addItems(strListFs);
|
|
if(channelSetting.samplingRate == 1)
|
|
ui->comboBox_sampleRate->setCurrentText("1Hz");
|
|
if(channelSetting.samplingRate == 8)
|
|
ui->comboBox_sampleRate->setCurrentText("8Hz");
|
|
if(channelSetting.samplingRate == 16)
|
|
ui->comboBox_sampleRate->setCurrentText("16Hz");
|
|
if(channelSetting.samplingRate == 32)
|
|
ui->comboBox_sampleRate->setCurrentText("32Hz");
|
|
if(channelSetting.samplingRate == 64)
|
|
ui->comboBox_sampleRate->setCurrentText("64Hz");
|
|
if(channelSetting.samplingRate == 1024)
|
|
ui->comboBox_sampleRate->setCurrentText("1kHz");
|
|
if(channelSetting.samplingRate == 2048)
|
|
ui->comboBox_sampleRate->setCurrentText("2kHz");
|
|
if(channelSetting.samplingRate == 4096)
|
|
ui->comboBox_sampleRate->setCurrentText("4kHz");
|
|
if(channelSetting.samplingRate == 8192)
|
|
ui->comboBox_sampleRate->setCurrentText("8kHz");
|
|
if(channelSetting.samplingRate == 16384)
|
|
ui->comboBox_sampleRate->setCurrentText("16kHz");
|
|
|
|
}
|
|
|
|
void CSlowSpeedChannelSetting::on_lineEdit_engineeringUnit_editingFinished()
|
|
{
|
|
QString str = ui->lineEdit_engineeringUnit->text();
|
|
ui->label_unit1->setText(str);
|
|
ui->label_unit2->setText(str);
|
|
}
|
|
|
|
|
|
void CSlowSpeedChannelSetting::on_pushButton_submit_clicked()
|
|
{
|
|
channelSetting.channelName = ui->lineEdit_channelName->text();
|
|
channelSetting.channelSensorType = ui->lineEdit_sensorType->text();
|
|
// channelSetting.sensorType ="SLOW_CURRENT";
|
|
channelSetting.sensorEngineeringUnit = ui->lineEdit_engineeringUnit->text();
|
|
channelSetting.sensorRangeMin = ui->lineEdit_lower->text();
|
|
channelSetting.sensorRangeMax = ui->lineEdit_upper->text();
|
|
channelSetting.zeroScalePosition = ui->lineEdit_zeroScalePosition->text();
|
|
channelSetting.xZeroScalePosition = ui->lineEdit_xzeroScalePosition->text();
|
|
channelSetting.fullScalePosition = ui->lineEdit_fullScalePosition->text().toDouble();
|
|
channelSetting.xFullScalePosition = ui->lineEdit_xfullScalePosition->text();
|
|
channelSetting.comments = ui->textEdit_comment->toPlainText();
|
|
channelSetting.ChUnitDot = ui->lineEdit_ChUnitDot->text().toInt();
|
|
QString str = ui->comboBox_check->currentText();
|
|
if(str == "是"){
|
|
channelSetting.sensorRangeCheck = true;
|
|
}else if(str == "否"){
|
|
channelSetting.sensorRangeCheck = false;
|
|
}
|
|
if(ui->comboBox_channelType->currentText() == "高速电流"){
|
|
channelSetting.sensorType ="PULSE_CURRENT";
|
|
}else if(ui->comboBox_channelType->currentText() == "气隙"){
|
|
channelSetting.sensorType ="AIRGAP";
|
|
}
|
|
|
|
channelSetting.defaultDisplay = ui->comboBox_defaultDisplay->currentText();
|
|
channelSetting.firstPoleNum = ui->lineEdit_poleNum->text();
|
|
|
|
QString strSamplingRate = ui->comboBox_sampleRate->currentText();
|
|
if(strSamplingRate == "1Hz")
|
|
channelSetting.samplingRate = 1;
|
|
else if(strSamplingRate == "8Hz")
|
|
channelSetting.samplingRate = 8;
|
|
else if(strSamplingRate == "16Hz")
|
|
channelSetting.samplingRate = 16;
|
|
else if(strSamplingRate == "32Hz")
|
|
channelSetting.samplingRate = 32;
|
|
else if(strSamplingRate == "64Hz")
|
|
channelSetting.samplingRate = 64;
|
|
else if(strSamplingRate == "1kHz")
|
|
channelSetting.samplingRate = 1024;
|
|
else if(strSamplingRate == "2kHz")
|
|
channelSetting.samplingRate = 2048;
|
|
else if(strSamplingRate == "4kHz")
|
|
channelSetting.samplingRate = 4096;
|
|
else if(strSamplingRate == "8kHz")
|
|
channelSetting.samplingRate = 8092;
|
|
else if(strSamplingRate == "16kHz")
|
|
channelSetting.samplingRate = 16384;
|
|
|
|
emit sgSetChannelData(channelSetting);
|
|
this->close();
|
|
}
|
|
|
|
|
|
void CSlowSpeedChannelSetting::on_comboBox_channelType_currentTextChanged(const QString &arg1)
|
|
{
|
|
if(arg1 == "气隙"){
|
|
|
|
}else if(arg1 == "高速电流"){
|
|
|
|
}
|
|
}
|
|
|