#include "seismic_monitor.h" #include "ui_seismic_monitor.h" #include #include #include #include #include #include #include "acceleration.h" #include "velocity.h" #include "radial_vibration.h" #include "data_config.h" #include "config_mgr.h" #include "vibrationdata.h" #include "trust.h" #include #include "pressure_pulsation.h" #include "channel_1_2.h" #include "channel_3_4.h" #include "copy_channel.h" Seismic_monitor::Seismic_monitor(int slot,CardType cardtype, QWidget *parent) : QWidget(parent), ui(new Ui::Seismic_monitor) { ui->setupUi(this); ui->widget_body->setProperty("flag", "body"); ui->comboBox_chan_type_1->setView(new QListView()); ui->comboBox_chan_type_2->setView(new QListView()); ui->comboBox_chan_type_3->setView(new QListView()); ui->comboBox_chan_type_4->setView(new QListView()); slot_no = slot; card_type = cardtype; QString slot_no_ = QString("%1").arg(slot_no); ui->label_slot_no->setText(slot_no_); current_config_1_2 = -1; current_config_3_4 = -1; ui->lineEdit_first_1->setVisible(false); ui->lineEdit_first_2->setVisible(false); ui->lineEdit_second_1->setVisible(false); ui->lineEdit_second_2->setVisible(false); ui->comboBox_dual_math_function->setVisible(false); ui->comboBox_dual_math_function_2->setVisible(false); ui->label_text_1->setVisible(false); ui->label_text_2->setVisible(false); ui->label_text_3->setVisible(false); ui->label_text_4->setVisible(false); ui->label_text_5->setVisible(false); ui->label_text_6->setVisible(false); ui->comboBox_function_1->setCurrentIndex(0); ui->comboBox_function_2->setCurrentIndex(0); Init(); } Seismic_monitor::~Seismic_monitor() { delete ui; } void Seismic_monitor::Init() { std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); if (base_ptr == nullptr) { qDebug() << "base_ptr"; // do nothing or use template to init it. std::shared_ptr vib_data = std::make_shared(); vib_data->slot_ = slot_no; vib_data->card_type_ = card_type; qDebug() << "card type" << vib_data->card_type_; ConfigMgr::Instance()->AddCard(vib_data); UpdateData(vib_data); return; } std::shared_ptr vib_data = std::dynamic_pointer_cast(base_ptr); for (int i = 0; i < CHANNEL_COUNT; i++) { if (i + 1 == 1) { qDebug() << vib_data->base_config_[i].channel_type ; ui->comboBox_chan_type_1->setCurrentIndex(vib_data->base_config_[i].channel_type); ui->checkBox_standby_1->setChecked(vib_data->base_config_[i].standby); ui->comboBox_sensitivity_unit_1->setCurrentText(GetUnit(vib_data->base_config_[i].sensitivity_unit)); ui->lineEdit_signal_sensitivity_1->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); if(vib_data->base_config_[i].power) ui->comboBox_power_supply_1->setCurrentIndex(0); else ui->comboBox_power_supply_1->setCurrentIndex(1); ui->checkBox_enable_1->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_1->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_1->setValue(vib_data->base_config_[i].normal_voltage_high); ui->checkBox_keyphase->setChecked(vib_data->base_config_[i].keyphase); ui->comboBox_keyphase_ch->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch)); ui->comboBox_keyphase_slot->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot)); } else if (i + 1 == 2) { ui->comboBox_chan_type_2->setCurrentIndex(vib_data->base_config_[i].channel_type); ui->comboBox_sensitivity_unit_2->setCurrentText(GetUnit(vib_data->base_config_[i].sensitivity_unit)); ui->lineEdit_signal_sensitivity_2->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); ui->checkBox_enable_2->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_2->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_2->setValue(vib_data->base_config_[i].normal_voltage_high); if(vib_data->base_config_[i].power) ui->comboBox_power_supply_2->setCurrentIndex(0); else ui->comboBox_power_supply_2->setCurrentIndex(1); ui->checkBox_keyphase_2->setChecked(vib_data->base_config_[i].keyphase); ui->comboBox_keyphase_ch_2->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch)); ui->comboBox_keyphase_slot_2->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot)); } else if (i + 1 == 3) { ui->checkBox_standby_2->setChecked(vib_data->base_config_[i].standby); ui->comboBox_chan_type_3->setCurrentIndex(vib_data->base_config_[i].channel_type); ui->comboBox_sensitivity_unit_3->setCurrentText(GetUnit(vib_data->base_config_[i].sensitivity_unit)); ui->lineEdit_signal_sensitivity_3->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); if(vib_data->base_config_[i].power) ui->comboBox_power_supply_3->setCurrentIndex(0); else ui->comboBox_power_supply_3->setCurrentIndex(1); ui->checkBox_keyphase_3->setChecked(vib_data->base_config_[i].keyphase); ui->comboBox_keyphase_ch_3->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch)); ui->comboBox_keyphase_slot_3->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot)); ui->checkBox_enable_3->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_3->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_3->setValue(vib_data->base_config_[i].normal_voltage_high); } else if (i + 1 == 4) { ui->comboBox_chan_type_4->setCurrentIndex(vib_data->base_config_[i].channel_type); ui->comboBox_sensitivity_unit_4->setCurrentText(GetUnit(vib_data->base_config_[i].sensitivity_unit)); ui->lineEdit_signal_sensitivity_4->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); ui->checkBox_keyphase_4->setChecked(vib_data->base_config_[i].keyphase); ui->comboBox_keyphase_ch_4->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch)); ui->comboBox_keyphase_slot_4->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot)); if(vib_data->base_config_[i].power) ui->comboBox_power_supply_4->setCurrentIndex(0); else ui->comboBox_power_supply_4->setCurrentIndex(1); ui->checkBox_enable_4->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_4->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_4->setValue(vib_data->base_config_[i].normal_voltage_high); }else if (i + 1 == 5) { ui->comboBox_function_1->setCurrentIndex(vib_data->base_config_[i].function); if(vib_data->base_config_[i].function == kRST){ ui->lineEdit_first_1->setVisible(true); ui->lineEdit_second_1->setVisible(true); ui->label_text_1->setVisible(true); ui->label_text_2->setVisible(true); ui->comboBox_dual_math_function->setVisible(false); ui->label_text_5->setVisible(false); ui->lineEdit_first_1->setText(QString::number(vib_data->base_config_[i].first_channel_angle)); ui->lineEdit_second_1->setText(QString::number(vib_data->base_config_[i].second_channel_angle)); }else if(vib_data->base_config_[i].function == kDMF){ ui->lineEdit_first_1->setVisible(false); ui->lineEdit_second_1->setVisible(false); ui->label_text_1->setVisible(false); ui->label_text_2->setVisible(false); ui->comboBox_dual_math_function->setVisible(true); ui->label_text_5->setVisible(true); ui->comboBox_dual_math_function->setCurrentIndex(vib_data->base_config_[i].dmf_function); } }else if (i + 1 == 6) { ui->comboBox_function_2->setCurrentIndex(vib_data->base_config_[i].function); if(vib_data->base_config_[i].function == kRST){ ui->lineEdit_first_2->setVisible(true); ui->lineEdit_second_2->setVisible(true); ui->label_text_3->setVisible(true); ui->label_text_4->setVisible(true); ui->comboBox_dual_math_function_2->setVisible(false); ui->label_text_6->setVisible(false); ui->lineEdit_first_2->setText(QString::number(vib_data->base_config_[i].first_channel_angle)); ui->lineEdit_second_2->setText(QString::number(vib_data->base_config_[i].second_channel_angle)); }else if(vib_data->base_config_[i].function == kDMF){ ui->lineEdit_first_2->setVisible(false); ui->lineEdit_second_2->setVisible(false); ui->label_text_3->setVisible(false); ui->label_text_4->setVisible(false); ui->comboBox_dual_math_function_2->setVisible(true); ui->label_text_6->setVisible(true); ui->comboBox_dual_math_function_2->setCurrentIndex(vib_data->base_config_[i].dmf_function); } } } ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number); qDebug() << "group" << base_ptr->group; ui->comboBox_group->setCurrentIndex(base_ptr->group - 1); } void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { for (int var = 0; var < CHANNEL_COUNT; ++var) { if (var + 1 == 1) { vib_data->base_config_[var].standby = ui->checkBox_standby_1->isChecked(); vib_data->base_config_[var].active = ui->checkBox_enable_1->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_1->currentIndex(); vib_data->base_config_[var].sensitivity_unit = SetUnit(ui->comboBox_sensitivity_unit_1->currentText()); vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_1->text().toFloat(); if(ui->comboBox_power_supply_1->currentIndex() == 0) vib_data->base_config_[var].power = true; else if(ui->comboBox_power_supply_1->currentIndex() == 1) vib_data->base_config_[var].power = false; vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_1->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_1->value(); vib_data->base_config_[var].chan_id = QString("S%1C%2").arg(QString::number(slot_no, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); vib_data->base_config_[var].keyphase = ui->checkBox_keyphase->isChecked(); vib_data->base_config_[var].keyphase_slot = ui->comboBox_keyphase_slot->currentText().toInt(); vib_data->base_config_[var].keyphase_ch = ui->comboBox_keyphase_ch->currentText().toInt(); } else if (var + 1 == 2) { vib_data->base_config_[var].standby = ui->checkBox_standby_1->isChecked(); vib_data->base_config_[var].active = ui->checkBox_enable_2->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_2->currentIndex(); vib_data->base_config_[var].sensitivity_unit = SetUnit(ui->comboBox_sensitivity_unit_2->currentText()); vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_2->text().toFloat(); if(ui->comboBox_power_supply_1->currentIndex() == 0) vib_data->base_config_[var].power = true; else if(ui->comboBox_power_supply_1->currentIndex() == 1) vib_data->base_config_[var].power = false; vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_2->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_2->value(); vib_data->base_config_[var].chan_id = QString("S%1C%2").arg(QString::number(slot_no, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); vib_data->base_config_[var].keyphase = ui->checkBox_keyphase_2->isChecked(); vib_data->base_config_[var].keyphase_slot = ui->comboBox_keyphase_slot_2->currentText().toInt(); vib_data->base_config_[var].keyphase_ch = ui->comboBox_keyphase_ch_2->currentText().toInt(); } else if (var + 1 == 3) { vib_data->base_config_[var].standby = ui->checkBox_standby_2->isChecked(); vib_data->base_config_[var].active = ui->checkBox_enable_3->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_3->currentIndex(); vib_data->base_config_[var].sensitivity_unit = SetUnit(ui->comboBox_sensitivity_unit_3->currentText()); vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_3->text().toFloat(); if(ui->comboBox_power_supply_1->currentIndex() == 0) vib_data->base_config_[var].power = true; else if(ui->comboBox_power_supply_1->currentIndex() == 1) vib_data->base_config_[var].power = false; vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_3->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_3->value(); vib_data->base_config_[var].chan_id = QString("S%1C%2").arg(QString::number(slot_no, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); vib_data->base_config_[var].keyphase = ui->checkBox_keyphase_3->isChecked(); vib_data->base_config_[var].keyphase_slot = ui->comboBox_keyphase_slot_3->currentText().toInt(); vib_data->base_config_[var].keyphase_ch = ui->comboBox_keyphase_ch_3->currentText().toInt(); } else if (var + 1 == 4) { vib_data->base_config_[var].standby = ui->checkBox_standby_2->isChecked(); vib_data->base_config_[var].active = ui->checkBox_enable_4->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_4->currentIndex(); vib_data->base_config_[var].sensitivity_unit = SetUnit(ui->comboBox_sensitivity_unit_4->currentText()); vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_4->text().toFloat(); if(ui->comboBox_power_supply_1->currentIndex() == 0) vib_data->base_config_[var].power = true; else if(ui->comboBox_power_supply_1->currentIndex() == 1) vib_data->base_config_[var].power = false; vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_4->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_4->value(); vib_data->base_config_[var].chan_id = QString("S%1C%2").arg(QString::number(slot_no, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); vib_data->base_config_[var].keyphase = ui->checkBox_keyphase_4->isChecked(); vib_data->base_config_[var].keyphase_slot = ui->comboBox_keyphase_slot_4->currentText().toInt(); vib_data->base_config_[var].keyphase_ch = ui->comboBox_keyphase_ch_4->currentText().toInt(); }else if (var + 1 == 5) { vib_data->base_config_[var].function = ui->comboBox_function_1->currentIndex(); if(ui->comboBox_function_1->currentIndex() == 3){ vib_data->base_config_[var].first_channel_angle = ui->lineEdit_first_1->text().toFloat(); vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_1->text().toFloat(); }else if(ui->comboBox_function_1->currentIndex() == 5){ vib_data->base_config_[var].dmf_function = ui->comboBox_dual_math_function->currentIndex(); } vib_data->base_config_[var].channel_type = kVib12; }else if (var + 1 == 6) { vib_data->base_config_[var].function = ui->comboBox_function_2->currentIndex(); if(ui->comboBox_function_2->currentIndex() == 3){ vib_data->base_config_[var].first_channel_angle = ui->lineEdit_first_2->text().toFloat(); vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_2->text().toFloat(); }else if(ui->comboBox_function_2->currentIndex() == 5){ vib_data->base_config_[var].dmf_function = ui->comboBox_dual_math_function_2->currentIndex(); } vib_data->base_config_[var].channel_type = kVib34; } } } void Seismic_monitor::on_pushButton_confirm_clicked() { std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); if (base_ptr == nullptr) { qCritical() << " should not be here"; // std::shared_ptr vib_data = std::make_shared(); // ConfigMgr::Instance()->AddCard(vib_data); // UpdateData(vib_data); return; } if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase->isChecked()) { QMessageBox::information(this, QStringLiteral("提示"), "第一通道键相槽位选择错误!"); return; } if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_2->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_2->isChecked()) { QMessageBox::information(this, QStringLiteral("提示"), "第二通道键相槽位选择错误!"); return; } if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_3->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_3->isChecked()) { QMessageBox::information(this, QStringLiteral("提示"), "第三通道键相槽位选择错误!"); return; } if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_4->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_4->isChecked()) { QMessageBox::information(this, QStringLiteral("提示"), "第四通道键相槽位选择错误!"); return; } if(ui->lineEdit_first_1->text().toFloat() < -360 || ui->lineEdit_first_1->text().toFloat() > 360){ QMessageBox::information(this, QStringLiteral("提示"), "第一通道角度必须在-360 ~ 360 之间"); return; } if(ui->lineEdit_second_1->text().toFloat() < -360 || ui->lineEdit_second_1->text().toFloat() > 360){ QMessageBox::information(this, QStringLiteral("提示"), "第二通道角度必须在-360 ~ 360 之间"); return; } if(ui->lineEdit_first_2->text().toFloat() < -360 || ui->lineEdit_first_2->text().toFloat() > 360){ QMessageBox::information(this, QStringLiteral("提示"), "第一通道角度必须在-360 ~ 360 之间"); return; } if(ui->lineEdit_second_2->text().toFloat() < -360 || ui->lineEdit_second_2->text().toFloat() > 360){ QMessageBox::information(this, QStringLiteral("提示"), "第二通道角度必须在-360 ~ 360 之间"); return; } if(ui->lineEdit_signal_sensitivity_1->text() == "0" || ui->lineEdit_signal_sensitivity_2->text() == "0" || ui->lineEdit_signal_sensitivity_3->text() == "0" || ui->lineEdit_signal_sensitivity_4->text() == "0"){ QMessageBox::information(this, QStringLiteral("提示"), "传感器灵敏度填写错误!"); return; } for (int var = 1; var <= SLOT_NUM; var ++) { if(ui->comboBox_relative_number->currentIndex() != 0){ std::shared_ptr slot_base_ptr = ConfigMgr::Instance()->GetSlotPtr(var); if(slot_base_ptr == nullptr || slot_base_ptr->card_type_ != kCardVibSingle) continue; if(var == slot_no) continue; qDebug() << "relative_number" << var << slot_base_ptr->relative_number; if(slot_base_ptr->relative_number == ui->comboBox_relative_number->currentIndex() && slot_base_ptr->card_type_ != kCardSpeedSingle ){ QMessageBox::information(this, QStringLiteral("提示"), "板卡相对编号重复!"); return; } } } base_ptr->relative_number = ui->comboBox_relative_number->currentIndex(); base_ptr->group = ui->comboBox_group->currentIndex() + 1; std::shared_ptr vib_data = std::dynamic_pointer_cast(base_ptr); UpdateData(vib_data); qDebug() <<"type" << base_ptr->card_type_; this->close(); } void Seismic_monitor::on_pushButton_set_default_clicked() { } void Seismic_monitor::on_pushButton_config_1_clicked() { channel = 1; if (ui->comboBox_chan_type_1->currentIndex() == kVibAcc) { Acceleration *acceleration = new Acceleration(slot_no, channel, ui->checkBox_enable_1->isChecked()); acceleration->setWindowModality(Qt::ApplicationModal); acceleration->show(); } else if (ui->comboBox_chan_type_1->currentIndex() == kVibRadial) { Radial *radial_vibration = new Radial(slot_no, channel, ui->checkBox_enable_1->isChecked()); radial_vibration->setWindowModality(Qt::ApplicationModal); radial_vibration->show(); } else if (ui->comboBox_chan_type_1->currentIndex() == kVibVelocity) { Velocity *velocity = new Velocity(slot_no, channel, ui->checkBox_enable_1->isChecked()); velocity->setWindowModality(Qt::ApplicationModal); velocity->show(); }else if (ui->comboBox_chan_type_1->currentIndex() == kVibThrust) { Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_1->isChecked()); trust->setWindowModality(Qt::ApplicationModal); trust->show(); }else if (ui->comboBox_chan_type_1->currentIndex() == kVibPressurePulsation) { PressurePulsation *pressure_pulsation = new PressurePulsation(slot_no, channel, ui->checkBox_enable_1->isChecked()); pressure_pulsation->setWindowModality(Qt::ApplicationModal); pressure_pulsation->show(); } } void Seismic_monitor::on_pushButton_config_2_clicked() { channel = 2; if (ui->comboBox_chan_type_2->currentIndex() == kVibAcc) { Acceleration *acceleration = new Acceleration(slot_no, channel, ui->checkBox_enable_2->isChecked()); acceleration->setWindowModality(Qt::ApplicationModal); acceleration->show(); } else if (ui->comboBox_chan_type_2->currentIndex() == kVibRadial) { Radial *radial_vibration = new Radial(slot_no, channel, ui->checkBox_enable_2->isChecked()); radial_vibration->setWindowModality(Qt::ApplicationModal); radial_vibration->show(); } else if (ui->comboBox_chan_type_2->currentIndex() == kVibVelocity) { Velocity *velocity = new Velocity(slot_no, channel, ui->checkBox_enable_2->isChecked()); velocity->setWindowModality(Qt::ApplicationModal); velocity->show(); }else if (ui->comboBox_chan_type_2->currentIndex() == kVibThrust) { Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_2->isChecked()); trust->setWindowModality(Qt::ApplicationModal); trust->show(); }else if (ui->comboBox_chan_type_2->currentIndex() == kVibPressurePulsation) { PressurePulsation *pressure_pulsation = new PressurePulsation(slot_no, channel, ui->checkBox_enable_2->isChecked()); pressure_pulsation->setWindowModality(Qt::ApplicationModal); pressure_pulsation->show(); } } void Seismic_monitor::on_pushButton_config_3_clicked() { channel = 3; if (ui->comboBox_chan_type_3->currentIndex() == kVibAcc) { Acceleration *acceleration = new Acceleration(slot_no, channel, ui->checkBox_enable_3->isChecked()); acceleration->setWindowModality(Qt::ApplicationModal); acceleration->show(); } else if (ui->comboBox_chan_type_3->currentIndex() == kVibRadial) { Radial *radial_vibration = new Radial(slot_no, channel, ui->checkBox_enable_3->isChecked()); radial_vibration->setWindowModality(Qt::ApplicationModal); radial_vibration->show(); } else if (ui->comboBox_chan_type_3->currentIndex() == kVibVelocity) { Velocity *velocity = new Velocity(slot_no, channel, ui->checkBox_enable_3->isChecked()); velocity->setWindowModality(Qt::ApplicationModal); velocity->show(); }else if (ui->comboBox_chan_type_3->currentIndex() == kVibThrust) { Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_3->isChecked()); trust->setWindowModality(Qt::ApplicationModal); trust->show(); }else if (ui->comboBox_chan_type_3->currentIndex() == kVibPressurePulsation) { PressurePulsation *pressure_pulsation = new PressurePulsation(slot_no, channel, ui->checkBox_enable_3->isChecked()); pressure_pulsation->setWindowModality(Qt::ApplicationModal); pressure_pulsation->show(); } } void Seismic_monitor::on_pushButton_config_4_clicked() { channel = 4; if (ui->comboBox_chan_type_4->currentIndex() == kVibAcc) { Acceleration *acceleration = new Acceleration(slot_no, channel, ui->checkBox_enable_4->isChecked()); acceleration->setWindowModality(Qt::ApplicationModal); acceleration->show(); } else if (ui->comboBox_chan_type_4->currentIndex() == kVibRadial) { Radial *radial_vibration = new Radial(slot_no, channel, ui->checkBox_enable_4->isChecked()); radial_vibration->setWindowModality(Qt::ApplicationModal); radial_vibration->show(); } else if (ui->comboBox_chan_type_4->currentIndex() == kVibVelocity) { Velocity *velocity = new Velocity(slot_no, channel, ui->checkBox_enable_4->isChecked()); velocity->setWindowModality(Qt::ApplicationModal); velocity->show(); }else if (ui->comboBox_chan_type_4->currentIndex() == kVibThrust) { Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_4->isChecked()); trust->setWindowModality(Qt::ApplicationModal); trust->show(); }else if (ui->comboBox_chan_type_4->currentIndex() == kVibPressurePulsation) { PressurePulsation *pressure_pulsation = new PressurePulsation(slot_no, channel, ui->checkBox_enable_4->isChecked()); pressure_pulsation->setWindowModality(Qt::ApplicationModal); pressure_pulsation->show(); } } void Seismic_monitor::on_comboBox_chan_type_1_currentTextChanged(const QString &arg1) { switch (ui->comboBox_chan_type_1->currentIndex()) { case kVibRadial: EnableKeyphase(); break; case kVibAcc: EnableKeyphase(); break; case kVibVelocity: EnableKeyphase(); break; case kVibThrust: DisableKeyphase(); break; case kVibPressurePulsation: DisableKeyphase(); break; } } void Seismic_monitor::on_comboBox_chan_type_2_currentTextChanged(const QString &arg1) { switch (ui->comboBox_chan_type_2->currentIndex()) { case kVibRadial: EnableKeyphase(); break; case kVibAcc: EnableKeyphase2(); break; case kVibVelocity: EnableKeyphase2(); break; case kVibThrust: DisableKeyphase2(); break; case kVibPressurePulsation: DisableKeyphase2(); break; } } void Seismic_monitor::on_comboBox_chan_type_3_currentTextChanged(const QString &arg1) { switch (ui->comboBox_chan_type_3->currentIndex()) { case kVibRadial: EnableKeyphase(); break; case kVibAcc: EnableKeyphase3(); break; case kVibVelocity: EnableKeyphase3(); break; case kVibThrust: DisableKeyphase3(); break; case kVibPressurePulsation: DisableKeyphase3(); break; } } void Seismic_monitor::on_comboBox_chan_type_4_currentTextChanged(const QString &arg1) { switch (ui->comboBox_chan_type_4->currentIndex()) { case kVibRadial: EnableKeyphase4(); break; case kVibAcc: EnableKeyphase4(); break; case kVibVelocity: EnableKeyphase4(); break; case kVibThrust: DisableKeyphase4(); break; case kVibPressurePulsation: DisableKeyphase4(); break; } } void Seismic_monitor::on_pushButton_cancel_clicked() { this->close(); } void Seismic_monitor::EnableKeyphase(){ ui->checkBox_keyphase->setCheckable(true); ui->checkBox_keyphase->setEnabled(true); ui->comboBox_keyphase_ch->setEnabled(true); ui->comboBox_keyphase_slot->setEnabled(true); } void Seismic_monitor::EnableKeyphase2(){ ui->checkBox_keyphase_2->setCheckable(true); ui->checkBox_keyphase_2->setEnabled(true); ui->comboBox_keyphase_ch_2->setEnabled(true); ui->comboBox_keyphase_slot_2->setEnabled(true); } void Seismic_monitor::EnableKeyphase3(){ ui->checkBox_keyphase_3->setCheckable(true); ui->checkBox_keyphase_3->setEnabled(true); ui->comboBox_keyphase_ch_3->setEnabled(true); ui->comboBox_keyphase_slot_3->setEnabled(true); } void Seismic_monitor::EnableKeyphase4(){ ui->checkBox_keyphase_4->setCheckable(true); ui->checkBox_keyphase_4->setEnabled(true); ui->comboBox_keyphase_ch_4->setEnabled(true); ui->comboBox_keyphase_slot_4->setEnabled(true); } void Seismic_monitor::DisableKeyphase(){ ui->checkBox_keyphase->setCheckable(false); ui->checkBox_keyphase->setEnabled(false); ui->comboBox_keyphase_ch->setEnabled(false); ui->comboBox_keyphase_slot->setEnabled(false); } void Seismic_monitor::DisableKeyphase2(){ ui->checkBox_keyphase_2->setCheckable(false); ui->checkBox_keyphase_2->setEnabled(false); ui->comboBox_keyphase_ch_2->setEnabled(false); ui->comboBox_keyphase_slot_2->setEnabled(false); } void Seismic_monitor::DisableKeyphase3(){ ui->checkBox_keyphase_3->setCheckable(false); ui->checkBox_keyphase_3->setEnabled(false); ui->comboBox_keyphase_ch_3->setEnabled(false); ui->comboBox_keyphase_slot_3->setEnabled(false); } void Seismic_monitor::DisableKeyphase4(){ ui->checkBox_keyphase_4->setCheckable(false); ui->checkBox_keyphase_4->setEnabled(false); ui->comboBox_keyphase_ch_4->setEnabled(false); ui->comboBox_keyphase_slot_4->setEnabled(false); } void Seismic_monitor::on_comboBox_sensitivity_unit_1_currentTextChanged(const QString &arg1) { QString str = QString("信号灵敏度(mV/%1)").arg(arg1); ui->label_signal_sensitivity_1->setText(str); } void Seismic_monitor::on_comboBox_sensitivity_unit_2_currentTextChanged(const QString &arg1) { QString str = QString("信号灵敏度(mV/%1)").arg(arg1); ui->label_signal_sensitivity_2->setText(str); } void Seismic_monitor::on_comboBox_sensitivity_unit_3_currentTextChanged(const QString &arg1) { QString str = QString("信号灵敏度(mV/%1)").arg(arg1); ui->label_signal_sensitivity_3->setText(str); } void Seismic_monitor::on_comboBox_sensitivity_unit_4_currentTextChanged(const QString &arg1) { QString str = QString("信号灵敏度(mV/%1)").arg(arg1); ui->label_signal_sensitivity_4->setText(str); } void Seismic_monitor::on_pushButton_config_1_2_clicked() { Channel_1_2 *ch1_2 = new Channel_1_2(slot_no, 5,current_config_1_2); ch1_2->setWindowModality(Qt::ApplicationModal); ch1_2->show(); } void Seismic_monitor::on_pushButton_config_3_4_clicked() { Channel_3_4 *ch3_4 = new Channel_3_4(slot_no, 6,current_config_3_4); ch3_4->setWindowModality(Qt::ApplicationModal); ch3_4->show(); } void Seismic_monitor::copy_end_slot(){ Init(); } void Seismic_monitor::on_pushButton_copy_channel_clicked() { CopyChannel *copy_channel = new CopyChannel(slot_no); connect(copy_channel,SIGNAL(copy_end_sg()),this,SLOT(copy_end_slot())); copy_channel->setWindowModality(Qt::ApplicationModal); copy_channel->show(); } void Seismic_monitor::on_comboBox_function_2_currentIndexChanged(int index) { if(index == 1 && (ui->comboBox_chan_type_3->currentIndex() != 0 || ui->comboBox_chan_type_4->currentIndex() != 0)){ QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 必须为径向位移!"); ui->comboBox_function_2->setCurrentIndex(0); return; } if((index == 2||index == 3||index == 4) && (ui->comboBox_chan_type_3->currentIndex() != 3 || ui->comboBox_chan_type_4->currentIndex() != 3)){ QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 必须为轴向位移!"); ui->comboBox_function_2->setCurrentIndex(0); return; } if(index == 3){ ui->lineEdit_first_2->setVisible(true); ui->lineEdit_second_2->setVisible(true); ui->label_text_3->setVisible(true); ui->label_text_4->setVisible(true); ui->comboBox_dual_math_function_2->setVisible(false); ui->label_text_6->setVisible(false); }else if(index == 5){ ui->lineEdit_first_2->setVisible(false); ui->lineEdit_second_2->setVisible(false); ui->label_text_3->setVisible(false); ui->label_text_4->setVisible(false); ui->comboBox_dual_math_function_2->setVisible(true); ui->label_text_6->setVisible(true); }else{ ui->lineEdit_first_2->setVisible(false); ui->lineEdit_second_2->setVisible(false); ui->label_text_3->setVisible(false); ui->label_text_4->setVisible(false); ui->comboBox_dual_math_function_2->setVisible(false); ui->label_text_6->setVisible(false); } current_config_3_4 = index; if(index != 0){ on_comboBox_dual_math_function_2_currentIndexChanged(0); } } void Seismic_monitor::on_comboBox_function_1_currentIndexChanged(int index) { if(index == 1 && (ui->comboBox_chan_type_1->currentIndex() != 0 || ui->comboBox_chan_type_2->currentIndex() != 0)){ QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 必须为径向位移!"); ui->comboBox_function_1->setCurrentIndex(0); return; } if((index == 2||index == 3||index == 4) && (ui->comboBox_chan_type_3->currentIndex() != 3 || ui->comboBox_chan_type_4->currentIndex() != 3)){ QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 必须为轴向位移!"); ui->comboBox_function_1->setCurrentIndex(0); return; } if(index == 3){ ui->lineEdit_first_1->setVisible(true); ui->lineEdit_second_1->setVisible(true); ui->label_text_1->setVisible(true); ui->label_text_2->setVisible(true); ui->comboBox_dual_math_function->setVisible(false); ui->label_text_5->setVisible(false); }else if(index == 5){ ui->lineEdit_first_1->setVisible(false); ui->lineEdit_second_1->setVisible(false); ui->label_text_1->setVisible(false); ui->label_text_2->setVisible(false); ui->comboBox_dual_math_function->setVisible(true); ui->label_text_5->setVisible(true); }else{ ui->lineEdit_first_1->setVisible(false); ui->lineEdit_second_1->setVisible(false); ui->label_text_1->setVisible(false); ui->label_text_2->setVisible(false); ui->comboBox_dual_math_function->setVisible(false); ui->label_text_5->setVisible(false); } current_config_1_2 = index; if(index != 0){ on_comboBox_dual_math_function_currentIndexChanged(0); } } QString Seismic_monitor::GetUnit(int unit_num){ QString unit_str = ""; switch (unit_num) { case kUnit1:{ unit_str = "g"; break; } case kUnit2:{ unit_str = "m/s**2"; break; } case kUnit3:{ unit_str = "mm/s"; break; } case kUnit4:{ unit_str = "inch/s"; break; } case kUnit5:{ unit_str = "um"; break; } case kUnit6:{ unit_str = "mm"; break; } case kUnit7:{ unit_str = "mils"; break; } case kUnit8:{ unit_str = "inch/s**2"; break; } case kUnit9:{ unit_str = "mbar"; break; } case kUnit10:{ unit_str = "bar"; break; } } return unit_str; } int Seismic_monitor::SetUnit(QString unit_str){ int unit_num = -1; if (unit_str == "g") { unit_num = 0; } else if(unit_str == "m/s**2"){ unit_num = 1; }else if(unit_str == "mm/s"){ unit_num = 2; }else if(unit_str == "inch/s"){ unit_num = 3; }else if(unit_str == "um"){ unit_num = 4; }else if(unit_str == "mm"){ unit_num = 5; }else if(unit_str == "mils"){ unit_num = 6; }else if(unit_str == "inch/s**2"){ unit_num = 7; }else if(unit_str == "mbar"){ unit_num = 9; }else if(unit_str == "bar"){ unit_num = 10; } return unit_num; } void Seismic_monitor::on_comboBox_dual_math_function_currentIndexChanged(int index) { std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); std::shared_ptr variable_base1 = ptr->GetChannelPtr(1); std::shared_ptr variable_base2 = ptr->GetChannelPtr(2); qDebug() << "comboBox_function_1" << ui->comboBox_function_1->currentIndex(); if(ui->comboBox_function_1->currentIndex() == kDMF && (index == kRMSSum || index == kRMSSubtraction) && variable_base1->general.rectifier_function != 6 && variable_base2->general.rectifier_function != 6){ QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 整流器必须为RMS!"); ui->comboBox_function_1->setCurrentIndex(0); return; } if((index == kSUM || index == kSUBTRACTION || index == kXYMin || index == kXYMax) && variable_base1->general.rectifier_function != variable_base2->general.rectifier_function){ QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 整流器必须配置相同!"); ui->comboBox_function_1->setCurrentIndex(0); return; } } void Seismic_monitor::on_comboBox_dual_math_function_2_currentIndexChanged(int index) { std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); std::shared_ptr variable_base1 = ptr->GetChannelPtr(3); std::shared_ptr variable_base2 = ptr->GetChannelPtr(4); qDebug() << "comboBox_function_2" << ui->comboBox_function_2->currentIndex(); if(ui->comboBox_function_2->currentIndex() == kDMF && (index == kRMSSum || index == kRMSSubtraction) && variable_base1->general.rectifier_function != 6 && variable_base2->general.rectifier_function != 6){ QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 整流器必须为RMS!"); ui->comboBox_function_2->setCurrentIndex(0); return; } if((index == kSUM || index == kSUBTRACTION || index == kXYMin || index == kXYMax) && variable_base1->general.rectifier_function != variable_base2->general.rectifier_function){ QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 整流器必须配置相同!"); ui->comboBox_function_2->setCurrentIndex(0); return; } }