add copy channel config
This commit is contained in:
parent
226f3acc24
commit
8d66507e83
@ -1,11 +1,27 @@
|
|||||||
#include "copy_channel.h"
|
#include "copy_channel.h"
|
||||||
#include "ui_copy_channel.h"
|
#include "ui_copy_channel.h"
|
||||||
|
#include "data_config.h"
|
||||||
|
#include "config_mgr.h"
|
||||||
|
#include "vibrationdata.h"
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
CopyChannel::CopyChannel(QWidget *parent) :
|
CopyChannel::CopyChannel(int slot_no_,QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::CopyChannel)
|
ui(new Ui::CopyChannel)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
slot_no = slot_no_;
|
||||||
|
radio_btn.reserve(4);
|
||||||
|
check_ch.reserve(4);
|
||||||
|
radio_btn.push_back(ui->radioButton_ch1);
|
||||||
|
radio_btn.push_back(ui->radioButton_ch2);
|
||||||
|
radio_btn.push_back(ui->radioButton_ch3);
|
||||||
|
radio_btn.push_back(ui->radioButton_ch4);
|
||||||
|
check_ch.push_back(ui->checkBox_ch1);
|
||||||
|
check_ch.push_back(ui->checkBox_ch2);
|
||||||
|
check_ch.push_back(ui->checkBox_ch3);
|
||||||
|
check_ch.push_back(ui->checkBox_ch4);
|
||||||
|
ui->checkBox_ch1->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyChannel::~CopyChannel()
|
CopyChannel::~CopyChannel()
|
||||||
@ -61,3 +77,67 @@ void CopyChannel::on_radioButton_ch4_clicked(bool checked)
|
|||||||
ui->checkBox_ch1->setEnabled(true);
|
ui->checkBox_ch1->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CopyChannel::on_pushButton_cancel_clicked()
|
||||||
|
{
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CopyChannel::on_pushButton_confirm_clicked()
|
||||||
|
{
|
||||||
|
int var = 0;
|
||||||
|
for( ; var < 4; var ++){
|
||||||
|
if(radio_btn[var]->isChecked())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||||
|
if (base_ptr == nullptr) {
|
||||||
|
qDebug() << "base_ptr";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
if(i != var && check_ch[i]->isChecked()){
|
||||||
|
QString point_name = vib_data->base_config_[i].point_name;
|
||||||
|
vib_data->base_config_[i] = vib_data->base_config_[var];
|
||||||
|
vib_data->base_config_[i].point_name = point_name;
|
||||||
|
vib_data->dc_output[i] = vib_data->dc_output[var];
|
||||||
|
auto variable_base_old = vib_data->GetChannelPtr(var + 1);
|
||||||
|
if(vib_data->base_config_[var].channel_type == kVibRadial){
|
||||||
|
std::shared_ptr<RadialVariable> variable = std::dynamic_pointer_cast<RadialVariable>(variable_base_old);
|
||||||
|
std::shared_ptr<RadialVariable> variable_new = std::make_shared<RadialVariable>();
|
||||||
|
*variable_new = *variable;
|
||||||
|
variable_new->id_ = i + 1;
|
||||||
|
vib_data->RemoveChannel(i + 1);
|
||||||
|
vib_data->InsertChannelPtr(variable_new);
|
||||||
|
}else if(vib_data->base_config_[var].channel_type == kVibAcc ||
|
||||||
|
vib_data->base_config_[var].channel_type == kVibVelocity){
|
||||||
|
std::shared_ptr<AccVelVariable> variable = std::dynamic_pointer_cast<AccVelVariable>(variable_base_old);
|
||||||
|
std::shared_ptr<AccVelVariable> variable_new = std::make_shared<AccVelVariable>();
|
||||||
|
*variable_new = *variable;
|
||||||
|
variable_new->id_ = i + 1;
|
||||||
|
vib_data->RemoveChannel(i + 1);
|
||||||
|
vib_data->InsertChannelPtr(variable_new);
|
||||||
|
}else if(vib_data->base_config_[var].channel_type == kVibThrust){
|
||||||
|
std::shared_ptr<ThrustVariable> variable = std::dynamic_pointer_cast<ThrustVariable>(variable_base_old);
|
||||||
|
std::shared_ptr<ThrustVariable> variable_new = std::make_shared<ThrustVariable>();
|
||||||
|
*variable_new = *variable;
|
||||||
|
variable_new->id_ = i + 1;
|
||||||
|
vib_data->RemoveChannel(i + 1);
|
||||||
|
vib_data->InsertChannelPtr(variable_new);
|
||||||
|
}else if(vib_data->base_config_[var].channel_type == kVibPressurePulsation){
|
||||||
|
std::shared_ptr<PressurePulsationVariable> variable = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base_old);
|
||||||
|
std::shared_ptr<PressurePulsationVariable> variable_new = std::make_shared<PressurePulsationVariable>();
|
||||||
|
*variable_new = *variable;
|
||||||
|
variable_new->id_ = i + 1;
|
||||||
|
vib_data->RemoveChannel(i + 1);
|
||||||
|
vib_data->InsertChannelPtr(variable_new);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit copy_end_sg();
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,8 @@
|
|||||||
#define COPY_CHANNEL_H
|
#define COPY_CHANNEL_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QRadioButton>
|
||||||
|
#include <QCheckBox>
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CopyChannel;
|
class CopyChannel;
|
||||||
}
|
}
|
||||||
@ -12,8 +13,9 @@ class CopyChannel : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CopyChannel(QWidget *parent = nullptr);
|
explicit CopyChannel(int slot_no_,QWidget *parent = nullptr);
|
||||||
~CopyChannel();
|
~CopyChannel();
|
||||||
|
int slot_no;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_radioButton_ch1_clicked(bool checked);
|
void on_radioButton_ch1_clicked(bool checked);
|
||||||
@ -24,8 +26,15 @@ private slots:
|
|||||||
|
|
||||||
void on_radioButton_ch4_clicked(bool checked);
|
void on_radioButton_ch4_clicked(bool checked);
|
||||||
|
|
||||||
|
void on_pushButton_cancel_clicked();
|
||||||
|
|
||||||
|
void on_pushButton_confirm_clicked();
|
||||||
|
signals:
|
||||||
|
void copy_end_sg();
|
||||||
private:
|
private:
|
||||||
Ui::CopyChannel *ui;
|
Ui::CopyChannel *ui;
|
||||||
|
QList<QRadioButton*> radio_btn;
|
||||||
|
QList<QCheckBox*> check_ch;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COPY_CHANNEL_H
|
#endif // COPY_CHANNEL_H
|
||||||
|
|||||||
@ -62,6 +62,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>通道1</string>
|
<string>通道1</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<attribute name="buttonGroup">
|
<attribute name="buttonGroup">
|
||||||
<string notr="true">buttonGroup</string>
|
<string notr="true">buttonGroup</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
@ -133,6 +136,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>通道1</string>
|
<string>通道1</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QCheckBox" name="checkBox_ch2">
|
<widget class="QCheckBox" name="checkBox_ch2">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
|||||||
@ -56,6 +56,7 @@ void Radial::Init() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||||
|
|
||||||
if (variable_base == nullptr) {
|
if (variable_base == nullptr) {
|
||||||
qDebug() << "[Radial::Init] no channel ptr";
|
qDebug() << "[Radial::Init] no channel ptr";
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -43,12 +43,7 @@ Seismic_monitor::~Seismic_monitor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Seismic_monitor::Init() {
|
void Seismic_monitor::Init() {
|
||||||
// for (int var = 0; var < vec_transducer.size(); ++var) {
|
|
||||||
// ui->comboBox_transducer_name_1->addItem(vec_transducer[var].transducer_name);
|
|
||||||
// ui->comboBox_transducer_name_2->addItem(vec_transducer[var].transducer_name);
|
|
||||||
// ui->comboBox_transducer_name_3->addItem(vec_transducer[var].transducer_name);
|
|
||||||
// ui->comboBox_transducer_name_4->addItem(vec_transducer[var].transducer_name);
|
|
||||||
// }
|
|
||||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||||
if (base_ptr == nullptr) {
|
if (base_ptr == nullptr) {
|
||||||
qDebug() << "base_ptr";
|
qDebug() << "base_ptr";
|
||||||
@ -521,10 +516,13 @@ void Seismic_monitor::on_pushButton_config_3_4_clicked()
|
|||||||
ch3_4->show();
|
ch3_4->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Seismic_monitor::copy_end_slot(){
|
||||||
|
Init();
|
||||||
|
}
|
||||||
void Seismic_monitor::on_pushButton_copy_channel_clicked()
|
void Seismic_monitor::on_pushButton_copy_channel_clicked()
|
||||||
{
|
{
|
||||||
CopyChannel *copy_channel = new CopyChannel();
|
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->setWindowModality(Qt::ApplicationModal);
|
||||||
copy_channel->show();
|
copy_channel->show();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,6 +63,8 @@ class Seismic_monitor : public QWidget {
|
|||||||
|
|
||||||
void on_pushButton_copy_channel_clicked();
|
void on_pushButton_copy_channel_clicked();
|
||||||
|
|
||||||
|
void copy_end_slot();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Seismic_monitor *ui;
|
Ui::Seismic_monitor *ui;
|
||||||
void UpdateData(std::shared_ptr<VibrationData> vib_data);
|
void UpdateData(std::shared_ptr<VibrationData> vib_data);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include "vibrationdata.h"
|
#include "vibrationdata.h"
|
||||||
|
#include <QDebug>
|
||||||
VibrationData::VibrationData() {
|
VibrationData::VibrationData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11,7 +11,18 @@ std::shared_ptr<VariableBase> VibrationData::GetChannelPtr(int cid) {
|
|||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
void VibrationData::InsertChannelPtr(std::shared_ptr<RadialVariable> variable_base){
|
||||||
|
variables_.push_back(variable_base);
|
||||||
|
}
|
||||||
|
void VibrationData::InsertChannelPtr(std::shared_ptr<AccVelVariable> variable_base){
|
||||||
|
variables_.push_back(variable_base);
|
||||||
|
}
|
||||||
|
void VibrationData::InsertChannelPtr(std::shared_ptr<ThrustVariable> variable_base){
|
||||||
|
variables_.push_back(variable_base);
|
||||||
|
}
|
||||||
|
void VibrationData::InsertChannelPtr(std::shared_ptr<PressurePulsationVariable> variable_base){
|
||||||
|
variables_.push_back(variable_base);
|
||||||
|
}
|
||||||
void VibrationData::RemoveChannel(int cid) {
|
void VibrationData::RemoveChannel(int cid) {
|
||||||
std::vector<std::shared_ptr<VariableBase>> tmp;
|
std::vector<std::shared_ptr<VariableBase>> tmp;
|
||||||
for (auto &item : variables_) {
|
for (auto &item : variables_) {
|
||||||
|
|||||||
@ -10,6 +10,11 @@ class VibrationData : public CardBase {
|
|||||||
VibrationData();
|
VibrationData();
|
||||||
std::shared_ptr<VariableBase> GetChannelPtr(int cid);
|
std::shared_ptr<VariableBase> GetChannelPtr(int cid);
|
||||||
void RemoveChannel(int cid);
|
void RemoveChannel(int cid);
|
||||||
|
void InsertChannelPtr(std::shared_ptr<RadialVariable>);
|
||||||
|
void InsertChannelPtr(std::shared_ptr<AccVelVariable>);
|
||||||
|
void InsertChannelPtr(std::shared_ptr<ThrustVariable>);
|
||||||
|
void InsertChannelPtr(std::shared_ptr<PressurePulsationVariable>);
|
||||||
|
|
||||||
SeismicMonitor base_config_[CHANNEL_COUNT];
|
SeismicMonitor base_config_[CHANNEL_COUNT];
|
||||||
std::vector<std::shared_ptr<VariableBase>> variables_;
|
std::vector<std::shared_ptr<VariableBase>> variables_;
|
||||||
VibAlertDanger alert_danger[CHANNEL_COUNT];
|
VibAlertDanger alert_danger[CHANNEL_COUNT];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user