From 4ceee47797b3653a8b51c2b99f9995236bd5362f Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Wed, 9 Oct 2024 10:15:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86redhat=20=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=AD=98=E5=82=A8=E7=9B=AE=E5=BD=95=EF=BC=8C=E9=AB=98?= =?UTF-8?q?=E9=80=9F=E7=94=B5=E6=B5=81=EF=BC=8C=E6=B0=94=E9=9A=99=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=BB=A4=E6=B3=A2=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DIO_Board.cpp | 29 +++++++++++++++++++++++- DIO_Board.ui | 6 +++++ DataWatch3500_GUI.pro | 2 ++ OtherConfig.cpp | 39 +++++++++++++++++++++++++++++++- OtherConfig.h | 4 ++++ OtherConfig.ui | 39 ++++++++++++++++++++++++++++++++ SlowSpeedChannelSetting.cpp | 15 +++++++++++++ SlowSpeedChannelSetting.h | 2 ++ SlowSpeedChannelSetting.ui | 44 ++++++++++++++++++++++++++++++++++++- TerminalInfo.cpp | 11 +++++----- global.cpp | 1 + global.h | 2 +- log.h | 7 +++++- mainwindow.cpp | 18 +++++++++++++-- 14 files changed, 207 insertions(+), 12 deletions(-) diff --git a/DIO_Board.cpp b/DIO_Board.cpp index 05ef386..3eb432e 100644 --- a/DIO_Board.cpp +++ b/DIO_Board.cpp @@ -15,7 +15,10 @@ CDIO_Board::CDIO_Board(QWidget *parent) : Init(); CRealTimeForm *pRealTime = new CRealTimeForm(); connect(pRealTime,SIGNAL(sigDOStatus(QJsonArray&,QJsonArray&)), this, SLOT(slotDOStatus(QJsonArray&,QJsonArray&))); - + if(g_strIOControl == "1"){ + ui->pushButton_Close->setEnabled(1); + ui->pushButton_Open->setEnabled(1); + } } @@ -135,6 +138,18 @@ void CDIO_Board::Init() void CDIO_Board::on_pushButton_Close_clicked() { + QMessageBox:: StandardButton iResult = QMessageBox::question(this, QStringLiteral("提示"), + QStringLiteral("确认后将关闭选择的开出通道!"), + QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); + switch (iResult) { + case QMessageBox::Yes: + break; + case QMessageBox::No: + return; + break; + default: + break; + } QJsonObject allObj,cmdBody,itemObj,DOContralObj; QJsonArray arrayBody; allObj.insert("cmd", "91"); @@ -238,6 +253,18 @@ void CDIO_Board::on_pushButton_Open_clicked() // ] // } // } + QMessageBox:: StandardButton iResult = QMessageBox::question(this, QStringLiteral("提示"), + QStringLiteral("确认后将打开选择的开出通道!"), + QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); + switch (iResult) { + case QMessageBox::Yes: + break; + case QMessageBox::No: + return; + break; + default: + break; + } QJsonObject allObj,cmdBody,itemObj,DOContralObj; QJsonArray arrayBody; allObj.insert("cmd", "91"); diff --git a/DIO_Board.ui b/DIO_Board.ui index 9182c7f..68c8d07 100644 --- a/DIO_Board.ui +++ b/DIO_Board.ui @@ -1086,6 +1086,9 @@ color: rgb(27, 30, 35); + + false + 120 @@ -1118,6 +1121,9 @@ color: rgb(27, 30, 35); + + false + 120 diff --git a/DataWatch3500_GUI.pro b/DataWatch3500_GUI.pro index 5e7bdc0..1dc381c 100644 --- a/DataWatch3500_GUI.pro +++ b/DataWatch3500_GUI.pro @@ -32,6 +32,7 @@ SOURCES += \ CharacteristicList.cpp \ Configuration.cpp \ CopyChannelSetting.cpp \ + CopyDatFile.cpp \ CustomFilter.cpp \ DIO_Board.cpp \ DataGraphView.cpp \ @@ -84,6 +85,7 @@ HEADERS += \ CharacteristicList.h \ Configuration.h \ CopyChannelSetting.h \ + CopyDatFile.h \ CustomFilter.h \ DIO_Board.h \ DataGraphView.h \ diff --git a/OtherConfig.cpp b/OtherConfig.cpp index 6de0887..287c9fb 100644 --- a/OtherConfig.cpp +++ b/OtherConfig.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "ftpclient.h" COtherConfig::COtherConfig(QWidget *parent) : @@ -18,6 +19,7 @@ COtherConfig::COtherConfig(QWidget *parent) : ui->lineEdit_Trigger->setValidator(Validator); ui->lineEdit_peaktopeak->setValidator(Validator); + ui->radioButton_closeIO->setChecked(1); LoadWorkingConditionConfig(); } @@ -101,7 +103,6 @@ void COtherConfig::LoadWorkingConditionConfig() QSettings settingsread(QCoreApplication::applicationDirPath() + "/config/config.ini",QSettings::IniFormat); #endif settingsread.setIniCodec(QTextCodec::codecForName("UTF8")); - g_strVersion = settingsread.value("main/Version").toString(); g_strProject = settingsread.value("main/Project").toString(); QTextCodec* codec = QTextCodec::codecForName("UTF-8");//添加编码格式 @@ -436,3 +437,39 @@ void COtherConfig::on_radioButton_close_clicked() ui->lineEdit_peaktopeak->setEnabled(1); } + +void COtherConfig::on_radioButton_openIO_clicked() +{ + bool ok; + QString password = QInputDialog::getText(this, + "输入密码", + "Enter Password:", + QLineEdit::Password, + "", + &ok); + if(!ok) { + ui->radioButton_openIO->setChecked(0); + ui->radioButton_closeIO->setChecked(1); + return; + } +#ifdef Q_OS_WIN32 + QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini",QSettings::IniFormat); +#endif +#ifdef Q_OS_LINUX + QSettings settingsread(QCoreApplication::applicationDirPath() + "/config/config.ini",QSettings::IniFormat); +#endif + if(password == settingsread.value("main/passwd").toString()) + { + g_strIOControl = "1"; + }else{ + QMessageBox::information(this, QStringLiteral("提示"), "请输入正确的密码!"); + } + +} + + +void COtherConfig::on_radioButton_closeIO_clicked() +{ + g_strIOControl = "0"; +} + diff --git a/OtherConfig.h b/OtherConfig.h index ade5231..ec1575e 100644 --- a/OtherConfig.h +++ b/OtherConfig.h @@ -28,6 +28,10 @@ private slots: void on_radioButton_close_clicked(); void slotNetMgr(QString sAddr,const QVariant& msg); + void on_radioButton_openIO_clicked(); + + void on_radioButton_closeIO_clicked(); + private: Ui::COtherConfig *ui; diff --git a/OtherConfig.ui b/OtherConfig.ui index 0fc1b3c..0f08c26 100644 --- a/OtherConfig.ui +++ b/OtherConfig.ui @@ -411,6 +411,45 @@ + + + + 10 + 210 + 231 + 61 + + + + 继电器开关控制 + + + + + 10 + 30 + 89 + 16 + + + + + + + + + + 120 + 30 + 89 + 16 + + + + + + + diff --git a/SlowSpeedChannelSetting.cpp b/SlowSpeedChannelSetting.cpp index 9125a39..15a16fc 100644 --- a/SlowSpeedChannelSetting.cpp +++ b/SlowSpeedChannelSetting.cpp @@ -2,6 +2,7 @@ #include "ui_SlowSpeedChannelSetting.h" #include #include "CopyChannelSetting.h" +#include "CustomFilter.h" CSlowSpeedChannelSetting::CSlowSpeedChannelSetting(QWidget *parent) : QWidget(parent), @@ -35,6 +36,7 @@ CSlowSpeedChannelSetting::CSlowSpeedChannelSetting(QWidget *parent) : m_DisPlayerList << "平均值" << "最小值" << "最大值"; ui->comboBox_defaultDisplay->clear(); ui->comboBox_defaultDisplay->addItems(m_DisPlayerList); + ui->pushButton_CustomFilter->setVisible(false); } CSlowSpeedChannelSetting::~CSlowSpeedChannelSetting() @@ -58,9 +60,11 @@ void CSlowSpeedChannelSetting::displayChannelSetting() } if(channelSetting.sensorType == "PULSE_CURRENT"){ ui->comboBox_channelType->addItem("气隙"); + ui->pushButton_CustomFilter->setVisible(true); } if(channelSetting.sensorType == "AIRGAP"){ ui->comboBox_channelType->addItem("高速电流"); + ui->pushButton_CustomFilter->setVisible(true); } ui->RPMComBox->clear(); @@ -299,3 +303,14 @@ void CSlowSpeedChannelSetting::on_pushButton_copy_clicked() dialog->show(); } + +void CSlowSpeedChannelSetting::on_pushButton_CustomFilter_clicked() +{ + CustomFilter *pCustomFilter = new CustomFilter(); + pCustomFilter->channel_ID = channelSetting.channelId; + pCustomFilter->vibrate_channel = 1; + pCustomFilter->setWindowModality(Qt::ApplicationModal); + pCustomFilter->show(); + pCustomFilter->getfilterInfo(); +} + diff --git a/SlowSpeedChannelSetting.h b/SlowSpeedChannelSetting.h index d184dc6..2dad4d2 100644 --- a/SlowSpeedChannelSetting.h +++ b/SlowSpeedChannelSetting.h @@ -28,6 +28,8 @@ private slots: void on_comboBox_channelType_currentTextChanged(const QString &arg1); void on_pushButton_copy_clicked(); + void on_pushButton_CustomFilter_clicked(); + public slots: void slotCopyChannelData(QStringList&); private: diff --git a/SlowSpeedChannelSetting.ui b/SlowSpeedChannelSetting.ui index 7f870f2..13e50ec 100644 --- a/SlowSpeedChannelSetting.ui +++ b/SlowSpeedChannelSetting.ui @@ -384,7 +384,7 @@ color: rgb(27, 30, 35); - 0 + 150 0 @@ -398,6 +398,48 @@ color: rgb(27, 30, 35); + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 96 + 28 + + + + + 96 + 28 + + + + #pushButton_CustomFilter { border-image: url(:/image/Btn/normal_Btn.png); + color:#1f5188 } +#pushButton_CustomFilter:hover { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_CustomFilter:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_CustomFilter:checked { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} + + + 滤波设置 + + + diff --git a/TerminalInfo.cpp b/TerminalInfo.cpp index 900d2bb..bf4e062 100644 --- a/TerminalInfo.cpp +++ b/TerminalInfo.cpp @@ -3,7 +3,7 @@ #include "NetMgr.h" #include #include "ftpclient.h" -//#include "CopyDatFile.h" +#include "CopyDatFile.h" #include "Backup.h" #include "ImportConfig.h" @@ -55,6 +55,7 @@ CTerminalInfo::CTerminalInfo(QWidget *parent) : double cpuUserUse = 10,memoryUse = 20,hardDiskUse = 30,temperature = 60; QString updateTime = "1583487670"; + ui->label_Version_GUI->setText(g_strVersion); //UpdateChart(cpuUserUse,memoryUse,memoryUse,temperature,updateTime); @@ -301,10 +302,10 @@ void CTerminalInfo::on_pushButton_Update_clicked() void CTerminalInfo::on_pushButtonCopy_clicked() { -// CCopyDatFile *copyDatDialog = new CCopyDatFile(); -// copyDatDialog->setWindowModality(Qt::ApplicationModal); -// copyDatDialog->setAttribute(Qt::WA_DeleteOnClose); -// copyDatDialog->show(); + CCopyDatFile *copyDatDialog = new CCopyDatFile(); + copyDatDialog->setWindowModality(Qt::ApplicationModal); + copyDatDialog->setAttribute(Qt::WA_DeleteOnClose); + copyDatDialog->show(); } void CTerminalInfo::on_pushButton_export_clicked() diff --git a/global.cpp b/global.cpp index 75a853e..1a58c79 100644 --- a/global.cpp +++ b/global.cpp @@ -14,3 +14,4 @@ QString g_LocalFile ; QString g_strVersion ; QString g_strProject ; QString g_strFre ; +QString g_strIOControl ; diff --git a/global.h b/global.h index 5fe6ee4..fd8b3a0 100644 --- a/global.h +++ b/global.h @@ -16,7 +16,7 @@ extern QString g_LocalFile ; extern QString g_strVersion ; extern QString g_strProject ; extern QString g_strFre ; - +extern QString g_strIOControl ; //#define NO_FILTER typedef struct ChannelSetting{ diff --git a/log.h b/log.h index 1aa2bd6..514b693 100644 --- a/log.h +++ b/log.h @@ -6,8 +6,13 @@ #include #include -#define LOG_FILE_NAME QCoreApplication::applicationDirPath() + QString("\\Log\\") + QDateTime::currentDateTime().toString("yyyy-MM-dd") + QString(".log") +#ifdef Q_OS_WIN32 + #define LOG_FILE_NAME QCoreApplication::applicationDirPath() + QString("\\Log\\") + QDateTime::currentDateTime().toString("yyyy-MM-dd") + QString(".log") +#endif +#ifdef Q_OS_LINUX + #define LOG_FILE_NAME QCoreApplication::applicationDirPath() + QString("/Log/") + QDateTime::currentDateTime().toString("yyyy-MM-dd") + QString(".log") +#endif static int s_logLevel = 0; static QMutex s_logMutex; static QString s_logPath; diff --git a/mainwindow.cpp b/mainwindow.cpp index cf9dd25..1da8120 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -27,7 +27,7 @@ MainWindow::MainWindow(QWidget *parent) : #ifdef Q_OS_LINUX QSettings settingsread(QCoreApplication::applicationDirPath() + "/config/config.ini",QSettings::IniFormat); #endif - g_strVersion = "SJ90C V1.1"; + g_strVersion = "SJ90C V1.1_20241009"; g_strProject = settingsread.value("main/Project").toString(); g_strFre = settingsread.value("main/Fre").toString(); @@ -249,16 +249,28 @@ void MainWindow::leftConfigClick() delete pWaveDisPlay; pWaveDisPlay = NULL; } + if(pDIOBoard){ + delete pDIOBoard; + pDIOBoard = NULL; + } }else if(name == "特征值列表"){ ui->tabWidget_main->setCurrentWidget(pCharacteristcList); if(pWaveDisPlay){ delete pWaveDisPlay; pWaveDisPlay = NULL; } + if(pDIOBoard){ + delete pDIOBoard; + pDIOBoard = NULL; + } }else if(name == "气隙监测"){ }else if(name == "波形图"){ + if(pDIOBoard){ + delete pDIOBoard; + pDIOBoard = NULL; + } if(pWaveDisPlay == NULL) pWaveDisPlay = new CWaveDisPlay(this); ui->tabWidget_main->addTab(pWaveDisPlay,""); @@ -600,8 +612,10 @@ void MainWindow::buttonClick() if (name == "实时监测") { if(pRealTimeForm == NULL) pRealTimeForm = new CRealTimeForm (this); - + if(pDIOBoard == NULL) + pDIOBoard = new CDIO_Board (this); ui->stackedWidget->setCurrentIndex(0); + ui->tabWidget_main->setCurrentIndex(0); } else if (name == "事故追溯") { ui->stackedWidget->setCurrentIndex(1);