681 lines
21 KiB
C++
681 lines
21 KiB
C++
#include <QMessageBox>
|
||
#include <QJsonDocument>
|
||
#include "measureSettingDlg.h"
|
||
#include "bayInfoDlg.h"
|
||
#include "graphicsDataModel/fixedPortsModel.h"
|
||
#include "bayMeasureDlg.h"
|
||
#include "baseProperty.h"
|
||
#include "basePropertyManager.h"
|
||
#include "ui_measureSettingDlg.h"
|
||
|
||
MeasureSettingDlg::MeasureSettingDlg(QWidget *parent)
|
||
: QDialog(parent)
|
||
, ui(new Ui::measureSettingDlg)
|
||
,_pBayComponent(nullptr)
|
||
,_pBayMeasure(nullptr)
|
||
,_pEventStrategy(nullptr)
|
||
,_pEventYXGroup(nullptr)
|
||
,_curMode(0)
|
||
{
|
||
ui->setupUi(this);
|
||
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||
setStyleSheet("background-color: white;");
|
||
initial();
|
||
}
|
||
|
||
MeasureSettingDlg::~MeasureSettingDlg()
|
||
{
|
||
delete ui;
|
||
}
|
||
|
||
void MeasureSettingDlg::initial()
|
||
{
|
||
_pEventStrategy = new QButtonGroup(this);
|
||
_pEventStrategy->addButton(ui->rb_eventOff,0);
|
||
_pEventStrategy->addButton(ui->rb_eventOn,1);
|
||
|
||
_pEventYXGroup = new QButtonGroup(this);
|
||
_pEventYXGroup->addButton(ui->rb_yxDown,0);
|
||
_pEventYXGroup->addButton(ui->rb_yxRise,1);
|
||
|
||
connect(_pEventStrategy,&QButtonGroup::idClicked,this,&MeasureSettingDlg::onEventStrategyChange);
|
||
|
||
connect(ui->btn_ok,&QPushButton::clicked,this,&MeasureSettingDlg::onOkClicked);
|
||
connect(ui->btn_cancel,&QPushButton::clicked,this,&MeasureSettingDlg::onCancelClicked);
|
||
connect(ui->btn_addPara,&QPushButton::clicked,this,&MeasureSettingDlg::onAddParaClicked);
|
||
connect(ui->btn_delPara,&QPushButton::clicked,this,&MeasureSettingDlg::onDelParaClicked);
|
||
connect(ui->cb_tag,&QComboBox::textActivated,this,&MeasureSettingDlg::onTagChanged);
|
||
connect(ui->cb_name,&QComboBox::textActivated,this,&MeasureSettingDlg::onNameChanged);
|
||
|
||
connect(ui->cb_rule,&QComboBox::currentIndexChanged, this,&MeasureSettingDlg::onRuleIndexChanged);
|
||
connect(ui->cb_type,&QComboBox::currentIndexChanged, this,&MeasureSettingDlg::onTypeIndexChanged);
|
||
|
||
// 设置正则验证器:1-5000整数
|
||
QRegularExpression regExp("^(?:[1-9]|[1-9]\\d{1,2}|[1-4]\\d{3}|5000)$");
|
||
QRegularExpressionValidator *validator = new QRegularExpressionValidator(regExp,ui->le_size);
|
||
ui->le_size->setValidator(validator);
|
||
|
||
ui->cb_rule->setItemData(0, 1);
|
||
ui->cb_rule->setItemData(1, 2);
|
||
|
||
ui->gb_yx->setVisible(false);
|
||
}
|
||
|
||
void MeasureSettingDlg::showDlg(int type,propertyStateInfo proInfo,bool isDouble)
|
||
{
|
||
ui->label_wind->setVisible(false);
|
||
ui->cb_windIndex->setVisible(false);
|
||
//setDbCheckVisible(false);
|
||
if(isDouble)
|
||
setDbTagVisible(true);
|
||
else
|
||
setDbTagVisible(false);
|
||
_isDouble = isDouble;
|
||
if(type == 4){ //ct,显示index选择
|
||
ui->label_wind->setVisible(true);
|
||
ui->cb_windIndex->setVisible(true);
|
||
ui->cb_windIndex->clear();
|
||
|
||
QMap<int,CtExtraInfo> map;
|
||
|
||
/*QString jsonString = proInfo.defaultValue.toString();
|
||
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonString.toUtf8().data());
|
||
QJsonObject obj = jsonDocument.object();*/
|
||
|
||
QJsonObject obj = safeToJsonObject(proInfo.defaultValue);
|
||
|
||
if(obj.contains("winding")){
|
||
QJsonArray arr = obj["winding"].toArray();
|
||
for (QJsonValueRef jsonObj : arr)
|
||
{
|
||
CtExtraInfo info;
|
||
QJsonObject node = jsonObj.toObject();
|
||
info.index = node["index"].toInt();
|
||
info.scope = node["scope"].toString();
|
||
info.accuracy= node["accuracy"].toString();
|
||
info.volume = node["volume"].toString();
|
||
info.ratio = node["ratio"].toDouble();
|
||
info.polarity= node["polarity"].toBool();
|
||
map.insert(info.index,info);
|
||
|
||
ui->cb_windIndex->addItem(QString::number(info.index));
|
||
}
|
||
_tempCtMap = map;
|
||
}
|
||
}
|
||
else if(type == 5){ //pt,显示index选择
|
||
ui->label_wind->setVisible(true);
|
||
ui->cb_windIndex->setVisible(true);
|
||
|
||
ui->cb_windIndex->clear();
|
||
QMap<int,PtExtraInfo> map;
|
||
|
||
/*QString jsonString = proInfo.defaultValue.toString();
|
||
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonString.toUtf8().data());
|
||
QJsonObject obj = jsonDocument.object();*/
|
||
QJsonObject obj = safeToJsonObject(proInfo.defaultValue);
|
||
|
||
if(obj.contains("winding")){
|
||
QJsonArray arr = obj["winding"].toArray();
|
||
for (QJsonValueRef jsonObj : arr)
|
||
{
|
||
PtExtraInfo info;
|
||
QJsonObject node = jsonObj.toObject();
|
||
info.index = node["index"].toInt();
|
||
info.scope = node["scope"].toString();
|
||
info.accuracy= node["accuracy"].toString();
|
||
info.volume = node["volume"].toString();
|
||
info.star = node["star"].toString();
|
||
info.ratio = node["ratio"].toDouble();
|
||
info.polarity= node["polarity"].toBool();
|
||
map.insert(info.index,info);
|
||
|
||
ui->cb_windIndex->addItem(QString::number(info.index));
|
||
}
|
||
_tempPtMap = map;
|
||
}
|
||
}
|
||
ui->cb_windIndex->setCurrentIndex(0);
|
||
_curComponentType = type;
|
||
_curMode = 0;
|
||
clearData();
|
||
QStringList lstTag;
|
||
QStringList lstName;
|
||
show();
|
||
if(_nParentType == 0){
|
||
if(_pBayComponent){
|
||
QString curItemName; //当前元件名称
|
||
auto pItemData = _pBayComponent->getProperty();
|
||
curItemName = pItemData->name();
|
||
auto lst = _pBayComponent->getValidType();
|
||
for(auto& item:lst){
|
||
item.tag = item.tag+"_"+curItemName;
|
||
item.name = item.name+"_"+curItemName;
|
||
lstTag.append(item.tag);
|
||
lstName.append(item.name);
|
||
}
|
||
ui->cb_tag->addItems(lstTag);
|
||
ui->cb_name->addItems(lstName);
|
||
|
||
BaseProperty* pro = _pBayComponent->getProperty();
|
||
if(pro){
|
||
ui->le_s1->setText(pro->station());
|
||
ui->le_s2->setText(pro->station());
|
||
}
|
||
}
|
||
}
|
||
else if(_nParentType == 1){
|
||
QString curBayName;
|
||
if(_pBayMeasure){
|
||
auto pItemBay = _pBayMeasure->getBayProperty();
|
||
curBayName = pItemBay->name();
|
||
|
||
auto lst = _pBayMeasure->getValidType();
|
||
for(auto& item:lst){
|
||
item.tag = item.tag+"_"+curBayName;
|
||
item.name = item.name+"_"+curBayName;
|
||
lstTag.append(item.tag);
|
||
lstName.append(item.name);
|
||
}
|
||
ui->cb_tag->addItems(lstTag);
|
||
ui->cb_name->addItems(lstName);
|
||
|
||
BayProperty* pro = _pBayMeasure->getBayProperty(); //间隔不直接包含站,找到间隔所属设备的站
|
||
if(pro){
|
||
QList<QUuid> lst = pro->getLstComponent();
|
||
QString sStation;
|
||
if(!lst.isEmpty()){
|
||
auto pPro = BasePropertyManager::instance().findEntityData(lst.first());
|
||
if(pPro){
|
||
sStation = pPro->station();
|
||
}
|
||
}
|
||
ui->le_s1->setText(sStation);
|
||
ui->le_s2->setText(sStation);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
void MeasureSettingDlg::showDlg(MeasurementInfo info,propertyStateInfo proInfo,bool isDouble,MeasurementInfo symmetryInfo)
|
||
{
|
||
ui->label_wind->setVisible(false);
|
||
ui->cb_windIndex->setVisible(false);
|
||
if(isDouble){
|
||
setDbTagVisible(true);
|
||
ui->le_dbTag->setText(symmetryInfo.tag);
|
||
ui->le_dbName->setText(symmetryInfo.name);
|
||
ui->le_dbTag->setReadOnly(true);
|
||
ui->le_dbName->setReadOnly(true);
|
||
}
|
||
else
|
||
setDbTagVisible(false);
|
||
_isDouble = isDouble;
|
||
if(info.sWindType == "ct"){ //ct,显示index选择
|
||
ui->label_wind->setVisible(true);
|
||
ui->cb_windIndex->setVisible(true);
|
||
ui->cb_windIndex->clear();
|
||
QMap<int,CtExtraInfo> map;
|
||
|
||
QJsonObject obj = safeToJsonObject(proInfo.defaultValue);
|
||
|
||
if(obj.contains("winding")){
|
||
QJsonArray arr = obj["winding"].toArray();
|
||
for (QJsonValueRef jsonObj : arr)
|
||
{
|
||
CtExtraInfo info;
|
||
QJsonObject node = jsonObj.toObject();
|
||
info.index = node["index"].toInt();
|
||
info.scope = node["scope"].toString();
|
||
info.accuracy= node["accuracy"].toString();
|
||
info.volume = node["volume"].toString();
|
||
info.ratio = node["ratio"].toDouble();
|
||
info.polarity= node["polarity"].toBool();
|
||
map.insert(info.index,info);
|
||
|
||
ui->cb_windIndex->addItem(QString::number(info.index));
|
||
}
|
||
ui->cb_windIndex->setCurrentText(QString::number(info.nIndex));
|
||
_tempCtMap = map;
|
||
}
|
||
}
|
||
else if(info.sWindType == "pt"){ //pt,显示index选择
|
||
ui->label_wind->setVisible(true);
|
||
ui->cb_windIndex->setVisible(true);
|
||
|
||
ui->cb_windIndex->clear();
|
||
QMap<int,PtExtraInfo> map;
|
||
|
||
QJsonObject obj = safeToJsonObject(proInfo.defaultValue);
|
||
|
||
if(obj.contains("winding")){
|
||
QJsonArray arr = obj["winding"].toArray();
|
||
for (QJsonValueRef jsonObj : arr)
|
||
{
|
||
PtExtraInfo info;
|
||
QJsonObject node = jsonObj.toObject();
|
||
info.index = node["index"].toInt();
|
||
info.scope = node["scope"].toString();
|
||
info.accuracy= node["accuracy"].toString();
|
||
info.volume = node["volume"].toString();
|
||
info.star = node["star"].toString();
|
||
info.ratio = node["ratio"].toDouble();
|
||
info.polarity= node["polarity"].toBool();
|
||
map.insert(info.index,info);
|
||
|
||
ui->cb_windIndex->addItem(QString::number(info.index));
|
||
}
|
||
ui->cb_windIndex->setCurrentText(QString::number(info.nIndex));
|
||
_tempPtMap = map;
|
||
}
|
||
}
|
||
|
||
if(info.sWindType == "ct"){
|
||
_curComponentType = 4;
|
||
}
|
||
else if(info.sWindType == "pt"){
|
||
_curComponentType = 5;
|
||
}
|
||
|
||
show();
|
||
_curMode = 1;
|
||
clearData();
|
||
ui->cb_tag->blockSignals(true);
|
||
ui->cb_name->blockSignals(true);
|
||
ui->cb_tag->addItem(info.tag);
|
||
ui->cb_name->addItem(info.name);
|
||
ui->cb_tag->setCurrentText(info.tag);
|
||
ui->cb_name->setCurrentText(info.name);
|
||
ui->cb_type->setCurrentIndex(info.type);
|
||
ui->le_size->setText(QString::number(info.size));
|
||
|
||
if(info.nSource == 1){ //3611
|
||
ui->cb_rule->setCurrentIndex(0);
|
||
ui->le_s1->setText(info.sStation);
|
||
ui->le_d1->setText(info.sDevice);
|
||
if(info.type == 0){ //遥测
|
||
ui->cb_channelYC->setCurrentText(info.sChannel);
|
||
}
|
||
else if(info.type == 1){ //遥信
|
||
ui->cb_channelYX->setCurrentText(info.sChannel);
|
||
}
|
||
else if(info.type == 2){ //遥控
|
||
ui->cb_channelYK->setCurrentText(info.sChannel);
|
||
}
|
||
}
|
||
else if(info.nSource == 2){ //104
|
||
ui->cb_rule->setCurrentIndex(1);
|
||
ui->le_s2->setText(info.sStation);
|
||
ui->le_packet->setText(QString::number(info.nPacket));
|
||
ui->le_offset->setText(QString::number(info.nOffset));
|
||
}
|
||
|
||
if(info.bEnable){
|
||
ui->rb_eventOn->setChecked(true);
|
||
}
|
||
else{
|
||
ui->rb_eventOff->setChecked(true);
|
||
}
|
||
ui->le_measure->setText(ui->cb_type->currentText());
|
||
if(info.type == 0){ //遥测
|
||
if(info.mapTE.contains("upup")){
|
||
ui->checkBox_upup->setChecked(true);
|
||
ui->dbsb_upup->setValue(info.mapTE["upup"]);
|
||
}
|
||
else{
|
||
ui->checkBox_upup->setChecked(false);
|
||
}
|
||
|
||
if(info.mapTE.contains("up")){
|
||
ui->checkBox_up->setChecked(true);
|
||
ui->dbsb_up->setValue(info.mapTE["up"]);
|
||
}
|
||
else{
|
||
ui->checkBox_up->setChecked(false);
|
||
}
|
||
|
||
if(info.mapTE.contains("down")){
|
||
ui->checkBox_down->setChecked(true);
|
||
ui->dbsb_down->setValue(info.mapTE["down"]);
|
||
}
|
||
else{
|
||
ui->checkBox_down->setChecked(false);
|
||
}
|
||
|
||
if(info.mapTE.contains("downdown")){
|
||
ui->checkBox_downdown->setChecked(true);
|
||
ui->dbsb_downdown->setValue(info.mapTE["downdown"]);
|
||
}
|
||
else{
|
||
ui->checkBox_downdown->setChecked(false);
|
||
}
|
||
}
|
||
else if(info.type == 1){ //遥信
|
||
if(info.sEdge == "raising"){ //上升沿
|
||
ui->rb_yxRise->setChecked(true);
|
||
}
|
||
else if(info.sEdge == "falling"){ //上升沿
|
||
ui->rb_yxDown->setChecked(true);
|
||
}
|
||
}
|
||
|
||
ui->cb_command->setCurrentText(info.sCommand);
|
||
for(auto ¶:info.lstParameter){
|
||
ui->lst_parameter->addItem(para);
|
||
}
|
||
}
|
||
|
||
void MeasureSettingDlg::clearData()
|
||
{
|
||
if(ui->cb_tag->count())
|
||
ui->cb_tag->clear();
|
||
if(ui->cb_name->count())
|
||
ui->cb_name->clear();
|
||
ui->le_size->clear();
|
||
ui->cb_type->setCurrentIndex(0);
|
||
ui->cb_rule->setCurrentIndex(0);
|
||
ui->rb_eventOff->setChecked(true);
|
||
ui->checkBox_upup->setChecked(false);
|
||
ui->checkBox_up->setChecked(false);
|
||
ui->checkBox_down->setChecked(false);
|
||
ui->checkBox_downdown->setChecked(false);
|
||
ui->dbsb_upup->clear();
|
||
ui->dbsb_up->clear();
|
||
ui->dbsb_down->clear();
|
||
ui->dbsb_downdown->clear();
|
||
ui->cb_command->setCurrentIndex(0);
|
||
ui->le_parameter->clear();
|
||
ui->lst_parameter->clear();
|
||
}
|
||
|
||
/*void MeasureSettingDlg::setDbCheckVisible(bool val)
|
||
{
|
||
if(val){
|
||
ui->label_dbCheck->setVisible(true);
|
||
ui->cB_dbCheck->setVisible(true);
|
||
}
|
||
else{
|
||
ui->label_dbCheck->setVisible(false);
|
||
ui->cB_dbCheck->setVisible(false);
|
||
}
|
||
}*/
|
||
|
||
void MeasureSettingDlg::setDbTagVisible(bool val)
|
||
{
|
||
ui->le_dbTag->clear();
|
||
ui->le_dbName->clear();
|
||
if(val){
|
||
ui->label_dbTag->setVisible(true);
|
||
ui->le_dbTag->setVisible(true);
|
||
ui->label_dbName->setVisible(true);
|
||
ui->le_dbName->setVisible(true);
|
||
}
|
||
else{
|
||
ui->label_dbTag->setVisible(false);
|
||
ui->le_dbTag->setVisible(false);
|
||
ui->label_dbName->setVisible(false);
|
||
ui->le_dbName->setVisible(false);
|
||
}
|
||
}
|
||
|
||
QJsonObject MeasureSettingDlg::safeToJsonObject(const QVariant& var) {
|
||
switch (var.typeId()) {
|
||
case QMetaType::QJsonObject:
|
||
return var.toJsonObject();
|
||
case QMetaType::QString: {
|
||
QJsonParseError error;
|
||
auto doc = QJsonDocument::fromJson(
|
||
var.toString().toUtf8(),
|
||
&error
|
||
);
|
||
if (error.error == QJsonParseError::NoError)
|
||
return doc.object();
|
||
break;
|
||
}
|
||
default:
|
||
break;
|
||
}
|
||
return QJsonObject();
|
||
}
|
||
|
||
void MeasureSettingDlg::onOkClicked()
|
||
{
|
||
MeasurementInfo info;
|
||
info.tag = ui->cb_tag->currentText();
|
||
info.name = ui->cb_name->currentText();
|
||
info.type = ui->cb_type->currentIndex();
|
||
info.size = ui->le_size->text().toInt();
|
||
|
||
info.nSource = ui->cb_rule->currentData().toInt();
|
||
if(info.nSource == 1){ //cl3611
|
||
info.sStation = ui->le_s1->text();
|
||
info.sDevice = ui->le_d1->text();
|
||
}
|
||
else if(info.nSource == 2){
|
||
info.sStation = ui->le_s2->text();
|
||
}
|
||
if(info.type == 0)
|
||
info.sChannel = ui->cb_channelYC->currentText();
|
||
else if(info.type == 1)
|
||
info.sChannel = ui->cb_channelYX->currentText();
|
||
else if(info.type == 2)
|
||
info.sChannel = ui->cb_channelYK->currentText();
|
||
info.nPacket = ui->le_packet->text().toInt(); //包号
|
||
info.nOffset = ui->le_offset->text().toInt(); //偏移量
|
||
if(_pEventStrategy){ //事件策略开关
|
||
info.bEnable = _pEventStrategy->checkedId();
|
||
}
|
||
|
||
if(ui->checkBox_upup->isChecked()){
|
||
info.mapTE.insert("upup",ui->dbsb_upup->value());
|
||
}
|
||
if(ui->checkBox_up->isChecked()){
|
||
info.mapTE.insert("up",ui->dbsb_up->value());
|
||
}
|
||
if(ui->checkBox_downdown->isChecked()){
|
||
info.mapTE.insert("downdown",ui->dbsb_downdown->value());
|
||
}
|
||
if(ui->checkBox_down->isChecked()){
|
||
info.mapTE.insert("down",ui->dbsb_down->value());
|
||
}
|
||
|
||
if(_pEventYXGroup->checkedId() == 0){
|
||
info.sEdge = "falling";
|
||
}
|
||
else if(_pEventYXGroup->checkedId() == 1){
|
||
info.sEdge = "raising";
|
||
}
|
||
info.sCommand = ui->cb_command->currentText();
|
||
for(int i = 0;i < ui->lst_parameter->count();++i){
|
||
QListWidgetItem *item = ui->lst_parameter->item(i);
|
||
info.lstParameter.append(item->text());
|
||
}
|
||
|
||
if(_curComponentType == 4 || _curComponentType == 5){
|
||
int nNumber;
|
||
QString sNumber = ui->cb_windIndex->currentText();
|
||
nNumber = sNumber.isEmpty()?-1:sNumber.toInt();
|
||
if(nNumber != -1){
|
||
if(_curComponentType == 4){ //ct
|
||
info.sWindType = "ct";
|
||
info.nIndex = nNumber;
|
||
info.nRatio = _tempCtMap.value(nNumber).ratio;
|
||
info.nPolarity = _tempCtMap.value(nNumber).polarity;
|
||
}
|
||
else if(_curComponentType == 5){ //pt
|
||
info.sWindType = "pt";
|
||
info.nIndex = nNumber;
|
||
info.nRatio = _tempPtMap.value(nNumber).ratio;
|
||
info.nPolarity = _tempPtMap.value(nNumber).polarity;
|
||
}
|
||
}
|
||
}
|
||
if(_nParentType == 0){
|
||
if(_pBayComponent){
|
||
if(_isDouble)
|
||
info.sSymmetry = ui->le_dbName->text(); //与double互相记录
|
||
_pBayComponent->addMeasure(info,_curMode);
|
||
}
|
||
|
||
if(_isDouble){
|
||
MeasurementInfo dbInfo;
|
||
dbInfo = info;
|
||
dbInfo.tag = ui->le_dbTag->text();
|
||
dbInfo.name = ui->le_dbName->text();
|
||
dbInfo.nPolarity = -info.nPolarity;
|
||
dbInfo.sSymmetry = info.name; //与source互相记录
|
||
|
||
if(_pBayComponent)
|
||
_pBayComponent->addMeasure(dbInfo,_curMode);
|
||
}
|
||
}
|
||
else if(_nParentType == 1){
|
||
if(_pBayMeasure){
|
||
_pBayMeasure->addMeasure(info,_curMode);
|
||
}
|
||
}
|
||
|
||
ui->cb_tag->blockSignals(false);
|
||
ui->cb_name->blockSignals(false);
|
||
ui->le_dbTag->setReadOnly(false);
|
||
ui->le_dbName->setReadOnly(false);
|
||
hide();
|
||
}
|
||
|
||
void MeasureSettingDlg::onCancelClicked()
|
||
{
|
||
ui->cb_tag->blockSignals(false);
|
||
ui->cb_name->blockSignals(false);
|
||
hide();
|
||
}
|
||
|
||
void MeasureSettingDlg::onTagChanged(const QString& str)
|
||
{
|
||
QList<measureAttributeType> lst;
|
||
QString curName;
|
||
if(_nParentType == 0){
|
||
if(_pBayComponent){
|
||
lst = _pBayComponent->getValidType();
|
||
auto pItemData = _pBayComponent->getProperty();
|
||
curName = "_"+pItemData->name();
|
||
}
|
||
}
|
||
else if(_nParentType == 1){
|
||
if(_pBayMeasure){
|
||
lst = _pBayMeasure->getValidType();
|
||
auto pItemBay = _pBayMeasure->getBayProperty();
|
||
curName = "_"+pItemBay->name();
|
||
}
|
||
}
|
||
|
||
QString name;
|
||
for(auto& item:lst){
|
||
if(item.tag+curName == str){
|
||
name = item.name+curName;
|
||
ui->cb_name->setCurrentText(name);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(_isDouble){
|
||
ui->le_dbTag->setText(str+"double");
|
||
ui->le_dbName->setText(name+"对称");
|
||
}
|
||
}
|
||
|
||
void MeasureSettingDlg::onNameChanged(const QString& str)
|
||
{
|
||
QList<measureAttributeType> lst;
|
||
QString curName;
|
||
if(_nParentType == 0){
|
||
if(_pBayComponent){
|
||
lst = _pBayComponent->getValidType();
|
||
auto pItemData = _pBayComponent->getProperty();
|
||
curName = "_"+pItemData->name();
|
||
}
|
||
}
|
||
else if(_nParentType == 1){
|
||
if(_pBayMeasure){
|
||
lst = _pBayMeasure->getValidType();
|
||
auto pItemBay = _pBayMeasure->getBayProperty();
|
||
curName = "_"+pItemBay->name();
|
||
}
|
||
}
|
||
|
||
QString tag;
|
||
for(auto& item:lst){
|
||
if(item.name+curName == str){
|
||
tag = item.tag+curName;
|
||
ui->cb_tag->setCurrentText(tag);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(_isDouble){
|
||
ui->le_dbTag->setText(tag+"double");
|
||
ui->le_dbName->setText(str+"对称");
|
||
}
|
||
}
|
||
|
||
void MeasureSettingDlg::onRuleIndexChanged(int n)
|
||
{
|
||
ui->sw_type->setCurrentIndex(n);
|
||
}
|
||
|
||
void MeasureSettingDlg::onTypeIndexChanged(int n)
|
||
{
|
||
switch (n) {
|
||
case 0: //遥测
|
||
ui->sw_channel->setCurrentIndex(0);
|
||
ui->gb_yc->setVisible(true);
|
||
ui->gb_yx->setVisible(false);
|
||
break;
|
||
case 1: //遥信
|
||
ui->sw_channel->setCurrentIndex(1);
|
||
ui->gb_yc->setVisible(false);
|
||
ui->gb_yx->setVisible(true);
|
||
break;
|
||
case 2: //遥控
|
||
ui->sw_channel->setCurrentIndex(2);
|
||
ui->gb_yc->setVisible(false);
|
||
ui->gb_yx->setVisible(false);
|
||
break;
|
||
default:
|
||
ui->gb_yc->setVisible(false);
|
||
ui->gb_yx->setVisible(false);
|
||
break;
|
||
}
|
||
ui->le_measure->setText(ui->cb_type->currentText());
|
||
}
|
||
|
||
void MeasureSettingDlg::onAddParaClicked()
|
||
{
|
||
QString str = ui->le_parameter->text();
|
||
auto lst = ui->lst_parameter->findItems(str,Qt::MatchExactly);
|
||
if(lst.isEmpty()){ //列表中不存在
|
||
ui->lst_parameter->addItem(str);
|
||
}
|
||
}
|
||
|
||
void MeasureSettingDlg::onDelParaClicked()
|
||
{
|
||
auto pItem = ui->lst_parameter->takeItem(ui->lst_parameter->currentRow());
|
||
if(pItem)
|
||
delete pItem;
|
||
}
|
||
|
||
void MeasureSettingDlg::onEventStrategyChange(int n)
|
||
{
|
||
if(n == 0){ //不启用
|
||
ui->sw_event->setCurrentIndex(0);
|
||
}
|
||
else if(n == 1){ //启用
|
||
ui->sw_event->setCurrentIndex(1);
|
||
}
|
||
}
|
||
|
||
void MeasureSettingDlg::onHttpDataUpdated(HttpRecommandInfo info)
|
||
{
|
||
//
|
||
}
|