优化提交接口,适配redhat 8.0
This commit is contained in:
parent
a630c5a85b
commit
c39c730211
@ -1,5 +1,5 @@
|
||||
#include "Backup.h"
|
||||
#include "ui_BackUp.h"
|
||||
#include "ui_Backup.h"
|
||||
#include <QFileDialog>
|
||||
#include <QProcess>
|
||||
|
||||
|
||||
123
BoardSetting.cpp
123
BoardSetting.cpp
@ -33,7 +33,13 @@ CBoardSetting::~CBoardSetting()
|
||||
|
||||
void CBoardSetting::initReadConfig()
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitBoardsInfo.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/UnitBoardsInfo.json";
|
||||
#endif
|
||||
|
||||
QFile loadFile(name);
|
||||
if(!loadFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
@ -292,7 +298,13 @@ void CBoardSetting::PushData()
|
||||
qDebug() << UnitBoardsInfoObj << endl;
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(UnitBoardsInfoObj);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitBoardsInfo.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/UnitBoardsInfo.json";
|
||||
#endif
|
||||
|
||||
QFile file(name);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(jsonDoc.toJson());
|
||||
@ -447,7 +459,13 @@ void CBoardSetting::PushData()
|
||||
|
||||
QJsonDocument jsonDoc2;
|
||||
jsonDoc2.setObject(WorkConditionsInfoObj);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\UnitWorkConditionsInfo.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/UnitWorkConditionsInfo.json";
|
||||
#endif
|
||||
|
||||
|
||||
QFile file2(fileName);
|
||||
file2.open(QIODevice::WriteOnly);
|
||||
@ -463,36 +481,51 @@ void CBoardSetting::PushData()
|
||||
g_SqliteDB->DeleteData(strTablename);
|
||||
|
||||
QString strURL = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitWorkConditionsInfo.json");
|
||||
g_FtpClient->SetServerInfo(strURL);
|
||||
g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
g_FtpClient->UpLoadFile(fileName,"UnitWorkConditionsInfo.json");
|
||||
|
||||
// g_FtpClient->SetServerInfo(strURL);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileName,"UnitWorkConditionsInfo.json");
|
||||
|
||||
g_FtpClient->uploadFile(strURL,fileName,"UnitWorkConditionsInfo.json");
|
||||
QJsonDocument jsonDocUnit;
|
||||
QJsonObject UnitObj;
|
||||
UnitObj["NULL"] = "";
|
||||
jsonDocUnit.setObject(UnitObj);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameUnit = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileNameUnit = QCoreApplication::applicationDirPath() + "/config/UnitConfigurations.json";
|
||||
#endif
|
||||
|
||||
QFile fileUnit(fileNameUnit);
|
||||
fileUnit.open(QIODevice::WriteOnly);
|
||||
fileUnit.write(jsonDocUnit.toJson());
|
||||
fileUnit.close();
|
||||
QString str2 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitConfigurations.json");
|
||||
g_FtpClient->SetServerInfo(str2);
|
||||
g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
g_FtpClient->UpLoadFile(fileNameUnit,"UnitConfigurations.json");
|
||||
// g_FtpClient->SetServerInfo(str2);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameUnit,"UnitConfigurations.json");
|
||||
|
||||
g_FtpClient->uploadFile(str2,fileNameUnit,"UnitConfigurations.json");
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameUnit2 = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations2.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileNameUnit2 = QCoreApplication::applicationDirPath() + "/config/UnitConfigurations2.json";
|
||||
#endif
|
||||
|
||||
|
||||
QFile fileUnit2(fileNameUnit2);
|
||||
fileUnit2.open(QIODevice::WriteOnly);
|
||||
fileUnit2.write(jsonDocUnit.toJson());
|
||||
fileUnit2.close();
|
||||
QString str22 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitConfigurations2.json");
|
||||
g_FtpClient->SetServerInfo(str22);
|
||||
g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
g_FtpClient->UpLoadFile(fileNameUnit2,"UnitConfigurations2.json");
|
||||
// g_FtpClient->SetServerInfo(str22);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameUnit2,"UnitConfigurations2.json");
|
||||
|
||||
g_FtpClient->uploadFile(str22,fileNameUnit2,"UnitConfigurations2.json");
|
||||
|
||||
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
|
||||
for (int i = 0; i < g_channelSetting.size(); i++)
|
||||
@ -520,8 +553,13 @@ void CBoardSetting::PushData()
|
||||
QJsonDocument jsonDocTri;
|
||||
QJsonArray triArray,m_channeltriggerArray;
|
||||
QJsonObject triggerConfigObj;
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameTri = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileNameTri = QCoreApplication::applicationDirPath() + "/config/TriggerSettings.json";
|
||||
#endif
|
||||
|
||||
|
||||
for (int ii = 0; ii < g_ChannelBaseInfo.size(); ii++) {
|
||||
|
||||
@ -540,25 +578,34 @@ void CBoardSetting::PushData()
|
||||
fileTri.write(jsonDocTri.toJson());
|
||||
fileTri.close();
|
||||
QString str1 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("TriggerSettings.json");
|
||||
g_FtpClient->SetServerInfo(str1);
|
||||
g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
g_FtpClient->UpLoadFile(fileNameTri,"TriggerSettings.json");
|
||||
// g_FtpClient->SetServerInfo(str1);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameTri,"TriggerSettings.json");
|
||||
|
||||
g_FtpClient->uploadFile(str1,fileNameTri,"TriggerSettings.json");
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameTri2 = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings2.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileNameTri2 = QCoreApplication::applicationDirPath() + "/config/TriggerSettings2.json";
|
||||
#endif
|
||||
|
||||
QFile fileTri2(fileNameTri2);
|
||||
fileTri2.open(QIODevice::WriteOnly);
|
||||
fileTri2.write(jsonDocTri.toJson());
|
||||
fileTri2.close();
|
||||
QString strTri2 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("TriggerSettings2.json");
|
||||
g_FtpClient->SetServerInfo(strTri2);
|
||||
g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
g_FtpClient->UpLoadFile(fileNameTri2,"TriggerSettings2.json");
|
||||
// g_FtpClient->SetServerInfo(strTri2);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameTri2,"TriggerSettings2.json");
|
||||
g_FtpClient->uploadFile(strTri2,fileNameTri2,"TriggerSettings2.json");
|
||||
|
||||
QString str = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitBoardsInfo.json");
|
||||
g_FtpClient->SetServerInfo(str);
|
||||
g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
g_FtpClient->UpLoadFile(name,"UnitBoardsInfo.json");
|
||||
// g_FtpClient->SetServerInfo(str);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(name,"UnitBoardsInfo.json");
|
||||
g_FtpClient->uploadFile(str,name,"UnitBoardsInfo.json");
|
||||
disconnect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||||
|
||||
}
|
||||
@ -736,7 +783,13 @@ void CBoardSetting::on_pushButton_Init_clicked()
|
||||
qDebug() << UnitBoardsInfoObj << endl;
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(UnitBoardsInfoObj);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitBoardsInfo.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/UnitBoardsInfo.json";
|
||||
#endif
|
||||
|
||||
QFile file(name);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(jsonDoc.toJson());
|
||||
@ -855,7 +908,13 @@ void CBoardSetting::on_pushButton_Init_clicked()
|
||||
|
||||
QJsonDocument jsonDoc2;
|
||||
jsonDoc2.setObject(WorkConditionsInfoObj);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\UnitWorkConditionsInfo.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/UnitWorkConditionsInfo.json";
|
||||
#endif
|
||||
|
||||
|
||||
QFile file2(fileName);
|
||||
file2.open(QIODevice::WriteOnly);
|
||||
@ -879,8 +938,13 @@ void CBoardSetting::on_pushButton_Init_clicked()
|
||||
QJsonObject UnitObj;
|
||||
UnitObj["NULL"] = "";
|
||||
jsonDocUnit.setObject(UnitObj);
|
||||
QString fileNameUnit = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations.json";
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameUnit = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileNameUnit = QCoreApplication::applicationDirPath() + "/config/UnitConfigurations.json";
|
||||
#endif
|
||||
QFile fileUnit(fileNameUnit);
|
||||
fileUnit.open(QIODevice::WriteOnly);
|
||||
fileUnit.write(jsonDocUnit.toJson());
|
||||
@ -919,8 +983,13 @@ void CBoardSetting::on_pushButton_Init_clicked()
|
||||
QJsonArray triArray,m_channeltriggerArray;
|
||||
QJsonObject triggerConfigObj;
|
||||
|
||||
QString fileNameTri = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings.json";
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameTri = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileNameTri = QCoreApplication::applicationDirPath() + "/config/TriggerSettings.json";
|
||||
#endif
|
||||
for (int ii = 0; ii < g_ChannelBaseInfo.size(); ii++) {
|
||||
|
||||
|
||||
@ -947,14 +1016,14 @@ void CBoardSetting::on_pushButton_Init_clicked()
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(name,"UnitBoardsInfo.json");
|
||||
customLogMessageHandler(QtDebugMsg,"初始化机组板卡配置信息推送完成!");
|
||||
|
||||
#ifndef NO_FILTER
|
||||
QJsonObject sendData;
|
||||
sendData["cmd"] = "111";
|
||||
QNetworkRequest req;
|
||||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||||
req.setUrl(sUrl);
|
||||
g_NetMgr->PostJson(req,sendData);
|
||||
|
||||
#endif
|
||||
putJson();
|
||||
|
||||
}
|
||||
@ -1065,7 +1134,13 @@ void CBoardSetting::putJson()
|
||||
}
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setArray(channelArray);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString name = QCoreApplication::applicationDirPath() + "\\config\\ChannelSettings.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/ChannelSettings.json";
|
||||
#endif
|
||||
QFile file(name);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(jsonDoc.toJson());
|
||||
|
||||
@ -174,6 +174,7 @@ void CChannelList::iniConnect()
|
||||
connect(model, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(itemChangedSlot(QStandardItem*)));
|
||||
|
||||
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||||
#ifndef NO_FILTER
|
||||
QJsonObject sendData;
|
||||
sendData["cmd"] = "97";
|
||||
QJsonArray chan_list;
|
||||
@ -186,6 +187,7 @@ void CChannelList::iniConnect()
|
||||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||||
req.setUrl(sUrl);
|
||||
g_NetMgr->PostJson(req,sendData);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CChannelList::createItem(QStringList filename)
|
||||
@ -478,7 +480,13 @@ void CChannelList::putJson()
|
||||
}
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setArray(channelArray);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString name = QCoreApplication::applicationDirPath() + "\\config\\ChannelSettings.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/ChannelSettings.json";
|
||||
#endif
|
||||
QFile file(name);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(jsonDoc.toJson());
|
||||
@ -639,7 +647,8 @@ void CChannelList::on_pushButton_open_clicked()
|
||||
}
|
||||
}
|
||||
putJson();
|
||||
}else if(ui->comboBox_operate->currentText() == "带通滤波"){
|
||||
}else if(ui->comboBox_operate->currentText() == "带通滤波")
|
||||
{
|
||||
QJsonArray channleList;
|
||||
for (int i = 0; i < model->rowCount(); i++) {
|
||||
QModelIndex indexCheck = model->index(i,0);
|
||||
@ -703,6 +712,7 @@ void CChannelList::on_pushButton_refresh_clicked()
|
||||
model->removeRows(0, model->rowCount());
|
||||
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
|
||||
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||||
#ifndef NO_FILTER
|
||||
QJsonObject sendData;
|
||||
sendData["cmd"] = "97";
|
||||
QJsonArray chan_list;
|
||||
@ -714,6 +724,9 @@ void CChannelList::on_pushButton_refresh_clicked()
|
||||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||||
req.setUrl(sUrl);
|
||||
g_NetMgr->PostJson(req,sendData);
|
||||
#else
|
||||
initReadConfig();
|
||||
#endif
|
||||
#ifdef QT_DEBUG
|
||||
initReadConfig();
|
||||
#endif
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include <QWidget>
|
||||
#include <QStandardItemModel> //数据模型类
|
||||
#include <QMessageBox>
|
||||
#include "HeaderView.h"
|
||||
#include "headerView.h"
|
||||
#include "TableHeaderView.h"
|
||||
#include "global.h"
|
||||
#include "ftpclient.h"
|
||||
|
||||
@ -56,7 +56,7 @@ CChannelSetting::CChannelSetting(QWidget *parent) :
|
||||
|
||||
|
||||
QStringList strSensorList;
|
||||
strSensorList << "电涡流传感器" << "低频位移" << "IEPE型传感器" ;
|
||||
strSensorList << "电涡流传感器" << "低频位移" << "IEPE型传感器" << "速度型传感器" ;
|
||||
ui->comboBox_sensorType->addItems(strSensorList);
|
||||
QStringList ChannelTypeList;
|
||||
ChannelTypeList << "转速" << "径向振动位移" << "轴向位移" << "加速度" << "速度" << "动态电压";
|
||||
@ -607,6 +607,7 @@ void CChannelSetting::on_channelTypeCombox_currentTextChanged(const QString &arg
|
||||
ui->pairChannelComBox->setCurrentText("- -");
|
||||
ui->RPMComBox->setCurrentText("- -");
|
||||
ui->lineEdit_sensorRange->setText("2054");
|
||||
ui->comboBox_sensorType->setCurrentIndex(3);
|
||||
|
||||
}else if(arg1 == "声音"){
|
||||
ui->lineEdit_SensorType->setText("378B02");
|
||||
@ -662,6 +663,7 @@ void CChannelSetting::on_channelTypeCombox_currentTextChanged(const QString &arg
|
||||
ui->pairChannelComBox->setCurrentText("- -");
|
||||
ui->RPMComBox->setCurrentText("- -");
|
||||
ui->lineEdit_sensorRange->setText("2000");
|
||||
ui->comboBox_sensorType->setCurrentIndex(0);
|
||||
|
||||
}else if(arg1 == "轴向位移"){
|
||||
|
||||
@ -691,6 +693,7 @@ void CChannelSetting::on_channelTypeCombox_currentTextChanged(const QString &arg
|
||||
ui->pairChannelComBox->setCurrentText("- -");
|
||||
ui->RPMComBox->setCurrentText("- -");
|
||||
ui->lineEdit_sensorRange->setText("2");
|
||||
ui->comboBox_sensorType->setCurrentIndex(0);
|
||||
}else if(arg1 == "动态电压"){
|
||||
ui->lineEdit_SensorType->setText("电压");
|
||||
ui->lineEdit_sensorEngineeringUnit->setText("V");
|
||||
@ -755,10 +758,10 @@ void CChannelSetting::on_comboBox_samplingRate_currentTextChanged(const QString
|
||||
}
|
||||
|
||||
|
||||
void CChannelSetting::slotSetChannelData(QStringList& listChannelName)
|
||||
void CChannelSetting::slotCopyChannelData(QStringList& listChannelID)
|
||||
{
|
||||
qDebug() << listChannelName << endl;
|
||||
for (int i = 0; i < listChannelName.size(); i++)
|
||||
qDebug() << listChannelID << endl;
|
||||
for (int i = 0; i < listChannelID.size(); i++)
|
||||
{
|
||||
QString strUpdateSql = QString(" set ChUnitCoeff = '%1' , ChUnitDot = %2,SensorICP = '%3', \
|
||||
SensorType = '%4',bearingClearance='%5',bearingStartPosition='%6',\
|
||||
@ -775,7 +778,7 @@ void CChannelSetting::slotSetChannelData(QStringList& listChannelName)
|
||||
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' ,confidenceDegree=%58,sectionNum=%59 where channelName = '%60'").\
|
||||
defaultDisplay = '%57' ,confidenceDegree=%58,sectionNum=%59,sensorTypes='%60' where channelId = '%61'").\
|
||||
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).\
|
||||
@ -795,7 +798,7 @@ void CChannelSetting::slotSetChannelData(QStringList& listChannelName)
|
||||
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(channelSetting.confidenceDegree).arg(channelSetting.sectionNum).arg(listChannelName[i]);
|
||||
arg(channelSetting.confidenceDegree).arg(channelSetting.sectionNum).arg(channelSetting.sensorTypes).arg(listChannelID[i]);
|
||||
|
||||
QString tableName = "t_ChannelSetting ";
|
||||
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
|
||||
@ -808,12 +811,11 @@ void CChannelSetting::on_pushButton_copy_clicked()
|
||||
QString strWhere = QString(" sensorModuleNo = %1 and channelId <> '%2' ").arg(channelSetting.sensorModuleNo).arg(channelSetting.channelId);
|
||||
QVector<ChannelSetting> copyChannel = g_SqliteDB->GetDataMultiLine("t_ChannelSetting","*",strWhere);
|
||||
CopyChannelSetting *dialog = new CopyChannelSetting();
|
||||
connect(dialog, SIGNAL(sgSetChannelData(QStringList&)), this, SLOT(slotSetChannelData(QStringList&)));
|
||||
connect(dialog, SIGNAL(sgCopyChannelData(QStringList&)), this, SLOT(slotCopyChannelData(QStringList&)));
|
||||
dialog->copyChannel = copyChannel;
|
||||
dialog->setWindowModality(Qt::ApplicationModal);
|
||||
dialog->displayCopyChannel();
|
||||
dialog->show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -828,6 +830,9 @@ void CChannelSetting::on_comboBox_sensorType_currentTextChanged(const QString &a
|
||||
}else if(arg1 == "IEPE型传感器"){
|
||||
ui->lineEdit_vMax->setText("12");
|
||||
ui->lineEdit_vMin->setText("8");
|
||||
}else if(arg1 == "速度型传感器"){
|
||||
ui->lineEdit_vMax->setText("24");
|
||||
ui->lineEdit_vMin->setText("-24");
|
||||
}
|
||||
}
|
||||
|
||||
@ -845,10 +850,7 @@ void CChannelSetting::on_pushButton_CustomFilter_clicked()
|
||||
|
||||
CustomFilter *pCustomFilter = new CustomFilter();
|
||||
pCustomFilter->channel_ID = channelSetting.channelId;
|
||||
if(ui->channelTypeCombox->currentText()=="径向振动位移")
|
||||
pCustomFilter->vibrate_channel = 1;
|
||||
else
|
||||
pCustomFilter->vibrate_channel = 0;
|
||||
pCustomFilter->setWindowModality(Qt::ApplicationModal);
|
||||
pCustomFilter->show();
|
||||
pCustomFilter->getfilterInfo();
|
||||
|
||||
@ -43,7 +43,7 @@ private slots:
|
||||
void on_pushButton_CustomFilter_clicked();
|
||||
|
||||
public slots:
|
||||
void slotSetChannelData(QStringList&);
|
||||
void slotCopyChannelData(QStringList&);
|
||||
private:
|
||||
Ui::CChannelSetting *ui;
|
||||
QStringList m_itemList;
|
||||
|
||||
@ -30,7 +30,8 @@ void CCharacteristicList::timerEvent(QTimerEvent *ev)
|
||||
}
|
||||
void CCharacteristicList::InitTable()
|
||||
{
|
||||
headerStr = QObject::tr("通道名称,单位,通频值,峰峰值,反时限危险值,反时限报警值,平均工作位置,间隙,安装角度,状态");
|
||||
headerStr = QObject::tr("通道名称,单位,通频值,峰峰值,反时限危险值,反时限警报值,平均工作位置,间隙,安装角度,状态");
|
||||
//headerStr = QObject::tr("通道名称,单位,通频值,峰峰值,平均工作位置,间隙,安装角度,状态");
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
|
||||
model = new QStandardItemModel(ui->tableView);
|
||||
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); //选中行
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QStandardItemModel> //数据模型类
|
||||
#include "HeaderView.h"
|
||||
//#include "HeaderView.h"
|
||||
#include "TableHeaderView.h"
|
||||
#include "global.h"
|
||||
#include <QTimer> //定时器类
|
||||
|
||||
@ -87,8 +87,13 @@ void CConfiguration::Init()
|
||||
item1->appendRow(itemAnd);
|
||||
item1->appendRow(itemOr);
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString name = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/TriggerSettings.json";
|
||||
#endif
|
||||
|
||||
QFile loadFile(name);
|
||||
if(!loadFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
@ -191,7 +196,13 @@ void CConfiguration::Init()
|
||||
|
||||
void CConfiguration::LoadConfiguration()
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/UnitConfigurations.json";
|
||||
#endif
|
||||
|
||||
QFile loadFile(name);
|
||||
if(!loadFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
@ -738,6 +749,10 @@ void CConfiguration::on_comboBox_WC_currentTextChanged2(const QString &arg1)
|
||||
strStaticData = "峰值";
|
||||
else if(strList[0] == "MonitorPk2Pk")
|
||||
strStaticData = "监测保护峰峰值";
|
||||
else if(strList[0] == "InvertDanger")
|
||||
strStaticData = "反时限危险值";
|
||||
else if(strList[0] == "InvertAlarm")
|
||||
strStaticData = "反时限警报值";
|
||||
if(xAlertOverEnabled == 1){
|
||||
|
||||
item = new QStandardItem(QString(channelName + "-" + strStaticData + "-" + "高于警报值"));
|
||||
@ -797,11 +812,23 @@ void CConfiguration::PushData()
|
||||
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(WorkConditionConfiguraitonsObj);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/UnitConfigurations.json";
|
||||
#endif
|
||||
|
||||
|
||||
QJsonDocument jsonDoc2;
|
||||
jsonDoc2.setObject(WorkConditionConfiguraitonsObj2);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName2 = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations2.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName2 = QCoreApplication::applicationDirPath() + "/config/UnitConfigurations2.json";
|
||||
#endif
|
||||
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
|
||||
@ -31,28 +31,29 @@ void CopyChannelSetting::displayCopyChannel()
|
||||
row ++ ;
|
||||
|
||||
}
|
||||
m_listCheckBox.append(checkButton);
|
||||
m_mapCheckBox.insert(copyChannel[i].channelId,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());
|
||||
QStringList listChannelID;
|
||||
QMap<QString,QCheckBox*>::iterator iter = m_mapCheckBox.begin();
|
||||
for (; iter != m_mapCheckBox.end(); iter++) {
|
||||
if(iter.value()->checkState()){
|
||||
listChannelID.append(iter.key());
|
||||
}
|
||||
}
|
||||
sgSetChannelData(listChannelName);
|
||||
sgCopyChannelData(listChannelID);
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void CopyChannelSetting::on_pushButton_selectAll_clicked()
|
||||
{
|
||||
for (int i = 0; i < m_listCheckBox.size(); i++) {
|
||||
m_listCheckBox[i]->setCheckState(Qt::Checked);
|
||||
QMap<QString,QCheckBox*>::iterator iter = m_mapCheckBox.begin();
|
||||
for (; iter != m_mapCheckBox.end(); iter++) {
|
||||
iter.value()->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,9 +28,9 @@ private slots:
|
||||
private:
|
||||
Ui::CopyChannelSetting *ui;
|
||||
|
||||
QList<QCheckBox*> m_listCheckBox;
|
||||
QMap<QString,QCheckBox*> m_mapCheckBox;
|
||||
signals:
|
||||
void sgSetChannelData(QStringList&);
|
||||
void sgCopyChannelData(QStringList&);
|
||||
};
|
||||
|
||||
#endif // COPYCHANNELSETTING_H
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QUrl>
|
||||
#include <QtFtp/qftp.h>
|
||||
#include <QtFtp/qurlinfo.h>
|
||||
#include <qftp.h>
|
||||
#include <qurlinfo.h>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QStandardItemModel>
|
||||
#include <QFile>
|
||||
|
||||
@ -337,7 +337,7 @@ void CDataGraphView::ViewData(QString& strChannelID,QVector<WAVE_DATA>& wavedata
|
||||
QVector<double>::iterator min = std::min_element(std::begin(value), std::end(value));
|
||||
double biggest = *max;
|
||||
double minimum = *min;
|
||||
ui->widget_TimeGraph->yAxis->setRange(minimum-1,biggest+2);
|
||||
ui->widget_TimeGraph->yAxis->setRange(minimum,biggest);
|
||||
ui->widget_TimeGraph->axisRect()->setRangeZoomFactor(1.2,1);
|
||||
ui->widget_TimeGraph->axisRect()->setRangeZoomAxes(ui->widget_TimeGraph->xAxis,ui->widget_TimeGraph->yAxis);
|
||||
ui->widget_TimeGraph->replot();
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui network charts ftp
|
||||
QT += core gui network charts
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets sql ftp printsupport
|
||||
|
||||
@ -16,7 +16,6 @@ TEMPLATE = app
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
QMAKE_LFLAGS += -Wl,--large-address-aware
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
@ -33,7 +32,6 @@ SOURCES += \
|
||||
CharacteristicList.cpp \
|
||||
Configuration.cpp \
|
||||
CopyChannelSetting.cpp \
|
||||
CopyDatFile.cpp \
|
||||
CustomFilter.cpp \
|
||||
DIO_Board.cpp \
|
||||
DataGraphView.cpp \
|
||||
@ -86,7 +84,6 @@ HEADERS += \
|
||||
CharacteristicList.h \
|
||||
Configuration.h \
|
||||
CopyChannelSetting.h \
|
||||
CopyDatFile.h \
|
||||
CustomFilter.h \
|
||||
DIO_Board.h \
|
||||
DataGraphView.h \
|
||||
@ -182,9 +179,14 @@ DISTFILES += \
|
||||
|
||||
INCLUDEPATH += $$PWD/include/mqtt
|
||||
INCLUDEPATH += $$PWD/include/fftw
|
||||
INCLUDEPATH += $$PWD/include/ftp
|
||||
|
||||
LIBS += -L$$PWD/lib/fftw/ -llibfftw3-3 -llibfftw3f-3 -llibfftw3l-3
|
||||
LIBS += -L$$PWD/lib/ftp/ -lQt5Ftp
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/fftw/ -llibfftw3-3 -llibfftw3f-3 -llibfftw3l-3
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/fftw/ -llibfftw3-3 -llibfftw3f-3 -llibfftw3l-3
|
||||
else:unix: LIBS += -L$$PWD/lib/fftw/ -lfftw3
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/mqtt/ -lQt5Qmqtt
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/mqtt/ -lQt5Qmqttd
|
||||
else:unix: LIBS += -L$$PWD/lib/MQTT/ -lQt5Qmqtt
|
||||
else:unix: LIBS += -L$$PWD/lib/mqtt/ -lQt5Qmqtt
|
||||
|
||||
@ -47,7 +47,13 @@ void CFileServerConfig::Init()
|
||||
ui->comboBox_NetStatus_PS->addItem("DHCP");
|
||||
ui->comboBox_NetStatus_PL->addItem("STATIC");
|
||||
ui->comboBox_NetStatus_PL->addItem("DHCP");
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\NetWorkConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/NetWorkConfig.json";
|
||||
#endif
|
||||
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
qDebug() << "打开" << fileName ;
|
||||
@ -86,8 +92,13 @@ void CFileServerConfig::Init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
fileName = QCoreApplication::applicationDirPath() + "\\config\\ServerConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
fileName = QCoreApplication::applicationDirPath() + "/config/ServerConfig.json";
|
||||
#endif
|
||||
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
qDebug() << "打开" << fileName ;
|
||||
@ -111,8 +122,13 @@ void CFileServerConfig::Init()
|
||||
ui->lineEdit_writingPeriod->setText(OptionObject["writingPeriodLocalServer"].toString());
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
fileName = QCoreApplication::applicationDirPath() + "\\config\\TcpConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
fileName = QCoreApplication::applicationDirPath() + "/config/TcpConfig.json";
|
||||
#endif
|
||||
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
QFile file(fileName);
|
||||
@ -134,8 +150,13 @@ void CFileServerConfig::Init()
|
||||
QString strPort = QString("%1").arg(jsonObject["port"].toInt());
|
||||
ui->lineEdit_TCP_PORT->setText(strPort);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
fileName = QCoreApplication::applicationDirPath() + "\\config\\ModbusConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
fileName = QCoreApplication::applicationDirPath() + "/config/ModbusConfig.json";
|
||||
#endif
|
||||
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
QFile file(fileName);
|
||||
@ -190,7 +211,13 @@ void CFileServerConfig::on_pushButtonPush_clicked()
|
||||
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(netWorkObj);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\NetWorkConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/NetWorkConfig.json";
|
||||
#endif
|
||||
|
||||
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
@ -214,7 +241,13 @@ void CFileServerConfig::on_pushButtonPush_clicked()
|
||||
|
||||
QJsonDocument jsonDoc2;
|
||||
jsonDoc2.setObject(m_ServerObject);
|
||||
#ifdef Q_OS_WIN32
|
||||
fileName = QCoreApplication::applicationDirPath() + "\\config\\ServerConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
fileName = QCoreApplication::applicationDirPath() + "/config/ServerConfig.json";
|
||||
#endif
|
||||
|
||||
|
||||
QFile file2(fileName);
|
||||
file2.open(QIODevice::WriteOnly);
|
||||
@ -302,7 +335,13 @@ void CFileServerConfig::on_pushButtonConfirm_clicked()
|
||||
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(TcpConfigObj);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\TcpConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/TcpConfig.json";
|
||||
#endif
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(jsonDoc.toJson());
|
||||
@ -324,7 +363,13 @@ void CFileServerConfig::on_pushButtonConfirm2_clicked()
|
||||
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(RTUConfigObj);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ModbusConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/ModbusConfig.json";
|
||||
#endif
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(jsonDoc.toJson());
|
||||
|
||||
125
HistoryAlarm.cpp
125
HistoryAlarm.cpp
@ -13,22 +13,19 @@ CHistoryAlarm::CHistoryAlarm(QWidget *parent) :
|
||||
ui(new Ui::CHistoryAlarm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
headerStr = QObject::tr("序号,报警级别,报警内容,报警时间,复归时间,报警详情");
|
||||
|
||||
headerStr = QObject::tr(" ,序号,报警级别,报警内容,报警时间,复归时间,报警详情");
|
||||
myHeader = new TableHeaderView(Qt::Horizontal, ui->tableView);
|
||||
model = new QStandardItemModel(ui->tableView);
|
||||
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); //选中行
|
||||
connect(myHeader, &TableHeaderView::stateChanged, this, &CHistoryAlarm::headerStateChangedSlot);
|
||||
QStringList headerList = headerStr.split(",");
|
||||
model->setHorizontalHeaderLabels(headerList);
|
||||
model->setColumnCount(headerList.size());
|
||||
ui->tableView->setModel(model);
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
|
||||
ui->tableView->setColumnWidth(2, 300);
|
||||
ui->tableView->setColumnWidth(3, 200);
|
||||
ui->tableView->setColumnWidth(4, 200);
|
||||
ui->tableView->setAlternatingRowColors(true);
|
||||
|
||||
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(0,QHeaderView::ResizeToContents);
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(5,QHeaderView::ResizeToContents);
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(6,QHeaderView::ResizeToContents);
|
||||
|
||||
ui->dateTimeEdit_start->setCalendarPopup(true);
|
||||
ui->dateTimeEdit_end->setCalendarPopup(true);
|
||||
@ -41,6 +38,19 @@ CHistoryAlarm::CHistoryAlarm(QWidget *parent) :
|
||||
|
||||
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
|
||||
ui->tableView->setHorizontalHeader(myHeader);
|
||||
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); //选中行
|
||||
|
||||
CheckBoxDelegate *pCheckDelegate = new CheckBoxDelegate(this);
|
||||
ui->tableView->setItemDelegateForColumn(0, pCheckDelegate);
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
|
||||
ui->tableView->setColumnWidth(0, 100);
|
||||
ui->tableView->setColumnWidth(3, 450);
|
||||
ui->tableView->setColumnWidth(4, 200);
|
||||
ui->tableView->setColumnWidth(5, 200);
|
||||
ui->tableView->setAlternatingRowColors(true);
|
||||
|
||||
|
||||
connect(ui->comboBox_channel,SIGNAL(currentIndexChanged(const QString &)),this,SLOT(on_comboBox_channel_currentTextChanged(const QString&)));
|
||||
|
||||
ui->comboBox_channel->addItem("请选择通道...");
|
||||
@ -67,14 +77,34 @@ void CHistoryAlarm::on_comboBox_channel_currentTextChanged(const QString& strCha
|
||||
}
|
||||
|
||||
}
|
||||
void CHistoryAlarm::headerStateChangedSlot(int state)
|
||||
{
|
||||
int rowCount = model->rowCount();
|
||||
if (state == 2)//全选
|
||||
{
|
||||
for (int j = 0; j<rowCount; j++)
|
||||
{
|
||||
QModelIndex index = model->index(j, 0, QModelIndex());
|
||||
model->setData(index, true, Qt::UserRole);
|
||||
}
|
||||
}
|
||||
else if (state == 0) //全不选
|
||||
{
|
||||
for (int j = 0; j<rowCount; j++)
|
||||
{
|
||||
QModelIndex index = model->index(j, 0, QModelIndex());
|
||||
model->setData(index, false, Qt::UserRole);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
void CHistoryAlarm::createRowItem(int Row,QVariantList RowItem)
|
||||
{
|
||||
model->setRowCount(Row+1);
|
||||
|
||||
for (int j = 0; j < RowItem.size(); ++j)
|
||||
for (int j = 1; j < RowItem.size()+1; ++j)
|
||||
{
|
||||
model->setData(model->index(Row,j,QModelIndex()),RowItem.at(j));
|
||||
model->setData(model->index(Row,j,QModelIndex()),RowItem.at(j-1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,17 +141,44 @@ void CHistoryAlarm::on_pushButton_search_clicked()
|
||||
triggerLevel = "危险";
|
||||
}
|
||||
|
||||
QString strFeatureName = "";
|
||||
if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MinValues"))
|
||||
strFeatureName = "最小值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MaxValues"))
|
||||
strFeatureName = "最大值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DCValues"))
|
||||
strFeatureName = "偏置电压/Gap";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("RMSValues"))
|
||||
strFeatureName = "有效值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DiagnosisPk2Pk"))
|
||||
strFeatureName = "诊断峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratRMS"))
|
||||
strFeatureName = "有效值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratPk2Pk"))
|
||||
strFeatureName = "积分峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("SpeedProfileSpeed"))
|
||||
strFeatureName = "转速";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratPk2Pk/2"))
|
||||
strFeatureName = "峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DiagnosisPeak"))
|
||||
strFeatureName = "峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MonitorPk2Pk"))
|
||||
strFeatureName = "监测保护峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("InvertDanger") )
|
||||
strFeatureName = "反时限危险值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("InvertAlarm"))
|
||||
strFeatureName = "反时限警报值";
|
||||
if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("Over")){
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + "高于" + triggerLevel + "值";
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + strFeatureName+ "-" + "高于" + triggerLevel + "值";
|
||||
}else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("Under")){
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + "低于" + triggerLevel + "值";
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + strFeatureName+ "-" + "低于" + triggerLevel + "值";
|
||||
}
|
||||
strRowItem << i + 1 << triggerLevel << triggerEventName << TStr << resetTime;
|
||||
|
||||
createRowItem(i,strRowItem);
|
||||
}
|
||||
QMyTableViewBtnDelegate *m_btnDelegate = new QMyTableViewBtnDelegate(QStringList()<<"详情", this);
|
||||
ui->tableView->setItemDelegateForColumn(5, m_btnDelegate);
|
||||
ui->tableView->setItemDelegateForColumn(6, m_btnDelegate);
|
||||
connect(m_btnDelegate, SIGNAL(editData(const QModelIndex &)), this,SLOT(Details(const QModelIndex &)));
|
||||
|
||||
}else{
|
||||
@ -511,7 +568,13 @@ void CHistoryAlarm::Details(const QModelIndex &index)
|
||||
strFileName = strFileName.left(strFileName.size()-1);
|
||||
QStringList strList = strFileName.split("/");
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString strPath = QCoreApplication::applicationDirPath() + "\\dat\\" + strList[5];
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString strPath = QCoreApplication::applicationDirPath() + "/dat/" + strList[5];
|
||||
#endif
|
||||
customLogMessageHandler(QtDebugMsg,"HistoryAlarm:" + strPath);
|
||||
QFile file(strPath);
|
||||
g_LocalFile = strPath;
|
||||
@ -540,3 +603,39 @@ void CHistoryAlarm::ItemCheckStateSlot(QString strID, bool bChecked)
|
||||
DateViewdialog->ViewData(strID,mapWaveData[strID]);
|
||||
}
|
||||
|
||||
|
||||
void CHistoryAlarm::on_pushButton_delete_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;
|
||||
}
|
||||
for (int i = 0; i < model->rowCount(); i++) {
|
||||
QModelIndex indexCheck = model->index(i,0);
|
||||
bool check = model->data(indexCheck, Qt::UserRole).toBool();
|
||||
if(check){
|
||||
QString strDate = model->data(model->index(i,4)).toString();
|
||||
QString strChannelName = model->data(model->index(i,3)).toString();
|
||||
QStringList channellist = strChannelName.split("-");
|
||||
QDateTime dateTime = QDateTime::fromString(strDate, "yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
QString strTableNameAlarm = "t_AlarmStatusInfo",strTableNameTriger = "t_TriggerEvent";
|
||||
// 将QDateTime转换为时间戳
|
||||
qint64 timestamp = dateTime.toSecsSinceEpoch();
|
||||
QString strWhere1 = QString("timestamp = '%1' and channelName = '%2'").arg(timestamp).arg(channellist[0]);
|
||||
QString strWhere2 = QString("triggeredTime = %1 and triggeredChannelName = '%2'").arg(timestamp).arg(channellist[0]);
|
||||
g_SqliteDB->DeleteDataW(strTableNameAlarm,strWhere1);
|
||||
g_SqliteDB->DeleteDataW(strTableNameTriger,strWhere2);
|
||||
}
|
||||
}
|
||||
on_pushButton_search_clicked();
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,9 @@ private slots:
|
||||
void Details(const QModelIndex &index);
|
||||
void downloadProcess_Slot(qint64 byteSend, qint64 byteTotal);
|
||||
void ItemCheckStateSlot(QString strID, bool bChecked);
|
||||
void headerStateChangedSlot(int state);
|
||||
void on_pushButton_delete_clicked();
|
||||
|
||||
private:
|
||||
Ui::CHistoryAlarm *ui;
|
||||
|
||||
|
||||
@ -145,6 +145,35 @@ color: rgb(27, 30, 35);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_delete">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#pushButton_delete { border-image: url(:/image/Btn/normal_Btn.png);
|
||||
color:#1f5188 }
|
||||
#pushButton_delete:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_delete:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_delete:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>删除</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
121
ImportConfig.cpp
121
ImportConfig.cpp
@ -31,7 +31,13 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
QMessageBox::warning(this,tr("提示"),tr("请选择导入文件路径!"));
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString copy_path = QCoreApplication::applicationDirPath() + "\\config\\copy\\";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString copy_path = QCoreApplication::applicationDirPath() + "/config/copy/";
|
||||
#endif
|
||||
QDir copyDir(copy_path);
|
||||
|
||||
// 创建目标文件夹
|
||||
@ -75,7 +81,7 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
ExeSqlData(strSql);
|
||||
strSql = QString("update t_ChannelSetting SET speedRefChannelId = '%1' || SUBSTR(channelId, 13) where speedRefChannelId <> '' AND pairChannelId <> 'NONE';").arg(MAC);
|
||||
ExeSqlData(strSql);
|
||||
strSql = QString("update t_DeviceInfo SET MAC = '%1' ;").arg(MAC);
|
||||
strSql = QString("update t_DeviceInfo SET MAC = '%1',IP = '%2' ;").arg(MAC).arg(IP);
|
||||
ExeSqlData(strSql);
|
||||
strSql = QString("update t_TriggerConfig SET ChannelID = '%1' || SUBSTR(ChannelID, 13) ;").arg(MAC);
|
||||
ExeSqlData(strSql);
|
||||
@ -139,22 +145,27 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
fileTriggerSettings.close();
|
||||
|
||||
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitWorkConditionsInfo.json", copy_path + "UnitWorkConditionsInfo.json");
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitParameters.json", copy_path + "UnitParameters.json");
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ServerConfig.json", copy_path + "ServerConfig.json");
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "NetWorkConfig.json", copy_path + "NetWorkConfig.json");
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ModbusConfig.json", copy_path + "ModbusConfig.json");
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "TcpConfig.json", copy_path + "TcpConfig.json");
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitBoardsInfo.json", copy_path + "UnitBoardsInfo.json");
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ZeroDrift.json", copy_path + "ZeroDrift.json");
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitBoardsInfo.json", copy_path + "UnitBoardsInfo.json");
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ConfidenceDegree.json", copy_path + "ConfidenceDegree.json");
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "TriggerConfig.json", copy_path + "TriggerConfig.json");
|
||||
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "config.ini", copy_path + "config.ini");
|
||||
// copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitWorkConditionsInfo.json", copy_path + "UnitWorkConditionsInfo.json");
|
||||
// copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitParameters.json", copy_path + "UnitParameters.json");
|
||||
// copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ServerConfig.json", copy_path + "ServerConfig.json");
|
||||
// copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "NetWorkConfig.json", copy_path + "NetWorkConfig.json");
|
||||
// copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ModbusConfig.json", copy_path + "ModbusConfig.json");
|
||||
// copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "TcpConfig.json", copy_path + "TcpConfig.json");
|
||||
// copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitBoardsInfo.json", copy_path + "UnitBoardsInfo.json");
|
||||
// copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ZeroDrift.json", copy_path + "ZeroDrift.json");
|
||||
// //copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitBoardsInfo.json", copy_path + "UnitBoardsInfo.json");
|
||||
// copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ConfidenceDegree.json", copy_path + "ConfidenceDegree.json");
|
||||
// copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "TriggerConfig.json", copy_path + "TriggerConfig.json");
|
||||
// copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "config.ini", copy_path + "config.ini");
|
||||
|
||||
qApp->exit(0);
|
||||
g_SqliteDB->CloseDataBase();
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
copyDirectory(copy_path, QCoreApplication::applicationDirPath() + "\\config\\");
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
copyDirectory(copy_path, QCoreApplication::applicationDirPath() + "/config/");
|
||||
#endif
|
||||
QMessageBox::information(this,tr("导入"),tr("导入成功"));
|
||||
// 如果目标文件夹已存在,则删除它
|
||||
QDir copyDir2(copy_path);
|
||||
@ -162,6 +173,86 @@ void CImportConfig::on_pushButton_confirm_clicked()
|
||||
copyDir2.removeRecursively();
|
||||
}
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameInfo = QCoreApplication::applicationDirPath() + "\\config\\UnitWorkConditionsInfo.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileNameInfo = QCoreApplication::applicationDirPath() + "/config/UnitWorkConditionsInfo.json";
|
||||
#endif
|
||||
|
||||
QString strURL = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitWorkConditionsInfo.json");
|
||||
// g_FtpClient->SetServerInfo(strURL);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameInfo,"UnitWorkConditionsInfo.json");
|
||||
g_FtpClient->uploadFile(strURL,fileNameInfo,"UnitWorkConditionsInfo.json");
|
||||
// Uploader u;
|
||||
// u.start(strURL,fileNameInfo,"UnitWorkConditionsInfo.json");
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameUnit = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileNameUnit = QCoreApplication::applicationDirPath() + "/config/UnitConfigurations.json";
|
||||
#endif
|
||||
|
||||
QString str2 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitConfigurations.json");
|
||||
// g_FtpClient->SetServerInfo(str2);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameUnit,"UnitConfigurations.json");
|
||||
g_FtpClient->uploadFile(str2,fileNameUnit,"UnitConfigurations.json");
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameUnit2 = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations2.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileNameUnit2 = QCoreApplication::applicationDirPath() + "/config/UnitConfigurations2.json";
|
||||
#endif
|
||||
|
||||
QString str22 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitConfigurations2.json");
|
||||
// g_FtpClient->SetServerInfo(str22);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameUnit2,"UnitConfigurations2.json");
|
||||
g_FtpClient->uploadFile(str22,fileNameUnit2,"UnitConfigurations2.json");
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameTri = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileNameTri = QCoreApplication::applicationDirPath() + "/config/TriggerSettings.json";
|
||||
#endif
|
||||
|
||||
QString str1 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("TriggerSettings.json");
|
||||
// g_FtpClient->SetServerInfo(str1);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameTri,"TriggerSettings.json");
|
||||
g_FtpClient->uploadFile(str1,fileNameTri,"TriggerSettings.json");
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileNameTri2 = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings2.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileNameTri2 = QCoreApplication::applicationDirPath() + "/config/TriggerSettings2.json";
|
||||
#endif
|
||||
|
||||
QString strTri2 = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("TriggerSettings2.json");
|
||||
// g_FtpClient->SetServerInfo(strTri2);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(fileNameTri2,"TriggerSettings2.json");
|
||||
g_FtpClient->uploadFile(strTri2,fileNameTri2,"TriggerSettings2.json");
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitBoardsInfo.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/UnitBoardsInfo.json";
|
||||
#endif
|
||||
QString str = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("UnitBoardsInfo.json");
|
||||
// g_FtpClient->SetServerInfo(str);
|
||||
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||||
// g_FtpClient->UpLoadFile(name,"UnitBoardsInfo.json");
|
||||
g_FtpClient->uploadFile(str,name,"UnitBoardsInfo.json");
|
||||
qApp->exit(0);
|
||||
QProcess::startDetached(qApp->applicationFilePath(), QStringList());
|
||||
}
|
||||
|
||||
@ -220,7 +311,7 @@ bool CImportConfig::copyDirectory(const QString &sourceDir, const QString &desti
|
||||
QString fileName = fileInfo.fileName();
|
||||
QString srcFilePath = srcDir.absoluteFilePath(fileName);
|
||||
QString destFilePath = destDir.absoluteFilePath(fileName);
|
||||
|
||||
//qDebug() << "srcFilePath" << srcFilePath << destFilePath <<endl;
|
||||
if (fileInfo.isDir()) {
|
||||
// 递归复制子文件夹
|
||||
if (!copyDirectory(srcFilePath, destFilePath)) {
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include <QSqlQuery>
|
||||
#include <QSqlError>
|
||||
#include "global.h"
|
||||
#include "ftpclient.h"
|
||||
namespace Ui {
|
||||
class CImportConfig;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "MqttClient.h"
|
||||
#include "Mqttclient.h"
|
||||
|
||||
MqttClient::MqttClient(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
@ -82,7 +82,13 @@ void CNTPServerConfig::on_pushButton_manual_clicked()
|
||||
void CNTPServerConfig::Init()
|
||||
{
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ServerConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/ServerConfig.json";
|
||||
#endif
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
qDebug() << "打开" << fileName ;
|
||||
@ -136,7 +142,13 @@ void CNTPServerConfig::slotReplyStatus(int result)
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(m_ServerObject);
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ServerConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/ServerConfig.json";
|
||||
#endif
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(jsonDoc.toJson());
|
||||
@ -164,7 +176,13 @@ void CNTPServerConfig::on_radioButton_switch_clicked()
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(m_ServerObject);
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ServerConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/ServerConfig.json";
|
||||
#endif
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(jsonDoc.toJson());
|
||||
|
||||
@ -29,7 +29,13 @@ COtherConfig::~COtherConfig()
|
||||
|
||||
void COtherConfig::LoadWorkingConditionConfig()
|
||||
{
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\TriggerConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/TriggerConfig.json";
|
||||
#endif
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
qDebug() << "打开" << fileName ;
|
||||
@ -56,7 +62,13 @@ void COtherConfig::LoadWorkingConditionConfig()
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef Q_OS_WIN32
|
||||
fileName = QCoreApplication::applicationDirPath() + "\\config\\ConfidenceDegree.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
fileName = QCoreApplication::applicationDirPath() + "/config/ConfidenceDegree.json";
|
||||
#endif
|
||||
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
qDebug() << "打开" << fileName ;
|
||||
@ -81,7 +93,13 @@ void COtherConfig::LoadWorkingConditionConfig()
|
||||
}
|
||||
|
||||
//读取ini
|
||||
|
||||
#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
|
||||
settingsread.setIniCodec(QTextCodec::codecForName("UTF8"));
|
||||
g_strVersion = settingsread.value("main/Version").toString();
|
||||
g_strProject = settingsread.value("main/Project").toString();
|
||||
@ -97,14 +115,20 @@ void COtherConfig::LoadWorkingConditionConfig()
|
||||
for (int i = 0; i < g_ChannelBaseInfo.size(); i++) {
|
||||
if(g_ChannelBaseInfo[i].channelType == "TACHOMETER"){
|
||||
ui->comboBox_ch->addItem(g_ChannelBaseInfo[i].channelName);
|
||||
}else{
|
||||
}else if(g_ChannelBaseInfo[i].channelType == "PROXIMETER"){
|
||||
ui->comboBox_ch2->addItem(g_ChannelBaseInfo[i].channelName);
|
||||
}
|
||||
}
|
||||
ui->comboBox_logic->addItem("与");
|
||||
ui->comboBox_logic->addItem("或");
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
fileName = QCoreApplication::applicationDirPath() + "\\config\\ZeroDrift.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
fileName = QCoreApplication::applicationDirPath() + "/config/ZeroDrift.json";
|
||||
#endif
|
||||
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
qDebug() << "打开" << fileName ;
|
||||
@ -168,7 +192,13 @@ void COtherConfig::on_pushButto_Trigger_clicked()
|
||||
return;
|
||||
}
|
||||
m_strTriggerTime = str;
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\TriggerConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/TriggerConfig.json";
|
||||
#endif
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
qDebug() << "打开" << fileName ;
|
||||
@ -196,7 +226,13 @@ void COtherConfig::on_pushButto_Trigger_clicked()
|
||||
}
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(jsonObject);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\TriggerConfig.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/TriggerConfig.json";
|
||||
#endif
|
||||
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(jsonDoc.toJson());
|
||||
file.close();
|
||||
@ -240,7 +276,13 @@ inline QString UTF82GBK(QByteArray &inStr)
|
||||
|
||||
void COtherConfig::on_pushButton_main_clicked()
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
QSettings *settings = new QSettings(QCoreApplication::applicationDirPath() + "\\config\\config.ini", QSettings::IniFormat);
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QSettings *settings = new QSettings(QCoreApplication::applicationDirPath() + "/config/config.ini", QSettings::IniFormat);
|
||||
#endif
|
||||
|
||||
settings->setIniCodec(QTextCodec::codecForName("UTF-8"));
|
||||
|
||||
settings->setValue("main/Version", ui->textEdit_version->toPlainText());
|
||||
@ -311,7 +353,13 @@ void COtherConfig::on_radioButton_open_clicked()
|
||||
ZeroDriftObj["ref_channel"] = ref_channelObj;
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(ZeroDriftObj);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ZeroDrift.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/ZeroDrift.json";
|
||||
#endif
|
||||
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(jsonDoc.toJson());
|
||||
@ -335,7 +383,13 @@ void COtherConfig::on_radioButton_open_clicked()
|
||||
|
||||
void COtherConfig::on_radioButton_close_clicked()
|
||||
{
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ZeroDrift.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ZeroDrift.json";
|
||||
#endif
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
qDebug() << "打开" << fileName ;
|
||||
@ -357,7 +411,12 @@ void COtherConfig::on_radioButton_close_clicked()
|
||||
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(ZeroDriftObj);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ZeroDrift.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ZeroDrift.json";
|
||||
#endif
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(jsonDoc.toJson());
|
||||
file.close();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "qmytableviewbtndelegate.h"
|
||||
#include "QMyTableViewBtnDelegate.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMouseEvent>
|
||||
|
||||
@ -22,7 +22,7 @@ CRealTimeAlarm::CRealTimeAlarm(QWidget *parent) :
|
||||
model->setHorizontalHeaderLabels(headerList);
|
||||
model->setColumnCount(headerList.size());
|
||||
ui->tableView->setModel(model);
|
||||
ui->tableView->setColumnWidth(2, 300);
|
||||
ui->tableView->setColumnWidth(2, 450);
|
||||
ui->tableView->setColumnWidth(3, 200);
|
||||
ui->tableView->setAlternatingRowColors(true);
|
||||
|
||||
@ -81,11 +81,37 @@ void CRealTimeAlarm::initTable()
|
||||
}else if(m_vecTriggerAlarmStatusInfo[i].triggerLevel == "2"){
|
||||
triggerLevel = "危险";
|
||||
}
|
||||
|
||||
QString strFeatureName = "";
|
||||
if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MinValues"))
|
||||
strFeatureName = "最小值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MaxValues"))
|
||||
strFeatureName = "最大值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DCValues"))
|
||||
strFeatureName = "偏置电压/Gap";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("RMSValues"))
|
||||
strFeatureName = "有效值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DiagnosisPk2Pk"))
|
||||
strFeatureName = "诊断峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratRMS"))
|
||||
strFeatureName = "有效值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratPk2Pk"))
|
||||
strFeatureName = "积分峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("SpeedProfileSpeed"))
|
||||
strFeatureName = "转速";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratPk2Pk/2"))
|
||||
strFeatureName = "峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DiagnosisPeak"))
|
||||
strFeatureName = "峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MonitorPk2Pk"))
|
||||
strFeatureName = "监测保护峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("InvertDanger") )
|
||||
strFeatureName = "反时限危险值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("InvertAlarm"))
|
||||
strFeatureName = "反时限警报值";
|
||||
if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("Over")){
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + "高于" + triggerLevel + "值";
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + strFeatureName+ "-" + "高于" + triggerLevel + "值";
|
||||
}else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("Under")){
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + "低于" + triggerLevel + "值";
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + strFeatureName+ "-" + "低于" + triggerLevel + "值";
|
||||
}
|
||||
strRowItem << i + 1 << triggerLevel << triggerEventName << TStr;
|
||||
|
||||
@ -499,7 +525,13 @@ void CRealTimeAlarm::Details(const QModelIndex &index)
|
||||
strFileName = strFileName.left(strFileName.size()-1);
|
||||
QStringList strList = strFileName.split("/");
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString strPath = QCoreApplication::applicationDirPath() + "\\dat\\" + strList[5];
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString strPath = QCoreApplication::applicationDirPath() + "/dat/" + strList[5];
|
||||
#endif
|
||||
|
||||
QFile file(strPath);
|
||||
customLogMessageHandler(QtDebugMsg, "RealTimeAlarm:" + strPath);
|
||||
g_LocalFile = strPath;
|
||||
|
||||
@ -241,10 +241,10 @@ void CSlowSpeedChannelSetting::on_comboBox_channelType_currentTextChanged(const
|
||||
}
|
||||
}
|
||||
|
||||
void CSlowSpeedChannelSetting::slotSetChannelData(QStringList& listChannelName)
|
||||
void CSlowSpeedChannelSetting::slotCopyChannelData(QStringList& listChannelID)
|
||||
{
|
||||
qDebug() << listChannelName << endl;
|
||||
for (int i = 0; i < listChannelName.size(); i++)
|
||||
qDebug() << listChannelID << endl;
|
||||
for (int i = 0; i < listChannelID.size(); i++)
|
||||
{
|
||||
QString strUpdateSql = QString(" set ChUnitCoeff = '%1' , ChUnitDot = %2,SensorICP = '%3', \
|
||||
SensorType = '%4',bearingClearance='%5',bearingStartPosition='%6',\
|
||||
@ -261,7 +261,7 @@ void CSlowSpeedChannelSetting::slotSetChannelData(QStringList& listChannelName)
|
||||
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' ,confidenceDegree=%58,sectionNum=%59 where channelName = '%60'").\
|
||||
defaultDisplay = '%57' ,confidenceDegree=%58,sectionNum=%59 where channelId = '%60'").\
|
||||
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).\
|
||||
@ -281,7 +281,7 @@ void CSlowSpeedChannelSetting::slotSetChannelData(QStringList& listChannelName)
|
||||
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(channelSetting.confidenceDegree).arg(channelSetting.sectionNum).arg(listChannelName[i]);
|
||||
arg(channelSetting.confidenceDegree).arg(channelSetting.sectionNum).arg(listChannelID[i]);
|
||||
|
||||
QString tableName = "t_ChannelSetting ";
|
||||
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
|
||||
@ -292,7 +292,7 @@ void CSlowSpeedChannelSetting::on_pushButton_copy_clicked()
|
||||
QString strWhere = QString(" sensorModuleNo = %1 and channelId <> '%2' ").arg(channelSetting.sensorModuleNo).arg(channelSetting.channelId);
|
||||
QVector<ChannelSetting> copyChannel = g_SqliteDB->GetDataMultiLine("t_ChannelSetting","*",strWhere);
|
||||
CopyChannelSetting *dialog = new CopyChannelSetting();
|
||||
connect(dialog, SIGNAL(sgSetChannelData(QStringList&)), this, SLOT(slotSetChannelData(QStringList&)));
|
||||
connect(dialog, SIGNAL(sgCopyChannelData(QStringList&)), this, SLOT(slotCopyChannelData(QStringList&)));
|
||||
dialog->copyChannel = copyChannel;
|
||||
dialog->setWindowModality(Qt::ApplicationModal);
|
||||
dialog->displayCopyChannel();
|
||||
|
||||
@ -29,7 +29,7 @@ private slots:
|
||||
|
||||
void on_pushButton_copy_clicked();
|
||||
public slots:
|
||||
void slotSetChannelData(QStringList&);
|
||||
void slotCopyChannelData(QStringList&);
|
||||
private:
|
||||
Ui::CSlowSpeedChannelSetting *ui;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include "NetMgr.h"
|
||||
#include <QNetworkRequest>
|
||||
#include "ftpclient.h"
|
||||
#include "CopyDatFile.h"
|
||||
//#include "CopyDatFile.h"
|
||||
#include "Backup.h"
|
||||
#include "ImportConfig.h"
|
||||
|
||||
@ -301,10 +301,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()
|
||||
|
||||
@ -112,16 +112,19 @@
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>在线状态:</string>
|
||||
</property>
|
||||
@ -148,13 +151,13 @@
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -181,13 +184,13 @@
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -214,13 +217,13 @@
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -247,13 +250,13 @@
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -280,13 +283,13 @@
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -348,13 +351,13 @@
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -381,13 +384,13 @@
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -414,13 +417,13 @@
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -447,13 +450,13 @@
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -480,13 +483,13 @@
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -513,13 +516,13 @@
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -610,13 +613,13 @@
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
|
||||
@ -275,7 +275,7 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
|
||||
model->setData(model->index(1,1,QModelIndex()),"峰值");
|
||||
model->setData(model->index(2,1,QModelIndex()),"速度峰值");
|
||||
model->setData(model->index(3,1,QModelIndex()),"速度有效值");
|
||||
model->setData(model->index(4,1,QModelIndex()),"反时限报警值");
|
||||
model->setData(model->index(4,1,QModelIndex()),"反时限警报值");
|
||||
model->setData(model->index(5,1,QModelIndex()),"反时限危险值");
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
|
||||
model->setData(model->index(1,1,QModelIndex()),"偏置电压/Gap");
|
||||
model->setData(model->index(2,1,QModelIndex()),"监测保护峰峰值");
|
||||
model->setData(model->index(3,1,QModelIndex()),"有效值");
|
||||
model->setData(model->index(4,1,QModelIndex()),"反时限报警值");
|
||||
model->setData(model->index(4,1,QModelIndex()),"反时限警报值");
|
||||
model->setData(model->index(5,1,QModelIndex()),"反时限危险值");
|
||||
}
|
||||
|
||||
@ -339,7 +339,7 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
|
||||
model->setData(model->index(1,1,QModelIndex()),"峰值");
|
||||
model->setData(model->index(2,1,QModelIndex()),"位移峰值");
|
||||
model->setData(model->index(3,1,QModelIndex()),"位移有效值");
|
||||
model->setData(model->index(4,1,QModelIndex()),"反时限报警值");
|
||||
model->setData(model->index(4,1,QModelIndex()),"反时限警报值");
|
||||
model->setData(model->index(5,1,QModelIndex()),"反时限危险值");
|
||||
}
|
||||
|
||||
@ -377,7 +377,7 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
|
||||
model->setData(model->index(0,1,QModelIndex()),"平均值");
|
||||
model->setData(model->index(1,1,QModelIndex()),"最小值");
|
||||
model->setData(model->index(2,1,QModelIndex()),"最大值");
|
||||
model->setData(model->index(3,1,QModelIndex()),"反时限报警值");
|
||||
model->setData(model->index(3,1,QModelIndex()),"反时限警报值");
|
||||
model->setData(model->index(4,1,QModelIndex()),"反时限危险值");
|
||||
}
|
||||
|
||||
@ -675,7 +675,7 @@ void CTriggerConfig::PushData()
|
||||
rowObj["triggerFeatureName"] = "MonitorPk2Pk";
|
||||
else if(triggerConfig[j].Characteristic == "反时限危险值")
|
||||
rowObj["triggerFeatureName"] = "InvertDanger";
|
||||
else if(triggerConfig[j].Characteristic == "反时限报警值")
|
||||
else if(triggerConfig[j].Characteristic == "反时限警报值")
|
||||
rowObj["triggerFeatureName"] = "InvertAlarm";
|
||||
|
||||
|
||||
@ -714,7 +714,13 @@ void CTriggerConfig::PushData()
|
||||
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setArray(m_channeltriggerArray);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/TriggerSettings.json";
|
||||
#endif
|
||||
|
||||
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
@ -759,7 +765,7 @@ void CTriggerConfig::PushData()
|
||||
rowObj["triggerFeatureName"] = "MonitorPk2Pk";
|
||||
else if(triggerConfig[j].Characteristic == "反时限危险值")
|
||||
rowObj["triggerFeatureName"] = "InvertDanger";
|
||||
else if(triggerConfig[j].Characteristic == "反时限报警值")
|
||||
else if(triggerConfig[j].Characteristic == "反时限警报值")
|
||||
rowObj["triggerFeatureName"] = "InvertAlarm";
|
||||
|
||||
|
||||
@ -800,7 +806,13 @@ void CTriggerConfig::PushData()
|
||||
|
||||
QJsonDocument jsonDoc2;
|
||||
jsonDoc2.setArray(m_channeltriggerArray2);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName2 = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings2.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName2 = QCoreApplication::applicationDirPath() + "/config/TriggerSettings2.json";
|
||||
#endif
|
||||
|
||||
|
||||
QFile file2(fileName2);
|
||||
file2.open(QIODevice::WriteOnly);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include <QWidget>
|
||||
#include <QTableView>
|
||||
#include "global.h"
|
||||
#include "HeaderView.h"
|
||||
#include "headerView.h"
|
||||
#include "TableHeaderView.h"
|
||||
#include <QStandardItemModel>
|
||||
#include <QComboBox>
|
||||
|
||||
@ -23,7 +23,13 @@ CUnitSetting::~CUnitSetting()
|
||||
|
||||
void CUnitSetting::initReadConfig()
|
||||
{
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitParameters.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/UnitParameters.json";
|
||||
#endif
|
||||
QFile loadFile(name);
|
||||
if(!loadFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
@ -298,7 +304,13 @@ void CUnitSetting::PushData()
|
||||
qDebug() << paramsObj << endl;
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(paramsObj);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\UnitParameters.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/UnitParameters.json";
|
||||
#endif
|
||||
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
|
||||
@ -41,8 +41,27 @@ CWaveDisPlay::CWaveDisPlay(QWidget *parent) :
|
||||
// container->setWindowFlag(Qt::FramelessWindowHint);
|
||||
// container->setWindowFlag(Qt::NoDropShadowWindowHint);
|
||||
|
||||
|
||||
InitWindows();
|
||||
|
||||
// ui->widget_wave->xAxis->setRange(0, 1);
|
||||
// ui->widget_wave->xAxis->setLabel("Fs(Hz)");
|
||||
// ui->widget_wave->yAxis->setLabel(m_ChannelUnit);
|
||||
// QVector<double> ticks;
|
||||
// QVector<QString> labels;
|
||||
// ticks << 1 << 2 << 3 << 4 << 5 << 6 << 7;
|
||||
// labels << "USA" << "Japan" << "Germany" << "France" << "UK" << "Italy" << "Canada";
|
||||
// QVector<double> fossilData;
|
||||
// fossilData << 0.86*10.5 << 0.83*5.5 << 0.84*5.5 << 0.52*5.8 << 0.89*5.2 << 0.90*4.2 << 0.67*11.2;
|
||||
// QCPBars *bars = new QCPBars(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
|
||||
// bars->setPen(QPen(QColor(31, 81, 136).lighter(130))); // 设置柱状图的边框颜色
|
||||
// bars->setBrush(QColor(31, 81, 136)); // 设置柱状图的画刷颜色
|
||||
// bars->setAntialiased(false);
|
||||
// bars->setWidth(0.02);
|
||||
// bars->setData(ticks, fossilData);
|
||||
// ui->widget_wave->xAxis->setRange(0, fossilData.size());
|
||||
// on_Btn_Scales_clicked();
|
||||
// ui->widget_wave->replot();
|
||||
|
||||
}
|
||||
|
||||
CWaveDisPlay::~CWaveDisPlay()
|
||||
@ -291,7 +310,12 @@ void CWaveDisPlay::ParseDataFsWave(QJsonObject & objContent)
|
||||
ui->widget_wave->yAxis->setLabel(m_ChannelUnit);
|
||||
|
||||
QVector<double> x,y;
|
||||
QCPGraph* graph = ui->widget_wave->addGraph(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
|
||||
//QCPGraph* graph = ui->widget_wave->addGraph(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
|
||||
QCPBars *bars = new QCPBars(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
|
||||
bars->setAntialiased(false);
|
||||
bars->setPen(QPen(QColor(31, 81, 136).lighter(130))); // 设置柱状图的边框颜色
|
||||
bars->setBrush(QColor(31, 81, 136)); // 设置柱状图的画刷颜色
|
||||
bars->setWidth(0.02);
|
||||
float gap = 0;
|
||||
for(int i = 0; i < m_ListWaveData.size();i++){
|
||||
x.push_back(gap);
|
||||
@ -303,7 +327,8 @@ void CWaveDisPlay::ParseDataFsWave(QJsonObject & objContent)
|
||||
}
|
||||
y[0] = 0;
|
||||
//qDebug() << "x" <<x.size() << "y" << y.size() << endl;
|
||||
graph->setData(x,y);
|
||||
//graph->setData(x,y);
|
||||
bars->setData(x, y);
|
||||
ui->widget_wave->xAxis->setRange(0, y.size());
|
||||
on_Btn_Scales_clicked();
|
||||
ui->widget_wave->replot();
|
||||
@ -444,6 +469,7 @@ void CWaveDisPlay::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
tracer->setVisible(true);
|
||||
tracerLabel->setVisible(true);
|
||||
if(ui->Btn_Timewave->isChecked()){
|
||||
//将像素点转换成qcustomplot中的坐标值,并通过setGraphKey将锚点值设为真实数据值。tracer->setGraphKey(xAxis->pixelToCoord(event->pos().x()));
|
||||
int graphCount = ui->widget_wave->graphCount();
|
||||
if(graphCount < 1)
|
||||
@ -465,7 +491,36 @@ void CWaveDisPlay::mouseMoveEvent(QMouseEvent *event)
|
||||
//显示tip框
|
||||
QCPDataContainer<QCPGraphData>::const_iterator coorPoint = ui->widget_wave->graph(0)->data().data()->findBegin(xValue, true);//true代表向左搜索
|
||||
}
|
||||
}else if(ui->Btn_Fswave->isChecked()){
|
||||
// 获取鼠标位置并转换为坐标
|
||||
double x = ui->widget_wave->xAxis->pixelToCoord(event->pos().x());
|
||||
|
||||
// 找到最近的条形图数据点
|
||||
double minDistance = std::numeric_limits<double>::max();
|
||||
double nearestBarKey = 0;
|
||||
double nearestBarValue = 0;
|
||||
|
||||
for (int i = 0; i < ui->widget_wave->plottableCount();i++)
|
||||
{
|
||||
if (QCPBars *bars = qobject_cast<QCPBars *>(ui->widget_wave->plottable(i)))
|
||||
{
|
||||
for (int i = 0; i < bars->data()->size(); ++i)
|
||||
{
|
||||
double barKey = bars->data()->at(i)->key;
|
||||
double distance = std::abs(barKey - x);
|
||||
if (distance < minDistance)
|
||||
{
|
||||
minDistance = distance;
|
||||
nearestBarKey = barKey;
|
||||
nearestBarValue = bars->data()->at(i)->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tracerLabel->setText(QString("X: %1 Y: %2").arg( QString::number(nearestBarKey)).arg(QString::number(nearestBarValue)));
|
||||
// 设置游标位置
|
||||
tracer->position->setCoords(nearestBarKey, nearestBarValue);
|
||||
}
|
||||
//重绘
|
||||
ui->widget_wave->replot();
|
||||
}
|
||||
|
||||
535
WokingConditionConfig - 副本.ui
Normal file
535
WokingConditionConfig - 副本.ui
Normal file
@ -0,0 +1,535 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CWokingConditionConfig</class>
|
||||
<widget class="QWidget" name="CWokingConditionConfig">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>845</width>
|
||||
<height>678</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font: 10pt "黑体";
|
||||
color: rgb(27, 30, 35);</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>393</width>
|
||||
<height>9</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>工况逻辑配置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>393</width>
|
||||
<height>9</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<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_5" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>工况名称:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_workContion"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>工况参数选择:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_unitType">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_6" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QTableView" name="tableView">
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::DragDrop</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_7" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton_save">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>130</y>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#pushButton_save { border-image: url(:/image/Btn/normal_Btn.png);
|
||||
color:#1f5188 }
|
||||
#pushButton_save:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_save:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_save:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_addUnit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>130</y>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#pushButton_addUnit { border-image: url(:/image/Btn/normal_Btn.png);
|
||||
color:#1f5188 }
|
||||
#pushButton_addUnit:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_addUnit:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_addUnit:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>添加</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_del">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<y>130</y>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#pushButton_del { border-image: url(:/image/Btn/normal_Btn.png);
|
||||
color:#1f5188 }
|
||||
#pushButton_del:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_del:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_del:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>删除</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>21</x>
|
||||
<y>51</y>
|
||||
<width>364</width>
|
||||
<height>52</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>描述:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit_Description">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>21</x>
|
||||
<y>10</y>
|
||||
<width>284</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>工况判定间隔时间:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_Interval"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_4" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_8" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="topMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Relay Logic Editor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="treeView">
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::DragDrop</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_9" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>125</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>27</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_and">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#pushButton_and { border-image: url(:/image/Btn/normal_Btn.png);
|
||||
color:#1f5188 }
|
||||
#pushButton_and:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_and:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_and:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>添加AND</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="QPushButton" name="pushButton_or">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#pushButton_or { border-image: url(:/image/Btn/normal_Btn.png);
|
||||
color:#1f5188 }
|
||||
#pushButton_or:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_or:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_or:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>添加OR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>27</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QStandardItemModel> //数据模型类
|
||||
#include "HeaderView.h"
|
||||
#include "headerView.h"
|
||||
#include "TableHeaderView.h"
|
||||
#include "global.h"
|
||||
#include "sqlitedb.h"
|
||||
|
||||
@ -96,7 +96,13 @@ QRadioButton* CWorkingcondition::add_radio_model(int flag)
|
||||
|
||||
void CWorkingcondition::LoadWorkingConditionConfig()
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\UnitWorkConditionsInfo.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/UnitWorkConditionsInfo.json";
|
||||
#endif
|
||||
|
||||
//QString fileName =QFileDialog::getOpenFileName(this,"打开文件",QDir::currentPath(), "*.json");
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
@ -659,7 +665,7 @@ void CWorkingcondition::on_pushButton_save_clicked()
|
||||
void CWorkingcondition::PushData()
|
||||
{
|
||||
|
||||
int flag = -1;
|
||||
int flag = -1,flag2 = -1;
|
||||
for (int i = 0; i < model->rowCount(); i++) {
|
||||
QComboBox *gg = (QComboBox*)(ui->tableView->indexWidget(model->index(i,2)));
|
||||
QRadioButton *radio = (QRadioButton*)(ui->tableView->indexWidget(model->index(i,3)));
|
||||
@ -671,6 +677,7 @@ void CWorkingcondition::PushData()
|
||||
|
||||
if(strComBox == "是"){
|
||||
enable = 1;
|
||||
flag2 = 1;
|
||||
}else if( strComBox == "否"){
|
||||
enable = 0;
|
||||
|
||||
@ -693,6 +700,10 @@ void CWorkingcondition::PushData()
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "请选择起始工况!");
|
||||
return;
|
||||
}
|
||||
if(flag2 == -1){
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "请使能一个工况!");
|
||||
return;
|
||||
}
|
||||
|
||||
QVector<WorkCondition_t> WorkCondition = g_SqliteDB->GetWorkCondition("t_WorkCondition","");
|
||||
QJsonArray arrayWorkCondition;
|
||||
@ -847,7 +858,13 @@ void CWorkingcondition::PushData()
|
||||
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(WorkConditionsInfoObj);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\UnitWorkConditionsInfo.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/UnitWorkConditionsInfo.json";
|
||||
#endif
|
||||
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
|
||||
@ -35,7 +35,6 @@ 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*)));
|
||||
//connect(m_ftpManager, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(CheckReplyStatus(QNetworkReply::NetworkError)));
|
||||
@ -72,6 +71,8 @@ void FtpClient::finished(QNetworkReply* reply)
|
||||
|
||||
QNetworkReply::NetworkError error = reply->error();
|
||||
qDebug() << "finished" << error <<endl;
|
||||
delete m_ftpUrl;
|
||||
m_ftpUrl = NULL;
|
||||
if(m_fileName != ""){
|
||||
//QMessageBox::information(this, QStringLiteral("提示"), QStringLiteral("保存成功!"));
|
||||
QJsonObject allObj,cmdBody,temp;
|
||||
@ -199,3 +200,61 @@ void FtpClient::downloadProgress(qint64 byteSend, qint64 byteTotal)
|
||||
qDebug() << byteSend << byteTotal << endl;
|
||||
emit sigDownloadProcess(byteSend,byteTotal);
|
||||
}
|
||||
|
||||
void FtpClient::uploadFile(const QString fileUrl, const QString filePath,const QString fileName,int type)
|
||||
{
|
||||
QNetworkAccessManager manager;
|
||||
//QUrl url;
|
||||
QUrl url(fileUrl);
|
||||
/* 设置通讯协议 */
|
||||
url.setScheme("ftp");
|
||||
/* 设置用户名 */
|
||||
url.setUserName("root");
|
||||
/* 设置密码 */
|
||||
url.setPassword("@#cidw!@123456");
|
||||
|
||||
/* 设置端口号,一般为21 */
|
||||
url.setPort(21);
|
||||
|
||||
/* 装载本地文件 */
|
||||
QFile file(filePath);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
/* 读取本地文件数据 */
|
||||
QByteArray data = file.readAll();
|
||||
file.close();
|
||||
|
||||
QNetworkRequest request(url);
|
||||
/* 上传数据,上传成功后会在远端创建文件 */
|
||||
QNetworkReply* reply = manager.put(request, data);
|
||||
|
||||
QEventLoop eventLoop;
|
||||
QObject::connect(reply, SIGNAL(finished()), &eventLoop, SLOT(quit()));
|
||||
/* 进入等待,但事件循环依然进行 */
|
||||
eventLoop.exec();
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
qDebug() << "Error: " << reply->errorString();
|
||||
}
|
||||
|
||||
QJsonObject allObj,cmdBody,temp;
|
||||
QJsonArray tempArray;
|
||||
if(fileName.contains(".json")){
|
||||
allObj.insert("cmd", "90");
|
||||
temp["fileName"] = fileName;
|
||||
if(type >= 0)
|
||||
temp["content"] = type;
|
||||
tempArray.append(temp);
|
||||
allObj.insert("cmdBody",tempArray);
|
||||
}else{
|
||||
allObj.insert("cmd", "46");
|
||||
allObj.insert("type", type);
|
||||
temp["fileName"] = fileName;
|
||||
allObj.insert("cmdBody",temp);
|
||||
}
|
||||
qDebug() << allObj << endl;
|
||||
QNetworkRequest req;
|
||||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||||
|
||||
req.setUrl(sUrl);
|
||||
g_NetMgr->PostJson(req,allObj);
|
||||
}
|
||||
|
||||
13
ftpclient.h
13
ftpclient.h
@ -2,13 +2,13 @@
|
||||
#define FTPCLIENT_H
|
||||
|
||||
#include <QtWidgets/QWidget>
|
||||
#include <QtCore\QFile>
|
||||
#include <QtNetwork\QNetworkRequest>
|
||||
#include <QtNetwork\QNetworkReply>
|
||||
#include <QtNetwork\QNetworkAccessManager>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtNetwork/QNetworkRequest>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <QtNetwork/QNetworkAccessManager>
|
||||
#include <QUrl>
|
||||
#include <QMessageBox>
|
||||
#include <QtCore\QFileInfo>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QProgressDialog>
|
||||
|
||||
class FtpClient : public QWidget
|
||||
@ -28,7 +28,7 @@ public:
|
||||
//下载文件
|
||||
void DownLoad(const QString fileSource, const QString fileDest);
|
||||
|
||||
|
||||
void uploadFile(const QString fileUrl, const QString filePath,const QString fileName,int type = -1);
|
||||
signals:
|
||||
void sigReplyStatus(int result);
|
||||
void sigDownloadProcess(qint64 byteSend, qint64 byteTotal);
|
||||
@ -50,6 +50,7 @@ private:
|
||||
QNetworkReply* downloadReply;
|
||||
};
|
||||
|
||||
|
||||
extern FtpClient *g_FtpClient;
|
||||
|
||||
#endif // FTPCLIENT_H
|
||||
|
||||
2
global.h
2
global.h
@ -17,6 +17,8 @@ extern QString g_strVersion ;
|
||||
extern QString g_strProject ;
|
||||
extern QString g_strFre ;
|
||||
|
||||
//#define NO_FILTER
|
||||
|
||||
typedef struct ChannelSetting{
|
||||
double ChUnitCoeff;
|
||||
int ChUnitDot;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "HeaderView.h"
|
||||
#include "headerView.h"
|
||||
#include <QPainter>
|
||||
#include <QCheckBox>
|
||||
#include <QDebug>
|
||||
|
||||
161
include/ftp/qftp.h
Normal file
161
include/ftp/qftp.h
Normal file
@ -0,0 +1,161 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtNetwork module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QFTP_H
|
||||
#define QFTP_H
|
||||
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qobject.h>
|
||||
#include <qurlinfo.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QFtpPrivate;
|
||||
|
||||
class QFtp : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QFtp(QObject *parent = 0);
|
||||
virtual ~QFtp();
|
||||
|
||||
enum State {
|
||||
Unconnected,
|
||||
HostLookup,
|
||||
Connecting,
|
||||
Connected,
|
||||
LoggedIn,
|
||||
Closing
|
||||
};
|
||||
enum Error {
|
||||
NoError,
|
||||
UnknownError,
|
||||
HostNotFound,
|
||||
ConnectionRefused,
|
||||
NotConnected
|
||||
};
|
||||
enum Command {
|
||||
None,
|
||||
SetTransferMode,
|
||||
SetProxy,
|
||||
ConnectToHost,
|
||||
Login,
|
||||
Close,
|
||||
List,
|
||||
Cd,
|
||||
Get,
|
||||
Put,
|
||||
Remove,
|
||||
Mkdir,
|
||||
Rmdir,
|
||||
Rename,
|
||||
RawCommand
|
||||
};
|
||||
enum TransferMode {
|
||||
Active,
|
||||
Passive
|
||||
};
|
||||
enum TransferType {
|
||||
Binary,
|
||||
Ascii
|
||||
};
|
||||
|
||||
int setProxy(const QString &host, quint16 port);
|
||||
int connectToHost(const QString &host, quint16 port=21);
|
||||
int login(const QString &user = QString(), const QString &password = QString());
|
||||
int close();
|
||||
int setTransferMode(TransferMode mode);
|
||||
int list(const QString &dir = QString());
|
||||
int cd(const QString &dir);
|
||||
int get(const QString &file, QIODevice *dev=0, TransferType type = Binary);
|
||||
int put(const QByteArray &data, const QString &file, TransferType type = Binary);
|
||||
int put(QIODevice *dev, const QString &file, TransferType type = Binary);
|
||||
int remove(const QString &file);
|
||||
int mkdir(const QString &dir);
|
||||
int rmdir(const QString &dir);
|
||||
int rename(const QString &oldname, const QString &newname);
|
||||
|
||||
int rawCommand(const QString &command);
|
||||
|
||||
qint64 bytesAvailable() const;
|
||||
qint64 read(char *data, qint64 maxlen);
|
||||
QByteArray readAll();
|
||||
|
||||
int currentId() const;
|
||||
QIODevice* currentDevice() const;
|
||||
Command currentCommand() const;
|
||||
bool hasPendingCommands() const;
|
||||
void clearPendingCommands();
|
||||
|
||||
State state() const;
|
||||
|
||||
Error error() const;
|
||||
QString errorString() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void abort();
|
||||
|
||||
Q_SIGNALS:
|
||||
void stateChanged(int);
|
||||
void listInfo(const QUrlInfo&);
|
||||
void readyRead();
|
||||
void dataTransferProgress(qint64, qint64);
|
||||
void rawCommandReply(int, const QString&);
|
||||
|
||||
void commandStarted(int);
|
||||
void commandFinished(int, bool);
|
||||
void done(bool);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QFtp)
|
||||
QScopedPointer<QFtpPrivate> d;
|
||||
|
||||
Q_PRIVATE_SLOT(d, void _q_startNextCommand())
|
||||
Q_PRIVATE_SLOT(d, void _q_piFinished(const QString&))
|
||||
Q_PRIVATE_SLOT(d, void _q_piError(int, const QString&))
|
||||
Q_PRIVATE_SLOT(d, void _q_piConnectState(int))
|
||||
Q_PRIVATE_SLOT(d, void _q_piFtpReply(int, const QString&))
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QFTP_H
|
||||
121
include/ftp/qurlinfo.h
Normal file
121
include/ftp/qurlinfo.h
Normal file
@ -0,0 +1,121 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtNetwork module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QURLINFO_H
|
||||
#define QURLINFO_H
|
||||
|
||||
#include <QtCore/qdatetime.h>
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qiodevice.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QUrl;
|
||||
class QUrlInfoPrivate;
|
||||
|
||||
class QUrlInfo
|
||||
{
|
||||
public:
|
||||
enum PermissionSpec {
|
||||
ReadOwner = 00400, WriteOwner = 00200, ExeOwner = 00100,
|
||||
ReadGroup = 00040, WriteGroup = 00020, ExeGroup = 00010,
|
||||
ReadOther = 00004, WriteOther = 00002, ExeOther = 00001 };
|
||||
|
||||
QUrlInfo();
|
||||
QUrlInfo(const QUrlInfo &ui);
|
||||
QUrlInfo(const QString &name, int permissions, const QString &owner,
|
||||
const QString &group, qint64 size, const QDateTime &lastModified,
|
||||
const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink,
|
||||
bool isWritable, bool isReadable, bool isExecutable);
|
||||
QUrlInfo(const QUrl &url, int permissions, const QString &owner,
|
||||
const QString &group, qint64 size, const QDateTime &lastModified,
|
||||
const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink,
|
||||
bool isWritable, bool isReadable, bool isExecutable);
|
||||
QUrlInfo &operator=(const QUrlInfo &ui);
|
||||
virtual ~QUrlInfo();
|
||||
|
||||
virtual void setName(const QString &name);
|
||||
virtual void setDir(bool b);
|
||||
virtual void setFile(bool b);
|
||||
virtual void setSymLink(bool b);
|
||||
virtual void setOwner(const QString &s);
|
||||
virtual void setGroup(const QString &s);
|
||||
virtual void setSize(qint64 size);
|
||||
virtual void setWritable(bool b);
|
||||
virtual void setReadable(bool b);
|
||||
virtual void setPermissions(int p);
|
||||
virtual void setLastModified(const QDateTime &dt);
|
||||
void setLastRead(const QDateTime &dt);
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
QString name() const;
|
||||
int permissions() const;
|
||||
QString owner() const;
|
||||
QString group() const;
|
||||
qint64 size() const;
|
||||
QDateTime lastModified() const;
|
||||
QDateTime lastRead() const;
|
||||
bool isDir() const;
|
||||
bool isFile() const;
|
||||
bool isSymLink() const;
|
||||
bool isWritable() const;
|
||||
bool isReadable() const;
|
||||
bool isExecutable() const;
|
||||
|
||||
static bool greaterThan(const QUrlInfo &i1, const QUrlInfo &i2,
|
||||
int sortBy);
|
||||
static bool lessThan(const QUrlInfo &i1, const QUrlInfo &i2,
|
||||
int sortBy);
|
||||
static bool equal(const QUrlInfo &i1, const QUrlInfo &i2,
|
||||
int sortBy);
|
||||
|
||||
bool operator==(const QUrlInfo &i) const;
|
||||
inline bool operator!=(const QUrlInfo &i) const
|
||||
{ return !operator==(i); }
|
||||
|
||||
private:
|
||||
QUrlInfoPrivate *d;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QURLINFO_H
|
||||
17
lib/fftw/cmake/fftw3/FFTW3Config.cmake
Normal file
17
lib/fftw/cmake/fftw3/FFTW3Config.cmake
Normal file
@ -0,0 +1,17 @@
|
||||
# defined since 2.8.3
|
||||
if (CMAKE_VERSION VERSION_LESS 2.8.3)
|
||||
get_filename_component (CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
endif ()
|
||||
|
||||
# Allows loading FFTW3 settings from another project
|
||||
set (FFTW3_CONFIG_FILE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
|
||||
set (FFTW3_LIBRARIES fftw3)
|
||||
set (FFTW3_LIBRARY_DIRS /opt/Tools/fftw-3.3.8/install/lib)
|
||||
set (FFTW3_INCLUDE_DIRS /opt/Tools/fftw-3.3.8/install/include)
|
||||
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/FFTW3LibraryDepends.cmake")
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS 2.8.3)
|
||||
set (CMAKE_CURRENT_LIST_DIR)
|
||||
endif ()
|
||||
12
lib/fftw/cmake/fftw3/FFTW3ConfigVersion.cmake
Normal file
12
lib/fftw/cmake/fftw3/FFTW3ConfigVersion.cmake
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
set (PACKAGE_VERSION "3.3.8")
|
||||
|
||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||
if ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
set (PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else ()
|
||||
set (PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
||||
set (PACKAGE_VERSION_EXACT TRUE)
|
||||
endif ()
|
||||
endif ()
|
||||
BIN
lib/fftw/libfftw3.so.3
Normal file
BIN
lib/fftw/libfftw3.so.3
Normal file
Binary file not shown.
BIN
lib/fftw/libfftw3.so.3.5.8
Normal file
BIN
lib/fftw/libfftw3.so.3.5.8
Normal file
Binary file not shown.
11
lib/fftw/pkgconfig/fftw3.pc
Normal file
11
lib/fftw/pkgconfig/fftw3.pc
Normal file
@ -0,0 +1,11 @@
|
||||
prefix=/opt/Tools/fftw-3.3.8/install
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: FFTW
|
||||
Description: fast Fourier transform library
|
||||
Version: 3.3.8
|
||||
Libs: -L${libdir} -lfftw3
|
||||
Libs.private: -lm
|
||||
Cflags: -I${includedir}
|
||||
7
lib/ftp/cmake/Qt5Ftp/ExtraSourceIncludes.cmake
Normal file
7
lib/ftp/cmake/Qt5Ftp/ExtraSourceIncludes.cmake
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
list(APPEND _Qt5Ftp_OWN_INCLUDE_DIRS
|
||||
"/opt/Tools/qtftp-master/include" "/opt/Tools/qtftp-master/include/QtFtp"
|
||||
)
|
||||
set(Qt5Ftp_PRIVATE_INCLUDE_DIRS
|
||||
"/opt/Tools/qtftp-master/include/QtFtp/5.0.0" "/opt/Tools/qtftp-master/include/QtFtp/5.0.0/QtFtp"
|
||||
)
|
||||
176
lib/ftp/cmake/Qt5Ftp/Qt5FtpConfig.cmake
Normal file
176
lib/ftp/cmake/Qt5Ftp/Qt5FtpConfig.cmake
Normal file
@ -0,0 +1,176 @@
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS 3.1.0)
|
||||
message(FATAL_ERROR "Qt 5 Ftp module requires at least CMake version 3.1.0")
|
||||
endif()
|
||||
|
||||
get_filename_component(_qt5Ftp_install_prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
|
||||
|
||||
# For backwards compatibility only. Use Qt5Ftp_VERSION instead.
|
||||
set(Qt5Ftp_VERSION_STRING 5.0.0)
|
||||
|
||||
set(Qt5Ftp_LIBRARIES Qt5::Ftp)
|
||||
|
||||
macro(_qt5_Ftp_check_file_exists file)
|
||||
if(NOT EXISTS "${file}" )
|
||||
message(FATAL_ERROR "The imported target \"Qt5::Ftp\" references the file
|
||||
\"${file}\"
|
||||
but this file does not exist. Possible reasons include:
|
||||
* The file was deleted, renamed, or moved to another location.
|
||||
* An install or uninstall procedure did not complete successfully.
|
||||
* The installation package was faulty and contained
|
||||
\"${CMAKE_CURRENT_LIST_FILE}\"
|
||||
but not all the files it references.
|
||||
")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(_populate_Ftp_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
|
||||
set_property(TARGET Qt5::Ftp APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
|
||||
|
||||
set(imported_location "${_qt5Ftp_install_prefix}/lib/${LIB_LOCATION}")
|
||||
_qt5_Ftp_check_file_exists(${imported_location})
|
||||
set_target_properties(Qt5::Ftp PROPERTIES
|
||||
"INTERFACE_LINK_LIBRARIES" "${_Qt5Ftp_LIB_DEPENDENCIES}"
|
||||
"IMPORTED_LOCATION_${Configuration}" ${imported_location}
|
||||
"IMPORTED_SONAME_${Configuration}" "libQt5Ftp.so.5"
|
||||
# For backward compatibility with CMake < 2.8.12
|
||||
"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}" "${_Qt5Ftp_LIB_DEPENDENCIES}"
|
||||
)
|
||||
|
||||
endmacro()
|
||||
|
||||
if (NOT TARGET Qt5::Ftp)
|
||||
|
||||
set(_Qt5Ftp_OWN_INCLUDE_DIRS "${_qt5Ftp_install_prefix}/include/" "${_qt5Ftp_install_prefix}/include/QtFtp")
|
||||
set(Qt5Ftp_PRIVATE_INCLUDE_DIRS "")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake" OPTIONAL)
|
||||
|
||||
foreach(_dir ${_Qt5Ftp_OWN_INCLUDE_DIRS})
|
||||
_qt5_Ftp_check_file_exists(${_dir})
|
||||
endforeach()
|
||||
|
||||
# Only check existence of private includes if the Private component is
|
||||
# specified.
|
||||
list(FIND Qt5Ftp_FIND_COMPONENTS Private _check_private)
|
||||
if (NOT _check_private STREQUAL -1)
|
||||
foreach(_dir ${Qt5Ftp_PRIVATE_INCLUDE_DIRS})
|
||||
_qt5_Ftp_check_file_exists(${_dir})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(Qt5Ftp_INCLUDE_DIRS ${_Qt5Ftp_OWN_INCLUDE_DIRS})
|
||||
|
||||
set(Qt5Ftp_DEFINITIONS -DQT_FTP_LIB)
|
||||
set(Qt5Ftp_COMPILE_DEFINITIONS QT_FTP_LIB)
|
||||
set(_Qt5Ftp_MODULE_DEPENDENCIES "Network;Core")
|
||||
|
||||
|
||||
set(Qt5Ftp_OWN_PRIVATE_INCLUDE_DIRS ${Qt5Ftp_PRIVATE_INCLUDE_DIRS})
|
||||
|
||||
set(_Qt5Ftp_FIND_DEPENDENCIES_REQUIRED)
|
||||
if (Qt5Ftp_FIND_REQUIRED)
|
||||
set(_Qt5Ftp_FIND_DEPENDENCIES_REQUIRED REQUIRED)
|
||||
endif()
|
||||
set(_Qt5Ftp_FIND_DEPENDENCIES_QUIET)
|
||||
if (Qt5Ftp_FIND_QUIETLY)
|
||||
set(_Qt5Ftp_DEPENDENCIES_FIND_QUIET QUIET)
|
||||
endif()
|
||||
set(_Qt5Ftp_FIND_VERSION_EXACT)
|
||||
if (Qt5Ftp_FIND_VERSION_EXACT)
|
||||
set(_Qt5Ftp_FIND_VERSION_EXACT EXACT)
|
||||
endif()
|
||||
|
||||
set(Qt5Ftp_EXECUTABLE_COMPILE_FLAGS "")
|
||||
|
||||
foreach(_module_dep ${_Qt5Ftp_MODULE_DEPENDENCIES})
|
||||
if (NOT Qt5${_module_dep}_FOUND)
|
||||
find_package(Qt5${_module_dep}
|
||||
5.0.0 ${_Qt5Ftp_FIND_VERSION_EXACT}
|
||||
${_Qt5Ftp_DEPENDENCIES_FIND_QUIET}
|
||||
${_Qt5Ftp_FIND_DEPENDENCIES_REQUIRED}
|
||||
PATHS "${CMAKE_CURRENT_LIST_DIR}/.." NO_DEFAULT_PATH
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT Qt5${_module_dep}_FOUND)
|
||||
set(Qt5Ftp_FOUND False)
|
||||
return()
|
||||
endif()
|
||||
|
||||
list(APPEND Qt5Ftp_INCLUDE_DIRS "${Qt5${_module_dep}_INCLUDE_DIRS}")
|
||||
list(APPEND Qt5Ftp_PRIVATE_INCLUDE_DIRS "${Qt5${_module_dep}_PRIVATE_INCLUDE_DIRS}")
|
||||
list(APPEND Qt5Ftp_DEFINITIONS ${Qt5${_module_dep}_DEFINITIONS})
|
||||
list(APPEND Qt5Ftp_COMPILE_DEFINITIONS ${Qt5${_module_dep}_COMPILE_DEFINITIONS})
|
||||
list(APPEND Qt5Ftp_EXECUTABLE_COMPILE_FLAGS ${Qt5${_module_dep}_EXECUTABLE_COMPILE_FLAGS})
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES Qt5Ftp_INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES Qt5Ftp_PRIVATE_INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES Qt5Ftp_DEFINITIONS)
|
||||
list(REMOVE_DUPLICATES Qt5Ftp_COMPILE_DEFINITIONS)
|
||||
list(REMOVE_DUPLICATES Qt5Ftp_EXECUTABLE_COMPILE_FLAGS)
|
||||
|
||||
set(_Qt5Ftp_LIB_DEPENDENCIES "Qt5::Network;Qt5::Core")
|
||||
|
||||
|
||||
add_library(Qt5::Ftp SHARED IMPORTED)
|
||||
|
||||
set_property(TARGET Qt5::Ftp PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${_Qt5Ftp_OWN_INCLUDE_DIRS})
|
||||
set_property(TARGET Qt5::Ftp PROPERTY
|
||||
INTERFACE_COMPILE_DEFINITIONS QT_FTP_LIB)
|
||||
|
||||
set_property(TARGET Qt5::Ftp PROPERTY INTERFACE_QT_ENABLED_FEATURES )
|
||||
set_property(TARGET Qt5::Ftp PROPERTY INTERFACE_QT_DISABLED_FEATURES )
|
||||
|
||||
set(_Qt5Ftp_PRIVATE_DIRS_EXIST TRUE)
|
||||
foreach (_Qt5Ftp_PRIVATE_DIR ${Qt5Ftp_OWN_PRIVATE_INCLUDE_DIRS})
|
||||
if (NOT EXISTS ${_Qt5Ftp_PRIVATE_DIR})
|
||||
set(_Qt5Ftp_PRIVATE_DIRS_EXIST FALSE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (_Qt5Ftp_PRIVATE_DIRS_EXIST)
|
||||
add_library(Qt5::FtpPrivate INTERFACE IMPORTED)
|
||||
set_property(TARGET Qt5::FtpPrivate PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${Qt5Ftp_OWN_PRIVATE_INCLUDE_DIRS}
|
||||
)
|
||||
set(_Qt5Ftp_PRIVATEDEPS)
|
||||
foreach(dep ${_Qt5Ftp_LIB_DEPENDENCIES})
|
||||
if (TARGET ${dep}Private)
|
||||
list(APPEND _Qt5Ftp_PRIVATEDEPS ${dep}Private)
|
||||
endif()
|
||||
endforeach()
|
||||
set_property(TARGET Qt5::FtpPrivate PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES Qt5::Ftp ${_Qt5Ftp_PRIVATEDEPS}
|
||||
)
|
||||
endif()
|
||||
|
||||
_populate_Ftp_target_properties(RELEASE "libQt5Ftp.so.5.0.0" "" )
|
||||
|
||||
|
||||
|
||||
|
||||
file(GLOB pluginTargets "${CMAKE_CURRENT_LIST_DIR}/Qt5Ftp_*Plugin.cmake")
|
||||
|
||||
macro(_populate_Ftp_plugin_properties Plugin Configuration PLUGIN_LOCATION)
|
||||
set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
|
||||
|
||||
set(imported_location "${_qt5Ftp_install_prefix}/plugins/${PLUGIN_LOCATION}")
|
||||
_qt5_Ftp_check_file_exists(${imported_location})
|
||||
set_target_properties(Qt5::${Plugin} PROPERTIES
|
||||
"IMPORTED_LOCATION_${Configuration}" ${imported_location}
|
||||
)
|
||||
endmacro()
|
||||
|
||||
if (pluginTargets)
|
||||
foreach(pluginTarget ${pluginTargets})
|
||||
include(${pluginTarget})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
_qt5_Ftp_check_file_exists("${CMAKE_CURRENT_LIST_DIR}/Qt5FtpConfigVersion.cmake")
|
||||
|
||||
endif()
|
||||
11
lib/ftp/cmake/Qt5Ftp/Qt5FtpConfigVersion.cmake
Normal file
11
lib/ftp/cmake/Qt5Ftp/Qt5FtpConfigVersion.cmake
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
set(PACKAGE_VERSION 5.0.0)
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
6
lib/ftp/libQt5Ftp.prl
Normal file
6
lib/ftp/libQt5Ftp.prl
Normal file
@ -0,0 +1,6 @@
|
||||
QMAKE_PRL_BUILD_DIR = /opt/Tools/build-qtftp-Desktop_Qt_5_12_2_GCC_64bit-Release/src/qftp
|
||||
QMAKE_PRO_INPUT = qftp.pro
|
||||
QMAKE_PRL_TARGET = libQt5Ftp.so.5.0.0
|
||||
QMAKE_PRL_CONFIG = lex yacc depend_includepath testcase_targets import_plugins import_qpa_plugin qt_build_extra file_copies qmake_use qt warn_on release link_prl incremental shared release linux unix posix gcc sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples enable_new_dtags f16c force_debug_info largefile rdrnd shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl prepare_docs qt_docs_targets no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions explicitlib qtquickcompiler shared relative_qt_rpath qmake_cache target_qt c++11 strict_c++ c++14 c99 c11 hide_symbols bsymbolic_functions separate_debug_info split_incpath qt_install_headers need_fwd_pri qt_install_module create_cmake compiler_supports_fpmath create_pc create_libtool have_target dll debug_info thread moc resources
|
||||
QMAKE_PRL_VERSION = 5.0.0
|
||||
QMAKE_PRL_LIBS = -L/opt/Qt5.12.2/5.12.2/gcc_64/lib -lQt5Network -lQt5Core -lpthread
|
||||
BIN
lib/ftp/libQt5Ftp.so.5
Normal file
BIN
lib/ftp/libQt5Ftp.so.5
Normal file
Binary file not shown.
BIN
lib/ftp/libQt5Ftp.so.5.0
Normal file
BIN
lib/ftp/libQt5Ftp.so.5.0
Normal file
Binary file not shown.
BIN
lib/ftp/libQt5Ftp.so.5.0.0
Normal file
BIN
lib/ftp/libQt5Ftp.so.5.0.0
Normal file
Binary file not shown.
BIN
lib/ftp/libQt5Ftp.so.5.0.0.debug
Normal file
BIN
lib/ftp/libQt5Ftp.so.5.0.0.debug
Normal file
Binary file not shown.
13
lib/ftp/pkgconfig/Qt5Ftp.pc
Normal file
13
lib/ftp/pkgconfig/Qt5Ftp.pc
Normal file
@ -0,0 +1,13 @@
|
||||
prefix=/opt/Qt5.12.2/5.12.2/gcc_64
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
|
||||
Name: Qt5 Ftp
|
||||
Description: Qt Ftp module
|
||||
Version: 5.0.0
|
||||
Libs: -L${libdir} -lQt5Ftp
|
||||
Cflags: -DQT_FTP_LIB -I${includedir}/QtFtp -I${includedir}
|
||||
Requires: Qt5Core Qt5Network
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
list(APPEND _Qt5Qmqtt_OWN_INCLUDE_DIRS
|
||||
"E:/ThunderDownload/qmqtt-master/include" "E:/ThunderDownload/qmqtt-master/include/QtQmqtt"
|
||||
"/opt/Tools/qmqtt-emqx/qmqtt-master/include" "/opt/Tools/qmqtt-emqx/qmqtt-master/include/QtQmqtt"
|
||||
)
|
||||
set(Qt5Qmqtt_PRIVATE_INCLUDE_DIRS
|
||||
"E:/ThunderDownload/qmqtt-master/include/QtQmqtt/1.0.2" "E:/ThunderDownload/qmqtt-master/include/QtQmqtt/1.0.2/QtQmqtt"
|
||||
"/opt/Tools/qmqtt-emqx/qmqtt-master/include/QtQmqtt/1.0.3" "/opt/Tools/qmqtt-emqx/qmqtt-master/include/QtQmqtt/1.0.3/QtQmqtt"
|
||||
)
|
||||
|
||||
@ -6,7 +6,7 @@ endif()
|
||||
get_filename_component(_qt5Qmqtt_install_prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
|
||||
|
||||
# For backwards compatibility only. Use Qt5Qmqtt_VERSION instead.
|
||||
set(Qt5Qmqtt_VERSION_STRING 1.0.2)
|
||||
set(Qt5Qmqtt_VERSION_STRING 1.0.3)
|
||||
|
||||
set(Qt5Qmqtt_LIBRARIES Qt5::Qmqtt)
|
||||
|
||||
@ -27,22 +27,16 @@ endmacro()
|
||||
macro(_populate_Qmqtt_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
|
||||
set_property(TARGET Qt5::Qmqtt APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
|
||||
|
||||
set(imported_location "${_qt5Qmqtt_install_prefix}/bin/${LIB_LOCATION}")
|
||||
set(imported_location "${_qt5Qmqtt_install_prefix}/lib/${LIB_LOCATION}")
|
||||
_qt5_Qmqtt_check_file_exists(${imported_location})
|
||||
set_target_properties(Qt5::Qmqtt PROPERTIES
|
||||
"INTERFACE_LINK_LIBRARIES" "${_Qt5Qmqtt_LIB_DEPENDENCIES}"
|
||||
"IMPORTED_LOCATION_${Configuration}" ${imported_location}
|
||||
"IMPORTED_SONAME_${Configuration}" "libQt5Qmqtt.so.1"
|
||||
# For backward compatibility with CMake < 2.8.12
|
||||
"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}" "${_Qt5Qmqtt_LIB_DEPENDENCIES}"
|
||||
)
|
||||
|
||||
set(imported_implib "${_qt5Qmqtt_install_prefix}/lib/${IMPLIB_LOCATION}")
|
||||
_qt5_Qmqtt_check_file_exists(${imported_implib})
|
||||
if(NOT "${IMPLIB_LOCATION}" STREQUAL "")
|
||||
set_target_properties(Qt5::Qmqtt PROPERTIES
|
||||
"IMPORTED_IMPLIB_${Configuration}" ${imported_implib}
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if (NOT TARGET Qt5::Qmqtt)
|
||||
@ -91,7 +85,7 @@ if (NOT TARGET Qt5::Qmqtt)
|
||||
foreach(_module_dep ${_Qt5Qmqtt_MODULE_DEPENDENCIES})
|
||||
if (NOT Qt5${_module_dep}_FOUND)
|
||||
find_package(Qt5${_module_dep}
|
||||
1.0.2 ${_Qt5Qmqtt_FIND_VERSION_EXACT}
|
||||
1.0.3 ${_Qt5Qmqtt_FIND_VERSION_EXACT}
|
||||
${_Qt5Qmqtt_DEPENDENCIES_FIND_QUIET}
|
||||
${_Qt5Qmqtt_FIND_DEPENDENCIES_REQUIRED}
|
||||
PATHS "${CMAKE_CURRENT_LIST_DIR}/.." NO_DEFAULT_PATH
|
||||
@ -151,13 +145,10 @@ if (NOT TARGET Qt5::Qmqtt)
|
||||
)
|
||||
endif()
|
||||
|
||||
_populate_Qmqtt_target_properties(RELEASE "Qt5Qmqtt.dll" "libQt5Qmqtt.a" )
|
||||
_populate_Qmqtt_target_properties(RELEASE "libQt5Qmqtt.so.1.0.3" "" )
|
||||
|
||||
|
||||
|
||||
_populate_Qmqtt_target_properties(DEBUG "Qt5Qmqttd.dll" "libQt5Qmqttd.a" )
|
||||
|
||||
|
||||
|
||||
file(GLOB pluginTargets "${CMAKE_CURRENT_LIST_DIR}/Qt5Qmqtt_*Plugin.cmake")
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
set(PACKAGE_VERSION 1.0.2)
|
||||
set(PACKAGE_VERSION 1.0.3)
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
|
||||
6
lib/mqtt/libQt5Qmqtt.prl
Normal file
6
lib/mqtt/libQt5Qmqtt.prl
Normal file
@ -0,0 +1,6 @@
|
||||
QMAKE_PRL_BUILD_DIR = /opt/Tools/qmqtt-emqx/build-qmqtt-Desktop_Qt_5_12_2_GCC_64bit-Release/src/mqtt
|
||||
QMAKE_PRO_INPUT = qmqtt.pro
|
||||
QMAKE_PRL_TARGET = libQt5Qmqtt.so.1.0.3
|
||||
QMAKE_PRL_CONFIG = lex yacc depend_includepath testcase_targets import_plugins import_qpa_plugin qt_build_extra file_copies qmake_use qt warn_on release link_prl incremental shared release linux unix posix gcc sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples enable_new_dtags f16c force_debug_info largefile precompile_header rdrnd shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl prepare_docs qt_docs_targets no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions explicitlib warning_clean qtquickcompiler relative_qt_rpath qmake_cache target_qt c++11 strict_c++ c++14 c99 c11 hide_symbols bsymbolic_functions separate_debug_info split_incpath qt_install_headers need_fwd_pri qt_install_module create_cmake compiler_supports_fpmath create_pc create_libtool have_target dll debug_info thread moc resources
|
||||
QMAKE_PRL_VERSION = 1.0.3
|
||||
QMAKE_PRL_LIBS = -L/opt/Qt5.12.2/5.12.2/gcc_64/lib -lQt5Network -lQt5Core -lpthread
|
||||
BIN
lib/mqtt/libQt5Qmqtt.so.1
Normal file
BIN
lib/mqtt/libQt5Qmqtt.so.1
Normal file
Binary file not shown.
BIN
lib/mqtt/libQt5Qmqtt.so.1.0
Normal file
BIN
lib/mqtt/libQt5Qmqtt.so.1.0
Normal file
Binary file not shown.
BIN
lib/mqtt/libQt5Qmqtt.so.1.0.3
Normal file
BIN
lib/mqtt/libQt5Qmqtt.so.1.0.3
Normal file
Binary file not shown.
BIN
lib/mqtt/libQt5Qmqtt.so.1.0.3.debug
Normal file
BIN
lib/mqtt/libQt5Qmqtt.so.1.0.3.debug
Normal file
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
prefix=D:/Qt/Qt5.12.11/5.12.11/mingw73_32
|
||||
prefix=/opt/Qt5.12.2/5.12.2/gcc_64
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
@ -6,8 +6,8 @@ includedir=${prefix}/include
|
||||
|
||||
Name: Qt5 Qmqtt
|
||||
Description: Qt Qmqtt module
|
||||
Version: 1.0.2
|
||||
Libs: -L${libdir} -lQt5Qmqttd
|
||||
Version: 1.0.3
|
||||
Libs: -L${libdir} -lQt5Qmqtt
|
||||
Cflags: -DQT_QMQTT_LIB -I${includedir}/QtQmqtt -I${includedir}
|
||||
Requires: Qt5Core Qt5Network
|
||||
|
||||
|
||||
@ -20,7 +20,13 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
g_FtpClient = new FtpClient();
|
||||
|
||||
//读取ini
|
||||
|
||||
#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
|
||||
g_strVersion = "SJ90C V1.1";
|
||||
g_strProject = settingsread.value("main/Project").toString();
|
||||
g_strFre = settingsread.value("main/Fre").toString();
|
||||
@ -300,12 +306,26 @@ void MainWindow::leftConfigClick2()
|
||||
}
|
||||
|
||||
if(name == "实时报警"){
|
||||
if(pRealTimeAlarm == NULL)
|
||||
pRealTimeAlarm = new CRealTimeAlarm (this);
|
||||
ui->tabWidget_accidentTracing->addTab(pRealTimeAlarm,"");
|
||||
ui->tabWidget_accidentTracing->setCurrentWidget(pRealTimeAlarm);
|
||||
}else if(name == "历史报警"){
|
||||
ui->tabWidget_accidentTracing->setCurrentWidget(pHistoryAlarm);
|
||||
}else if(name == "趋势分析"){
|
||||
ui->tabWidget_accidentTracing->setCurrentWidget(pTrendGraph);
|
||||
if(pHistoryAlarm){
|
||||
delete pHistoryAlarm;
|
||||
pHistoryAlarm = NULL;
|
||||
}
|
||||
}else if(name == "历史报警"){
|
||||
if(pHistoryAlarm == NULL)
|
||||
pHistoryAlarm = new CHistoryAlarm (this);
|
||||
ui->tabWidget_accidentTracing->addTab(pHistoryAlarm,"");
|
||||
ui->tabWidget_accidentTracing->setCurrentWidget(pHistoryAlarm);
|
||||
if(pRealTimeAlarm){
|
||||
delete pRealTimeAlarm;
|
||||
pRealTimeAlarm = NULL;
|
||||
}
|
||||
}/*else if(name == "趋势分析"){
|
||||
ui->tabWidget_accidentTracing->setCurrentWidget(pTrendGraph);
|
||||
}*/
|
||||
}
|
||||
|
||||
void MainWindow::initLeft3()
|
||||
@ -337,6 +357,22 @@ void MainWindow::leftConfigClick3()
|
||||
if(name == "机组配置"){
|
||||
|
||||
ui->tabWidget_Configuration->setCurrentWidget(pUnitSetting);
|
||||
if(pBoardSetting){
|
||||
delete pBoardSetting;
|
||||
pBoardSetting = NULL;
|
||||
}
|
||||
if(pWorkCondition){
|
||||
delete pWorkCondition;
|
||||
pWorkCondition = NULL;
|
||||
}
|
||||
if(pTriggerConfig){
|
||||
delete pTriggerConfig;
|
||||
pTriggerConfig = NULL;
|
||||
}
|
||||
if(pConfiguration){
|
||||
delete pConfiguration;
|
||||
pConfiguration = NULL;
|
||||
}
|
||||
}else if(name == "板卡配置"){
|
||||
if(pBoardSetting == NULL)
|
||||
pBoardSetting = new CBoardSetting (this);
|
||||
@ -375,6 +411,10 @@ void MainWindow::leftConfigClick3()
|
||||
delete pTriggerConfig;
|
||||
pTriggerConfig = NULL;
|
||||
}
|
||||
if(pConfiguration){
|
||||
delete pConfiguration;
|
||||
pConfiguration = NULL;
|
||||
}
|
||||
|
||||
}else if(name == "工况配置"){
|
||||
if(pWorkCondition == NULL)
|
||||
|
||||
340
realtimeform.cpp
340
realtimeform.cpp
@ -21,12 +21,10 @@
|
||||
|
||||
CRealTimeForm::CRealTimeForm(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CRealTimeForm)
|
||||
{
|
||||
ui(new Ui::CRealTimeForm) {
|
||||
ui->setupUi(this);
|
||||
ui->graphicsView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
QObject::connect(ui->graphicsView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(on_graphView_customContextMenuRequested(const QPoint &)));
|
||||
|
||||
ui->graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
m_pGraphicsScene = new QGraphicsScene();
|
||||
m_pGraphicsScene->setSceneRect(0, 0, 600, 550);
|
||||
@ -35,58 +33,49 @@ CRealTimeForm::CRealTimeForm(QWidget *parent) :
|
||||
ui->graphicsView->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
ui->graphicsView_2->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
QObject::connect(ui->graphicsView_2, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(on_graphView_customContextMenuRequested(const QPoint &)));
|
||||
|
||||
ui->graphicsView_2->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
m_pGraphicsScene_2 = new QGraphicsScene();
|
||||
m_pGraphicsScene_2->setSceneRect(0, 0, 600, 550);
|
||||
ui->graphicsView_2->setScene(m_pGraphicsScene_2);
|
||||
ui->graphicsView_2->setDragMode(QGraphicsView::RubberBandDrag);
|
||||
|
||||
|
||||
|
||||
ui->tabWidget->setTabPosition(QTabWidget::South);
|
||||
ui->tabWidget->setTabShape(QTabWidget::Triangular);
|
||||
//绑定HTTP消息响应
|
||||
connect(g_NetMgr, SIGNAL(sigNetMgr(QString, const QVariant &)), this, SLOT(slotNetMgr(QString, const QVariant &)));
|
||||
|
||||
m_pSocket = new QTcpSocket(this);
|
||||
|
||||
m_EditMode = 0;
|
||||
m_MachineStatus = 1;
|
||||
//读取ini
|
||||
QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini",QSettings::IniFormat);
|
||||
m_RealtimeLog = settingsread.value("Log/realtime").toInt();
|
||||
|
||||
|
||||
#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
|
||||
m_RealtimeLog = settingsread.value("Log/realtime").toInt();
|
||||
LoadGraphicsConfig(0);
|
||||
InitChannelInfo();
|
||||
|
||||
|
||||
//m_strServerIp = IP;
|
||||
m_nServerPort = 7305;
|
||||
|
||||
m_pSocket = new QTcpSocket(this);
|
||||
|
||||
// /*下面是几种常用的信号,更多的信号可以查看QAbstractSocket和QIODevice文档*/
|
||||
// connect(m_pSocket, &QTcpSocket::connected, this, [] () {
|
||||
// qDebug() << "socket已连接";
|
||||
// });
|
||||
|
||||
// connect(m_pSocket, &QTcpSocket::disconnected, this, [] () {
|
||||
// qDebug() << "socket已断开连接";
|
||||
// });
|
||||
|
||||
// connect(m_pSocket, &QTcpSocket::stateChanged, this, [] (QAbstractSocket::SocketState socketState) {
|
||||
// qDebug() << "socket状态改变" << socketState;
|
||||
// });
|
||||
|
||||
// connect(m_pSocket, &QTcpSocket::readyRead, this, [] () {
|
||||
// qDebug() << "有数据可读";
|
||||
|
||||
// });
|
||||
//connect(m_pSocket, SIGNAL(readyRead()), this, SLOT(slotRecieve()));
|
||||
connect(m_pSocket, &QTcpSocket::readyRead, this, &CRealTimeForm::slotRecieve);
|
||||
connect(m_pSocket, &QTcpSocket::disconnected, this, &CRealTimeForm::disConnect);
|
||||
|
||||
//#ifdef QT_NO_DEBUG
|
||||
id1 = startTimer(2000); //参数1 间隔 单位 毫秒
|
||||
//定时器第二种方式
|
||||
@ -94,52 +83,46 @@ CRealTimeForm::CRealTimeForm(QWidget *parent) :
|
||||
//启动定时器
|
||||
timer->start(500);
|
||||
//#endif
|
||||
|
||||
// MyGraphicsView *view = new MyGraphicsView(m_pGraphicsScene, this);
|
||||
|
||||
// QVBoxLayout *layout = new QVBoxLayout(ui->tab);
|
||||
// layout->setContentsMargins(0, 0, 0, 0); // 去除边距
|
||||
// layout->addWidget(view);
|
||||
// setLayout(layout);
|
||||
}
|
||||
|
||||
CRealTimeForm::~CRealTimeForm()
|
||||
{
|
||||
CRealTimeForm::~CRealTimeForm() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CRealTimeForm::timerEvent(QTimerEvent *ev)
|
||||
{
|
||||
if(ev->timerId() == id1)
|
||||
{
|
||||
void CRealTimeForm::timerEvent(QTimerEvent *ev) {
|
||||
if (ev->timerId() == id1) {
|
||||
QJsonObject allObj;
|
||||
allObj.insert("cmd", "09");
|
||||
// 设置IP和端口号连接
|
||||
m_pSocket->connectToHost(IP, m_nServerPort);
|
||||
|
||||
// 设置超时连接时间
|
||||
m_bConnected = m_pSocket->waitForConnected(1 * 1000);
|
||||
// QNetworkRequest req;
|
||||
// QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||||
|
||||
// req.setUrl(sUrl);
|
||||
// g_NetMgr->PostJson(req,allObj);
|
||||
|
||||
QJsonDocument doc(allObj);
|
||||
QString strData = QString(doc.toJson(QJsonDocument::Indented));
|
||||
|
||||
|
||||
|
||||
int nRet = m_pSocket->write(strData.toStdString().c_str(), strlen(strData.toStdString().c_str()));
|
||||
|
||||
if (nRet != 0) {
|
||||
//qDebug() << "09 通信失败" << endl;
|
||||
//customLogMessageHandler(QtWarningMsg,"09通信失败");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CRealTimeForm::InitChannelInfo()
|
||||
{
|
||||
void CRealTimeForm::InitChannelInfo() {
|
||||
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
|
||||
g_ChannelBaseInfo.clear();
|
||||
QVector<channelBaseInfo>().swap(g_ChannelBaseInfo);
|
||||
for (int i = 0; i < g_channelSetting.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < g_channelSetting.size(); i++) {
|
||||
QMap<QString, QString> mapChannelType;
|
||||
mapChannelType.insert(g_channelSetting[i].sensorType, g_channelSetting[i].channelName);
|
||||
g_MapChannel.insert(g_channelSetting[i].channelId, mapChannelType);
|
||||
@ -161,8 +144,7 @@ void CRealTimeForm::InitChannelInfo()
|
||||
qDebug() << "InitChannelInfo" << g_ChannelBaseInfo.size() << endl;
|
||||
}
|
||||
|
||||
void CRealTimeForm::on_graphView_customContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
void CRealTimeForm::on_graphView_customContextMenuRequested(const QPoint &pos) {
|
||||
qDebug() << " custom menu!!!!!!!!!" << "##" << pos.x() << " ; " << pos.y();
|
||||
// if(ui->graphicsView->itemAt(pos) || ui->graphicsView_2->itemAt(pos))
|
||||
// return;
|
||||
@ -177,7 +159,6 @@ void CRealTimeForm::on_graphView_customContextMenuRequested(const QPoint &pos)
|
||||
pActionAlignmentY = menu.addAction("垂直分布");
|
||||
pActionEdit = menu.addAction("编辑");
|
||||
pActionSave = menu.addAction("保存");
|
||||
|
||||
pActionVerticalLine->setData(1);
|
||||
pActionHorizontalLine->setData(2);
|
||||
pActionRect->setData(3);
|
||||
@ -188,7 +169,6 @@ void CRealTimeForm::on_graphView_customContextMenuRequested(const QPoint &pos)
|
||||
pActionRect2->setData(8);
|
||||
pActionAlignmentX->setData(9);
|
||||
pActionAlignmentY->setData(10);
|
||||
|
||||
connect(pActionVerticalLine, SIGNAL(triggered()), this, SLOT(onTaskBoxContextMenuEvent()));
|
||||
connect(pActionHorizontalLine, SIGNAL(triggered()), this, SLOT(onTaskBoxContextMenuEvent()));
|
||||
connect(pActionRect, SIGNAL(triggered()), this, SLOT(onTaskBoxContextMenuEvent()));
|
||||
@ -199,7 +179,6 @@ void CRealTimeForm::on_graphView_customContextMenuRequested(const QPoint &pos)
|
||||
connect(pActionRect2, SIGNAL(triggered()), this, SLOT(onTaskBoxContextMenuEvent()));
|
||||
connect(pActionAlignmentX, SIGNAL(triggered()), this, SLOT(onTaskBoxContextMenuEvent()));
|
||||
connect(pActionAlignmentY, SIGNAL(triggered()), this, SLOT(onTaskBoxContextMenuEvent()));
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
//menu.exec(ui->graphicsView->mapToGlobal(pos));
|
||||
// if(pActionLine == menu.exec(ui->graphicsView->mapToGlobal(pos))){
|
||||
@ -209,14 +188,11 @@ void CRealTimeForm::on_graphView_customContextMenuRequested(const QPoint &pos)
|
||||
// qDebug() << " Rect!!!!!!!!!"<< "##"<< pos.x() << " ; "<< pos.y();
|
||||
// SetCurDrawType("Rect",pos);
|
||||
// }
|
||||
|
||||
}
|
||||
void CRealTimeForm::onTaskBoxContextMenuEvent()
|
||||
{
|
||||
void CRealTimeForm::onTaskBoxContextMenuEvent() {
|
||||
QAction *pEven = qobject_cast<QAction *>(this->sender());
|
||||
int iType = pEven->data().toInt();
|
||||
switch (iType)
|
||||
{
|
||||
switch (iType) {
|
||||
case 1:
|
||||
SetCurDrawType("vertical");
|
||||
break;
|
||||
@ -250,14 +226,12 @@ void CRealTimeForm::onTaskBoxContextMenuEvent()
|
||||
}
|
||||
}
|
||||
|
||||
void CRealTimeForm::SetEdit()
|
||||
{
|
||||
void CRealTimeForm::SetEdit() {
|
||||
m_EditMode = 1;
|
||||
LoadGraphicsConfig(1);
|
||||
}
|
||||
|
||||
void CRealTimeForm::SetAlignmentX()
|
||||
{
|
||||
void CRealTimeForm::SetAlignmentX() {
|
||||
if (!m_EditMode) {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "请先进入编辑模式!");
|
||||
return;
|
||||
@ -269,7 +243,6 @@ void CRealTimeForm::SetAlignmentX()
|
||||
} else if (ui->tabWidget->currentIndex() == 1) {
|
||||
items = m_pGraphicsScene_2->items();
|
||||
}
|
||||
|
||||
foreach (QGraphicsItem *item, items) {
|
||||
QGraphicsItem *graphicsItem = static_cast<QGraphicsItem *>(item);
|
||||
int itemType = graphicsItem->type();
|
||||
@ -285,7 +258,6 @@ void CRealTimeForm::SetAlignmentX()
|
||||
qSort(list);
|
||||
float minValue = list.first();
|
||||
qDebug() << "minValue" << minValue << endl;
|
||||
|
||||
QMap<QGraphicsItem *, float>::iterator iter = channleAxisX.begin();
|
||||
for (; iter != channleAxisX.end(); iter++) {
|
||||
iter.key()->setPos(minValue, iter.key()->y());
|
||||
@ -293,8 +265,7 @@ void CRealTimeForm::SetAlignmentX()
|
||||
}
|
||||
|
||||
|
||||
void CRealTimeForm::SetAlignmentY()
|
||||
{
|
||||
void CRealTimeForm::SetAlignmentY() {
|
||||
if (!m_EditMode) {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "请先进入编辑模式!");
|
||||
return;
|
||||
@ -306,7 +277,6 @@ void CRealTimeForm::SetAlignmentY()
|
||||
} else if (ui->tabWidget->currentIndex() == 1) {
|
||||
items = m_pGraphicsScene_2->items();
|
||||
}
|
||||
|
||||
foreach (QGraphicsItem *item, items) {
|
||||
QGraphicsItem *graphicsItem = static_cast<QGraphicsItem *>(item);
|
||||
int itemType = graphicsItem->type();
|
||||
@ -317,26 +287,28 @@ void CRealTimeForm::SetAlignmentY()
|
||||
}
|
||||
}
|
||||
}
|
||||
qDebug() << "channleAxisY" << channleAxisY << endl;
|
||||
QList<float> list = channleAxisY.values();
|
||||
qSort(list);
|
||||
float minValue = list.first();
|
||||
qDebug() << "minValue" << minValue << endl;
|
||||
|
||||
qDebug() << "minValue" << minValue << list.size() << endl;
|
||||
QMap<QGraphicsItem *, float>::iterator iter = channleAxisY.begin();
|
||||
int i = 0;
|
||||
for (; iter != channleAxisY.end(); iter++,i++) {
|
||||
iter.key()->setPos(iter.key()->x(),list[0] + i * 40 );
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
for (iter = channleAxisY.begin(); iter != channleAxisY.end(); iter++) {
|
||||
if (iter.value() == list[j]) {
|
||||
qDebug() << "iter" << iter.key() << endl;
|
||||
iter.key()->setPos(iter.key()->x(), list[0] + j * 40);
|
||||
qDebug() << "iter X" << iter.key()->x() << "Y" << list[0] + j * 40 << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo,QString str)
|
||||
{
|
||||
|
||||
void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo, QString str) {
|
||||
QPen pen; // 定义一个画笔,设置画笔颜色和宽度
|
||||
pen.setColor(QColor(0, 0, 0, 0));
|
||||
pen.setWidth(1);
|
||||
CMyCustomGraphicsItem *pItemGroup = new CMyCustomGraphicsItem();
|
||||
|
||||
QGraphicsRectItem *pRect = new QGraphicsRectItem(0, 0, 290, 30);
|
||||
pRect->setBrush(QBrush(QColor(255, 255, 255)));
|
||||
pRect->setPen(pen);
|
||||
@ -344,8 +316,6 @@ void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo,QString str)
|
||||
pRect->setData(1, "Rect");
|
||||
pItemGroup->addToGroup(pRect);
|
||||
pItemGroup->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
|
||||
|
||||
QGraphicsTextItem *pTextUnits = NULL;
|
||||
if (channelbaseInfo.channelType == "TACHOMETER") {
|
||||
if (str == "偏置电压" || str == "最大正向峰值" || str == "最大负向峰值" || str == "平均值") {
|
||||
@ -356,8 +326,7 @@ void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo,QString str)
|
||||
} else if (channelbaseInfo.channelType == "ACCELEROMETER") {
|
||||
if (str == "偏置电压") {
|
||||
pTextUnits = new QGraphicsTextItem("V");
|
||||
}
|
||||
else if(str == "最大正向峰值" || str == "最大负向峰值" ||
|
||||
} else if (str == "最大正向峰值" || str == "最大负向峰值" ||
|
||||
str == "诊断峰峰值" || str == "平均值") {
|
||||
pTextUnits = new QGraphicsTextItem(channelbaseInfo.sensorEngineeringUnit);
|
||||
} else if (str == "速度峰值" || str == "速度有效值") {
|
||||
@ -368,8 +337,7 @@ void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo,QString str)
|
||||
} else if (channelbaseInfo.channelType == "PROXIMETER") {
|
||||
if (str == "平均值") {
|
||||
pTextUnits = new QGraphicsTextItem(channelbaseInfo.sensorEngineeringUnit);
|
||||
}
|
||||
else if(str == "最大正向峰值" || str == "最大负向峰值" ||
|
||||
} else if (str == "最大正向峰值" || str == "最大负向峰值" ||
|
||||
str == "诊断峰峰值") {
|
||||
pTextUnits = new QGraphicsTextItem(channelbaseInfo.sensorEngineeringUnit);
|
||||
} else {
|
||||
@ -388,35 +356,27 @@ void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo,QString str)
|
||||
pTextUnits = new QGraphicsTextItem("V");
|
||||
} else if (str == "有效值") {
|
||||
pTextUnits = new QGraphicsTextItem(channelbaseInfo.sensorEngineeringUnit);
|
||||
}else if(str == "位移峰值" || str == "位移有效值"){
|
||||
} else if (str == "位移峰值" || str == "位移有效值" || str == "诊断峰峰值") {
|
||||
pTextUnits = new QGraphicsTextItem("um");
|
||||
} else {
|
||||
pTextUnits = new QGraphicsTextItem(channelbaseInfo.sensorEngineeringUnit);
|
||||
}
|
||||
} else if (channelbaseInfo.channelType == "SLOW_CURRENT") {
|
||||
|
||||
pTextUnits = new QGraphicsTextItem(channelbaseInfo.sensorEngineeringUnit);
|
||||
|
||||
} else if (channelbaseInfo.channelType == "FAST_VOLTAGE") {
|
||||
|
||||
pTextUnits = new QGraphicsTextItem(channelbaseInfo.sensorEngineeringUnit);
|
||||
} else if (channelbaseInfo.channelType == "PULSE_CURRENT") {
|
||||
|
||||
pTextUnits = new QGraphicsTextItem(channelbaseInfo.sensorEngineeringUnit);
|
||||
}
|
||||
|
||||
if (str == "峰值因子") {
|
||||
pTextUnits = new QGraphicsTextItem("");
|
||||
}
|
||||
|
||||
QGraphicsTextItem *pTextChannel = new QGraphicsTextItem(channelbaseInfo.channelName);
|
||||
QGraphicsTextItem *pTextValue = new QGraphicsTextItem("0.0");
|
||||
|
||||
pTextUnits->setData(1, "units");
|
||||
pTextChannel->setData(2, "channel");
|
||||
pTextValue->setData(3, "value");
|
||||
pTextValue->setData(4, str); //特征值
|
||||
|
||||
QFont font;
|
||||
font.setPixelSize(16);
|
||||
QFont font2("黑体", 18, 50);
|
||||
@ -430,25 +390,19 @@ void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo,QString str)
|
||||
pTextChannel->setPos(0, 2);
|
||||
pTextChannel->setDefaultTextColor(QColor(27, 30, 35));
|
||||
pTextUnits->setPos(240, 5);
|
||||
|
||||
|
||||
// 设置可移动、可选择
|
||||
|
||||
pItemGroup->addToGroup(pTextChannel);
|
||||
pItemGroup->addToGroup(pTextValue);
|
||||
pItemGroup->addToGroup(pTextUnits);
|
||||
|
||||
pItemGroup->setData(0, channelbaseInfo.channelID);
|
||||
if (ui->tabWidget->currentIndex() == 0) {
|
||||
m_pGraphicsScene->addItem(pItemGroup);
|
||||
} else if (ui->tabWidget->currentIndex() == 1) {
|
||||
m_pGraphicsScene_2->addItem(pItemGroup);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CRealTimeForm::SetCurDrawType(QString strType)
|
||||
{
|
||||
void CRealTimeForm::SetCurDrawType(QString strType) {
|
||||
if (!m_EditMode) {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "请先进入编辑模式!");
|
||||
return;
|
||||
@ -464,7 +418,6 @@ void CRealTimeForm::SetCurDrawType(QString strType)
|
||||
} else if (ui->tabWidget->currentIndex() == 1) {
|
||||
m_pGraphicsScene_2->addItem(pLine);
|
||||
}
|
||||
|
||||
} else if (strType == "Horizonta") {
|
||||
QGraphicsLineItem *pLine = new QGraphicsLineItem(0, 0, 100, 100);
|
||||
pLine->setPos(0, 0);
|
||||
@ -476,19 +429,21 @@ void CRealTimeForm::SetCurDrawType(QString strType)
|
||||
} else if (ui->tabWidget->currentIndex() == 1) {
|
||||
m_pGraphicsScene_2->addItem(pLine);
|
||||
}
|
||||
|
||||
}
|
||||
else if(strType == "Channel"){
|
||||
} else if (strType == "Channel") {
|
||||
CAddChannel *pAddChannel = new CAddChannel();
|
||||
pAddChannel->setWindowModality(Qt::ApplicationModal);
|
||||
pAddChannel->show();
|
||||
connect(pAddChannel, SIGNAL(addChannel_sg(channelBaseInfo, QString)), this, SLOT(on_addchannel(channelBaseInfo, QString)));
|
||||
|
||||
} else if (strType == "Pixmap") {
|
||||
#ifdef Q_OS_WIN32
|
||||
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitParameters.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/UnitParameters.json";
|
||||
#endif
|
||||
|
||||
QFile loadFile(name);
|
||||
if(!loadFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
if (!loadFile.open(QIODevice::ReadOnly)) {
|
||||
qDebug() << "could't open projects json";
|
||||
return;
|
||||
}
|
||||
@ -500,7 +455,6 @@ void CRealTimeForm::SetCurDrawType(QString strType)
|
||||
QMessageBox::about(NULL, "提示", "读取文件错误!");
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject jsonObject = document.object();
|
||||
if (jsonObject.contains(QStringLiteral("UnitStyle"))) {
|
||||
QJsonValue jsonValue = jsonObject.value(QStringLiteral("UnitStyle"));
|
||||
@ -523,9 +477,7 @@ void CRealTimeForm::SetCurDrawType(QString strType)
|
||||
m_pGraphicsScene_2->addItem(pPixmap);
|
||||
}
|
||||
pPixmap->setPos(0, 0);
|
||||
|
||||
}
|
||||
|
||||
} else if (strType == "Text") {
|
||||
QGraphicsTextItem *pText = new QGraphicsTextItem("请输入...");
|
||||
// 设置可移动、可选择
|
||||
@ -552,13 +504,10 @@ void CRealTimeForm::SetCurDrawType(QString strType)
|
||||
m_rect->setTransformOriginPoint(25, 25);
|
||||
m_rect->setRotation(45);
|
||||
}
|
||||
|
||||
ui->graphicsView->update();
|
||||
|
||||
}
|
||||
|
||||
void CRealTimeForm::SaveGraphicsConfig()
|
||||
{
|
||||
void CRealTimeForm::SaveGraphicsConfig() {
|
||||
m_EditMode = 0;
|
||||
QJsonObject jsonObject;
|
||||
QJsonArray RectjsonArray;
|
||||
@ -572,7 +521,6 @@ void CRealTimeForm::SaveGraphicsConfig()
|
||||
} else if (ui->tabWidget->currentIndex() == 1) {
|
||||
items = m_pGraphicsScene_2->items();
|
||||
}
|
||||
|
||||
foreach (QGraphicsItem *item, items) {
|
||||
QGraphicsItem *graphicsItem = static_cast<QGraphicsItem *>(item);
|
||||
int itemType = graphicsItem->type();
|
||||
@ -588,12 +536,10 @@ void CRealTimeForm::SaveGraphicsConfig()
|
||||
// RectjsonObject.insert("w", rect.width());
|
||||
// RectjsonObject.insert("h", rect.height());
|
||||
// RectjsonArray.append(RectjsonObject);
|
||||
|
||||
// } break;
|
||||
case 4://Ellipse
|
||||
break;
|
||||
case 6://Line
|
||||
{
|
||||
case 6: { //Line
|
||||
QPointF pos = graphicsItem->pos();
|
||||
QRectF rect = graphicsItem->boundingRect();
|
||||
//qDebug() << "Line" << pos << rect;
|
||||
@ -606,9 +552,7 @@ void CRealTimeForm::SaveGraphicsConfig()
|
||||
LinejsonArray.append(LinejsonObject);
|
||||
}
|
||||
break;
|
||||
case 7://Pixmap
|
||||
{
|
||||
|
||||
case 7: { //Pixmap
|
||||
QPointF pos = graphicsItem->pos();
|
||||
QRectF rect = graphicsItem->boundingRect();
|
||||
//qDebug() << "Pixmap" << pos << rect;
|
||||
@ -618,7 +562,6 @@ void CRealTimeForm::SaveGraphicsConfig()
|
||||
PixmapjsonObject.insert("w", rect.width());
|
||||
PixmapjsonObject.insert("h", rect.height());
|
||||
PixmapjsonArray.append(PixmapjsonObject);
|
||||
|
||||
}
|
||||
break;
|
||||
// case 8:{//Text
|
||||
@ -648,7 +591,6 @@ void CRealTimeForm::SaveGraphicsConfig()
|
||||
QJsonObject itemjsonObject;
|
||||
QList<QGraphicsItem *> items = pGraphicGroupItem->childItems();
|
||||
foreach (QGraphicsItem *item, items) {
|
||||
|
||||
QString itemData, itemData2 = "";
|
||||
for (int i = 0; i < 5; i++) {
|
||||
itemData = item->data(i).toString();
|
||||
@ -664,11 +606,9 @@ void CRealTimeForm::SaveGraphicsConfig()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QGraphicsItem *graphicsItem = static_cast<QGraphicsItem *>(item);
|
||||
int itemType = graphicsItem->type();
|
||||
//qDebug() << "itemData2" << itemData << endl;
|
||||
|
||||
switch (itemType) {
|
||||
case 3: {//Rect
|
||||
QPointF pos = graphicsItem->pos();
|
||||
@ -680,9 +620,8 @@ void CRealTimeForm::SaveGraphicsConfig()
|
||||
RectjsonObject.insert("w", rect.width());
|
||||
RectjsonObject.insert("h", rect.height());
|
||||
GroupRectjsonArray.append(RectjsonObject);
|
||||
|
||||
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case 8: { //Text
|
||||
QGraphicsTextItem *pGraphicTextItem = static_cast<QGraphicsTextItem *>(graphicsItem);
|
||||
QPointF pos = graphicsItem->pos();
|
||||
@ -696,18 +635,19 @@ void CRealTimeForm::SaveGraphicsConfig()
|
||||
QColor color = pGraphicTextItem->defaultTextColor();
|
||||
QRgb mRgb = qRgba(color.red(), color.green(), color.blue(), color.alpha());
|
||||
TextjsonObject.insert("color", QString::number(mRgb, 16));
|
||||
if(itemData2 != "")
|
||||
if (itemData2 != "") {
|
||||
TextjsonObject.insert("static", itemData2);
|
||||
if(itemData == "units")
|
||||
}
|
||||
if (itemData == "units") {
|
||||
temp.channelUnit = pGraphicTextItem->toPlainText();
|
||||
else if(itemData == "channel")
|
||||
} else if (itemData == "channel") {
|
||||
temp.channelName = pGraphicTextItem->toPlainText();
|
||||
}
|
||||
TextjsonObject.insert("word", pGraphicTextItem->toPlainText());
|
||||
GroupTextjsonArray.append(TextjsonObject);
|
||||
|
||||
}break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
itemjsonObject.insert("Rect", GroupRectjsonArray);
|
||||
itemjsonObject.insert("Text", GroupTextjsonArray);
|
||||
@ -717,9 +657,8 @@ void CRealTimeForm::SaveGraphicsConfig()
|
||||
GroupjsonArray.append(itemjsonObject);
|
||||
temp.channelID = strChannelID;
|
||||
g_ChannelView.append(temp);
|
||||
|
||||
|
||||
}break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -729,19 +668,25 @@ void CRealTimeForm::SaveGraphicsConfig()
|
||||
jsonObject.insert("Pixmap", PixmapjsonArray);
|
||||
jsonObject.insert("Text", TextjsonArray);
|
||||
jsonObject.insert("Group", GroupjsonArray);
|
||||
|
||||
QString fileName;
|
||||
if (ui->tabWidget->currentIndex() == 0) {
|
||||
#ifdef Q_OS_WIN32
|
||||
fileName = QCoreApplication::applicationDirPath() + "\\config\\Graph1.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
fileName = QCoreApplication::applicationDirPath() + "/config/Graph1.json";
|
||||
#endif
|
||||
} else {
|
||||
#ifdef Q_OS_WIN32
|
||||
fileName = QCoreApplication::applicationDirPath() + "\\config\\Graph2.json";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
fileName = QCoreApplication::applicationDirPath() + "/config/Graph2.json";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
QJsonDocument jsonDoc;
|
||||
jsonDoc.setObject(jsonObject);
|
||||
//QString fileName = QFileDialog::getSaveFileName(this,"另存为 ","xxx.json");
|
||||
|
||||
//if(!fileName.isEmpty())
|
||||
{
|
||||
qDebug() << "另存为" << fileName;
|
||||
@ -752,49 +697,44 @@ void CRealTimeForm::SaveGraphicsConfig()
|
||||
file.write(jsonDoc.toJson());
|
||||
file.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CRealTimeForm::slotDoubleClick(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
void CRealTimeForm::slotDoubleClick(QGraphicsSceneMouseEvent *event) {
|
||||
qDebug() << "slotDoubleClick" << event->pos() << endl;
|
||||
QGraphicsItem *item = m_pGraphicsScene->itemAt(event->scenePos(), QTransform());
|
||||
QGraphicsItemGroup *pGraphicGroupItem = static_cast<QGraphicsItemGroup *>(item);
|
||||
qDebug() << "QGraphicsItem" << pGraphicGroupItem->childItems() << endl;
|
||||
}
|
||||
|
||||
void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
{
|
||||
void CRealTimeForm::LoadGraphicsConfig(int type) {
|
||||
//读取图元的数据
|
||||
|
||||
m_pGraphicsScene->clear();
|
||||
m_pGraphicsScene_2->clear();
|
||||
QPen pen; // 定义一个画笔,设置画笔颜色和宽度
|
||||
pen.setColor(QColor(0, 0, 0, 0));
|
||||
pen.setWidth(1);
|
||||
|
||||
|
||||
//QString fileName =QFileDialog::getOpenFileName(this,"打开文件",QDir::currentPath(), "*.json");
|
||||
for (int ii = 0; ii < ui->tabWidget->count(); ii++) {
|
||||
QString strFileName = QString("Graph%1.json").arg(ii + 1);
|
||||
#ifdef Q_OS_WIN32
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\" + strFileName;
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QString fileName = QCoreApplication::applicationDirPath() + "/config/" + strFileName;
|
||||
#endif
|
||||
qDebug() << "打开" << fileName ;
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
if (!fileName.isEmpty()) {
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||
QString value = file.readAll();
|
||||
file.close();
|
||||
|
||||
QJsonParseError parseJsonErr;
|
||||
QJsonDocument document = QJsonDocument::fromJson(value.toUtf8(), &parseJsonErr);
|
||||
if (!(parseJsonErr.error == QJsonParseError::NoError)) {
|
||||
QMessageBox::about(NULL, "提示", "读取文件错误!");
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject jsonObject = document.object();
|
||||
// Line字段
|
||||
if (jsonObject.contains(QStringLiteral("Line"))) {
|
||||
@ -811,8 +751,9 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
pLine->setPos(key["x"].toDouble(), key["y"].toDouble());
|
||||
pLine->setRotation(key["rotation"].toInt());
|
||||
pLine->setZValue(100);
|
||||
if(type)
|
||||
if (type) {
|
||||
pLine->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
}
|
||||
if (ii == 0) {
|
||||
m_pGraphicsScene->addItem(pLine);
|
||||
} else if (ii == 1) {
|
||||
@ -834,8 +775,9 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
0,
|
||||
key["w"].toDouble(), key["h"].toDouble());
|
||||
pRect->setPos(key["x"].toDouble(), key["y"].toDouble());
|
||||
if(type)
|
||||
if (type) {
|
||||
pRect->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
}
|
||||
if (ii == 0) {
|
||||
m_pGraphicsScene->addItem(pRect);
|
||||
} else if (ii == 1) {
|
||||
@ -852,10 +794,14 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
QJsonValue nameArray = array.at(i);
|
||||
QJsonObject key = nameArray.toObject();
|
||||
#ifdef Q_OS_LINUX
|
||||
QString name = QCoreApplication::applicationDirPath() + "/config/UnitParameters.json";
|
||||
#endif
|
||||
#ifdef Q_OS_WIN32
|
||||
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitParameters.json";
|
||||
#endif
|
||||
QFile loadFile(name);
|
||||
if(!loadFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
if (!loadFile.open(QIODevice::ReadOnly)) {
|
||||
qDebug() << "could't open projects json";
|
||||
return;
|
||||
}
|
||||
@ -867,7 +813,6 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
QMessageBox::about(NULL, "提示", "读取文件错误!");
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject jsonObject = document.object();
|
||||
if (jsonObject.contains(QStringLiteral("UnitStyle"))) {
|
||||
QJsonValue jsonValue = jsonObject.value(QStringLiteral("UnitStyle"));
|
||||
@ -877,29 +822,32 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
QMovie *movie = NULL;
|
||||
qDebug() << "strContent" << strContent << endl;
|
||||
if (strContent == "混流式机组") {
|
||||
if(type == 1 || type == 2)
|
||||
if (type == 1 || type == 2) {
|
||||
pPixmap = new QGraphicsPixmapItem(QPixmap(QCoreApplication::applicationDirPath() + "/image/unit/hunliushi.png"));
|
||||
else
|
||||
} else {
|
||||
movie = new QMovie(QCoreApplication::applicationDirPath() + "/image/unit/hunliushi.gif");
|
||||
|
||||
}
|
||||
} else if (strContent == "轴流定桨式机组" || strContent == "轴流转浆式机组") {
|
||||
if(type == 1 || type == 2)
|
||||
if (type == 1 || type == 2) {
|
||||
pPixmap = new QGraphicsPixmapItem(QPixmap(QCoreApplication::applicationDirPath() + "/image/unit/zhouliushi.png"));
|
||||
else
|
||||
} else {
|
||||
movie = new QMovie(QCoreApplication::applicationDirPath() + "/image/unit/zhouliushi.gif");
|
||||
}
|
||||
//pPixmap = new QGraphicsPixmapItem(QPixmap(QCoreApplication::applicationDirPath() + "/image/unit/zhouliushi.png"));
|
||||
} else if (strContent == "可逆式机组") {
|
||||
if(type == 1 || type == 2)
|
||||
if (type == 1 || type == 2) {
|
||||
pPixmap = new QGraphicsPixmapItem(QPixmap(QCoreApplication::applicationDirPath() + "/image/unit/kenishi.png"));
|
||||
else
|
||||
} else {
|
||||
movie = new QMovie(QCoreApplication::applicationDirPath() + "/image/unit/kenishi.gif");
|
||||
}
|
||||
//pPixmap = new QGraphicsPixmapItem(QPixmap(QCoreApplication::applicationDirPath() + "/image/unit/kenishi.png"));
|
||||
} else if (strContent == "灯泡式机组") {
|
||||
if(type == 1 || type == 2)
|
||||
if (type == 1 || type == 2) {
|
||||
pPixmap = new QGraphicsPixmapItem(QPixmap(QCoreApplication::applicationDirPath() + "/image/unit/dengpaoshi.png"));
|
||||
else
|
||||
} else {
|
||||
movie = new QMovie(QCoreApplication::applicationDirPath() + "/image/unit/dengpaoshi.gif");
|
||||
}
|
||||
}
|
||||
qDebug() << "type" << type << ii << endl;
|
||||
if (type) {
|
||||
pPixmap->setPos(key["x"].toInt(), key["y"].toInt());
|
||||
@ -938,7 +886,6 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
// gif_anim->setMovie(movie);
|
||||
// movie->start();
|
||||
// QGraphicsProxyWidget *proxy = m_pGraphicsScene->addWidget(gif_anim);
|
||||
|
||||
// QGraphicsMovieItem *pPixmap = new QGraphicsMovieItem();
|
||||
// pPixmap->setPos(key["x"].toInt(), key["y"].toInt());
|
||||
// QMovie movie(":/image/1.png");
|
||||
@ -970,7 +917,6 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
QJsonValue nameArray = array.at(i);
|
||||
QJsonObject key = nameArray.toObject();
|
||||
|
||||
QGraphicsTextItem *pText = new QGraphicsTextItem(key["word"].toString());
|
||||
pText->setPos(key["x"].toInt(), key["y"].toInt());
|
||||
pText->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
@ -994,13 +940,12 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
channelBaseInfo temp;
|
||||
CMyCustomGraphicsItem *pItemGroup = new CMyCustomGraphicsItem();
|
||||
if(type == 1)
|
||||
if (type == 1) {
|
||||
pItemGroup->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
}
|
||||
connect(pItemGroup, SIGNAL(doubleclick(QGraphicsSceneMouseEvent *)), this, SLOT(slotDoubleClick(QGraphicsSceneMouseEvent *)));
|
||||
//qDebug() << array.at(i)["x"].toDouble() << array.at(i)["y"].toDouble() << endl;
|
||||
|
||||
QJsonObject jsonObject = array.at(i).toObject();
|
||||
|
||||
if (jsonObject.contains(QStringLiteral("Rect"))) {
|
||||
QJsonValue arrayValue = jsonObject.value(QStringLiteral("Rect"));
|
||||
if (arrayValue.isArray()) {
|
||||
@ -1013,8 +958,9 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
0,
|
||||
290, 30);
|
||||
pRect->setPos(key["x"].toDouble(), key["y"].toDouble());
|
||||
if(type == 1)
|
||||
if (type == 1) {
|
||||
pRect->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
}
|
||||
pRect->setBrush(QBrush(QColor(255, 255, 255)));
|
||||
pRect->setPen(pen);
|
||||
pItemGroup->addToGroup(pRect);
|
||||
@ -1028,7 +974,6 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
QJsonValue nameArray = array.at(i);
|
||||
QJsonObject key = nameArray.toObject();
|
||||
|
||||
QGraphicsTextItem *pText = new QGraphicsTextItem(key["word"].toString());
|
||||
pText->setPos(key["x"].toDouble(), key["y"].toDouble());
|
||||
if (type) {
|
||||
@ -1060,13 +1005,11 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
}
|
||||
pItemGroup->setPos(array.at(i)["x"].toDouble(), array.at(i)["y"].toDouble());
|
||||
pItemGroup->setData(0, array.at(i)["data"].toString());
|
||||
|
||||
if (ii == 0) {
|
||||
m_pGraphicsScene->addItem(pItemGroup);
|
||||
} else if (ii == 1) {
|
||||
m_pGraphicsScene_2->addItem(pItemGroup);
|
||||
}
|
||||
|
||||
temp.channelID = array.at(i)["data"].toString();
|
||||
g_ChannelView.append(temp);
|
||||
}
|
||||
@ -1075,12 +1018,10 @@ void CRealTimeForm::LoadGraphicsConfig(int type)
|
||||
}
|
||||
}
|
||||
}
|
||||
void CRealTimeForm::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
void CRealTimeForm::keyPressEvent(QKeyEvent *event) {
|
||||
//QGraphicsItem::keyPressEvent(event);
|
||||
qDebug() << "键盘按下";
|
||||
if (event->key() == Qt::Key_Delete)
|
||||
{
|
||||
if (event->key() == Qt::Key_Delete) {
|
||||
qDebug() << "press Key_Delete";
|
||||
if (ui->tabWidget->currentIndex() == 0) {
|
||||
QList<QGraphicsItem *> items = m_pGraphicsScene->items();
|
||||
@ -1106,8 +1047,7 @@ void CRealTimeForm::keyPressEvent(QKeyEvent *event)
|
||||
//
|
||||
}
|
||||
|
||||
void CRealTimeForm::UpdateCharacteristic(QVector<_Charateristic>& m_vecCharateristic)
|
||||
{
|
||||
void CRealTimeForm::UpdateCharacteristic(QVector<_Charateristic> &m_vecCharateristic) {
|
||||
QString RPM = "0";
|
||||
if (m_vecCharateristic.size() > 0) {
|
||||
for (int i = 0; i < m_vecCharateristic.size(); i++) {
|
||||
@ -1117,7 +1057,6 @@ void CRealTimeForm::UpdateCharacteristic(QVector<_Charateristic>& m_vecCharateri
|
||||
} else if (ui->tabWidget->currentIndex() == 1) {
|
||||
items = m_pGraphicsScene_2->items();
|
||||
}
|
||||
|
||||
foreach (QGraphicsItem *item, items) {
|
||||
QGraphicsItem *graphicsItem = static_cast<QGraphicsItem *>(item);
|
||||
int itemType = graphicsItem->type();
|
||||
@ -1126,13 +1065,13 @@ void CRealTimeForm::UpdateCharacteristic(QVector<_Charateristic>& m_vecCharateri
|
||||
QGraphicsItemGroup *pGraphicGroupItem = static_cast<QGraphicsItemGroup *>(graphicsItem);
|
||||
channelBaseInfo temp;
|
||||
QString strChannelID = pGraphicGroupItem->data(0).toString();
|
||||
if(strChannelID != m_vecCharateristic[i].ChannelID)
|
||||
if (strChannelID != m_vecCharateristic[i].ChannelID) {
|
||||
continue;
|
||||
}
|
||||
QJsonObject itemjsonObject;
|
||||
QList<QGraphicsItem *> items = pGraphicGroupItem->childItems();
|
||||
QString itemData, itemData2 = "";
|
||||
foreach (QGraphicsItem *item, items) {
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
itemData = item->data(i).toString();
|
||||
if (itemData == "value") {
|
||||
@ -1145,7 +1084,6 @@ void CRealTimeForm::UpdateCharacteristic(QVector<_Charateristic>& m_vecCharateri
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QGraphicsItem *graphicsItem = static_cast<QGraphicsItem *>(item);
|
||||
int itemType = graphicsItem->type();
|
||||
switch (itemType) {
|
||||
@ -1154,7 +1092,6 @@ void CRealTimeForm::UpdateCharacteristic(QVector<_Charateristic>& m_vecCharateri
|
||||
if (itemData == "value") {
|
||||
//qDebug() << strChannelID << "itemData" <<itemData << "itemData2" << itemData2 << m_vecCharateristic[i].speedRPM<<endl;
|
||||
QString str = "";
|
||||
|
||||
if (itemData2 == "转速") {
|
||||
str = QString("%1").arg(QString::number(m_vecCharateristic[i].speedRPM, 'f', m_vecCharateristic[i].ChUnitDot));
|
||||
RPM = str;
|
||||
@ -1194,8 +1131,7 @@ void CRealTimeForm::UpdateCharacteristic(QVector<_Charateristic>& m_vecCharateri
|
||||
(str.toFloat() > g_mapTriggerEvent[strChannelID].DangerOverSetpoint.toFloat() && g_mapTriggerEvent[strChannelID].DangerOver == 1)) {
|
||||
pGraphicTextItem->setDefaultTextColor(QColor(255, 0, 0));
|
||||
flag = 1;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
pGraphicTextItem->setDefaultTextColor(QColor(31, 81, 136));
|
||||
}
|
||||
}
|
||||
@ -1209,21 +1145,19 @@ void CRealTimeForm::UpdateCharacteristic(QVector<_Charateristic>& m_vecCharateri
|
||||
(str.toFloat() > g_mapTriggerEvent[strChannelID].AlertOverSetpoint.toFloat() && g_mapTriggerEvent[strChannelID].AlertOver == 1 \
|
||||
&& g_mapTriggerEvent[strChannelID].DangerOver == 1 && str.toFloat() < g_mapTriggerEvent[strChannelID].DangerOverSetpoint.toFloat())) {
|
||||
pGraphicTextItem->setDefaultTextColor(QColor(255, 165, 0));
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
pGraphicTextItem->setDefaultTextColor(QColor(31, 81, 136));
|
||||
|
||||
}
|
||||
}
|
||||
sigRPM(RPM);
|
||||
pGraphicTextItem->setPlainText(str);
|
||||
}
|
||||
|
||||
}break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1232,13 +1166,11 @@ void CRealTimeForm::UpdateCharacteristic(QVector<_Charateristic>& m_vecCharateri
|
||||
} else if (ui->tabWidget->currentIndex() == 1) {
|
||||
ui->graphicsView_2->update();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CRealTimeForm::ParseCharacteristic(QJsonArray& arrayValue)
|
||||
{
|
||||
void CRealTimeForm::ParseCharacteristic(QJsonArray &arrayValue) {
|
||||
m_vecCharateristic.clear();
|
||||
g_Charateristic.clear();
|
||||
QVector<Charateristic_t>().swap(m_vecCharateristic);
|
||||
@ -1256,7 +1188,6 @@ void CRealTimeForm::ParseCharacteristic(QJsonArray& arrayValue)
|
||||
tempCharateristic.DerivedPeak = arrayValue.at(i)["DerivedPeak"].toDouble();
|
||||
tempCharateristic.DiagnosisPeak = arrayValue.at(i)["DiagnosisPeak"].toDouble();
|
||||
tempCharateristic.DiagnosisPk2Pk = arrayValue.at(i)["DiagnosisPk2Pk"].toDouble();
|
||||
|
||||
tempCharateristic.DirectPK = arrayValue.at(i)["DirectPK"].toDouble();
|
||||
tempCharateristic.FullScalePosition = arrayValue.at(i)["FullScalePosition"].toDouble();
|
||||
tempCharateristic.Gap = arrayValue.at(i)["Gap"].toDouble();
|
||||
@ -1264,13 +1195,11 @@ void CRealTimeForm::ParseCharacteristic(QJsonArray& arrayValue)
|
||||
tempCharateristic.IntegratRMS = arrayValue.at(i)["IntegratRMS"].toDouble();
|
||||
tempCharateristic.MaxValues = arrayValue.at(i)["MaxValues"].toDouble();
|
||||
tempCharateristic.MinValues = arrayValue.at(i)["MinValues"].toDouble();
|
||||
|
||||
tempCharateristic.MonitorPk2Pk = arrayValue.at(i)["MonitorPk2Pk"].toDouble();
|
||||
tempCharateristic.Position = arrayValue.at(i)["Position"].toDouble();
|
||||
tempCharateristic.RmsPkPk2Pk = arrayValue.at(i)["RmsPkPk2Pk"].toDouble();
|
||||
tempCharateristic.SensorEngineeringUnit = arrayValue.at(i)["SensorEngineeringUnit"].toString();
|
||||
tempCharateristic.SensorStatus = arrayValue.at(i)["SensorStatus"].toDouble();
|
||||
|
||||
tempCharateristic.ZeroScalePosition = arrayValue.at(i)["ZeroScalePosition"].toDouble();
|
||||
tempCharateristic.xFullScalePosition = arrayValue.at(i)["xFullScalePosition"].toDouble();
|
||||
tempCharateristic.xProcessVariableName = arrayValue.at(i)["xProcessVariableName"].toString();
|
||||
@ -1283,7 +1212,6 @@ void CRealTimeForm::ParseCharacteristic(QJsonArray& arrayValue)
|
||||
tempCharateristic.channelType = arrayValue.at(i)["ChannelType"].toString();
|
||||
tempCharateristic.InvertAlarm = arrayValue.at(i)["InvertAlarm"].toDouble();
|
||||
tempCharateristic.InvertDanger = arrayValue.at(i)["InvertDanger"].toDouble();
|
||||
|
||||
m_vecCharateristic.push_back(tempCharateristic);
|
||||
g_Charateristic.push_back(tempCharateristic);
|
||||
}
|
||||
@ -1292,8 +1220,7 @@ void CRealTimeForm::ParseCharacteristic(QJsonArray& arrayValue)
|
||||
}
|
||||
|
||||
// 接受服务返回的数据
|
||||
void CRealTimeForm::slotRecieve()
|
||||
{
|
||||
void CRealTimeForm::slotRecieve() {
|
||||
QByteArray arrayReady = m_pSocket->readAll();
|
||||
m_arrayReady += arrayReady;
|
||||
// customLogMessageHandler(QtDebugMsg,m_arrayReady);
|
||||
@ -1318,14 +1245,13 @@ void CRealTimeForm::slotRecieve()
|
||||
// }
|
||||
}
|
||||
|
||||
void CRealTimeForm::disConnect()
|
||||
{
|
||||
void CRealTimeForm::disConnect() {
|
||||
QJsonDocument doc = QJsonDocument::fromJson(m_arrayReady);
|
||||
QJsonObject objec = doc.object();
|
||||
if(m_RealtimeLog == 1)
|
||||
if (m_RealtimeLog == 1) {
|
||||
customLogMessageHandler(QtDebugMsg, QString(QJsonDocument(objec).toJson()));
|
||||
if(objec.contains("cmd"))
|
||||
{
|
||||
}
|
||||
if (objec.contains("cmd")) {
|
||||
QJsonValue arrays_value = objec.take("cmd");
|
||||
//qDebug()<<"cmd ="<<arrays_value.toString();
|
||||
if (arrays_value.toString() == "09") {
|
||||
@ -1357,11 +1283,9 @@ void CRealTimeForm::disConnect()
|
||||
}
|
||||
|
||||
|
||||
void CRealTimeForm::slotNetMgr(QString sAddr, const QVariant &msg)
|
||||
{
|
||||
void CRealTimeForm::slotNetMgr(QString sAddr, const QVariant &msg) {
|
||||
QJsonObject objec = msg.value<QJsonObject>();
|
||||
if(objec.contains("cmd"))
|
||||
{
|
||||
if (objec.contains("cmd")) {
|
||||
QJsonValue arrays_value = objec.take("cmd");
|
||||
//qDebug()<<"cmd ="<<arrays_value.toString();
|
||||
if (arrays_value.toString() == "09") {
|
||||
@ -1378,14 +1302,11 @@ void CRealTimeForm::slotNetMgr(QString sAddr, const QVariant &msg)
|
||||
}
|
||||
}
|
||||
|
||||
void CRealTimeForm::mouseDoubleClickEvent(QMouseEvent* e)
|
||||
{
|
||||
void CRealTimeForm::mouseDoubleClickEvent(QMouseEvent *e) {
|
||||
QGraphicsItem *currentItem = m_pGraphicsScene->focusItem();
|
||||
QGraphicsSceneEvent *mouseEvent = (QGraphicsSceneEvent *)e;
|
||||
qDebug() << "event->type():" << mouseEvent->type();
|
||||
|
||||
if (e->type() == QEvent::MouseButtonDblClick)
|
||||
{
|
||||
if (e->type() == QEvent::MouseButtonDblClick) {
|
||||
qDebug() << "Double Click"; // 注意这里一定要返回true,表示你要过滤该事件原本的实现
|
||||
QList<QGraphicsItem *> items = m_pGraphicsScene->items();
|
||||
foreach (QGraphicsItem *item, items) {
|
||||
@ -1393,7 +1314,6 @@ void CRealTimeForm::mouseDoubleClickEvent(QMouseEvent* e)
|
||||
QGraphicsItem *graphicsItem = static_cast<QGraphicsItem *>(item);
|
||||
if (graphicsItem->isSelected()) {
|
||||
qDebug() << "Double Click Item";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,45 @@ private:
|
||||
QPen pen;
|
||||
|
||||
};
|
||||
class MyGraphicsView : public QGraphicsView
|
||||
{
|
||||
public:
|
||||
MyGraphicsView(QGraphicsScene *scene, QWidget *parent = nullptr) : QGraphicsView(scene, parent) {}
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
QPointF scenePos = mapToScene(event->pos());
|
||||
|
||||
// 查找点击位置的 QGraphicsItem
|
||||
QGraphicsItem *item = scene()->itemAt(scenePos, transform());
|
||||
|
||||
if (item) {
|
||||
// 检查该项目是否是一个 QGraphicsItemGroup
|
||||
QGraphicsItemGroup *group = dynamic_cast<QGraphicsItemGroup*>(item);
|
||||
if (group) {
|
||||
qDebug() << "QGraphicsItemGroup clicked";
|
||||
|
||||
// 在组内项目上改变颜色,表示被选中
|
||||
for (QGraphicsItem *child : group->childItems()) {
|
||||
QGraphicsRectItem *rectItem = dynamic_cast<QGraphicsRectItem*>(child);
|
||||
if (rectItem) {
|
||||
rectItem->setBrush(Qt::blue); // 将颜色设置为蓝色
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qDebug() << "Other QGraphicsItem clicked";
|
||||
}
|
||||
} else {
|
||||
qDebug() << "No item clicked";
|
||||
}
|
||||
}
|
||||
|
||||
// 调用基类的鼠标按下事件处理器
|
||||
QGraphicsView::mousePressEvent(event);
|
||||
}
|
||||
};
|
||||
|
||||
class CRealTimeForm : public QWidget //, public MyItem2
|
||||
{
|
||||
@ -89,7 +127,7 @@ signals:
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent* e);
|
||||
//void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
|
||||
private:
|
||||
Ui::CRealTimeForm *ui;
|
||||
QGraphicsScene* m_pGraphicsScene ;
|
||||
|
||||
15
sqlitedb.cpp
15
sqlitedb.cpp
@ -17,13 +17,23 @@ int SqliteDB::OpenDataBase()
|
||||
QString path = QDir::currentPath();
|
||||
qDebug("currentPath : %s", qPrintable(path));
|
||||
QApplication::addLibraryPath(path);
|
||||
#ifdef Q_OS_WIN32
|
||||
QPluginLoader loader(QString("./plugins/sqldrivers/qsqlite.dll"));
|
||||
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
QPluginLoader loader(QString("./plugins/sqldrivers/qsqlite.so"));
|
||||
#endif
|
||||
|
||||
qDebug() << QSqlDatabase::drivers() << "\r\n";
|
||||
db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
#ifdef Q_OS_LINUX
|
||||
db.setDatabaseName(QCoreApplication::applicationDirPath() + "/config/config.db");
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
db.setDatabaseName(QCoreApplication::applicationDirPath() + "\\config\\config.db");
|
||||
#endif
|
||||
|
||||
if (!db.open())
|
||||
{
|
||||
qDebug() << "Error: Failed to connect database." << database.lastError();
|
||||
@ -73,7 +83,7 @@ int SqliteDB::initTable()
|
||||
strSql = "ALTER TABLE t_TriggerConfig ADD COLUMN 'operate' integer DEFAULT 1";
|
||||
ExeSqlData(strSql);
|
||||
}
|
||||
|
||||
//#ifndef NO_FILTER
|
||||
strSql = QString("select count(*) from %1 where name = '%2' and sql LIKE '%%3%' ")\
|
||||
.arg("sqlite_master").arg("t_ChannelSetting").arg("filterStatus");
|
||||
iRet = ExeSqlData(strSql);
|
||||
@ -81,6 +91,7 @@ int SqliteDB::initTable()
|
||||
strSql = "ALTER TABLE t_ChannelSetting ADD COLUMN 'filterStatus' integer";
|
||||
ExeSqlData(strSql);
|
||||
}
|
||||
//#endif
|
||||
|
||||
CreateDataBase();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user