From 884e2b0a00735fc9c06d3422100df00e6b5ec1d1 Mon Sep 17 00:00:00 2001 From: Zhang0626 Date: Mon, 17 Apr 2023 17:40:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChannelList.cpp | 8 ++ ChannelList.h | 1 + ChannelSetting.cpp | 67 +++++++++- ChannelSetting.h | 4 + CharacteristicList.cpp | 4 +- CopyChannelSetting.cpp | 44 +++++++ CopyChannelSetting.h | 14 ++ CopyChannelSetting.ui | 86 ++++++++++++- DataWatch3500_GUI.pro.user | 255 +++---------------------------------- FileServerConfig.cpp | 53 ++++---- FileServerConfig.h | 2 + FileServerConfig.ui | 47 ++++++- HistoryAlarm.cpp | 2 +- MyCustomGraphicsItem.cpp | 8 +- RealTimeAlarm.cpp | 2 +- SlowSpeedChannelSetting.ui | 42 ------ WaveDisplay.cpp | 56 ++++++++ WaveDisplay.h | 10 ++ WaveDisplay.ui | 66 +++++++++- channellist.ui | 79 ++++++++---- ftpclient.cpp | 6 +- mainwindow.cpp | 5 +- realtimeform.cpp | 17 ++- sqlitedb.cpp | 11 +- 24 files changed, 527 insertions(+), 362 deletions(-) diff --git a/ChannelList.cpp b/ChannelList.cpp index 949bf1c..f8da66d 100644 --- a/ChannelList.cpp +++ b/ChannelList.cpp @@ -600,3 +600,11 @@ void CChannelList::on_pushButton_close_clicked() putJson(); } + +void CChannelList::on_pushButton_refresh_clicked() +{ + model->removeRows(0, model->rowCount()); + g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting"); + initReadConfig(); +} + diff --git a/ChannelList.h b/ChannelList.h index 578c7bd..cdbdfd0 100644 --- a/ChannelList.h +++ b/ChannelList.h @@ -56,6 +56,7 @@ private slots: void on_pushButton_close_clicked(); void on_pushButton_open_clicked(); + void on_pushButton_refresh_clicked(); }; #endif // CHANNELLIST_H diff --git a/ChannelSetting.cpp b/ChannelSetting.cpp index 64fdcff..43683c8 100644 --- a/ChannelSetting.cpp +++ b/ChannelSetting.cpp @@ -3,6 +3,7 @@ #include #include #include +#include "CopyChannelSetting.h" @@ -48,6 +49,8 @@ CChannelSetting::CChannelSetting(QWidget *parent) : ui->lineEdit_tachTriggerPerRev->setValidator(Validator); ui->lineEdit_tachTriggerHysteresis->setValidator(Validator); + connect(ui->channelTypeCombox,SIGNAL(currentTextChanged(QString)),this,SLOT(on_channelTypeCombox_currentTextChanged(const QString&))); + } CChannelSetting::~CChannelSetting() @@ -84,7 +87,6 @@ void CChannelSetting::displayChannelSetting() QMap::Iterator iter = g_MapChannelType.begin(); for (; iter != g_MapChannelType.end(); iter++) { if(iter.key() == channelSetting.sensorType){ - qDebug() <<"iter.value()" << iter.value() <channelTypeCombox->setCurrentText(iter.value()); } } @@ -141,10 +143,8 @@ void CChannelSetting::displayChannelSetting() ui->comboBox_sensorICP->setCurrentText("是"); else ui->comboBox_sensorICP->setCurrentText("否"); - QString frequencyRangeMax = QString("%1").arg(channelSetting.frequencyRangeMax); - ui->lineEdit_frequencyRangeMax->setText(frequencyRangeMax); - QString frequencyRangeMin = QString("%1").arg(channelSetting.frequencyRangeMin); - ui->lineEdit_frequencyRangeMax->setText(frequencyRangeMin); + ui->lineEdit_frequencyRangeMax->setText(channelSetting.frequencyRangeMax); + ui->lineEdit_frequencyRangeMin->setText(channelSetting.frequencyRangeMin); ui->comboBox_sensorRangeCheck->clear(); ui->comboBox_sensorRangeCheck->addItems(m_itemList); @@ -266,14 +266,14 @@ void CChannelSetting::on_pushButton_submit_clicked() }else if(ui->channelTypeCombox->currentText() == "声音"){ channelSetting.sensorType ="MICROPHONE"; }else if(ui->channelTypeCombox->currentText() == "轴向位移"){ - channelSetting.sensorType ="PROXIMETER"; + channelSetting.sensorType ="THRUST"; }else if(ui->channelTypeCombox->currentText() == "速度"){ channelSetting.sensorType ="VELOCITY"; }else if(ui->channelTypeCombox->currentText() == "转速"){ channelSetting.sensorType ="TACHOMETER"; }else if(ui->channelTypeCombox->currentText() == "径向振动位移"){ - channelSetting.sensorType ="THRUST"; + channelSetting.sensorType ="PROXIMETER"; }else if(ui->channelTypeCombox->currentText() == "动态电压"){ channelSetting.sensorType ="FAST_VOLTAGE"; } @@ -586,8 +586,61 @@ void CChannelSetting::on_comboBox_samplingRate_currentTextChanged(const QString } +void CChannelSetting::slotSetChannelData(QStringList& listChannelName) +{ + qDebug() << listChannelName << endl; + for (int i = 0; i < listChannelName.size(); i++) + { + QString strUpdateSql = QString(" set ChUnitCoeff = '%1' , ChUnitDot = %2,SensorICP = '%3', \ + SensorType = '%4',bearingClearance='%5',bearingStartPosition='%6',\ + channelIntDiff = '%7',channelRMSPkPk2Pk='%8',channelSensorType='%9',\ + comments = '%10',couplingACDC='%11',envelopeHighpassband=%12,envelopeLowpassband=%13,\ + equipmentId = %14,filter='%15',frequencyRangeMax='%16',frequencyRangeMin='%17',\ + fullScalePosition=%18,highPassFrequency='%19',installMethod='%20',isEnable=%21,\ + isWork=%22,lowPassFrequency='%23',measuringRange='%24',offset=%25,pairChannelId='%26',\ + pairChannelName='%27',rpmMultiplier='%28',samplingRate=%29,sensor1xAmplitudeRunout='%30',\ + sensor1xPhaseRunout='%31',sensorConfigureDate='%32',sensorEngineeringUnit='%33',\ + sensorGapVoltage='%34',sensorLeftOrRight='%35',sensorLocationInDegree=%36,\ + sensorRange='%37',sensorRangeCheck='%38',sensorRangeMax='%39',sensorRangeMin='%40',\ + sensorSensitivity='%41',shaftRotationDirection='%42',speedRefChannelId='%43',\ + startBrands='%44',stopBrands='%45',tachAutoTach='%46',tachTriggerEdge='%47',tachTriggerHysteresis=%48,\ + tachTriggerPerRev='%49',tachTriggerVoltageLevel='%50',thermalCoupleType = '%51',xFullScalePosition='%52',\ + xProcessVariableName='%53',xZeroScalePosition='%54',zeroScalePosition='%55',speedRefChannelName = '%56',defaultDisplay = '%57' where channelName = '%58'").\ + arg(channelSetting.ChUnitCoeff).arg(channelSetting.ChUnitDot).arg(channelSetting.sensorICP).\ + arg(channelSetting.sensorType).arg(channelSetting.bearingClearance).arg(channelSetting.bearingStartPosition).\ + arg(channelSetting.channelIntDiff).arg(channelSetting.channelRMSPkPk2Pk).arg(channelSetting.channelSensorType).\ + arg(channelSetting.comments).arg(channelSetting.couplingACDC).arg(channelSetting.envelopeHighpassband).arg(channelSetting.envelopeLowpassband).\ + arg(channelSetting.equipmentId).arg(channelSetting.filter).arg(channelSetting.frequencyRangeMax).\ + arg(channelSetting.frequencyRangeMin).arg(channelSetting.fullScalePosition).arg(channelSetting.highPassFrequency).\ + arg(channelSetting.installMethod).arg(channelSetting.isEnable).arg(channelSetting.isWork).\ + arg(channelSetting.lowPassFrequency).arg(channelSetting.measuringRange).arg(channelSetting.offset).\ + arg(channelSetting.pairChannelId).arg(channelSetting.pairChannelName).arg(channelSetting.rpmMultiplier).\ + arg(channelSetting.samplingRate).arg(channelSetting.sensor1xAmplitudeRunout).arg(channelSetting.sensor1xPhaseRunout).\ + arg(channelSetting.sensorConfigureDate).arg(channelSetting.sensorEngineeringUnit).arg(channelSetting.sensorGapVoltage).\ + arg(channelSetting.sensorLeftOrRight).arg(channelSetting.sensorLocationInDegree).\ + arg(channelSetting.sensorRange).arg(channelSetting.sensorRangeCheck).\ + arg(channelSetting.sensorRangeMax).arg(channelSetting.sensorRangeMin).arg(channelSetting.sensorSensitivity).\ + arg(channelSetting.shaftRotationDirection).arg(channelSetting.speedRefChannelId).\ + arg(channelSetting.startBrands).arg(channelSetting.stopBrands).arg(channelSetting.tachAutoTach).arg(channelSetting.tachTriggerEdge).\ + arg(channelSetting.tachTriggerHysteresis).arg(channelSetting.tachTriggerPerRev).arg(channelSetting.tachTriggerVoltageLevel).\ + arg(channelSetting.thermalCoupleType).arg(channelSetting.xFullScalePosition).arg(channelSetting.xProcessVariableName).arg(channelSetting.xZeroScalePosition).\ + arg(channelSetting.zeroScalePosition).arg(channelSetting.speedRefChannelName).arg(channelSetting.defaultDisplay).arg(listChannelName[i]); + + QString tableName = "t_ChannelSetting "; + g_SqliteDB->UpdateDataSql(tableName,strUpdateSql); + } +} void CChannelSetting::on_pushButton_copy_clicked() { + //sensorModuleNo + QString strWhere = QString(" sensorModuleNo = %1 and channelId <> '%2' ").arg(channelSetting.sensorModuleNo).arg(channelSetting.channelId); + QVector copyChannel = g_SqliteDB->GetDataMultiLine("t_ChannelSetting","*",strWhere); + CopyChannelSetting *dialog = new CopyChannelSetting(); + connect(dialog, SIGNAL(sgSetChannelData(QStringList&)), this, SLOT(slotSetChannelData(QStringList&))); + dialog->copyChannel = copyChannel; + dialog->setWindowModality(Qt::ApplicationModal); + dialog->displayCopyChannel(); + dialog->show(); } diff --git a/ChannelSetting.h b/ChannelSetting.h index 3a62fb5..b8903cf 100644 --- a/ChannelSetting.h +++ b/ChannelSetting.h @@ -3,6 +3,7 @@ #include #include "global.h" +#include "sqlitedb.h" namespace Ui { class CChannelSetting; @@ -31,6 +32,9 @@ private slots: void on_comboBox_samplingRate_currentTextChanged(const QString &arg1); + void on_pushButton_copy_clicked(); +public slots: + void slotSetChannelData(QStringList&); private: Ui::CChannelSetting *ui; QStringList m_itemList; diff --git a/CharacteristicList.cpp b/CharacteristicList.cpp index d139099..b16d451 100644 --- a/CharacteristicList.cpp +++ b/CharacteristicList.cpp @@ -31,7 +31,7 @@ void CCharacteristicList::timerEvent(QTimerEvent *ev) void CCharacteristicList::InitTable() { headerStr = QObject::tr("通道名称,单位,通频值,峰峰值,1X幅值,1X相位,平均工作位置,间隙,安装角度,状态"); - ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive); model = new QStandardItemModel(ui->tableView); ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); //选中行 QStringList headerList = headerStr.split(","); @@ -40,7 +40,7 @@ void CCharacteristicList::InitTable() ui->tableView->setModel(model); ui->tableView->setAlternatingRowColors(true); ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); - ui->tableView->setColumnWidth(0, 600); + ui->tableView->setColumnWidth(0, 300); ui->tableView->setColumnWidth(6, 200); // for (int i = 0;i < g_ChannelView.size(); i++) diff --git a/CopyChannelSetting.cpp b/CopyChannelSetting.cpp index 2a60b88..20cc8e3 100644 --- a/CopyChannelSetting.cpp +++ b/CopyChannelSetting.cpp @@ -1,6 +1,8 @@ #include "CopyChannelSetting.h" #include "ui_CopyChannelSetting.h" +#include + CopyChannelSetting::CopyChannelSetting(QWidget *parent) : QWidget(parent), ui(new Ui::CopyChannelSetting) @@ -12,3 +14,45 @@ CopyChannelSetting::~CopyChannelSetting() { delete ui; } + +void CopyChannelSetting::displayCopyChannel() +{ + QGridLayout* layout = new QGridLayout(ui->widget); + int col = 0,row = 0; + for(int i = 0; i < copyChannel.size();i++){ + QCheckBox *checkButton = new QCheckBox(copyChannel[i].channelName,ui->widget); + + if(!int((i+1) % 2)){ + layout->addWidget(checkButton, col, row); + col ++ ; + row = 0; + }else{ + layout->addWidget(checkButton, col, row); + row ++ ; + + } + m_listCheckBox.append(checkButton); + } +} + +void CopyChannelSetting::on_pushButton_confirm_clicked() +{ + QStringList listChannelName; + for (int i = 0; i < m_listCheckBox.size(); i++) { + if(m_listCheckBox[i]->checkState()){ + qDebug() << m_listCheckBox[i]->text() << endl; + listChannelName.append(m_listCheckBox[i]->text()); + } + } + sgSetChannelData(listChannelName); + this->close(); +} + + +void CopyChannelSetting::on_pushButton_selectAll_clicked() +{ + for (int i = 0; i < m_listCheckBox.size(); i++) { + m_listCheckBox[i]->setCheckState(Qt::Checked); + } +} + diff --git a/CopyChannelSetting.h b/CopyChannelSetting.h index df64f2b..c781077 100644 --- a/CopyChannelSetting.h +++ b/CopyChannelSetting.h @@ -2,6 +2,8 @@ #define COPYCHANNELSETTING_H #include +#include "global.h" +#include namespace Ui { class CopyChannelSetting; @@ -15,8 +17,20 @@ public: explicit CopyChannelSetting(QWidget *parent = nullptr); ~CopyChannelSetting(); + QVector copyChannel; + void displayCopyChannel(); + +private slots: + void on_pushButton_confirm_clicked(); + + void on_pushButton_selectAll_clicked(); + private: Ui::CopyChannelSetting *ui; + + QList m_listCheckBox; +signals: + void sgSetChannelData(QStringList&); }; #endif // COPYCHANNELSETTING_H diff --git a/CopyChannelSetting.ui b/CopyChannelSetting.ui index 59a352e..93fcacb 100644 --- a/CopyChannelSetting.ui +++ b/CopyChannelSetting.ui @@ -6,8 +6,8 @@ 0 0 - 681 - 429 + 855 + 605 @@ -21,7 +21,7 @@ color: rgb(27, 30, 35); 140 - 110 + 50 421 31 @@ -30,6 +30,86 @@ color: rgb(27, 30, 35); 你想要把当前通道的配置复制到哪些通道? + + + + 70 + 130 + 751 + 351 + + + + + + + 480 + 520 + 120 + 35 + + + + + 120 + 35 + + + + + 120 + 35 + + + + #pushButton_confirm { border-image: url(:/image/Btn/normal_Btn.png); + color:#1f5188 } +#pushButton_confirm:hover { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_confirm:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_confirm:checked { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} + + + 确定 + + + + + + 240 + 520 + 120 + 35 + + + + + 120 + 35 + + + + + 120 + 35 + + + + #pushButton_selectAll { border-image: url(:/image/Btn/normal_Btn.png); + color:#1f5188 } +#pushButton_selectAll:hover { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_selectAll:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_selectAll:checked { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} + + + 全选 + + diff --git a/DataWatch3500_GUI.pro.user b/DataWatch3500_GUI.pro.user index 93ecf1f..a41c556 100644 --- a/DataWatch3500_GUI.pro.user +++ b/DataWatch3500_GUI.pro.user @@ -1,14 +1,14 @@ - + EnvironmentId - {4d2e0de9-4d17-4362-8db9-5eb52cc06e2d} + {168666bd-c3a3-4089-8a9e-043b6ddc15f8} ProjectExplorer.Project.ActiveTarget - 1 + 0 ProjectExplorer.Project.EditorSettings @@ -79,7 +79,7 @@ true true Builtin.DefaultTidyAndClazy - 12 + 3 @@ -91,16 +91,16 @@ ProjectExplorer.Project.Target.0 Desktop - Desktop Qt 5.12.11 MSVC2017 64bit - Desktop Qt 5.12.11 MSVC2017 64bit - qt.qt5.51211.win64_msvc2017_64_kit - 0 + Desktop Qt 5.12.11 MinGW 32-bit + Desktop Qt 5.12.11 MinGW 32-bit + qt.qt5.51211.win32_mingw73_kit + 1 0 0 0 - D:\chaos\build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug - D:/chaos/build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug + E:\WorkSpace\3500\build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_32_bit-Debug + E:/WorkSpace/3500/build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_32_bit-Debug true @@ -137,8 +137,8 @@ 2 - D:\chaos\build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MSVC2017_64bit-Release - D:/chaos/build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MSVC2017_64bit-Release + E:\WorkSpace\3500\build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_32_bit-Release + E:/WorkSpace/3500/build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_32_bit-Release true @@ -177,13 +177,13 @@ 0 - D:\chaos\build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MSVC2017_64bit-Profile - D:/chaos/build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MSVC2017_64bit-Profile + E:\WorkSpace\3500\build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_32_bit-Profile + E:/WorkSpace/3500/build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_32_bit-Profile true QtProjectManager.QMakeBuildStep - false + true @@ -294,236 +294,21 @@ 2 - ProjectExplorer.CustomExecutableRunConfiguration - - false - true - false - true - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop - Desktop Qt 5.12.11 MinGW 64-bit - Desktop Qt 5.12.11 MinGW 64-bit - qt.qt5.51211.win64_mingw73_kit - 0 - 0 - 0 - - 0 - D:\chaos\build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_64_bit-Debug - D:/chaos/build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:\chaos\build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_64_bit-Release - D:/chaos/build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - D:\chaos\build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_64_bit-Profile - D:/chaos/build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - - 25 - - 1 - true - false - true - - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - ProjectExplorer.CustomExecutableRunConfiguration - + Qt4ProjectManager.Qt4RunConfiguration:E:/WorkSpace/3500/DataWatch3500_GUI/DataWatch3500_GUI.pro + E:/WorkSpace/3500/DataWatch3500_GUI/DataWatch3500_GUI.pro false true + true false true + E:/WorkSpace/3500/build-DataWatch3500_GUI-Desktop_Qt_5_12_11_MinGW_32_bit-Release 1 ProjectExplorer.Project.TargetCount - 2 + 1 ProjectExplorer.Project.Updater.FileVersion diff --git a/FileServerConfig.cpp b/FileServerConfig.cpp index 9817135..5df15d6 100644 --- a/FileServerConfig.cpp +++ b/FileServerConfig.cpp @@ -16,10 +16,8 @@ CFileServerConfig::CFileServerConfig(QWidget *parent) : connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&))); - QString exp = "^(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\." - "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\." - "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\." - "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)$"; + 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_PS->setValidator(Validator); @@ -33,8 +31,6 @@ CFileServerConfig::CFileServerConfig(QWidget *parent) : ui->lineEdit_Mask_PL->setValidator(Validator); ui->lineEdit_ServerIP->setValidator(Validator); - - } CFileServerConfig::~CFileServerConfig() @@ -118,27 +114,6 @@ void CFileServerConfig::Init() void CFileServerConfig::on_pushButtonPush_clicked() { - QString strTableName = "t_DeviceInfo"; - QString strUpdateSql = QString(" set IP = '%1' ;").arg(ui->lineEdit_hostIP->text()); - g_SqliteDB->UpdateDataSql(strTableName,strUpdateSql); - - QString col = "IP"; - QString str = g_SqliteDB->GetSingelLine(strTableName,col); - QStringList strList = str.split(","); - IP = strList[0]; - qDebug() << "IP" << IP << endl; - - QJsonObject allObj,cmdBody; - QNetworkRequest req; - QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP); - allObj.insert("cmd", "20"); - cmdBody.insert("type","GET"); - allObj["cmdBody"] = cmdBody; - req.setUrl(sUrl); - - g_NetMgr->PostJson(req,allObj); - - QJsonObject netWorkObj,plObj,psObj; psObj["ipAddress"] = ui->lineEdit_IP_PS->text(); psObj["hostName"] = ui->lineEdit_HostName_PS->text(); @@ -221,3 +196,27 @@ void CFileServerConfig::slotNetMgr(QString sAddr, const QVariant &msg) } + +void CFileServerConfig::on_pushButton_get_clicked() +{ + QString strTableName = "t_DeviceInfo"; + QString strUpdateSql = QString(" set IP = '%1' ;").arg(ui->lineEdit_hostIP->text()); + g_SqliteDB->UpdateDataSql(strTableName,strUpdateSql); + + QString col = "IP"; + QString str = g_SqliteDB->GetSingelLine(strTableName,col); + QStringList strList = str.split(","); + IP = strList[0]; + qDebug() << "IP" << IP << endl; + + QJsonObject allObj,cmdBody; + QNetworkRequest req; + QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP); + allObj.insert("cmd", "20"); + cmdBody.insert("type","GET"); + allObj["cmdBody"] = cmdBody; + req.setUrl(sUrl); + + g_NetMgr->PostJson(req,allObj); +} + diff --git a/FileServerConfig.h b/FileServerConfig.h index c021f4f..86049e5 100644 --- a/FileServerConfig.h +++ b/FileServerConfig.h @@ -22,6 +22,8 @@ private slots: //网络请求数据响应 void slotNetMgr(QString sAddr,const QVariant& msg); + void on_pushButton_get_clicked(); + private: Ui::CFileServerConfig *ui; diff --git a/FileServerConfig.ui b/FileServerConfig.ui index 57ee9c1..1737e79 100644 --- a/FileServerConfig.ui +++ b/FileServerConfig.ui @@ -120,7 +120,7 @@ - 16777215 + 150 16777215 @@ -158,7 +158,7 @@ 13 53 - 429 + 451 321 @@ -378,6 +378,12 @@ 0 + + + 150 + 16777215 + + 主机IP: @@ -398,6 +404,41 @@ + + + + 170 + 492 + 120 + 35 + + + + + 120 + 35 + + + + + 120 + 35 + + + + #pushButton_get { border-image: url(:/image/Btn/normal_Btn.png); + color:#1f5188 } +#pushButton_get:hover { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_get:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_get:checked { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} + + + 获取 + + @@ -410,7 +451,7 @@ 10 50 - 429 + 453 321 diff --git a/HistoryAlarm.cpp b/HistoryAlarm.cpp index 44c1230..3135663 100644 --- a/HistoryAlarm.cpp +++ b/HistoryAlarm.cpp @@ -14,7 +14,7 @@ CHistoryAlarm::CHistoryAlarm(QWidget *parent) : model->setHorizontalHeaderLabels(headerList); model->setColumnCount(headerList.size()); ui->tableView->setModel(model); - ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive); ui->tableView->setColumnWidth(2, 300); ui->tableView->setAlternatingRowColors(true); model->setRowCount(10); diff --git a/MyCustomGraphicsItem.cpp b/MyCustomGraphicsItem.cpp index 5818c78..fe5003b 100644 --- a/MyCustomGraphicsItem.cpp +++ b/MyCustomGraphicsItem.cpp @@ -14,11 +14,11 @@ void CMyCustomGraphicsItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *even qDebug() << "mouseDoubleClickEvent" << event->scenePos() <pos()), QTransform()); - QMessageBox msgBox; // 生成对象 - msgBox.setText("This is Rect."); // 设置文本 - int ret = msgBox.exec(); // 执行 +// QMessageBox msgBox; // 生成对象 +// msgBox.setText("This is Rect."); // 设置文本 +// int ret = msgBox.exec(); // 执行 - emit doubleclick(event); +// emit doubleclick(event); } void CMyCustomGraphicsItem::wheelEvent(QGraphicsSceneWheelEvent *event) diff --git a/RealTimeAlarm.cpp b/RealTimeAlarm.cpp index d5b9d9c..ca6e75d 100644 --- a/RealTimeAlarm.cpp +++ b/RealTimeAlarm.cpp @@ -17,7 +17,7 @@ CRealTimeAlarm::CRealTimeAlarm(QWidget *parent) : ui->tableView->setColumnWidth(2, 300); ui->tableView->setAlternatingRowColors(true); model->setRowCount(10); - ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive); ui->tableView->horizontalHeader()->setSectionResizeMode(0,QHeaderView::ResizeToContents); ui->tableView->horizontalHeader()->setSectionResizeMode(4,QHeaderView::ResizeToContents); diff --git a/SlowSpeedChannelSetting.ui b/SlowSpeedChannelSetting.ui index 912852f..dca4968 100644 --- a/SlowSpeedChannelSetting.ui +++ b/SlowSpeedChannelSetting.ui @@ -1426,48 +1426,6 @@ color: rgb(27, 30, 35); - - - - - 120 - 35 - - - - - 120 - 35 - - - - #pushButton_copy { border-image: url(:/image/Btn/normal_Btn.png); - color:#1f5188 } -#pushButton_copy:hover { border-image: url(:/image/Btn/normal_Btn_p.png); - color:#ffffff} -#pushButton_copy:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); - color:#ffffff} -#pushButton_copy:checked { border-image: url(:/image/Btn/normal_Btn_p.png); - color:#ffffff} - - - 复制通道 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - diff --git a/WaveDisplay.cpp b/WaveDisplay.cpp index bdeb14c..61b9513 100644 --- a/WaveDisplay.cpp +++ b/WaveDisplay.cpp @@ -12,6 +12,7 @@ CWaveDisPlay::CWaveDisPlay(QWidget *parent) : m_ChannelID = ""; m_PackgNum = 1; bFlag = false; + m_Times = 0; ui->widget->setProperty("flag", "Title"); ui->widget_4->setProperty("flag", "normal"); // QAbstractItemView* view = ui->comboBox_channel_2->view(); @@ -58,6 +59,13 @@ void CWaveDisPlay::InitWindows() QPushButton:pressed{border-image:url(:/image/Btn/timewave-p.png) 5; }\ QPushButton:checked{border-image:url(:/image/Btn/timewave-p.png) 5; } " ); ui->Btn_Timewave->setChecked(true); + + ui->pushButton_1S->setStyleSheet(" QPushButton{ border-image:url(:/image/Btn/normal_Btn.png); color:#1f5188 }\ + QPushButton:hover{ border-image:url(:/image/Btn/normal_Btn_p.png); color:#ffffff }\ + QPushButton:pressed{border-image:url(:/image/Btn/normal_Btn_p.png); color:#ffffff }\ + QPushButton:checked{border-image:url(:/image/Btn/normal_Btn_p.png); color:#ffffff } " ); + ui->pushButton_1S->setChecked(true); + //绑定HTTP消息响应 connect(m_pNetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&))); @@ -372,3 +380,51 @@ void CWaveDisPlay::on_comboBox_channel_2_currentTextChanged(const QString &arg1) } } + +void CWaveDisPlay::timerEvent(QTimerEvent *ev) +{ + if(ev->timerId() == id1) + { + QJsonObject allObj,cmdBody; + allObj.insert("cmd", "30"); + cmdBody.insert("package",0); + cmdBody.insert("channelId",m_ChannelID); + allObj["cmdBody"] = cmdBody; + QNetworkRequest req; + QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP); + req.setUrl(sUrl); + m_pNetMgr->PostJson(req,allObj); + m_Times = m_Times + 1; + if(m_Times == 4){ + killTimer(id1); + m_Times = 0; + } + } +} + + +void CWaveDisPlay::on_pushButton_1S_clicked() +{ + ui->pushButton_4S->setChecked(false); + if(!ui->pushButton_1S->isChecked()){ + + return; + } +} + + +void CWaveDisPlay::on_pushButton_4S_clicked() +{ + ui->pushButton_1S->setChecked(false); + if(ui->pushButton_4S->isChecked()){ + + id1 = startTimer(1000); //参数1 间隔 单位 毫秒 + //定时器第二种方式 + QTimer * timer = new QTimer(this); + //启动定时器 + timer->start(500); + + return; + } +} + diff --git a/WaveDisplay.h b/WaveDisplay.h index 044af69..6a718a3 100644 --- a/WaveDisplay.h +++ b/WaveDisplay.h @@ -36,6 +36,10 @@ private slots: void on_comboBox_channel_2_currentTextChanged(const QString &arg1); + void on_pushButton_1S_clicked(); + + void on_pushButton_4S_clicked(); + public slots: void mouseMoveEvent(QMouseEvent *event); @@ -50,11 +54,17 @@ private: bool bFlag; QCPItemTracer *tracer; //游标 QCPItemText *tracerLabel; //游标标签 + + int id1; //定时器1的唯一标示 + int m_Times; void InitWindows(); void ParseDataTimeWave(QJsonObject&); void ParseDataFsWave(QJsonObject&); void InitGraph(); void Cursor(); + + virtual void timerEvent(QTimerEvent *); + }; #endif // WAVEDISPLAY_H diff --git a/WaveDisplay.ui b/WaveDisplay.ui index 343ec48..3dbf975 100644 --- a/WaveDisplay.ui +++ b/WaveDisplay.ui @@ -6,7 +6,7 @@ 0 0 - 913 + 1203 646 @@ -324,6 +324,70 @@ + + + + + 120 + 35 + + + + + 120 + 35 + + + + #pushButton_1S { border-image: url(:/image/Btn/normal_Btn.png); + color:#1f5188 } +#pushButton_1S:hover { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_1S:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_1S:checked { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} + + + 1S + + + true + + + + + + + + 120 + 35 + + + + + 120 + 35 + + + + #pushButton_4S { border-image: url(:/image/Btn/normal_Btn.png); + color:#1f5188 } +#pushButton_4S:hover { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_4S:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_4S:checked { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} + + + 4S + + + true + + + diff --git a/channellist.ui b/channellist.ui index 1484d21..5706d41 100644 --- a/channellist.ui +++ b/channellist.ui @@ -70,7 +70,7 @@ QTableView::item { 80 - + @@ -140,28 +140,59 @@ QTableView::item { - 523 - 20 + 241 + 59 - - - - 120 - 35 - - - - - 120 - 35 - - - - #pushButton_line { border-image: url(:/image/Btn/normal_Btn.png); + + + + + + 120 + 35 + + + + + 120 + 35 + + + + #pushButton_refresh { border-image: url(:/image/Btn/normal_Btn.png); + color:#1f5188 } +#pushButton_refresh:hover { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_refresh:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_refresh:checked { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} + + + 刷新 + + + + + + + + 120 + 35 + + + + + 120 + 35 + + + + #pushButton_line { border-image: url(:/image/Btn/normal_Btn.png); color:#1f5188 } #pushButton_line:hover { border-image: url(:/image/Btn/normal_Btn_p.png); color:#ffffff} @@ -169,11 +200,13 @@ QTableView::item { color:#ffffff} #pushButton_line:checked { border-image: url(:/image/Btn/normal_Btn_p.png); color:#ffffff} - - - 查看线路图 - - + + + 查看线路图 + + + + diff --git a/ftpclient.cpp b/ftpclient.cpp index 2872343..52f4da6 100644 --- a/ftpclient.cpp +++ b/ftpclient.cpp @@ -34,6 +34,8 @@ void FtpClient::SetUserInfo(const QString userAccount, const QString pwd) void FtpClient::SetServerInfo(const QString fileAddr, int Port/* =21 */) { + m_ftpManager->disconnect(SIGNAL(finished(QNetworkReply*))); + connect(m_ftpManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(finished(QNetworkReply*))); m_ftpUrl = new QUrl(fileAddr); m_ftpUrl->setPort(Port); @@ -45,7 +47,7 @@ void FtpClient::slotNetMgr(QString sAddr, const QVariant &msg) if(objec.contains("cmd")) { QJsonValue arrays_value = objec.take("cmd"); - //qDebug()<<"cmd ="<graphicsView->itemAt(pos)) return; QMenu menu(this); - pActionVerticalLine = menu.addAction("Add VerticalLine"); - pActionHorizontalLine = menu.addAction("Add HorizontalLine"); - pActionRect = menu.addAction("Add Channel"); - pActionPixmap = menu.addAction("Add Pixmap"); - pActionText = menu.addAction("Add Text"); - pActionSave = menu.addAction("Save"); + pActionVerticalLine = menu.addAction("添加竖线"); + pActionHorizontalLine = menu.addAction("添加横线"); + pActionRect = menu.addAction("添加通道"); + pActionPixmap = menu.addAction("添加图片"); + pActionText = menu.addAction("添加文字"); + pActionSave = menu.addAction("保存"); pActionVerticalLine->setData(1); pActionHorizontalLine->setData(2); @@ -259,7 +259,10 @@ void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo,QString str) pTextUnits = new QGraphicsTextItem(channelbaseInfo.sensorEngineeringUnit); - } + }else if(channelbaseInfo.channelType == "FAST_VOLTAGE"){ + + pTextUnits = new QGraphicsTextItem("V"); + } QGraphicsTextItem* pTextChannel = new QGraphicsTextItem(channelbaseInfo.channelName); QGraphicsTextItem* pTextValue = new QGraphicsTextItem("0.0"); diff --git a/sqlitedb.cpp b/sqlitedb.cpp index a13515c..d5a9705 100644 --- a/sqlitedb.cpp +++ b/sqlitedb.cpp @@ -102,7 +102,14 @@ QVector SqliteDB::GetDataMultiLine(QString tablename, QString co QVector vecResult; ChannelSetting tempchannel; - QString strSql = QString("SELECT * FROM %1 order BY sensorModuleNo;").arg(tablename); + QString strSql = "SELECT "; + if(column != ""){ + strSql = strSql + column + " from " + tablename + " where " + whereCon + ";"; + } + else{ + strSql = QString("SELECT * FROM %1 order BY sensorModuleNo;").arg(tablename); + } + qDebug() << strSql; sql_query.exec(strSql); if(!sql_query.exec()) { @@ -419,7 +426,7 @@ int SqliteDB::UpdateDataSql(QString& tablename,QString& UpdataSql) int iRet = -1; QString strSql = "update "; strSql = strSql + tablename + UpdataSql; - //qDebug() << strSql << endl; + qDebug() << strSql << endl; if(!sql_query.exec(strSql)) { qDebug() << sql_query.lastError();