修复bug

This commit is contained in:
DESKTOP-7I8SUIC\zhang 2025-11-26 21:29:20 +08:00
parent 110685ef56
commit b35e594834
18 changed files with 70 additions and 271 deletions

View File

@ -596,30 +596,16 @@ void ConfigMgr::Save(QString & file_path) {
channel_item.insert("group",ptr->single_relay[ch].group);
}
}
}else if(card_type_[i] == kCardRelaySingleNOK){
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot);
if (base_ptr == nullptr) {
continue;
}
std::shared_ptr<SingleRelayData> ptr = std::dynamic_pointer_cast<SingleRelayData>(base_ptr);
if(ptr->single_relay[ch].vote){
channel_item.insert("count_vote",ptr->single_relay[ch].count_vote);
QJsonArray array_logic;
for(int var = 0 ; var < 10;++var){
if(ptr->single_relay[ch].logic[var] != ""){
array_logic.append(ptr->single_relay[ch].logic[var]);
}
}
channel_item.insert("logic_vote", array_logic);
}else{
if(ptr->single_relay[ch].logic_expression != ""){
qDebug() << "ch" << ch << ptr->single_relay[ch].logic_expression;
channel_item.insert("logic_expression", ptr->single_relay[ch].logic_expression);
channel_item.insert("vote",ptr->single_relay[ch].vote);
channel_item.insert("active", ptr->single_relay[ch].active);
channel_item.insert("group",ptr->single_relay[ch].group);
}
if(ptr->single_relay[ch].logic_expression != ""){
qDebug() << "ch" << ch << ptr->single_relay[ch].logic_expression;
channel_item.insert("logic_expression", ptr->single_relay[ch].logic_expression);
channel_item.insert("active", ptr->single_relay[ch].active);
}
}else if(card_type_[i] == kCardRelayTMRPrimary){
@ -1158,16 +1144,7 @@ void ConfigMgr::Load(QString filename) {
singlerelay_data->version_ = temp_obj["version"].toInt();
for (int j = 0; j < RELAY_COUNT; ++j) {
channel = temp_obj[QString::number(j + 1)].toObject();
if(channel["vote"].toBool()){
singlerelay_data->single_relay[j].count_vote = channel["count_vote"].toInt();
singlerelay_data->single_relay[j].vote = channel["vote"].toBool();
QJsonArray array_logic = channel["logic_vote"].toArray();
for(int var = 0;var < array_logic.size();++var){
singlerelay_data->single_relay[j].logic[var] = array_logic[var].toString();
}
}else{
singlerelay_data->single_relay[j].logic_expression = channel["logic_expression"].toString();
}
singlerelay_data->single_relay[j].logic_expression = channel["logic_expression"].toString();
singlerelay_data->single_relay[j].active = channel["active"].toBool();
singlerelay_data->single_relay[j].group = channel["group"].toInt();
}

View File

@ -182,6 +182,7 @@ typedef struct SlotConfig_{
QString slot_type;
QPushButton *slot_btn;
QLabel *slot_label;
CardType card_type;
SlotConfig_(){
slot_type = "";
}

View File

@ -10,14 +10,14 @@
#include "config_mgr.h"
#include "keyphase_data.h"
KeyPhase::KeyPhase(int slot_no_,int cardtype, QWidget *parent)
KeyPhase::KeyPhase(int slot_no_,CardType cardtype, QWidget *parent)
: QDialog(parent)
, ui(new Ui::KeyPhase) {
ui->setupUi(this);
ui->widget_body->setProperty("flag", "body");
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
slot_no = slot_no_;
car_type = static_cast<CardType>(cardtype);
car_type = cardtype;
QString slot = QString("%1").arg(slot_no);
ui->label_slot->setText(slot);
// QString filePath_keyphase = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\keyphase.json").arg(slot_no);

View File

@ -12,7 +12,7 @@ class KeyPhase : public QDialog {
Q_OBJECT
public:
explicit KeyPhase(int slot_no_,int cardtype, QWidget *parent = nullptr);
explicit KeyPhase(int slot_no_,CardType cardtype, QWidget *parent = nullptr);
~KeyPhase();
int slot_no;
CardType car_type;

View File

@ -291,7 +291,7 @@ void MainWindow::onMenuActionTriggered() {
qDebug() << "子菜单项被点击,所属按钮:" << button->objectName() << action->text();
QString slot_type = action->text().mid(1, 6);
QString rack_type = action->text().right(action->text().length() - 8);
card_type = static_cast<CardType>(action->data().toInt());
CardType card_type = static_cast<CardType>(action->data().toInt());
qDebug() << "rack_type" << action->data() << "card type" << card_type;
int button_id = button->objectName().right(button->objectName().length() - 15).toInt();
qDebug() << slot_type << rack_type << button_id << map_slot_config[button_id].slot_type << map_slot_config[button_id + 2].slot_type ;
@ -317,10 +317,13 @@ void MainWindow::onMenuActionTriggered() {
ConfigMgr::Instance()->card_type_[button_id + 1] == kCardNone) {
map_slot_config[button_id].slot_type = slot_type;
map_slot_config[button_id].slot_btn->setText(chan_display);
map_slot_config[button_id].card_type = kCardRelayTMRPrimary;
map_slot_config[button_id + 1].slot_type = slot_type;
map_slot_config[button_id + 1].slot_btn->setText(chan_display);
map_slot_config[button_id + 1].card_type = kCardRelayTMRBackup;
map_slot_config[button_id + 2].slot_type = slot_type;
map_slot_config[button_id + 2].slot_btn->setText(chan_display);
map_slot_config[button_id + 2].card_type = kCardRelayTMRBackup;
ConfigMgr::Instance()->card_type_[button_id - 1] = kCardRelayTMRPrimary;
ConfigMgr::Instance()->card_type_[button_id] = kCardRelayTMRBackup;
@ -342,6 +345,7 @@ void MainWindow::onMenuActionTriggered() {
card_type == kCardKeyphaseSingle || card_type == kCardRelaySingle ||
card_type == kCardRelaySingleNOK) && ConfigMgr::Instance()->card_type_[button_id - 1] == kCardNone) {
map_slot_config[button_id].slot_type = slot_type;
map_slot_config[button_id].card_type = card_type;
button->setText(chan_display);
ConfigMgr::Instance()->card_type_[button_id - 1] = card_type;
}else if ((card_type == kCardVibSingle || card_type == kCardSpeedSingle ||
@ -425,45 +429,45 @@ void MainWindow::onMenuActionTriggered() {
void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) {
if (slot_btn != NULL && ui->pushButton_chan->isChecked()) {
QString object_name = slot_btn->objectName();
qDebug() << object_name << card_type ;
int button_id = object_name.right(object_name.length() - 15).toInt();
SlotConfig slot_config = map_slot_config[button_id];
map_slot_config[button_id].slot_label->setStyleSheet("QLabel { color :#2980b9; font: bold 16px}");
if(current_slot != -1)
map_slot_config[current_slot].slot_label->setStyleSheet("");
current_slot = button_id;
qDebug() << map_slot_config[button_id].card_type << button_id ;
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id);
if(base_ptr == nullptr){
ConfigMgr::Instance()->card_type_[button_id - 1] = card_type;
ConfigMgr::Instance()->card_type_[button_id - 1] = map_slot_config[button_id].card_type;
if (slot_config.slot_type == "KPM834") { // 键相模块
KeyPhase *key_phase = new KeyPhase(button_id,card_type);
KeyPhase *key_phase = new KeyPhase(button_id,map_slot_config[button_id].card_type);
key_phase->setWindowModality(Qt::ApplicationModal);
key_phase->show();
} else if (slot_config.slot_type == "DOM810") { // 继电器模块
switch (card_type) {
switch (map_slot_config[button_id].card_type) {
case kCardRelayTMRPrimary:{
TMRRelayAssociation *single_tmr_relay = new TMRRelayAssociation(button_id,card_type);
TMRRelayAssociation *single_tmr_relay = new TMRRelayAssociation(button_id,map_slot_config[button_id].card_type);
single_tmr_relay->setWindowModality(Qt::ApplicationModal);
single_tmr_relay->show();
}break;
case kCardRelaySingle:{
SingleRelay *single_relay = new SingleRelay(button_id,card_type);
SingleRelay *single_relay = new SingleRelay(button_id,map_slot_config[button_id].card_type);
single_relay->setWindowModality(Qt::ApplicationModal);
single_relay->show();
}break;
case kCardRelaySingleNOK:{
SingleRelay_NOK *single_relay_nok = new SingleRelay_NOK(button_id,card_type);
SingleRelay_NOK *single_relay_nok = new SingleRelay_NOK(button_id,map_slot_config[button_id].card_type);
single_relay_nok->setWindowModality(Qt::ApplicationModal);
single_relay_nok->show();
}break;
}
} else if (slot_config.slot_type == "HAM824") { // 振动模块
Seismic_monitor *seismic_monitor = new Seismic_monitor(button_id,card_type);
Seismic_monitor *seismic_monitor = new Seismic_monitor(button_id,map_slot_config[button_id].card_type);
seismic_monitor->setWindowModality(Qt::ApplicationModal);
seismic_monitor->show();
} else if (slot_config.slot_type == "OPM844") { // 转速模块
Tachometer *tachometer = new Tachometer(button_id,card_type);
Tachometer *tachometer = new Tachometer(button_id,map_slot_config[button_id].card_type);
tachometer->setWindowModality(Qt::ApplicationModal);
tachometer->show();
}
@ -472,36 +476,36 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) {
qDebug() << "base_ptr->card_type_" << base_ptr->card_type_;
switch(base_ptr->card_type_){
case kCardVibSingle:{
Seismic_monitor *seismic_monitor = new Seismic_monitor(button_id,card_type);
Seismic_monitor *seismic_monitor = new Seismic_monitor(button_id,map_slot_config[button_id].card_type);
seismic_monitor->setWindowModality(Qt::ApplicationModal);
seismic_monitor->show();
break;
}
case kCardKeyphaseSingle:{
KeyPhase *key_phase = new KeyPhase(button_id,card_type);
KeyPhase *key_phase = new KeyPhase(button_id,map_slot_config[button_id].card_type);
key_phase->setWindowModality(Qt::ApplicationModal);
key_phase->show();
break;
}
case kCardSpeedSingle:{
Tachometer *tachometer = new Tachometer(button_id,card_type);
Tachometer *tachometer = new Tachometer(button_id,map_slot_config[button_id].card_type);
tachometer->setWindowModality(Qt::ApplicationModal);
tachometer->show();
break;
}
case kCardRelaySingle:{
SingleRelay *single_relay = new SingleRelay(button_id,card_type);
SingleRelay *single_relay = new SingleRelay(button_id,map_slot_config[button_id].card_type);
single_relay->setWindowModality(Qt::ApplicationModal);
single_relay->show();
break;
}
case kCardRelayTMRPrimary:{
TMRRelayAssociation *single_tmr_relay = new TMRRelayAssociation(button_id,card_type);
TMRRelayAssociation *single_tmr_relay = new TMRRelayAssociation(button_id,map_slot_config[button_id].card_type);
single_tmr_relay->setWindowModality(Qt::ApplicationModal);
single_tmr_relay->show();
}break;
case kCardRelaySingleNOK:{
SingleRelay_NOK *single_relay_nok = new SingleRelay_NOK(button_id,card_type);
SingleRelay_NOK *single_relay_nok = new SingleRelay_NOK(button_id,map_slot_config[button_id].card_type);
single_relay_nok->setWindowModality(Qt::ApplicationModal);
single_relay_nok->show();
}break;

View File

@ -45,7 +45,6 @@ private:
QTcpSocket *socket;
QProgressBar *progressBar;
CardType card_type;
int current_slot;
QString tsi_config_file;

View File

@ -30,7 +30,7 @@ Seismic_monitor::Seismic_monitor(int slot,CardType cardtype, QWidget *parent) :
ui->comboBox_chan_type_4->setView(new QListView());
slot_no = slot;
car_type = cardtype;
card_type = cardtype;
QString slot_no_ = QString("%1").arg(slot_no);
ui->label_slot_no->setText(slot_no_);
Init();
@ -48,7 +48,7 @@ void Seismic_monitor::Init() {
// do nothing or use template to init it.
std::shared_ptr<VibrationData> vib_data = std::make_shared<VibrationData>();
vib_data->slot_ = slot_no;
vib_data->card_type_ = car_type;
vib_data->card_type_ = card_type;
qDebug() << "card type" << vib_data->card_type_;
ConfigMgr::Instance()->AddCard(vib_data);
UpdateData(vib_data);

View File

@ -17,7 +17,7 @@ class Seismic_monitor : public QWidget {
~Seismic_monitor();
int slot_no;
int channel;
CardType car_type;
CardType card_type;
private slots:
void on_pushButton_confirm_clicked();
@ -60,7 +60,7 @@ class Seismic_monitor : public QWidget {
private:
Ui::Seismic_monitor *ui;
void UpdateData(std::shared_ptr<VibrationData> vib_data);
int card_type;
// int card_type;
// void readJsonFile(const QString &filePath);
// SeismicMonitor seismic_monitor[CHANNLE_COUNT];
QVector<Transducer> vec_transducer;

View File

@ -5,12 +5,12 @@
#include <QMessageBox>
#include <QMenu>
SingleRelay::SingleRelay(int slot,int cardtype,QWidget *parent)
SingleRelay::SingleRelay(int slot,CardType cardtype,QWidget *parent)
: QDialog(parent)
, ui(new Ui::SingleRelay) {
ui->setupUi(this);
slot_no = slot;
car_type = static_cast<CardType>(cardtype);
car_type = cardtype;
ui->label_slot_no->setText(QString::number(slot_no));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QVBoxLayout *layout_available = new QVBoxLayout(ui->widget_available);

View File

@ -18,7 +18,7 @@ class SingleRelay : public QDialog {
Q_OBJECT
public:
explicit SingleRelay(int slot,int cardtype,QWidget *parent = nullptr);
explicit SingleRelay(int slot,CardType cardtype,QWidget *parent = nullptr);
~SingleRelay();
int slot_no;
CardType car_type;

View File

@ -245,7 +245,7 @@
<rect>
<x>40</x>
<y>10</y>
<width>71</width>
<width>101</width>
<height>16</height>
</rect>
</property>
@ -915,9 +915,9 @@
<widget class="QLabel" name="label_slot_no">
<property name="geometry">
<rect>
<x>110</x>
<x>150</x>
<y>10</y>
<width>61</width>
<width>91</width>
<height>16</height>
</rect>
</property>
@ -1011,13 +1011,13 @@
<string>是否投票</string>
</property>
</widget>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>632</x>
<y>110</y>
<width>141</width>
<height>31</height>
<height>32</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
@ -1058,7 +1058,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>632</x>

View File

@ -5,13 +5,13 @@
#include <QMessageBox>
#include <QMenu>
SingleRelay_NOK::SingleRelay_NOK(int slot,int cardtype,QWidget *parent) :
SingleRelay_NOK::SingleRelay_NOK(int slot,CardType cardtype,QWidget *parent) :
QWidget(parent),
ui(new Ui::SingleRelay_NOK)
{
ui->setupUi(this);
slot_no = slot;
car_type = static_cast<CardType>(cardtype);
car_type = cardtype;
ui->label_slot_no->setText(QString::number(slot_no));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QVBoxLayout *layout_available = new QVBoxLayout(ui->widget_available);
@ -53,7 +53,6 @@ SingleRelay_NOK::SingleRelay_NOK(int slot,int cardtype,QWidget *parent) :
treeView_relay->setContextMenuPolicy(Qt::CustomContextMenu);
connect(treeView_relay,&QTreeView::customContextMenuRequested,this,&SingleRelay_NOK::on_treeView_Relay_customContextMenuRequested);
current_index = ui->comboBox_relay_ch->currentIndex();
vote_current_index = ui->comboBox_vote_group->currentIndex();
Init();
onComboBoxIndexChanged(current_index);
}
@ -170,11 +169,8 @@ void SingleRelay_NOK::on_pushButton_confirm_clicked()
QString("错误位置:%1\n错误描述:%2").arg(result.errorPos).arg(result.errorMsg));
return;
}
if(ui->checkBox_vote->checkState()){
relay_data->single_relay[current_index].logic[ui->comboBox_vote_group->currentIndex()] = finalExpr;
}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].group = ui->comboBox_group->currentIndex() + 1;
qDebug() << "逻辑表达式:" << finalExpr;
@ -268,19 +264,13 @@ void SingleRelay_NOK::onComboBoxIndexChanged(int index){
return;
}
qDebug() << "finalExpr" << finalExpr;
if(ui->checkBox_vote->checkState()){
relay_data->single_relay[current_index].logic[ui->comboBox_vote_group->currentIndex()] = finalExpr;
if(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
model_Relay->clear();
}else{
relay_data->single_relay[current_index].logic_expression = finalExpr;
if(relay_data->single_relay[index].logic_expression != "")
setExpressionToTreeView(treeView_relay, relay_data->single_relay[index].logic_expression);
else
model_Relay->clear();
}
relay_data->single_relay[current_index].logic_expression = finalExpr;
if(relay_data->single_relay[index].logic_expression != "")
setExpressionToTreeView(treeView_relay, relay_data->single_relay[index].logic_expression);
else
model_Relay->clear();
relay_data->single_relay[current_index].active = ui->checkBox_active->isChecked();
relay_data->single_relay[current_index].group = ui->comboBox_group->currentIndex() + 1;
current_index = index;
@ -484,14 +474,3 @@ void SingleRelay_NOK::on_comboBox_vote_group_currentIndexChanged(int index)
vote_current_index = index;
}
void SingleRelay_NOK::on_checkBox_vote_clicked(bool checked)
{
if(checked){
ui->comboBox_vote_group->setEnabled(true);
}else{
ui->comboBox_vote_group->setEnabled(false);
}
}

View File

@ -20,7 +20,7 @@ class SingleRelay_NOK : public QWidget
Q_OBJECT
public:
explicit SingleRelay_NOK(int slot,int cardtype,QWidget *parent = nullptr);
explicit SingleRelay_NOK(int slot,CardType cardtype,QWidget *parent = nullptr);
~SingleRelay_NOK();
int slot_no;
CardType car_type;
@ -37,8 +37,6 @@ private slots:
void slotDeleteItem();
void on_checkBox_vote_clicked(bool checked);
void on_treeView_Relay_customContextMenuRequested(const QPoint &pos);

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>非OK继电器</string>
<string>非OK继电器组态</string>
</property>
<widget class="QWidget" name="widget" native="true">
<property name="geometry">
@ -742,7 +742,7 @@
<property name="geometry">
<rect>
<x>620</x>
<y>180</y>
<y>10</y>
<width>91</width>
<height>16</height>
</rect>
@ -975,26 +975,13 @@
<string>继电器槽位:</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_vote">
<property name="geometry">
<rect>
<x>640</x>
<y>30</y>
<width>121</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>是否投票</string>
</property>
</widget>
<widget class="QWidget" name="widget_relay" native="true">
<property name="geometry">
<rect>
<x>620</x>
<y>200</y>
<y>40</y>
<width>341</width>
<height>301</height>
<height>461</height>
</rect>
</property>
</widget>
@ -1011,153 +998,6 @@
<string>可用的告警:</string>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>630</x>
<y>108</y>
<width>141</width>
<height>32</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_97">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string> 选择:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_vote_count">
<property name="minimumSize">
<size>
<width>50</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>30</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget_3">
<property name="geometry">
<rect>
<x>630</x>
<y>70</y>
<width>141</width>
<height>32</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_96">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string> 逻辑:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_vote_group">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>30</height>
</size>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
<item>
<property name="text">
<string>6</string>
</property>
</item>
<item>
<property name="text">
<string>7</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
<item>
<property name="text">
<string>9</string>
</property>
</item>
<item>
<property name="text">
<string>10</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>

View File

@ -12,14 +12,14 @@
#include "tachometer_data.h"
#include "copy_channel.h"
Tachometer::Tachometer(int slot_no_,int cardtype, QWidget *parent)
Tachometer::Tachometer(int slot_no_,CardType cardtype, QWidget *parent)
: QDialog(parent)
, ui(new Ui::Tachometer) {
ui->setupUi(this);
ui->widget_body->setProperty("flag", "body");
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
slot_no = slot_no_;
car_type = static_cast<CardType>(cardtype);
card_type = cardtype;
QString slot = QString("%1").arg(slot_no);
ui->label_slot->setText(slot);
Init();
@ -238,7 +238,7 @@ void Tachometer::Init() {
if (base_ptr == nullptr) {
// do nothing or use template to init it.
std::shared_ptr<TachometerData> speed_data = std::make_shared<TachometerData>();
speed_data->card_type_ = car_type;
speed_data->card_type_ = card_type;
speed_data->slot_ = slot_no;
ConfigMgr::Instance()->AddCard(speed_data);
UpdateData(speed_data);

View File

@ -13,10 +13,10 @@ class Tachometer : public QDialog {
Q_OBJECT
public:
explicit Tachometer(int slot_no_,int cardtype, QWidget *parent = nullptr);
explicit Tachometer(int slot_no_,CardType cardtype, QWidget *parent = nullptr);
~Tachometer();
int slot_no;
CardType car_type;
CardType card_type;
private slots:
void on_pushButton_confirm_clicked();
void on_pushButton_cancel_clicked();

View File

@ -5,14 +5,14 @@
#include <QMenu>
#include <QMessageBox>
TMRRelayAssociation::TMRRelayAssociation(int slot,int cardtype,QWidget *parent)
TMRRelayAssociation::TMRRelayAssociation(int slot,CardType cardtype,QWidget *parent)
: QDialog(parent)
, ui(new Ui::TMRRelayAssociation)
{
ui->setupUi(this);
slot_no = slot;
car_type = static_cast<CardType>(cardtype);
if(car_type == kCardRelaySingle){
card_type = cardtype;
if(card_type == kCardRelaySingle){
ui->checkBox_sgcc->setVisible(0);
}
ui->label_slot_no->setText(QString::number(slot_no));
@ -99,7 +99,7 @@ void TMRRelayAssociation::Init(){
if (base_ptr == nullptr) {
// do nothing or use template to init it.
relay_data = std::make_shared<TmrrelayassociationData>();
relay_data->card_type_ = car_type;
relay_data->card_type_ = card_type;
relay_data->slot_ = slot_no;
ConfigMgr::Instance()->AddCard(relay_data);
@ -540,6 +540,7 @@ void TMRRelayAssociation::on_checkBox_sgcc_stateChanged(int arg1)
ui->comboBox_relay_ch->setEnabled(false);
ui->pushButton_logic->setEnabled(false);
ui->textEdit_logic->setEnabled(false);
model_Relay->clear();
}else{
treeView_relay->setEnabled(true);
list_widget_available->setEnabled(true);

View File

@ -21,10 +21,10 @@ class TMRRelayAssociation : public QDialog
Q_OBJECT
public:
explicit TMRRelayAssociation(int slot,int cardtype,QWidget *parent = nullptr);
explicit TMRRelayAssociation(int slot,CardType cardtype,QWidget *parent = nullptr);
~TMRRelayAssociation();
int slot_no;
CardType car_type;
CardType card_type;
private slots:
void on_pushButton_cancel_clicked();