Merge branch 'self_dev_screen' of http://218.94.94.190:3000/zhangsheng/TSI_Config into self_dev_screen

This commit is contained in:
DESKTOP-7I8SUIC\zhang 2025-12-08 17:18:07 +08:00
commit d64e70bf07
3 changed files with 24 additions and 9 deletions

View File

@ -587,6 +587,7 @@ void ConfigMgr::Save(QString & file_path) {
} }
} }
channel_item.insert("logic_vote", array_logic); channel_item.insert("logic_vote", array_logic);
channel_item.insert("vote",ptr->single_relay[ch].vote);
}else{ }else{
if(ptr->single_relay[ch].logic_expression != ""){ if(ptr->single_relay[ch].logic_expression != ""){
qDebug() << "ch" << ch << ptr->single_relay[ch].logic_expression; qDebug() << "ch" << ch << ptr->single_relay[ch].logic_expression;

View File

@ -519,6 +519,7 @@ typedef struct SingleRelayS_{
logic_expression = ""; logic_expression = "";
active = false; active = false;
vote = false; vote = false;
count_vote = 0;
} }
} SingleRelayS; } SingleRelayS;
@ -534,6 +535,7 @@ typedef struct SingleRelayNOK_{
logic_expression = ""; logic_expression = "";
active = false; active = false;
vote = false; vote = false;
count_vote = 0;
} }
} SingleRelayNOK; } SingleRelayNOK;

View File

@ -55,7 +55,7 @@ SingleRelay::SingleRelay(int slot,CardType cardtype,QWidget *parent)
vote_current_index = ui->comboBox_vote_group->currentIndex(); vote_current_index = ui->comboBox_vote_group->currentIndex();
Init(); Init();
onComboBoxIndexChanged(current_index); onComboBoxIndexChanged(current_index);
on_comboBox_vote_group_currentIndexChanged(current_index);
} }
SingleRelay::~SingleRelay() { SingleRelay::~SingleRelay() {
@ -149,8 +149,16 @@ void SingleRelay::Init(){
if(!relay_data->single_relay[current_index].logic_expression.isEmpty()){ if(!relay_data->single_relay[current_index].logic_expression.isEmpty()){
setExpressionToTreeView(treeView_relay, relay_data->single_relay[current_index].logic_expression); setExpressionToTreeView(treeView_relay, relay_data->single_relay[current_index].logic_expression);
} }
if(!relay_data->single_relay[current_index].logic[vote_current_index].isEmpty()){
setExpressionToTreeView(treeView_relay, relay_data->single_relay[current_index].logic[vote_current_index]);
}
qDebug() << "relay_data->single_relay[current_index].active" << relay_data->single_relay[current_index].active;
ui->checkBox_active->setChecked(relay_data->single_relay[current_index].active); ui->checkBox_active->setChecked(relay_data->single_relay[current_index].active);
ui->comboBox_group->setCurrentIndex(relay_data->single_relay[current_index].group - 1); ui->comboBox_group->setCurrentIndex(relay_data->single_relay[current_index].group - 1);
ui->lineEdit_vote_count->setText(QString::number(relay_data->single_relay[current_index].count_vote));
ui->checkBox_vote->setChecked(relay_data->single_relay[current_index].vote);
on_checkBox_vote_clicked(relay_data->single_relay[current_index].vote);
} }
void SingleRelay::on_pushButton_cancel_clicked() { void SingleRelay::on_pushButton_cancel_clicked() {
this->close(); this->close();
@ -274,14 +282,16 @@ void SingleRelay::on_pushButton_confirm_clicked()
QString("错误位置:%1\n错误描述:%2").arg(result.errorPos).arg(result.errorMsg)); QString("错误位置:%1\n错误描述:%2").arg(result.errorPos).arg(result.errorMsg));
return; return;
} }
if(ui->checkBox_vote->checkState()){ if(ui->checkBox_vote->isChecked()){
relay_data->single_relay[current_index].logic[ui->comboBox_vote_group->currentIndex()] = finalExpr; relay_data->single_relay[current_index].logic[ui->comboBox_vote_group->currentIndex()] = finalExpr;
relay_data->single_relay[current_index].count_vote = ui->lineEdit_vote_count->text().toInt();
}else{ }else{
relay_data->single_relay[current_index].logic_expression = finalExpr; relay_data->single_relay[current_index].logic_expression = finalExpr;
} }
relay_data->single_relay[current_index].active = ui->checkBox_active->isChecked(); relay_data->single_relay[current_index].vote = ui->checkBox_vote->isChecked();
relay_data->single_relay[current_index].group = ui->comboBox_group->currentIndex() + 1; relay_data->single_relay[current_index].group = ui->comboBox_group->currentIndex() + 1;
qDebug() << "逻辑表达式:" << finalExpr; relay_data->single_relay[current_index].count_vote = ui->lineEdit_vote_count->text().toInt();
qDebug() << "逻辑表达式:" << finalExpr ;
this->close(); this->close();
} }
void SingleRelay::onComboBoxIndexChanged(int index){ void SingleRelay::onComboBoxIndexChanged(int index){
@ -304,9 +314,9 @@ void SingleRelay::onComboBoxIndexChanged(int index){
return; return;
} }
qDebug() << "finalExpr" << finalExpr; qDebug() << "finalExpr" << finalExpr;
if(ui->checkBox_vote->checkState()){ if(ui->checkBox_vote->isChecked()){
relay_data->single_relay[current_index].logic[ui->comboBox_vote_group->currentIndex()] = finalExpr; relay_data->single_relay[current_index].logic[vote_current_index] = finalExpr;
if(relay_data->single_relay[index].logic[ui->comboBox_vote_group->currentIndex()] != "") if(relay_data->single_relay[index].logic[0] != "")
setExpressionToTreeView(treeView_relay, relay_data->single_relay[index].logic[ui->comboBox_vote_group->currentIndex()]); setExpressionToTreeView(treeView_relay, relay_data->single_relay[index].logic[ui->comboBox_vote_group->currentIndex()]);
else else
model_Relay->clear(); model_Relay->clear();
@ -317,11 +327,13 @@ void SingleRelay::onComboBoxIndexChanged(int index){
else else
model_Relay->clear(); model_Relay->clear();
} }
relay_data->single_relay[current_index].active = ui->checkBox_active->isChecked(); relay_data->single_relay[current_index].vote = ui->checkBox_vote->isChecked();
relay_data->single_relay[current_index].group = ui->comboBox_group->currentIndex() + 1; relay_data->single_relay[current_index].group = ui->comboBox_group->currentIndex() + 1;
relay_data->single_relay[current_index].count_vote = ui->lineEdit_vote_count->text().toInt();
current_index = index; current_index = index;
qDebug() << "active" << relay_data->single_relay[index].active; qDebug() << "active" << relay_data->single_relay[index].active;
ui->checkBox_active->setChecked(relay_data->single_relay[index].active); ui->checkBox_active->setChecked(relay_data->single_relay[index].active);
ui->lineEdit_vote_count->setText(QString::number(relay_data->single_relay[index].count_vote));
} }
ExprNode* SingleRelay::parseExpression(const QString& expr, int& pos) { ExprNode* SingleRelay::parseExpression(const QString& expr, int& pos) {
@ -522,7 +534,7 @@ void SingleRelay::on_comboBox_vote_group_currentIndexChanged(int index)
QString("错误位置:%1\n错误描述:%2").arg(result.errorPos).arg(result.errorMsg)); QString("错误位置:%1\n错误描述:%2").arg(result.errorPos).arg(result.errorMsg));
return; return;
} }
qDebug() << "finalExpr" << finalExpr; qDebug() << "finalExpr" << finalExpr << index;
relay_data->single_relay[current_index].logic[vote_current_index] = finalExpr; relay_data->single_relay[current_index].logic[vote_current_index] = finalExpr;
if(relay_data->single_relay[current_index].logic[index] != "") if(relay_data->single_relay[current_index].logic[index] != "")
setExpressionToTreeView(treeView_relay, relay_data->single_relay[current_index].logic[index]); setExpressionToTreeView(treeView_relay, relay_data->single_relay[current_index].logic[index]);