Compare commits
147 Commits
master
...
self_dev_s
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b17099174 | |||
| 13510306d8 | |||
| 033bb1c02d | |||
| 5c9a3f0bc5 | |||
| e43f61d648 | |||
| abb9b7ccff | |||
| f160454b82 | |||
| 76c8206037 | |||
| 1704ae9aa0 | |||
| 129d4bbc93 | |||
| 8102b9dee7 | |||
| be3489e20e | |||
| 3609ab9047 | |||
| 37ac87a797 | |||
| 0ec1b26709 | |||
| 2c6a047852 | |||
| 546ed2d0fa | |||
| 84dad3a3aa | |||
| 1c8bdeaaac | |||
| f7e5c65755 | |||
| a5a7eb8464 | |||
| 091d3c7be7 | |||
| ef103a92f3 | |||
| e6585ea213 | |||
| 0479251400 | |||
| a4a8007913 | |||
| 3bcd3c9c9b | |||
| 24f3956206 | |||
| 8417745a17 | |||
| 1de7d438ad | |||
| faffd3695f | |||
| 3dd43ccf32 | |||
| 2e87b56d44 | |||
| 0770af3c7b | |||
| f7554909f8 | |||
| ef1dfff301 | |||
| b62d3a4773 | |||
| 18741a9f22 | |||
| 8a16b60a09 | |||
| 0994b00441 | |||
| 8bc8a544cd | |||
| 66a38280b8 | |||
| 9328c2caad | |||
| 180f70218b | |||
| d64e70bf07 | |||
| 4f2985abc5 | |||
| 88c2a30e95 | |||
| 4086443af6 | |||
| ce6c066532 | |||
| b106a751db | |||
| b35e594834 | |||
| 110685ef56 | |||
| a264bffb15 | |||
| 108ac397b6 | |||
| dbed030a0c | |||
| 7e79055671 | |||
| 8d66507e83 | |||
| 226f3acc24 | |||
| 95156105a3 | |||
| f59b9dff3d | |||
| 97dbfa589e | |||
| 2ddec8de0d | |||
| 46390dc9df | |||
| 19eeb8246e | |||
| bdeba32f9d | |||
| 185c387749 | |||
| 3104162b2c | |||
| a9a951326e | |||
| 88cb93b261 | |||
| 810ba9626d | |||
| 4848649dea | |||
| 4f299f2fdd | |||
| f83cbfc753 | |||
| 6c908697bf | |||
| 71cc0c4f1a | |||
| 340f9316ee | |||
| 648b8b0f70 | |||
| 1f780ef25b | |||
| c96ed16d09 | |||
| fe33514c40 | |||
| 3af645f080 | |||
| 87549b312f | |||
| b1a776bfda | |||
| ec2d25398c | |||
| 27d45de8a1 | |||
| 16450402a1 | |||
| a1d2b53084 | |||
| 8e2df6d291 | |||
| 889803339e | |||
| 2f2ee5b6c5 | |||
| 0df5b3bf51 | |||
| 9ea836be8c | |||
| 6b8fa0685e | |||
| f7d5ba4bf9 | |||
| fe60964e28 | |||
| 7f4db7efdb | |||
| 1bd94f5f77 | |||
| 74784e2e40 | |||
| 020e7fb47e | |||
| ee2d142182 | |||
| 43a6bfff3c | |||
| e71d0abfe8 | |||
| ac2f1ee8ec | |||
| 166b62af1b | |||
| baf5ae0a37 | |||
| 55c9f8e435 | |||
| 46a0a87da9 | |||
| 2c42a9eaa7 | |||
| 0da25401ac | |||
| 9f3b468afc | |||
| c5a57c9678 | |||
| 16bad754f0 | |||
| 3ec608686f | |||
| 3461aa9e4a | |||
| 37cd43791e | |||
| 8f75f5672c | |||
| 4b28af5a4e | |||
| 64f60fe3af | |||
| ac94c60151 | |||
| 69eecc6824 | |||
| 0eb563da4e | |||
| c1f45d3524 | |||
| ae6c9fdd25 | |||
| fcae5b8236 | |||
| d167660911 | |||
| 64bd8799fb | |||
| b03cf0c257 | |||
| e952ec06a5 | |||
| 70d34a54a2 | |||
| 44c0daefe8 | |||
| 4c8d546c84 | |||
| 7575aa4aa9 | |||
| 4a0e1a44c5 | |||
| eaed2efaa5 | |||
| 576fe1ffd1 | |||
| 50901aefed | |||
| 653d994f9c | |||
| 6c6acfea62 | |||
| 3dd25ff15b | |||
| 385d30613c | |||
| 0c217eea58 | |||
| 306db57a47 | |||
| f7cf832d9a | |||
| e1541a5da5 | |||
| dedc7d3bfa | |||
| 28e8e6779c | |||
| 21ea1b3f8b |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
TSI_Config.pro.user
|
||||
build/
|
||||
|
||||
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"memory": "cpp"
|
||||
}
|
||||
}
|
||||
@ -14,6 +14,8 @@ MyTcpClient::MyTcpClient(QObject *parent) : QObject(parent), shouldReconnect(tru
|
||||
// 连接失败后,定时尝试重连
|
||||
connect(&reconnectTimer, &QTimer::timeout, this, &MyTcpClient::onReconnect);
|
||||
reconnectTimer.setInterval(5000); // 5秒重连一次
|
||||
memset(header,0,sizeof(header));
|
||||
int packge_len = 0;
|
||||
}
|
||||
|
||||
MyTcpClient::~MyTcpClient() {
|
||||
@ -30,18 +32,18 @@ MyTcpClient* MyTcpClient::instance()
|
||||
}
|
||||
return m_instance;
|
||||
}
|
||||
void MyTcpClient::connectToServer(const QString &host, quint16 port) {
|
||||
int MyTcpClient::connectToServer(const QString &host, quint16 port) {
|
||||
serverHost = host;
|
||||
serverPort = port;
|
||||
if (socket->state() == QAbstractSocket::ConnectedState) {
|
||||
qDebug() << "Already connected!";
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
qDebug() << "Connecting to" << host << ":" << port;
|
||||
socket->connectToHost(host, port);
|
||||
if (!socket->waitForConnected()) {
|
||||
qDebug() << "Connection failed!";
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +54,7 @@ int MyTcpClient::sendData(char*data,qint64 len) {
|
||||
return bytesWritten;
|
||||
}
|
||||
void MyTcpClient::waitForRead() {
|
||||
socket->waitForReadyRead();
|
||||
socket->waitForReadyRead(3000);
|
||||
}
|
||||
void MyTcpClient::disconnectFromServer() {
|
||||
shouldReconnect = false; // 停止自动重连
|
||||
@ -70,8 +72,59 @@ void MyTcpClient::onConnected() {
|
||||
}
|
||||
|
||||
void MyTcpClient::onReadyRead() {
|
||||
QByteArray data = socket->readAll();
|
||||
emit dataReceived(data);
|
||||
m_buffer.append(socket->readAll());
|
||||
|
||||
while (true) {
|
||||
if (m_buffer.size() < sizeof(BaseHeader)) return;
|
||||
|
||||
const BaseHeader *base = reinterpret_cast<const BaseHeader *>(m_buffer.constData());
|
||||
if (!(base->head[0] == 0xAA && base->head[1] == 0x55 && base->head[2] == 0xAA)) {
|
||||
m_buffer.remove(0, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t cmd = base->cmd;
|
||||
|
||||
if (cmd == kDownloadConfigFile) {
|
||||
if (m_buffer.size() < sizeof(BaseHeader) + sizeof(LargeHeaderExtra))
|
||||
return; // 等待更多数据
|
||||
|
||||
const LargeHeaderExtra *extra = reinterpret_cast<const LargeHeaderExtra *>(
|
||||
m_buffer.constData() + sizeof(BaseHeader));
|
||||
int payloadLen = extra->len;
|
||||
if (payloadLen <= 0 || payloadLen > 10 * 1024 * 1024) {
|
||||
qWarning() << "Detected abnormal payload length:" << payloadLen;
|
||||
m_buffer.remove(0, sizeof(BaseHeader)); // 丢弃当前包头
|
||||
continue;
|
||||
}
|
||||
int totalLen = sizeof(BaseHeader) + sizeof(LargeHeaderExtra) + extra->len;
|
||||
if (m_buffer.size() < totalLen)
|
||||
return; // 等待完整数据到达
|
||||
emit dataReceived( m_buffer);
|
||||
m_buffer.remove(0, totalLen);
|
||||
}else if(cmd == kGetLogInfo){
|
||||
if (m_buffer.size() < sizeof(GetSubCardLogRsp))
|
||||
return; // 等待更多数据
|
||||
|
||||
const GetSubCardLogRsp *extra = reinterpret_cast<const GetSubCardLogRsp *>(m_buffer.constData());
|
||||
int payloadLen = extra->len;
|
||||
if (payloadLen <= 0 || payloadLen > 10 * 1024 * 1024) {
|
||||
qWarning() << "Detected abnormal payload length:" << payloadLen;
|
||||
m_buffer.remove(0, sizeof(BaseHeader)); // 丢弃当前包头
|
||||
continue;
|
||||
}
|
||||
int totalLen = sizeof(GetSubCardLogRsp) + extra->len;
|
||||
if (m_buffer.size() < totalLen)
|
||||
return; // 等待完整数据到达
|
||||
emit dataReceived( m_buffer);
|
||||
m_buffer.remove(0, totalLen);
|
||||
} else {
|
||||
QByteArray fullData = m_buffer;
|
||||
emit dataReceived(fullData);
|
||||
m_buffer.clear();
|
||||
return; // 等待下一批数据
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MyTcpClient::onDisconnected() {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include <QTcpSocket>
|
||||
#include <QTimer>
|
||||
#include <QObject>
|
||||
#include "data_config.h"
|
||||
|
||||
class MyTcpClient : public QObject {
|
||||
Q_OBJECT
|
||||
@ -13,7 +14,7 @@ public:
|
||||
explicit MyTcpClient(QObject *parent = nullptr);
|
||||
~MyTcpClient();
|
||||
|
||||
void connectToServer(const QString &host, quint16 port);
|
||||
int connectToServer(const QString &host, quint16 port);
|
||||
int sendData(char* data,qint64 len);
|
||||
void waitForRead();
|
||||
void disconnectFromServer();
|
||||
@ -39,6 +40,12 @@ private:
|
||||
quint16 serverPort;
|
||||
bool shouldReconnect; // 标记是否需要重连
|
||||
static MyTcpClient* m_instance;
|
||||
|
||||
QByteArray m_buffer; // 存储当前正在接收的数据
|
||||
bool m_waitingForHeader = true; // 是否在等待头部
|
||||
|
||||
uint8_t header[4];
|
||||
int packge_len ;
|
||||
};
|
||||
|
||||
#endif // MYTCPCLIENT_H
|
||||
|
||||
@ -10,45 +10,121 @@ CONFIG += c++11
|
||||
|
||||
SOURCES += \
|
||||
MyTcpClient.cpp \
|
||||
TableHeaderView.cpp \
|
||||
acceleration.cpp \
|
||||
cardbase.cpp \
|
||||
channel_1_2.cpp \
|
||||
channel_3_4.cpp \
|
||||
channel_crc.cpp \
|
||||
common.cpp \
|
||||
config_mgr.cpp \
|
||||
connect.cpp \
|
||||
copy_channel.cpp \
|
||||
dc_output_channel.cpp \
|
||||
dc_outputs.cpp \
|
||||
ethconfig.cpp \
|
||||
headerView.cpp \
|
||||
high_speed_current.cpp \
|
||||
high_speed_current_data.cpp \
|
||||
keyphase.cpp \
|
||||
keyphase_data.cpp \
|
||||
macconfig.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
mqtt_config.cpp \
|
||||
pointname.cpp \
|
||||
pointname_relay.cpp \
|
||||
pressure_pulsation.cpp \
|
||||
radial_vibration.cpp \
|
||||
rangeslider.cpp \
|
||||
relaysetting.cpp \
|
||||
seismic_monitor.cpp \
|
||||
setpoint.cpp \
|
||||
setpoint_tachometer.cpp \
|
||||
singlerelay.cpp \
|
||||
singlerelay_data.cpp \
|
||||
singlerelay_nok.cpp \
|
||||
tachometer.cpp \
|
||||
velocity.cpp
|
||||
tachometer_data.cpp \
|
||||
tmrrelayassociation.cpp \
|
||||
tmrrelayassociation_data.cpp \
|
||||
trust.cpp \
|
||||
velocity.cpp \
|
||||
vibrationdata.cpp
|
||||
|
||||
HEADERS += \
|
||||
MyTcpClient.h \
|
||||
TableHeaderView.h \
|
||||
acceleration.h \
|
||||
acceleration_ds.h \
|
||||
cardbase.h \
|
||||
channel_1_2.h \
|
||||
channel_3_4.h \
|
||||
channel_crc.h \
|
||||
common.h \
|
||||
config_mgr.h \
|
||||
connect.h \
|
||||
copy_channel.h \
|
||||
data_config.h \
|
||||
dc_output_channel.h \
|
||||
dc_outputs.h \
|
||||
displacement_ds.h \
|
||||
ethconfig.h \
|
||||
headerView.h \
|
||||
high_speed_current.h \
|
||||
high_speed_current_data.h \
|
||||
keyphase.h \
|
||||
keyphase_data.h \
|
||||
macconfig.h \
|
||||
mainwindow.h \
|
||||
mqtt_config.h \
|
||||
pointname.h \
|
||||
pointname_relay.h \
|
||||
pressure_pulsation.h \
|
||||
radial_vibration.h \
|
||||
rangeslider.h \
|
||||
relaysetting.h \
|
||||
seismic_monitor.h \
|
||||
setpoint.h \
|
||||
setpoint_tachometer.h \
|
||||
singlerelay.h \
|
||||
singlerelay_data.h \
|
||||
singlerelay_nok.h \
|
||||
tachometer.h \
|
||||
velocity.h
|
||||
tachometer_data.h \
|
||||
tmrrelayassociation.h \
|
||||
tmrrelayassociation_data.h \
|
||||
trust.h \
|
||||
trust_ds.h \
|
||||
velocity.h \
|
||||
velocity_ds.h \
|
||||
vibrationdata.h
|
||||
|
||||
FORMS += \
|
||||
acceleration.ui \
|
||||
channel_1_2.ui \
|
||||
channel_3_4.ui \
|
||||
channel_crc.ui \
|
||||
connect.ui \
|
||||
copy_channel.ui \
|
||||
dc_output_channel.ui \
|
||||
dc_outputs.ui \
|
||||
ethconfig.ui \
|
||||
high_speed_current.ui \
|
||||
keyphase.ui \
|
||||
macconfig.ui \
|
||||
mainwindow.ui \
|
||||
mqtt_config.ui \
|
||||
pointname.ui \
|
||||
pointname_relay.ui \
|
||||
pressure_pulsation.ui \
|
||||
radial_vibration.ui \
|
||||
relaysetting.ui \
|
||||
seismic_monitor.ui \
|
||||
setpoint.ui \
|
||||
setpoint_tachometer.ui \
|
||||
singlerelay.ui \
|
||||
singlerelay_nok.ui \
|
||||
tachometer.ui \
|
||||
tmrrelayassociation.ui \
|
||||
trust.ui \
|
||||
velocity.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
|
||||
206
TableHeaderView.cpp
Normal file
206
TableHeaderView.cpp
Normal file
@ -0,0 +1,206 @@
|
||||
#include "TableHeaderView.h"
|
||||
#include <QCheckBox>
|
||||
#include <QApplication>
|
||||
#include <QMouseEvent>
|
||||
#include <qmessagebox.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma execution_character_set("utf-8")
|
||||
#endif
|
||||
|
||||
#define CHECK_BOX_COLUMN 0
|
||||
TableHeaderView::TableHeaderView(Qt::Orientation orientation, QWidget *parent)
|
||||
: QHeaderView(orientation, parent),
|
||||
m_bPressed(false),
|
||||
m_bChecked(false),
|
||||
m_bTristate(false),
|
||||
m_bNoChange(false),
|
||||
m_bMoving(false)
|
||||
|
||||
{
|
||||
setSectionsClickable(true); // 响应鼠标
|
||||
}
|
||||
|
||||
TableHeaderView::~TableHeaderView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// 槽函数,用于更新复选框状态
|
||||
void TableHeaderView::onStateChanged(int state)
|
||||
{
|
||||
if (state == Qt::PartiallyChecked) {
|
||||
m_bTristate = true;
|
||||
m_bNoChange = true;
|
||||
}
|
||||
else {
|
||||
m_bNoChange = false;
|
||||
}
|
||||
|
||||
m_bChecked = (state != Qt::Unchecked);
|
||||
update();
|
||||
}
|
||||
|
||||
// 绘制复选框
|
||||
void TableHeaderView::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const
|
||||
{
|
||||
painter->save();
|
||||
QHeaderView::paintSection(painter, rect, logicalIndex);
|
||||
painter->restore();
|
||||
|
||||
if (logicalIndex == CHECK_BOX_COLUMN )
|
||||
{
|
||||
QStyleOptionButton option;
|
||||
option.initFrom(this);
|
||||
|
||||
if (m_bChecked)
|
||||
option.state |= QStyle::State_Sunken;
|
||||
|
||||
if (m_bTristate && m_bNoChange)
|
||||
option.state |= QStyle::State_NoChange;
|
||||
else
|
||||
option.state |= m_bChecked ? QStyle::State_On : QStyle::State_Off;
|
||||
if (testAttribute(Qt::WA_Hover) && underMouse()) {
|
||||
if (m_bMoving)
|
||||
option.state |= QStyle::State_MouseOver;
|
||||
else
|
||||
option.state &= ~QStyle::State_MouseOver;
|
||||
}
|
||||
|
||||
QCheckBox checkBox;
|
||||
option.iconSize = QSize(20, 20);
|
||||
option.rect = rect;
|
||||
style()->drawPrimitive(QStyle::PE_IndicatorCheckBox, &option, painter, &checkBox);
|
||||
}
|
||||
}
|
||||
|
||||
// 鼠标按下表头
|
||||
void TableHeaderView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
int nColumn = logicalIndexAt(event->pos());
|
||||
if ((event->buttons() & Qt::LeftButton) && (nColumn == CHECK_BOX_COLUMN))
|
||||
{
|
||||
m_bPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
QHeaderView::mousePressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
// 鼠标从表头释放,发送信号,更新model数据
|
||||
void TableHeaderView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
|
||||
if (m_bPressed)
|
||||
{
|
||||
if (m_bTristate && m_bNoChange)
|
||||
{
|
||||
m_bChecked = true;
|
||||
m_bNoChange = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bChecked = !m_bChecked;
|
||||
}
|
||||
|
||||
update();
|
||||
|
||||
Qt::CheckState state = m_bChecked ? Qt::Checked : Qt::Unchecked;
|
||||
|
||||
emit stateChanged(state);
|
||||
|
||||
updateSection(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
QHeaderView::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
m_bPressed = false;
|
||||
}
|
||||
|
||||
// 鼠标滑过、离开,更新复选框状态
|
||||
bool TableHeaderView::event(QEvent *event)
|
||||
{
|
||||
updateSection(0);
|
||||
if (event->type() == QEvent::Enter || event->type() == QEvent::Leave)
|
||||
{
|
||||
QMouseEvent *pEvent = static_cast<QMouseEvent *>(event);
|
||||
int nColumn = logicalIndexAt(pEvent->x());
|
||||
if (nColumn == CHECK_BOX_COLUMN)
|
||||
{
|
||||
m_bMoving = (event->type() == QEvent::Enter);
|
||||
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QHeaderView::event(event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
CheckBoxDelegate::CheckBoxDelegate(QObject *parent) :QStyledItemDelegate(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CheckBoxDelegate::~CheckBoxDelegate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// 绘制复选框
|
||||
void CheckBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QStyleOptionViewItem viewOption(option);
|
||||
initStyleOption(&viewOption, index);
|
||||
if (option.state.testFlag(QStyle::State_HasFocus))
|
||||
viewOption.state = viewOption.state ^ QStyle::State_HasFocus;
|
||||
|
||||
QStyledItemDelegate::paint(painter, viewOption, index);
|
||||
|
||||
if (index.column() == CHECK_BOX_COLUMN )
|
||||
{
|
||||
bool data = index.model()->data(index, Qt::UserRole).toBool();
|
||||
|
||||
QStyleOptionButton checkBoxStyle;
|
||||
checkBoxStyle.state = data ? QStyle::State_On : QStyle::State_Off;
|
||||
checkBoxStyle.state |= QStyle::State_Enabled;
|
||||
checkBoxStyle.iconSize = QSize(20, 20);
|
||||
checkBoxStyle.rect = option.rect;
|
||||
|
||||
QCheckBox checkBox;
|
||||
checkBoxStyle.iconSize = QSize(20, 20);
|
||||
checkBoxStyle.rect = option.rect;
|
||||
QApplication::style()->drawPrimitive(QStyle::PE_IndicatorCheckBox, &checkBoxStyle, painter, &checkBox);
|
||||
|
||||
checkBox.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
// 响应鼠标事件,更新数据
|
||||
bool CheckBoxDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
|
||||
{
|
||||
QRect decorationRect = option.rect;
|
||||
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (event->type() == QEvent::MouseButtonPress && decorationRect.contains(mouseEvent->pos()))
|
||||
{
|
||||
if (index.column() == CHECK_BOX_COLUMN )
|
||||
{
|
||||
|
||||
bool data = model->data(index, Qt::UserRole).toBool();
|
||||
model->setData(index, !data, Qt::UserRole);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return QStyledItemDelegate::editorEvent(event, model, option, index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
57
TableHeaderView.h
Normal file
57
TableHeaderView.h
Normal file
@ -0,0 +1,57 @@
|
||||
#ifndef CCHECKBOXMODEL_H
|
||||
#define CCHECKBOXMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QEvent>
|
||||
#include <QHeaderView>
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
class TableHeaderView :public QHeaderView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TableHeaderView(Qt::Orientation orientation, QWidget *parent);
|
||||
~TableHeaderView();
|
||||
|
||||
protected:
|
||||
void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const;
|
||||
bool event(QEvent *e) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
||||
|
||||
public slots:
|
||||
void onStateChanged(int state);
|
||||
|
||||
signals:
|
||||
void stateChanged(int state);
|
||||
|
||||
private:
|
||||
bool m_bPressed;
|
||||
bool m_bChecked;
|
||||
bool m_bTristate;
|
||||
bool m_bNoChange;
|
||||
bool m_bMoving;
|
||||
};
|
||||
|
||||
|
||||
class CheckBoxDelegate :public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CheckBoxDelegate(QObject *parent);
|
||||
~CheckBoxDelegate();
|
||||
// painting
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
|
||||
protected:
|
||||
bool editorEvent(QEvent *event, QAbstractItemModel *model,
|
||||
const QStyleOptionViewItem &option, const QModelIndex &index);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // TABLE_MODEL_H
|
||||
|
||||
|
||||
536
acceleration.cpp
536
acceleration.cpp
@ -5,11 +5,14 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "config_mgr.h"
|
||||
|
||||
Acceleration::Acceleration(int slot_no_,int channel_,bool active,QWidget *parent) :
|
||||
Acceleration::Acceleration(int slot_no_, int channel_, bool active, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::Acceleration)
|
||||
{
|
||||
ui(new Ui::Acceleration) {
|
||||
ui->setupUi(this);
|
||||
slot_no = slot_no_;
|
||||
channel = channel_;
|
||||
@ -17,264 +20,319 @@ Acceleration::Acceleration(int slot_no_,int channel_,bool active,QWidget *parent
|
||||
QString slot = QString("%1").arg(slot_no);
|
||||
ui->label_channel->setText(chan);
|
||||
ui->label_slot->setText(slot);
|
||||
if(active)
|
||||
if (active) {
|
||||
ui->label_active->setText("(启用)");
|
||||
else
|
||||
} else {
|
||||
ui->label_active->setText("(停用)");
|
||||
QString filePath_filter = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\filter_%2.json").arg(slot_no).arg(channel);
|
||||
readJsonFile(filePath_filter);
|
||||
QString filePath_variables = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\acceleration_variables_%2.json").arg(slot_no).arg(channel);
|
||||
readJsonFile(filePath_variables);
|
||||
}
|
||||
ui->comboBox_fre_domain_resolution->setCurrentIndex(2);
|
||||
ui->comboBox_lines_number->setCurrentIndex(2);
|
||||
Init();
|
||||
}
|
||||
|
||||
Acceleration::~Acceleration()
|
||||
{
|
||||
Acceleration::~Acceleration() {
|
||||
delete ui;
|
||||
}
|
||||
void Acceleration::readJsonFile(const QString &filePath)
|
||||
{
|
||||
// 创建文件对象
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qDebug() << "Cannot open file for reading:" << filePath;
|
||||
return;
|
||||
}
|
||||
QString content = file.readAll();
|
||||
file.close();
|
||||
QByteArray jsonData = content.toUtf8();
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
|
||||
if (jsonDoc.isNull()) {
|
||||
qDebug() << "Cannot parse JSON document";
|
||||
return;
|
||||
}
|
||||
if (!jsonDoc.isObject() && !jsonDoc.isArray()) {
|
||||
qDebug() << "JSON document is not an object or an array";
|
||||
return;
|
||||
}
|
||||
QJsonObject json_obj = jsonDoc.object();
|
||||
if(filePath.contains("filter_")){
|
||||
QJsonArray filter_array = json_obj["filter"].toArray();
|
||||
for(int i = 0; i < filter_array.size(); i++){
|
||||
QJsonObject temp_obj = filter_array[i].toObject();
|
||||
filter[i].type = temp_obj["type"].toString();
|
||||
filter[i].low = temp_obj["low"].toInt();
|
||||
filter[i].high = temp_obj["high"].toInt();
|
||||
filter[i].checked = temp_obj["checked"].toBool();
|
||||
}
|
||||
}else if(filePath.contains("acceleration_variables_")){
|
||||
|
||||
QJsonArray variables_array = json_obj["variables"].toArray();
|
||||
for(int i = 0; i < variables_array.size(); i++){
|
||||
QJsonObject temp_obj = variables_array[i].toObject();
|
||||
variables[i].type = temp_obj["type"].toString();
|
||||
if(variables[i].type == "direct"){
|
||||
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
|
||||
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
}else if(variables[i].type == "bias_volt"){
|
||||
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
variables[i].bias_voltage = temp_obj["bias_voltage"].toInt();
|
||||
}else if(variables[i].type == "1x_ampl"){
|
||||
variables[i].checked = temp_obj["checked"].toBool();
|
||||
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
|
||||
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
variables[i].phase_lag = temp_obj["phase_lag"].toDouble();
|
||||
}else if(variables[i].type == "2x_ampl"){
|
||||
variables[i].checked = temp_obj["checked"].toBool();
|
||||
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
|
||||
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
variables[i].phase_lag = temp_obj["phase_lag"].toDouble();
|
||||
}
|
||||
}
|
||||
QJsonObject delay_obj = json_obj["delay"].toObject();
|
||||
delay.alert = delay_obj["alert"].toInt();
|
||||
delay.danger = delay_obj["danger"].toDouble();
|
||||
delay.active_100ms = delay_obj["100ms"].toBool();
|
||||
alert_variables.rms_active = json_obj["rms_active"].toBool();
|
||||
alert_variables.integrate_active = json_obj["integrate_active"].toBool();
|
||||
alert_variables.alert_latching = json_obj["alert_latching"].toBool();
|
||||
alert_variables.danger_latching = json_obj["danger_latching"].toBool();
|
||||
alert_variables.timed_ok = json_obj["timed_ok"].toBool();
|
||||
alert_variables.recorder_output = json_obj["recorder_output"].toString();
|
||||
alert_variables.two_ma_clamp = json_obj["two_ma_clamp"].toBool();
|
||||
alert_variables.trip_multiply = json_obj["trip_multiply"].toDouble();
|
||||
alert_variables.comparision = json_obj["comparision"].toString();
|
||||
alert_variables.comparision_percentage = json_obj["comparision_percentage"].toInt();
|
||||
void Acceleration::Init() {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[Acceleration::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
}
|
||||
void Acceleration::Init()
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if(filter[i].checked){
|
||||
if(filter[i].type == "band_pass"){
|
||||
ui->checkBox_band_pass->setChecked(filter[i].checked);
|
||||
ui->spinBox_band_pass_low->setValue(filter[i].low);
|
||||
ui->spinBox_band_pass_high->setValue(filter[i].high);
|
||||
}else if(filter[i].type == "low_pass"){
|
||||
ui->checkBox_low_pass->setChecked(filter[i].checked);
|
||||
ui->spinBox_low_pass_low->setValue(filter[i].low);
|
||||
ui->spinBox_low_pass_high->setValue(filter[i].high);
|
||||
}else if(filter[i].type == "high_pass"){
|
||||
ui->checkBox_high_pass->setChecked(filter[i].checked);
|
||||
ui->spinBox_high_pass_low->setValue(filter[i].low);
|
||||
ui->spinBox_high_pass_high->setValue(filter[i].high);
|
||||
}
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if (ptr->base_config_[channel - 1].channel_type != kVibAcc) {
|
||||
qDebug() << "[Acceleration::Init] channel type changes";
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if(variables[i].type == "direct"){
|
||||
ui->comboBox_direct_value_range->setCurrentText(variables[i].full_sacle_range);
|
||||
ui->doubleSpinBox_direct_clamp->setValue(variables[i].clamp_value);
|
||||
}else if(variables[i].type == "bias_volt"){
|
||||
ui->label_bias_voltage->setText(QString::number(variables[i].bias_voltage));
|
||||
ui->doubleSpinBox_bias_volt_clamp->setValue(variables[i].clamp_value);
|
||||
}else if(variables[i].type == "1x_ampl"){
|
||||
ui->comboBox_1x_value_range->setCurrentText(variables[i].full_sacle_range);
|
||||
ui->doubleSpinBox_1x_ampl_clamp->setValue(variables[i].clamp_value);
|
||||
ui->doubleSpinBox_1x_phase_lag_clamp->setValue(variables[i].clamp_value);
|
||||
}else if(variables[i].type == "2x_ampl"){
|
||||
ui->comboBox_2x_value_range->setCurrentText(variables[i].full_sacle_range);
|
||||
ui->doubleSpinBox_2x_ampl_clamp->setValue(variables[i].clamp_value);
|
||||
ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variables[i].clamp_value);
|
||||
}
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "[Acceleration::Init] no channel ptr";
|
||||
return;
|
||||
}
|
||||
ui->spinBox_alert->setValue(delay.alert);
|
||||
ui->doubleSpinBox_danger->setValue(delay.danger);
|
||||
ui->checkBox_100ms->setChecked(delay.active_100ms);
|
||||
ui->checkBox_rms->setChecked(alert_variables.rms_active);
|
||||
ui->checkBox_integrate->setChecked(alert_variables.integrate_active);
|
||||
ui->checkBox_alert_latching->setChecked(alert_variables.alert_latching);
|
||||
ui->checkBox_danger_latching->setChecked(alert_variables.danger_latching);
|
||||
ui->checkBox_timed_ok->setChecked(alert_variables.timed_ok);
|
||||
ui->comboBox_recorder_output->setCurrentText(alert_variables.recorder_output);
|
||||
ui->checkBox_two_ma_clamp->setChecked(alert_variables.two_ma_clamp);
|
||||
ui->doubleSpinBox_trip_multiply->setValue(alert_variables.trip_multiply);
|
||||
ui->comboBox_comparision->setCurrentText(alert_variables.comparision);
|
||||
ui->spinBox_comparision_percentage->setValue(alert_variables.comparision_percentage);
|
||||
std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||
ui->checkBox_low_pass->setChecked(variable_ptr->filter_[0].checked);
|
||||
ui->spinBox_low_pass_low->setValue(variable_ptr->filter_[0].low);
|
||||
ui->spinBox_low_pass_high->setValue(variable_ptr->filter_[0].high);
|
||||
ui->checkBox_high_pass->setChecked(variable_ptr->filter_[1].checked);
|
||||
ui->spinBox_high_pass_low->setValue(variable_ptr->filter_[1].low);
|
||||
ui->spinBox_high_pass_high->setValue(variable_ptr->filter_[1].high);
|
||||
ui->checkBox_band_pass->setChecked(variable_ptr->filter_[2].checked);
|
||||
ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low);
|
||||
ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high);
|
||||
|
||||
// processed output
|
||||
// -general
|
||||
if(variable_ptr->general.output_used)
|
||||
ui->comboBox_output_used->setCurrentIndex(0);
|
||||
else
|
||||
ui->comboBox_output_used->setCurrentIndex(1);
|
||||
ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->general.engineering_unit);
|
||||
ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level));
|
||||
ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis));
|
||||
ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.delay));
|
||||
ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable);
|
||||
ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch);
|
||||
|
||||
ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level));
|
||||
ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.hysteresis));
|
||||
ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.delay));
|
||||
ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable);
|
||||
ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch);
|
||||
|
||||
ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level));
|
||||
ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.hysteresis));
|
||||
ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.delay));
|
||||
ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable);
|
||||
ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch);
|
||||
|
||||
ui->lineEdit_alert_low_level->setText(QString::number(variable_ptr->alert_low.level));
|
||||
ui->lineEdit_alert_low_hysteresis->setText(QString::number(variable_ptr->alert_low.hysteresis));
|
||||
ui->lineEdit_alert_low_delay->setText(QString::number(variable_ptr->alert_low.delay));
|
||||
ui->checkBox_alert_low_enable->setChecked(variable_ptr->alert_low.enable);
|
||||
ui->checkBox_alert_low_latch->setChecked(variable_ptr->alert_low.latch);
|
||||
|
||||
// freband output
|
||||
ui->comboBox_fre_domain_resolution->setCurrentText(QString::number( variable_ptr->freband_output_item.fre_domain_resolution));
|
||||
ui->comboBox_lines_number->setCurrentText(QString::number( variable_ptr->freband_output_item.lines_number));
|
||||
ui->checkBox_enable->setChecked(variable_ptr->freband_output[0].enable);
|
||||
ui->lineEdit_start->setText(QString::number(variable_ptr->freband_output[0].start));
|
||||
ui->lineEdit_end->setText(QString::number(variable_ptr->freband_output[0].end));
|
||||
ui->checkBox_enable_2->setChecked(variable_ptr->freband_output[1].enable);
|
||||
ui->lineEdit_start_2->setText(QString::number(variable_ptr->freband_output[1].start));
|
||||
ui->lineEdit_end_2->setText(QString::number(variable_ptr->freband_output[1].end));
|
||||
ui->checkBox_enable_3->setChecked(variable_ptr->freband_output[2].enable);
|
||||
ui->lineEdit_start_3->setText(QString::number(variable_ptr->freband_output[2].start));
|
||||
ui->lineEdit_end_3->setText(QString::number(variable_ptr->freband_output[2].end));
|
||||
ui->checkBox_enable_4->setChecked(variable_ptr->freband_output[3].enable);
|
||||
ui->lineEdit_start_4->setText(QString::number(variable_ptr->freband_output[3].start));
|
||||
ui->lineEdit_end_4->setText(QString::number(variable_ptr->freband_output[3].end));
|
||||
ui->checkBox_enable_5->setChecked(variable_ptr->freband_output[4].enable);
|
||||
ui->lineEdit_start_5->setText(QString::number(variable_ptr->freband_output[4].start));
|
||||
ui->lineEdit_end_5->setText(QString::number(variable_ptr->freband_output[4].end));
|
||||
ui->checkBox_enable_6->setChecked(variable_ptr->freband_output[5].enable);
|
||||
ui->lineEdit_start_6->setText(QString::number(variable_ptr->freband_output[5].start));
|
||||
ui->lineEdit_end_6->setText(QString::number(variable_ptr->freband_output[5].end));
|
||||
ui->checkBox_enable_7->setChecked(variable_ptr->freband_output[6].enable);
|
||||
ui->lineEdit_start_7->setText(QString::number(variable_ptr->freband_output[6].start));
|
||||
ui->lineEdit_end_7->setText(QString::number(variable_ptr->freband_output[6].end));
|
||||
ui->checkBox_enable_8->setChecked(variable_ptr->freband_output[7].enable);
|
||||
ui->lineEdit_start_8->setText(QString::number(variable_ptr->freband_output[7].start));
|
||||
ui->lineEdit_end_8->setText(QString::number(variable_ptr->freband_output[7].end));
|
||||
ui->checkBox_enable_9->setChecked(variable_ptr->freband_output[8].enable);
|
||||
ui->lineEdit_start_9->setText(QString::number(variable_ptr->freband_output[8].start));
|
||||
ui->lineEdit_end_9->setText(QString::number(variable_ptr->freband_output[8].end));
|
||||
ui->checkBox_enable_10->setChecked(variable_ptr->freband_output[9].enable);
|
||||
ui->lineEdit_start_10->setText(QString::number(variable_ptr->freband_output[9].start));
|
||||
ui->lineEdit_end_10->setText(QString::number(variable_ptr->freband_output[9].end));
|
||||
}
|
||||
|
||||
void Acceleration::on_pushButton_confirm_clicked()
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if(filter[i].type == "band_pass"){
|
||||
filter[i].checked = ui->checkBox_band_pass->isChecked();
|
||||
filter[i].low = ui->spinBox_band_pass_low->value();
|
||||
filter[i].high = ui->spinBox_band_pass_high->value();
|
||||
}else if(filter[i].type == "low_pass"){
|
||||
filter[i].checked = ui->checkBox_low_pass->isChecked();
|
||||
filter[i].low = ui->spinBox_low_pass_low->value();
|
||||
filter[i].high = ui->spinBox_low_pass_high->value();
|
||||
}else if(filter[i].type == "high_pass"){
|
||||
filter[i].checked = ui->checkBox_high_pass->isChecked();
|
||||
filter[i].low = ui->spinBox_high_pass_low->value();
|
||||
filter[i].high = ui->spinBox_high_pass_high->value();
|
||||
}
|
||||
void Acceleration::on_pushButton_confirm_clicked() {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[Acceleration::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if(variables[i].type == "direct"){
|
||||
variables[i].full_sacle_range = ui->comboBox_direct_value_range->currentText();
|
||||
variables[i].clamp_value = ui->doubleSpinBox_direct_clamp->value();
|
||||
}else if(variables[i].type == "bias_volt"){
|
||||
variables[i].clamp_value = ui->doubleSpinBox_bias_volt_clamp->value();
|
||||
}else if(variables[i].type == "1x_ampl"){
|
||||
variables[i].checked = ui->checkBox_1x_ampl->isChecked();
|
||||
variables[i].full_sacle_range = ui->comboBox_1x_value_range->currentText();
|
||||
variables[i].clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value();
|
||||
variables[i].clamp_value = ui->doubleSpinBox_1x_phase_lag_clamp->value();
|
||||
}else if(variables[i].type == "2x_ampl"){
|
||||
variables[i].checked = ui->checkBox_2x_ampl->isChecked();
|
||||
variables[i].full_sacle_range = ui->comboBox_2x_value_range->currentText();
|
||||
variables[i].clamp_value = ui->doubleSpinBox_2x_ampl_clamp->value();
|
||||
variables[i].clamp_value = ui->doubleSpinBox_2x_phase_lag_clamp->value();
|
||||
}
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高");
|
||||
return;
|
||||
}
|
||||
delay.alert = ui->spinBox_alert->value();
|
||||
delay.danger = ui->doubleSpinBox_danger->value();
|
||||
delay.active_100ms = ui->checkBox_100ms->isChecked();
|
||||
alert_variables.rms_active = ui->checkBox_rms->isChecked();
|
||||
alert_variables.integrate_active = ui->checkBox_integrate->isChecked();
|
||||
alert_variables.alert_latching = ui->checkBox_alert_latching->isChecked();
|
||||
alert_variables.danger_latching = ui->checkBox_danger_latching->isChecked();
|
||||
alert_variables.timed_ok = ui->checkBox_timed_ok->isChecked();
|
||||
alert_variables.recorder_output = ui->comboBox_recorder_output->currentText();
|
||||
alert_variables.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked();
|
||||
alert_variables.trip_multiply = ui->doubleSpinBox_trip_multiply->value();
|
||||
alert_variables.comparision = ui->comboBox_comparision->currentText();
|
||||
alert_variables.comparision_percentage = ui->spinBox_comparision_percentage->value();
|
||||
if(ui->spinBox_high_pass_low->value() > ui->spinBox_high_pass_high->value()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "带通1配置错误!");
|
||||
return;
|
||||
}
|
||||
if(ui->spinBox_low_pass_low->value() > ui->spinBox_low_pass_high->value()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "带通2配置错误!");
|
||||
return;
|
||||
}
|
||||
if(ui->spinBox_band_pass_low->value() > ui->spinBox_band_pass_high->value()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "带通3配置错误!");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
ptr->base_config_[channel - 1].channel_type = kVibAcc;
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
std::shared_ptr<AccVelVariable> variable = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||
|
||||
QJsonObject filter_obj,variables_obj;
|
||||
QJsonArray filter_array;
|
||||
for(int i = 0; i < 3; i++){
|
||||
QJsonObject temp_obj;
|
||||
temp_obj.insert("type",filter[i].type);
|
||||
temp_obj.insert("low",filter[i].low);
|
||||
temp_obj.insert("high",filter[i].high);
|
||||
temp_obj.insert("checked",filter[i].checked);
|
||||
filter_array.append(temp_obj);
|
||||
}
|
||||
filter_obj.insert("filter",filter_array);
|
||||
filter_obj.insert("slot",slot_no);
|
||||
filter_obj.insert("id",channel);
|
||||
filter_obj.insert("version",1);
|
||||
QJsonArray variables_array;
|
||||
for(int i = 0; i < 4; i++){
|
||||
QJsonObject temp_obj;
|
||||
temp_obj.insert("type",variables[i].type);
|
||||
if(variables[i].type == "direct"){
|
||||
temp_obj.insert("full_sacle_range",variables[i].full_sacle_range);
|
||||
temp_obj.insert("clamp_value",variables[i].clamp_value);
|
||||
}else if(variables[i].type == "bias_volt"){
|
||||
temp_obj.insert("clamp_value",variables[i].clamp_value);
|
||||
temp_obj.insert("full_sacle_range",variables[i].full_sacle_range);
|
||||
}else if(variables[i].type == "1x_ampl" || variables[i].type == "2x_ampl"){
|
||||
temp_obj.insert("checked",variables[i].checked);
|
||||
temp_obj.insert("full_sacle_range",variables[i].full_sacle_range);
|
||||
temp_obj.insert("clamp_value",variables[i].clamp_value);
|
||||
temp_obj.insert("phase_lag",variables[i].phase_lag);
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibAcc || variable == nullptr) {
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "no channel ptr";
|
||||
} else {
|
||||
ptr->RemoveChannel(channel);
|
||||
qDebug() << "channel type change";
|
||||
}
|
||||
variables_array.append(temp_obj);
|
||||
}
|
||||
variables_obj.insert("variables",variables_array);
|
||||
QJsonObject delay_obj;
|
||||
delay_obj.insert("alert",delay.alert);
|
||||
delay_obj.insert("danger",delay.danger);
|
||||
delay_obj.insert("100ms",delay.active_100ms);
|
||||
variables_obj.insert("delay",delay_obj);
|
||||
variables_obj.insert("rms_active",alert_variables.rms_active);
|
||||
variables_obj.insert("integrate_active",alert_variables.integrate_active);
|
||||
variables_obj.insert("alert_latching",alert_variables.alert_latching);
|
||||
variables_obj.insert("danger_latching",alert_variables.danger_latching);
|
||||
variables_obj.insert("timed_ok",alert_variables.timed_ok);
|
||||
variables_obj.insert("recorder_output",alert_variables.recorder_output);
|
||||
variables_obj.insert("two_ma_clamp",alert_variables.two_ma_clamp);
|
||||
variables_obj.insert("trip_multiply",alert_variables.trip_multiply);
|
||||
variables_obj.insert("comparision",alert_variables.comparision);
|
||||
variables_obj.insert("comparision_percentage",alert_variables.comparision_percentage);
|
||||
variables_obj.insert("slot",slot_no);
|
||||
variables_obj.insert("id",channel);
|
||||
variables_obj.insert("version",1);
|
||||
QJsonDocument jsonDoc_filter(filter_obj);
|
||||
QString filePath = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\filter_%2.json").arg(slot_no).arg(channel);
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qDebug() << "Cannot open file for writing:" << filePath;
|
||||
std::shared_ptr<AccVelVariable> variable = std::make_shared<AccVelVariable>();
|
||||
variable->id_ = channel;
|
||||
variable->type_ = kVibAcc;
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->isChecked();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
variable->filter_[1].checked = ui->checkBox_high_pass->isChecked();
|
||||
variable->filter_[1].low = ui->spinBox_high_pass_low->value();
|
||||
variable->filter_[1].high = ui->spinBox_high_pass_high->value();
|
||||
variable->filter_[2].checked = ui->checkBox_band_pass->isChecked();
|
||||
variable->filter_[2].low = ui->spinBox_band_pass_low->value();
|
||||
variable->filter_[2].high = ui->spinBox_band_pass_high->value();
|
||||
// processed output
|
||||
// -general
|
||||
if(ui->comboBox_output_used->currentIndex() == 0)
|
||||
variable->general.output_used = true;
|
||||
else
|
||||
variable->general.output_used = false;
|
||||
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble();
|
||||
variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble();
|
||||
variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble();
|
||||
variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked();
|
||||
variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked();
|
||||
variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble();
|
||||
variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble();
|
||||
variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble();
|
||||
variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked();
|
||||
variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked();
|
||||
// -freband output
|
||||
variable->freband_output_item.fre_domain_resolution = ui->comboBox_fre_domain_resolution->currentText().toFloat();
|
||||
variable->freband_output_item.lines_number = ui->comboBox_lines_number->currentText().toInt();
|
||||
variable->freband_output[0].enable = ui->checkBox_enable->isChecked();
|
||||
variable->freband_output[0].start = ui->lineEdit_start->text().toDouble();
|
||||
variable->freband_output[0].end = ui->lineEdit_end->text().toDouble();
|
||||
variable->freband_output[1].enable = ui->checkBox_enable_2->isChecked();
|
||||
variable->freband_output[1].start = ui->lineEdit_start_2->text().toDouble();
|
||||
variable->freband_output[1].end = ui->lineEdit_end_2->text().toDouble();
|
||||
variable->freband_output[2].enable = ui->checkBox_enable_3->isChecked();
|
||||
variable->freband_output[2].start = ui->lineEdit_start_3->text().toDouble();
|
||||
variable->freband_output[2].end = ui->lineEdit_end_3->text().toDouble();
|
||||
variable->freband_output[3].enable = ui->checkBox_enable_4->isChecked();
|
||||
variable->freband_output[3].start = ui->lineEdit_start_4->text().toDouble();
|
||||
variable->freband_output[3].end = ui->lineEdit_end_4->text().toDouble();
|
||||
variable->freband_output[4].enable = ui->checkBox_enable_5->isChecked();
|
||||
variable->freband_output[4].start = ui->lineEdit_start_5->text().toDouble();
|
||||
variable->freband_output[4].end = ui->lineEdit_end_5->text().toDouble();
|
||||
variable->freband_output[5].enable = ui->checkBox_enable_6->isChecked();
|
||||
variable->freband_output[5].start = ui->lineEdit_start_6->text().toDouble();
|
||||
variable->freband_output[5].end = ui->lineEdit_end_6->text().toDouble();
|
||||
variable->freband_output[6].enable = ui->checkBox_enable_7->isChecked();
|
||||
variable->freband_output[6].start = ui->lineEdit_start_7->text().toDouble();
|
||||
variable->freband_output[6].end = ui->lineEdit_end_7->text().toDouble();
|
||||
variable->freband_output[7].enable = ui->checkBox_enable_8->isChecked();
|
||||
variable->freband_output[7].start = ui->lineEdit_start_8->text().toDouble();
|
||||
variable->freband_output[7].end = ui->lineEdit_end_8->text().toDouble();
|
||||
variable->freband_output[8].enable = ui->checkBox_enable_9->isChecked();
|
||||
variable->freband_output[8].start = ui->lineEdit_start_9->text().toDouble();
|
||||
variable->freband_output[8].end = ui->lineEdit_end_9->text().toDouble();
|
||||
variable->freband_output[9].enable = ui->checkBox_enable_10->isChecked();
|
||||
variable->freband_output[9].start = ui->lineEdit_start_10->text().toDouble();
|
||||
variable->freband_output[9].end = ui->lineEdit_end_10->text().toDouble();
|
||||
ptr->variables_.push_back(variable);
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
file.write(jsonDoc_filter.toJson());
|
||||
file.close();
|
||||
QJsonDocument jsonDoc_variables(variables_obj);
|
||||
filePath = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\acceleration_variables_%2.json").arg(slot_no).arg(channel);
|
||||
file.setFileName(filePath);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qDebug() << "Cannot open file for writing:" << filePath;
|
||||
return;
|
||||
}
|
||||
file.write(jsonDoc_variables.toJson());
|
||||
file.close();
|
||||
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->isChecked();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
variable->filter_[1].checked = ui->checkBox_high_pass->isChecked();
|
||||
variable->filter_[1].low = ui->spinBox_high_pass_low->value();
|
||||
variable->filter_[1].high = ui->spinBox_high_pass_high->value();
|
||||
variable->filter_[2].checked = ui->checkBox_band_pass->isChecked();
|
||||
variable->filter_[2].low = ui->spinBox_band_pass_low->value();
|
||||
variable->filter_[2].high = ui->spinBox_band_pass_high->value();
|
||||
// processed output
|
||||
// -general
|
||||
if(ui->comboBox_output_used->currentIndex() == 0)
|
||||
variable->general.output_used = true;
|
||||
else
|
||||
variable->general.output_used = false;
|
||||
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble();
|
||||
variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble();
|
||||
variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble();
|
||||
variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked();
|
||||
variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked();
|
||||
variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble();
|
||||
variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble();
|
||||
variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble();
|
||||
variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked();
|
||||
variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked();
|
||||
// -freband output
|
||||
variable->freband_output_item.fre_domain_resolution = ui->comboBox_fre_domain_resolution->currentText().toFloat();
|
||||
variable->freband_output_item.lines_number = ui->comboBox_lines_number->currentText().toInt();
|
||||
variable->freband_output[0].enable = ui->checkBox_enable->isChecked();
|
||||
variable->freband_output[0].start = ui->lineEdit_start->text().toDouble();
|
||||
variable->freband_output[0].end = ui->lineEdit_end->text().toDouble();
|
||||
variable->freband_output[1].enable = ui->checkBox_enable_2->isChecked();
|
||||
variable->freband_output[1].start = ui->lineEdit_start_2->text().toDouble();
|
||||
variable->freband_output[1].end = ui->lineEdit_end_2->text().toDouble();
|
||||
variable->freband_output[2].enable = ui->checkBox_enable_3->isChecked();
|
||||
variable->freband_output[2].start = ui->lineEdit_start_3->text().toDouble();
|
||||
variable->freband_output[2].end = ui->lineEdit_end_3->text().toDouble();
|
||||
variable->freband_output[3].enable = ui->checkBox_enable_4->isChecked();
|
||||
variable->freband_output[3].start = ui->lineEdit_start_4->text().toDouble();
|
||||
variable->freband_output[3].end = ui->lineEdit_end_4->text().toDouble();
|
||||
variable->freband_output[4].enable = ui->checkBox_enable_5->isChecked();
|
||||
variable->freband_output[4].start = ui->lineEdit_start_5->text().toDouble();
|
||||
variable->freband_output[4].end = ui->lineEdit_end_5->text().toDouble();
|
||||
variable->freband_output[5].enable = ui->checkBox_enable_6->isChecked();
|
||||
variable->freband_output[5].start = ui->lineEdit_start_6->text().toDouble();
|
||||
variable->freband_output[5].end = ui->lineEdit_end_6->text().toDouble();
|
||||
variable->freband_output[6].enable = ui->checkBox_enable_7->isChecked();
|
||||
variable->freband_output[6].start = ui->lineEdit_start_7->text().toDouble();
|
||||
variable->freband_output[6].end = ui->lineEdit_end_7->text().toDouble();
|
||||
variable->freband_output[7].enable = ui->checkBox_enable_8->isChecked();
|
||||
variable->freband_output[7].start = ui->lineEdit_start_8->text().toDouble();
|
||||
variable->freband_output[7].end = ui->lineEdit_end_8->text().toDouble();
|
||||
variable->freband_output[8].enable = ui->checkBox_enable_9->isChecked();
|
||||
variable->freband_output[8].start = ui->lineEdit_start_9->text().toDouble();
|
||||
variable->freband_output[8].end = ui->lineEdit_end_9->text().toDouble();
|
||||
variable->freband_output[9].enable = ui->checkBox_enable_10->isChecked();
|
||||
variable->freband_output[9].start = ui->lineEdit_start_10->text().toDouble();
|
||||
variable->freband_output[9].end = ui->lineEdit_end_10->text().toDouble();
|
||||
this->close();
|
||||
}
|
||||
|
||||
void Acceleration::on_pushButton_set_default_clicked() {
|
||||
}
|
||||
|
||||
void Acceleration::on_pushButton_cancel_clicked() {
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void Acceleration::on_pushButton_set_default_clicked()
|
||||
void Acceleration::on_lineEdit_alert_high_level_editingFinished()
|
||||
{
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Acceleration::on_lineEdit_danger_high_level_editingFinished()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -8,30 +8,29 @@ namespace Ui {
|
||||
class Acceleration;
|
||||
}
|
||||
|
||||
class Acceleration : public QWidget
|
||||
{
|
||||
class Acceleration : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Acceleration(int slot_no_,int channel_,bool active,QWidget *parent = nullptr);
|
||||
public:
|
||||
explicit Acceleration(int slot_no_, int channel_, bool active, QWidget *parent = nullptr);
|
||||
~Acceleration();
|
||||
int slot_no;
|
||||
int channel;
|
||||
|
||||
private slots:
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_set_default_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
void on_lineEdit_alert_high_level_editingFinished();
|
||||
|
||||
void on_lineEdit_danger_high_level_editingFinished();
|
||||
|
||||
private:
|
||||
Ui::Acceleration *ui;
|
||||
|
||||
Filter filter[3];
|
||||
Dealy delay;
|
||||
Variables variables[4];
|
||||
Alert_Variables alert_variables;
|
||||
|
||||
void readJsonFile(const QString &filePath);
|
||||
void Init();
|
||||
};
|
||||
|
||||
|
||||
2005
acceleration.ui
2005
acceleration.ui
File diff suppressed because it is too large
Load Diff
46
acceleration_ds.h
Normal file
46
acceleration_ds.h
Normal file
@ -0,0 +1,46 @@
|
||||
#ifndef ACCELERATION_DS_H
|
||||
#define ACCELERATION_DS_H
|
||||
|
||||
// 加速度峰值的量程范围
|
||||
typedef enum {
|
||||
kAccPK20 = 0, // 0-20 m/s^2 pk
|
||||
kAccPK50 = 1, // 0-50 m/s^2 pk
|
||||
kAccPK100 = 2, // 0-100 m/s^2 pk
|
||||
kAccPK200 = 3, // 0-200 m/s^2 pk
|
||||
kAccPK250 = 4, // 0-250 m/s^2 pk
|
||||
kAccPK400 = 5, // 0-400 m/s^2 pk
|
||||
kAccPKCustom = 6 // custom
|
||||
} AccPKFullScaleRange;
|
||||
|
||||
// 加速度有效值的量程范围
|
||||
typedef enum {
|
||||
kAccRMS20 = 0, // 0-20 m/s^2 rms
|
||||
kAccRMS50 = 1, // 0-50 m/s^2 rms
|
||||
kAccRMS100 = 2, // 0-100 m/s^2 rms
|
||||
kAccRMS200 = 3, // 0-200 m/s^2 rms
|
||||
kAccRMSCustom = 4 // custom
|
||||
} AccRMSFullScaleRange;
|
||||
|
||||
// 速度峰值的量程范围
|
||||
typedef enum {
|
||||
kAccVelPK25 = 0, // 0-25 mm/s pk
|
||||
kAccVelPK50 = 1, // 0-50 mm/s pk
|
||||
kAccVelPK100 = 2, // 0-100 mm/s pk
|
||||
kAccVelCustom = 3 // custom
|
||||
} AccVelPKFullScaleRange;
|
||||
|
||||
typedef enum {
|
||||
kAccVelRMS25 = 0, // 0-25 mm/s rms
|
||||
kAccVelRMS50 = 1, // 0-50 mm/s rms
|
||||
kAccVelRMSCustom = 2 // custom
|
||||
} AccVelRMSFullScaleRange;
|
||||
|
||||
// recorder out
|
||||
typedef enum {
|
||||
kAccRecorderOutNone = 0,
|
||||
kAccRecorderOutDirectAmpl = 1,
|
||||
kAccRecorderOut1XAmpl = 2,
|
||||
kAccRecorderOut2XAmpl = 3,
|
||||
} AccRecorderOut;
|
||||
|
||||
#endif // ACCELERATION_DS_H
|
||||
6
cardbase.cpp
Normal file
6
cardbase.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "cardbase.h"
|
||||
|
||||
//CardBase::CardBase()
|
||||
//{
|
||||
|
||||
//}
|
||||
88
cardbase.h
Normal file
88
cardbase.h
Normal file
@ -0,0 +1,88 @@
|
||||
#ifndef CARDBASE_H
|
||||
#define CARDBASE_H
|
||||
|
||||
#include "data_config.h"
|
||||
//#ifdef NAME
|
||||
// #undef NAME
|
||||
//#endif
|
||||
//#define NAME(x) (x, #x)
|
||||
|
||||
class CardBase {
|
||||
public:
|
||||
CardBase() {}
|
||||
virtual ~CardBase() {}
|
||||
int version_;
|
||||
int slot_; // 从1~15
|
||||
CardType card_type_;
|
||||
int relative_number;
|
||||
int group;
|
||||
};
|
||||
|
||||
class VariableBase {
|
||||
public:
|
||||
VariableBase() {}
|
||||
virtual ~VariableBase() {}
|
||||
|
||||
int id_;
|
||||
int type_;
|
||||
Filter filter_[3];
|
||||
General general;
|
||||
AlarmDangerHigh danger_high;
|
||||
AlarmAlertHigh alert_high;
|
||||
AlarmDangerLow danger_low;
|
||||
AlarmAlertLow alert_low;
|
||||
|
||||
General gap_general;
|
||||
AlarmDangerHigh gap_danger_high;
|
||||
AlarmAlertHigh gap_alert_high;
|
||||
AlarmDangerLow gap_danger_low;
|
||||
AlarmAlertLow gap_alert_low;
|
||||
|
||||
FrequencybandOutput freband_output[10];
|
||||
FrequencybandOutputItem freband_output_item;
|
||||
};
|
||||
|
||||
// 位移
|
||||
class RadialVariable : public VariableBase {
|
||||
public:
|
||||
bool alert_latching_;
|
||||
bool danger_latching_;
|
||||
RadialImpl not1x_;
|
||||
RadialImpl smax_;
|
||||
};
|
||||
|
||||
// 加速度与速度
|
||||
class AccVelVariable : public VariableBase {
|
||||
public:
|
||||
bool alert_latching_;
|
||||
bool danger_latching_;
|
||||
bool timed_ok_;
|
||||
bool rms_active_;
|
||||
bool integrate_active_;
|
||||
};
|
||||
// 轴向位移
|
||||
class ThrustVariable : public VariableBase {
|
||||
public:
|
||||
bool alert_latching_;
|
||||
bool danger_latching_;
|
||||
bool timed_ok_;
|
||||
ZeroPosition zero_position;
|
||||
};
|
||||
// 动态压力脉动
|
||||
class PressurePulsationVariable : public VariableBase {
|
||||
public:
|
||||
bool fixed;
|
||||
int sample_rate;
|
||||
int bandwidth;
|
||||
int fft_points;
|
||||
bool spectral_synchron;
|
||||
int measuring_min;
|
||||
int measuring_max;
|
||||
int scale_min;
|
||||
int scale_max;
|
||||
bool inherited;
|
||||
};
|
||||
class DefaultVariable : public VariableBase {
|
||||
|
||||
};
|
||||
#endif // CARDBASE_H
|
||||
183
channel_1_2.cpp
Normal file
183
channel_1_2.cpp
Normal file
@ -0,0 +1,183 @@
|
||||
#include "channel_1_2.h"
|
||||
#include "ui_channel_1_2.h"
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "config_mgr.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
Channel_1_2::Channel_1_2(int slot_no_, int channel_,int function_index_,QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::Channel_1_2)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
slot_no = slot_no_;
|
||||
channel = channel_;
|
||||
function_index = function_index_;
|
||||
QString chan = QString("%1").arg("1 & 2");
|
||||
QString slot = QString("%1").arg(slot_no);
|
||||
ui->label_channel->setText(chan);
|
||||
ui->label_slot->setText(slot);
|
||||
if(function_index == 5){
|
||||
ui->comboBox_rectifier_funtion->clear();
|
||||
QStringList list_funtion;
|
||||
list_funtion << "RSM Sum" << "RMS Subtraction" << "SUM" << "SUBTRACTION" << "X & Y MIN" << "X & Y MAX";
|
||||
ui->comboBox_rectifier_funtion->addItems(list_funtion);
|
||||
}
|
||||
Init();
|
||||
}
|
||||
|
||||
Channel_1_2::~Channel_1_2()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void Channel_1_2::Init()
|
||||
{
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[kVib12::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if (ptr->base_config_[channel - 1].channel_type != kVib12) {
|
||||
qDebug() << "[kVib12::Init] channel type changes";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "[kVib12::Init] no channel ptr";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<DefaultVariable> variable_ptr = std::dynamic_pointer_cast<DefaultVariable>(variable_base);
|
||||
|
||||
// processed output
|
||||
// -general
|
||||
if(variable_ptr->general.output_used)
|
||||
ui->comboBox_output_used->setCurrentIndex(0);
|
||||
else
|
||||
ui->comboBox_output_used->setCurrentIndex(1);
|
||||
ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->general.engineering_unit);
|
||||
ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level));
|
||||
ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis));
|
||||
ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.delay));
|
||||
ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable);
|
||||
ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch);
|
||||
|
||||
ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level));
|
||||
ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.hysteresis));
|
||||
ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.delay));
|
||||
ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable);
|
||||
ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch);
|
||||
|
||||
ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level));
|
||||
ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.hysteresis));
|
||||
ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.delay));
|
||||
ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable);
|
||||
ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch);
|
||||
|
||||
ui->lineEdit_alert_low_level->setText(QString::number(variable_ptr->alert_low.level));
|
||||
ui->lineEdit_alert_low_hysteresis->setText(QString::number(variable_ptr->alert_low.hysteresis));
|
||||
ui->lineEdit_alert_low_delay->setText(QString::number(variable_ptr->alert_low.delay));
|
||||
ui->checkBox_alert_low_enable->setChecked(variable_ptr->alert_low.enable);
|
||||
ui->checkBox_alert_low_latch->setChecked(variable_ptr->alert_low.latch);
|
||||
}
|
||||
|
||||
void Channel_1_2::on_pushButton_confirm_clicked()
|
||||
{
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[kVib12::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
ptr->base_config_[channel - 1].channel_type = kVib12;
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
std::shared_ptr<DefaultVariable> variable = std::dynamic_pointer_cast<DefaultVariable>(variable_base);
|
||||
|
||||
if (variable_base == nullptr || variable_base->type_ != kVib12 || variable == nullptr) {
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "no channel ptr";
|
||||
} else {
|
||||
ptr->RemoveChannel(channel);
|
||||
qDebug() << "channel type change";
|
||||
}
|
||||
std::shared_ptr<DefaultVariable> variable = std::make_shared<DefaultVariable>();
|
||||
variable->id_ = channel;
|
||||
// processed output
|
||||
// -general
|
||||
if(ui->comboBox_output_used->currentIndex() == 0)
|
||||
variable->general.output_used = true;
|
||||
else
|
||||
variable->general.output_used = false;
|
||||
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble();
|
||||
variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble();
|
||||
variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble();
|
||||
variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked();
|
||||
variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked();
|
||||
variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble();
|
||||
variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble();
|
||||
variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble();
|
||||
variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked();
|
||||
variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked();
|
||||
ptr->variables_.push_back(variable);
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
// processed output
|
||||
// -general
|
||||
if(ui->comboBox_output_used->currentIndex() == 0)
|
||||
variable->general.output_used = true;
|
||||
else
|
||||
variable->general.output_used = false;
|
||||
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble();
|
||||
variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble();
|
||||
variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble();
|
||||
variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked();
|
||||
variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked();
|
||||
variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble();
|
||||
variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble();
|
||||
variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble();
|
||||
variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked();
|
||||
variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked();
|
||||
this->close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Channel_1_2::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
|
||||
}
|
||||
|
||||
31
channel_1_2.h
Normal file
31
channel_1_2.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef CHANNEL_1_2_H
|
||||
#define CHANNEL_1_2_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class Channel_1_2;
|
||||
}
|
||||
|
||||
class Channel_1_2 : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Channel_1_2(int slot_no_, int channel_,int function_index_,QWidget *parent = nullptr);
|
||||
~Channel_1_2();
|
||||
int slot_no;
|
||||
int channel;
|
||||
int function_index;
|
||||
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
private:
|
||||
Ui::Channel_1_2 *ui;
|
||||
void Init();
|
||||
};
|
||||
|
||||
#endif // CHANNEL_1_2_H
|
||||
953
channel_1_2.ui
Normal file
953
channel_1_2.ui
Normal file
@ -0,0 +1,953 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Channel_1_2</class>
|
||||
<widget class="QWidget" name="Channel_1_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>776</width>
|
||||
<height>640</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>通道1&2配置</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>通道:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_channel">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_active">
|
||||
<property name="text">
|
||||
<string>(启用)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>236</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string> 槽位号:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_slot">
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>235</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>处理后输出</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget_3">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_8">
|
||||
<attribute name="title">
|
||||
<string>常规</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_output_used">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>是</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>否</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>输出使用</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_engineering_unit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>g</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>m/s**2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>mm/s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>inch/s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>um</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>mm</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string>工程单位</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_rectifier_funtion">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>True Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>True Peak-To-Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled Peak-To-Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>AVG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled AVG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="text">
|
||||
<string>整流器</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_9">
|
||||
<attribute name="title">
|
||||
<string> 警报</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<property name="topMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_36">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>危险 + 高</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_37">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>警报 + 高</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_38">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>警报 + 低</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_39">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>危险 + 低</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_40">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>等级</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_high_level">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_high_level">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_low_level">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_low_level">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_41">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>回差</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_high_hysteresis">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_high_hysteresis">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_low_hysteresis">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_low_hysteresis">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_42">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>延时</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_high_delay">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_high_delay">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_low_delay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_low_delay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_43">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>使能</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_danger_high_enable">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alert_high_enable">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alert_low_enable">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_danger_low_enable">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_44">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>锁存</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_danger_high_latch">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alert_high_latch">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alert_low_latch">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_danger_low_latch">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_set_default">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>设置为默认值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_print">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打印</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_help">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>帮助</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
179
channel_3_4.cpp
Normal file
179
channel_3_4.cpp
Normal file
@ -0,0 +1,179 @@
|
||||
#include "channel_3_4.h"
|
||||
#include "ui_channel_3_4.h"
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "config_mgr.h"
|
||||
#include <QMessageBox>
|
||||
Channel_3_4::Channel_3_4(int slot_no_, int channel_,int function_index_,QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::Channel_3_4)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
slot_no = slot_no_;
|
||||
channel = channel_;
|
||||
function_index = function_index_;
|
||||
QString chan = QString("%1").arg("3 & 4");
|
||||
QString slot = QString("%1").arg(slot_no);
|
||||
ui->label_channel->setText(chan);
|
||||
ui->label_slot->setText(slot);
|
||||
if(function_index == 5){
|
||||
ui->comboBox_rectifier_funtion->clear();
|
||||
QStringList list_funtion;
|
||||
list_funtion << "RSM Sum" << "RMS Subtraction" << "SUM" << "SUBTRACTION" << "X & Y MIN" << "X & Y MAX";
|
||||
ui->comboBox_rectifier_funtion->addItems(list_funtion);
|
||||
}
|
||||
Init();
|
||||
}
|
||||
|
||||
Channel_3_4::~Channel_3_4()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void Channel_3_4::Init()
|
||||
{
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[kVib34::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if (ptr->base_config_[channel - 1].channel_type != kVib34) {
|
||||
qDebug() << "[kVib34::Init] channel type changes";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "[kVib34::Init] no channel ptr";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<DefaultVariable> variable_ptr = std::dynamic_pointer_cast<DefaultVariable>(variable_base);
|
||||
|
||||
// processed output
|
||||
// -general
|
||||
if(variable_ptr->general.output_used)
|
||||
ui->comboBox_output_used->setCurrentIndex(0);
|
||||
else
|
||||
ui->comboBox_output_used->setCurrentIndex(1);
|
||||
ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->general.engineering_unit);
|
||||
ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level));
|
||||
ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis));
|
||||
ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.delay));
|
||||
ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable);
|
||||
ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch);
|
||||
|
||||
ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level));
|
||||
ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.hysteresis));
|
||||
ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.delay));
|
||||
ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable);
|
||||
ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch);
|
||||
|
||||
ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level));
|
||||
ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.hysteresis));
|
||||
ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.delay));
|
||||
ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable);
|
||||
ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch);
|
||||
|
||||
ui->lineEdit_alert_low_level->setText(QString::number(variable_ptr->alert_low.level));
|
||||
ui->lineEdit_alert_low_hysteresis->setText(QString::number(variable_ptr->alert_low.hysteresis));
|
||||
ui->lineEdit_alert_low_delay->setText(QString::number(variable_ptr->alert_low.delay));
|
||||
ui->checkBox_alert_low_enable->setChecked(variable_ptr->alert_low.enable);
|
||||
ui->checkBox_alert_low_latch->setChecked(variable_ptr->alert_low.latch);
|
||||
}
|
||||
void Channel_3_4::on_pushButton_confirm_clicked()
|
||||
{
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[kVib34::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
ptr->base_config_[channel - 1].channel_type = kVib34;
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
std::shared_ptr<DefaultVariable> variable = std::dynamic_pointer_cast<DefaultVariable>(variable_base);
|
||||
|
||||
if (variable_base == nullptr || variable_base->type_ != kVib34 || variable == nullptr) {
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "no channel ptr";
|
||||
} else {
|
||||
ptr->RemoveChannel(channel);
|
||||
qDebug() << "channel type change";
|
||||
}
|
||||
std::shared_ptr<DefaultVariable> variable = std::make_shared<DefaultVariable>();
|
||||
variable->id_ = channel;
|
||||
// processed output
|
||||
// -general
|
||||
if(ui->comboBox_output_used->currentIndex() == 0)
|
||||
variable->general.output_used = true;
|
||||
else
|
||||
variable->general.output_used = false;
|
||||
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble();
|
||||
variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble();
|
||||
variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble();
|
||||
variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked();
|
||||
variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked();
|
||||
variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble();
|
||||
variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble();
|
||||
variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble();
|
||||
variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked();
|
||||
variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked();
|
||||
ptr->variables_.push_back(variable);
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
// processed output
|
||||
// -general
|
||||
if(ui->comboBox_output_used->currentIndex() == 0)
|
||||
variable->general.output_used = true;
|
||||
else
|
||||
variable->general.output_used = false;
|
||||
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble();
|
||||
variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble();
|
||||
variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble();
|
||||
variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked();
|
||||
variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked();
|
||||
variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble();
|
||||
variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble();
|
||||
variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble();
|
||||
variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked();
|
||||
variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked();
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void Channel_3_4::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
31
channel_3_4.h
Normal file
31
channel_3_4.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef CHANNEL_3_4_H
|
||||
#define CHANNEL_3_4_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class Channel_3_4;
|
||||
}
|
||||
|
||||
class Channel_3_4 : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Channel_3_4(int slot_no_, int channel_,int function_index,QWidget *parent = nullptr);
|
||||
~Channel_3_4();
|
||||
int slot_no;
|
||||
int channel;
|
||||
int function_index;
|
||||
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
private:
|
||||
Ui::Channel_3_4 *ui;
|
||||
void Init();
|
||||
};
|
||||
|
||||
#endif // CHANNEL_3_4_H
|
||||
953
channel_3_4.ui
Normal file
953
channel_3_4.ui
Normal file
@ -0,0 +1,953 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Channel_3_4</class>
|
||||
<widget class="QWidget" name="Channel_3_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>819</width>
|
||||
<height>587</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>通道3&4配置</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>通道:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_channel">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_active">
|
||||
<property name="text">
|
||||
<string>(启用)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>236</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string> 槽位号:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_slot">
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>235</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>处理后输出</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget_3">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_8">
|
||||
<attribute name="title">
|
||||
<string>常规</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_output_used">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>是</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>否</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>输出使用</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_engineering_unit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>g</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>m/s**2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>mm/s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>inch/s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>um</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>mm</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string>工程单位</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_rectifier_funtion">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>True Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>True Peak-To-Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled Peak-To-Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>AVG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled AVG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="text">
|
||||
<string>整流器</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_9">
|
||||
<attribute name="title">
|
||||
<string> 警报</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<property name="topMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_36">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>危险 + 高</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_37">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>警报 + 高</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_38">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>警报 + 低</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_39">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>危险 + 低</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_40">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>等级</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_high_level">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_high_level">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_low_level">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_low_level">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_41">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>回差</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_high_hysteresis">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_high_hysteresis">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_low_hysteresis">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_low_hysteresis">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_42">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>延时</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_high_delay">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_high_delay">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_low_delay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_low_delay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_43">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>使能</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_danger_high_enable">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alert_high_enable">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alert_low_enable">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_danger_low_enable">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_44">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>锁存</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_danger_high_latch">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alert_high_latch">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alert_low_latch">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_danger_low_latch">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_set_default">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>设置为默认值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_print">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打印</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_help">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>帮助</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
69
channel_crc.cpp
Normal file
69
channel_crc.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
#include "channel_crc.h"
|
||||
#include "ui_channel_crc.h"
|
||||
#include "config_mgr.h"
|
||||
#include "data_config.h"
|
||||
|
||||
ChannelCRC::ChannelCRC(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ChannelCRC)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
initable();
|
||||
m_tcpClient = MyTcpClient::instance();
|
||||
connect(m_tcpClient, SIGNAL(dataReceived(const QByteArray &)), this, SLOT(readData(const QByteArray &)));
|
||||
|
||||
}
|
||||
|
||||
ChannelCRC::~ChannelCRC()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void ChannelCRC::initable()
|
||||
{
|
||||
headerStr = QObject::tr("板卡,通道1,通道2,通道3,通道4");
|
||||
myHeader = new TableHeaderView(Qt::Horizontal, ui->tableView);
|
||||
model = new QStandardItemModel(ui->tableView);
|
||||
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
QStringList headerList = headerStr.split(",");
|
||||
model->setHorizontalHeaderLabels(headerList);
|
||||
model->setColumnCount(headerList.size());
|
||||
ui->tableView->setModel(model);
|
||||
}
|
||||
|
||||
void ChannelCRC::on_pushButton_get_clicked()
|
||||
{
|
||||
model->removeRows(0, model->rowCount());
|
||||
int rows = 0;
|
||||
for (int slot = 1; slot <= SLOT_NUM; slot ++ ) {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot);
|
||||
if(base_ptr == nullptr)
|
||||
continue;
|
||||
if(base_ptr->card_type_ == kCardVibSingle ||
|
||||
base_ptr->card_type_ == kCardSpeedSingle ||
|
||||
base_ptr->card_type_ == kCardKeyphaseSingle){
|
||||
for (int ch = 1 ; ch <= 4 ; ch ++ ) {
|
||||
model->setRowCount(rows + 1);
|
||||
model->setData(model->index(rows,0,QModelIndex()),slot);
|
||||
rows_slot[slot] = rows;
|
||||
|
||||
GetChannelCRCCountReq get_ch_crc_req = { {0xAA, 0x55, 0xAA}, kGetChannelCRCValue, 1,(uint8_t)slot,(uint8_t)ch };
|
||||
int length = sizeof(GetChannelCRCCountReq);
|
||||
qint64 bytesWritten = m_tcpClient->sendData((char*)&get_ch_crc_req, length);
|
||||
m_tcpClient->waitForRead();
|
||||
qDebug() << "bytesWritten: " << bytesWritten;
|
||||
}
|
||||
rows ++ ;
|
||||
}
|
||||
}
|
||||
}
|
||||
void ChannelCRC::readData(const QByteArray &data) {
|
||||
uint8_t cmd = data[3];
|
||||
if (cmd == kGetChannelCRCValue) {
|
||||
GetChannelCRCCountRsp get_ch_crc_rsp;
|
||||
memcpy(&get_ch_crc_rsp, data.data(), sizeof(GetChannelCRCCountRsp));
|
||||
qDebug() << "get_ch_crc_rsp code" << get_ch_crc_rsp.code << get_ch_crc_rsp.card_id << get_ch_crc_rsp.channel_id << get_ch_crc_rsp.count << rows_slot[(int)get_ch_crc_rsp.card_id] ;
|
||||
model->setData(model->index(rows_slot[(int)get_ch_crc_rsp.card_id],((int)get_ch_crc_rsp.channel_id),QModelIndex()),get_ch_crc_rsp.count);
|
||||
}
|
||||
}
|
||||
36
channel_crc.h
Normal file
36
channel_crc.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef CHANNEL_CRC_H
|
||||
#define CHANNEL_CRC_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QStandardItemModel> //数据模型类
|
||||
#include <QMessageBox>
|
||||
#include "headerView.h"
|
||||
#include "TableHeaderView.h"
|
||||
#include "MyTcpClient.h"
|
||||
|
||||
namespace Ui {
|
||||
class ChannelCRC;
|
||||
}
|
||||
|
||||
class ChannelCRC : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ChannelCRC(QWidget *parent = nullptr);
|
||||
~ChannelCRC();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_get_clicked();
|
||||
void readData(const QByteArray&);
|
||||
private:
|
||||
Ui::ChannelCRC *ui;
|
||||
TableHeaderView *myHeader;
|
||||
QStandardItemModel *model;
|
||||
QString headerStr ;
|
||||
MyTcpClient* m_tcpClient;
|
||||
QMap<int,int> rows_slot;//<row,slot>
|
||||
void initable();
|
||||
};
|
||||
|
||||
#endif // CHANNEL_CRC_H
|
||||
59
channel_crc.ui
Normal file
59
channel_crc.ui
Normal file
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ChannelCRC</class>
|
||||
<widget class="QWidget" name="ChannelCRC">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>766</width>
|
||||
<height>519</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>获取通道CRC</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton_get">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>650</x>
|
||||
<y>50</y>
|
||||
<width>81</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>获取</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTableView" name="tableView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
293
config/template_vib.json
Normal file
293
config/template_vib.json
Normal file
@ -0,0 +1,293 @@
|
||||
{
|
||||
"1": {
|
||||
"1": {
|
||||
"active": true,
|
||||
"chan_id": "S01C01",
|
||||
"channel_type": 0,
|
||||
"keyphase": false,
|
||||
"keyphase_ch": 1,
|
||||
"keyphase_slot": 1,
|
||||
"normal_voltage_range": [
|
||||
-18,
|
||||
-2
|
||||
],
|
||||
"point_name": "出线端X向轴振1",
|
||||
"power": false,
|
||||
"sensitivity_unit": 3,
|
||||
"signal_sensitivity": 8,
|
||||
"standby": true,
|
||||
"variable": {
|
||||
"filter": [
|
||||
{
|
||||
"checked": false,
|
||||
"high": 3000,
|
||||
"low": 30
|
||||
},
|
||||
{
|
||||
"checked": false,
|
||||
"high": 3000,
|
||||
"low": 3
|
||||
},
|
||||
{
|
||||
"checked": false,
|
||||
"high": 3000,
|
||||
"low": 3
|
||||
}
|
||||
],
|
||||
"gap": {
|
||||
"alarm": {
|
||||
"alert_high_delay": 0,
|
||||
"alert_high_enable": false,
|
||||
"alert_high_hysteresis": 0,
|
||||
"alert_high_latch": false,
|
||||
"alert_high_level": 0,
|
||||
"danger_high_delay": 0,
|
||||
"danger_high_enable": false,
|
||||
"danger_high_hysteresis": 0,
|
||||
"danger_high_latch": false,
|
||||
"danger_high_level": 0
|
||||
},
|
||||
"general": {
|
||||
"engieneering_unit": 4,
|
||||
"output_used": false,
|
||||
"rectifier_function": -1
|
||||
}
|
||||
},
|
||||
"measurement": {
|
||||
"alarm": {
|
||||
"alert_high_delay": 1,
|
||||
"alert_high_enable": true,
|
||||
"alert_high_hysteresis": 0,
|
||||
"alert_high_latch": false,
|
||||
"alert_high_level": 125,
|
||||
"danger_high_delay": 1,
|
||||
"danger_high_enable": true,
|
||||
"danger_high_hysteresis": 0,
|
||||
"danger_high_latch": false,
|
||||
"danger_high_level": 260
|
||||
},
|
||||
"general": {
|
||||
"engieneering_unit": 4,
|
||||
"output_used": true,
|
||||
"rectifier_function": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"2": {
|
||||
"active": true,
|
||||
"chan_id": "S01C02",
|
||||
"channel_type": 0,
|
||||
"keyphase": false,
|
||||
"keyphase_ch": 1,
|
||||
"keyphase_slot": 1,
|
||||
"normal_voltage_range": [
|
||||
-18,
|
||||
-2
|
||||
],
|
||||
"point_name": "出线端X向轴振2",
|
||||
"power": false,
|
||||
"sensitivity_unit": 3,
|
||||
"signal_sensitivity": 8,
|
||||
"standby": true,
|
||||
"variable": {
|
||||
"filter": [
|
||||
{
|
||||
"checked": false,
|
||||
"high": 3000,
|
||||
"low": 30
|
||||
},
|
||||
{
|
||||
"checked": true,
|
||||
"high": 3000,
|
||||
"low": 3
|
||||
},
|
||||
{
|
||||
"checked": false,
|
||||
"high": 3000,
|
||||
"low": 3
|
||||
}
|
||||
],
|
||||
"gap": {
|
||||
"alarm": {
|
||||
"alert_high_delay": 0,
|
||||
"alert_high_enable": false,
|
||||
"alert_high_hysteresis": 0,
|
||||
"alert_high_latch": false,
|
||||
"alert_high_level": 0,
|
||||
"danger_high_delay": 0,
|
||||
"danger_high_enable": false,
|
||||
"danger_high_hysteresis": 0,
|
||||
"danger_high_latch": false,
|
||||
"danger_high_level": 0
|
||||
},
|
||||
"general": {
|
||||
"engieneering_unit": 4,
|
||||
"output_used": false,
|
||||
"rectifier_function": -1
|
||||
}
|
||||
},
|
||||
"measurement": {
|
||||
"alarm": {
|
||||
"alert_high_delay": 1,
|
||||
"alert_high_enable": true,
|
||||
"alert_high_hysteresis": 0,
|
||||
"alert_high_latch": false,
|
||||
"alert_high_level": 125,
|
||||
"danger_high_delay": 1,
|
||||
"danger_high_enable": true,
|
||||
"danger_high_hysteresis": 0,
|
||||
"danger_high_latch": false,
|
||||
"danger_high_level": 260
|
||||
},
|
||||
"general": {
|
||||
"engieneering_unit": 4,
|
||||
"output_used": true,
|
||||
"rectifier_function": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"3": {
|
||||
"active": true,
|
||||
"chan_id": "S01C03",
|
||||
"channel_type": 2,
|
||||
"keyphase": false,
|
||||
"keyphase_ch": 1,
|
||||
"keyphase_slot": 1,
|
||||
"normal_voltage_range": [
|
||||
-20,
|
||||
20
|
||||
],
|
||||
"point_name": "非出线端Y向绝对振动1",
|
||||
"power": false,
|
||||
"sensitivity_unit": 2,
|
||||
"signal_sensitivity": 20,
|
||||
"standby": true,
|
||||
"variable": {
|
||||
"filter": [
|
||||
{
|
||||
"checked": false,
|
||||
"high": 3000,
|
||||
"low": 30
|
||||
},
|
||||
{
|
||||
"checked": false,
|
||||
"high": 3000,
|
||||
"low": 3
|
||||
},
|
||||
{
|
||||
"checked": false,
|
||||
"high": 3000,
|
||||
"low": 3
|
||||
}
|
||||
],
|
||||
"processed_output": {
|
||||
"alarm": {
|
||||
"alert_high_delay": 1,
|
||||
"alert_high_enable": true,
|
||||
"alert_high_hysteresis": 0,
|
||||
"alert_high_latch": false,
|
||||
"alert_high_level": 7.5,
|
||||
"danger_high_delay": 1,
|
||||
"danger_high_enable": true,
|
||||
"danger_high_hysteresis": 0,
|
||||
"danger_high_latch": false,
|
||||
"danger_high_level": 11.800000190734864
|
||||
},
|
||||
"general": {
|
||||
"engieneering_unit": 2,
|
||||
"output_used": true,
|
||||
"rectifier_function": 6
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"4": {
|
||||
"active": false,
|
||||
"chan_id": "S01C04",
|
||||
"channel_type": 2,
|
||||
"keyphase": false,
|
||||
"keyphase_ch": 1,
|
||||
"keyphase_slot": 1,
|
||||
"normal_voltage_range": [
|
||||
-20,
|
||||
20
|
||||
],
|
||||
"point_name": "非出线端Y向绝对振动2",
|
||||
"power": false,
|
||||
"sensitivity_unit": 2,
|
||||
"signal_sensitivity": 20,
|
||||
"standby": true,
|
||||
"variable": {
|
||||
"filter": [
|
||||
{
|
||||
"checked": false,
|
||||
"high": 3000,
|
||||
"low": 30
|
||||
},
|
||||
{
|
||||
"checked": false,
|
||||
"high": 3000,
|
||||
"low": 3
|
||||
},
|
||||
{
|
||||
"checked": false,
|
||||
"high": 3000,
|
||||
"low": 3
|
||||
}
|
||||
],
|
||||
"processed_output": {
|
||||
"alarm": {
|
||||
"alert_high_delay": 1,
|
||||
"alert_high_enable": true,
|
||||
"alert_high_hysteresis": 0,
|
||||
"alert_high_latch": false,
|
||||
"alert_high_level": 7.5,
|
||||
"danger_high_delay": 1,
|
||||
"danger_high_enable": true,
|
||||
"danger_high_hysteresis": 0,
|
||||
"danger_high_latch": false,
|
||||
"danger_high_level": 11.800000190734864
|
||||
},
|
||||
"general": {
|
||||
"engieneering_unit": 2,
|
||||
"output_used": true,
|
||||
"rectifier_function": 6
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dc_output": {
|
||||
"1": {
|
||||
"maxmum": 500,
|
||||
"minmum": 0,
|
||||
"output_channel": 0
|
||||
},
|
||||
"2": {
|
||||
"maxmum": 500,
|
||||
"minmum": 0,
|
||||
"output_channel": 0
|
||||
},
|
||||
"3": {
|
||||
"maxmum": 20,
|
||||
"minmum": 0,
|
||||
"output_channel": 2
|
||||
},
|
||||
"4": {
|
||||
"maxmum": 20,
|
||||
"minmum": 0,
|
||||
"output_channel": 2
|
||||
}
|
||||
},
|
||||
"group": 1,
|
||||
"relative_number": 1,
|
||||
"version": 1
|
||||
},
|
||||
"card_type": [
|
||||
{
|
||||
"slot": 1,
|
||||
"type": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
1618
config_mgr.cpp
Normal file
1618
config_mgr.cpp
Normal file
File diff suppressed because it is too large
Load Diff
137
config_mgr.h
Normal file
137
config_mgr.h
Normal file
@ -0,0 +1,137 @@
|
||||
#ifndef CONFIG_MGR_H
|
||||
#define CONFIG_MGR_H
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "cardbase.h"
|
||||
#include <QDrag>
|
||||
#include <QMimeData>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QDebug>
|
||||
#include <QListWidget>
|
||||
#include <QStandardItemModel> //数据模型类
|
||||
#include <QTreeView>
|
||||
|
||||
class DraggableListWidget : public QListWidget {
|
||||
public:
|
||||
DraggableListWidget(QWidget *parent = nullptr) : QListWidget(parent) {
|
||||
setDragEnabled(true);
|
||||
}
|
||||
|
||||
protected:
|
||||
void startDrag(Qt::DropActions supportedActions) override {
|
||||
QListWidgetItem *item = currentItem();
|
||||
if (!item) return;
|
||||
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
|
||||
// 获取显示文本和 UserRole 数据
|
||||
QString visibleText = item->text();
|
||||
QString userData = item->data(Qt::UserRole).toString();
|
||||
|
||||
// 使用 QDataStream 打包数据
|
||||
QByteArray data;
|
||||
QDataStream stream(&data, QIODevice::WriteOnly);
|
||||
stream << visibleText << userData; // 包含显示文本和 UserRole 数据
|
||||
|
||||
mimeData->setData("application/x-custom", data); // 设置自定义 MIME 数据
|
||||
|
||||
QDrag *drag = new QDrag(this);
|
||||
drag->setMimeData(mimeData);
|
||||
drag->exec(Qt::CopyAction);
|
||||
}
|
||||
};
|
||||
class DropTreeModel : public QStandardItemModel {
|
||||
public:
|
||||
using QStandardItemModel::QStandardItemModel;
|
||||
|
||||
QStringList mimeTypes() const override {
|
||||
// 支持自定义类型和 QListWidget 默认类型
|
||||
return { "application/x-custom", "application/x-qabstractitemmodeldatalist" };
|
||||
}
|
||||
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||
int row, int column, const QModelIndex &parent) override {
|
||||
QStandardItem *parentItem = this->itemFromIndex(parent);
|
||||
if (!parentItem)
|
||||
parentItem = this->invisibleRootItem();
|
||||
|
||||
if (data->hasFormat("application/x-custom")) {
|
||||
QByteArray rawData = data->data("application/x-custom");
|
||||
QString customText = QString::fromUtf8(rawData);
|
||||
|
||||
QStandardItem *newItem = new QStandardItem(customText);
|
||||
newItem->setData(customText, Qt::UserRole); // 假设 data 也就是内容
|
||||
newItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable |
|
||||
Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled);
|
||||
|
||||
if (row < 0)
|
||||
parentItem->appendRow(newItem);
|
||||
else
|
||||
parentItem->insertRow(row, newItem);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (data->hasFormat("application/x-qabstractitemmodeldatalist")) {
|
||||
QByteArray encoded = data->data("application/x-qabstractitemmodeldatalist");
|
||||
QDataStream stream(&encoded, QIODevice::ReadOnly);
|
||||
|
||||
while (!stream.atEnd()) {
|
||||
int r, c;
|
||||
QMap<int, QVariant> roleDataMap;
|
||||
stream >> r >> c >> roleDataMap;
|
||||
|
||||
QString text = roleDataMap.value(Qt::DisplayRole).toString();
|
||||
QVariant userData = roleDataMap.value(Qt::UserRole);
|
||||
|
||||
QStandardItem *newItem = new QStandardItem(text);
|
||||
newItem->setData(userData, Qt::UserRole); // 保留附加数据
|
||||
newItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable |
|
||||
Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled);
|
||||
|
||||
if (row < 0)
|
||||
parentItem->appendRow(newItem);
|
||||
else
|
||||
parentItem->insertRow(row, newItem);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::DropActions supportedDropActions() const override {
|
||||
return Qt::CopyAction | Qt::MoveAction;
|
||||
}
|
||||
};
|
||||
class ConfigMgr {
|
||||
private:
|
||||
static ConfigMgr *instance;
|
||||
ConfigMgr() {
|
||||
for (int i = 0; i < SLOT_NUM; ++i) {
|
||||
card_type_[i] = kCardNone;
|
||||
}
|
||||
}
|
||||
public:
|
||||
int card_type_[15];
|
||||
static ConfigMgr *Instance() {
|
||||
if (instance == nullptr) {
|
||||
instance = new ConfigMgr();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
~ConfigMgr();
|
||||
int Save(QString & file_path);
|
||||
void Load(QString filename);
|
||||
void LaodTemplate(QString filename,int slot);
|
||||
std::shared_ptr<CardBase> GetSlotPtr(int slot);//1-15
|
||||
void AddCard(std::shared_ptr<CardBase> ptr);
|
||||
void RemoveCard(std::shared_ptr<CardBase> ptr);
|
||||
private:
|
||||
QString filename_;
|
||||
|
||||
std::vector<std::shared_ptr<CardBase>> cards_;
|
||||
};
|
||||
|
||||
#endif // CONFIG_MGR_H
|
||||
38
connect.cpp
Normal file
38
connect.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include "connect.h"
|
||||
#include "ui_connect.h"
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionValidator>
|
||||
#include "data_config.h"
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkProxy>
|
||||
|
||||
Connect::Connect(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::Connect)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QRegularExpression ipRegex(R"(^(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$)");
|
||||
QRegularExpressionValidator *ipValidator = new QRegularExpressionValidator(ipRegex, this);
|
||||
ui->lineEdit_IP->setValidator(ipValidator);
|
||||
ui->lineEdit_IP->setText(g_strServerIp);
|
||||
}
|
||||
|
||||
Connect::~Connect()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Connect::on_pushButton_connect_clicked()
|
||||
{
|
||||
g_strServerIp = ui->lineEdit_IP->text();
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
|
||||
m_tcpClient = MyTcpClient::instance();
|
||||
// 连接服务器
|
||||
m_tcpClient->connectToServer(g_strServerIp, 10000);
|
||||
QSettings *settings = new QSettings(QCoreApplication::applicationDirPath() + "/config/config.ini", QSettings::IniFormat);
|
||||
settings->setValue("Server/IP", ui->lineEdit_IP->text());
|
||||
this->close();
|
||||
}
|
||||
|
||||
28
connect.h
Normal file
28
connect.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef CONNECT_H
|
||||
#define CONNECT_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "MyTcpClient.h"
|
||||
|
||||
namespace Ui {
|
||||
class Connect;
|
||||
}
|
||||
|
||||
class Connect : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Connect(QWidget *parent = nullptr);
|
||||
~Connect();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_connect_clicked();
|
||||
|
||||
private:
|
||||
Ui::Connect *ui;
|
||||
MyTcpClient* m_tcpClient;
|
||||
|
||||
};
|
||||
|
||||
#endif // CONNECT_H
|
||||
58
connect.ui
Normal file
58
connect.ui
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Connect</class>
|
||||
<widget class="QWidget" name="Connect">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>连接</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton_connect">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>190</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>连接</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>80</y>
|
||||
<width>221</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>CPU IP:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_IP">
|
||||
<property name="text">
|
||||
<string>192.168.0.101</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
174
copy_channel.cpp
Normal file
174
copy_channel.cpp
Normal file
@ -0,0 +1,174 @@
|
||||
#include "copy_channel.h"
|
||||
#include "ui_copy_channel.h"
|
||||
#include "data_config.h"
|
||||
#include "config_mgr.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "tachometer_data.h"
|
||||
#include "high_speed_current_data.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
CopyChannel::CopyChannel(int slot_no_,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CopyChannel)
|
||||
{
|
||||
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()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CopyChannel::on_radioButton_ch1_clicked(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
ui->checkBox_ch1->setChecked(false);
|
||||
ui->checkBox_ch1->setEnabled(false);
|
||||
}
|
||||
ui->checkBox_ch2->setEnabled(true);
|
||||
ui->checkBox_ch3->setEnabled(true);
|
||||
ui->checkBox_ch4->setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CopyChannel::on_radioButton_ch2_clicked(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
ui->checkBox_ch2->setChecked(false);
|
||||
ui->checkBox_ch2->setEnabled(false);
|
||||
}
|
||||
ui->checkBox_ch1->setEnabled(true);
|
||||
ui->checkBox_ch3->setEnabled(true);
|
||||
ui->checkBox_ch4->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
void CopyChannel::on_radioButton_ch3_clicked(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
ui->checkBox_ch3->setChecked(false);
|
||||
ui->checkBox_ch3->setEnabled(false);
|
||||
}
|
||||
ui->checkBox_ch2->setEnabled(true);
|
||||
ui->checkBox_ch1->setEnabled(true);
|
||||
ui->checkBox_ch4->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
void CopyChannel::on_radioButton_ch4_clicked(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
ui->checkBox_ch4->setChecked(false);
|
||||
ui->checkBox_ch4->setEnabled(false);
|
||||
}
|
||||
ui->checkBox_ch2->setEnabled(true);
|
||||
ui->checkBox_ch3->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;
|
||||
}
|
||||
if(base_ptr->card_type_ == kCardVibSingle){
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(base_ptr->card_type_ == kCardSpeedSingle){
|
||||
std::shared_ptr<TachometerData> tachometer_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if(i != var && check_ch[i]->isChecked()){
|
||||
QString point_name = tachometer_data->variables_[i].point_name;
|
||||
int id = tachometer_data->variables_[i].id;
|
||||
tachometer_data->variables_[i] = tachometer_data->variables_[var];
|
||||
tachometer_data->variables_[i].point_name = point_name;
|
||||
tachometer_data->variables_[i].id = id;
|
||||
auto variable_base_old = tachometer_data->variables_[i];
|
||||
tachometer_data->danger_high[i] = tachometer_data->danger_high[var];
|
||||
tachometer_data->alert_high[i] = tachometer_data->alert_high[var];
|
||||
}
|
||||
}
|
||||
}else if(base_ptr->card_type_ == kCardHighSpeedCurrent){
|
||||
std::shared_ptr<HighSpeedCurrentData> current_data = std::dynamic_pointer_cast<HighSpeedCurrentData>(base_ptr);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if(i != var && check_ch[i]->isChecked()){
|
||||
QString point_name = current_data->variables_[i].point_name;
|
||||
int id = current_data->variables_[i].id;
|
||||
current_data->variables_[i] = current_data->variables_[var];
|
||||
current_data->variables_[i].point_name = point_name;
|
||||
current_data->variables_[i].id = id;
|
||||
auto variable_base_old = current_data->variables_[i];
|
||||
current_data->danger_high[i] = current_data->danger_high[var];
|
||||
current_data->alert_high[i] = current_data->alert_high[var];
|
||||
}
|
||||
}
|
||||
}
|
||||
emit copy_end_sg();
|
||||
this->close();
|
||||
}
|
||||
|
||||
40
copy_channel.h
Normal file
40
copy_channel.h
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef COPY_CHANNEL_H
|
||||
#define COPY_CHANNEL_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QRadioButton>
|
||||
#include <QCheckBox>
|
||||
namespace Ui {
|
||||
class CopyChannel;
|
||||
}
|
||||
|
||||
class CopyChannel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CopyChannel(int slot_no_,QWidget *parent = nullptr);
|
||||
~CopyChannel();
|
||||
int slot_no;
|
||||
|
||||
private slots:
|
||||
void on_radioButton_ch1_clicked(bool checked);
|
||||
|
||||
void on_radioButton_ch2_clicked(bool checked);
|
||||
|
||||
void on_radioButton_ch3_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:
|
||||
Ui::CopyChannel *ui;
|
||||
QList<QRadioButton*> radio_btn;
|
||||
QList<QCheckBox*> check_ch;
|
||||
};
|
||||
|
||||
#endif // COPY_CHANNEL_H
|
||||
250
copy_channel.ui
Normal file
250
copy_channel.ui
Normal file
@ -0,0 +1,250 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CopyChannel</class>
|
||||
<widget class="QWidget" name="CopyChannel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>673</width>
|
||||
<height>534</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>复制通道</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>复制通道配置</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>选择被复制的通道</string>
|
||||
</property>
|
||||
<widget class="QRadioButton" name="radioButton_ch1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>111</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道1</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_ch2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>80</y>
|
||||
<width>111</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道2</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_ch3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>80</y>
|
||||
<width>111</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道3</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_ch4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>80</y>
|
||||
<width>111</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道4</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>选择需要复制的通道</string>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="checkBox_ch1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>90</y>
|
||||
<width>87</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道1</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_ch2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>90</y>
|
||||
<width>87</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道2</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_ch3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>90</y>
|
||||
<width>87</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道3</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_ch4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>90</y>
|
||||
<width>87</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
985
data_config.h
985
data_config.h
File diff suppressed because it is too large
Load Diff
79
dc_output_channel.cpp
Normal file
79
dc_output_channel.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
#include "dc_output_channel.h"
|
||||
#include "ui_dc_output_channel.h"
|
||||
#include <QMessageBox>
|
||||
#include "data_config.h"
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
DC_Output_Channel::DC_Output_Channel(int slot_no_,QString unit_str_,int current_index_,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::DC_Output_Channel)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
unit_str = unit_str_;
|
||||
current_index = current_index_;
|
||||
slot_no = slot_no_;
|
||||
ui->label_min_unit->setText(unit_str);
|
||||
ui->label_max_unit->setText(unit_str);
|
||||
radiobtn[0] = ui->radioButton;
|
||||
radiobtn[1] = ui->radioButton_2;
|
||||
radiobtn[2] = ui->radioButton_3;
|
||||
radiobtn[3] = ui->radioButton_4;
|
||||
radiobtn[4] = ui->radioButton_5;
|
||||
int not_used = 0;
|
||||
for (int i = 0; i < 22; i++) {
|
||||
for (int j = 0; j < 4; j++){
|
||||
if(ch_used[slot_no][i].used[j] && current_index == i){
|
||||
radiobtn[j]->setEnabled(true);
|
||||
radiobtn[j]->setChecked(true);
|
||||
first_used = j;
|
||||
}else if(ch_used[slot_no][i].used[j] && current_index != i){
|
||||
radiobtn[j]->setEnabled(false);
|
||||
}else if(!ch_used[slot_no][i].used[j] && current_index == i){
|
||||
not_used ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(not_used == 4){
|
||||
ui->radioButton_5->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
DC_Output_Channel::~DC_Output_Channel()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DC_Output_Channel::on_pushButton_confirm_clicked()
|
||||
{
|
||||
int channel = 0;
|
||||
if(!ui->radioButton_5->isChecked() && ((ui->lineEdit_minmum->text().toFloat() >= ui->lineEdit_maxmum->text().toFloat()) ||
|
||||
(ui->lineEdit_minmum->text().toFloat() == 0 && ui->lineEdit_maxmum->text().toFloat() == 0))){
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "请填写正确的最小值和最大值");
|
||||
return;
|
||||
}
|
||||
if(ui->radioButton->isChecked()){
|
||||
channel = 1;
|
||||
}else if(ui->radioButton_2->isChecked()){
|
||||
channel = 2;
|
||||
}else if(ui->radioButton_3->isChecked()){
|
||||
channel = 3;
|
||||
}else if(ui->radioButton_4->isChecked()){
|
||||
channel = 4;
|
||||
}else if(ui->radioButton_5->isChecked()){
|
||||
ch_used[slot_no][current_index].used[first_used] = false;
|
||||
channel = 5;
|
||||
}else {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "请选择正确的通道");
|
||||
return;
|
||||
}
|
||||
emit output_channel_data_sg(channel,ui->lineEdit_minmum->text().toFloat(),ui->lineEdit_maxmum->text().toFloat(),first_used);
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void DC_Output_Channel::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
34
dc_output_channel.h
Normal file
34
dc_output_channel.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef DC_OUTPUT_CHANNEL_H
|
||||
#define DC_OUTPUT_CHANNEL_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QRadioButton>
|
||||
|
||||
namespace Ui {
|
||||
class DC_Output_Channel;
|
||||
}
|
||||
|
||||
class DC_Output_Channel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DC_Output_Channel(int slot_no_,QString unit_str_,int current_index_,QWidget *parent = nullptr);
|
||||
~DC_Output_Channel();
|
||||
signals:
|
||||
void output_channel_data_sg(int channel,float minmun,float maxmum,int not_used);
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
private:
|
||||
Ui::DC_Output_Channel *ui;
|
||||
QString unit_str;
|
||||
int current_index;
|
||||
int first_used;
|
||||
int slot_no;
|
||||
QRadioButton *radiobtn[5];
|
||||
};
|
||||
|
||||
#endif // DC_OUTPUT_CHANNEL_H
|
||||
225
dc_output_channel.ui
Normal file
225
dc_output_channel.ui
Normal file
@ -0,0 +1,225 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DC_Output_Channel</class>
|
||||
<widget class="QWidget" name="DC_Output_Channel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>527</width>
|
||||
<height>416</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>输出通道</string>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>50</y>
|
||||
<width>391</width>
|
||||
<height>181</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>4 - 20 mA 输出</string>
|
||||
</property>
|
||||
<widget class="QRadioButton" name="radioButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>30</y>
|
||||
<width>89</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道1</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>60</y>
|
||||
<width>89</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道2</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>90</y>
|
||||
<width>89</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道3</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>120</y>
|
||||
<width>89</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道4</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>150</y>
|
||||
<width>89</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>不使用</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>360</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确认</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>360</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>260</y>
|
||||
<width>250</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_minmum">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_min_unit">
|
||||
<property name="text">
|
||||
<string>- -</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>最小值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>300</y>
|
||||
<width>250</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_maxmum">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_max_unit">
|
||||
<property name="text">
|
||||
<string>- -</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>最大值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
464
dc_outputs.cpp
Normal file
464
dc_outputs.cpp
Normal file
@ -0,0 +1,464 @@
|
||||
#include "dc_outputs.h"
|
||||
#include "ui_dc_outputs.h"
|
||||
#include <QListView>
|
||||
#include "dc_output_channel.h"
|
||||
#include <QDebug>
|
||||
#include "config_mgr.h"
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include <QStandardItemModel>
|
||||
|
||||
ChannelUsed ch_used[SLOT_NUM][22];
|
||||
|
||||
DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::DC_Outputs)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->comboBox_ch_output->setView(new QListView());
|
||||
slot_no = slot_no_;
|
||||
car_type = static_cast<CardType>(cardtype);
|
||||
unit = "";
|
||||
current_index = ui->comboBox_ch_output->currentIndex();
|
||||
label_ch1[0] = ui->label_ch_1;
|
||||
label_ch1[1] = ui->label_ch_1_min;
|
||||
label_ch1[2] = ui->label_ch_1_min_unit;
|
||||
label_ch1[3] = ui->label_ch_1_max;
|
||||
label_ch1[4] = ui->label_ch_1_max_unit;
|
||||
|
||||
label_ch2[0] = ui->label_ch_2;
|
||||
label_ch2[1] = ui->label_ch_2_min;
|
||||
label_ch2[2] = ui->label_ch_2_min_unit;
|
||||
label_ch2[3] = ui->label_ch_2_max;
|
||||
label_ch2[4] = ui->label_ch_2_max_unit;
|
||||
|
||||
label_ch3[0] = ui->label_ch_3;
|
||||
label_ch3[1] = ui->label_ch_3_min;
|
||||
label_ch3[2] = ui->label_ch_3_min_unit;
|
||||
label_ch3[3] = ui->label_ch_3_max;
|
||||
label_ch3[4] = ui->label_ch_3_max_unit;
|
||||
|
||||
label_ch4[0] = ui->label_ch_4;
|
||||
label_ch4[1] = ui->label_ch_4_min;
|
||||
label_ch4[2] = ui->label_ch_4_min_unit;
|
||||
label_ch4[3] = ui->label_ch_4_max;
|
||||
label_ch4[4] = ui->label_ch_4_max_unit;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
DC_Outputs::~DC_Outputs()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DC_Outputs::Init(){
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[DC_Outputs::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
if (car_type == kCardHighSpeedCurrent) {
|
||||
hsc_dc_output_ptr = std::dynamic_pointer_cast<HighSpeedCurrentData>(base_ptr);
|
||||
if (hsc_dc_output_ptr == nullptr) {
|
||||
qCritical() << "[DC_Outputs::Init] high speed current data is null";
|
||||
return;
|
||||
}
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(ui->comboBox_ch_output->model());
|
||||
if (model != nullptr) {
|
||||
for (int i = 6; i < ui->comboBox_ch_output->count(); ++i) {
|
||||
model->item(i)->setEnabled(false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vib_dc_output_ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
}
|
||||
QString unit_str = "";
|
||||
|
||||
DCOutput *dc_output = GetDcOutputArray();
|
||||
if (dc_output == nullptr) {
|
||||
qCritical() << "[DC_Outputs::Init] dc_output is null";
|
||||
return;
|
||||
}
|
||||
if(dc_output[0].output_channel != -1){
|
||||
unit_str = GetUnit(dc_output[0].output_channel);
|
||||
ui->label_ch_1->setText(ui->comboBox_ch_output->itemText(dc_output[0].output_channel));
|
||||
ui->label_ch_1_min->setText(QString::number(dc_output[0].minmum));
|
||||
ui->label_ch_1_max->setText(QString::number(dc_output[0].maxmum));
|
||||
ui->label_ch_1_min_unit->setText(unit_str);
|
||||
ui->label_ch_1_max_unit->setText(unit_str);
|
||||
ch_used[slot_no][dc_output[0].output_channel].used[0] = true;
|
||||
}
|
||||
if(dc_output[1].output_channel != -1){
|
||||
unit_str = GetUnit(dc_output[1].output_channel);
|
||||
ui->label_ch_2->setText(ui->comboBox_ch_output->itemText(dc_output[1].output_channel));
|
||||
ui->label_ch_2_min->setText(QString::number(dc_output[1].minmum));
|
||||
ui->label_ch_2_max->setText(QString::number(dc_output[1].maxmum));
|
||||
ui->label_ch_2_min_unit->setText(unit_str);
|
||||
ui->label_ch_2_max_unit->setText(unit_str);
|
||||
ch_used[slot_no][dc_output[1].output_channel].used[1] = true;
|
||||
}
|
||||
if(dc_output[2].output_channel != -1){
|
||||
unit_str = GetUnit(dc_output[2].output_channel);
|
||||
ui->label_ch_3->setText(ui->comboBox_ch_output->itemText(dc_output[2].output_channel));
|
||||
ui->label_ch_3_min->setText(QString::number(dc_output[2].minmum));
|
||||
ui->label_ch_3_max->setText(QString::number(dc_output[2].maxmum));
|
||||
ui->label_ch_3_min_unit->setText(unit_str);
|
||||
ui->label_ch_3_max_unit->setText(unit_str);
|
||||
ch_used[slot_no][dc_output[2].output_channel].used[2] = true;
|
||||
}
|
||||
if(dc_output[3].output_channel != -1){
|
||||
unit_str = GetUnit(dc_output[3].output_channel);
|
||||
ui->label_ch_4->setText(ui->comboBox_ch_output->itemText(dc_output[3].output_channel));
|
||||
ui->label_ch_4_min->setText(QString::number(dc_output[3].minmum));
|
||||
ui->label_ch_4_max->setText(QString::number(dc_output[3].maxmum));
|
||||
ui->label_ch_4_min_unit->setText(unit_str);
|
||||
ui->label_ch_4_max_unit->setText(unit_str);
|
||||
ch_used[slot_no][dc_output[3].output_channel].used[3] = true;
|
||||
}
|
||||
}
|
||||
|
||||
QString DC_Outputs::GetUnit(int com_index){
|
||||
if (car_type == kCardHighSpeedCurrent) {
|
||||
if (hsc_dc_output_ptr == nullptr) {
|
||||
return "";
|
||||
}
|
||||
int channel_num = com_index;
|
||||
if (com_index == 4) {
|
||||
channel_num = 0;
|
||||
} else if (com_index == 5) {
|
||||
channel_num = 2;
|
||||
}
|
||||
if (channel_num < 0 || channel_num >= CHANNEL_COUNT_SPEED) {
|
||||
return "";
|
||||
}
|
||||
return hsc_dc_output_ptr->variables_[channel_num].engineering_unit;
|
||||
}
|
||||
int unit_num = -1,channel_num = 0;
|
||||
QString unit_str = "";
|
||||
channel_num = com_index;
|
||||
if(com_index > 5 && com_index < 9){
|
||||
channel_num = 0;
|
||||
}
|
||||
if(com_index > 9 && com_index < 13){
|
||||
channel_num = 1;
|
||||
}
|
||||
if(com_index > 13 && com_index < 17){
|
||||
channel_num = 2;
|
||||
}
|
||||
if(com_index > 17 && com_index < 21){
|
||||
channel_num = 3;
|
||||
}
|
||||
if(com_index == 4) {
|
||||
channel_num = 0;
|
||||
}else if(com_index == 5){
|
||||
channel_num = 2;
|
||||
}
|
||||
std::shared_ptr<VariableBase> variable_base = vib_dc_output_ptr->GetChannelPtr(channel_num + 1);
|
||||
// if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibRadial) {
|
||||
// std::shared_ptr<RadialVariable> variable_ptr = std::dynamic_pointer_cast<RadialVariable>(variable_base);
|
||||
// unit_num = variable_ptr->general.engineering_unit;
|
||||
// qDebug() << "unit_num1" << unit_num ;
|
||||
// }
|
||||
// if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibAcc) {
|
||||
// std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||
// unit_num = variable_ptr->general.engineering_unit;
|
||||
// qDebug() << "unit_num2" << unit_num ;
|
||||
// }
|
||||
// if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibVelocity) {
|
||||
// std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||
// unit_num = variable_ptr->general.engineering_unit;
|
||||
// qDebug() << "unit_num3" << unit_num ;
|
||||
// }
|
||||
// if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibThrust) {
|
||||
// std::shared_ptr<ThrustVariable> variable_ptr = std::dynamic_pointer_cast<ThrustVariable>(variable_base);
|
||||
// unit_num = vib_dc_output_ptr->base_config_[channel_num].sensitivity_unit;
|
||||
// qDebug() << "unit_num4" << unit_num ;
|
||||
// }
|
||||
//if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibPressurePulsation) {
|
||||
unit_num = vib_dc_output_ptr->base_config_[channel_num].sensitivity_unit;
|
||||
qDebug() << "unit_num5" << unit_num ;
|
||||
//}
|
||||
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;
|
||||
}
|
||||
|
||||
DCOutput *DC_Outputs::GetDcOutputArray(){
|
||||
if (car_type == kCardHighSpeedCurrent) {
|
||||
if (hsc_dc_output_ptr == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return hsc_dc_output_ptr->dc_output;
|
||||
}
|
||||
if (vib_dc_output_ptr == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return vib_dc_output_ptr->dc_output;
|
||||
}
|
||||
void DC_Outputs::on_comboBox_ch_output_activated(int index)
|
||||
{
|
||||
current_index = index;
|
||||
QString unit_str = GetUnit(current_index);
|
||||
DC_Output_Channel *dc_output_channel = new DC_Output_Channel(slot_no,unit_str,current_index);
|
||||
dc_output_channel->setWindowModality(Qt::ApplicationModal);
|
||||
connect(dc_output_channel,SIGNAL(output_channel_data_sg(int,float,float,int)),this,SLOT(output_channel_data(int,float,float,int)));
|
||||
dc_output_channel->show();
|
||||
}
|
||||
|
||||
void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int not_used){
|
||||
qDebug() << channel << minmun << maxmum ;
|
||||
QString unit_str = GetUnit(current_index);
|
||||
DCOutput *dc_output = GetDcOutputArray();
|
||||
if (dc_output == nullptr) {
|
||||
qCritical() << "[DC_Outputs::output_channel_data] dc_output is null";
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
if(ch_used[slot_no][current_index].used[i] && i != (channel - 1)){
|
||||
if(i == 0){
|
||||
label_ch1[0]->setText("未使用");
|
||||
label_ch1[1]->setText("-----");
|
||||
label_ch1[2]->setText("-----");
|
||||
label_ch1[3]->setText("-----");
|
||||
label_ch1[4]->setText("-----");
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = false;
|
||||
dc_output[0].output_channel = -1;
|
||||
}else if(i == 1){
|
||||
label_ch2[0]->setText("未使用");
|
||||
label_ch2[1]->setText("-----");
|
||||
label_ch2[2]->setText("-----");
|
||||
label_ch2[3]->setText("-----");
|
||||
label_ch2[4]->setText("-----");
|
||||
ch_used[slot_no][current_index].used[1] = false;
|
||||
dc_output[1].output_channel = -1;
|
||||
}else if(i == 2){
|
||||
label_ch3[0]->setText("未使用");
|
||||
label_ch3[1]->setText("-----");
|
||||
label_ch3[2]->setText("-----");
|
||||
label_ch3[3]->setText("-----");
|
||||
label_ch3[4]->setText("-----");
|
||||
ch_used[slot_no][current_index].used[2] = false;
|
||||
dc_output[2].output_channel = -1;
|
||||
}else if(i == 3){
|
||||
label_ch4[0]->setText("未使用");
|
||||
label_ch4[1]->setText("-----");
|
||||
label_ch4[2]->setText("-----");
|
||||
label_ch4[3]->setText("-----");
|
||||
label_ch4[4]->setText("-----");
|
||||
ch_used[slot_no][current_index].used[3] = false;
|
||||
dc_output[3].output_channel = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(channel == 1){
|
||||
ui->label_ch_1->setText(ui->comboBox_ch_output->currentText());
|
||||
ui->label_ch_1_min->setText(QString::number(minmun));
|
||||
ui->label_ch_1_max->setText(QString::number(maxmum));
|
||||
ui->label_ch_1_min_unit->setText(unit_str);
|
||||
ui->label_ch_1_max_unit->setText(unit_str);
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = true;
|
||||
dc_output[0].output_channel = current_index;
|
||||
dc_output[0].minmum = ui->label_ch_1_min->text().toFloat();
|
||||
dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat();
|
||||
}else if(channel == 2){
|
||||
ui->label_ch_2->setText(ui->comboBox_ch_output->currentText());
|
||||
ui->label_ch_2_min->setText(QString::number(minmun));
|
||||
ui->label_ch_2_max->setText(QString::number(maxmum));
|
||||
ui->label_ch_2_min_unit->setText(unit_str);
|
||||
ui->label_ch_2_max_unit->setText(unit_str);
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[1] = true;
|
||||
dc_output[1].output_channel = current_index;
|
||||
dc_output[1].minmum = ui->label_ch_2_min->text().toFloat();
|
||||
dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat();
|
||||
}else if(channel == 3){
|
||||
ui->label_ch_3->setText(ui->comboBox_ch_output->currentText());
|
||||
ui->label_ch_3_min->setText(QString::number(minmun));
|
||||
ui->label_ch_3_max->setText(QString::number(maxmum));
|
||||
ui->label_ch_3_min_unit->setText(unit_str);
|
||||
ui->label_ch_3_max_unit->setText(unit_str);
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[2] = true;
|
||||
dc_output[2].output_channel = current_index;
|
||||
dc_output[2].minmum = ui->label_ch_3_min->text().toFloat();
|
||||
dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat();
|
||||
}else if(channel == 4){
|
||||
ui->label_ch_4->setText(ui->comboBox_ch_output->currentText());
|
||||
ui->label_ch_4_min->setText(QString::number(minmun));
|
||||
ui->label_ch_4_max->setText(QString::number(maxmum));
|
||||
ui->label_ch_4_min_unit->setText(unit_str);
|
||||
ui->label_ch_4_max_unit->setText(unit_str);
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[3] = true;
|
||||
dc_output[3].output_channel = current_index;
|
||||
dc_output[3].minmum = ui->label_ch_4_min->text().toFloat();
|
||||
dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat();
|
||||
}else if(channel == 5){
|
||||
if(not_used == 0){
|
||||
label_ch1[0]->setText("未使用");
|
||||
label_ch1[1]->setText("-----");
|
||||
label_ch1[2]->setText("-----");
|
||||
label_ch1[3]->setText("-----");
|
||||
label_ch1[4]->setText("-----");
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = false;
|
||||
dc_output[0].output_channel = -1;
|
||||
}else if(not_used == 1){
|
||||
label_ch2[0]->setText("未使用");
|
||||
label_ch2[1]->setText("-----");
|
||||
label_ch2[2]->setText("-----");
|
||||
label_ch2[3]->setText("-----");
|
||||
label_ch2[4]->setText("-----");
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[1] = false;
|
||||
dc_output[1].output_channel = -1;
|
||||
}else if(not_used == 2){
|
||||
label_ch3[0]->setText("未使用");
|
||||
label_ch3[1]->setText("-----");
|
||||
label_ch3[2]->setText("-----");
|
||||
label_ch3[3]->setText("-----");
|
||||
label_ch3[4]->setText("-----");
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[2] = false;
|
||||
dc_output[2].output_channel = -1;
|
||||
}else if(not_used == 3){
|
||||
label_ch4[0]->setText("未使用");
|
||||
label_ch4[1]->setText("-----");
|
||||
label_ch4[2]->setText("-----");
|
||||
label_ch4[3]->setText("-----");
|
||||
label_ch4[4]->setText("-----");
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[3] = false;
|
||||
dc_output[3].output_channel = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DC_Outputs::on_pushButton_confirm_clicked()
|
||||
{
|
||||
|
||||
// if(ui->label_ch_1->text() != "未使用" && current_index){
|
||||
// vib_dc_output_ptr->dc_output[0].output_channel = current_index;
|
||||
// vib_dc_output_ptr->dc_output[0].dc_output_channel = 1;
|
||||
// vib_dc_output_ptr->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat();
|
||||
// vib_dc_output_ptr->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat();
|
||||
// }
|
||||
// if(ui->label_ch_2->text() != "未使用"){
|
||||
// vib_dc_output_ptr->dc_output[1].output_channel = current_index;
|
||||
// vib_dc_output_ptr->dc_output[1].dc_output_channel = 2;
|
||||
// vib_dc_output_ptr->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat();
|
||||
// vib_dc_output_ptr->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat();
|
||||
// }
|
||||
// if(ui->label_ch_3->text() != "未使用"){
|
||||
// vib_dc_output_ptr->dc_output[2].output_channel = current_index;
|
||||
// vib_dc_output_ptr->dc_output[2].dc_output_channel = 3;
|
||||
// vib_dc_output_ptr->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat();
|
||||
// vib_dc_output_ptr->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat();
|
||||
// }
|
||||
// if(ui->label_ch_4->text() != "未使用"){
|
||||
// vib_dc_output_ptr->dc_output[3].output_channel = current_index;
|
||||
// vib_dc_output_ptr->dc_output[3].dc_output_channel = 4;
|
||||
// vib_dc_output_ptr->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat();
|
||||
// vib_dc_output_ptr->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat();
|
||||
// }
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void DC_Outputs::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void DC_Outputs::on_comboBox_ch_output_currentIndexChanged(int index)
|
||||
{
|
||||
qDebug() << "on_comboBox_ch_output_currentIndexChanged" ;
|
||||
// if(ui->label_ch_1->text() != "未使用"){
|
||||
// vib_dc_output_ptr->dc_output[0].output_channel = current_index;
|
||||
// vib_dc_output_ptr->dc_output[0].dc_output_channel = 1;
|
||||
// vib_dc_output_ptr->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat();
|
||||
// vib_dc_output_ptr->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat();
|
||||
// }
|
||||
// if(ui->label_ch_2->text() != "未使用"){
|
||||
// vib_dc_output_ptr->dc_output[1].output_channel = current_index;
|
||||
// vib_dc_output_ptr->dc_output[1].dc_output_channel = 2;
|
||||
// vib_dc_output_ptr->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat();
|
||||
// vib_dc_output_ptr->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat();
|
||||
// }
|
||||
// if(ui->label_ch_3->text() != "未使用"){
|
||||
// vib_dc_output_ptr->dc_output[2].output_channel = current_index;
|
||||
// vib_dc_output_ptr->dc_output[2].dc_output_channel = 3;
|
||||
// vib_dc_output_ptr->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat();
|
||||
// vib_dc_output_ptr->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat();
|
||||
// }
|
||||
// if(ui->label_ch_4->text() != "未使用"){
|
||||
// vib_dc_output_ptr->dc_output[3].output_channel = current_index;
|
||||
// vib_dc_output_ptr->dc_output[3].dc_output_channel = 4;
|
||||
// vib_dc_output_ptr->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat();
|
||||
// vib_dc_output_ptr->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat();
|
||||
// }
|
||||
|
||||
// current_index = index;
|
||||
// QString unit_str = GetUnit();
|
||||
// if(vib_dc_output_ptr->dc_output[0].dc_output_channel == 1 && current_index == vib_dc_output_ptr->dc_output[0].output_channel){
|
||||
// ui->label_ch_1->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[0].output_channel));
|
||||
// ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[0].minmum));
|
||||
// ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[0].maxmum));
|
||||
// ch_used[slot_no][current_index].used[0] = true;
|
||||
// }
|
||||
// if(vib_dc_output_ptr->dc_output[1].dc_output_channel == 2 && current_index == vib_dc_output_ptr->dc_output[1].output_channel){
|
||||
// ui->label_ch_2->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[1].output_channel));
|
||||
// ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[1].minmum));
|
||||
// ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[1].maxmum));
|
||||
// ch_used[slot_no][current_index].used[1] = true;
|
||||
// }
|
||||
// if(vib_dc_output_ptr->dc_output[2].dc_output_channel == 3 && current_index == vib_dc_output_ptr->dc_output[2].output_channel){
|
||||
// ui->label_ch_3->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[2].output_channel));
|
||||
// ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[2].minmum));
|
||||
// ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[2].maxmum));
|
||||
// ch_used[slot_no][current_index].used[2] = true;
|
||||
// }
|
||||
// if(vib_dc_output_ptr->dc_output[3].dc_output_channel == 4 && current_index == vib_dc_output_ptr->dc_output[3].output_channel){
|
||||
// ui->label_ch_4->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[3].output_channel));
|
||||
// ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[3].minmum));
|
||||
// ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[3].maxmum));
|
||||
// ch_used[slot_no][current_index].used[3] = true;
|
||||
// }
|
||||
}
|
||||
|
||||
48
dc_outputs.h
Normal file
48
dc_outputs.h
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef DC_OUTPUTS_H
|
||||
#define DC_OUTPUTS_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "high_speed_current_data.h"
|
||||
|
||||
namespace Ui {
|
||||
class DC_Outputs;
|
||||
}
|
||||
|
||||
class DC_Outputs : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DC_Outputs(int slot_no_,int cardtype,QWidget *parent = nullptr);
|
||||
~DC_Outputs();
|
||||
int slot_no;
|
||||
CardType car_type;
|
||||
private slots:
|
||||
void on_comboBox_ch_output_activated(int index);
|
||||
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
void output_channel_data(int channel,float minmun,float maxmum,int not_used);
|
||||
|
||||
void on_comboBox_ch_output_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::DC_Outputs *ui;
|
||||
std::shared_ptr<VibrationData> vib_dc_output_ptr = nullptr;
|
||||
std::shared_ptr<HighSpeedCurrentData> hsc_dc_output_ptr = nullptr;
|
||||
void Init();
|
||||
QString GetUnit(int com_index);
|
||||
DCOutput *GetDcOutputArray();
|
||||
QLabel *label_ch1[5];
|
||||
QLabel *label_ch2[5];
|
||||
QLabel *label_ch3[5];
|
||||
QLabel *label_ch4[5];
|
||||
int current_index;
|
||||
QString unit;
|
||||
};
|
||||
|
||||
#endif // DC_OUTPUTS_H
|
||||
528
dc_outputs.ui
Normal file
528
dc_outputs.ui
Normal file
@ -0,0 +1,528 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DC_Outputs</class>
|
||||
<widget class="QWidget" name="DC_Outputs">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>727</width>
|
||||
<height>450</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>直流输出</string>
|
||||
</property>
|
||||
<widget class="QComboBox" name="comboBox_ch_output">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>40</y>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道1 输出1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道2 输出1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道3 输出1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道4 输出1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道1 & 通道2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道3 & 通道4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道1 分频段1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道1 分频段2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道1 分频段3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道1 分频段4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道2 分频段1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道2 分频段2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道2 分频段3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道2 分频段4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道3 分频段1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道3 分频段2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道3 分频段3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道3 分频段4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道4 分频段1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道4 分频段2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道4 分频段3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道4 分频段4</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>160</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>200</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>240</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>280</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>110</y>
|
||||
<width>101</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IOC 直流 输出</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>110</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>最小值</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>110</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>最大值</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>160</y>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>未使用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>200</y>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>未使用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>240</y>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>未使用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>280</y>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>未使用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_1_min">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>160</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_2_min">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>200</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_1_max">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>160</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_2_max">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>200</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_3_min">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>240</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_4_min">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>280</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_3_max">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>240</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_4_max">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>280</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>380</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确认</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>380</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_1_min_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>160</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_1_max_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>160</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_2_min_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>200</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_2_max_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>200</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_3_min_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>240</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_3_max_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>240</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_4_min_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>280</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_4_max_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>280</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
21
displacement_ds.h
Normal file
21
displacement_ds.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef DISPLACEMENT_DS_H
|
||||
#define DISPLACEMENT_DS_H
|
||||
// 位移峰峰值的量程范围
|
||||
typedef enum {
|
||||
kDisPP100 = 0, // 0-100 um
|
||||
kDisPP150 = 1, // 0-150 um
|
||||
kDisPP200 = 2, // 0-200 um
|
||||
kDisPP400 = 3, // 0-400 um
|
||||
kDisPP500 = 4, // 0-500 um
|
||||
kDisPPCustom = 5 // custom
|
||||
} DisPPFullScaleRange;
|
||||
|
||||
// recorder out
|
||||
typedef enum {
|
||||
kDisRecorderOutNone = 0,
|
||||
kDisRecorderOutDirectAmpl = 1,
|
||||
kDisRecorderOut1XAmpl = 2,
|
||||
kDisRecorderOut2XAmpl = 3
|
||||
} DisRecorderOut;
|
||||
|
||||
#endif // DISPLACEMENT_DS_H
|
||||
0
doc/ReadME.txt
Normal file
0
doc/ReadME.txt
Normal file
@ -1,46 +0,0 @@
|
||||
{
|
||||
"version": 1,
|
||||
"slot":1,
|
||||
"id":1,
|
||||
"rms_active":true,
|
||||
"integrate_active":true,
|
||||
"variables":[
|
||||
{
|
||||
"type":"direct",
|
||||
"full_sacle_range":"0-20 m/s^2 pk",
|
||||
"clamp_value":1.25
|
||||
},
|
||||
{
|
||||
"type":"bias_volt",
|
||||
"bias_voltage": -24,
|
||||
"clamp_value":1.25
|
||||
},
|
||||
{
|
||||
"type":"1x_ampl",
|
||||
"full_sacle_range":"0-2 m/s^2 pk",
|
||||
"clamp_value":1.25,
|
||||
"phase_lag":180,
|
||||
"checked":true
|
||||
},
|
||||
{
|
||||
"type":"2x_ampl",
|
||||
"full_sacle_range":"0-2 m/s^2 pk",
|
||||
"clamp_value":1.25,
|
||||
"phase_lag":180,
|
||||
"checked":true
|
||||
}
|
||||
],
|
||||
"delay":{
|
||||
"alert":30,
|
||||
"danger":30.0,
|
||||
"100ms":true
|
||||
},
|
||||
"alert_latching":true,
|
||||
"danger_latching":true,
|
||||
"timed_ok":true,
|
||||
"recorder_output":"direct",
|
||||
"two_ma_clamp":true,
|
||||
"trip_mutiply":1.00,
|
||||
"comparision":"direct",
|
||||
"comparision_percentage":5
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
{
|
||||
"slot":1,
|
||||
"id":1,
|
||||
"filter":[
|
||||
{
|
||||
"type":"high_pass",
|
||||
"low":5,
|
||||
"high":1000,
|
||||
"checked":true
|
||||
},
|
||||
{
|
||||
"type":"low_pass",
|
||||
"low":5,
|
||||
"high":1000,
|
||||
"checked":true
|
||||
},
|
||||
{
|
||||
"type":"band_pass",
|
||||
"low":5,
|
||||
"high":1000,
|
||||
"checked":true
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -7,49 +7,49 @@
|
||||
},
|
||||
{
|
||||
"chan_display": "振动",
|
||||
"rack_type": "",
|
||||
"rack_type": "Single",
|
||||
"slot": 1,
|
||||
"slot_type": "HAM824"
|
||||
},
|
||||
{
|
||||
"chan_display": "振动",
|
||||
"rack_type": "",
|
||||
"rack_type": "Single",
|
||||
"slot": 2,
|
||||
"slot_type": "HAM824"
|
||||
},
|
||||
{
|
||||
"chan_display": "振动",
|
||||
"rack_type": "",
|
||||
"rack_type": "Single",
|
||||
"slot": 3,
|
||||
"slot_type": "HAM824"
|
||||
},
|
||||
{
|
||||
"chan_display": "振动",
|
||||
"rack_type": "",
|
||||
"rack_type": "Single",
|
||||
"slot": 4,
|
||||
"slot_type": "HAM824"
|
||||
},
|
||||
{
|
||||
"chan_display": "键相",
|
||||
"rack_type": "",
|
||||
"rack_type": "Single",
|
||||
"slot": 5,
|
||||
"slot_type": "KPM834"
|
||||
},
|
||||
{
|
||||
"chan_display": "键相",
|
||||
"rack_type": "",
|
||||
"rack_type": "Single",
|
||||
"slot": 6,
|
||||
"slot_type": "KPM834"
|
||||
},
|
||||
{
|
||||
"chan_display": "键相",
|
||||
"rack_type": "",
|
||||
"rack_type": "Single",
|
||||
"slot": 7,
|
||||
"slot_type": "KPM834"
|
||||
},
|
||||
{
|
||||
"chan_display": "转速",
|
||||
"rack_type": "",
|
||||
"rack_type": "Single",
|
||||
"slot": 8,
|
||||
"slot_type": "OPM844"
|
||||
},
|
||||
@ -73,25 +73,25 @@
|
||||
},
|
||||
{
|
||||
"chan_display": "继电器",
|
||||
"rack_type": "",
|
||||
"rack_type": "Single",
|
||||
"slot": 12,
|
||||
"slot_type": "DOM810"
|
||||
},
|
||||
{
|
||||
"chan_display": "三冗余继电器",
|
||||
"rack_type": "",
|
||||
"rack_type": "TMR1",
|
||||
"slot": 13,
|
||||
"slot_type": "DOM810"
|
||||
},
|
||||
{
|
||||
"chan_display": "三冗余继电器",
|
||||
"rack_type": "",
|
||||
"rack_type": "TMR2",
|
||||
"slot": 14,
|
||||
"slot_type": "DOM810"
|
||||
},
|
||||
{
|
||||
"chan_display": "三冗余继电器",
|
||||
"rack_type": "",
|
||||
"rack_type": "TMR3",
|
||||
"slot": 15,
|
||||
"slot_type": "DOM810"
|
||||
}
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
{
|
||||
"card_type": 1,
|
||||
"chan": [
|
||||
{
|
||||
"active": true,
|
||||
"channel_name": "",
|
||||
"channel_type": "acceleration",
|
||||
"id": 1,
|
||||
"normal_voltage_range": [
|
||||
0,
|
||||
21
|
||||
],
|
||||
"rack_type": "TMR",
|
||||
"sample_rate": "32 k",
|
||||
"scale_factor": "10",
|
||||
"standby": true,
|
||||
"tmr_group": "1-3",
|
||||
"transducer_name": ""
|
||||
},
|
||||
{
|
||||
"active": true,
|
||||
"channel_name": "",
|
||||
"channel_type": "acceleration",
|
||||
"id": 2,
|
||||
"normal_voltage_range": [
|
||||
0,
|
||||
21
|
||||
],
|
||||
"rack_type": "TMR",
|
||||
"sample_rate": "32 k",
|
||||
"scale_factor": "10",
|
||||
"standby": true,
|
||||
"tmr_group": "1-3",
|
||||
"transducer_name": ""
|
||||
},
|
||||
{
|
||||
"active": true,
|
||||
"channel_name": "",
|
||||
"channel_type": "velocity",
|
||||
"id": 3,
|
||||
"normal_voltage_range": [
|
||||
0,
|
||||
21
|
||||
],
|
||||
"rack_type": "TMR",
|
||||
"sample_rate": "32 k",
|
||||
"scale_factor": "10",
|
||||
"standby": true,
|
||||
"tmr_group": "3-5",
|
||||
"transducer_name": ""
|
||||
},
|
||||
{
|
||||
"active": true,
|
||||
"channel_name": "",
|
||||
"channel_type": "velocity",
|
||||
"id": 4,
|
||||
"normal_voltage_range": [
|
||||
0,
|
||||
21
|
||||
],
|
||||
"rack_type": "TMR",
|
||||
"sample_rate": "32 k",
|
||||
"scale_factor": "10",
|
||||
"standby": true,
|
||||
"tmr_group": "3-5",
|
||||
"transducer_name": ""
|
||||
}
|
||||
],
|
||||
"slot": 3,
|
||||
"version": 1
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
{
|
||||
"card_type": 1,
|
||||
"chan": [
|
||||
{
|
||||
"active": true,
|
||||
"channel_name": "",
|
||||
"channel_type": "",
|
||||
"id": -1973791,
|
||||
"normal_voltage_range": [
|
||||
null,
|
||||
null
|
||||
],
|
||||
"rack_type": "",
|
||||
"sample_rate": "",
|
||||
"scale_factor": "",
|
||||
"standby": true,
|
||||
"tmr_group": "",
|
||||
"transducer_name": ""
|
||||
},
|
||||
{
|
||||
"active": true,
|
||||
"channel_name": "",
|
||||
"channel_type": "",
|
||||
"id": -1973791,
|
||||
"normal_voltage_range": [
|
||||
null,
|
||||
null
|
||||
],
|
||||
"rack_type": "",
|
||||
"sample_rate": "",
|
||||
"scale_factor": "",
|
||||
"standby": true,
|
||||
"tmr_group": "",
|
||||
"transducer_name": ""
|
||||
},
|
||||
{
|
||||
"active": true,
|
||||
"channel_name": "",
|
||||
"channel_type": "",
|
||||
"id": -1973791,
|
||||
"normal_voltage_range": [
|
||||
null,
|
||||
null
|
||||
],
|
||||
"rack_type": "",
|
||||
"sample_rate": "",
|
||||
"scale_factor": "",
|
||||
"standby": true,
|
||||
"tmr_group": "",
|
||||
"transducer_name": ""
|
||||
},
|
||||
{
|
||||
"active": true,
|
||||
"channel_name": "",
|
||||
"channel_type": "",
|
||||
"id": -1973791,
|
||||
"normal_voltage_range": [
|
||||
null,
|
||||
null
|
||||
],
|
||||
"rack_type": "",
|
||||
"sample_rate": "",
|
||||
"scale_factor": "",
|
||||
"standby": true,
|
||||
"tmr_group": "",
|
||||
"transducer_name": ""
|
||||
}
|
||||
],
|
||||
"slot": 4,
|
||||
"version": 1
|
||||
}
|
||||
4
doc/config/transducer.json
Normal file
4
doc/config/transducer.json
Normal file
@ -0,0 +1,4 @@
|
||||
[{"transducer_name":"测试1","scale_factor":1.25},
|
||||
{"transducer_name":"测试2","scale_factor":1.26},
|
||||
{"transducer_name":"测试3","scale_factor":1.27},
|
||||
{"transducer_name":"测试4","scale_factor":1.28}]
|
||||
47
ethconfig.cpp
Normal file
47
ethconfig.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
#include "ethconfig.h"
|
||||
#include "ui_ethconfig.h"
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionValidator>
|
||||
|
||||
|
||||
EthConfig::EthConfig(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::EthConfig)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QRegularExpression ipRegex(R"(^(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$)");
|
||||
QRegularExpressionValidator *ipValidator = new QRegularExpressionValidator(ipRegex, this);
|
||||
|
||||
ui->lineEdit_IP->setValidator(ipValidator);
|
||||
ui->lineEdit_netmask->setValidator(ipValidator);
|
||||
ui->lineEdit_gw->setValidator(ipValidator);
|
||||
}
|
||||
|
||||
EthConfig::~EthConfig()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void EthConfig::on_pushButton_confirm_clicked()
|
||||
{
|
||||
ConfigIPv4Req config_ip = { {0xAA, 0x55, 0xAA}, kRebootCard, 1,0,{},{},{} };
|
||||
config_ip.ethn = ui->comboBox_eth->currentIndex();
|
||||
memcpy(config_ip.ip,ui->lineEdit_IP->text().toStdString().c_str(),sizeof(config_ip.ip));
|
||||
memcpy(config_ip.netmask,ui->lineEdit_netmask->text().toStdString().c_str(),sizeof(config_ip.netmask));
|
||||
memcpy(config_ip.gw,ui->lineEdit_gw->text().toStdString().c_str(),sizeof(config_ip.gw));
|
||||
char send_buf[100] ={0};
|
||||
memcpy(send_buf, (char*)&config_ip, sizeof(ConfigIPv4Req));
|
||||
|
||||
int length = sizeof(ConfigIPv4Req);
|
||||
qint64 bytesWritten = m_tcpClient->sendData(send_buf, length);
|
||||
m_tcpClient->waitForRead();
|
||||
qDebug() << "bytesWritten: " << bytesWritten;
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void EthConfig::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
30
ethconfig.h
Normal file
30
ethconfig.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef ETHCONFIG_H
|
||||
#define ETHCONFIG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "MyTcpClient.h"
|
||||
|
||||
namespace Ui {
|
||||
class EthConfig;
|
||||
}
|
||||
|
||||
class EthConfig : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EthConfig(QWidget *parent = nullptr);
|
||||
~EthConfig();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
private:
|
||||
Ui::EthConfig *ui;
|
||||
|
||||
MyTcpClient* m_tcpClient;
|
||||
};
|
||||
|
||||
#endif // ETHCONFIG_H
|
||||
165
ethconfig.ui
Normal file
165
ethconfig.ui
Normal file
@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EthConfig</class>
|
||||
<widget class="QWidget" name="EthConfig">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>361</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>以太网配置</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>33</x>
|
||||
<y>40</y>
|
||||
<width>81</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>以太网:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_eth">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>40</y>
|
||||
<width>111</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>eth1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>eth2</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>90</y>
|
||||
<width>54</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IP:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>13</x>
|
||||
<y>120</y>
|
||||
<width>101</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>子网掩码:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>33</x>
|
||||
<y>150</y>
|
||||
<width>81</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>网关:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_IP">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>90</y>
|
||||
<width>113</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_netmask">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>120</y>
|
||||
<width>113</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_gw">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>150</y>
|
||||
<width>113</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>222</y>
|
||||
<width>71</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<y>222</y>
|
||||
<width>81</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
75
headerView.cpp
Normal file
75
headerView.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
#include "headerView.h"
|
||||
#include <QPainter>
|
||||
#include <QCheckBox>
|
||||
#include <QDebug>
|
||||
|
||||
CHeaderView::CHeaderView(Qt::Orientation orientation, QWidget *parent)
|
||||
: QHeaderView(orientation, parent)
|
||||
{
|
||||
//设置Section可点击,若不设置则不能发出sectionClicked信号
|
||||
this->setSectionsClickable(true);
|
||||
//当发出sectionClicked就进入匿名函数
|
||||
connect(this, &CHeaderView::sectionClicked, [=](int logicalIndex)
|
||||
{
|
||||
//判断map容器是否包含当前点击列,包含则更新并发出columnSectionClicked
|
||||
if(m_columpnCheckedMap.contains(logicalIndex))
|
||||
{
|
||||
//更新当前值
|
||||
m_columpnCheckedMap[logicalIndex] = !m_columpnCheckedMap[logicalIndex];
|
||||
//发出信号
|
||||
emit columnSectionClicked(logicalIndex, m_columpnCheckedMap[logicalIndex]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void CHeaderView::setColumnCheckable(int column, bool checkable)
|
||||
{
|
||||
//当可选值为true
|
||||
if(checkable)
|
||||
{
|
||||
//将指定列添加到map容器中
|
||||
m_columpnCheckedMap[column] = false;
|
||||
}
|
||||
else if(m_columpnCheckedMap.contains(column)) //当可选值为false,且map容器包含指定列
|
||||
{
|
||||
//移除指定列
|
||||
m_columpnCheckedMap.remove(column);
|
||||
}
|
||||
}
|
||||
|
||||
bool CHeaderView::getColumnCheckable(int column)
|
||||
{
|
||||
return m_columpnCheckedMap[column];
|
||||
}
|
||||
|
||||
void CHeaderView::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const
|
||||
{
|
||||
qDebug()<<"paintSection" << endl;
|
||||
painter->save(); //保存当前画笔状态
|
||||
QHeaderView::paintSection(painter, rect, logicalIndex);
|
||||
painter->restore(); //恢复保存的画笔状态
|
||||
|
||||
//当map容器包含当前列才绘制复选框
|
||||
if(m_columpnCheckedMap.contains(logicalIndex))
|
||||
{
|
||||
//创建样式对象并设置区域
|
||||
QStyleOptionButton styleOption;
|
||||
styleOption.rect = rect.adjusted(10, 0, 0, 0);
|
||||
styleOption.state = QStyle::State_Enabled;
|
||||
|
||||
//根据map中的值设置状态
|
||||
if(m_columpnCheckedMap[logicalIndex])
|
||||
{
|
||||
styleOption.state |= QStyle::State_On;
|
||||
}
|
||||
else
|
||||
{
|
||||
styleOption.state |= QStyle::State_Off;
|
||||
}
|
||||
|
||||
//调用this的style对象绘制复选框
|
||||
this->style()->drawControl(QStyle::CE_CheckBox, &styleOption, painter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
47
headerView.h
Normal file
47
headerView.h
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef HEADERVIEW_H
|
||||
#define HEADERVIEW_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QHeaderView>
|
||||
#include <QMap>
|
||||
|
||||
class CHeaderView : public QHeaderView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief CHeaderView 鏋勯€犲嚱鏁 * @param orientation 鏂瑰悜
|
||||
* @param parent 鐖剁被瀵硅薄
|
||||
*/
|
||||
CHeaderView(Qt::Orientation orientation, QWidget *parent = nullptr);
|
||||
|
||||
/**
|
||||
* @brief setColumnCheckable 璁剧疆鎸囧畾鍒楁槸鍚﹀彲閫 * @param column 鎸囧畾鍒 * @param checkable 鍙€夊€ */
|
||||
void setColumnCheckable(int column, bool checkable);
|
||||
|
||||
bool getColumnCheckable(int column);
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief columnSectionClicked Section鐐瑰嚮淇″彿
|
||||
* @param logicalIndex 鐐瑰嚮浣嶇疆
|
||||
* @param checked 閫変腑鍊 */
|
||||
void columnSectionClicked(int logicalIndex, bool checked);
|
||||
|
||||
// QHeaderView interface
|
||||
protected:
|
||||
/**
|
||||
* @brief paintSection 缁樺埗澶嶉€夋
|
||||
* @param painter 缁樺埗瀵硅薄
|
||||
* @param rect 缁樺埗鍖哄煙
|
||||
* @param logicalIndex 褰撳墠绱㈠紩浣嶇疆
|
||||
*/
|
||||
void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const;
|
||||
|
||||
private:
|
||||
QMap<int, bool> m_columpnCheckedMap; //鍖呭惈澶嶉€夋鍒楃殑map瀹瑰櫒
|
||||
|
||||
};
|
||||
|
||||
#endif // HEADERVIEW_H
|
||||
|
||||
354
high_speed_current.cpp
Normal file
354
high_speed_current.cpp
Normal file
@ -0,0 +1,354 @@
|
||||
#include "high_speed_current.h"
|
||||
#include "ui_high_speed_current.h"
|
||||
#include "config_mgr.h"
|
||||
#include <QMessageBox>
|
||||
#include <QDoubleValidator>
|
||||
#include <limits>
|
||||
#include "copy_channel.h"
|
||||
|
||||
HighSpeedCurrent::HighSpeedCurrent(int slot_no_,CardType cardtype,QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::HighSpeedCurrent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
slot_no = slot_no_;
|
||||
card_type = cardtype;
|
||||
QString slot = QString("%1").arg(slot_no);
|
||||
ui->label_slot->setText(slot);
|
||||
auto *double_validator = new QDoubleValidator(
|
||||
std::numeric_limits<double>::lowest(),
|
||||
std::numeric_limits<double>::max(),
|
||||
10,
|
||||
this);
|
||||
double_validator->setNotation(QDoubleValidator::StandardNotation);
|
||||
ui->lineEdit_fullScalePosition->setValidator(double_validator);
|
||||
ui->lineEdit_xfullScalePosition->setValidator(double_validator);
|
||||
ui->lineEdit_zeroScalePosition->setValidator(double_validator);
|
||||
ui->lineEdit_xzeroScalePosition->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_level->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_hysteresis->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_delay->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_level->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_hysteresis->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_delay->setValidator(double_validator);
|
||||
|
||||
ui->lineEdit_fullScalePosition_2->setValidator(double_validator);
|
||||
ui->lineEdit_xfullScalePosition_2->setValidator(double_validator);
|
||||
ui->lineEdit_zeroScalePosition_2->setValidator(double_validator);
|
||||
ui->lineEdit_xzeroScalePosition_2->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_level_2->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_hysteresis_2->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_delay_2->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_level_2->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_hysteresis_2->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_delay_2->setValidator(double_validator);
|
||||
|
||||
ui->lineEdit_fullScalePosition_3->setValidator(double_validator);
|
||||
ui->lineEdit_xfullScalePosition_3->setValidator(double_validator);
|
||||
ui->lineEdit_zeroScalePosition_3->setValidator(double_validator);
|
||||
ui->lineEdit_xzeroScalePosition_3->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_level_3->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_hysteresis_3->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_delay_3->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_level_3->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_hysteresis_3->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_delay_3->setValidator(double_validator);
|
||||
|
||||
ui->lineEdit_fullScalePosition_4->setValidator(double_validator);
|
||||
ui->lineEdit_xfullScalePosition_4->setValidator(double_validator);
|
||||
ui->lineEdit_zeroScalePosition_4->setValidator(double_validator);
|
||||
ui->lineEdit_xzeroScalePosition_4->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_level_4->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_hysteresis_4->setValidator(double_validator);
|
||||
ui->lineEdit_danger_high_delay_4->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_level_4->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_hysteresis_4->setValidator(double_validator);
|
||||
ui->lineEdit_alert_high_delay_4->setValidator(double_validator);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
HighSpeedCurrent::~HighSpeedCurrent()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void HighSpeedCurrent::UpdateData(std::shared_ptr<HighSpeedCurrentData> ¤t_data){
|
||||
|
||||
current_data->card_type_ = kCardHighSpeedCurrent;
|
||||
current_data->slot_ = slot_no;
|
||||
current_data->version_ = 1;
|
||||
for (int i = 0; i < CHANNEL_COUNT_SPEED; i++){
|
||||
if (i + 1 == 1) {
|
||||
current_data->variables_[i].active = ui->checkBox_chan_1->isChecked();
|
||||
current_data->variables_[i].engineering_unit = ui->lineEdit_engineeringUnit->text();
|
||||
current_data->variables_[i].fullScalePosition = ui->lineEdit_fullScalePosition->text().toFloat();
|
||||
current_data->variables_[i].xfullScalePosition = ui->lineEdit_xfullScalePosition->text().toFloat();
|
||||
current_data->variables_[i].zeroScalePosition = ui->lineEdit_zeroScalePosition->text().toFloat();
|
||||
current_data->variables_[i].xzeroScalePosition = ui->lineEdit_xzeroScalePosition->text().toFloat();
|
||||
current_data->variables_[i].rectifier_funtion = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
current_data->danger_high[i].level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
current_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
current_data->danger_high[i].delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
current_data->danger_high[i].enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
current_data->danger_high[i].latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
current_data->alert_high[i].level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
current_data->alert_high[i].hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
current_data->alert_high[i].delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
current_data->alert_high[i].enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
current_data->alert_high[i].latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
|
||||
}else if(i + 1 == 2){
|
||||
current_data->variables_[i].active = ui->checkBox_chan_2->isChecked();
|
||||
current_data->variables_[i].engineering_unit = ui->lineEdit_engineeringUnit_2->text();
|
||||
current_data->variables_[i].fullScalePosition = ui->lineEdit_fullScalePosition_2->text().toFloat();
|
||||
current_data->variables_[i].xfullScalePosition = ui->lineEdit_xfullScalePosition_2->text().toFloat();
|
||||
current_data->variables_[i].zeroScalePosition = ui->lineEdit_zeroScalePosition_2->text().toFloat();
|
||||
current_data->variables_[i].xzeroScalePosition = ui->lineEdit_xzeroScalePosition_2->text().toFloat();
|
||||
current_data->variables_[i].rectifier_funtion = ui->comboBox_rectifier_funtion_2->currentIndex();
|
||||
// -alarm
|
||||
current_data->danger_high[i].level = ui->lineEdit_danger_high_level_2->text().toDouble();
|
||||
current_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble();
|
||||
current_data->danger_high[i].delay = ui->lineEdit_danger_high_delay_2->text().toDouble();
|
||||
current_data->danger_high[i].enable = ui->checkBox_danger_high_enable_2->isChecked();
|
||||
current_data->danger_high[i].latch = ui->checkBox_danger_high_latch_2->isChecked();
|
||||
current_data->alert_high[i].level = ui->lineEdit_alert_high_level_2->text().toDouble();
|
||||
current_data->alert_high[i].hysteresis = ui->lineEdit_alert_high_hysteresis_2->text().toDouble();
|
||||
current_data->alert_high[i].delay = ui->lineEdit_alert_high_delay_2->text().toDouble();
|
||||
current_data->alert_high[i].enable = ui->checkBox_alert_high_enable_2->isChecked();
|
||||
current_data->alert_high[i].latch = ui->checkBox_alert_high_latch_2->isChecked();
|
||||
}else if(i + 1 == 3){
|
||||
current_data->variables_[i].active = ui->checkBox_chan_3->isChecked();
|
||||
current_data->variables_[i].engineering_unit = ui->lineEdit_engineeringUnit_3->text();
|
||||
current_data->variables_[i].fullScalePosition = ui->lineEdit_fullScalePosition_3->text().toFloat();
|
||||
current_data->variables_[i].xfullScalePosition = ui->lineEdit_xfullScalePosition_3->text().toFloat();
|
||||
current_data->variables_[i].zeroScalePosition = ui->lineEdit_zeroScalePosition_3->text().toFloat();
|
||||
current_data->variables_[i].xzeroScalePosition = ui->lineEdit_xzeroScalePosition_3->text().toFloat();
|
||||
current_data->variables_[i].rectifier_funtion = ui->comboBox_rectifier_funtion_3->currentIndex();
|
||||
// -alarm
|
||||
current_data->danger_high[i].level = ui->lineEdit_danger_high_level_3->text().toDouble();
|
||||
current_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_3->text().toDouble();
|
||||
current_data->danger_high[i].delay = ui->lineEdit_danger_high_delay_3->text().toDouble();
|
||||
current_data->danger_high[i].enable = ui->checkBox_danger_high_enable_3->isChecked();
|
||||
current_data->danger_high[i].latch = ui->checkBox_danger_high_latch_3->isChecked();
|
||||
current_data->alert_high[i].level = ui->lineEdit_alert_high_level_3->text().toDouble();
|
||||
current_data->alert_high[i].hysteresis = ui->lineEdit_alert_high_hysteresis_3->text().toDouble();
|
||||
current_data->alert_high[i].delay = ui->lineEdit_alert_high_delay_3->text().toDouble();
|
||||
current_data->alert_high[i].enable = ui->checkBox_alert_high_enable_3->isChecked();
|
||||
current_data->alert_high[i].latch = ui->checkBox_alert_high_latch_3->isChecked();
|
||||
}else if(i + 1 == 4){
|
||||
current_data->variables_[i].active = ui->checkBox_chan_4->isChecked();
|
||||
current_data->variables_[i].engineering_unit = ui->lineEdit_engineeringUnit_4->text();
|
||||
current_data->variables_[i].fullScalePosition = ui->lineEdit_fullScalePosition_4->text().toFloat();
|
||||
current_data->variables_[i].xfullScalePosition = ui->lineEdit_xfullScalePosition_4->text().toFloat();
|
||||
current_data->variables_[i].zeroScalePosition = ui->lineEdit_zeroScalePosition_4->text().toFloat();
|
||||
current_data->variables_[i].xzeroScalePosition = ui->lineEdit_xzeroScalePosition_4->text().toFloat();
|
||||
current_data->variables_[i].rectifier_funtion = ui->comboBox_rectifier_funtion_4->currentIndex();
|
||||
// -alarm
|
||||
current_data->danger_high[i].level = ui->lineEdit_danger_high_level_4->text().toDouble();
|
||||
current_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_4->text().toDouble();
|
||||
current_data->danger_high[i].delay = ui->lineEdit_danger_high_delay_4->text().toDouble();
|
||||
current_data->danger_high[i].enable = ui->checkBox_danger_high_enable_4->isChecked();
|
||||
current_data->danger_high[i].latch = ui->checkBox_danger_high_latch_4->isChecked();
|
||||
current_data->alert_high[i].level = ui->lineEdit_alert_high_level_4->text().toDouble();
|
||||
current_data->alert_high[i].hysteresis = ui->lineEdit_alert_high_hysteresis_4->text().toDouble();
|
||||
current_data->alert_high[i].delay = ui->lineEdit_alert_high_delay_4->text().toDouble();
|
||||
current_data->alert_high[i].enable = ui->checkBox_alert_high_enable_4->isChecked();
|
||||
current_data->alert_high[i].latch = ui->checkBox_alert_high_latch_4->isChecked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HighSpeedCurrent::Init() {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
// do nothing or use template to init it.
|
||||
std::shared_ptr<HighSpeedCurrentData> current_data = std::make_shared<HighSpeedCurrentData>();
|
||||
current_data->card_type_ = card_type;
|
||||
current_data->slot_ = slot_no;
|
||||
ConfigMgr::Instance()->AddCard(current_data);
|
||||
UpdateData(current_data);
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<HighSpeedCurrentData> current_data = std::dynamic_pointer_cast<HighSpeedCurrentData>(base_ptr);
|
||||
for (int i = 0; i < CHANNEL_COUNT_SPEED; i++) {
|
||||
if (i + 1 == 1) {
|
||||
ui->checkBox_chan_1->setChecked(current_data->variables_[i].active);
|
||||
ui->lineEdit_engineeringUnit->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->lineEdit_fullScalePosition->setText(QString::number(current_data->variables_[i].fullScalePosition));
|
||||
ui->lineEdit_xfullScalePosition->setText(QString::number(current_data->variables_[i].xfullScalePosition));
|
||||
ui->lineEdit_zeroScalePosition->setText(QString::number(current_data->variables_[i].zeroScalePosition));
|
||||
ui->lineEdit_xzeroScalePosition->setText(QString::number(current_data->variables_[i].xzeroScalePosition));
|
||||
ui->comboBox_rectifier_funtion->setCurrentIndex(current_data->variables_[i].rectifier_funtion);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level->setText(QString::number(current_data->danger_high[i].level));
|
||||
ui->lineEdit_danger_high_hysteresis->setText(QString::number(current_data->danger_high[i].hysteresis));
|
||||
ui->lineEdit_danger_high_delay->setText(QString::number(current_data->danger_high[i].delay));
|
||||
ui->checkBox_danger_high_enable->setChecked(current_data->danger_high[i].enable);
|
||||
ui->checkBox_danger_high_latch->setChecked(current_data->danger_high[i].latch);
|
||||
|
||||
ui->lineEdit_alert_high_level->setText(QString::number(current_data->alert_high[i].level));
|
||||
ui->lineEdit_alert_high_hysteresis->setText(QString::number(current_data->alert_high[i].hysteresis));
|
||||
ui->lineEdit_alert_high_delay->setText(QString::number(current_data->alert_high[i].delay));
|
||||
ui->checkBox_alert_high_enable->setChecked(current_data->alert_high[i].enable);
|
||||
ui->checkBox_alert_high_latch->setChecked(current_data->alert_high[i].latch);
|
||||
ui->label_unit1->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->label_unit2->setText(current_data->variables_[i].engineering_unit);
|
||||
}else if(i + 1 == 2){
|
||||
ui->checkBox_chan_2->setChecked(current_data->variables_[i].active);
|
||||
ui->lineEdit_engineeringUnit_2->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->lineEdit_fullScalePosition_2->setText(QString::number(current_data->variables_[i].fullScalePosition));
|
||||
ui->lineEdit_xfullScalePosition_2->setText(QString::number(current_data->variables_[i].xfullScalePosition));
|
||||
ui->lineEdit_zeroScalePosition_2->setText(QString::number(current_data->variables_[i].zeroScalePosition));
|
||||
ui->lineEdit_xzeroScalePosition_2->setText(QString::number(current_data->variables_[i].xzeroScalePosition));
|
||||
ui->comboBox_rectifier_funtion_2->setCurrentIndex(current_data->variables_[i].rectifier_funtion);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level_2->setText(QString::number(current_data->danger_high[i].level));
|
||||
ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(current_data->danger_high[i].hysteresis));
|
||||
ui->lineEdit_danger_high_delay_2->setText(QString::number(current_data->danger_high[i].delay));
|
||||
ui->checkBox_danger_high_enable_2->setChecked(current_data->danger_high[i].enable);
|
||||
ui->checkBox_danger_high_latch_2->setChecked(current_data->danger_high[i].latch);
|
||||
|
||||
ui->lineEdit_alert_high_level_2->setText(QString::number(current_data->alert_high[i].level));
|
||||
ui->lineEdit_alert_high_hysteresis_2->setText(QString::number(current_data->alert_high[i].hysteresis));
|
||||
ui->lineEdit_alert_high_delay_2->setText(QString::number(current_data->alert_high[i].delay));
|
||||
ui->checkBox_alert_high_enable_2->setChecked(current_data->alert_high[i].enable);
|
||||
ui->checkBox_alert_high_latch_2->setChecked(current_data->alert_high[i].latch);
|
||||
ui->label_unit1_2->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->label_unit2_2->setText(current_data->variables_[i].engineering_unit);
|
||||
}else if(i + 1 == 3){
|
||||
ui->checkBox_chan_3->setChecked(current_data->variables_[i].active);
|
||||
ui->lineEdit_engineeringUnit_3->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->lineEdit_fullScalePosition_3->setText(QString::number(current_data->variables_[i].fullScalePosition));
|
||||
ui->lineEdit_xfullScalePosition_3->setText(QString::number(current_data->variables_[i].xfullScalePosition));
|
||||
ui->lineEdit_zeroScalePosition_3->setText(QString::number(current_data->variables_[i].zeroScalePosition));
|
||||
ui->lineEdit_xzeroScalePosition_3->setText(QString::number(current_data->variables_[i].xzeroScalePosition));
|
||||
ui->comboBox_rectifier_funtion_3->setCurrentIndex(current_data->variables_[i].rectifier_funtion);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level_3->setText(QString::number(current_data->danger_high[i].level));
|
||||
ui->lineEdit_danger_high_hysteresis_3->setText(QString::number(current_data->danger_high[i].hysteresis));
|
||||
ui->lineEdit_danger_high_delay_3->setText(QString::number(current_data->danger_high[i].delay));
|
||||
ui->checkBox_danger_high_enable_3->setChecked(current_data->danger_high[i].enable);
|
||||
ui->checkBox_danger_high_latch_3->setChecked(current_data->danger_high[i].latch);
|
||||
|
||||
ui->lineEdit_alert_high_level_3->setText(QString::number(current_data->alert_high[i].level));
|
||||
ui->lineEdit_alert_high_hysteresis_3->setText(QString::number(current_data->alert_high[i].hysteresis));
|
||||
ui->lineEdit_alert_high_delay_3->setText(QString::number(current_data->alert_high[i].delay));
|
||||
ui->checkBox_alert_high_enable_3->setChecked(current_data->alert_high[i].enable);
|
||||
ui->checkBox_alert_high_latch_3->setChecked(current_data->alert_high[i].latch);
|
||||
ui->label_unit1_3->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->label_unit2_3->setText(current_data->variables_[i].engineering_unit);
|
||||
}else if(i + 1 == 4){
|
||||
ui->checkBox_chan_4->setChecked(current_data->variables_[i].active);
|
||||
ui->lineEdit_engineeringUnit_4->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->lineEdit_fullScalePosition_4->setText(QString::number(current_data->variables_[i].fullScalePosition));
|
||||
ui->lineEdit_xfullScalePosition_4->setText(QString::number(current_data->variables_[i].xfullScalePosition));
|
||||
ui->lineEdit_zeroScalePosition_4->setText(QString::number(current_data->variables_[i].zeroScalePosition));
|
||||
ui->lineEdit_xzeroScalePosition_4->setText(QString::number(current_data->variables_[i].xzeroScalePosition));
|
||||
ui->comboBox_rectifier_funtion_4->setCurrentIndex(current_data->variables_[i].rectifier_funtion);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level_4->setText(QString::number(current_data->danger_high[i].level));
|
||||
ui->lineEdit_danger_high_hysteresis_4->setText(QString::number(current_data->danger_high[i].hysteresis));
|
||||
ui->lineEdit_danger_high_delay_4->setText(QString::number(current_data->danger_high[i].delay));
|
||||
ui->checkBox_danger_high_enable_4->setChecked(current_data->danger_high[i].enable);
|
||||
ui->checkBox_danger_high_latch_4->setChecked(current_data->danger_high[i].latch);
|
||||
|
||||
ui->lineEdit_alert_high_level_4->setText(QString::number(current_data->alert_high[i].level));
|
||||
ui->lineEdit_alert_high_hysteresis_4->setText(QString::number(current_data->alert_high[i].hysteresis));
|
||||
ui->lineEdit_alert_high_delay_4->setText(QString::number(current_data->alert_high[i].delay));
|
||||
ui->checkBox_alert_high_enable_4->setChecked(current_data->alert_high[i].enable);
|
||||
ui->checkBox_alert_high_latch_4->setChecked(current_data->alert_high[i].latch);
|
||||
ui->label_unit1_4->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->label_unit2_4->setText(current_data->variables_[i].engineering_unit);
|
||||
}
|
||||
}
|
||||
ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number);
|
||||
ui->comboBox_group->setCurrentIndex(base_ptr->group - 1);
|
||||
}
|
||||
void HighSpeedCurrent::on_lineEdit_engineeringUnit_editingFinished()
|
||||
{
|
||||
QString str = ui->lineEdit_engineeringUnit->text();
|
||||
ui->label_unit1->setText(str);
|
||||
ui->label_unit2->setText(str);
|
||||
}
|
||||
|
||||
|
||||
void HighSpeedCurrent::on_lineEdit_engineeringUnit_2_editingFinished()
|
||||
{
|
||||
QString str = ui->lineEdit_engineeringUnit_2->text();
|
||||
ui->label_unit1_2->setText(str);
|
||||
ui->label_unit2_2->setText(str);
|
||||
}
|
||||
|
||||
|
||||
void HighSpeedCurrent::on_lineEdit_engineeringUnit_3_editingFinished()
|
||||
{
|
||||
QString str = ui->lineEdit_engineeringUnit_3->text();
|
||||
ui->label_unit1_3->setText(str);
|
||||
ui->label_unit2_3->setText(str);
|
||||
}
|
||||
|
||||
|
||||
void HighSpeedCurrent::on_lineEdit_engineeringUnit_4_editingFinished()
|
||||
{
|
||||
QString str = ui->lineEdit_engineeringUnit_4->text();
|
||||
ui->label_unit1_4->setText(str);
|
||||
ui->label_unit2_4->setText(str);
|
||||
}
|
||||
|
||||
|
||||
void HighSpeedCurrent::on_pushButton_confirm_clicked()
|
||||
{
|
||||
if(ui->lineEdit_fullScalePosition->text() == "" ||
|
||||
ui->lineEdit_xfullScalePosition->text() == "" ||
|
||||
ui->lineEdit_zeroScalePosition->text() == "" ||
|
||||
ui->lineEdit_xzeroScalePosition->text() == ""){
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "请填写测量上下限数据!");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << " should not be here";
|
||||
return;
|
||||
}
|
||||
for (int var = 1; var < SLOT_NUM; var ++) {
|
||||
if(ui->comboBox_relative_number->currentIndex() != 0){
|
||||
std::shared_ptr<CardBase> slot_base_ptr = ConfigMgr::Instance()->GetSlotPtr(var);
|
||||
if(slot_base_ptr == nullptr || slot_base_ptr->card_type_ != kCardHighSpeedCurrent)
|
||||
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_ != kCardHighSpeedCurrent){
|
||||
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<HighSpeedCurrentData> current_data = std::dynamic_pointer_cast<HighSpeedCurrentData>(base_ptr);
|
||||
UpdateData(current_data);
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void HighSpeedCurrent::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
void HighSpeedCurrent::copy_end_slot(){
|
||||
Init();
|
||||
}
|
||||
void HighSpeedCurrent::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();
|
||||
}
|
||||
|
||||
45
high_speed_current.h
Normal file
45
high_speed_current.h
Normal file
@ -0,0 +1,45 @@
|
||||
#ifndef HIGH_SPEED_CURRENT_H
|
||||
#define HIGH_SPEED_CURRENT_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "data_config.h"
|
||||
#include "high_speed_current_data.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Ui {
|
||||
class HighSpeedCurrent;
|
||||
}
|
||||
|
||||
class HighSpeedCurrent : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HighSpeedCurrent(int slot_no_,CardType cardtype,QWidget *parent = nullptr);
|
||||
~HighSpeedCurrent();
|
||||
int slot_no;
|
||||
CardType card_type;
|
||||
private slots:
|
||||
void on_lineEdit_engineeringUnit_editingFinished();
|
||||
|
||||
void on_lineEdit_engineeringUnit_2_editingFinished();
|
||||
|
||||
void on_lineEdit_engineeringUnit_3_editingFinished();
|
||||
|
||||
void on_lineEdit_engineeringUnit_4_editingFinished();
|
||||
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
void on_pushButton_copy_channel_clicked();
|
||||
|
||||
void copy_end_slot();
|
||||
|
||||
private:
|
||||
Ui::HighSpeedCurrent *ui;
|
||||
void UpdateData(std::shared_ptr<HighSpeedCurrentData> ¤t_data);
|
||||
void Init();
|
||||
};
|
||||
|
||||
#endif // HIGH_SPEED_CURRENT_H
|
||||
3535
high_speed_current.ui
Normal file
3535
high_speed_current.ui
Normal file
File diff suppressed because it is too large
Load Diff
3
high_speed_current_data.cpp
Normal file
3
high_speed_current_data.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include "high_speed_current_data.h"
|
||||
|
||||
HighSpeedCurrentData::HighSpeedCurrentData() {}
|
||||
16
high_speed_current_data.h
Normal file
16
high_speed_current_data.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef HIGH_SPEED_CURRENT_DATA_H
|
||||
#define HIGH_SPEED_CURRENT_DATA_H
|
||||
|
||||
#include "cardbase.h"
|
||||
|
||||
class HighSpeedCurrentData : public CardBase
|
||||
{
|
||||
public:
|
||||
HighSpeedCurrentData();
|
||||
HighSpeedCurrentVariables variables_[4];
|
||||
AlarmDangerHigh danger_high[CHANNEL_COUNT_SPEED];
|
||||
AlarmAlertHigh alert_high[CHANNEL_COUNT_SPEED];
|
||||
DCOutput dc_output[CHANNEL_COUNT];
|
||||
};
|
||||
|
||||
#endif // HIGH_SPEED_CURRENT_DATA_H
|
||||
451
keyphase.cpp
451
keyphase.cpp
@ -6,192 +6,335 @@
|
||||
#include <QJsonObject>
|
||||
#include <QFile>
|
||||
|
||||
KeyPhase::KeyPhase(int slot_no_,QWidget *parent)
|
||||
#include "data_config.h"
|
||||
#include "config_mgr.h"
|
||||
#include "keyphase_data.h"
|
||||
|
||||
KeyPhase::KeyPhase(int slot_no_,CardType cardtype, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::KeyPhase)
|
||||
{
|
||||
, ui(new Ui::KeyPhase) {
|
||||
ui->setupUi(this);
|
||||
ui->widget_body->setProperty("flag", "body");
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
slot_no = slot_no_;
|
||||
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);
|
||||
readJsonFile(filePath_keyphase);
|
||||
// QString filePath_keyphase = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\keyphase.json").arg(slot_no);
|
||||
// readJsonFile(filePath_keyphase);
|
||||
Init();
|
||||
connect(ui->radioButton_manual_threshold_1, &QRadioButton::toggled, this, &KeyPhase::on_manual_threshold_1_clicked);
|
||||
connect(ui->radioButton_manual_threshold_2, &QRadioButton::toggled, this, &KeyPhase::on_manual_threshold_2_clicked);
|
||||
connect(ui->radioButton_manual_threshold_3, &QRadioButton::toggled, this, &KeyPhase::on_manual_threshold_3_clicked);
|
||||
connect(ui->radioButton_manual_threshold_4, &QRadioButton::toggled, this, &KeyPhase::on_manual_threshold_4_clicked);
|
||||
}
|
||||
|
||||
KeyPhase::~KeyPhase()
|
||||
{
|
||||
KeyPhase::~KeyPhase() {
|
||||
delete ui;
|
||||
}
|
||||
void KeyPhase::readJsonFile(const QString &filePath)
|
||||
{
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qDebug() << "Cannot open file for reading:" << filePath;
|
||||
|
||||
void KeyPhase::on_pushButton_cancel_clicked() {
|
||||
this->close();
|
||||
}
|
||||
|
||||
void KeyPhase::on_manual_threshold_1_clicked(bool checked) {
|
||||
if (checked) {
|
||||
ui->doubleSpinBox_threshold_1->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_1->setEnabled(true);
|
||||
return;
|
||||
}
|
||||
QString content = file.readAll();
|
||||
file.close();
|
||||
QByteArray jsonData = content.toUtf8();
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
|
||||
if (jsonDoc.isNull()) {
|
||||
qDebug() << "Cannot parse JSON document";
|
||||
ui->doubleSpinBox_threshold_1->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_1->setEnabled(false);
|
||||
}
|
||||
|
||||
void KeyPhase::on_manual_threshold_2_clicked(bool checked) {
|
||||
if (checked) {
|
||||
ui->doubleSpinBox_threshold_2->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_2->setEnabled(true);
|
||||
return;
|
||||
}
|
||||
if (!jsonDoc.isObject() && !jsonDoc.isArray()) {
|
||||
qDebug() << "JSON document is not an object or an array";
|
||||
ui->doubleSpinBox_threshold_2->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_2->setEnabled(false);
|
||||
}
|
||||
|
||||
void KeyPhase::on_manual_threshold_3_clicked(bool checked) {
|
||||
if (checked) {
|
||||
ui->doubleSpinBox_threshold_3->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_3->setEnabled(true);
|
||||
return;
|
||||
}
|
||||
QJsonObject json_obj = jsonDoc.object();
|
||||
QJsonArray chan_array = json_obj["chan"].toArray();
|
||||
for(int i = 0; i < chan_array.size(); i++){
|
||||
QJsonObject temp_obj = chan_array[i].toObject();
|
||||
keyphase_variables[i].id = temp_obj["id"].toInt();
|
||||
keyphase_variables[i].active = temp_obj["active"].toBool();
|
||||
QJsonArray voltage_range_array = temp_obj["normal_voltage_range"].toArray();
|
||||
keyphase_variables[i].normal_voltage_high = voltage_range_array[1].toDouble();
|
||||
keyphase_variables[i].normal_voltage_low = voltage_range_array[0].toDouble();
|
||||
keyphase_variables[i].threshold = temp_obj["threshold"].toDouble();
|
||||
keyphase_variables[i].hysteresis = temp_obj["hysteresis"].toDouble();
|
||||
keyphase_variables[i].events_per_revolution = temp_obj["events_per_revolution"].toInt();
|
||||
keyphase_variables[i].record_output = temp_obj["record_output"].toString();
|
||||
keyphase_variables[i].two_ma_clamp = temp_obj["two_ma_clamp"].toBool();
|
||||
keyphase_variables[i].alert_latching = temp_obj["alert_latching"].toBool();
|
||||
keyphase_variables[i].overspeed_latching = temp_obj["overspeed_latching"].toBool();
|
||||
keyphase_variables[i].normal_latching = temp_obj["normal_latching"].toBool();
|
||||
ui->doubleSpinBox_threshold_3->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_3->setEnabled(false);
|
||||
}
|
||||
|
||||
void KeyPhase::on_manual_threshold_4_clicked(bool checked) {
|
||||
if (checked) {
|
||||
ui->doubleSpinBox_threshold_4->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_4->setEnabled(true);
|
||||
return;
|
||||
}
|
||||
ui->doubleSpinBox_threshold_4->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_4->setEnabled(false);
|
||||
}
|
||||
|
||||
void KeyPhase::UpdateData(std::shared_ptr<KeyphaseData> &keyphase_data) {
|
||||
keyphase_data->card_type_ = kCardKeyphaseSingle;
|
||||
keyphase_data->slot_ = slot_no;
|
||||
keyphase_data->version_ = 1;
|
||||
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
if (i + 1 == 1) {
|
||||
keyphase_data->variables_[i].active = ui->checkBox_enable_1->isChecked();
|
||||
keyphase_data->variables_[i].normal_voltage_high = ui->doubleSpinBox_high_1->value();
|
||||
keyphase_data->variables_[i].normal_voltage_low = ui->doubleSpinBox_low_1->value();
|
||||
keyphase_data->variables_[i].automatic_threshold = ui->radioButton_automatic_threshold_1->isChecked();
|
||||
keyphase_data->variables_[i].threshold = ui->doubleSpinBox_threshold_1->value();
|
||||
keyphase_data->variables_[i].hysteresis = ui->doubleSpinBox_hysteresis_1->value();
|
||||
keyphase_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_1->value();
|
||||
keyphase_data->variables_[i].keyphase_points = ui->spinBox_points->value();
|
||||
keyphase_data->variables_[i].speed_delay = ui->spinBox_delay->value();
|
||||
if(ui->radioButton_falling_edge->isChecked()){
|
||||
keyphase_data->variables_[i].fail = true;
|
||||
}else if(ui->radioButton_rising_edge->isChecked()){
|
||||
keyphase_data->variables_[i].fail = false;
|
||||
}
|
||||
} else if (i + 1 == 2) {
|
||||
keyphase_data->variables_[i].active = ui->checkBox_enable_2->isChecked();
|
||||
keyphase_data->variables_[i].normal_voltage_high = ui->doubleSpinBox_high_2->value();
|
||||
keyphase_data->variables_[i].normal_voltage_low = ui->doubleSpinBox_low_2->value();
|
||||
keyphase_data->variables_[i].automatic_threshold = ui->radioButton_automatic_threshold_2->isChecked();
|
||||
keyphase_data->variables_[i].threshold = ui->doubleSpinBox_threshold_2->value();
|
||||
keyphase_data->variables_[i].hysteresis = ui->doubleSpinBox_hysteresis_2->value();
|
||||
keyphase_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_2->value();
|
||||
keyphase_data->variables_[i].keyphase_points = ui->spinBox_points_2->value();
|
||||
keyphase_data->variables_[i].speed_delay = ui->spinBox_delay_2->value();
|
||||
if(ui->radioButton_falling_edge_2->isChecked()){
|
||||
keyphase_data->variables_[i].fail = true;
|
||||
}else if(ui->radioButton_rising_edge_2->isChecked()){
|
||||
keyphase_data->variables_[i].fail = false;
|
||||
}
|
||||
} else if (i + 1 == 3) {
|
||||
keyphase_data->variables_[i].active = ui->checkBox_enable_3->isChecked();
|
||||
keyphase_data->variables_[i].normal_voltage_high = ui->doubleSpinBox_high_3->value();
|
||||
keyphase_data->variables_[i].normal_voltage_low = ui->doubleSpinBox_low_3->value();
|
||||
keyphase_data->variables_[i].automatic_threshold = ui->radioButton_automatic_threshold_3->isChecked();
|
||||
keyphase_data->variables_[i].threshold = ui->doubleSpinBox_threshold_3->value();
|
||||
keyphase_data->variables_[i].hysteresis = ui->doubleSpinBox_hysteresis_3->value();
|
||||
keyphase_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_3->value();
|
||||
keyphase_data->variables_[i].keyphase_points = ui->spinBox_points_3->value();
|
||||
keyphase_data->variables_[i].speed_delay = ui->spinBox_delay_3->value();
|
||||
if(ui->radioButton_falling_edge_3->isChecked()){
|
||||
keyphase_data->variables_[i].fail = true;
|
||||
}else if(ui->radioButton_rising_edge_3->isChecked()){
|
||||
keyphase_data->variables_[i].fail = false;
|
||||
}
|
||||
} else if (i + 1 == 4) {
|
||||
keyphase_data->variables_[i].active = ui->checkBox_enable_4->isChecked();
|
||||
keyphase_data->variables_[i].normal_voltage_high = ui->doubleSpinBox_high_4->value();
|
||||
keyphase_data->variables_[i].normal_voltage_low = ui->doubleSpinBox_low_4->value();
|
||||
keyphase_data->variables_[i].automatic_threshold = ui->radioButton_automatic_threshold_4->isChecked();
|
||||
keyphase_data->variables_[i].threshold = ui->doubleSpinBox_threshold_4->value();
|
||||
keyphase_data->variables_[i].hysteresis = ui->doubleSpinBox_hysteresis_4->value();
|
||||
keyphase_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_4->value();
|
||||
keyphase_data->variables_[i].keyphase_points = ui->spinBox_points_4->value();
|
||||
keyphase_data->variables_[i].speed_delay = ui->spinBox_delay_4->value();
|
||||
if(ui->radioButton_falling_edge_3->isChecked()){
|
||||
keyphase_data->variables_[i].fail = true;
|
||||
}else if(ui->radioButton_rising_edge_3->isChecked()){
|
||||
keyphase_data->variables_[i].fail = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void KeyPhase::Init()
|
||||
{
|
||||
for (int i = 0; i < CHANNLE_COUNT; i++) {
|
||||
if(keyphase_variables[i].id == 1){
|
||||
ui->checkBox_enable_1->setChecked(keyphase_variables[i].active);
|
||||
ui->doubleSpinBox_high_1->setValue(keyphase_variables[i].normal_voltage_high);
|
||||
ui->doubleSpinBox_low_1->setValue(keyphase_variables[i].normal_voltage_low);
|
||||
if(keyphase_variables[i].automatic_threshold)
|
||||
|
||||
void KeyPhase::Init() {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
// do nothing or use template to init it.
|
||||
std::shared_ptr<KeyphaseData> keyphase_data = std::make_shared<KeyphaseData>();
|
||||
keyphase_data->card_type_ = car_type;
|
||||
keyphase_data->slot_ = slot_no;
|
||||
ConfigMgr::Instance()->AddCard(keyphase_data);
|
||||
UpdateData(keyphase_data);
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<KeyphaseData> keyphase_data = std::dynamic_pointer_cast<KeyphaseData>(base_ptr);
|
||||
for (int i = 0; i < CHANNEL_COUNT_SPEED; i++) {
|
||||
if (i + 1 == 1) {
|
||||
ui->checkBox_enable_1->setChecked(keyphase_data->variables_[i].active);
|
||||
ui->doubleSpinBox_high_1->setValue(keyphase_data->variables_[i].normal_voltage_high);
|
||||
ui->doubleSpinBox_low_1->setValue(keyphase_data->variables_[i].normal_voltage_low);
|
||||
ui->spinBox_points->setValue(keyphase_data->variables_[i].keyphase_points);
|
||||
ui->spinBox_delay->setValue(keyphase_data->variables_[i].speed_delay);
|
||||
if (keyphase_data->variables_[i].automatic_threshold) {
|
||||
ui->radioButton_automatic_threshold_1->setChecked(true);
|
||||
else
|
||||
ui->doubleSpinBox_threshold_1->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_1->setEnabled(false);
|
||||
} else {
|
||||
ui->radioButton_manual_threshold_1->setChecked(true);
|
||||
ui->doubleSpinBox_threshold_1->setValue(keyphase_variables[i].threshold);
|
||||
ui->doubleSpinBox_hysteresis_1->setValue(keyphase_variables[i].hysteresis);
|
||||
ui->spinBox_events_per_revolution_1->setValue(keyphase_variables[i].events_per_revolution);
|
||||
|
||||
}
|
||||
if(keyphase_variables[i].id == 2)
|
||||
{
|
||||
ui->checkBox_enable_2->setChecked(keyphase_variables[i].active);
|
||||
ui->doubleSpinBox_high_2->setValue(keyphase_variables[i].normal_voltage_high);
|
||||
ui->doubleSpinBox_low_2->setValue(keyphase_variables[i].normal_voltage_low);
|
||||
if(keyphase_variables[i].automatic_threshold)
|
||||
ui->doubleSpinBox_threshold_1->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_1->setEnabled(true);
|
||||
}
|
||||
ui->doubleSpinBox_threshold_1->setValue(keyphase_data->variables_[i].threshold);
|
||||
ui->doubleSpinBox_hysteresis_1->setValue(keyphase_data->variables_[i].hysteresis);
|
||||
ui->spinBox_events_per_revolution_1->setValue(keyphase_data->variables_[i].events_per_revolution);
|
||||
if(keyphase_data->variables_[i].fail)
|
||||
ui->radioButton_falling_edge->setChecked(true);
|
||||
else
|
||||
ui->radioButton_rising_edge->setChecked(true);
|
||||
} else if (i + 1 == 2) {
|
||||
ui->checkBox_enable_2->setChecked(keyphase_data->variables_[i].active);
|
||||
ui->doubleSpinBox_high_2->setValue(keyphase_data->variables_[i].normal_voltage_high);
|
||||
ui->doubleSpinBox_low_2->setValue(keyphase_data->variables_[i].normal_voltage_low);
|
||||
ui->spinBox_points_2->setValue(keyphase_data->variables_[i].keyphase_points);
|
||||
ui->spinBox_delay_2->setValue(keyphase_data->variables_[i].speed_delay);
|
||||
if (keyphase_data->variables_[i].automatic_threshold) {
|
||||
ui->radioButton_automatic_threshold_2->setChecked(true);
|
||||
else
|
||||
ui->doubleSpinBox_threshold_2->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_2->setEnabled(false);
|
||||
} else {
|
||||
ui->radioButton_manual_threshold_2->setChecked(true);
|
||||
ui->doubleSpinBox_threshold_2->setValue(keyphase_variables[i].threshold);
|
||||
ui->doubleSpinBox_hysteresis_2->setValue(keyphase_variables[i].hysteresis);
|
||||
ui->spinBox_events_per_revolution_2->setValue(keyphase_variables[i].events_per_revolution);
|
||||
|
||||
}
|
||||
if(keyphase_variables[i].id == 3){
|
||||
ui->checkBox_enable_3->setChecked(keyphase_variables[i].active);
|
||||
ui->doubleSpinBox_high_3->setValue(keyphase_variables[i].normal_voltage_high);
|
||||
ui->doubleSpinBox_low_3->setValue(keyphase_variables[i].normal_voltage_low);
|
||||
if(keyphase_variables[i].automatic_threshold)
|
||||
ui->doubleSpinBox_threshold_2->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_2->setEnabled(true);
|
||||
}
|
||||
ui->doubleSpinBox_threshold_2->setValue(keyphase_data->variables_[i].threshold);
|
||||
ui->doubleSpinBox_hysteresis_2->setValue(keyphase_data->variables_[i].hysteresis);
|
||||
ui->spinBox_events_per_revolution_2->setValue(keyphase_data->variables_[i].events_per_revolution);
|
||||
if(keyphase_data->variables_[i].fail)
|
||||
ui->radioButton_falling_edge_2->setChecked(true);
|
||||
else
|
||||
ui->radioButton_rising_edge_2->setChecked(true);
|
||||
} else if (i + 1 == 3) {
|
||||
ui->checkBox_enable_3->setChecked(keyphase_data->variables_[i].active);
|
||||
ui->doubleSpinBox_high_3->setValue(keyphase_data->variables_[i].normal_voltage_high);
|
||||
ui->doubleSpinBox_low_3->setValue(keyphase_data->variables_[i].normal_voltage_low);
|
||||
ui->spinBox_points_3->setValue(keyphase_data->variables_[i].keyphase_points);
|
||||
ui->spinBox_delay_3->setValue(keyphase_data->variables_[i].speed_delay);
|
||||
if (keyphase_data->variables_[i].automatic_threshold) {
|
||||
ui->radioButton_automatic_threshold_3->setChecked(true);
|
||||
else
|
||||
ui->doubleSpinBox_threshold_3->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_3->setEnabled(false);
|
||||
} else {
|
||||
ui->radioButton_manual_threshold_3->setChecked(true);
|
||||
ui->doubleSpinBox_threshold_3->setValue(keyphase_variables[i].threshold);
|
||||
ui->doubleSpinBox_hysteresis_3->setValue(keyphase_variables[i].hysteresis);
|
||||
ui->spinBox_events_per_revolution_3->setValue(keyphase_variables[i].events_per_revolution);
|
||||
}
|
||||
if(keyphase_variables[i].id == 4){
|
||||
ui->checkBox_enable_4->setChecked(keyphase_variables[i].active);
|
||||
ui->doubleSpinBox_high_4->setValue(keyphase_variables[i].normal_voltage_high);
|
||||
ui->doubleSpinBox_low_4->setValue(keyphase_variables[i].normal_voltage_low);
|
||||
if(keyphase_variables[i].automatic_threshold)
|
||||
ui->radioButton_automatic_threshold_4->setChecked(true);
|
||||
ui->doubleSpinBox_threshold_3->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_3->setEnabled(true);
|
||||
}
|
||||
ui->doubleSpinBox_threshold_3->setValue(keyphase_data->variables_[i].threshold);
|
||||
ui->doubleSpinBox_hysteresis_3->setValue(keyphase_data->variables_[i].hysteresis);
|
||||
ui->spinBox_events_per_revolution_3->setValue(keyphase_data->variables_[i].events_per_revolution);
|
||||
if(keyphase_data->variables_[i].fail)
|
||||
ui->radioButton_falling_edge_3->setChecked(true);
|
||||
else
|
||||
ui->radioButton_rising_edge_3->setChecked(true);
|
||||
} else if (i + 1 == 4) {
|
||||
ui->checkBox_enable_4->setChecked(keyphase_data->variables_[i].active);
|
||||
ui->doubleSpinBox_high_4->setValue(keyphase_data->variables_[i].normal_voltage_high);
|
||||
ui->doubleSpinBox_low_4->setValue(keyphase_data->variables_[i].normal_voltage_low);
|
||||
ui->spinBox_points_4->setValue(keyphase_data->variables_[i].keyphase_points);
|
||||
ui->spinBox_delay_4->setValue(keyphase_data->variables_[i].speed_delay);
|
||||
if (keyphase_data->variables_[i].automatic_threshold) {
|
||||
ui->radioButton_automatic_threshold_4->setChecked(true);
|
||||
ui->doubleSpinBox_threshold_4->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_4->setEnabled(false);
|
||||
} else {
|
||||
ui->radioButton_manual_threshold_4->setChecked(true);
|
||||
ui->doubleSpinBox_threshold_4->setValue(keyphase_variables[i].threshold);
|
||||
ui->doubleSpinBox_hysteresis_4->setValue(keyphase_variables[i].hysteresis);
|
||||
ui->spinBox_events_per_revolution_4->setValue(keyphase_variables[i].events_per_revolution);
|
||||
|
||||
ui->doubleSpinBox_threshold_4->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_4->setEnabled(true);
|
||||
}
|
||||
ui->doubleSpinBox_threshold_4->setValue(keyphase_data->variables_[i].threshold);
|
||||
ui->doubleSpinBox_hysteresis_4->setValue(keyphase_data->variables_[i].hysteresis);
|
||||
ui->spinBox_events_per_revolution_4->setValue(keyphase_data->variables_[i].events_per_revolution);
|
||||
if(keyphase_data->variables_[i].fail)
|
||||
ui->radioButton_falling_edge_4->setChecked(true);
|
||||
else
|
||||
ui->radioButton_rising_edge_4->setChecked(true);
|
||||
}
|
||||
}
|
||||
ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number);
|
||||
ui->comboBox_group->setCurrentIndex(base_ptr->group -1);
|
||||
}
|
||||
void KeyPhase::on_pushButton_confirm_clicked()
|
||||
{
|
||||
for (int i = 0; i < CHANNLE_COUNT; i++) {
|
||||
if(keyphase_variables[i].id == 1){
|
||||
keyphase_variables[i].active = ui->checkBox_enable_1->isChecked();
|
||||
keyphase_variables[i].normal_voltage_high = ui->doubleSpinBox_high_1->value();
|
||||
keyphase_variables[i].normal_voltage_low = ui->doubleSpinBox_low_1->value();
|
||||
keyphase_variables[i].automatic_threshold = ui->radioButton_automatic_threshold_1->isChecked();
|
||||
keyphase_variables[i].threshold = ui->doubleSpinBox_threshold_1->value();
|
||||
keyphase_variables[i].hysteresis = ui->doubleSpinBox_hysteresis_1->value();
|
||||
keyphase_variables[i].events_per_revolution = ui->spinBox_events_per_revolution_1->value();
|
||||
}
|
||||
if(keyphase_variables[i].id == 2){
|
||||
keyphase_variables[i].active = ui->checkBox_enable_2->isChecked();
|
||||
keyphase_variables[i].normal_voltage_high = ui->doubleSpinBox_high_2->value();
|
||||
keyphase_variables[i].normal_voltage_low = ui->doubleSpinBox_low_2->value();
|
||||
keyphase_variables[i].automatic_threshold = ui->radioButton_automatic_threshold_2->isChecked();
|
||||
keyphase_variables[i].threshold = ui->doubleSpinBox_threshold_2->value();
|
||||
keyphase_variables[i].hysteresis = ui->doubleSpinBox_hysteresis_2->value();
|
||||
keyphase_variables[i].events_per_revolution = ui->spinBox_events_per_revolution_2->value();
|
||||
}
|
||||
if(keyphase_variables[i].id == 3){
|
||||
keyphase_variables[i].active = ui->checkBox_enable_3->isChecked();
|
||||
keyphase_variables[i].normal_voltage_high = ui->doubleSpinBox_high_3->value();
|
||||
keyphase_variables[i].normal_voltage_low = ui->doubleSpinBox_low_3->value();
|
||||
keyphase_variables[i].automatic_threshold = ui->radioButton_automatic_threshold_3->isChecked();
|
||||
keyphase_variables[i].threshold = ui->doubleSpinBox_threshold_3->value();
|
||||
keyphase_variables[i].hysteresis = ui->doubleSpinBox_hysteresis_3->value();
|
||||
keyphase_variables[i].events_per_revolution = ui->spinBox_events_per_revolution_3->value();
|
||||
}
|
||||
if(keyphase_variables[i].id == 4){
|
||||
keyphase_variables[i].active = ui->checkBox_enable_4->isChecked();
|
||||
keyphase_variables[i].normal_voltage_high = ui->doubleSpinBox_high_4->value();
|
||||
keyphase_variables[i].normal_voltage_low = ui->doubleSpinBox_low_4->value();
|
||||
keyphase_variables[i].automatic_threshold = ui->radioButton_automatic_threshold_4->isChecked();
|
||||
keyphase_variables[i].threshold = ui->doubleSpinBox_threshold_4->value();
|
||||
keyphase_variables[i].hysteresis = ui->doubleSpinBox_hysteresis_4->value();
|
||||
keyphase_variables[i].events_per_revolution = ui->spinBox_events_per_revolution_4->value();
|
||||
}
|
||||
}
|
||||
QString slot = QString("%1").arg(slot_no);
|
||||
QString filePath_keyphase = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\keyphase.json").arg(slot_no);
|
||||
QFile file(filePath_keyphase);
|
||||
if(!file.open(QIODevice::WriteOnly))
|
||||
{
|
||||
qDebug() << "Could not open file for writing";
|
||||
void KeyPhase::on_pushButton_confirm_clicked() {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << " should not be here";
|
||||
return;
|
||||
}
|
||||
QJsonObject json_obj;
|
||||
QJsonArray chan_array;
|
||||
for (int i = 0; i < CHANNLE_COUNT; i++) {
|
||||
QJsonObject temp_obj;
|
||||
temp_obj.insert("id", keyphase_variables[i].id);
|
||||
temp_obj.insert("active", keyphase_variables[i].active);
|
||||
QJsonArray voltage_range_array;
|
||||
voltage_range_array.append(keyphase_variables[i].normal_voltage_low);
|
||||
voltage_range_array.append(keyphase_variables[i].normal_voltage_high);
|
||||
temp_obj.insert("normal_voltage_range", voltage_range_array);
|
||||
temp_obj.insert("threshold", keyphase_variables[i].threshold);
|
||||
temp_obj.insert("hysteresis", keyphase_variables[i].hysteresis);
|
||||
temp_obj.insert("events_per_revolution", keyphase_variables[i].events_per_revolution);
|
||||
temp_obj.insert("automatic_threshold",keyphase_variables[i].automatic_threshold);
|
||||
chan_array.append(temp_obj);
|
||||
}
|
||||
json_obj.insert("chan", chan_array);
|
||||
json_obj.insert("version",1);
|
||||
json_obj.insert("slot",slot_no);
|
||||
json_obj.insert("card_type",2);
|
||||
QJsonDocument json_doc;
|
||||
json_doc.setObject(json_obj);
|
||||
QByteArray byte_array = json_doc.toJson();
|
||||
file.write(byte_array);
|
||||
file.close();
|
||||
base_ptr->group = ui->comboBox_group->currentIndex() + 1;
|
||||
base_ptr->relative_number = ui->comboBox_relative_number->currentIndex();
|
||||
|
||||
std::shared_ptr<KeyphaseData> keyphase_data = std::dynamic_pointer_cast<KeyphaseData>(base_ptr);
|
||||
UpdateData(keyphase_data);
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void KeyPhase::on_radioButton_manual_threshold_1_clicked()
|
||||
{
|
||||
if(ui->radioButton_manual_threshold_1->isChecked()){
|
||||
ui->doubleSpinBox_threshold_1->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_1->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KeyPhase::on_radioButton_automatic_threshold_1_clicked()
|
||||
{
|
||||
if(ui->radioButton_automatic_threshold_1->isChecked()){
|
||||
ui->doubleSpinBox_threshold_1->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_1->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KeyPhase::on_radioButton_automatic_threshold_2_clicked()
|
||||
{
|
||||
if(ui->radioButton_automatic_threshold_2->isChecked()){
|
||||
ui->doubleSpinBox_threshold_2->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_2->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KeyPhase::on_radioButton_manual_threshold_2_clicked()
|
||||
{
|
||||
if(ui->radioButton_manual_threshold_2->isChecked()){
|
||||
ui->doubleSpinBox_threshold_2->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_2->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KeyPhase::on_radioButton_automatic_threshold_3_clicked()
|
||||
{
|
||||
if(ui->radioButton_automatic_threshold_3->isChecked()){
|
||||
ui->doubleSpinBox_threshold_3->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_3->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KeyPhase::on_radioButton_manual_threshold_3_clicked()
|
||||
{
|
||||
if(ui->radioButton_manual_threshold_3->isChecked()){
|
||||
ui->doubleSpinBox_threshold_3->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_3->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KeyPhase::on_radioButton_automatic_threshold_4_clicked()
|
||||
{
|
||||
if(ui->radioButton_automatic_threshold_4->isChecked()){
|
||||
ui->doubleSpinBox_threshold_4->setEnabled(false);
|
||||
ui->doubleSpinBox_hysteresis_4->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KeyPhase::on_radioButton_manual_threshold_4_clicked()
|
||||
{
|
||||
if(ui->radioButton_manual_threshold_4->isChecked()){
|
||||
ui->doubleSpinBox_threshold_4->setEnabled(true);
|
||||
ui->doubleSpinBox_hysteresis_4->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
39
keyphase.h
39
keyphase.h
@ -1,28 +1,49 @@
|
||||
#ifndef KEYPHASE_H
|
||||
#define KEYPHASE_H
|
||||
|
||||
#include <memory>
|
||||
#include <QDialog>
|
||||
#include "data_config.h"
|
||||
#include "keyphase_data.h"
|
||||
namespace Ui {
|
||||
class KeyPhase;
|
||||
}
|
||||
|
||||
class KeyPhase : public QDialog
|
||||
{
|
||||
class KeyPhase : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KeyPhase(int slot_no_,QWidget *parent = nullptr);
|
||||
public:
|
||||
explicit KeyPhase(int slot_no_,CardType cardtype, QWidget *parent = nullptr);
|
||||
~KeyPhase();
|
||||
int slot_no;
|
||||
|
||||
private slots:
|
||||
CardType car_type;
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
void on_pushButton_cancel_clicked();
|
||||
void on_manual_threshold_1_clicked(bool checked);
|
||||
void on_manual_threshold_2_clicked(bool checked);
|
||||
void on_manual_threshold_3_clicked(bool checked);
|
||||
void on_manual_threshold_4_clicked(bool checked);
|
||||
void on_radioButton_manual_threshold_1_clicked();
|
||||
|
||||
void on_radioButton_automatic_threshold_1_clicked();
|
||||
|
||||
void on_radioButton_automatic_threshold_2_clicked();
|
||||
|
||||
void on_radioButton_manual_threshold_2_clicked();
|
||||
|
||||
void on_radioButton_automatic_threshold_3_clicked();
|
||||
|
||||
void on_radioButton_manual_threshold_3_clicked();
|
||||
|
||||
void on_radioButton_automatic_threshold_4_clicked();
|
||||
|
||||
void on_radioButton_manual_threshold_4_clicked();
|
||||
|
||||
private:
|
||||
Ui::KeyPhase *ui;
|
||||
Tachometer_Variables keyphase_variables[4];
|
||||
void readJsonFile(const QString &filePath);
|
||||
void UpdateData(std::shared_ptr<KeyphaseData> &keyphase_data);
|
||||
// TachometerVariables keyphase_variables[4];
|
||||
// void readJsonFile(const QString &filePath);
|
||||
void Init();
|
||||
};
|
||||
|
||||
|
||||
3556
keyphase.ui
3556
keyphase.ui
File diff suppressed because it is too large
Load Diff
6
keyphase_data.cpp
Normal file
6
keyphase_data.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "keyphase_data.h"
|
||||
|
||||
KeyphaseData::KeyphaseData()
|
||||
{
|
||||
|
||||
}
|
||||
11
keyphase_data.h
Normal file
11
keyphase_data.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef KEYPHASEDATA_H
|
||||
#define KEYPHASEDATA_H
|
||||
|
||||
#include "cardbase.h"
|
||||
class KeyphaseData : public CardBase {
|
||||
public:
|
||||
KeyphaseData();
|
||||
KeyphaseVariables variables_[4];
|
||||
};
|
||||
|
||||
#endif // KEYPHASEDATA_H
|
||||
40
macconfig.cpp
Normal file
40
macconfig.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
#include "macconfig.h"
|
||||
#include "ui_macconfig.h"
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionValidator>
|
||||
|
||||
MacConfig::MacConfig(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::MacConfig)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QRegularExpression macRegex("^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$");
|
||||
QRegularExpressionValidator *macValidator = new QRegularExpressionValidator(macRegex, this);
|
||||
ui->lineEdit_mac->setValidator(macValidator);
|
||||
}
|
||||
|
||||
MacConfig::~MacConfig()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MacConfig::on_pushButton_confirm_clicked()
|
||||
{
|
||||
ConfigMacReq config_mac = { {0xAA, 0x55, 0xAA}, kConfigMac, 1,0,{} };
|
||||
memcpy(config_mac.mac,ui->lineEdit_mac->text().toStdString().c_str(),sizeof(config_mac.mac));
|
||||
char send_buf[50] ={0};
|
||||
memcpy(send_buf, (char*)&config_mac, sizeof(ConfigMacReq));
|
||||
|
||||
int length = sizeof(ConfigMacReq);
|
||||
qint64 bytesWritten = m_tcpClient->sendData(send_buf, length);
|
||||
m_tcpClient->waitForRead();
|
||||
qDebug() << "bytesWritten: " << bytesWritten;
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void MacConfig::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
29
macconfig.h
Normal file
29
macconfig.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef MACCONFIG_H
|
||||
#define MACCONFIG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "MyTcpClient.h"
|
||||
|
||||
namespace Ui {
|
||||
class MacConfig;
|
||||
}
|
||||
|
||||
class MacConfig : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MacConfig(QWidget *parent = nullptr);
|
||||
~MacConfig();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
private:
|
||||
Ui::MacConfig *ui;
|
||||
MyTcpClient* m_tcpClient;
|
||||
};
|
||||
|
||||
#endif // MACCONFIG_H
|
||||
74
macconfig.ui
Normal file
74
macconfig.ui
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MacConfig</class>
|
||||
<widget class="QWidget" name="MacConfig">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>mac配置</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>80</y>
|
||||
<width>54</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>MAC:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_mac">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>80</y>
|
||||
<width>113</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>212</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>212</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
1510
mainwindow.cpp
1510
mainwindow.cpp
File diff suppressed because it is too large
Load Diff
31
mainwindow.h
31
mainwindow.h
@ -45,6 +45,10 @@ private:
|
||||
QTcpSocket *socket;
|
||||
|
||||
QProgressBar *progressBar;
|
||||
int current_slot;
|
||||
QString tsi_config_file;
|
||||
bool shouldReconnect ;
|
||||
QLabel *connect_status;
|
||||
|
||||
void createMenu();
|
||||
void createMenu(const QString& rootTitle, QPushButton* button = nullptr);
|
||||
@ -54,15 +58,38 @@ private:
|
||||
void readJsonFile(const QString &filePath);
|
||||
void sendUpgradePackage(int slot);
|
||||
void getVersion(int slot);
|
||||
void ConfigSubCard(int slot);
|
||||
void GetSubLog(int slot);
|
||||
void initStyle();
|
||||
void connectServer();
|
||||
void UploadConfigFile(uint8_t sub_cmd);
|
||||
void GetVoltageRangeValue(int slot);
|
||||
void GetVibVersion(int slot);
|
||||
void GetCardProcessID(int slot);
|
||||
void CopySubCard(int slot);
|
||||
void MoveSubCard(int slot);
|
||||
void VibRealy(int slot);
|
||||
|
||||
private slots:
|
||||
|
||||
void onDisConnected();
|
||||
void onConnected();
|
||||
void readData(const QByteArray&);
|
||||
void onerrorOccurred(const QString &errorMsg);
|
||||
void onMenuAction_relay();
|
||||
void OnButtonGroup(QAbstractButton *);
|
||||
void onConnect();
|
||||
void onDisconnect();
|
||||
void onEthConfig();
|
||||
void onMACConfig();
|
||||
void onSetTime();
|
||||
void onMqttConfig();
|
||||
void onConfigDeviceID();
|
||||
void onGetDeviceID();
|
||||
void onCloseConfig();
|
||||
void onOpenUserManual();
|
||||
void onGetChannelCRC();
|
||||
|
||||
|
||||
void onMenuActionTriggered();
|
||||
void on_pushButton_slot_clicked();
|
||||
@ -71,5 +98,9 @@ private slots:
|
||||
void on_pushButton_point_name_clicked();
|
||||
void on_pushButton_save_clicked();
|
||||
void on_pushButton_open_clicked();
|
||||
void on_pushButton_download_clicked();
|
||||
void on_pushButton_upload_clicked();
|
||||
void on_pushButton_upload_config_clicked();
|
||||
void on_pushButton_close_clicked();
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
409
mainwindow.ui
409
mainwindow.ui
@ -7,29 +7,14 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1129</width>
|
||||
<height>529</height>
|
||||
<height>564</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
<string>TSI_Config</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_body" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
@ -48,31 +33,6 @@
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton_save">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_open">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
@ -93,11 +53,42 @@
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>保存配置</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_22">
|
||||
<widget class="QPushButton" name="pushButton_open">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>打开配置文件</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打开</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_upload">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
@ -118,11 +109,70 @@
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>上传配置文件</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>上传</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_23">
|
||||
<widget class="QPushButton" name="pushButton_download">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>20</y>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>下载配置文件</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>下载</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_upload_config">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>20</y>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>上传配置文件并下发到子板卡</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>配置</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_close">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
@ -143,108 +193,11 @@
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_24">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>20</y>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
<property name="toolTip">
|
||||
<string>关闭配置文件</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_25">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>20</y>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_26">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>20</y>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_27">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>430</x>
|
||||
<y>20</y>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>关闭</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -314,7 +267,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>触发配置</string>
|
||||
<string>直流输出</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@ -414,7 +367,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
@ -770,25 +723,62 @@
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
<height>280</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
<height>280</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>电源板</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>140</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>电源1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>140</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>电源2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -831,7 +821,7 @@
|
||||
<enum>Qt::DefaultContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>振动</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -850,7 +840,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>振动</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -869,7 +859,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>振动</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -888,7 +878,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>振动</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1110,6 +1100,22 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_bot" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_version">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1124,19 +1130,18 @@
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu">
|
||||
<widget class="QMenu" name="menu_start">
|
||||
<property name="title">
|
||||
<string>文件</string>
|
||||
<string>开始</string>
|
||||
</property>
|
||||
<addaction name="actionNEW"/>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actiondaoru"/>
|
||||
<addaction name="actionlianjie"/>
|
||||
<addaction name="action_connect"/>
|
||||
<addaction name="action_disconnect"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_2">
|
||||
<property name="title">
|
||||
<string>帮助</string>
|
||||
</property>
|
||||
<addaction name="action_user_manual"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_tool">
|
||||
<property name="title">
|
||||
@ -1144,18 +1149,24 @@
|
||||
</property>
|
||||
<addaction name="action_realy"/>
|
||||
<addaction name="action_time"/>
|
||||
<addaction name="action_eth"/>
|
||||
<addaction name="action_mac"/>
|
||||
<addaction name="action_mqtt"/>
|
||||
<addaction name="action_deviveID"/>
|
||||
<addaction name="action_get_deviceID"/>
|
||||
<addaction name="action_get_channel_crc"/>
|
||||
</widget>
|
||||
<addaction name="menu"/>
|
||||
<addaction name="menu_2"/>
|
||||
<addaction name="menu_start"/>
|
||||
<addaction name="menu_tool"/>
|
||||
<addaction name="menu_2"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionNEW">
|
||||
<action name="action_new">
|
||||
<property name="text">
|
||||
<string>新建</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen">
|
||||
<action name="action_open">
|
||||
<property name="text">
|
||||
<string>打开</string>
|
||||
</property>
|
||||
@ -1167,19 +1178,69 @@
|
||||
</action>
|
||||
<action name="action_time">
|
||||
<property name="text">
|
||||
<string>校时功能</string>
|
||||
<string>校时</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actiondaoru">
|
||||
<action name="action_import">
|
||||
<property name="text">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionlianjie">
|
||||
<action name="action_connect">
|
||||
<property name="text">
|
||||
<string>连接</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_disconnect">
|
||||
<property name="text">
|
||||
<string>断开</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_eth">
|
||||
<property name="text">
|
||||
<string>网络配置</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_mac">
|
||||
<property name="text">
|
||||
<string>MAC配置</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_mqtt">
|
||||
<property name="text">
|
||||
<string>MQTT配置</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_deviveID">
|
||||
<property name="text">
|
||||
<string>设备ID配置</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_get_deviceID">
|
||||
<property name="text">
|
||||
<string>获取设备ID</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_get_vib_version">
|
||||
<property name="text">
|
||||
<string>获取振动板卡辅助程序版本</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_close">
|
||||
<property name="text">
|
||||
<string>关闭</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_user_manual">
|
||||
<property name="text">
|
||||
<string>使用手册</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_get_channel_crc">
|
||||
<property name="text">
|
||||
<string>获取通道CRC</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
53
mqtt_config.cpp
Normal file
53
mqtt_config.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
#include "mqtt_config.h"
|
||||
#include "ui_mqtt_config.h"
|
||||
#include <QRegExpValidator>
|
||||
MqttConfig::MqttConfig(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::MqttConfig)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QString exp = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.)"
|
||||
"{3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b";
|
||||
QRegExp rege(exp);
|
||||
QValidator *Validator = new QRegExpValidator(rege);
|
||||
ui->lineEdit_ip->setValidator(Validator);
|
||||
m_tcpClient = MyTcpClient::instance();
|
||||
connect(m_tcpClient, SIGNAL(dataReceived(const QByteArray &)), this, SLOT(readData(const QByteArray &)));
|
||||
|
||||
}
|
||||
|
||||
MqttConfig::~MqttConfig()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void MqttConfig::readData(const QByteArray &data) {
|
||||
qDebug() << "Received from server:" << data;
|
||||
uint8_t cmd = data[3];
|
||||
if (cmd == kConfigMQTTBrokerInfo) {
|
||||
MQTTBrokerConfigInfoRsp mqtt_config_rsp;
|
||||
memcpy(&mqtt_config_rsp, data.data(), sizeof(MQTTBrokerConfigInfoRsp));
|
||||
qDebug() << "mqtt_config_rsp code" << mqtt_config_rsp.code ;
|
||||
}
|
||||
}
|
||||
void MqttConfig::on_pushButton_confirm_clicked()
|
||||
{
|
||||
MQTTBrokerConfigInfoReq mqtt_config = { {0xAA, 0x55, 0xAA}, kConfigMQTTBrokerInfo, 1,1,{} };
|
||||
memcpy(mqtt_config.ip,ui->lineEdit_ip->text().toStdString().c_str(),sizeof(mqtt_config.ip));
|
||||
mqtt_config.port = ui->lineEdit_port->text().toInt();
|
||||
char send_buf[100] ={0};
|
||||
memcpy(send_buf, (char*)&mqtt_config, sizeof(MQTTBrokerConfigInfoReq));
|
||||
|
||||
int length = sizeof(MQTTBrokerConfigInfoReq);
|
||||
qint64 bytesWritten = m_tcpClient->sendData(send_buf, length);
|
||||
m_tcpClient->waitForRead();
|
||||
qDebug() << "bytesWritten: " << bytesWritten;
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void MqttConfig::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
28
mqtt_config.h
Normal file
28
mqtt_config.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef MQTT_CONFIG_H
|
||||
#define MQTT_CONFIG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "MyTcpClient.h"
|
||||
namespace Ui {
|
||||
class MqttConfig;
|
||||
}
|
||||
|
||||
class MqttConfig : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MqttConfig(QWidget *parent = nullptr);
|
||||
~MqttConfig();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
void readData(const QByteArray&);
|
||||
private:
|
||||
Ui::MqttConfig *ui;
|
||||
MyTcpClient* m_tcpClient;
|
||||
};
|
||||
|
||||
#endif // MQTT_CONFIG_H
|
||||
116
mqtt_config.ui
Normal file
116
mqtt_config.ui
Normal file
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MqttConfig</class>
|
||||
<widget class="QWidget" name="MqttConfig">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>412</width>
|
||||
<height>314</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MQTT 配置</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>30</y>
|
||||
<width>111</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>MQTT 服务器配置</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>90</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IP:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_ip">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>80</y>
|
||||
<width>151</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>130</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>端口:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_port">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>120</y>
|
||||
<width>151</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>230</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>230</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
92
pointname.cpp
Normal file
92
pointname.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
#include "pointname.h"
|
||||
#include "ui_pointname.h"
|
||||
#include "config_mgr.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "tachometer_data.h"
|
||||
#include "keyphase_data.h"
|
||||
#include "high_speed_current_data.h"
|
||||
|
||||
PointName::PointName(int slot_no_,CardType cardtype,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::PointName)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
slot_no = slot_no_;
|
||||
car_type = cardtype;
|
||||
ui->label_slot->setText(QString::number(slot_no));
|
||||
Init();
|
||||
}
|
||||
|
||||
PointName::~PointName()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PointName::Init()
|
||||
{
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
return;
|
||||
}
|
||||
if(base_ptr->card_type_ == kCardVibSingle){
|
||||
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
|
||||
ui->lineEdit_pointname_1->setText(vib_data->base_config_[0].point_name);
|
||||
ui->lineEdit_pointname_2->setText(vib_data->base_config_[1].point_name);
|
||||
ui->lineEdit_pointname_3->setText(vib_data->base_config_[2].point_name);
|
||||
ui->lineEdit_pointname_4->setText(vib_data->base_config_[3].point_name);
|
||||
}else if(base_ptr->card_type_ == kCardSpeedSingle){
|
||||
std::shared_ptr<TachometerData> tac_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
|
||||
ui->lineEdit_pointname_1->setText(tac_data->variables_[0].point_name);
|
||||
ui->lineEdit_pointname_2->setText(tac_data->variables_[1].point_name);
|
||||
ui->lineEdit_pointname_3->setText(tac_data->variables_[2].point_name);
|
||||
ui->lineEdit_pointname_4->setText(tac_data->variables_[3].point_name);
|
||||
}else if(base_ptr->card_type_ == kCardKeyphaseSingle){
|
||||
std::shared_ptr<KeyphaseData> keyphase_data = std::dynamic_pointer_cast<KeyphaseData>(base_ptr);
|
||||
ui->lineEdit_pointname_1->setText(keyphase_data->variables_[0].point_name);
|
||||
ui->lineEdit_pointname_2->setText(keyphase_data->variables_[1].point_name);
|
||||
ui->lineEdit_pointname_3->setText(keyphase_data->variables_[2].point_name);
|
||||
ui->lineEdit_pointname_4->setText(keyphase_data->variables_[3].point_name);
|
||||
}
|
||||
}
|
||||
|
||||
void PointName::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void PointName::on_pushButton_confirm_clicked()
|
||||
{
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
return;
|
||||
}
|
||||
if(base_ptr->card_type_ == kCardVibSingle){
|
||||
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
vib_data->base_config_[0].point_name = ui->lineEdit_pointname_1->text();
|
||||
vib_data->base_config_[1].point_name = ui->lineEdit_pointname_2->text();
|
||||
vib_data->base_config_[2].point_name = ui->lineEdit_pointname_3->text();
|
||||
vib_data->base_config_[3].point_name = ui->lineEdit_pointname_4->text();
|
||||
}else if(base_ptr->card_type_ == kCardSpeedSingle){
|
||||
std::shared_ptr<TachometerData> tac_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
|
||||
tac_data->variables_[0].point_name = ui->lineEdit_pointname_1->text();
|
||||
tac_data->variables_[1].point_name = ui->lineEdit_pointname_2->text();
|
||||
tac_data->variables_[2].point_name = ui->lineEdit_pointname_3->text();
|
||||
tac_data->variables_[3].point_name = ui->lineEdit_pointname_4->text();
|
||||
}else if(base_ptr->card_type_ == kCardKeyphaseSingle){
|
||||
std::shared_ptr<KeyphaseData> keyphase_data = std::dynamic_pointer_cast<KeyphaseData>(base_ptr);
|
||||
keyphase_data->variables_[0].point_name = ui->lineEdit_pointname_1->text();
|
||||
keyphase_data->variables_[1].point_name = ui->lineEdit_pointname_2->text();
|
||||
keyphase_data->variables_[2].point_name = ui->lineEdit_pointname_3->text();
|
||||
keyphase_data->variables_[3].point_name = ui->lineEdit_pointname_4->text();
|
||||
}else if(base_ptr->card_type_ == kCardHighSpeedCurrent){
|
||||
std::shared_ptr<HighSpeedCurrentData> keyphase_data = std::dynamic_pointer_cast<HighSpeedCurrentData>(base_ptr);
|
||||
keyphase_data->variables_[0].point_name = ui->lineEdit_pointname_1->text();
|
||||
keyphase_data->variables_[1].point_name = ui->lineEdit_pointname_2->text();
|
||||
keyphase_data->variables_[2].point_name = ui->lineEdit_pointname_3->text();
|
||||
keyphase_data->variables_[3].point_name = ui->lineEdit_pointname_4->text();
|
||||
}
|
||||
this->close();
|
||||
}
|
||||
|
||||
31
pointname.h
Normal file
31
pointname.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef POINTNAME_H
|
||||
#define POINTNAME_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "data_config.h"
|
||||
|
||||
namespace Ui {
|
||||
class PointName;
|
||||
}
|
||||
|
||||
class PointName : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PointName(int slot_no_,CardType cardtype,QWidget *parent = nullptr);
|
||||
~PointName();
|
||||
int slot_no;
|
||||
CardType car_type;
|
||||
private slots:
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
private:
|
||||
Ui::PointName *ui;
|
||||
|
||||
void Init();
|
||||
};
|
||||
|
||||
#endif // POINTNAME_H
|
||||
211
pointname.ui
Normal file
211
pointname.ui
Normal file
@ -0,0 +1,211 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PointName</class>
|
||||
<widget class="QWidget" name="PointName">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>416</width>
|
||||
<height>291</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>测点名称</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>30</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>槽位号:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_slot">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>30</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>slot</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>232</y>
|
||||
<width>81</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>232</y>
|
||||
<width>71</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>70</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>通道1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_1"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>110</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>通道2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>150</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>通道3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_3"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>190</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>通道4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_4"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
14
pointname_relay.cpp
Normal file
14
pointname_relay.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "pointname_relay.h"
|
||||
#include "ui_pointname_relay.h"
|
||||
|
||||
PointNameRelay::PointNameRelay(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::PointNameRelay)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
PointNameRelay::~PointNameRelay()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
22
pointname_relay.h
Normal file
22
pointname_relay.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef POINTNAME_RELAY_H
|
||||
#define POINTNAME_RELAY_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class PointNameRelay;
|
||||
}
|
||||
|
||||
class PointNameRelay : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PointNameRelay(QWidget *parent = nullptr);
|
||||
~PointNameRelay();
|
||||
|
||||
private:
|
||||
Ui::PointNameRelay *ui;
|
||||
};
|
||||
|
||||
#endif // POINTNAME_RELAY_H
|
||||
631
pointname_relay.ui
Normal file
631
pointname_relay.ui
Normal file
@ -0,0 +1,631 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PointNameRelay</class>
|
||||
<widget class="QWidget" name="PointNameRelay">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>742</width>
|
||||
<height>495</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>60</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>通道1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_1"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>430</y>
|
||||
<width>71</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>140</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>通道3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_3"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>槽位号:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_slot">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>20</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>slot</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>430</y>
|
||||
<width>81</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>100</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>通道2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>180</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>通道4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_4"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>220</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>通道5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_5"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>260</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>通道6</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_6"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>300</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>通道7</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_7"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>340</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>通道8</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_8"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_9">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>60</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>通道9</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_9"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_10">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>100</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>通道10</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_10"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_11">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>140</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>通道11</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_11"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_12">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>180</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>通道12</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_12"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_13">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>220</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>通道13</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_13"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_14">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>260</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>通道14</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_14"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_15">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>300</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>通道15</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_15">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_15"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_16">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>340</y>
|
||||
<width>281</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>通道16</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pointname_16"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
405
pressure_pulsation.cpp
Normal file
405
pressure_pulsation.cpp
Normal file
@ -0,0 +1,405 @@
|
||||
#include "pressure_pulsation.h"
|
||||
#include "ui_pressure_pulsation.h"
|
||||
#include <QDebug>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QMessageBox>
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "config_mgr.h"
|
||||
|
||||
PressurePulsation::PressurePulsation(int slot_no_, int channel_, bool active,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::PressurePulsation)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
slot_no = slot_no_;
|
||||
channel = channel_;
|
||||
QString chan = QString("%1").arg(channel);
|
||||
QString slot = QString("%1").arg(slot_no);
|
||||
ui->label_channel->setText(chan);
|
||||
ui->label_slot->setText(slot);
|
||||
if (active) {
|
||||
ui->label_active->setText("(启用)");
|
||||
} else {
|
||||
ui->label_active->setText("(停用)");
|
||||
}
|
||||
ui->comboBox_fre_domain_resolution->setCurrentIndex(2);
|
||||
ui->comboBox_lines_number->setCurrentIndex(2);
|
||||
Init();
|
||||
}
|
||||
|
||||
PressurePulsation::~PressurePulsation()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void PressurePulsation::Init() {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[Radial::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if (ptr->base_config_[channel - 1].channel_type != kVibPressurePulsation) {
|
||||
qDebug() << "[Radial::Init] channel type changes";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "[Radial::Init] no channel ptr";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<PressurePulsationVariable> variable_ptr = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
|
||||
ui->checkBox_low_pass->setChecked(variable_ptr->filter_[0].checked);
|
||||
ui->spinBox_low_pass_low->setValue(variable_ptr->filter_[0].low);
|
||||
ui->spinBox_low_pass_high->setValue(variable_ptr->filter_[0].high);
|
||||
ui->checkBox_high_pass->setChecked(variable_ptr->filter_[1].checked);
|
||||
ui->spinBox_high_pass_low->setValue(variable_ptr->filter_[1].low);
|
||||
ui->spinBox_high_pass_high->setValue(variable_ptr->filter_[1].high);
|
||||
ui->checkBox_band_pass->setChecked(variable_ptr->filter_[2].checked);
|
||||
ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low);
|
||||
ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high);
|
||||
// processed output
|
||||
// -general
|
||||
if(variable_ptr->general.output_used)
|
||||
ui->comboBox_output_used->setCurrentIndex(0);
|
||||
else
|
||||
ui->comboBox_output_used->setCurrentIndex(1);
|
||||
ui->comboBox_engineering_unit->setCurrentText(GetUnit(variable_ptr->general.engineering_unit));
|
||||
ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level));
|
||||
ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis));
|
||||
ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.delay));
|
||||
ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable);
|
||||
ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch);
|
||||
|
||||
ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level));
|
||||
ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.hysteresis));
|
||||
ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.delay));
|
||||
ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable);
|
||||
ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch);
|
||||
|
||||
ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level));
|
||||
ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.hysteresis));
|
||||
ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.delay));
|
||||
ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable);
|
||||
ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch);
|
||||
|
||||
ui->lineEdit_alert_low_level->setText(QString::number(variable_ptr->alert_low.level));
|
||||
ui->lineEdit_alert_low_hysteresis->setText(QString::number(variable_ptr->alert_low.hysteresis));
|
||||
ui->lineEdit_alert_low_delay->setText(QString::number(variable_ptr->alert_low.delay));
|
||||
ui->checkBox_alert_low_enable->setChecked(variable_ptr->alert_low.enable);
|
||||
ui->checkBox_alert_low_latch->setChecked(variable_ptr->alert_low.latch);
|
||||
|
||||
// freband output
|
||||
ui->comboBox_fre_domain_resolution->setCurrentText(QString::number( variable_ptr->freband_output_item.fre_domain_resolution));
|
||||
ui->comboBox_lines_number->setCurrentText(QString::number( variable_ptr->freband_output_item.lines_number));
|
||||
ui->checkBox_enable->setChecked(variable_ptr->freband_output[0].enable);
|
||||
ui->lineEdit_start->setText(QString::number(variable_ptr->freband_output[0].start));
|
||||
ui->lineEdit_end->setText(QString::number(variable_ptr->freband_output[0].end));
|
||||
ui->checkBox_enable_2->setChecked(variable_ptr->freband_output[1].enable);
|
||||
ui->lineEdit_start_2->setText(QString::number(variable_ptr->freband_output[1].start));
|
||||
ui->lineEdit_end_2->setText(QString::number(variable_ptr->freband_output[1].end));
|
||||
ui->checkBox_enable_3->setChecked(variable_ptr->freband_output[2].enable);
|
||||
ui->lineEdit_start_3->setText(QString::number(variable_ptr->freband_output[2].start));
|
||||
ui->lineEdit_end_3->setText(QString::number(variable_ptr->freband_output[2].end));
|
||||
ui->checkBox_enable_4->setChecked(variable_ptr->freband_output[3].enable);
|
||||
ui->lineEdit_start_4->setText(QString::number(variable_ptr->freband_output[3].start));
|
||||
ui->lineEdit_end_4->setText(QString::number(variable_ptr->freband_output[3].end));
|
||||
ui->checkBox_enable_5->setChecked(variable_ptr->freband_output[4].enable);
|
||||
ui->lineEdit_start_5->setText(QString::number(variable_ptr->freband_output[4].start));
|
||||
ui->lineEdit_end_5->setText(QString::number(variable_ptr->freband_output[4].end));
|
||||
ui->checkBox_enable_6->setChecked(variable_ptr->freband_output[5].enable);
|
||||
ui->lineEdit_start_6->setText(QString::number(variable_ptr->freband_output[5].start));
|
||||
ui->lineEdit_end_6->setText(QString::number(variable_ptr->freband_output[5].end));
|
||||
ui->checkBox_enable_7->setChecked(variable_ptr->freband_output[6].enable);
|
||||
ui->lineEdit_start_7->setText(QString::number(variable_ptr->freband_output[6].start));
|
||||
ui->lineEdit_end_7->setText(QString::number(variable_ptr->freband_output[6].end));
|
||||
ui->checkBox_enable_8->setChecked(variable_ptr->freband_output[7].enable);
|
||||
ui->lineEdit_start_8->setText(QString::number(variable_ptr->freband_output[7].start));
|
||||
ui->lineEdit_end_8->setText(QString::number(variable_ptr->freband_output[7].end));
|
||||
ui->checkBox_enable_9->setChecked(variable_ptr->freband_output[8].enable);
|
||||
ui->lineEdit_start_9->setText(QString::number(variable_ptr->freband_output[8].start));
|
||||
ui->lineEdit_end_9->setText(QString::number(variable_ptr->freband_output[8].end));
|
||||
ui->checkBox_enable_10->setChecked(variable_ptr->freband_output[9].enable);
|
||||
ui->lineEdit_start_10->setText(QString::number(variable_ptr->freband_output[9].start));
|
||||
ui->lineEdit_end_10->setText(QString::number(variable_ptr->freband_output[9].end));
|
||||
|
||||
}
|
||||
void PressurePulsation::on_pushButton_confirm_clicked()
|
||||
{
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[Radial::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高");
|
||||
return;
|
||||
}
|
||||
if(ui->spinBox_high_pass_low->value() > ui->spinBox_high_pass_high->value()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "带通1配置错误!");
|
||||
return;
|
||||
}
|
||||
if(ui->spinBox_low_pass_low->value() > ui->spinBox_low_pass_high->value()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "带通2配置错误!");
|
||||
return;
|
||||
}
|
||||
if(ui->spinBox_band_pass_low->value() > ui->spinBox_band_pass_high->value()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "带通3配置错误!");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
ptr->base_config_[channel - 1].channel_type = kVibPressurePulsation;
|
||||
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
std::shared_ptr<PressurePulsationVariable> variable = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
|
||||
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibThrust || variable == nullptr) {
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "no channel ptr";
|
||||
} else {
|
||||
ptr->RemoveChannel(channel);
|
||||
qDebug() << "channel type change";
|
||||
}
|
||||
std::shared_ptr<PressurePulsationVariable> variable = std::make_shared<PressurePulsationVariable>();
|
||||
variable->id_ = channel;
|
||||
variable->type_ = kVibPressurePulsation;
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->checkState();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
variable->filter_[1].checked = ui->checkBox_high_pass->checkState();
|
||||
variable->filter_[1].low = ui->spinBox_high_pass_low->value();
|
||||
variable->filter_[1].high = ui->spinBox_high_pass_high->value();
|
||||
variable->filter_[2].checked = ui->checkBox_band_pass->checkState();
|
||||
variable->filter_[2].low = ui->spinBox_band_pass_low->value();
|
||||
variable->filter_[2].high = ui->spinBox_band_pass_high->value();
|
||||
// processed output
|
||||
// -general
|
||||
if(ui->comboBox_output_used->currentIndex() == 0)
|
||||
variable->general.output_used = true;
|
||||
else
|
||||
variable->general.output_used = false;
|
||||
variable->general.engineering_unit = SetUnit(ui->comboBox_engineering_unit->currentText());
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble();
|
||||
variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble();
|
||||
variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble();
|
||||
variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked();
|
||||
variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked();
|
||||
variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble();
|
||||
variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble();
|
||||
variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble();
|
||||
variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked();
|
||||
variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked();
|
||||
// -freband output
|
||||
variable->freband_output_item.fre_domain_resolution = ui->comboBox_fre_domain_resolution->currentText().toFloat();
|
||||
variable->freband_output_item.lines_number = ui->comboBox_lines_number->currentText().toInt();
|
||||
variable->freband_output[0].enable = ui->checkBox_enable->isChecked();
|
||||
variable->freband_output[0].start = ui->lineEdit_start->text().toDouble();
|
||||
variable->freband_output[0].end = ui->lineEdit_end->text().toDouble();
|
||||
variable->freband_output[1].enable = ui->checkBox_enable_2->isChecked();
|
||||
variable->freband_output[1].start = ui->lineEdit_start_2->text().toDouble();
|
||||
variable->freband_output[1].end = ui->lineEdit_end_2->text().toDouble();
|
||||
variable->freband_output[2].enable = ui->checkBox_enable_3->isChecked();
|
||||
variable->freband_output[2].start = ui->lineEdit_start_3->text().toDouble();
|
||||
variable->freband_output[2].end = ui->lineEdit_end_3->text().toDouble();
|
||||
variable->freband_output[3].enable = ui->checkBox_enable_4->isChecked();
|
||||
variable->freband_output[3].start = ui->lineEdit_start_4->text().toDouble();
|
||||
variable->freband_output[3].end = ui->lineEdit_end_4->text().toDouble();
|
||||
variable->freband_output[4].enable = ui->checkBox_enable_5->isChecked();
|
||||
variable->freband_output[4].start = ui->lineEdit_start_5->text().toDouble();
|
||||
variable->freband_output[4].end = ui->lineEdit_end_5->text().toDouble();
|
||||
variable->freband_output[5].enable = ui->checkBox_enable_6->isChecked();
|
||||
variable->freband_output[5].start = ui->lineEdit_start_6->text().toDouble();
|
||||
variable->freband_output[5].end = ui->lineEdit_end_6->text().toDouble();
|
||||
variable->freband_output[6].enable = ui->checkBox_enable_7->isChecked();
|
||||
variable->freband_output[6].start = ui->lineEdit_start_7->text().toDouble();
|
||||
variable->freband_output[6].end = ui->lineEdit_end_7->text().toDouble();
|
||||
variable->freband_output[7].enable = ui->checkBox_enable_8->isChecked();
|
||||
variable->freband_output[7].start = ui->lineEdit_start_8->text().toDouble();
|
||||
variable->freband_output[7].end = ui->lineEdit_end_8->text().toDouble();
|
||||
variable->freband_output[8].enable = ui->checkBox_enable_9->isChecked();
|
||||
variable->freband_output[8].start = ui->lineEdit_start_9->text().toDouble();
|
||||
variable->freband_output[8].end = ui->lineEdit_end_9->text().toDouble();
|
||||
variable->freband_output[9].enable = ui->checkBox_enable_10->isChecked();
|
||||
variable->freband_output[9].start = ui->lineEdit_start_10->text().toDouble();
|
||||
variable->freband_output[9].end = ui->lineEdit_end_10->text().toDouble();
|
||||
|
||||
ptr->variables_.push_back(variable);
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->checkState();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
variable->filter_[1].checked = ui->checkBox_high_pass->checkState();
|
||||
variable->filter_[1].low = ui->spinBox_high_pass_low->value();
|
||||
variable->filter_[1].high = ui->spinBox_high_pass_high->value();
|
||||
variable->filter_[2].checked = ui->checkBox_band_pass->checkState();
|
||||
variable->filter_[2].low = ui->spinBox_band_pass_low->value();
|
||||
variable->filter_[2].high = ui->spinBox_band_pass_high->value();
|
||||
// processed output
|
||||
// -general
|
||||
if(ui->comboBox_output_used->currentIndex() == 0)
|
||||
variable->general.output_used = true;
|
||||
else
|
||||
variable->general.output_used = false;
|
||||
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble();
|
||||
variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble();
|
||||
variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble();
|
||||
variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked();
|
||||
variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked();
|
||||
variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble();
|
||||
variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble();
|
||||
variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble();
|
||||
variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked();
|
||||
variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked();
|
||||
// -freband output
|
||||
variable->freband_output_item.fre_domain_resolution = ui->comboBox_fre_domain_resolution->currentText().toFloat();
|
||||
variable->freband_output_item.lines_number = ui->comboBox_lines_number->currentText().toInt();
|
||||
variable->freband_output[0].enable = ui->checkBox_enable->isChecked();
|
||||
variable->freband_output[0].start = ui->lineEdit_start->text().toDouble();
|
||||
variable->freband_output[0].end = ui->lineEdit_end->text().toDouble();
|
||||
variable->freband_output[1].enable = ui->checkBox_enable_2->isChecked();
|
||||
variable->freband_output[1].start = ui->lineEdit_start_2->text().toDouble();
|
||||
variable->freband_output[1].end = ui->lineEdit_end_2->text().toDouble();
|
||||
variable->freband_output[2].enable = ui->checkBox_enable_3->isChecked();
|
||||
variable->freband_output[2].start = ui->lineEdit_start_3->text().toDouble();
|
||||
variable->freband_output[2].end = ui->lineEdit_end_3->text().toDouble();
|
||||
variable->freband_output[3].enable = ui->checkBox_enable_4->isChecked();
|
||||
variable->freband_output[3].start = ui->lineEdit_start_4->text().toDouble();
|
||||
variable->freband_output[3].end = ui->lineEdit_end_4->text().toDouble();
|
||||
variable->freband_output[4].enable = ui->checkBox_enable_5->isChecked();
|
||||
variable->freband_output[4].start = ui->lineEdit_start_5->text().toDouble();
|
||||
variable->freband_output[4].end = ui->lineEdit_end_5->text().toDouble();
|
||||
variable->freband_output[5].enable = ui->checkBox_enable_6->isChecked();
|
||||
variable->freband_output[5].start = ui->lineEdit_start_6->text().toDouble();
|
||||
variable->freband_output[5].end = ui->lineEdit_end_6->text().toDouble();
|
||||
variable->freband_output[6].enable = ui->checkBox_enable_7->isChecked();
|
||||
variable->freband_output[6].start = ui->lineEdit_start_7->text().toDouble();
|
||||
variable->freband_output[6].end = ui->lineEdit_end_7->text().toDouble();
|
||||
variable->freband_output[7].enable = ui->checkBox_enable_8->isChecked();
|
||||
variable->freband_output[7].start = ui->lineEdit_start_8->text().toDouble();
|
||||
variable->freband_output[7].end = ui->lineEdit_end_8->text().toDouble();
|
||||
variable->freband_output[8].enable = ui->checkBox_enable_9->isChecked();
|
||||
variable->freband_output[8].start = ui->lineEdit_start_9->text().toDouble();
|
||||
variable->freband_output[8].end = ui->lineEdit_end_9->text().toDouble();
|
||||
variable->freband_output[9].enable = ui->checkBox_enable_10->isChecked();
|
||||
variable->freband_output[9].start = ui->lineEdit_start_10->text().toDouble();
|
||||
variable->freband_output[9].end = ui->lineEdit_end_10->text().toDouble();
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void PressurePulsation::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void PressurePulsation::on_lineEdit_alert_high_level_editingFinished()
|
||||
{
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text());
|
||||
}
|
||||
}
|
||||
QString PressurePulsation::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 PressurePulsation::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;
|
||||
}
|
||||
34
pressure_pulsation.h
Normal file
34
pressure_pulsation.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef PRESSURE_PULSATION_H
|
||||
#define PRESSURE_PULSATION_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class PressurePulsation;
|
||||
}
|
||||
|
||||
class PressurePulsation : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PressurePulsation(int slot_no_, int channel_, bool active,QWidget *parent = nullptr);
|
||||
~PressurePulsation();
|
||||
int slot_no;
|
||||
int channel;
|
||||
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
void on_lineEdit_alert_high_level_editingFinished();
|
||||
|
||||
private:
|
||||
Ui::PressurePulsation *ui;
|
||||
void Init();
|
||||
QString GetUnit(int unit_num);
|
||||
int SetUnit(QString unit_str);
|
||||
};
|
||||
|
||||
#endif // PRESSURE_PULSATION_H
|
||||
1819
pressure_pulsation.ui
Normal file
1819
pressure_pulsation.ui
Normal file
File diff suppressed because it is too large
Load Diff
1
qss.qrc
1
qss.qrc
@ -1,5 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>qss/soft.css</file>
|
||||
<file>config/template_vib.json</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@ -5,11 +5,14 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QMessageBox>
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "config_mgr.h"
|
||||
|
||||
Radial_vibration::Radial_vibration(int slot_no_,int channel_,bool active,QWidget *parent)
|
||||
Radial::Radial(int slot_no_, int channel_, bool active, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::Radial_vibration)
|
||||
{
|
||||
, ui(new Ui::Radial_vibration) {
|
||||
ui->setupUi(this);
|
||||
slot_no = slot_no_;
|
||||
channel = channel_;
|
||||
@ -17,278 +20,319 @@ Radial_vibration::Radial_vibration(int slot_no_,int channel_,bool active,QWidget
|
||||
QString slot = QString("%1").arg(slot_no);
|
||||
ui->label_channel->setText(chan);
|
||||
ui->label_slot->setText(slot);
|
||||
if(active)
|
||||
if (active) {
|
||||
ui->label_active->setText("(启用)");
|
||||
else
|
||||
} else {
|
||||
ui->label_active->setText("(停用)");
|
||||
QString filePath_filter = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\filter_%2.json").arg(slot_no).arg(channel);
|
||||
readJsonFile(filePath_filter);
|
||||
QString filePath_variables = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\radial_vibration_variables_%2.json").arg(slot_no).arg(channel);
|
||||
readJsonFile(filePath_variables);
|
||||
}
|
||||
ui->comboBox_output_used_2->setCurrentIndex(1);
|
||||
Init();
|
||||
}
|
||||
|
||||
Radial_vibration::~Radial_vibration()
|
||||
{
|
||||
Radial::~Radial() {
|
||||
delete ui;
|
||||
}
|
||||
void Radial_vibration::readJsonFile(const QString &filePath)
|
||||
{
|
||||
// 创建文件对象
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qDebug() << "Cannot open file for reading:" << filePath;
|
||||
return;
|
||||
}
|
||||
QString content = file.readAll();
|
||||
file.close();
|
||||
QByteArray jsonData = content.toUtf8();
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
|
||||
if (jsonDoc.isNull()) {
|
||||
qDebug() << "Cannot parse JSON document";
|
||||
return;
|
||||
}
|
||||
if (!jsonDoc.isObject() && !jsonDoc.isArray()) {
|
||||
qDebug() << "JSON document is not an object or an array";
|
||||
return;
|
||||
}
|
||||
QJsonObject json_obj = jsonDoc.object();
|
||||
if(filePath.contains("filter_")){
|
||||
QJsonArray filter_array = json_obj["filter"].toArray();
|
||||
for(int i = 0; i < filter_array.size(); i++){
|
||||
QJsonObject temp_obj = filter_array[i].toObject();
|
||||
filter[i].type = temp_obj["type"].toString();
|
||||
filter[i].low = temp_obj["low"].toInt();
|
||||
filter[i].high = temp_obj["high"].toInt();
|
||||
filter[i].checked = temp_obj["checked"].toBool();
|
||||
}
|
||||
}else if(filePath.contains("radial_vibration_variables_")){
|
||||
QJsonArray variables_array = json_obj["variables"].toArray();
|
||||
for(int i = 0; i < variables_array.size(); i++){
|
||||
QJsonObject temp_obj = variables_array[i].toObject();
|
||||
variables[i].type = temp_obj["type"].toString();
|
||||
if(variables[i].type == "direct"){
|
||||
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
|
||||
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
}else if(variables[i].type == "bias_volt"){
|
||||
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
|
||||
}else if(variables[i].type == "1x_ampl" || variables[i].type == "2x_ampl"){
|
||||
variables[i].checked = temp_obj["checked"].toBool();
|
||||
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
|
||||
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
variables[i].phase_lag = temp_obj["phase_lag"].toDouble();
|
||||
}else if(variables[i].type == "not_1x_ampl"){
|
||||
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
variables[i].checked = temp_obj["checked"].toBool();
|
||||
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
|
||||
}else if(variables[i].type == "smax_ampl"){
|
||||
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
variables[i].checked = temp_obj["checked"].toBool();
|
||||
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
|
||||
}
|
||||
}
|
||||
QJsonObject delay_obj = json_obj["delay"].toObject();
|
||||
delay.alert = delay_obj["alert"].toInt();
|
||||
delay.danger = delay_obj["danger"].toDouble();
|
||||
delay.active_100ms = delay_obj["active_100ms"].toBool();
|
||||
alert_variables.alert_latching = json_obj["alert_latching"].toBool();
|
||||
alert_variables.danger_latching = json_obj["danger_latching"].toBool();
|
||||
alert_variables.timed_ok = json_obj["timed_ok"].toBool();
|
||||
alert_variables.recorder_output = json_obj["recorder_output"].toString();
|
||||
alert_variables.two_ma_clamp = json_obj["two_ma_clamp"].toBool();
|
||||
alert_variables.trip_multiply = json_obj["trip_multiply"].toDouble();
|
||||
alert_variables.comparision = json_obj["comparision"].toString();
|
||||
alert_variables.comparision_percentage = json_obj["comparision_percentage"].toInt();
|
||||
}
|
||||
|
||||
void Radial::on_pushButton_cancel_clicked() {
|
||||
this->close();
|
||||
}
|
||||
|
||||
void Radial_vibration::Init()
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if(filter[i].type == "band_pass"){
|
||||
ui->checkBox_band_pass->setChecked(filter[i].checked);
|
||||
ui->spinBox_band_pass_low->setValue(filter[i].low);
|
||||
ui->spinBox_band_pass_high->setValue(filter[i].high);
|
||||
}else if(filter[i].type == "low_pass"){
|
||||
ui->checkBox_low_pass->setChecked(filter[i].checked);
|
||||
ui->spinBox_low_pass_low->setValue(filter[i].low);
|
||||
ui->spinBox_low_pass_high->setValue(filter[i].high);
|
||||
}else if(filter[i].type == "high_pass"){
|
||||
ui->checkBox_high_pass->setChecked(filter[i].checked);
|
||||
ui->spinBox_high_pass_low->setValue(filter[i].low);
|
||||
ui->spinBox_high_pass_high->setValue(filter[i].high);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if(variables[i].type == "direct"){
|
||||
ui->comboBox_direct_value_range->setCurrentText(variables[i].full_sacle_range);
|
||||
ui->doubleSpinBox_direct_clamp->setValue(variables[i].clamp_value);
|
||||
}else if(variables[i].type == "gap"){
|
||||
ui->comboBox_gap_range->setCurrentText(variables[i].full_sacle_range);
|
||||
ui->doubleSpinBox_gap_clamp->setValue(variables[i].clamp_value);
|
||||
}else if(variables[i].type == "1x_ampl"){
|
||||
ui->checkBox_1x_ampl->setChecked(variables[i].checked);
|
||||
ui->comboBox_1x_value_range->setCurrentText(variables[i].full_sacle_range);
|
||||
ui->doubleSpinBox_1x_ampl_clamp->setValue(variables[i].clamp_value);
|
||||
ui->doubleSpinBox_1x_phase_lag_clamp->setValue(variables[i].phase_lag);
|
||||
}else if(variables[i].type == "2x_ampl"){
|
||||
ui->checkBox_2x_ampl->setChecked(variables[i].checked);
|
||||
ui->comboBox_2x_value_range->setCurrentText(variables[i].full_sacle_range);
|
||||
ui->doubleSpinBox_2x_ampl_clamp->setValue(variables[i].clamp_value);
|
||||
ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variables[i].phase_lag);
|
||||
}else if(variables[i].type == "not_1x_ampl"){
|
||||
ui->checkBox_not_1x_ampl->setChecked(variables[i].checked);
|
||||
ui->comboBox_not_1x_ampl->setCurrentText(variables[i].full_sacle_range);
|
||||
ui->doubleSpinBox_not_1x_ampl_clamp->setValue(variables[i].clamp_value);
|
||||
}else if(variables[i].type == "smax_ampl"){
|
||||
ui->checkBox_smax_ampl->setChecked(variables[i].checked);
|
||||
ui->comboBox_smax_range->setCurrentText(variables[i].full_sacle_range);
|
||||
ui->doubleSpinBox_smax_clamp->setValue(variables[i].clamp_value);
|
||||
}
|
||||
}
|
||||
ui->spinBox_alert_delay->setValue(delay.alert);
|
||||
ui->doubleSpinBox_danger_delay->setValue(delay.danger);
|
||||
ui->checkBox_100ms_delay->setChecked(delay.active_100ms);
|
||||
ui->checkBox_alert_latching->setChecked(alert_variables.alert_latching);
|
||||
ui->checkBox_danger_latching->setChecked(alert_variables.danger_latching);
|
||||
ui->comboBox_recorder_output->setCurrentText(alert_variables.recorder_output);
|
||||
ui->checkBox_two_ma_clamp->setChecked(alert_variables.two_ma_clamp);
|
||||
ui->doubleSpinBox_trip_multiply->setValue(alert_variables.trip_multiply);
|
||||
ui->comboBox_comparision->setCurrentText(alert_variables.comparision);
|
||||
ui->spinBox_comparision_percentage->setValue(alert_variables.comparision_percentage);
|
||||
void Radial::on_checkBox_1x_ampl_toggled(bool checked) {
|
||||
|
||||
}
|
||||
|
||||
void Radial_vibration::on_pushButton_confirm_clicked()
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if(filter[i].checked){
|
||||
if(filter[i].type == "band_pass"){
|
||||
filter[i].checked = ui->checkBox_band_pass->isChecked();
|
||||
filter[i].low = ui->spinBox_band_pass_low->value();
|
||||
filter[i].high = ui->spinBox_band_pass_high->value();
|
||||
}else if(filter[i].type == "low_pass"){
|
||||
filter[i].checked = ui->checkBox_low_pass->isChecked();
|
||||
filter[i].low = ui->spinBox_low_pass_low->value();
|
||||
filter[i].high = ui->spinBox_low_pass_high->value();
|
||||
}else if(filter[i].type == "high_pass"){
|
||||
filter[i].checked = ui->checkBox_high_pass->isChecked();
|
||||
filter[i].low = ui->spinBox_high_pass_low->value();
|
||||
filter[i].high = ui->spinBox_high_pass_high->value();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if(variables[i].type == "direct"){
|
||||
variables[i].full_sacle_range = ui->comboBox_direct_value_range->currentText();
|
||||
variables[i].clamp_value = ui->doubleSpinBox_direct_clamp->value();
|
||||
}else if(variables[i].type == "gap"){
|
||||
variables[i].full_sacle_range = ui->comboBox_gap_range->currentText();
|
||||
variables[i].clamp_value = ui->doubleSpinBox_gap_clamp->value();
|
||||
}else if(variables[i].type == "1x_ampl"){
|
||||
variables[i].checked = ui->checkBox_1x_ampl->isChecked();
|
||||
variables[i].full_sacle_range = ui->comboBox_1x_value_range->currentText();
|
||||
variables[i].clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value();
|
||||
variables[i].phase_lag = ui->doubleSpinBox_1x_phase_lag_clamp->value();
|
||||
}else if(variables[i].type == "2x_ampl"){
|
||||
variables[i].checked = ui->checkBox_2x_ampl->isChecked();
|
||||
variables[i].full_sacle_range = ui->comboBox_2x_value_range->currentText();
|
||||
variables[i].clamp_value = ui->doubleSpinBox_2x_ampl_clamp->value();
|
||||
variables[i].phase_lag = ui->doubleSpinBox_2x_phase_lag_clamp->value();
|
||||
}else if(variables[i].type == "not_1x_ampl"){
|
||||
variables[i].checked = ui->checkBox_not_1x_ampl->isChecked();
|
||||
variables[i].full_sacle_range = ui->comboBox_not_1x_ampl->currentText();
|
||||
variables[i].clamp_value = ui->doubleSpinBox_not_1x_ampl_clamp->value();
|
||||
}else if(variables[i].type == "smax_ampl"){
|
||||
variables[i].checked = ui->checkBox_smax_ampl->isChecked();
|
||||
variables[i].full_sacle_range = ui->comboBox_smax_range->currentText();
|
||||
variables[i].clamp_value = ui->doubleSpinBox_smax_clamp->value();
|
||||
}
|
||||
}
|
||||
delay.alert = ui->spinBox_alert_delay->value();
|
||||
delay.danger = ui->doubleSpinBox_danger_delay->value();
|
||||
delay.active_100ms = ui->checkBox_100ms_delay->isChecked();
|
||||
alert_variables.alert_latching = ui->checkBox_alert_latching->isChecked();
|
||||
alert_variables.danger_latching = ui->checkBox_danger_latching->isChecked();
|
||||
alert_variables.recorder_output = ui->comboBox_recorder_output->currentText();
|
||||
alert_variables.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked();
|
||||
alert_variables.trip_multiply = ui->doubleSpinBox_trip_multiply->value();
|
||||
alert_variables.comparision = ui->comboBox_comparision->currentText();
|
||||
alert_variables.comparision_percentage = ui->spinBox_comparision_percentage->value();
|
||||
QJsonObject filter_obj,variables_obj;
|
||||
QJsonArray filter_array;
|
||||
for(int i = 0; i < 3; i++){
|
||||
QJsonObject temp_obj;
|
||||
temp_obj.insert("type",filter[i].type);
|
||||
temp_obj.insert("low",filter[i].low);
|
||||
temp_obj.insert("high",filter[i].high);
|
||||
temp_obj.insert("checked",filter[i].checked);
|
||||
filter_array.append(temp_obj);
|
||||
}
|
||||
filter_obj.insert("filter",filter_array);
|
||||
filter_obj.insert("slot",slot_no);
|
||||
filter_obj.insert("id",channel);
|
||||
filter_obj.insert("version",1);
|
||||
QJsonArray variables_array;
|
||||
for(int i = 0; i < 6; i++){
|
||||
QJsonObject temp_obj;
|
||||
temp_obj.insert("type",variables[i].type);
|
||||
if(variables[i].type == "direct"){
|
||||
temp_obj.insert("full_sacle_range",variables[i].full_sacle_range);
|
||||
temp_obj.insert("clamp_value",variables[i].clamp_value);
|
||||
}else if(variables[i].type == "gap"){
|
||||
temp_obj.insert("clamp_value",variables[i].clamp_value);
|
||||
temp_obj.insert("full_sacle_range",variables[i].full_sacle_range);
|
||||
}else if(variables[i].type == "1x_ampl" || variables[i].type == "2x_ampl"){
|
||||
temp_obj.insert("checked",variables[i].checked);
|
||||
temp_obj.insert("full_sacle_range",variables[i].full_sacle_range);
|
||||
temp_obj.insert("clamp_value",variables[i].clamp_value);
|
||||
temp_obj.insert("phase_lag",variables[i].phase_lag);
|
||||
}else if(variables[i].type == "not_1x_ampl" || variables[i].type == "smax_ampl"){
|
||||
temp_obj.insert("checked",variables[i].checked);
|
||||
temp_obj.insert("full_sacle_range",variables[i].full_sacle_range);
|
||||
temp_obj.insert("clamp_value",variables[i].clamp_value);
|
||||
}
|
||||
variables_array.append(temp_obj);
|
||||
}
|
||||
variables_obj.insert("variables",variables_array);
|
||||
QJsonObject delay_obj;
|
||||
delay_obj.insert("alert",delay.alert);
|
||||
delay_obj.insert("danger",delay.danger);
|
||||
delay_obj.insert("100ms",delay.active_100ms);
|
||||
variables_obj.insert("delay",delay_obj);
|
||||
variables_obj.insert("alert_latching",alert_variables.alert_latching);
|
||||
variables_obj.insert("danger_latching",alert_variables.danger_latching);
|
||||
variables_obj.insert("recorder_output",alert_variables.recorder_output);
|
||||
variables_obj.insert("two_ma_clamp",alert_variables.two_ma_clamp);
|
||||
variables_obj.insert("trip_multiply",alert_variables.trip_multiply);
|
||||
variables_obj.insert("comparision",alert_variables.comparision);
|
||||
variables_obj.insert("comparision_percentage",alert_variables.comparision_percentage);
|
||||
variables_obj.insert("slot",slot_no);
|
||||
variables_obj.insert("id",channel);
|
||||
variables_obj.insert("version",1);
|
||||
QString filePath_filter = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\filter_%2.json").arg(slot_no).arg(channel);
|
||||
QString filePath_variables = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\radial_vibration_variables_%2.json").arg(slot_no).arg(channel);
|
||||
QFile file_filter(filePath_filter);
|
||||
QFile file_variables(filePath_variables);
|
||||
if (!file_filter.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qDebug() << "Cannot open file for writing:" << filePath_filter;
|
||||
void Radial::on_checkBox_2x_ampl_toggled(bool checked) {
|
||||
|
||||
}
|
||||
|
||||
void Radial::Init() {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[Radial::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
if (!file_variables.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qDebug() << "Cannot open file for writing:" << filePath_variables;
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if (ptr->base_config_[channel - 1].channel_type != kVibRadial) {
|
||||
qDebug() << "[Radial::Init] channel type changes";
|
||||
return;
|
||||
}
|
||||
QJsonDocument jsonDoc_filter(filter_obj);
|
||||
QJsonDocument jsonDoc_variables(variables_obj);
|
||||
file_filter.write(jsonDoc_filter.toJson());
|
||||
file_variables.write(jsonDoc_variables.toJson());
|
||||
file_filter.close();
|
||||
file_variables.close();
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "[Radial::Init] no channel ptr";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<RadialVariable> variable_ptr = std::dynamic_pointer_cast<RadialVariable>(variable_base);
|
||||
ui->checkBox_low_pass->setChecked(variable_ptr->filter_[0].checked);
|
||||
ui->spinBox_low_pass_low->setValue(variable_ptr->filter_[0].low);
|
||||
ui->spinBox_low_pass_high->setValue(variable_ptr->filter_[0].high);
|
||||
ui->checkBox_high_pass->setChecked(variable_ptr->filter_[1].checked);
|
||||
ui->spinBox_high_pass_low->setValue(variable_ptr->filter_[1].low);
|
||||
ui->spinBox_high_pass_high->setValue(variable_ptr->filter_[1].high);
|
||||
ui->checkBox_band_pass->setChecked(variable_ptr->filter_[2].checked);
|
||||
ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low);
|
||||
ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high);
|
||||
// processed output
|
||||
// -general
|
||||
if(variable_ptr->general.output_used)
|
||||
ui->comboBox_output_used->setCurrentIndex(0);
|
||||
else
|
||||
ui->comboBox_output_used->setCurrentIndex(1);
|
||||
ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->general.engineering_unit);
|
||||
ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level));
|
||||
ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis));
|
||||
ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.delay));
|
||||
ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable);
|
||||
ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch);
|
||||
|
||||
ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level));
|
||||
ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.hysteresis));
|
||||
ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.delay));
|
||||
ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable);
|
||||
ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch);
|
||||
|
||||
ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level));
|
||||
ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.hysteresis));
|
||||
ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.delay));
|
||||
ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable);
|
||||
ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch);
|
||||
|
||||
ui->lineEdit_alert_low_level->setText(QString::number(variable_ptr->alert_low.level));
|
||||
ui->lineEdit_alert_low_hysteresis->setText(QString::number(variable_ptr->alert_low.hysteresis));
|
||||
ui->lineEdit_alert_low_delay->setText(QString::number(variable_ptr->alert_low.delay));
|
||||
ui->checkBox_alert_low_enable->setChecked(variable_ptr->alert_low.enable);
|
||||
ui->checkBox_alert_low_latch->setChecked(variable_ptr->alert_low.latch);
|
||||
|
||||
// Gap
|
||||
// -general
|
||||
if(variable_ptr->gap_general.output_used)
|
||||
ui->comboBox_output_used_2->setCurrentIndex(0);
|
||||
else
|
||||
ui->comboBox_output_used_2->setCurrentIndex(1);
|
||||
ui->comboBox_engineering_unit_2->setCurrentIndex(variable_ptr->general.engineering_unit);
|
||||
ui->comboBox_rectifier_funtion_2->setCurrentIndex(variable_ptr->general.rectifier_function);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level_2->setText(QString::number(variable_ptr->gap_danger_high.level));
|
||||
ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_high.hysteresis));
|
||||
ui->lineEdit_danger_high_delay_2->setText(QString::number(variable_ptr->gap_danger_high.delay));
|
||||
ui->checkBox_danger_high_enable_2->setChecked(variable_ptr->gap_danger_high.enable);
|
||||
ui->checkBox_danger_high_latch_2->setChecked(variable_ptr->gap_danger_high.latch);
|
||||
|
||||
ui->lineEdit_alert_high_level_2->setText(QString::number(variable_ptr->gap_alert_high.level));
|
||||
ui->lineEdit_alert_high_hysteresis_2->setText(QString::number(variable_ptr->gap_alert_high.hysteresis));
|
||||
ui->lineEdit_alert_high_delay_2->setText(QString::number(variable_ptr->gap_alert_high.delay));
|
||||
ui->checkBox_alert_high_enable_2->setChecked(variable_ptr->gap_alert_high.enable);
|
||||
ui->checkBox_alert_high_latch_2->setChecked(variable_ptr->gap_alert_high.latch);
|
||||
|
||||
ui->lineEdit_danger_low_level_2->setText(QString::number(variable_ptr->gap_danger_low.level));
|
||||
ui->lineEdit_danger_low_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_low.hysteresis));
|
||||
ui->lineEdit_danger_low_delay_2->setText(QString::number(variable_ptr->gap_danger_low.delay));
|
||||
ui->checkBox_danger_low_enable_2->setChecked(variable_ptr->gap_danger_low.enable);
|
||||
ui->checkBox_danger_low_latch_2->setChecked(variable_ptr->gap_danger_low.latch);
|
||||
|
||||
ui->lineEdit_alert_low_level_2->setText(QString::number(variable_ptr->gap_alert_low.level));
|
||||
ui->lineEdit_alert_low_hysteresis_2->setText(QString::number(variable_ptr->gap_alert_low.hysteresis));
|
||||
ui->lineEdit_alert_low_delay_2->setText(QString::number(variable_ptr->gap_alert_low.delay));
|
||||
ui->checkBox_alert_low_enable_2->setChecked(variable_ptr->gap_alert_low.enable);
|
||||
ui->checkBox_alert_low_latch_2->setChecked(variable_ptr->gap_alert_low.latch);
|
||||
}
|
||||
|
||||
void Radial::on_pushButton_confirm_clicked() {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[Radial::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高");
|
||||
return;
|
||||
}
|
||||
if(ui->spinBox_high_pass_low->value() > ui->spinBox_high_pass_high->value()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "带通1配置错误!");
|
||||
return;
|
||||
}
|
||||
if(ui->spinBox_low_pass_low->value() > ui->spinBox_low_pass_high->value()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "带通2配置错误!");
|
||||
return;
|
||||
}
|
||||
if(ui->spinBox_band_pass_low->value() > ui->spinBox_band_pass_high->value()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "带通3配置错误!");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
ptr->base_config_[channel - 1].channel_type = kVibRadial;
|
||||
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
std::shared_ptr<RadialVariable> variable = std::dynamic_pointer_cast<RadialVariable>(variable_base);
|
||||
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibRadial || variable == nullptr) {
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "no channel ptr";
|
||||
} else {
|
||||
ptr->RemoveChannel(channel);
|
||||
qDebug() << "channel type change";
|
||||
}
|
||||
std::shared_ptr<RadialVariable> variable = std::make_shared<RadialVariable>();
|
||||
variable->id_ = channel;
|
||||
variable->type_ = kVibRadial;
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->isChecked();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
variable->filter_[1].checked = ui->checkBox_high_pass->isChecked();
|
||||
variable->filter_[1].low = ui->spinBox_high_pass_low->value();
|
||||
variable->filter_[1].high = ui->spinBox_high_pass_high->value();
|
||||
variable->filter_[2].checked = ui->checkBox_band_pass->isChecked();
|
||||
variable->filter_[2].low = ui->spinBox_band_pass_low->value();
|
||||
variable->filter_[2].high = ui->spinBox_band_pass_high->value();
|
||||
// processed output
|
||||
// -general
|
||||
if(ui->comboBox_output_used->currentIndex() == 0)
|
||||
variable->general.output_used = true;
|
||||
else
|
||||
variable->general.output_used = false;
|
||||
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
// variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble();
|
||||
// variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble();
|
||||
// variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble();
|
||||
// variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked();
|
||||
// variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked();
|
||||
// variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble();
|
||||
// variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble();
|
||||
// variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble();
|
||||
// variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked();
|
||||
// variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked();
|
||||
// Gap
|
||||
// -general
|
||||
if(ui->comboBox_output_used_2->currentIndex() == 0)
|
||||
variable->gap_general.output_used = true;
|
||||
else
|
||||
variable->gap_general.output_used = false;
|
||||
variable->gap_general.engineering_unit = ui->comboBox_engineering_unit_2->currentIndex();
|
||||
variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion_2->currentIndex();
|
||||
// -alarm
|
||||
variable->gap_danger_high.level = ui->lineEdit_danger_high_level_2->text().toDouble();
|
||||
variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble();
|
||||
variable->gap_danger_high.delay = ui->lineEdit_danger_high_delay_2->text().toDouble();
|
||||
variable->gap_danger_high.enable = ui->checkBox_danger_high_enable_2->isChecked();
|
||||
variable->gap_danger_high.latch = ui->checkBox_danger_high_latch_2->isChecked();
|
||||
variable->gap_alert_high.level = ui->lineEdit_alert_high_level_2->text().toDouble();
|
||||
variable->gap_alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis_2->text().toDouble();
|
||||
variable->gap_alert_high.delay = ui->lineEdit_alert_high_delay_2->text().toDouble();
|
||||
variable->gap_alert_high.enable = ui->checkBox_alert_high_enable_2->isChecked();
|
||||
variable->gap_alert_high.latch = ui->checkBox_alert_high_latch_2->isChecked();
|
||||
// variable->gap_danger_low.level = ui->lineEdit_danger_low_level_2->text().toDouble();
|
||||
// variable->gap_danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis_2->text().toDouble();
|
||||
// variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay_2->text().toDouble();
|
||||
// variable->gap_danger_low.enable = ui->checkBox_danger_low_enable_2->isChecked();
|
||||
// variable->gap_danger_low.latch = ui->checkBox_danger_low_latch_2->isChecked();
|
||||
// variable->gap_alert_low.level = ui->lineEdit_alert_low_level_2->text().toDouble();
|
||||
// variable->gap_alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis_2->text().toDouble();
|
||||
// variable->gap_alert_low.delay = ui->lineEdit_alert_low_delay_2->text().toDouble();
|
||||
// variable->gap_alert_low.enable = ui->checkBox_alert_low_enable_2->isChecked();
|
||||
// variable->gap_alert_low.latch = ui->checkBox_alert_low_latch_2->isChecked();
|
||||
// add to ptr
|
||||
ptr->variables_.push_back(variable);
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->isChecked();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
variable->filter_[1].checked = ui->checkBox_high_pass->isChecked();
|
||||
variable->filter_[1].low = ui->spinBox_high_pass_low->value();
|
||||
variable->filter_[1].high = ui->spinBox_high_pass_high->value();
|
||||
variable->filter_[2].checked = ui->checkBox_band_pass->isChecked();
|
||||
variable->filter_[2].low = ui->spinBox_band_pass_low->value();
|
||||
variable->filter_[2].high = ui->spinBox_band_pass_high->value();
|
||||
// processed output
|
||||
// -general
|
||||
if(ui->comboBox_output_used->currentIndex() == 0)
|
||||
variable->general.output_used = true;
|
||||
else
|
||||
variable->general.output_used = false;
|
||||
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
// variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble();
|
||||
// variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble();
|
||||
// variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble();
|
||||
// variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked();
|
||||
// variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked();
|
||||
// variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble();
|
||||
// variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble();
|
||||
// variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble();
|
||||
// variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked();
|
||||
// variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked();
|
||||
// Gap
|
||||
// -general
|
||||
if(ui->comboBox_output_used_2->currentIndex() == 0)
|
||||
variable->gap_general.output_used = true;
|
||||
else
|
||||
variable->gap_general.output_used = false;
|
||||
variable->gap_general.engineering_unit = ui->comboBox_engineering_unit_2->currentIndex();
|
||||
variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion_2->currentIndex();
|
||||
// -alarm
|
||||
variable->gap_danger_high.level = ui->lineEdit_danger_high_level_2->text().toDouble();
|
||||
variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble();
|
||||
variable->gap_danger_high.delay = ui->lineEdit_danger_high_delay_2->text().toDouble();
|
||||
variable->gap_danger_high.enable = ui->checkBox_danger_high_enable_2->isChecked();
|
||||
variable->gap_danger_high.latch = ui->checkBox_danger_high_latch_2->isChecked();
|
||||
variable->gap_alert_high.level = ui->lineEdit_alert_high_level_2->text().toDouble();
|
||||
variable->gap_alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis_2->text().toDouble();
|
||||
variable->gap_alert_high.delay = ui->lineEdit_alert_high_delay_2->text().toDouble();
|
||||
variable->gap_alert_high.enable = ui->checkBox_alert_high_enable_2->isChecked();
|
||||
variable->gap_alert_high.latch = ui->checkBox_alert_high_latch_2->isChecked();
|
||||
// variable->gap_danger_low.level = ui->lineEdit_danger_low_level_2->text().toDouble();
|
||||
// variable->gap_danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis_2->text().toDouble();
|
||||
// variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay_2->text().toDouble();
|
||||
// variable->gap_danger_low.enable = ui->checkBox_danger_low_enable_2->isChecked();
|
||||
// variable->gap_danger_low.latch = ui->checkBox_danger_low_latch_2->isChecked();
|
||||
// variable->gap_alert_low.level = ui->lineEdit_alert_low_level_2->text().toDouble();
|
||||
// variable->gap_alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis_2->text().toDouble();
|
||||
// variable->gap_alert_low.delay = ui->lineEdit_alert_low_delay_2->text().toDouble();
|
||||
// variable->gap_alert_low.enable = ui->checkBox_alert_low_enable_2->isChecked();
|
||||
// variable->gap_alert_low.latch = ui->checkBox_alert_low_latch_2->isChecked();
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void Radial_vibration::on_pushButton_set_default_clicked()
|
||||
void Radial::on_pushButton_set_default_clicked() {
|
||||
}
|
||||
|
||||
|
||||
void Radial::on_lineEdit_alert_high_level_editingFinished()
|
||||
{
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Radial::on_comboBox_rectifier_funtion_currentIndexChanged(int index)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -7,28 +7,28 @@ namespace Ui {
|
||||
class Radial_vibration;
|
||||
}
|
||||
|
||||
class Radial_vibration : public QWidget
|
||||
{
|
||||
class Radial : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Radial_vibration(int slot_no_,int channel_,bool active,QWidget *parent = nullptr);
|
||||
~Radial_vibration();
|
||||
public:
|
||||
explicit Radial(int slot_no_, int channel_, bool active, QWidget *parent = nullptr);
|
||||
~Radial();
|
||||
int slot_no;
|
||||
int channel;
|
||||
private slots:
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
void on_pushButton_set_default_clicked();
|
||||
|
||||
void on_checkBox_1x_ampl_toggled(bool checked);
|
||||
void on_checkBox_2x_ampl_toggled(bool checked);
|
||||
void on_lineEdit_alert_high_level_editingFinished();
|
||||
|
||||
void on_comboBox_rectifier_funtion_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::Radial_vibration *ui;
|
||||
|
||||
Filter filter[3];
|
||||
Dealy delay;
|
||||
Variables variables[6];
|
||||
Alert_Variables alert_variables;
|
||||
void readJsonFile(const QString &filePath);
|
||||
void Init();
|
||||
};
|
||||
|
||||
|
||||
3014
radial_vibration.ui
3014
radial_vibration.ui
File diff suppressed because it is too large
Load Diff
171
rangeslider.cpp
Normal file
171
rangeslider.cpp
Normal file
@ -0,0 +1,171 @@
|
||||
#include "rangeslider.h"
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
#include <cmath>
|
||||
|
||||
RangeSlider::RangeSlider(int style_,QWidget *parent)
|
||||
: QWidget(parent) {
|
||||
setMinimumSize(20, 240);
|
||||
style = style_;
|
||||
}
|
||||
|
||||
void RangeSlider::setRange(float min, float max) {
|
||||
m_min = min;
|
||||
m_max = max;
|
||||
m_lower = qBound(m_min, m_lower, m_max);
|
||||
m_upper = qBound(m_lower, m_upper, m_max);
|
||||
update();
|
||||
}
|
||||
|
||||
void RangeSlider::setSliderWidth(int width) {
|
||||
sliderWidth = width;
|
||||
update(); // 更新界面
|
||||
}
|
||||
|
||||
float RangeSlider::lowerValue() const { return m_lower; }
|
||||
float RangeSlider::upperValue() const { return m_upper; }
|
||||
|
||||
float RangeSlider::valueToY(float value) const {
|
||||
double ratio = (value - m_min) / double(m_max - m_min);
|
||||
return height() - handleRadius - ratio * (height() - 2 * handleRadius);
|
||||
}
|
||||
|
||||
float RangeSlider::yToValue(float y) const {
|
||||
double ratio = (height() - handleRadius - y) / double(height() - 2 * handleRadius);
|
||||
ratio = qBound(0.0, ratio, 1.0);
|
||||
float rawValue = m_min + ratio * (m_max - m_min);
|
||||
float steppedValue = qRound(rawValue * 10) / 10.0f;
|
||||
return qBound(m_min, steppedValue, m_max);
|
||||
}
|
||||
|
||||
RangeSlider::HandleType RangeSlider::handleHitTest(float y) const {
|
||||
int yLower = valueToY(m_lower);
|
||||
int yUpper = valueToY(m_upper);
|
||||
if (qAbs(y - yLower) <= handleRadius + 2) return LowerHandle;
|
||||
if (qAbs(y - yUpper) <= handleRadius + 2) return UpperHandle;
|
||||
return NoHandle;
|
||||
}
|
||||
|
||||
void RangeSlider::mousePressEvent(QMouseEvent *event) {
|
||||
currentHandle = handleHitTest(event->pos().y());
|
||||
}
|
||||
|
||||
void RangeSlider::mouseMoveEvent(QMouseEvent *event) {
|
||||
if (currentHandle == NoHandle) return;
|
||||
|
||||
float val = yToValue(event->pos().y());
|
||||
if (currentHandle == LowerHandle) {
|
||||
m_lower = qBound(m_min, val, m_upper);
|
||||
} else if (currentHandle == UpperHandle) {
|
||||
m_upper = qBound(m_lower, val, m_max);
|
||||
}
|
||||
update();
|
||||
emit rangeChanged(m_lower, m_upper);
|
||||
}
|
||||
|
||||
void RangeSlider::mouseReleaseEvent(QMouseEvent *) {
|
||||
currentHandle = NoHandle;
|
||||
}
|
||||
|
||||
void RangeSlider::paintEvent(QPaintEvent *) {
|
||||
QPainter p(this);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
int x = width() / 2;
|
||||
int yLower = valueToY(m_lower);
|
||||
int yUpper = valueToY(m_upper);
|
||||
|
||||
// Draw Temperature-style background (gradient)
|
||||
drawTemperatureStyle(&p);
|
||||
|
||||
// Draw selected range (green)
|
||||
// Draw selected range (green)
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(Qt::green);
|
||||
p.drawRect(x - sliderWidth / 2, yUpper, sliderWidth, yLower - yUpper);
|
||||
|
||||
// Draw simple black handles (lines)
|
||||
p.setPen(QPen(Qt::black, 2));
|
||||
p.drawLine(x - sliderWidth / 2, yLower, x + sliderWidth, yLower);
|
||||
p.drawLine(x - sliderWidth / 2, yUpper, x + sliderWidth, yUpper);
|
||||
|
||||
// Draw ticks
|
||||
drawTicks(&p);
|
||||
}
|
||||
void RangeSlider::setLowerValue(float val) {
|
||||
m_lower = qBound(m_min, val, m_upper);
|
||||
update();
|
||||
emit rangeChanged(m_lower, m_upper);
|
||||
}
|
||||
|
||||
void RangeSlider::setUpperValue(float val) {
|
||||
m_upper = qBound(m_lower, val, m_max);
|
||||
update();
|
||||
emit rangeChanged(m_lower, m_upper);
|
||||
}
|
||||
void RangeSlider::drawTemperatureStyle(QPainter *p) {
|
||||
int x = width() / 2;
|
||||
int yTop = handleRadius;
|
||||
int yBottom = height() - handleRadius;
|
||||
|
||||
// Draw border (black)
|
||||
p->setPen(Qt::black);
|
||||
p->setBrush(Qt::NoBrush);
|
||||
p->drawRect(x - sliderWidth / 2, yTop, sliderWidth, yBottom - yTop);
|
||||
|
||||
// Draw yellow outside the range
|
||||
if(style != 0){
|
||||
p->setBrush(Qt::red);
|
||||
p->drawRect(x - sliderWidth / 2, yTop, sliderWidth, valueToY(m_lower) - yTop); // Above lower range
|
||||
p->drawRect(x - sliderWidth / 2, valueToY(m_upper), sliderWidth, yBottom - valueToY(m_upper)); // Below upper range
|
||||
}else{
|
||||
p->setBrush(Qt::yellow);
|
||||
p->drawRect(x - sliderWidth / 2, yTop, sliderWidth, valueToY(m_lower) - yTop); // Above lower range
|
||||
p->drawRect(x - sliderWidth / 2, valueToY(m_upper), sliderWidth, yBottom - valueToY(m_upper)); // Below upper range
|
||||
}
|
||||
|
||||
// Draw green inside the range
|
||||
p->setBrush(Qt::green);
|
||||
p->drawRect(x - sliderWidth / 2, valueToY(m_upper), sliderWidth, valueToY(m_lower) - valueToY(m_upper)); // Green area
|
||||
}
|
||||
int RangeSlider::niceStep(int range, int maxLabels) {
|
||||
double rawStep = static_cast<double>(range) / maxLabels;
|
||||
|
||||
// 取一个"好看"的步长
|
||||
double magnitude = pow(10, floor(log10(rawStep))); // 10 的整数次幂
|
||||
double residual = rawStep / magnitude;
|
||||
|
||||
double niceResidual;
|
||||
if (residual < 1.5)
|
||||
niceResidual = 1;
|
||||
else if (residual < 3)
|
||||
niceResidual = 2;
|
||||
else if (residual < 7)
|
||||
niceResidual = 5;
|
||||
else
|
||||
niceResidual = 10;
|
||||
|
||||
return static_cast<int>(niceResidual * magnitude);
|
||||
}
|
||||
void RangeSlider::drawTicks(QPainter *p) {
|
||||
int range = m_max - m_min;
|
||||
int labelStep = niceStep(range, 10);
|
||||
int minorStep = qMax(1, labelStep / 5);
|
||||
|
||||
int x = width() / 2 + handleRadius + 4;
|
||||
p->setFont(QFont("Arial", 8));
|
||||
|
||||
for (int val = m_min; val <= m_max; val += minorStep) {
|
||||
int y = valueToY(val);
|
||||
|
||||
if (val % labelStep == 0) {
|
||||
p->setPen(QPen(Qt::black, 1.5)); // 主刻度
|
||||
p->drawLine(x, y, x + 6, y);
|
||||
p->drawText(x + 10, y + 4, QString::number(val));
|
||||
} else {
|
||||
p->setPen(QPen(Qt::gray, 1)); // 次刻度
|
||||
p->drawLine(x, y, x + 3, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
48
rangeslider.h
Normal file
48
rangeslider.h
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef RANGESLIDER_H
|
||||
#define RANGESLIDER_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class RangeSlider : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RangeSlider(int style_ = 0,QWidget *parent = nullptr);
|
||||
|
||||
void setRange(float min, float max);
|
||||
void setSliderWidth(int width); // 新增方法:设置宽度
|
||||
float lowerValue() const;
|
||||
float upperValue() const;
|
||||
void setLowerValue(float val);
|
||||
void setUpperValue(float val);
|
||||
float m_lower = 3.5;
|
||||
float m_upper = 6.5;
|
||||
int style = 0;
|
||||
signals:
|
||||
void rangeChanged(float lower, float upper);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
void mousePressEvent(QMouseEvent *) override;
|
||||
void mouseMoveEvent(QMouseEvent *) override;
|
||||
void mouseReleaseEvent(QMouseEvent *) override;
|
||||
|
||||
private:
|
||||
float m_min = 0;
|
||||
float m_max = 10;
|
||||
|
||||
int sliderWidth = 10; // 默认宽度(可以根据需求调整)
|
||||
|
||||
int handleRadius = 8;
|
||||
enum HandleType { NoHandle, LowerHandle, UpperHandle };
|
||||
HandleType currentHandle = NoHandle;
|
||||
|
||||
float valueToY(float value) const;
|
||||
float yToValue(float y) const;
|
||||
HandleType handleHitTest(float y) const;
|
||||
int niceStep(int range, int maxLabels);
|
||||
void drawTicks(QPainter *p);
|
||||
void drawTemperatureStyle(QPainter *p);
|
||||
};
|
||||
|
||||
#endif // RANGESLIDER_H
|
||||
200
relaysetting.cpp
200
relaysetting.cpp
@ -10,16 +10,12 @@
|
||||
|
||||
RelaySetting::RelaySetting(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::RelaySetting)
|
||||
{
|
||||
, ui(new Ui::RelaySetting) {
|
||||
ui->setupUi(this);
|
||||
ui->widget_body->setProperty("flag", "body");
|
||||
readJsonFile(QCoreApplication::applicationDirPath() + "\\config\\main.json");
|
||||
|
||||
for (int var = 0; var < map_slot_config.size(); ++var) {
|
||||
if(map_slot_config[var].slot_type == 30){
|
||||
ui->comboBox_slot->addItem(QString::number(map_slot_config[var].slot));
|
||||
}
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
for (int var = 0; var < SLOT_NUM; ++var) {
|
||||
ui->comboBox_slot->addItem(QString::number(var + 1));
|
||||
}
|
||||
connect(ui->buttonGroup_OK, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
|
||||
this, &RelaySetting::onRadioButtonClicked);
|
||||
@ -62,14 +58,34 @@ RelaySetting::RelaySetting(QWidget *parent)
|
||||
connect(ui->buttonGroup_STATUS, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
|
||||
this, &RelaySetting::onRadioButtonClicked);
|
||||
|
||||
m_tcpClient = MyTcpClient::instance();
|
||||
connect(m_tcpClient, SIGNAL(dataReceived(const QByteArray &)), this, SLOT(readData(const QByteArray &)));
|
||||
}
|
||||
void RelaySetting::readData(const QByteArray &data) {
|
||||
qDebug() << "Received from server:" << data;
|
||||
|
||||
RelaySetting::~RelaySetting()
|
||||
{
|
||||
uint8_t cmd = data[3];
|
||||
if (cmd == kRelaySetting) {
|
||||
RelaySettingRsp relay_setting_rsp;
|
||||
memcpy(&relay_setting_rsp, data.data(), sizeof(RelaySettingRsp));
|
||||
qDebug() << "relay_setting_rsp code" << relay_setting_rsp.code ;
|
||||
}else if(cmd == kRelayStatus){
|
||||
RelayStatusRsp relay_status_rsp;
|
||||
memcpy(&relay_status_rsp, data.data(), sizeof(RelayStatusRsp));
|
||||
qDebug() << "relay_setting_rsp status" << relay_status_rsp.status ;
|
||||
if (relay_status_rsp.status == 7) {
|
||||
ui->label_status->setText("测试");
|
||||
} else if (relay_status_rsp.status == 8) {
|
||||
ui->label_status->setText("手动");
|
||||
} else if (relay_status_rsp.status == 9) {
|
||||
ui->label_status->setText("工作");
|
||||
}
|
||||
}
|
||||
}
|
||||
RelaySetting::~RelaySetting() {
|
||||
delete ui;
|
||||
}
|
||||
void RelaySetting::readJsonFile(const QString &filePath)
|
||||
{
|
||||
void RelaySetting::readJsonFile(const QString &filePath) {
|
||||
// 创建文件对象
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
@ -78,9 +94,7 @@ void RelaySetting::readJsonFile(const QString &filePath)
|
||||
}
|
||||
QString content = file.readAll();
|
||||
file.close();
|
||||
|
||||
QByteArray jsonData = content.toUtf8();
|
||||
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
|
||||
if (jsonDoc.isNull()) {
|
||||
qDebug() << "Cannot parse JSON document";
|
||||
@ -98,19 +112,17 @@ void RelaySetting::readJsonFile(const QString &filePath)
|
||||
QJsonObject obj = value.toObject();
|
||||
slot_config.slot = obj["slot"].toInt();
|
||||
slot_config.slot_type = obj["slot_type"].toInt();
|
||||
slot_config.chan_display = obj["chan_display"].toString();
|
||||
slot_config.rack_type = obj["rack_type"].toString();
|
||||
map_slot_config.insert(slot_id,slot_config);
|
||||
map_slot_config.insert(slot_id, slot_config);
|
||||
slot_id ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RelaySetting::onRadioButtonClicked(QAbstractButton *button)
|
||||
{
|
||||
void RelaySetting::onRadioButtonClicked(QAbstractButton *button) {
|
||||
QButtonGroup *group = qobject_cast<QButtonGroup *>(sender());
|
||||
if (!group || !button) return;
|
||||
|
||||
if (!group || !button) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "Group:" << group << ", Selected button text:" << button->text();
|
||||
QTcpSocket socket;
|
||||
// 连接到服务器
|
||||
@ -119,104 +131,74 @@ void RelaySetting::onRadioButtonClicked(QAbstractButton *button)
|
||||
qDebug() << "Connection failed!";
|
||||
return;
|
||||
}
|
||||
PackageHead header = { {0xAA, 0x55, 0xAA}, kRelaySetting, sizeof(RelaySettingReq),0,{} };
|
||||
|
||||
RelaySettingReq relay_setting_req = { {0xAA, 0x55, 0xAA}, kRelaySetting,1, 0, 0, 0 };
|
||||
int slot = ui->comboBox_slot->currentText().toInt();
|
||||
qDebug() << "slot" << slot <<endl;
|
||||
RelaySettingReq relay_setting_req;
|
||||
if(slot == 0)
|
||||
qDebug() << "slot" << slot ;
|
||||
if (slot == 0) {
|
||||
relay_setting_req.card_id = 0xFF;
|
||||
else
|
||||
} else {
|
||||
relay_setting_req.card_id = slot & 0xFF;
|
||||
QString led_id = group->objectName().mid(12);
|
||||
qDebug() << "led_id" << led_id <<endl;
|
||||
if(led_id == "OK")
|
||||
relay_setting_req.led_id = 0xff;
|
||||
else if(led_id == "TX_RX")
|
||||
relay_setting_req.led_id = 0xf1;
|
||||
else if(led_id == "TEST")
|
||||
relay_setting_req.led_id = 0xee;
|
||||
else if(led_id == "STATUS")
|
||||
relay_setting_req.led_id = 0xe1;
|
||||
else
|
||||
relay_setting_req.led_id = led_id.toInt() & 0xFF;
|
||||
|
||||
if(button->text() == "OFF")
|
||||
relay_setting_req.led_operate = 0;
|
||||
else if(button->text() == "ON")
|
||||
relay_setting_req.led_operate = 1;
|
||||
else if(button->text() == "红色")
|
||||
relay_setting_req.led_operate = 2;
|
||||
else if(button->text() == "绿色")
|
||||
relay_setting_req.led_operate = 3;
|
||||
else if(button->text() == "红色1Hz闪烁" || button->text() == "红色闪烁")
|
||||
relay_setting_req.led_operate = 4;
|
||||
else if(button->text() == "红色2Hz闪烁")
|
||||
relay_setting_req.led_operate = 5;
|
||||
else if(button->text() == "绿色闪烁")
|
||||
relay_setting_req.led_operate = 6;
|
||||
else if(button->text() == "测试")
|
||||
relay_setting_req.led_operate = 7;
|
||||
else if(button->text() == "手动")
|
||||
relay_setting_req.led_operate = 8;
|
||||
else if(button->text() == "工作")
|
||||
relay_setting_req.led_operate = 9;
|
||||
qDebug() << "relay_setting_req.led_operate " << relay_setting_req.led_operate;
|
||||
char send_buf[20] ={0};
|
||||
memcpy(send_buf, (char*)&header, sizeof(PackageHead));
|
||||
memcpy(send_buf + sizeof(PackageHead), (char*)&relay_setting_req, sizeof(RelaySettingReq));
|
||||
int length = sizeof(PackageHead) + sizeof(RelaySettingReq);
|
||||
qint64 bytesWritten = socket.write(send_buf, length);
|
||||
qDebug() << "Server response: " << bytesWritten;
|
||||
if (socket.waitForReadyRead()) {
|
||||
QByteArray response = socket.readAll();
|
||||
PackageHead header;
|
||||
RelaySettingRsp relay_setting_rsp;
|
||||
memcpy(&header,response.data(),sizeof(PackageHead));
|
||||
qDebug() << "header len" << header.len << endl;
|
||||
memcpy(&relay_setting_rsp,response.data() + sizeof(PackageHead),sizeof(RelaySettingRsp));
|
||||
qDebug() << "relay_setting_rsp code" << relay_setting_rsp.code << endl;
|
||||
}
|
||||
QString led_id = group->objectName().mid(12);
|
||||
qDebug() << "led_id" << led_id ;
|
||||
if (led_id == "OK") {
|
||||
relay_setting_req.led_id = 0xff;
|
||||
} else if (led_id == "TX_RX") {
|
||||
relay_setting_req.led_id = 0xf1;
|
||||
} else if (led_id == "TEST") {
|
||||
relay_setting_req.led_id = 0xee;
|
||||
} else if (led_id == "STATUS") {
|
||||
relay_setting_req.led_id = 0xe1;
|
||||
} else {
|
||||
relay_setting_req.led_id = led_id.toInt() & 0xFF;
|
||||
}
|
||||
if (button->text() == "OFF") {
|
||||
relay_setting_req.led_operate = 0;
|
||||
} else if (button->text() == "ON") {
|
||||
relay_setting_req.led_operate = 1;
|
||||
} else if (button->text() == "红色") {
|
||||
relay_setting_req.led_operate = 2;
|
||||
} else if (button->text() == "绿色") {
|
||||
relay_setting_req.led_operate = 3;
|
||||
} else if (button->text() == "红色1Hz闪烁" || button->text() == "红色闪烁") {
|
||||
relay_setting_req.led_operate = 4;
|
||||
} else if (button->text() == "红色2Hz闪烁") {
|
||||
relay_setting_req.led_operate = 5;
|
||||
} else if (button->text() == "绿色闪烁") {
|
||||
relay_setting_req.led_operate = 6;
|
||||
} else if (button->text() == "测试") {
|
||||
relay_setting_req.led_operate = 7;
|
||||
} else if (button->text() == "手动") {
|
||||
relay_setting_req.led_operate = 8;
|
||||
} else if (button->text() == "工作") {
|
||||
relay_setting_req.led_operate = 9;
|
||||
}
|
||||
qDebug() << "relay_setting_req.led_operate " << relay_setting_req.led_operate;
|
||||
char send_buf[20] = {0};
|
||||
memcpy(send_buf, (char *)&relay_setting_req, sizeof(RelaySettingReq));
|
||||
int length = sizeof(RelaySettingReq) + sizeof(RelaySettingReq);
|
||||
qint64 bytesWritten = m_tcpClient->sendData((char*)&send_buf, length);
|
||||
m_tcpClient->waitForRead();
|
||||
qDebug() << "Server response: " << bytesWritten;
|
||||
|
||||
}
|
||||
|
||||
void RelaySetting::on_pushButton_status_clicked()
|
||||
{
|
||||
QTcpSocket socket;
|
||||
// 连接到服务器
|
||||
socket.connectToHost(g_strServerIp, 10000);
|
||||
if (!socket.waitForConnected()) {
|
||||
qDebug() << "Connection failed!";
|
||||
return;
|
||||
}
|
||||
PackageHead header = { {0xAA, 0x55, 0xAA}, kRelayStatus, sizeof(RelaySettingReq),0,{} };
|
||||
void RelaySetting::on_pushButton_status_clicked() {
|
||||
|
||||
int slot = ui->comboBox_slot->currentText().toInt();
|
||||
qDebug() << "slot" << slot <<endl;
|
||||
RelayStatusReq relay_status_req;
|
||||
if(slot == 0)
|
||||
qDebug() << "slot" << slot ;
|
||||
RelayStatusReq relay_status_req { {0xAA, 0x55, 0xAA}, kRelayStatus, 1, 0 };
|
||||
if (slot == 0) {
|
||||
relay_status_req.card_id = 0xFF;
|
||||
else
|
||||
} else {
|
||||
relay_status_req.card_id = slot & 0xFF;
|
||||
char send_buf[20] ={0};
|
||||
memcpy(send_buf, (char*)&header, sizeof(PackageHead));
|
||||
memcpy(send_buf + sizeof(PackageHead), (char*)&relay_status_req, sizeof(RelayStatusReq));
|
||||
int length = sizeof(PackageHead) + sizeof(RelayStatusReq);
|
||||
qint64 bytesWritten = socket.write(send_buf, length);
|
||||
qDebug() << "Server response: " << bytesWritten;
|
||||
if (socket.waitForReadyRead()) {
|
||||
QByteArray response = socket.readAll();
|
||||
PackageHead header;
|
||||
RelayStatusRsp relay_status_rsp;
|
||||
memcpy(&header,response.data(),sizeof(PackageHead));
|
||||
qDebug() << "header len" << header.len << endl;
|
||||
memcpy(&relay_status_rsp,response.data() + sizeof(PackageHead),sizeof(RelayStatusRsp));
|
||||
qDebug() << "relay_setting_rsp status" << relay_status_rsp.status << endl;
|
||||
if(relay_status_rsp.status == 7)
|
||||
ui->label_status->setText("测试");
|
||||
else if(relay_status_rsp.status == 8)
|
||||
ui->label_status->setText("手动");
|
||||
else if(relay_status_rsp.status == 9)
|
||||
ui->label_status->setText("工作");
|
||||
}
|
||||
char send_buf[20] = {0};
|
||||
memcpy(send_buf, (char *)&relay_status_req, sizeof(RelayStatusReq));
|
||||
int length = sizeof(RelayStatusReq);
|
||||
qint64 bytesWritten = m_tcpClient->sendData((char*)&send_buf, length);
|
||||
m_tcpClient->waitForRead();
|
||||
qDebug() << "Server response: " << bytesWritten;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include "data_config.h"
|
||||
#include "MyTcpClient.h"
|
||||
|
||||
namespace Ui {
|
||||
class RelaySetting;
|
||||
@ -20,10 +21,11 @@ private slots:
|
||||
void onRadioButtonClicked(QAbstractButton *button);
|
||||
|
||||
void on_pushButton_status_clicked();
|
||||
|
||||
void readData(const QByteArray&);
|
||||
private:
|
||||
Ui::RelaySetting *ui;
|
||||
QMap<int,SlotConfig> map_slot_config;
|
||||
MyTcpClient* m_tcpClient;
|
||||
|
||||
void readJsonFile(const QString &filePath);
|
||||
};
|
||||
|
||||
@ -1024,17 +1024,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>绿色闪烁</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_TX_RX</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="text">
|
||||
<string>绿色</string>
|
||||
<string>黄绿色闪烁</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_TX_RX</string>
|
||||
@ -1168,7 +1158,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_7">
|
||||
<property name="text">
|
||||
<string>绿色</string>
|
||||
<string>黄绿</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_OK</string>
|
||||
@ -1328,24 +1318,24 @@
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup_16"/>
|
||||
<buttongroup name="buttonGroup_12"/>
|
||||
<buttongroup name="buttonGroup_TX_RX"/>
|
||||
<buttongroup name="buttonGroup_OK"/>
|
||||
<buttongroup name="buttonGroup_9"/>
|
||||
<buttongroup name="buttonGroup_2"/>
|
||||
<buttongroup name="buttonGroup_8"/>
|
||||
<buttongroup name="buttonGroup_TEST"/>
|
||||
<buttongroup name="buttonGroup_1"/>
|
||||
<buttongroup name="buttonGroup_3"/>
|
||||
<buttongroup name="buttonGroup_6"/>
|
||||
<buttongroup name="buttonGroup_4"/>
|
||||
<buttongroup name="buttonGroup_7"/>
|
||||
<buttongroup name="buttonGroup_10"/>
|
||||
<buttongroup name="buttonGroup_14"/>
|
||||
<buttongroup name="buttonGroup_11"/>
|
||||
<buttongroup name="buttonGroup_5"/>
|
||||
<buttongroup name="buttonGroup_STATUS"/>
|
||||
<buttongroup name="buttonGroup_8"/>
|
||||
<buttongroup name="buttonGroup_6"/>
|
||||
<buttongroup name="buttonGroup_15"/>
|
||||
<buttongroup name="buttonGroup_OK"/>
|
||||
<buttongroup name="buttonGroup_7"/>
|
||||
<buttongroup name="buttonGroup_11"/>
|
||||
<buttongroup name="buttonGroup_3"/>
|
||||
<buttongroup name="buttonGroup_4"/>
|
||||
<buttongroup name="buttonGroup_TX_RX"/>
|
||||
<buttongroup name="buttonGroup_5"/>
|
||||
<buttongroup name="buttonGroup_2"/>
|
||||
<buttongroup name="buttonGroup_TEST"/>
|
||||
<buttongroup name="buttonGroup_9"/>
|
||||
<buttongroup name="buttonGroup_12"/>
|
||||
<buttongroup name="buttonGroup_10"/>
|
||||
<buttongroup name="buttonGroup_13"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
||||
1092
seismic_monitor.cpp
1092
seismic_monitor.cpp
File diff suppressed because it is too large
Load Diff
@ -3,21 +3,22 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
|
||||
namespace Ui {
|
||||
class Seismic_monitor;
|
||||
}
|
||||
|
||||
class Seismic_monitor : public QWidget
|
||||
{
|
||||
class Seismic_monitor : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Seismic_monitor(int slot,QWidget *parent = nullptr);
|
||||
public:
|
||||
explicit Seismic_monitor(int slot,CardType cardtype, QWidget *parent = nullptr);
|
||||
~Seismic_monitor();
|
||||
int slot_no;
|
||||
int channel;
|
||||
private slots:
|
||||
CardType card_type;
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_set_default_clicked();
|
||||
@ -30,14 +31,67 @@ private slots:
|
||||
|
||||
void on_pushButton_config_4_clicked();
|
||||
|
||||
void on_comboBox_chan_type_1_currentTextChanged(const QString &arg1);
|
||||
|
||||
void on_comboBox_chan_type_2_currentTextChanged(const QString &arg1);
|
||||
|
||||
void on_comboBox_chan_type_3_currentTextChanged(const QString &arg1);
|
||||
|
||||
void on_comboBox_chan_type_4_currentTextChanged(const QString &arg1);
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
void on_comboBox_sensitivity_unit_1_currentTextChanged(const QString &arg1);
|
||||
|
||||
void on_comboBox_sensitivity_unit_2_currentTextChanged(const QString &arg1);
|
||||
|
||||
void on_comboBox_sensitivity_unit_3_currentTextChanged(const QString &arg1);
|
||||
|
||||
void on_comboBox_sensitivity_unit_4_currentTextChanged(const QString &arg1);
|
||||
|
||||
void on_pushButton_config_1_2_clicked();
|
||||
|
||||
void on_pushButton_config_3_4_clicked();
|
||||
|
||||
void on_pushButton_copy_channel_clicked();
|
||||
|
||||
void copy_end_slot();
|
||||
|
||||
void on_comboBox_function_2_currentIndexChanged(int index);
|
||||
|
||||
void on_comboBox_function_1_currentIndexChanged(int index);
|
||||
|
||||
void on_comboBox_dual_math_function_currentIndexChanged(int index);
|
||||
|
||||
void on_comboBox_dual_math_function_2_currentIndexChanged(int index);
|
||||
|
||||
void onConfigWindowClosed(QObject *);
|
||||
|
||||
private:
|
||||
Ui::Seismic_monitor *ui;
|
||||
|
||||
int card_type;
|
||||
void readJsonFile(const QString &filePath);
|
||||
SeismicMonitor seismic_monitor[CHANNLE_COUNT];
|
||||
|
||||
void UpdateData(std::shared_ptr<VibrationData> vib_data,int save = 0);
|
||||
// int card_type;
|
||||
// void readJsonFile(const QString &filePath);
|
||||
// SeismicMonitor seismic_monitor[CHANNLE_COUNT];
|
||||
int current_config_1_2;
|
||||
int current_config_3_4;
|
||||
QVector<Transducer> vec_transducer;
|
||||
void Init();
|
||||
void EnableKeyphase();
|
||||
void EnableKeyphase2();
|
||||
void EnableKeyphase3();
|
||||
void EnableKeyphase4();
|
||||
void DisableKeyphase();
|
||||
void DisableKeyphase2();
|
||||
void DisableKeyphase3();
|
||||
void DisableKeyphase4();
|
||||
void OpenAcc();
|
||||
void OpenRadial();
|
||||
void OpenVelocity();
|
||||
void OpenTrust();
|
||||
void OpenPressure();
|
||||
QString GetUnit(int unit_num);
|
||||
int SetUnit(QString unit_str);
|
||||
};
|
||||
|
||||
#endif // SEISMIC_MONITOR_H
|
||||
|
||||
4516
seismic_monitor.ui
4516
seismic_monitor.ui
File diff suppressed because it is too large
Load Diff
14
setpoint.cpp
14
setpoint.cpp
@ -1,14 +0,0 @@
|
||||
#include "Setpoint.h"
|
||||
#include "ui_Setpoint.h"
|
||||
|
||||
Setpoint::Setpoint(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::Setpoint)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
Setpoint::~Setpoint()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
22
setpoint.h
22
setpoint.h
@ -1,22 +0,0 @@
|
||||
#ifndef setpoint_H
|
||||
#define setpoint_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class Setpoint;
|
||||
}
|
||||
|
||||
class Setpoint : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Setpoint(QWidget *parent = nullptr);
|
||||
~Setpoint();
|
||||
|
||||
private:
|
||||
Ui::Setpoint *ui;
|
||||
};
|
||||
|
||||
#endif // setpoint_H
|
||||
445
setpoint.ui
445
setpoint.ui
@ -1,445 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Setpoint</class>
|
||||
<widget class="QWidget" name="Setpoint">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>722</width>
|
||||
<height>560</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>10</y>
|
||||
<width>161</width>
|
||||
<height>451</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>危险 / 警报 2</string>
|
||||
</property>
|
||||
<widget class="QComboBox" name="comboBox_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>69</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>30</y>
|
||||
<width>69</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>390</y>
|
||||
<width>21</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>140</y>
|
||||
<width>54</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 刻度</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>100</y>
|
||||
<width>41</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>23</x>
|
||||
<y>420</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>启用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>70</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mil pp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>520</y>
|
||||
<width>119</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>槽位号2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_6">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道 1</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>500</x>
|
||||
<y>520</y>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>帮助</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>520</y>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打印</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>520</y>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>521</width>
|
||||
<height>451</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>告警 / 警报 1</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>直接值</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>70</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mil pp</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>100</y>
|
||||
<width>41</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>390</y>
|
||||
<width>21</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>23</x>
|
||||
<y>420</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>启用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>140</y>
|
||||
<width>54</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 刻度</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>390</y>
|
||||
<width>21</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>70</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mil pp</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>100</y>
|
||||
<width>41</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>140</y>
|
||||
<width>54</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 刻度</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>40</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1倍频幅值</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>113</x>
|
||||
<y>420</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>启用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>420</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>启用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>197</x>
|
||||
<y>390</y>
|
||||
<width>21</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>187</x>
|
||||
<y>140</y>
|
||||
<width>54</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 刻度</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>187</x>
|
||||
<y>100</y>
|
||||
<width>41</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_31">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>187</x>
|
||||
<y>70</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mil pp</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_32">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>187</x>
|
||||
<y>40</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2倍频幅值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>520</y>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>520</y>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>复制</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
125
setpoint_tachometer.cpp
Normal file
125
setpoint_tachometer.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
#include "setpoint_tachometer.h"
|
||||
#include "ui_setpoint_tachometer.h"
|
||||
#include "config_mgr.h"
|
||||
|
||||
Setpoint_Tachometer::Setpoint_Tachometer(int slot_no_,int cardtype,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::Setpoint_Tachometer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
slot_no = slot_no_;
|
||||
car_type = static_cast<CardType>(cardtype);
|
||||
ui->label_slot->setText(QString::number(slot_no));
|
||||
Init();
|
||||
connect(ui->comboBox_chan, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &Setpoint_Tachometer::onComboBoxIndexChanged);
|
||||
current_index = ui->comboBox_chan->currentIndex();
|
||||
}
|
||||
|
||||
Setpoint_Tachometer::~Setpoint_Tachometer()
|
||||
{
|
||||
if(slider_alert != nullptr)
|
||||
delete slider_alert;
|
||||
if(slider_danger != nullptr)
|
||||
delete slider_danger;
|
||||
delete ui;
|
||||
}
|
||||
void Setpoint_Tachometer::Init(){
|
||||
|
||||
QVBoxLayout *layout_alert = new QVBoxLayout(ui->widget_alert);
|
||||
slider_alert = new RangeSlider;
|
||||
layout_alert->addWidget(slider_alert);
|
||||
|
||||
QVBoxLayout *layout_danger = new QVBoxLayout(ui->widget_danger);
|
||||
slider_danger = new RangeSlider(1);
|
||||
layout_danger->addWidget(slider_danger);
|
||||
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
speed_alert_ptr = std::dynamic_pointer_cast<TachometerData>(base_ptr);
|
||||
|
||||
switch (car_type) {
|
||||
case kCardSpeedSingle:{
|
||||
slider_alert->m_upper = 3500;
|
||||
slider_alert->m_lower = 1500;
|
||||
slider_alert->setRange(0,5000);
|
||||
slider_danger->m_upper = 4250;
|
||||
slider_danger->m_lower = 750;
|
||||
slider_danger->setRange(0,5000);
|
||||
|
||||
int chan = ui->comboBox_chan->currentIndex();
|
||||
std::shared_ptr<TachometerData> setpoint_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
|
||||
ui->lineEdit_alert_upper->setText(QString::number(setpoint_data->alert_danger[chan].speed_upper));
|
||||
ui->lineEdit_alert_lower->setText(QString::number(setpoint_data->alert_danger[chan].speed_lower));
|
||||
ui->checkBox_alert_upper->setChecked(setpoint_data->alert_danger[chan].speed_upper_enable);
|
||||
ui->checkBox_alert_lower->setChecked(setpoint_data->alert_danger[chan].speed_lower_enable);
|
||||
if(setpoint_data->alert_danger[chan].speed_upper > 0 && setpoint_data->alert_danger[chan].speed_lower){
|
||||
slider_alert->m_upper = setpoint_data->alert_danger[chan].speed_upper;
|
||||
slider_alert->m_lower = setpoint_data->alert_danger[chan].speed_lower;
|
||||
}
|
||||
ui->lineEdit_danger_upper->setText(QString::number(setpoint_data->alert_danger[chan].danger_speed_upper));
|
||||
if(setpoint_data->alert_danger[chan].danger_speed_upper > 0 ){
|
||||
slider_danger->m_upper = setpoint_data->alert_danger[chan].danger_speed_upper;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
QObject::connect(ui->lineEdit_alert_upper, &QLineEdit::editingFinished, [&]() {
|
||||
slider_alert->setUpperValue(ui->lineEdit_alert_upper->text().toFloat());
|
||||
});
|
||||
QObject::connect(ui->lineEdit_alert_lower, &QLineEdit::editingFinished, [&]() {
|
||||
slider_alert->setLowerValue(ui->lineEdit_alert_lower->text().toFloat());
|
||||
});
|
||||
QObject::connect(slider_alert, &RangeSlider::rangeChanged, [&](float low,float high) {
|
||||
ui->lineEdit_alert_upper->setText(QString::number((int)high));
|
||||
ui->lineEdit_alert_lower->setText(QString::number((int)low));
|
||||
});
|
||||
|
||||
QObject::connect(ui->lineEdit_danger_upper, &QLineEdit::editingFinished, [&]() {
|
||||
slider_danger->setUpperValue(ui->lineEdit_danger_upper->text().toFloat());
|
||||
});
|
||||
QObject::connect(slider_danger, &RangeSlider::rangeChanged, [&](float low,float high) {
|
||||
ui->lineEdit_danger_upper->setText(QString::number((int)high));
|
||||
});
|
||||
}
|
||||
void Setpoint_Tachometer::onComboBoxIndexChanged(int index){
|
||||
|
||||
speed_alert_ptr->alert_danger[current_index].speed_upper = ui->lineEdit_alert_upper->text().toFloat();
|
||||
speed_alert_ptr->alert_danger[current_index].speed_lower = ui->lineEdit_alert_lower->text().toFloat();
|
||||
speed_alert_ptr->alert_danger[current_index].speed_upper_enable = ui->checkBox_alert_upper->checkState();
|
||||
speed_alert_ptr->alert_danger[current_index].speed_lower_enable = ui->checkBox_alert_lower->checkState();
|
||||
speed_alert_ptr->alert_danger[current_index].danger_speed_upper = ui->lineEdit_danger_upper->text().toFloat();
|
||||
|
||||
current_index = index;
|
||||
ui->lineEdit_alert_upper->setText(QString::number(speed_alert_ptr->alert_danger[index].speed_upper));
|
||||
ui->lineEdit_alert_lower->setText(QString::number(speed_alert_ptr->alert_danger[index].speed_lower));
|
||||
ui->checkBox_alert_upper->setChecked(speed_alert_ptr->alert_danger[index].speed_upper_enable);
|
||||
ui->checkBox_alert_lower->setChecked(speed_alert_ptr->alert_danger[index].speed_lower_enable);
|
||||
if(speed_alert_ptr->alert_danger[index].speed_upper > 0 && speed_alert_ptr->alert_danger[index].speed_lower){
|
||||
slider_alert->m_upper = speed_alert_ptr->alert_danger[index].speed_upper;
|
||||
slider_alert->m_lower = speed_alert_ptr->alert_danger[index].speed_lower;
|
||||
}
|
||||
ui->lineEdit_danger_upper->setText(QString::number(speed_alert_ptr->alert_danger[index].danger_speed_upper));
|
||||
if(speed_alert_ptr->alert_danger[index].danger_speed_upper > 0){
|
||||
slider_danger->m_upper = speed_alert_ptr->alert_danger[index].danger_speed_upper;
|
||||
}
|
||||
}
|
||||
|
||||
void Setpoint_Tachometer::on_pushButton_confirm_clicked()
|
||||
{
|
||||
if (speed_alert_ptr == nullptr) {
|
||||
qCritical() << "[Setpoint_Tachometer::confirm] should not be here";
|
||||
return;
|
||||
}
|
||||
speed_alert_ptr->alert_danger[current_index].speed_upper = ui->lineEdit_alert_upper->text().toFloat();
|
||||
speed_alert_ptr->alert_danger[current_index].speed_lower = ui->lineEdit_alert_lower->text().toFloat();
|
||||
speed_alert_ptr->alert_danger[current_index].speed_upper_enable = ui->checkBox_alert_upper->checkState();
|
||||
speed_alert_ptr->alert_danger[current_index].speed_lower_enable = ui->checkBox_alert_lower->checkState();
|
||||
speed_alert_ptr->alert_danger[current_index].danger_speed_upper = ui->lineEdit_danger_upper->text().toFloat();
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void Setpoint_Tachometer::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
37
setpoint_tachometer.h
Normal file
37
setpoint_tachometer.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef SETPOINT_TACHOMETER_H
|
||||
#define SETPOINT_TACHOMETER_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "data_config.h"
|
||||
#include "rangeslider.h"
|
||||
#include "tachometer_data.h"
|
||||
|
||||
namespace Ui {
|
||||
class Setpoint_Tachometer;
|
||||
}
|
||||
|
||||
class Setpoint_Tachometer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Setpoint_Tachometer(int slot_no_,int cardtype,QWidget *parent = nullptr);
|
||||
~Setpoint_Tachometer();
|
||||
int slot_no;
|
||||
CardType car_type;
|
||||
private slots:
|
||||
void onComboBoxIndexChanged(int index);
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
private:
|
||||
Ui::Setpoint_Tachometer *ui;
|
||||
RangeSlider *slider_alert;
|
||||
RangeSlider *slider_danger;
|
||||
std::shared_ptr<TachometerData> speed_alert_ptr = nullptr;
|
||||
int current_index;
|
||||
void Init();
|
||||
};
|
||||
|
||||
#endif // SETPOINT_TACHOMETER_H
|
||||
375
setpoint_tachometer.ui
Normal file
375
setpoint_tachometer.ui
Normal file
@ -0,0 +1,375 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Setpoint_Tachometer</class>
|
||||
<widget class="QWidget" name="Setpoint_Tachometer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>710</width>
|
||||
<height>522</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>触发配置</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>480</y>
|
||||
<width>666</width>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>槽位号</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_slot">
|
||||
<property name="text">
|
||||
<string>slot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_chan">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_set_default">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>设置为默认值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_print">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打印</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_help">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>帮助</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>10</y>
|
||||
<width>161</width>
|
||||
<height>451</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>危险 / 警报 2</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>40</y>
|
||||
<width>36</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>rpm</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>20</y>
|
||||
<width>36</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>转速</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_danger_upper">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>80</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<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="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widget_danger" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>107</y>
|
||||
<width>120</width>
|
||||
<height>260</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>260</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>260</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>521</width>
|
||||
<height>451</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>告警 / 警报 1</string>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_upper">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>80</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<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="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widget_alert" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>107</y>
|
||||
<width>120</width>
|
||||
<height>260</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>260</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>260</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>20</y>
|
||||
<width>36</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>转速</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>40</y>
|
||||
<width>36</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>rpm</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_alert_lower">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>420</y>
|
||||
<width>65</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>启用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_alert_upper">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>60</y>
|
||||
<width>65</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>启用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_alert_lower">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>380</y>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<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="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
581
singlerelay.cpp
581
singlerelay.cpp
@ -1,14 +1,585 @@
|
||||
#include "singlerelay.h"
|
||||
#include "ui_singlerelay.h"
|
||||
#include "vibrationdata.h"
|
||||
#include <QStack>
|
||||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
#include <QListView>
|
||||
|
||||
SingleRelay::SingleRelay(QWidget *parent)
|
||||
SingleRelay::SingleRelay(int slot,CardType cardtype,QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::SingleRelay)
|
||||
{
|
||||
, ui(new Ui::SingleRelay) {
|
||||
ui->setupUi(this);
|
||||
slot_no = slot;
|
||||
car_type = cardtype;
|
||||
ui->label_slot_no->setText(QString::number(slot_no));
|
||||
ui->comboBox_relay_ch->setView(new QListView());
|
||||
if (car_type == kCardVibSingle) {
|
||||
for (int i = ui->comboBox_relay_ch->count() - 1; i >= 4; --i) {
|
||||
ui->comboBox_relay_ch->removeItem(i);
|
||||
}
|
||||
}
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
QVBoxLayout *layout_available = new QVBoxLayout(ui->widget_available);
|
||||
list_widget_available = new QListWidget();
|
||||
layout_available->addWidget(list_widget_available);
|
||||
list_widget_available->setDragEnabled(true);
|
||||
|
||||
QVBoxLayout *layout_relay = new QVBoxLayout(ui->widget_relay);
|
||||
treeView_relay = new QTreeView;
|
||||
layout_relay->addWidget(treeView_relay);
|
||||
treeView_relay->setDragEnabled(true); // 启用拖动
|
||||
treeView_relay->setAcceptDrops(true); // 接受放下
|
||||
treeView_relay->setDropIndicatorShown(true); // 显示放置指示器
|
||||
treeView_relay->setDragDropMode(QAbstractItemView::DropOnly);
|
||||
model_Relay = new DropTreeModel(this); //创建模型指定父类
|
||||
treeView_relay->setModel(model_Relay);
|
||||
treeView_relay->setHeaderHidden(true);
|
||||
|
||||
btnGroup_slot = new QButtonGroup(this);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot1);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot2);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot3);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot4);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot5);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot6);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot7);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot8);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot9);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot10);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot11);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot12);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot13);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot14);
|
||||
btnGroup_slot->addButton(ui->pushButton_slot15);
|
||||
|
||||
connect(btnGroup_slot, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(OnButtonGroup(QAbstractButton *)));
|
||||
connect(ui->comboBox_relay_ch, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &SingleRelay::onComboBoxIndexChanged);
|
||||
treeView_relay->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(treeView_relay,&QTreeView::customContextMenuRequested,this,&SingleRelay::on_treeView_Relay_customContextMenuRequested);
|
||||
current_index = ui->comboBox_relay_ch->currentIndex();
|
||||
vote_current_index = ui->comboBox_vote_group->currentIndex();
|
||||
Init();
|
||||
onComboBoxIndexChanged(current_index);
|
||||
on_comboBox_vote_group_currentIndexChanged(current_index);
|
||||
}
|
||||
|
||||
SingleRelay::~SingleRelay()
|
||||
{
|
||||
SingleRelay::~SingleRelay() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SingleRelay::Init(){
|
||||
QList<QAbstractButton *> buttonList = btnGroup_slot->buttons();
|
||||
for (int i = 1; i < buttonList.count() + 1; i++) {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(i);
|
||||
if(base_ptr != nullptr){
|
||||
switch (base_ptr->card_type_) {
|
||||
case kCardVibSingle :{
|
||||
buttonList[i - 1]->setText("振动");
|
||||
break;
|
||||
}
|
||||
case kCardKeyphaseSingle:{
|
||||
buttonList[i - 1]->setText("键相");
|
||||
break;
|
||||
}
|
||||
case kCardSpeedSingle:{
|
||||
buttonList[i - 1]->setText("转速");
|
||||
break;
|
||||
}
|
||||
case kCardRelaySingle:
|
||||
case kCardRelaySingleNOK:
|
||||
case kCardRelayTMRPrimary:{
|
||||
buttonList[i - 1]->setText("继电器");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
if (car_type == kCardVibSingle) {
|
||||
vib_data = std::make_shared<VibrationData>();
|
||||
vib_data->card_type_ = car_type;
|
||||
vib_data->slot_ = slot_no;
|
||||
ConfigMgr::Instance()->AddCard(vib_data);
|
||||
} else {
|
||||
// do nothing or use template to init it.
|
||||
relay_data = std::make_shared<SingleRelayData>();
|
||||
relay_data->card_type_ = car_type;
|
||||
relay_data->slot_ = slot_no;
|
||||
ConfigMgr::Instance()->AddCard(relay_data);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (base_ptr->card_type_ == kCardVibSingle) {
|
||||
vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
} else {
|
||||
relay_data = std::dynamic_pointer_cast<SingleRelayData>(base_ptr);
|
||||
}
|
||||
|
||||
SingleRelayS *relay = relayArray();
|
||||
if (!relay) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "logic" << relay[current_index].logic_expression;
|
||||
qDebug() << "active" << relay[current_index].active << "index" << current_index;
|
||||
|
||||
for(int i = 0 ; i < SLOT_NUM ; i++){
|
||||
std::shared_ptr<CardBase> cardbase_ptr = ConfigMgr::Instance()->GetSlotPtr(i + 1);
|
||||
if(cardbase_ptr != nullptr &&
|
||||
cardbase_ptr->card_type_ == kCardVibSingle){
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(cardbase_ptr);
|
||||
for (int var = 0; var < CHANNEL_COUNT; ++var) {
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(var + 1);
|
||||
if(variable_base == nullptr)
|
||||
continue;
|
||||
QString item_data,item_str;
|
||||
if(variable_base->alert_high.enable){
|
||||
item_str = QString("%1 (槽位 %2 通道 %3 警报高)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2));
|
||||
item_data = QString("%1A1").arg(ptr->base_config_[var].chan_id);
|
||||
}
|
||||
channelNameMap[item_data] = item_str;
|
||||
if(variable_base->danger_high.enable){
|
||||
item_str = QString("%1 (槽位 %2 通道 %3 危险高)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2));
|
||||
item_data = QString("%1A2").arg(ptr->base_config_[var].chan_id);
|
||||
}
|
||||
channelNameMap[item_data] = item_str;
|
||||
if(variable_base->alert_low.enable){
|
||||
item_str = QString("%1 (槽位 %2 通道 %3 警报低)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2));
|
||||
item_data = QString("%1A3").arg(ptr->base_config_[var].chan_id);
|
||||
}
|
||||
channelNameMap[item_data] = item_str;
|
||||
if(variable_base->danger_low.enable){
|
||||
item_str = QString("%1 (槽位 %2 通道 %3 危险低)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2));
|
||||
item_data = QString("%1A4").arg(ptr->base_config_[var].chan_id);
|
||||
}
|
||||
if(var == 3){
|
||||
qDebug() << "alert" << variable_base->danger_high.enable<<variable_base->danger_high.enable;
|
||||
}
|
||||
// channelNameMap[item_data] = item_str;
|
||||
// item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2));
|
||||
// item_data = QString("%1P##NO").arg(ptr->base_config_[var].chan_id);
|
||||
// channelNameMap[item_data] = item_str;
|
||||
}
|
||||
}else if(cardbase_ptr != nullptr &&
|
||||
cardbase_ptr->card_type_ == kCardSpeedSingle){
|
||||
}
|
||||
}
|
||||
if(!relay[current_index].logic_expression.isEmpty()){
|
||||
setExpressionToTreeView(treeView_relay, relay[current_index].logic_expression);
|
||||
}
|
||||
if(!relay[current_index].logic[vote_current_index].isEmpty()){
|
||||
setExpressionToTreeView(treeView_relay, relay[current_index].logic[vote_current_index]);
|
||||
}
|
||||
qDebug() << "relay_data->single_relay[current_index].active" << relay[current_index].active;
|
||||
ui->checkBox_active->setChecked(relay[current_index].active);
|
||||
ui->comboBox_group->setCurrentIndex(relay[current_index].group - 1);
|
||||
ui->lineEdit_vote_count->setText(QString::number(relay[current_index].count_vote));
|
||||
ui->checkBox_vote->setChecked(relay[current_index].vote);
|
||||
on_checkBox_vote_clicked(relay[current_index].vote);
|
||||
|
||||
}
|
||||
|
||||
SingleRelayS* SingleRelay::relayArray() {
|
||||
if (vib_data) {
|
||||
return vib_data->single_relay;
|
||||
}
|
||||
return relay_data ? relay_data->single_relay : nullptr;
|
||||
}
|
||||
void SingleRelay::on_pushButton_cancel_clicked() {
|
||||
this->close();
|
||||
}
|
||||
|
||||
void SingleRelay::OnButtonGroup(QAbstractButton *slot_btn) {
|
||||
if (slot_btn != NULL) {
|
||||
list_widget_available->clear();
|
||||
QString object_name = slot_btn->objectName();
|
||||
qDebug() << object_name ;
|
||||
int button_id = object_name.right(object_name.length() - 15).toInt();
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id);
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if(ptr == nullptr)
|
||||
return;
|
||||
QListWidgetItem *item_and = new QListWidgetItem("AND");
|
||||
item_and->setData(Qt::UserRole, "*");
|
||||
list_widget_available->addItem(item_and);
|
||||
|
||||
QListWidgetItem *item_or = new QListWidgetItem("OR");
|
||||
item_or->setData(Qt::UserRole, "+");
|
||||
list_widget_available->addItem(item_or);
|
||||
|
||||
for(int var = 0; var < CHANNEL_COUNT ; ++var){
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id);
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(var + 1);
|
||||
if(variable_base == nullptr)
|
||||
continue;
|
||||
if(base_ptr->card_type_ == kCardVibSingle){
|
||||
QString item_data;
|
||||
if(variable_base->alert_high.enable){
|
||||
QString item_str = QString("%1 (槽位 %3 通道 %4 警报高)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
QListWidgetItem *item = new QListWidgetItem(item_str);
|
||||
item_data = QString("S%1C%2A1").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
item->setData(Qt::UserRole, item_data);
|
||||
list_widget_available->addItem(item);
|
||||
}
|
||||
|
||||
if(variable_base->danger_high.enable){
|
||||
QString item_str = QString("%1 (槽位 %3 通道 %4 危险高)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
QListWidgetItem *item = new QListWidgetItem(item_str);
|
||||
item_data = QString("S%1C%2A2").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
item->setData(Qt::UserRole, item_data);
|
||||
list_widget_available->addItem(item);
|
||||
}
|
||||
if(variable_base->danger_low.enable){
|
||||
QString item_str = QString("%1 (槽位 %3 通道 %4 危险低)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
QListWidgetItem *item = new QListWidgetItem(item_str);
|
||||
item_data = QString("S%1C%2A4").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
item->setData(Qt::UserRole, item_data);
|
||||
list_widget_available->addItem(item);
|
||||
}
|
||||
if(variable_base->alert_low.enable){
|
||||
QString item_str = QString("%1 (槽位 %3 通道 %4 警报低)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
QListWidgetItem *item = new QListWidgetItem(item_str);
|
||||
item_data = QString("S%1C%2A3").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
item->setData(Qt::UserRole, item_data);
|
||||
list_widget_available->addItem(item);
|
||||
}
|
||||
// QString item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
// QListWidgetItem *item = new QListWidgetItem(item_str);
|
||||
// QString item_data_nok = QString("S%1C%2P##NO").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
// item->setData(Qt::UserRole, item_data_nok);
|
||||
// list_widget_available->addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SingleRelay::keyPressEvent(QKeyEvent *event) {
|
||||
// if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
|
||||
// removeLastElement();
|
||||
// return;
|
||||
// }
|
||||
// QTextEdit::keyPressEvent(event);
|
||||
}
|
||||
QString SingleRelay::buildLogicExpression(QStandardItem *item) {
|
||||
if (!item) return "";
|
||||
|
||||
int childCount = item->rowCount();
|
||||
QVariant userData = item->data(Qt::UserRole);
|
||||
QString text = userData.toString().trimmed();
|
||||
qDebug() << "item" << userData;
|
||||
if (childCount == 0) {
|
||||
// 叶子节点,直接返回表达式,比如 S01C01A1
|
||||
return text;
|
||||
}
|
||||
|
||||
// 判断当前是 +(OR)还是 *(AND)
|
||||
QString opStr = (text == "+") ? "+" :
|
||||
(text == "*") ? "*" : "";
|
||||
|
||||
// 如果不是 +/*,视为叶子节点
|
||||
if (opStr.isEmpty()) {
|
||||
return text;
|
||||
}
|
||||
|
||||
QStringList subExprs;
|
||||
for (int i = 0; i < childCount; ++i) {
|
||||
QStandardItem *child = item->child(i);
|
||||
subExprs << buildLogicExpression(child);
|
||||
}
|
||||
|
||||
return "(" + subExprs.join(" " + opStr + " ") + ")";
|
||||
}
|
||||
void SingleRelay::on_pushButton_confirm_clicked()
|
||||
{
|
||||
SingleRelayS *relay = relayArray();
|
||||
if (!relay) return;
|
||||
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(treeView_relay->model());
|
||||
if (!model) return;
|
||||
|
||||
QStandardItem *root = model->invisibleRootItem();
|
||||
QString finalExpr;
|
||||
for (int i = 0; i < root->rowCount(); ++i) {
|
||||
QStandardItem *topItem = root->child(i);
|
||||
QString expr = buildLogicExpression(topItem);
|
||||
finalExpr += expr;
|
||||
}
|
||||
ExprValidationResult result = validateLogicExpression(finalExpr);
|
||||
if (!result.isValid && !finalExpr.isEmpty()) {
|
||||
QMessageBox::warning(this, "表达式错误",
|
||||
QString("错误位置:%1\n错误描述:%2").arg(result.errorPos).arg(result.errorMsg));
|
||||
return;
|
||||
}
|
||||
if(ui->checkBox_vote->isChecked()){
|
||||
relay[current_index].logic[ui->comboBox_vote_group->currentIndex()] = finalExpr;
|
||||
relay[current_index].count_vote = ui->lineEdit_vote_count->text().toInt();
|
||||
}else{
|
||||
relay[current_index].logic_expression = finalExpr;
|
||||
}
|
||||
relay[current_index].active = ui->checkBox_active->isChecked();
|
||||
relay[current_index].vote = ui->checkBox_vote->isChecked();
|
||||
relay[current_index].group = ui->comboBox_group->currentIndex() + 1;
|
||||
relay[current_index].count_vote = ui->lineEdit_vote_count->text().toInt();
|
||||
qDebug() << "逻辑表达式:" << finalExpr ;
|
||||
this->close();
|
||||
}
|
||||
void SingleRelay::onComboBoxIndexChanged(int index){
|
||||
|
||||
qDebug()<< "[SingleRelay]:index " << index;
|
||||
|
||||
SingleRelayS *relay = relayArray();
|
||||
if (!relay) return;
|
||||
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(treeView_relay->model());
|
||||
if (!model) return;
|
||||
QStandardItem *root = model->invisibleRootItem();
|
||||
QString finalExpr;
|
||||
for (int i = 0; i < root->rowCount(); ++i) {
|
||||
QStandardItem *topItem = root->child(i);
|
||||
QString expr = buildLogicExpression(topItem);
|
||||
finalExpr += expr;
|
||||
}
|
||||
ExprValidationResult result = validateLogicExpression(finalExpr);
|
||||
if (!result.isValid && !finalExpr.isEmpty()) {
|
||||
QMessageBox::warning(this, "表达式错误",
|
||||
QString("错误位置:%1\n错误描述:%2").arg(result.errorPos).arg(result.errorMsg));
|
||||
return;
|
||||
}
|
||||
qDebug() << "finalExpr" << finalExpr;
|
||||
if(ui->checkBox_vote->isChecked()){
|
||||
relay[current_index].logic[vote_current_index] = finalExpr;
|
||||
if(relay[index].logic[0] != "")
|
||||
setExpressionToTreeView(treeView_relay, relay[index].logic[ui->comboBox_vote_group->currentIndex()]);
|
||||
else
|
||||
model_Relay->clear();
|
||||
}else{
|
||||
relay[current_index].logic_expression = finalExpr;
|
||||
if(relay[index].logic_expression != "")
|
||||
setExpressionToTreeView(treeView_relay, relay[index].logic_expression);
|
||||
else
|
||||
model_Relay->clear();
|
||||
}
|
||||
relay[current_index].vote = ui->checkBox_vote->isChecked();
|
||||
relay[current_index].group = ui->comboBox_group->currentIndex() + 1;
|
||||
relay[current_index].count_vote = ui->lineEdit_vote_count->text().toInt();
|
||||
current_index = index;
|
||||
qDebug() << "active" << relay[index].active;
|
||||
ui->checkBox_active->setChecked(relay[index].active);
|
||||
ui->lineEdit_vote_count->setText(QString::number(relay[index].count_vote));
|
||||
|
||||
}
|
||||
ExprNode* SingleRelay::parseExpression(const QString& expr, int& pos) {
|
||||
auto skipSpaces = [&]() {
|
||||
while (pos < expr.length() && expr[pos].isSpace()) pos++;
|
||||
};
|
||||
|
||||
QStack<ExprNode*> nodeStack;
|
||||
QStack<QString> opStack;
|
||||
|
||||
while (pos < expr.length()) {
|
||||
skipSpaces();
|
||||
if (pos >= expr.length()) break;
|
||||
|
||||
QChar ch = expr[pos];
|
||||
|
||||
if (ch == '(') {
|
||||
pos++;
|
||||
nodeStack.push(parseExpression(expr, pos));
|
||||
} else if (ch == ')') {
|
||||
pos++;
|
||||
break;
|
||||
} else if (ch == '+' || ch == '*') {
|
||||
opStack.push(QString(ch));
|
||||
pos++;
|
||||
} else {
|
||||
QString token;
|
||||
while (pos < expr.length() && !QString("()+* ").contains(expr[pos])) {
|
||||
token += expr[pos++];
|
||||
}
|
||||
if (!token.isEmpty()) {
|
||||
nodeStack.push(new ExprNode{token, {}});
|
||||
}
|
||||
}
|
||||
|
||||
while (opStack.size() > 0 && nodeStack.size() >= 2) {
|
||||
QString op = opStack.pop();
|
||||
ExprNode* right = nodeStack.pop();
|
||||
ExprNode* left = nodeStack.pop();
|
||||
|
||||
if (left->value == op) {
|
||||
left->children.append(right);
|
||||
nodeStack.push(left);
|
||||
} else if (right->value == op) {
|
||||
right->children.prepend(left);
|
||||
nodeStack.push(right);
|
||||
} else {
|
||||
ExprNode* parent = new ExprNode{op, {left, right}};
|
||||
nodeStack.push(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nodeStack.isEmpty() ? nullptr : nodeStack.top();
|
||||
}
|
||||
QStandardItem* SingleRelay::buildItemTree(ExprNode* node) {
|
||||
if (!node) return nullptr;
|
||||
QString displayText;
|
||||
if (node->value == "+" || node->value == "*") {
|
||||
displayText = (node->value == "+") ? "OR" : "AND"; // 运算符显示
|
||||
} else {
|
||||
displayText = channelNameMap.value(node->value, node->value); // 显示名
|
||||
qDebug() << "display" <<displayText << node->value;
|
||||
}
|
||||
QStandardItem* item = new QStandardItem(displayText);
|
||||
item->setData(node->value, Qt::UserRole); // 原始表达式key
|
||||
for (ExprNode* child : node->children) {
|
||||
item->appendRow(buildItemTree(child));
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
ExprValidationResult SingleRelay::validateLogicExpression(const QString& expr) {
|
||||
int bracketCount = 0;
|
||||
bool lastWasOperator = true;
|
||||
bool lastWasOpenParen = false;
|
||||
|
||||
for (int i = 0; i < expr.length(); ++i) {
|
||||
QChar ch = expr[i];
|
||||
|
||||
if (ch.isSpace()) continue;
|
||||
|
||||
if (ch == '(') {
|
||||
bracketCount++;
|
||||
lastWasOpenParen = true;
|
||||
lastWasOperator = true;
|
||||
} else if (ch == ')') {
|
||||
bracketCount--;
|
||||
if (bracketCount < 0) {
|
||||
return {false, i, "多余的右括号 ')'"};
|
||||
}
|
||||
lastWasOpenParen = false;
|
||||
lastWasOperator = false;
|
||||
} else if (ch == '+' || ch == '*') {
|
||||
if (lastWasOperator || lastWasOpenParen) {
|
||||
return {false, i, QString("无效的运算符 '%1' 的位置").arg(ch)};
|
||||
}
|
||||
lastWasOperator = true;
|
||||
lastWasOpenParen = false;
|
||||
} else if (ch.isLetterOrNumber()) {
|
||||
QString token;
|
||||
int start = i;
|
||||
while (i < expr.length() && expr[i].isLetterOrNumber()) {
|
||||
token += expr[i];
|
||||
++i;
|
||||
}
|
||||
--i; // 修正多读了一位
|
||||
if (token.isEmpty()) {
|
||||
return {false, start, "变量名称缺失"};
|
||||
}
|
||||
lastWasOperator = false;
|
||||
lastWasOpenParen = false;
|
||||
} else if (ch.isLetterOrNumber() || ch == '#' || ch.unicode() > 127) {
|
||||
QString token;
|
||||
int start = i;
|
||||
while (i < expr.length() &&
|
||||
(expr[i].isLetterOrNumber() || expr[i] == '#' || expr[i].unicode() > 127)) {
|
||||
token += expr[i];
|
||||
++i;
|
||||
}
|
||||
--i;
|
||||
if (token.isEmpty()) {
|
||||
return {false, start, "变量名称缺失"};
|
||||
}
|
||||
lastWasOperator = false;
|
||||
lastWasOpenParen = false;
|
||||
}else {
|
||||
return {false, i, QString("不支持的字符 '%1'").arg(ch)};
|
||||
}
|
||||
}
|
||||
|
||||
if (bracketCount != 0) {
|
||||
return {false, expr.length(), "括号不匹配"};
|
||||
}
|
||||
|
||||
if (lastWasOperator) {
|
||||
return {false, expr.length() - 1, "表达式不能以运算符结尾"};
|
||||
}
|
||||
|
||||
return {true, -1, ""};
|
||||
}
|
||||
void SingleRelay::setExpressionToTreeView(QTreeView* treeView, const QString& expr) {
|
||||
int pos = 0;
|
||||
model_Relay->clear();
|
||||
qDebug() << "expr" << expr;
|
||||
ExprNode* root = parseExpression(expr, pos);
|
||||
QStandardItem* rootItem = buildItemTree(root);
|
||||
|
||||
model_Relay->appendRow(rootItem);
|
||||
treeView_relay->expandAll();
|
||||
}
|
||||
void SingleRelay::slotDeleteItem()
|
||||
{
|
||||
QModelIndex curIndex = treeView_relay->currentIndex();
|
||||
if(curIndex.isValid()){
|
||||
model_Relay->removeRow(curIndex.row(),curIndex.parent());
|
||||
}
|
||||
}
|
||||
void SingleRelay::on_treeView_Relay_customContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
qDebug() << "on_treeView_Relay_customContextMenuRequested" <<endl;
|
||||
QModelIndex curIndex = treeView_relay->indexAt(pos); //当前点击的元素的index
|
||||
QModelIndex index = curIndex.sibling(curIndex.row(),0); //该行的第1列元素的index
|
||||
QMenu menu(this);
|
||||
if (index.isValid()){
|
||||
//添加一行菜单,进行展开
|
||||
menu.addAction(QStringLiteral("删除"), this, SLOT(slotDeleteItem()));
|
||||
menu.addSeparator(); //添加一个分隔线
|
||||
}
|
||||
menu.exec(QCursor::pos()); //显示菜单
|
||||
}
|
||||
|
||||
void SingleRelay::on_checkBox_vote_clicked(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
ui->comboBox_vote_group->setEnabled(true);
|
||||
}else{
|
||||
ui->comboBox_vote_group->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SingleRelay::on_comboBox_vote_group_currentIndexChanged(int index)
|
||||
{
|
||||
SingleRelayS *relay = relayArray();
|
||||
if (!relay) return;
|
||||
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(treeView_relay->model());
|
||||
if (!model) return;
|
||||
QStandardItem *root = model->invisibleRootItem();
|
||||
QString finalExpr;
|
||||
for (int i = 0; i < root->rowCount(); ++i) {
|
||||
QStandardItem *topItem = root->child(i);
|
||||
QString expr = buildLogicExpression(topItem);
|
||||
finalExpr += expr;
|
||||
}
|
||||
ExprValidationResult result = validateLogicExpression(finalExpr);
|
||||
if (!result.isValid && !finalExpr.isEmpty()) {
|
||||
QMessageBox::warning(this, "表达式错误",
|
||||
QString("错误位置:%1\n错误描述:%2").arg(result.errorPos).arg(result.errorMsg));
|
||||
return;
|
||||
}
|
||||
qDebug() << "finalExpr" << finalExpr << index;
|
||||
relay[current_index].logic[vote_current_index] = finalExpr;
|
||||
if(relay[current_index].logic[index] != "")
|
||||
setExpressionToTreeView(treeView_relay, relay[current_index].logic[index]);
|
||||
else
|
||||
model_Relay->clear();
|
||||
vote_current_index = index;
|
||||
}
|
||||
|
||||
|
||||
@ -2,21 +2,63 @@
|
||||
#define SINGLERELAY_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTextEdit>
|
||||
#include <QButtonGroup>
|
||||
#include <QPushButton>
|
||||
#include "data_config.h"
|
||||
#include "config_mgr.h"
|
||||
#include "singlerelay_data.h"
|
||||
#include <QStandardItemModel> //数据模型类
|
||||
#include <QTreeView>
|
||||
|
||||
namespace Ui {
|
||||
class SingleRelay;
|
||||
}
|
||||
|
||||
class SingleRelay : public QDialog
|
||||
{
|
||||
class VibrationData;
|
||||
class SingleRelay : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SingleRelay(QWidget *parent = nullptr);
|
||||
public:
|
||||
explicit SingleRelay(int slot,CardType cardtype,QWidget *parent = nullptr);
|
||||
~SingleRelay();
|
||||
int slot_no;
|
||||
CardType car_type;
|
||||
private slots:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void on_pushButton_cancel_clicked();
|
||||
void OnButtonGroup(QAbstractButton *);
|
||||
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void onComboBoxIndexChanged(int index);
|
||||
void slotDeleteItem();
|
||||
|
||||
void on_treeView_Relay_customContextMenuRequested(const QPoint &pos);
|
||||
|
||||
void on_checkBox_vote_clicked(bool checked);
|
||||
|
||||
void on_comboBox_vote_group_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::SingleRelay *ui;
|
||||
QButtonGroup * btnGroup_slot = nullptr;
|
||||
QListWidget *list_widget_available = nullptr;
|
||||
QTreeView *treeView_relay;
|
||||
QStandardItemModel *model_Relay;
|
||||
std::shared_ptr<SingleRelayData> relay_data = nullptr;
|
||||
std::shared_ptr<VibrationData> vib_data = nullptr;
|
||||
int current_index;
|
||||
int vote_current_index;
|
||||
QMap<QString, QString> channelNameMap;
|
||||
|
||||
void Init();
|
||||
void buildTreeFromExpression(QTreeView *treeView, const QString &expr);
|
||||
SingleRelayS* relayArray();
|
||||
ExprNode* parseExpression(const QString& expr, int& pos);
|
||||
QStandardItem* buildItemTree(ExprNode* node);
|
||||
void setExpressionToTreeView(QTreeView* treeView, const QString& expr);
|
||||
QString buildLogicExpression(QStandardItem *item);
|
||||
ExprValidationResult validateLogicExpression(const QString& expr);
|
||||
};
|
||||
|
||||
#endif // SINGLERELAY_H
|
||||
|
||||
760
singlerelay.ui
760
singlerelay.ui
@ -6,18 +6,18 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>943</width>
|
||||
<width>994</width>
|
||||
<height>569</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>单一继电器组态</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>360</y>
|
||||
<x>620</x>
|
||||
<y>180</y>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
@ -26,70 +26,11 @@
|
||||
<string>告警驱动逻辑:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_10">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>530</y>
|
||||
<width>71</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确 定</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>750</x>
|
||||
<y>535</y>
|
||||
<width>71</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>NCT6100T</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>690</x>
|
||||
<y>230</y>
|
||||
<width>61</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>或(*)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>380</y>
|
||||
<width>551</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
hr { height: 1px; border-width: 0; }
|
||||
li.unchecked::marker { content: "\2610"; }
|
||||
li.checked::marker { content: "\2612"; }
|
||||
</style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'.AppleSystemUIFont'; font-size:13pt;">S02C01P##NO</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>620</x>
|
||||
<y>30</y>
|
||||
<x>230</x>
|
||||
<y>340</y>
|
||||
<width>111</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
@ -98,54 +39,11 @@ li.checked::marker { content: "\2612"; }
|
||||
<string>可用的告警:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_9">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>510</x>
|
||||
<y>530</y>
|
||||
<width>71</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打 印...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>620</x>
|
||||
<y>50</y>
|
||||
<width>301</width>
|
||||
<height>161</height>
|
||||
</rect>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S02C01P##NO (Slot 2 Channel 1 Not OK)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S02C02P##NO (Slot 2 Channel 2 Not OK)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S02C03P##NO (Slot 2 Channel 3 Not OK)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S02C04P##NO (Slot 2 Channel 4 Not OK)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>360</y>
|
||||
<y>350</y>
|
||||
<width>201</width>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
@ -153,15 +51,113 @@ li.checked::marker { content: "\2612"; }
|
||||
<property name="title">
|
||||
<string>继电器关联</string>
|
||||
</property>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<widget class="QCheckBox" name="checkBox_active">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>30</y>
|
||||
<width>103</width>
|
||||
<height>32</height>
|
||||
<y>120</y>
|
||||
<width>85</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>激活</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_94">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>70</y>
|
||||
<width>42</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 分组:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_group">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>60</y>
|
||||
<width>101</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</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>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_95">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>42</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 通道:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_relay_ch">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>20</y>
|
||||
<width>103</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>通道 1</string>
|
||||
@ -243,91 +239,13 @@ li.checked::marker { content: "\2612"; }
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>26</x>
|
||||
<y>70</y>
|
||||
<width>85</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>激活</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>40</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>成组</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>690</x>
|
||||
<y>270</y>
|
||||
<width>61</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>113</x>
|
||||
<y>9</y>
|
||||
<width>31</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 13</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>620</x>
|
||||
<y>230</y>
|
||||
<width>61</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>与(*)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>620</x>
|
||||
<y>270</y>
|
||||
<width>61</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>(</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>10</y>
|
||||
<width>71</width>
|
||||
<width>101</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -335,97 +253,6 @@ li.checked::marker { content: "\2612"; }
|
||||
<string>继电器槽位:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>760</x>
|
||||
<y>230</y>
|
||||
<width>61</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enter</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_12">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>600</x>
|
||||
<y>530</y>
|
||||
<width>81</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>帮 助</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>850</x>
|
||||
<y>270</y>
|
||||
<width>61</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CLR</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>850</x>
|
||||
<y>230</y>
|
||||
<width>61</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><---</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_11">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>530</y>
|
||||
<width>81</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>测点名称...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_13">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>530</y>
|
||||
<width>71</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取 消</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>620</x>
|
||||
<y>320</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>总告警信号</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -769,28 +596,6 @@ li.checked::marker { content: "\2612"; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>16</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -798,7 +603,7 @@ li.checked::marker { content: "\2612"; }
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_17">
|
||||
<widget class="QPushButton" name="pushButton_slot1">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -812,12 +617,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_18">
|
||||
<widget class="QPushButton" name="pushButton_slot2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -831,12 +636,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_20">
|
||||
<widget class="QPushButton" name="pushButton_slot3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -850,12 +655,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_19">
|
||||
<widget class="QPushButton" name="pushButton_slot4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -869,12 +674,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_24">
|
||||
<widget class="QPushButton" name="pushButton_slot5">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -888,12 +693,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_23">
|
||||
<widget class="QPushButton" name="pushButton_slot6">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -907,12 +712,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_22">
|
||||
<widget class="QPushButton" name="pushButton_slot7">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -926,12 +731,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_21">
|
||||
<widget class="QPushButton" name="pushButton_slot8">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -945,12 +750,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_32">
|
||||
<widget class="QPushButton" name="pushButton_slot9">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -964,12 +769,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_31">
|
||||
<widget class="QPushButton" name="pushButton_slot10">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -983,12 +788,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_30">
|
||||
<widget class="QPushButton" name="pushButton_slot11">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -1002,12 +807,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_27">
|
||||
<widget class="QPushButton" name="pushButton_slot12">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -1021,12 +826,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_28">
|
||||
<widget class="QPushButton" name="pushButton_slot13">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -1040,12 +845,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_25">
|
||||
<widget class="QPushButton" name="pushButton_slot14">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -1059,12 +864,12 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_26">
|
||||
<widget class="QPushButton" name="pushButton_slot15">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -1078,26 +883,7 @@ li.checked::marker { content: "\2612"; }
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_29">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>220</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>220</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1106,6 +892,272 @@ li.checked::marker { content: "\2612"; }
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widget_relay" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>620</x>
|
||||
<y>200</y>
|
||||
<width>341</width>
|
||||
<height>301</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widget_available" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>360</y>
|
||||
<width>381</width>
|
||||
<height>141</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_slot_no">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>10</y>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>514</y>
|
||||
<width>420</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确 定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取 消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_print">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打 印...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_help">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>帮 助</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_vote">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>640</x>
|
||||
<y>30</y>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>是否投票</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>632</x>
|
||||
<y>110</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">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>632</x>
|
||||
<y>72</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/>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user