Merge branch 'font'

# Conflicts:
#	BoardSetting.cpp
#	ChannelList.cpp
#	ChannelSetting.cpp
#	CustomFilter.cpp
#	CustomFilter.h
#	CustomFilter.ui
#	mainwindow.cpp
#	sqlitedb.cpp
This commit is contained in:
zhangsheng 2024-10-24 13:54:15 +08:00
commit 332756c8eb
87 changed files with 3369 additions and 858 deletions

130
Backup.cpp Normal file
View File

@ -0,0 +1,130 @@
#include "Backup.h"
#include "ui_Backup.h"
#include <QFileDialog>
#include <QProcess>
CBackup::CBackup(QWidget *parent) :
QWidget(parent),
ui(new Ui::CBackup)
{
ui->setupUi(this);
backup_path = "";
}
CBackup::~CBackup()
{
delete ui;
}
void CBackup::on_pushButton_path_clicked()
{
QString dirpath = QFileDialog::getExistingDirectory(this, QStringLiteral("选择目录"), "./", QFileDialog::ShowDirsOnly);
if(dirpath.isEmpty()) dirpath = QDir::currentPath();
ui->lineEdit_filepath->setText(dirpath + "/");
backup_path = dirpath;
}
void CBackup::on_pushButton_confirm_clicked()
{
if(ui->lineEdit_filepath->text() == ""){
QMessageBox::information(this,tr("提示"),tr("请选择导出文件路径!"));
return;
}
backup_path = backup_path + "\\config\\";
copyDirectory(QCoreApplication::applicationDirPath() + "\\config\\", backup_path);
QFile file(backup_path+"macbackup");
if (!file.open(QIODevice::ReadWrite)) {
qWarning("Couldn't open file for writing.");
return;
}
QTextStream out(&file);
out << MAC << endl;
file.close();
QMessageBox::information(this,tr("导出"),tr("导出成功!"));
}
int CBackup::ExeSqlData(QString& strSql)
{
QSqlQuery sql_query;
int iRet = -1;
qDebug() << "strSql" << strSql << endl;
if(!sql_query.exec(strSql))
{
qDebug() << sql_query.lastError();
}
else
{
while(sql_query.next())
{
iRet = sql_query.value(0).toInt();
}
}
return iRet;
}
bool CBackup::copyFile(const QString &sourceFile, const QString &destinationFile)
{
QFile srcFile(sourceFile);
QFile dstFile(destinationFile);
if (!srcFile.exists()) {
qDebug() << "Source file does not exist:" << sourceFile;
return false;
}
if (!srcFile.open(QIODevice::ReadOnly)) {
qDebug() << "Unable to open source file for reading:" << sourceFile;
return false;
}
if (!dstFile.open(QIODevice::WriteOnly)) {
srcFile.close();
qDebug() << "Unable to open destination file for writing:" << destinationFile;
return false;
}
dstFile.write(srcFile.readAll());
srcFile.close();
dstFile.close();
return true;
}
bool CBackup::copyDirectory(const QString &sourceDir, const QString &destinationDir) {
QDir srcDir(sourceDir);
QDir destDir(destinationDir);
// 如果目标文件夹已存在,则删除它
if (destDir.exists()) {
destDir.removeRecursively();
}
// 创建目标文件夹
if (!destDir.mkpath(".")) {
qDebug() << "无法创建目标文件夹";
return false;
}
// 复制文件
foreach (const QFileInfo &fileInfo, srcDir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot)) {
QString fileName = fileInfo.fileName();
QString srcFilePath = srcDir.absoluteFilePath(fileName);
QString destFilePath = destDir.absoluteFilePath(fileName);
if (fileInfo.isDir()) {
// 递归复制子文件夹
if (!copyDirectory(srcFilePath, destFilePath)) {
return false;
}
} else {
// 复制文件
if (!QFile::copy(srcFilePath, destFilePath)) {
qDebug() << "无法复制文件" << srcFilePath << "" << destFilePath;
return false;
}
}
}
return true;
}

36
Backup.h Normal file
View File

@ -0,0 +1,36 @@
#ifndef BACKUP_H
#define BACKUP_H
#include <QWidget>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include "global.h"
namespace Ui {
class CBackup;
}
class CBackup : public QWidget
{
Q_OBJECT
public:
explicit CBackup(QWidget *parent = nullptr);
~CBackup();
private slots:
void on_pushButton_path_clicked();
void on_pushButton_confirm_clicked();
private:
Ui::CBackup *ui;
QString backup_path;
QSqlDatabase database;
int CreateDataBase();
int ExeSqlData(QString& strSql);
bool copyFile(const QString &sourceFile, const QString &destinationFile);
bool copyDirectory(const QString &sourceDir, const QString &destinationDir);
};
#endif // BACKUP_H

150
Backup.ui Normal file
View File

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CBackup</class>
<widget class="QWidget" name="CBackup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>711</width>
<height>169</height>
</rect>
</property>
<property name="windowTitle">
<string>配置导出</string>
</property>
<property name="styleSheet">
<string notr="true">font: 10pt &quot;黑体&quot;;
color: rgb(27, 30, 35);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>请填写导出信息</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="lineEdit_filepath">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_path">
<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_path { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_path:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_path:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_path: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>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_confirm">
<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_confirm { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_confirm:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_confirm:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_confirm:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<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>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -33,7 +33,13 @@ CBoardSetting::~CBoardSetting()
void CBoardSetting::initReadConfig()
{
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitBoardsInfo.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
QFile loadFile(name);
if(!loadFile.open(QIODevice::ReadOnly))
{
@ -292,7 +298,13 @@ void CBoardSetting::PushData()
qDebug() << UnitBoardsInfoObj << endl;
QJsonDocument jsonDoc;
jsonDoc.setObject(UnitBoardsInfoObj);
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitBoardsInfo.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
QFile file(name);
file.open(QIODevice::WriteOnly);
file.write(jsonDoc.toJson());
@ -447,7 +459,13 @@ void CBoardSetting::PushData()
QJsonDocument jsonDoc2;
jsonDoc2.setObject(WorkConditionsInfoObj);
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\UnitWorkConditionsInfo.json";
#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);
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());
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
QString fileNameUnit2 = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations2.json";
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
QString fileNameTri = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings.json";
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
QString fileNameTri2 = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings2.json";
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);
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitBoardsInfo.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
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);
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\UnitWorkConditionsInfo.json";
#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,22 @@ void CBoardSetting::on_pushButton_Init_clicked()
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
// g_FtpClient->UpLoadFile(name,"UnitBoardsInfo.json");
customLogMessageHandler(QtDebugMsg,"初始化机组板卡配置信息推送完成!");
<<<<<<< HEAD
=======
#ifndef NO_FILTER
>>>>>>> font
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);
<<<<<<< HEAD
=======
#endif
>>>>>>> font
putJson();
}
@ -1065,7 +1142,13 @@ void CBoardSetting::putJson()
}
QJsonDocument jsonDoc;
jsonDoc.setArray(channelArray);
QString name = QCoreApplication::applicationDirPath() + "\\config\\ChannelSettings.json";
#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());

View File

@ -65,12 +65,8 @@ CChannelList::CChannelList(QWidget *parent) :
ui->tableView->setColumnWidth(33, 256);
m_nCurRow = -1;
SlowSpeeddialog = new CSlowSpeedChannelSetting();
connect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
ChannelSettingdialog = new CChannelSetting();
connect(ChannelSettingdialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
SlowSpeeddialog = new CSlowSpeedChannelSetting();
connect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
ui->comboBox_operate->addItem("通道");
ui->comboBox_operate->addItem("带通滤波");
ui->comboBox_operate->addItem("带通滤波");
@ -83,6 +79,12 @@ CChannelList::CChannelList(QWidget *parent) :
#ifdef QT_DEBUG
initReadConfig();
#endif
<<<<<<< HEAD
=======
#ifdef NO_FILTER
initReadConfig();
#endif
>>>>>>> font
}
@ -178,6 +180,10 @@ 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&)));
<<<<<<< HEAD
=======
#ifndef NO_FILTER
>>>>>>> font
QJsonObject sendData;
sendData["cmd"] = "97";
QJsonArray chan_list;
@ -190,6 +196,10 @@ void CChannelList::iniConnect()
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
req.setUrl(sUrl);
g_NetMgr->PostJson(req,sendData);
<<<<<<< HEAD
=======
#endif
>>>>>>> font
}
void CChannelList::createItem(QStringList filename)
@ -267,9 +277,13 @@ void CChannelList::itemChangedSlot(QStandardItem *item)
myHeader->onStateChanged(state);
}
}
void CChannelList::slotChannelSettingClose()
{
on_pushButton_refresh_clicked();
}
void CChannelList::slotSetChannelData(ChannelSetting channelSetting)
{
qDebug() << "slotSetChannelData" << endl;
int i;
for (i = 0;i <g_channelSetting.size() ; i++) {
if(g_channelSetting[i].channelId == channelSetting.channelId){
@ -365,6 +379,7 @@ void CChannelList::slotSetChannelData(ChannelSetting channelSetting)
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
putJson();
//disconnect(ChannelSettingdialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
@ -477,7 +492,13 @@ void CChannelList::putJson()
}
QJsonDocument jsonDoc;
jsonDoc.setArray(channelArray);
QString name = QCoreApplication::applicationDirPath() + "\\config\\ChannelSettings.json";
#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());
@ -540,20 +561,26 @@ void CChannelList::slotRowDoubleClicked(const QModelIndex &index)
if(g_channelSetting[m_nCurRow].boardType.toInt() == 1 && g_channelSetting[i].channelId == g_channelSetting[m_nCurRow].channelId){//开入开出板卡
SlowSpeeddialog->channelSetting = g_channelSetting[i];
SlowSpeeddialog->setWindowModality(Qt::ApplicationModal);
SlowSpeeddialog->displayChannelSetting();
SlowSpeeddialog->show();
SlowSpeeddialog = new CSlowSpeedChannelSetting();
connect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
SlowSpeeddialog->channelSetting = g_channelSetting[i];
SlowSpeeddialog->setWindowModality(Qt::ApplicationModal);
SlowSpeeddialog->displayChannelSetting();
SlowSpeeddialog->show();
}
else if(g_channelSetting[m_nCurRow].boardType.toInt() > 1 && g_channelSetting[m_nCurRow].boardType.toInt() < 5 && g_channelSetting[i].channelId == g_channelSetting[m_nCurRow].channelId){//高速板卡
qDebug() << g_channelSetting[m_nCurRow].boardType << g_channelSetting[i].channelId << g_channelSetting[m_nCurRow].channelId<< endl;
ChannelSettingdialog = new CChannelSetting();
connect(ChannelSettingdialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
connect(ChannelSettingdialog, SIGNAL(ChannelSettingClose_sg()), this, SLOT(slotChannelSettingClose()));
ChannelSettingdialog->channelSetting = g_channelSetting[i];
ChannelSettingdialog->setWindowModality(Qt::ApplicationModal);
ChannelSettingdialog->displayChannelSetting();
ChannelSettingdialog->show();
}else if((g_channelSetting[m_nCurRow].boardType.toInt() == 5) && g_channelSetting[i].channelId == g_channelSetting[m_nCurRow].channelId){//低速板卡
SlowSpeeddialog = new CSlowSpeedChannelSetting();
connect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
SlowSpeeddialog->channelSetting = g_channelSetting[i];
SlowSpeeddialog->setWindowModality(Qt::ApplicationModal);
SlowSpeeddialog->displayChannelSetting();
@ -632,7 +659,12 @@ void CChannelList::on_pushButton_open_clicked()
}
}
putJson();
<<<<<<< HEAD
}else if(ui->comboBox_operate->currentText() == "带通滤波"){
=======
}else if(ui->comboBox_operate->currentText() == "带通滤波")
{
>>>>>>> font
QJsonArray channleList;
for (int i = 0; i < model->rowCount(); i++) {
QModelIndex indexCheck = model->index(i,0);
@ -696,6 +728,10 @@ 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&)));
<<<<<<< HEAD
=======
#ifndef NO_FILTER
>>>>>>> font
QJsonObject sendData;
sendData["cmd"] = "97";
QJsonArray chan_list;
@ -707,6 +743,15 @@ 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);
<<<<<<< HEAD
=======
#else
initReadConfig();
#endif
#ifdef QT_DEBUG
initReadConfig();
#endif
>>>>>>> font
}
void CChannelList::slotNetMgr(QString sAddr, const QVariant &msg)
@ -734,7 +779,13 @@ void CChannelList::slotNetMgr(QString sAddr, const QVariant &msg)
}
}
}
<<<<<<< HEAD
initReadConfig();
=======
#ifndef NO_FILTER
initReadConfig();
#endif
>>>>>>> font
}
}
disconnect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));

View File

@ -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"
@ -29,6 +29,7 @@ public slots:
void on_columnSectionClicked(int column, bool checked);
void slotSetChannelData(ChannelSetting channelSetting);
void slotChannelSettingClose();
private:
Ui::CChannelList *ui;
QStandardItemModel *m_pModel; //数据模型对象指针

View File

@ -56,7 +56,7 @@ CChannelSetting::CChannelSetting(QWidget *parent) :
QStringList strSensorList;
strSensorList << "电涡流传感器" << "低频位移" << "IEPE型传感器" ;
strSensorList << "电涡流传感器" << "低频位移" << "IEPE型传感器" << "速度型传感器" ;
ui->comboBox_sensorType->addItems(strSensorList);
QStringList ChannelTypeList;
ChannelTypeList << "转速" << "径向振动位移" << "轴向位移" << "加速度" << "速度" << "动态电压";
@ -85,10 +85,14 @@ CChannelSetting::CChannelSetting(QWidget *parent) :
ui->comboBox_tachAutoTach->addItems(m_itemList);
ui->comboBox_samplingRate_2->addItems(strListFs);
ui->comboBox_sensorRangeCheck_2->addItems(m_itemList);
setAttribute(Qt::WA_DeleteOnClose);//使能析构函数调用
}
CChannelSetting::~CChannelSetting()
{
qDebug() << "~CChannelSetting" << endl;
emit ChannelSettingClose_sg();
delete ui;
}
@ -603,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");
@ -658,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 == "轴向位移"){
@ -687,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");
@ -751,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',\
@ -771,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).\
@ -791,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);
@ -804,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();
}
@ -824,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");
}
}
@ -841,10 +850,14 @@ void CChannelSetting::on_pushButton_CustomFilter_clicked()
CustomFilter *pCustomFilter = new CustomFilter();
pCustomFilter->channel_ID = channelSetting.channelId;
<<<<<<< HEAD
if(ui->channelTypeCombox->currentText()=="径向振动位移" && ui->comboBox_sensorType->currentText() =="低频位移")
pCustomFilter->vibrate_channel = 1;
else
pCustomFilter->vibrate_channel = 0;
=======
pCustomFilter->vibrate_channel = 1;
>>>>>>> font
pCustomFilter->setWindowModality(Qt::ApplicationModal);
pCustomFilter->show();
pCustomFilter->getfilterInfo();

View File

@ -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;
@ -52,7 +52,7 @@ private:
signals:
void sgSetChannelData(ChannelSetting);
void ChannelSettingClose_sg();
};
#endif // CHANNELSETTING_H

View File

@ -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); //选中行
@ -41,7 +42,9 @@ void CCharacteristicList::InitTable()
ui->tableView->setAlternatingRowColors(true);
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->setColumnWidth(0, 300);
ui->tableView->setColumnWidth(4, 200);
ui->tableView->setColumnWidth(4, 160);
ui->tableView->setColumnWidth(5, 160);
ui->tableView->setColumnWidth(6, 200);
// for (int i = 0;i < g_ChannelView.size(); i++)
// {
@ -83,10 +86,12 @@ void CCharacteristicList::DisPlayCharacteristic()
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].DCValues,'f',g_Charateristic[j].ChUnitDot));
}
model->setData(model->index(j,3,QModelIndex()),QString::number(g_Charateristic[j].DiagnosisPk2Pk,'f',g_Charateristic[j].ChUnitDot));
model->setData(model->index(j,4,QModelIndex()),g_Charateristic[j].xFullScalePosition);
model->setData(model->index(j,5,QModelIndex()),QString::number(g_Charateristic[j].Gap,'f',g_Charateristic[j].ChUnitDot));
model->setData(model->index(j,6,QModelIndex()),g_Charateristic[j].ZeroScalePosition);
model->setData(model->index(j,7,QModelIndex()),g_Charateristic[j].SensorStatus);
model->setData(model->index(j,4,QModelIndex()),g_Charateristic[j].InvertDanger);
model->setData(model->index(j,5,QModelIndex()),g_Charateristic[j].InvertAlarm);
model->setData(model->index(j,6,QModelIndex()),g_Charateristic[j].xFullScalePosition);
model->setData(model->index(j,7,QModelIndex()),QString::number(g_Charateristic[j].Gap,'f',g_Charateristic[j].ChUnitDot));
model->setData(model->index(j,8,QModelIndex()),g_Charateristic[j].ZeroScalePosition);
model->setData(model->index(j,9,QModelIndex()),g_Charateristic[j].SensorStatus);
}
}
}

View File

@ -3,7 +3,7 @@
#include <QWidget>
#include <QStandardItemModel> //数据模型类
#include "HeaderView.h"
//#include "HeaderView.h"
#include "TableHeaderView.h"
#include "global.h"
#include <QTimer> //定时器类

View File

@ -31,6 +31,8 @@ CConfiguration::CConfiguration(QWidget *parent) :
pHeader2->setSectionResizeMode(QHeaderView::ResizeToContents);
pHeader2->setStretchLastSection(false);
ui->treeView_Available->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->treeView_Relay->setEditTriggers(QAbstractItemView::NoEditTriggers);
connect(ui->comboBox_WC,SIGNAL(currentTextChanged(const QString &)),this,SLOT(on_comboBox_WC_currentTextChanged2(const QString&)));
}
@ -87,8 +89,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
QString name = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings.json";
QFile loadFile(name);
if(!loadFile.open(QIODevice::ReadOnly))
{
@ -153,6 +160,10 @@ void CConfiguration::Init()
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 + "-" + "高于警报值"));
@ -187,7 +198,13 @@ void CConfiguration::Init()
void CConfiguration::LoadConfiguration()
{
QString name = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations.json";
#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))
{
@ -459,6 +476,7 @@ QJsonObject CConfiguration::SelectChannel(int channelNo)
ConfiguraitonsObj["ChannelId"] = g_ChannelBaseInfo[i].channelID;
ConfiguraitonsObj["ChannelName"] = g_ChannelBaseInfo[i].channelName;
ConfiguraitonsObj["ChannelNoInBoard"] = g_ChannelBaseInfo[i].channelNoInBoard;
ConfiguraitonsObj["DelaySeconds"] = ui->lineEdit_delay->text();
ConfiguraitonsObj["ChannelOperate"] = -1;
}
}
@ -733,6 +751,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 + "-" + "高于警报值"));
@ -792,11 +814,23 @@ void CConfiguration::PushData()
QJsonDocument jsonDoc;
jsonDoc.setObject(WorkConditionConfiguraitonsObj);
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations.json";
#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);
QString fileName2 = QCoreApplication::applicationDirPath() + "\\config\\UnitConfigurations2.json";
#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);
@ -892,6 +926,7 @@ void CConfiguration::ViewRelay(int ChannelNoInBoard)
ui->lineEdit_2->setText(strSecondDelaySeconds);
for (int j = 0;j < tempArray.size() ;j++ ) {
if(tempArray.at(j)["ChannelNoInBoard"] == ChannelNoInBoard){
ui->lineEdit_delay->setText(tempArray.at(j)["DelaySeconds"].toString());
QJsonArray tempArray2 = tempArray.at(j)["logicExpress"].toArray();
for (int k = 0; k < tempArray2.size(); k++) {
QJsonObject tempObj2 = tempArray2[k].toObject();
@ -1095,6 +1130,7 @@ void CConfiguration::on_radioButton_1_clicked()
{
m_curentRLY = 3;
ui->label_3->setText(ui->radioButton_1->text()+"");
ViewRelay(3);
}
@ -1102,6 +1138,7 @@ void CConfiguration::on_radioButton_1_clicked()
void CConfiguration::on_radioButton_2_clicked()
{
m_curentRLY = 4;
ui->label_3->setText(ui->radioButton_2->text()+"");
ViewRelay(4);
}
@ -1109,6 +1146,7 @@ void CConfiguration::on_radioButton_2_clicked()
void CConfiguration::on_radioButton_3_clicked()
{
m_curentRLY = 5;
ui->label_3->setText(ui->radioButton_3->text()+"");
ViewRelay(5);
}
@ -1116,6 +1154,7 @@ void CConfiguration::on_radioButton_3_clicked()
void CConfiguration::on_radioButton_4_clicked()
{
m_curentRLY = 6;
ui->label_3->setText(ui->radioButton_4->text()+"");
ViewRelay(6);
}
@ -1123,6 +1162,7 @@ void CConfiguration::on_radioButton_4_clicked()
void CConfiguration::on_radioButton_5_clicked()
{
m_curentRLY = 7;
ui->label_3->setText(ui->radioButton_5->text()+"");
ViewRelay(7);
}
@ -1130,6 +1170,7 @@ void CConfiguration::on_radioButton_5_clicked()
void CConfiguration::on_radioButton_6_clicked()
{
m_curentRLY = 8;
ui->label_3->setText(ui->radioButton_6->text()+"");
ViewRelay(8);
}
@ -1137,6 +1178,7 @@ void CConfiguration::on_radioButton_6_clicked()
void CConfiguration::on_radioButton_8_clicked()
{
m_curentRLY = 10;
ui->label_3->setText(ui->radioButton_8->text()+"");
ViewRelay(10);
}
@ -1144,6 +1186,7 @@ void CConfiguration::on_radioButton_8_clicked()
void CConfiguration::on_radioButton_7_clicked()
{
m_curentRLY = 9;
ui->label_3->setText(ui->radioButton_7->text()+"");
ViewRelay(9);
}
@ -1151,6 +1194,7 @@ void CConfiguration::on_radioButton_7_clicked()
void CConfiguration::on_radioButton_9_clicked()
{
m_curentRLY = 11;
ui->label_3->setText(ui->radioButton_9->text()+"");
ViewRelay(11);
}
@ -1158,6 +1202,7 @@ void CConfiguration::on_radioButton_9_clicked()
void CConfiguration::on_radioButton_10_clicked()
{
m_curentRLY = 12;
ui->label_3->setText(ui->radioButton_10->text()+"");
ViewRelay(12);
}

View File

@ -392,7 +392,7 @@ color: rgb(27, 30, 35);</string>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>第二层延时:</string>
<string>工况延时:</string>
</property>
</widget>
</item>
@ -437,6 +437,45 @@ color: rgb(27, 30, 35);</string>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>- -</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_delay">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>S</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5"/>
</item>

View File

@ -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);
}
}

View File

@ -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

View File

@ -119,8 +119,8 @@ void CCopyDatFile::on_pushButton_refresh_clicked()
ui -> treeWidget_dist ->clear();
ftp -> cd("/run/media/");
ui->label_path->setText("/run/media/");
m_strDistPwd = "";
m_strDistPwd = "/run/media/";
m_strDistPath = "";
m_strDistPath = "/run/media/";
ftp->list();
}
@ -133,10 +133,10 @@ void CCopyDatFile::processItem(QTreeWidgetItem *item, int /*column*/)
currentPath += '/';
currentPath += name;
ftp->cd(name);
m_strDistPwd = "";
m_strDistPath = "";
m_strDistPwd = "/run/media" + currentPath;
ui->label_path->setText(m_strDistPwd);
m_strDistPath = "/run/media" + currentPath;
ui->label_path->setText(m_strDistPath);
currentPath = "";
ftp->list();
return;
@ -153,7 +153,7 @@ void CCopyDatFile::slotCopyItem()
allObj.insert("cmd", "100");
cmdBody.insert("subcmd",1);
cmdBody.insert("srcfile",str);
cmdBody.insert("dstdirectory",m_strDistPwd);
cmdBody.insert("dstdirectory",m_strDistPath);
allObj["cmdBody"] = cmdBody;
QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
@ -179,7 +179,7 @@ void CCopyDatFile::on_pushButton_exit_clicked()
QJsonObject allObj,cmdBody;
allObj.insert("cmd", "100");
cmdBody.insert("subcmd",3);
cmdBody.insert("dstdirectory",m_strDistPwd);
cmdBody.insert("dstdirectory",m_strDistPath);
allObj["cmdBody"] = cmdBody;
QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);

View File

@ -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>
@ -42,7 +42,7 @@ private:
QFtp *ftp = nullptr;
QStandardItemModel *model;
QString currentPath;
QString m_strDistPwd;
QString m_strDistPath;
QAction *copyAction;
};

View File

@ -92,7 +92,11 @@ void CustomFilter::on_pushButton_Submit_clicked()
type = false;
}
<<<<<<< HEAD
if(ui->spinBox_start->text().toInt() >= ui->spinBox_stop->text().toInt()){
=======
if(ui->doubleSpinBox_start->text().toDouble() >= ui->doubleSpinBox_stop->text().toDouble()){
>>>>>>> font
QMessageBox::warning(this, QStringLiteral("提示"), QStringLiteral("频率下限设置错误!"));
return;
}
@ -100,10 +104,18 @@ void CustomFilter::on_pushButton_Submit_clicked()
sendData2["cmd"] = "95";
sendData2["chan_id"] = channel_ID;
sendData2["open"] = type;
<<<<<<< HEAD
sendData2["start"] = ui->spinBox_start->text().toInt();
sendData2["stop"] = ui->spinBox_stop->text().toInt();
req.setUrl(sUrl);
g_NetMgr->PostJson(req,sendData2);
=======
sendData2["start"] = ui->doubleSpinBox_start->text().toDouble();
sendData2["stop"] = ui->doubleSpinBox_stop->text().toDouble();
req.setUrl(sUrl);
g_NetMgr->PostJson(req,sendData2);
this->close();
>>>>>>> font
}
void CustomFilter::slotNetMgr(QString sAddr, const QVariant &msg)
@ -122,13 +134,23 @@ void CustomFilter::slotNetMgr(QString sAddr, const QVariant &msg)
if(arrays_value.toString() == "94"){
int Statusfilter = objec.take("status").toInt();
<<<<<<< HEAD
ui->spinBox_start->setValue(objec.take("start").toInt());
ui->spinBox_stop->setValue(objec.take("stop").toInt());
=======
ui->doubleSpinBox_start->setValue(objec.take("start").toDouble());
ui->doubleSpinBox_stop->setValue(objec.take("stop").toDouble());
>>>>>>> font
if(Statusfilter){
ui->comboBox_open->setCurrentText("");
}else if(!Statusfilter){
ui->comboBox_open->setCurrentText("");
<<<<<<< HEAD
=======
ui->doubleSpinBox_start->setEnabled(false);
ui->doubleSpinBox_stop->setEnabled(false);
>>>>>>> font
}
QMessageBox::information(this, QStringLiteral("提示"), QStringLiteral("获取成功!"));
}else if(arrays_value.toString() == "98"){
@ -145,13 +167,23 @@ void CustomFilter::slotNetMgr(QString sAddr, const QVariant &msg)
QMessageBox::information(this, QStringLiteral("提示"), QStringLiteral("获取成功!"));
}else if(arrays_value.toString() == "112"){
int Statusfilter = objec.take("status").toInt();
<<<<<<< HEAD
ui->spinBox_start->setValue(objec.take("start").toInt());
ui->spinBox_stop->setValue(objec.take("stop").toInt());
=======
ui->doubleSpinBox_start->setValue(objec.take("start").toDouble());
ui->doubleSpinBox_stop->setValue(objec.take("stop").toDouble());
>>>>>>> font
if(Statusfilter){
ui->comboBox_open->setCurrentText("");
}else if(!Statusfilter){
ui->comboBox_open->setCurrentText("");
<<<<<<< HEAD
=======
ui->doubleSpinBox_start->setEnabled(false);
ui->doubleSpinBox_stop->setEnabled(false);
>>>>>>> font
}
int num = objec["num"].toInt();
int j = 0;
@ -170,8 +202,13 @@ void CustomFilter::slotNetMgr(QString sAddr, const QVariant &msg)
}
if(!vibrate_channel){
ui->comboBox_open->setEnabled(false);
<<<<<<< HEAD
ui->spinBox_start->setEnabled(false);
ui->spinBox_stop->setEnabled(false);
=======
ui->doubleSpinBox_start->setEnabled(false);
ui->doubleSpinBox_stop->setEnabled(false);
>>>>>>> font
}
}
@ -189,7 +226,19 @@ void CustomFilter::getfilterInfo()
}
<<<<<<< HEAD
void CustomFilter::comboBox_open_currentTextChanged(const QString &)
{
qDebug() << "" << endl;
=======
void CustomFilter::comboBox_open_currentTextChanged(const QString &str)
{
if(str == ""){
ui->doubleSpinBox_start->setEnabled(false);
ui->doubleSpinBox_stop->setEnabled(false);
}else if(str == ""){
ui->doubleSpinBox_start->setEnabled(true);
ui->doubleSpinBox_stop->setEnabled(true);
}
>>>>>>> font
}

View File

@ -28,7 +28,11 @@ private slots:
void on_pushButton_Submit_clicked();
void slotNetMgr(QString sAddr,const QVariant& msg);
<<<<<<< HEAD
void comboBox_open_currentTextChanged(const QString &);
=======
void comboBox_open_currentTextChanged(const QString &str);
>>>>>>> font
private:
Ui::CustomFilter *ui;
TableHeaderView *myHeader;

View File

@ -94,6 +94,7 @@ color: rgb(27, 30, 35);</string>
</widget>
</item>
<item>
<<<<<<< HEAD
<widget class="QSpinBox" name="spinBox_start">
<property name="minimumSize">
<size>
@ -103,6 +104,11 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximum">
<number>9999</number>
=======
<widget class="QDoubleSpinBox" name="doubleSpinBox_start">
<property name="maximum">
<double>999999.989999999990687</double>
>>>>>>> font
</property>
</widget>
</item>
@ -138,6 +144,7 @@ color: rgb(27, 30, 35);</string>
</widget>
</item>
<item>
<<<<<<< HEAD
<widget class="QSpinBox" name="spinBox_stop">
<property name="minimumSize">
<size>
@ -150,6 +157,17 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="value">
<number>200</number>
=======
<widget class="QDoubleSpinBox" name="doubleSpinBox_stop">
<property name="decimals">
<number>2</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>999999.989999999990687</double>
>>>>>>> font
</property>
</widget>
</item>
@ -196,7 +214,15 @@ color: rgb(27, 30, 35);</string>
<widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<<<<<<< HEAD
<widget class="QTableView" name="tableView"/>
=======
<widget class="QTableView" name="tableView">
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
>>>>>>> font
</item>
</layout>
</widget>

View File

@ -15,7 +15,10 @@ CDIO_Board::CDIO_Board(QWidget *parent) :
Init();
CRealTimeForm *pRealTime = new CRealTimeForm();
connect(pRealTime,SIGNAL(sigDOStatus(QJsonArray&,QJsonArray&)), this, SLOT(slotDOStatus(QJsonArray&,QJsonArray&)));
if(g_strIOControl == "1"){
ui->pushButton_Close->setEnabled(1);
ui->pushButton_Open->setEnabled(1);
}
}
@ -135,6 +138,18 @@ void CDIO_Board::Init()
void CDIO_Board::on_pushButton_Close_clicked()
{
QMessageBox:: StandardButton iResult = QMessageBox::question(this, QStringLiteral("提示"),
QStringLiteral("确认后将关闭选择的开出通道!"),
QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
switch (iResult) {
case QMessageBox::Yes:
break;
case QMessageBox::No:
return;
break;
default:
break;
}
QJsonObject allObj,cmdBody,itemObj,DOContralObj;
QJsonArray arrayBody;
allObj.insert("cmd", "91");
@ -238,6 +253,18 @@ void CDIO_Board::on_pushButton_Open_clicked()
// ]
// }
// }
QMessageBox:: StandardButton iResult = QMessageBox::question(this, QStringLiteral("提示"),
QStringLiteral("确认后将打开选择的开出通道!"),
QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
switch (iResult) {
case QMessageBox::Yes:
break;
case QMessageBox::No:
return;
break;
default:
break;
}
QJsonObject allObj,cmdBody,itemObj,DOContralObj;
QJsonArray arrayBody;
allObj.insert("cmd", "91");

View File

@ -1086,6 +1086,9 @@ color: rgb(27, 30, 35);
<layout class="QHBoxLayout" name="horizontalLayout_30">
<item>
<widget class="QPushButton" name="pushButton_Close">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>120</width>
@ -1118,6 +1121,9 @@ color: rgb(27, 30, 35);
</item>
<item>
<widget class="QPushButton" name="pushButton_Open">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>120</width>

View File

@ -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();

View File

@ -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.
@ -29,6 +28,7 @@ CONFIG += c++11
SOURCES += \
AddChannel.cpp \
AlarmDetails.cpp \
Backup.cpp \
CharacteristicList.cpp \
Configuration.cpp \
CopyChannelSetting.cpp \
@ -38,6 +38,7 @@ SOURCES += \
DataGraphView.cpp \
FileServerConfig.cpp \
HistoryAlarm.cpp \
ImportConfig.cpp \
Mqttclient.cpp \
MyTreeView.cpp \
NTPServerConfig.cpp \
@ -80,6 +81,7 @@ SOURCES += \
HEADERS += \
AddChannel.h \
AlarmDetails.h \
Backup.h \
CharacteristicList.h \
Configuration.h \
CopyChannelSetting.h \
@ -89,6 +91,7 @@ HEADERS += \
DataGraphView.h \
FileServerConfig.h \
HistoryAlarm.h \
ImportConfig.h \
Mqttclient.h \
MyTreeView.h \
NTPServerConfig.h \
@ -131,6 +134,8 @@ HEADERS += \
FORMS += \
AddChannel.ui \
AlarmDetails.ui \
BackUp.ui \
Backup.ui \
CharacteristicList.ui \
Configuration.ui \
CopyChannelSetting.ui \
@ -140,6 +145,7 @@ FORMS += \
DataGraphView.ui \
FileServerConfig.ui \
HistoryAlarm.ui \
ImportConfig.ui \
NTPServerConfig.ui \
OtherConfig.ui \
PSConfig.ui \
@ -175,9 +181,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

View File

@ -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");
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\NetWorkConfig.json";
#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
fileName = QCoreApplication::applicationDirPath() + "\\config\\ServerConfig.json";
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
fileName = QCoreApplication::applicationDirPath() + "\\config\\TcpConfig.json";
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
fileName = QCoreApplication::applicationDirPath() + "\\config\\ModbusConfig.json";
if(!fileName.isEmpty())
{
QFile file(fileName);
@ -190,7 +211,13 @@ void CFileServerConfig::on_pushButtonPush_clicked()
QJsonDocument jsonDoc;
jsonDoc.setObject(netWorkObj);
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\NetWorkConfig.json";
#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);
fileName = QCoreApplication::applicationDirPath() + "\\config\\ServerConfig.json";
#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);
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\TcpConfig.json";
#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);
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ModbusConfig.json";
#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());

View File

@ -6,29 +6,26 @@
#include "AlarmDetails.h"
#include "ftpclient.h"
#include "global.h"
#include "NetMgr.h"
CHistoryAlarm::CHistoryAlarm(QWidget *parent) :
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("/");
QString strPath = QCoreApplication::applicationDirPath() + "\\dat\\" + strList[5];
#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,65 @@ 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;
}
QStringList strListFileName;
QString strChannelName;
QVector<TriggerEvent_t> vecTriggerEvent;
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();
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]);
QString strCol = "triggeredFileName";
QString strTableName = QString("t_TriggerEvent ORDER BY ABS(triggeredTime - %1) LIMIT 1").arg(timestamp);
QString strFileName = g_SqliteDB->GetSingelLine(strTableName,strCol);
strFileName = strFileName.left(strFileName.size()-1);
strListFileName = strFileName.split("/");
g_SqliteDB->DeleteDataW(strTableNameAlarm,strWhere1);
g_SqliteDB->DeleteDataW(strTableNameTriger,strWhere2);
}
}
QJsonObject allObj,cmdBody;
QJsonArray arrayFileName;
allObj.insert("cmd", "40");
cmdBody.insert("type","ARRAY");
arrayFileName.append(strChannelName);
cmdBody.insert("fileName",strListFileName[5]);
allObj["cmdBody"] = cmdBody;
QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
req.setUrl(sUrl);
g_NetMgr->PostJson(req,allObj);
QString dat_path = QCoreApplication::applicationDirPath() + "\\dat\\" + strListFileName[5];
QDir datDir(dat_path);
if (datDir.exists()) {
datDir.removeRecursively();
}
on_pushButton_search_clicked();
}

View File

@ -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;

View File

@ -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>

337
ImportConfig.cpp Normal file
View File

@ -0,0 +1,337 @@
#include "ImportConfig.h"
#include "ui_ImportConfig.h"
#include <QFileDialog>
#include <QProcess>
#include "sqlitedb.h"
CImportConfig::CImportConfig(QWidget *parent) :
QWidget(parent),
ui(new Ui::CImportConfig)
{
ui->setupUi(this);
}
CImportConfig::~CImportConfig()
{
delete ui;
}
void CImportConfig::on_pushButton_importpath_clicked()
{
QString dirpath = QFileDialog::getExistingDirectory(this, QStringLiteral("选择目录"), "./", QFileDialog::ShowDirsOnly);
if(dirpath.isEmpty()) dirpath = QDir::currentPath();
ui->lineEdit_filepath->setText(dirpath + "/");
import_path = dirpath;
}
void CImportConfig::on_pushButton_confirm_clicked()
{
if(ui->lineEdit_filepath->text() == ""){
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);
// 创建目标文件夹
if (!copyDir.mkpath(".")) {
qDebug() << "无法创建目标文件夹";
return;
}
copyDirectory(import_path, copy_path);
QFile fileMAC(copy_path+"macbackup");
if (!fileMAC.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug() << "无法打开文件";
return;
}
QTextStream in(&fileMAC);
QString oldMAC= "";
while (!in.atEnd()) {
oldMAC = in.readLine();
qDebug() << oldMAC;
}
fileMAC.close();
QFile sourceFile(copy_path + "config.db");
// if (!sourceFile.copy(copy_path + "\\config.db")) {
// QMessageBox::question(NULL, "提示", "导入数据库失败!");
// return;
// }
qDebug() << QSqlDatabase::drivers() << "\r\n";
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(copy_path + "config.db");
if (!db.open())
{
qDebug() << "Error: Failed to connect database." << database.lastError();
return ;
}
QString strSql = QString("update t_ChannelSetting SET channelId = '%1' || SUBSTR(channelId, 13),dataWatchNo='%2';").arg(MAC).arg(MAC);
ExeSqlData(strSql);
strSql = QString("update t_ChannelSetting SET pairChannelId = '%1' || SUBSTR(channelId, 13) where pairChannelId <> '' AND pairChannelId <> 'NONE' ;").arg(MAC);
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',IP = '%2' ;").arg(MAC).arg(IP);
ExeSqlData(strSql);
strSql = QString("update t_TriggerConfig SET ChannelID = '%1' || SUBSTR(ChannelID, 13) ;").arg(MAC);
ExeSqlData(strSql);
strSql = QString("update t_WorkConditionChannels SET ChannelId = '%1' || SUBSTR(ChannelId, 13) where ChannelId <> '';").arg(MAC);
ExeSqlData(strSql);
strSql = QString("update t_WorkConditionRules SET ChannelId = '%1' || SUBSTR(ChannelId, 13) ;").arg(MAC);
ExeSqlData(strSql);
strSql = QString("update t_UnitConfiguration SET ChannelId = '%1' || SUBSTR(ChannelId, 13) ;").arg(MAC);
ExeSqlData(strSql);
db.close();
QString fileName = copy_path + "Graph1.json";
QString value;
QFile file(fileName);
file.open(QIODevice::ReadWrite | QIODevice::Text);
value = file.readAll();
file.resize(0);
file.write(value.toUtf8());
value.replace(oldMAC,MAC);
value = file.readAll();
file.close();
QString fileName2 = copy_path + "Graph2.json";
QFile file2(fileName2);
file2.open(QIODevice::ReadWrite | QIODevice::Text);
value = file2.readAll();
file2.resize(0);
value.replace(oldMAC,MAC);
file2.write(value.toUtf8());
file2.close();
QString ChannelSettings = copy_path + "ChannelSettings.json";
QFile fileChannelSettings(ChannelSettings);
fileChannelSettings.open(QIODevice::ReadWrite | QIODevice::Text);
value = fileChannelSettings.readAll();
fileChannelSettings.resize(0);
value.replace(oldMAC,MAC);
fileChannelSettings.write(value.toUtf8());
fileChannelSettings.close();
QString UnitConfigurations = copy_path + "UnitConfigurations.json";
QFile fileUnitConfigurations(UnitConfigurations);
fileUnitConfigurations.open(QIODevice::ReadWrite | QIODevice::Text);
value = fileUnitConfigurations.readAll();
fileUnitConfigurations.resize(0);
value.replace(oldMAC,MAC);
fileUnitConfigurations.write(value.toUtf8());
fileUnitConfigurations.close();
QString TriggerSettings = copy_path + "TriggerSettings.json";
QFile fileTriggerSettings(TriggerSettings);
fileTriggerSettings.open(QIODevice::ReadWrite | QIODevice::Text);
value = fileTriggerSettings.readAll();
fileTriggerSettings.resize(0);
value.replace(oldMAC,MAC);
fileTriggerSettings.write(value.toUtf8());
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");
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);
if (copyDir2.exists()) {
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());
}
int CImportConfig::ExeSqlData(QString& strSql)
{
QSqlQuery sql_query;
int iRet = -1;
qDebug() << "strSql" << strSql << endl;
if(!sql_query.exec(strSql))
{
qDebug() << sql_query.lastError();
}
else
{
while(sql_query.next())
{
iRet = sql_query.value(0).toInt();
}
}
return iRet;
}
bool CImportConfig::copyFile(const QString &sourceFile, const QString &destinationFile)
{
QFile srcFile(sourceFile);
QFile dstFile(destinationFile);
if (!srcFile.exists()) {
qDebug() << "Source file does not exist:" << sourceFile;
return false;
}
if (!srcFile.open(QIODevice::ReadOnly)) {
qDebug() << "Unable to open source file for reading:" << sourceFile;
return false;
}
if (!dstFile.open(QIODevice::WriteOnly)) {
srcFile.close();
qDebug() << "Unable to open destination file for writing:" << destinationFile;
return false;
}
dstFile.write(srcFile.readAll());
srcFile.close();
dstFile.close();
return true;
}
bool CImportConfig::copyDirectory(const QString &sourceDir, const QString &destinationDir) {
QDir srcDir(sourceDir);
QDir destDir(destinationDir);
// 复制文件
foreach (const QFileInfo &fileInfo, srcDir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot)) {
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)) {
return false;
}
} else {
// 复制文件
QFile dest(destFilePath);
if (dest.exists()) {
bool re = dest.remove(); // 如果目标文件存在,先删除它
if(!re){
qDebug() << "删除失败 "<<dest;
}
}
if (!QFile::copy(srcFilePath, destFilePath)) {
qDebug() << "无法复制文件" << srcFilePath << "" << destFilePath;
return false;
}
}
}
return true;
}

36
ImportConfig.h Normal file
View File

@ -0,0 +1,36 @@
#ifndef IMPORTCONFIG_H
#define IMPORTCONFIG_H
#include <QWidget>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include "global.h"
#include "ftpclient.h"
namespace Ui {
class CImportConfig;
}
class CImportConfig : public QWidget
{
Q_OBJECT
public:
explicit CImportConfig(QWidget *parent = nullptr);
~CImportConfig();
private slots:
void on_pushButton_importpath_clicked();
void on_pushButton_confirm_clicked();
private:
Ui::CImportConfig *ui;
QString import_path;
QSqlDatabase database;
int ExeSqlData(QString& strSql);
bool copyFile(const QString &sourceFile, const QString &destinationFile);
bool copyDirectory(const QString &sourceDir, const QString &destinationDir);
};
#endif // IMPORTCONFIG_H

150
ImportConfig.ui Normal file
View File

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CImportConfig</class>
<widget class="QWidget" name="CImportConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>713</width>
<height>168</height>
</rect>
</property>
<property name="windowTitle">
<string>配置导入</string>
</property>
<property name="styleSheet">
<string notr="true">font: 10pt &quot;黑体&quot;;
color: rgb(27, 30, 35);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>请填写导入信息</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="lineEdit_filepath">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_importpath">
<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_importpath { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_importpath:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_importpath:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_importpath: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>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_confirm">
<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_confirm { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_confirm:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_confirm:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_confirm:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<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>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,4 +1,4 @@
#include "MqttClient.h"
#include "Mqttclient.h"
MqttClient::MqttClient(QObject *parent) : QObject(parent)
{

View File

@ -82,7 +82,13 @@ void CNTPServerConfig::on_pushButton_manual_clicked()
void CNTPServerConfig::Init()
{
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ServerConfig.json";
#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);
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ServerConfig.json";
#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);
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ServerConfig.json";
#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());

View File

@ -3,6 +3,7 @@
#include <QRegExpValidator>
#include <QSettings>
#include <QTextCodec>
#include <QInputDialog>
#include "ftpclient.h"
COtherConfig::COtherConfig(QWidget *parent) :
@ -18,6 +19,7 @@ COtherConfig::COtherConfig(QWidget *parent) :
ui->lineEdit_Trigger->setValidator(Validator);
ui->lineEdit_peaktopeak->setValidator(Validator);
ui->radioButton_closeIO->setChecked(1);
LoadWorkingConditionConfig();
}
@ -29,7 +31,13 @@ COtherConfig::~COtherConfig()
void COtherConfig::LoadWorkingConditionConfig()
{
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\TriggerConfig.json";
#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 +64,13 @@ void COtherConfig::LoadWorkingConditionConfig()
}
}
fileName = QCoreApplication::applicationDirPath() + "\\config\\ConfidenceDegree.json";
#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,9 +95,14 @@ void COtherConfig::LoadWorkingConditionConfig()
}
//读取ini
QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini",QSettings::IniFormat);
#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();
QTextCodec* codec = QTextCodec::codecForName("UTF-8");//添加编码格式
@ -97,14 +116,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("");
fileName = QCoreApplication::applicationDirPath() + "\\config\\ZeroDrift.json";
#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 +193,13 @@ void COtherConfig::on_pushButto_Trigger_clicked()
return;
}
m_strTriggerTime = str;
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\TriggerConfig.json";
#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 +227,13 @@ void COtherConfig::on_pushButto_Trigger_clicked()
}
QJsonDocument jsonDoc;
jsonDoc.setObject(jsonObject);
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\TriggerConfig.json";
#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 +277,13 @@ inline QString UTF82GBK(QByteArray &inStr)
void COtherConfig::on_pushButton_main_clicked()
{
QSettings *settings = new QSettings(QCoreApplication::applicationDirPath() + "\\config\\config.ini", QSettings::IniFormat);
#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 +354,13 @@ void COtherConfig::on_radioButton_open_clicked()
ZeroDriftObj["ref_channel"] = ref_channelObj;
QJsonDocument jsonDoc;
jsonDoc.setObject(ZeroDriftObj);
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ZeroDrift.json";
#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 +384,13 @@ void COtherConfig::on_radioButton_open_clicked()
void COtherConfig::on_radioButton_close_clicked()
{
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ZeroDrift.json";
#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 +412,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();
@ -377,3 +437,39 @@ void COtherConfig::on_radioButton_close_clicked()
ui->lineEdit_peaktopeak->setEnabled(1);
}
void COtherConfig::on_radioButton_openIO_clicked()
{
bool ok;
QString password = QInputDialog::getText(this,
"输入密码",
"Enter Password:",
QLineEdit::Password,
"",
&ok);
if(!ok) {
ui->radioButton_openIO->setChecked(0);
ui->radioButton_closeIO->setChecked(1);
return;
}
#ifdef Q_OS_WIN32
QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini",QSettings::IniFormat);
#endif
#ifdef Q_OS_LINUX
QSettings settingsread(QCoreApplication::applicationDirPath() + "/config/config.ini",QSettings::IniFormat);
#endif
if(password == settingsread.value("main/passwd").toString())
{
g_strIOControl = "1";
}else{
QMessageBox::information(this, QStringLiteral("提示"), "请输入正确的密码!");
}
}
void COtherConfig::on_radioButton_closeIO_clicked()
{
g_strIOControl = "0";
}

View File

@ -28,6 +28,10 @@ private slots:
void on_radioButton_close_clicked();
void slotNetMgr(QString sAddr,const QVariant& msg);
void on_radioButton_openIO_clicked();
void on_radioButton_closeIO_clicked();
private:
Ui::COtherConfig *ui;

View File

@ -411,6 +411,45 @@
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_5">
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
<width>231</width>
<height>61</height>
</rect>
</property>
<property name="title">
<string>继电器开关控制</string>
</property>
<widget class="QRadioButton" name="radioButton_openIO">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>89</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>开</string>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_closeIO">
<property name="geometry">
<rect>
<x>120</x>
<y>30</y>
<width>89</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>关</string>
</property>
</widget>
</widget>
</widget>
</item>
</layout>

View File

@ -1,4 +1,4 @@
#include "qmytableviewbtndelegate.h"
#include "QMyTableViewBtnDelegate.h"
#include <QApplication>
#include <QMouseEvent>

View File

@ -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;

View File

@ -2,6 +2,7 @@
#include "ui_SlowSpeedChannelSetting.h"
#include <QListView>
#include "CopyChannelSetting.h"
#include "CustomFilter.h"
CSlowSpeedChannelSetting::CSlowSpeedChannelSetting(QWidget *parent) :
QWidget(parent),
@ -35,6 +36,7 @@ CSlowSpeedChannelSetting::CSlowSpeedChannelSetting(QWidget *parent) :
m_DisPlayerList << "平均值" << "最小值" << "最大值";
ui->comboBox_defaultDisplay->clear();
ui->comboBox_defaultDisplay->addItems(m_DisPlayerList);
ui->pushButton_CustomFilter->setVisible(false);
}
CSlowSpeedChannelSetting::~CSlowSpeedChannelSetting()
@ -58,9 +60,11 @@ void CSlowSpeedChannelSetting::displayChannelSetting()
}
if(channelSetting.sensorType == "PULSE_CURRENT"){
ui->comboBox_channelType->addItem("气隙");
ui->pushButton_CustomFilter->setVisible(true);
}
if(channelSetting.sensorType == "AIRGAP"){
ui->comboBox_channelType->addItem("高速电流");
ui->pushButton_CustomFilter->setVisible(true);
}
ui->RPMComBox->clear();
@ -241,10 +245,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 +265,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 +285,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,10 +296,21 @@ 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();
dialog->show();
}
void CSlowSpeedChannelSetting::on_pushButton_CustomFilter_clicked()
{
CustomFilter *pCustomFilter = new CustomFilter();
pCustomFilter->channel_ID = channelSetting.channelId;
pCustomFilter->vibrate_channel = 1;
pCustomFilter->setWindowModality(Qt::ApplicationModal);
pCustomFilter->show();
pCustomFilter->getfilterInfo();
}

View File

@ -28,8 +28,10 @@ private slots:
void on_comboBox_channelType_currentTextChanged(const QString &arg1);
void on_pushButton_copy_clicked();
void on_pushButton_CustomFilter_clicked();
public slots:
void slotSetChannelData(QStringList&);
void slotCopyChannelData(QStringList&);
private:
Ui::CSlowSpeedChannelSetting *ui;

View File

@ -384,7 +384,7 @@ color: rgb(27, 30, 35);</string>
<widget class="QLineEdit" name="lineEdit_channelName">
<property name="minimumSize">
<size>
<width>0</width>
<width>150</width>
<height>0</height>
</size>
</property>
@ -398,6 +398,48 @@ color: rgb(27, 30, 35);</string>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_CustomFilter">
<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_CustomFilter { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_CustomFilter:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_CustomFilter:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_CustomFilter:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<property name="text">
<string>滤波设置</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">

View File

@ -4,6 +4,8 @@
#include <QNetworkRequest>
#include "ftpclient.h"
#include "CopyDatFile.h"
#include "Backup.h"
#include "ImportConfig.h"
CTerminalInfo::CTerminalInfo(QWidget *parent) :
QWidget(parent),
@ -53,6 +55,7 @@ CTerminalInfo::CTerminalInfo(QWidget *parent) :
double cpuUserUse = 10,memoryUse = 20,hardDiskUse = 30,temperature = 60;
QString updateTime = "1583487670";
ui->label_Version_GUI->setText(g_strVersion);
//UpdateChart(cpuUserUse,memoryUse,memoryUse,temperature,updateTime);
@ -209,7 +212,7 @@ void CTerminalInfo::slotNetMgr(QString sAddr, const QVariant &msg)
ui->label_Version->setText(sysObj["softVersion"].toString());
ui->label_Type->setText(sysObj["deviceType"].toString());
ui->label_SerialNo->setText(sysObj["serialNumber"].toString());
ui->label_Address->setText(sysObj["dataWatchIpAddress"].toString());
//ui->label_Address->setText(sysObj["dataWatchIpAddress"].toString());
}
}
}
@ -291,8 +294,6 @@ void CTerminalInfo::on_pushButton_Update_clicked()
curIndex = 0;
else if(text == "后端主程序")
curIndex = 1;
else if(text == "后端辅助程序")
curIndex = 2;
g_FtpClient->UpLoadFile(filepath,FileName,curIndex);
}
@ -305,3 +306,22 @@ void CTerminalInfo::on_pushButtonCopy_clicked()
copyDatDialog->show();
}
void CTerminalInfo::on_pushButton_export_clicked()
{
CBackup *BackupDialog = new CBackup();
BackupDialog->setWindowModality(Qt::ApplicationModal);
BackupDialog->setAttribute(Qt::WA_DeleteOnClose);
BackupDialog->setWindowFlags(BackupDialog->windowFlags() &~ Qt::WindowMaximizeButtonHint);
BackupDialog->show();
}
void CTerminalInfo::on_pushButton_import_clicked()
{
CImportConfig *ImportConfigDialog = new CImportConfig();
ImportConfigDialog->setWindowModality(Qt::ApplicationModal);
ImportConfigDialog->setAttribute(Qt::WA_DeleteOnClose);
ImportConfigDialog->setWindowFlags(ImportConfigDialog->windowFlags() &~ Qt::WindowMaximizeButtonHint);
ImportConfigDialog->show();
}

View File

@ -34,6 +34,10 @@ private slots:
void on_pushButtonCopy_clicked();
void on_pushButton_export_clicked();
void on_pushButton_import_clicked();
private:
Ui::CTerminalInfo *ui;

View File

@ -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,18 +516,18 @@
<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>
<property name="text">
<string>终端地址</string>
<string>数据配置</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -532,12 +535,76 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_Address">
<widget class="QPushButton" name="pushButton_import">
<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_import { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_import:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_import:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_import:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<property name="text">
<string>- -</string>
<string>导入</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_export">
<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_export { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_export:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_export:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_export:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<property name="text">
<string>导出</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>
</layout>
</item>
<item>
@ -546,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>

View File

@ -260,8 +260,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
}else if(g_ChannelBaseInfo[ii].channelType == "ACCELEROMETER"){
LoadTriggerConfig(g_ChannelBaseInfo[ii].channelID);
if(m_vecTriggerConfig.size() < 1){
model->setRowCount(4);
for (int i = 0; i < 4; i++) {
model->setRowCount(6);
for (int i = 0; i < 6; i++) {
model->setItem(i, 2, add_checkBox_model(0));
model->setItem(i, 3, add_checkBox_model(0));
model->setItem(i, 4, add_checkBox_model(0));
@ -275,6 +275,8 @@ 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(5,1,QModelIndex()),"反时限危险值");
}
@ -283,8 +285,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
{
LoadTriggerConfig(g_ChannelBaseInfo[ii].channelID);
if(m_vecTriggerConfig.size() < 1){
model->setRowCount(4);
for (int i = 0; i < 4; i++) {
model->setRowCount(6);
for (int i = 0; i < 6; i++) {
model->setItem(i, 2, add_checkBox_model());
model->setItem(i, 3, add_checkBox_model());
model->setItem(i, 4, add_checkBox_model());
@ -298,6 +300,8 @@ 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(5,1,QModelIndex()),"反时限危险值");
}
@ -320,8 +324,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
{
LoadTriggerConfig(g_ChannelBaseInfo[ii].channelID);
if(m_vecTriggerConfig.size() < 1){
model->setRowCount(4);
for (int i = 0; i < 4; i++) {
model->setRowCount(6);
for (int i = 0; i < 6; i++) {
model->setItem(i, 2, add_checkBox_model());
model->setItem(i, 3, add_checkBox_model());
model->setItem(i, 4, add_checkBox_model());
@ -335,6 +339,8 @@ 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(5,1,QModelIndex()),"反时限危险值");
}
@ -357,8 +363,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
LoadTriggerConfig(g_ChannelBaseInfo[ii].channelID);
if(m_vecTriggerConfig.size() < 1){
model->setRowCount(3);
for (int i = 0; i < 3; i++){
model->setRowCount(5);
for (int i = 0; i < 5; i++){
model->setItem(i, 2, add_checkBox_model());
model->setItem(i, 3, add_checkBox_model());
model->setItem(i, 4, add_checkBox_model());
@ -371,6 +377,8 @@ 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(4,1,QModelIndex()),"反时限危险值");
}
}
@ -480,7 +488,8 @@ void CTriggerConfig::on_pushButton_submit_clicked()
QString strCol = "count(*)";
int count = g_SqliteDB->QueryData(strTableName,strCol,strWhere);
if(count < 1){
if(rowList[2] == "1" || rowList[4] == "1" || rowList[6] == "1"||rowList[8] == "1"){
if(rowList[2] == "1" || rowList[4] == "1" || rowList[6] == "1"||rowList[8] == "1")
{
QString strSql = QString(" values('%1','%2',%3,'%4','%5',%6,'%7',%8,'%9',%10,'%11',%12,'%13','%14','%15','%16','%17','%18',0) ;").\
arg(ChannelID).arg(ChannelName).arg(WorkConditonSN).arg("").arg(rowList[1]).arg(rowList[2]).arg(rowList[3]).arg(rowList[4]).arg(rowList[5]).arg(rowList[6]).\
arg(rowList[7]).arg(rowList[8]).arg(rowList[9]).arg(rowList[10]).arg(rowList[11]).arg(rowList[12]).arg(rowList[13]).arg(rowList[14]);
@ -496,7 +505,8 @@ void CTriggerConfig::on_pushButton_submit_clicked()
int count = g_SqliteDB->QueryData(strTableName,strCol,strWhere);
qDebug() << "count " << count << endl;
if(count == 0){
if(rowList[2] == "1" || rowList[4] == "1" || rowList[6] == "1"||rowList[8] == "1"){
if(rowList[2] == "1" || rowList[4] == "1" || rowList[6] == "1"||rowList[8] == "1")
{
QString strSql = QString(" set AlertOver = %1,AlertOverSetpoint = '%2',DangerOver = %3,DangerOverSetpoint = '%4',AlertUnder = %5,AlertUnderSetpoint = '%6',DangerUnder = %7,\
DangerUnderSetpoint = '%8',AlertTriggerStatus = '%9',DangerTriggerStatus = '%10',AlertTriggerDelay = '%11',DangerTriggerDelay = '%12',TriggerType = '%13', operate = 2 where ChannelID = '%14' and WorkConditionID = %15 and Characteristic = '%16' and operate <> 3; ").arg(rowList[2]).arg(rowList[3]).arg(rowList[4]).arg(rowList[5]).arg(rowList[6]).\
arg(rowList[7]).arg(rowList[8]).arg(rowList[9]).arg(rowList[10]).arg(rowList[11]).arg(rowList[12]).arg(rowList[13]).arg(rowList[14]).arg(ChannelID).arg(WorkConditonSN.toInt()).arg(rowList[1]);
@ -663,6 +673,10 @@ void CTriggerConfig::PushData()
rowObj["triggerFeatureName"] = "DiagnosisPeak";
else if(triggerConfig[j].Characteristic == "监测保护峰峰值")
rowObj["triggerFeatureName"] = "MonitorPk2Pk";
else if(triggerConfig[j].Characteristic == "反时限危险值")
rowObj["triggerFeatureName"] = "InvertDanger";
else if(triggerConfig[j].Characteristic == "反时限警报值")
rowObj["triggerFeatureName"] = "InvertAlarm";
QString triggerEventName = QString("%1-%2-%3").arg(rowObj["triggerFeatureName"].toString()).arg(triggerConfig[j].TriggerType).arg(triggerConfig[j].ChannelID);
@ -700,7 +714,13 @@ void CTriggerConfig::PushData()
QJsonDocument jsonDoc;
jsonDoc.setArray(m_channeltriggerArray);
QString fileName = QCoreApplication::applicationDirPath() + "\\config\\TriggerSettings.json";
#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);
@ -743,6 +763,10 @@ void CTriggerConfig::PushData()
rowObj["triggerFeatureName"] = "DiagnosisPeak";
else if(triggerConfig[j].Characteristic == "监测保护峰峰值")
rowObj["triggerFeatureName"] = "MonitorPk2Pk";
else if(triggerConfig[j].Characteristic == "反时限危险值")
rowObj["triggerFeatureName"] = "InvertDanger";
else if(triggerConfig[j].Characteristic == "反时限警报值")
rowObj["triggerFeatureName"] = "InvertAlarm";
QString triggerEventName = QString("%1-%2-%3").arg(rowObj["triggerFeatureName"].toString()).arg(triggerConfig[j].TriggerType).arg(triggerConfig[j].ChannelID);
@ -782,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);

View File

@ -4,7 +4,7 @@
#include <QWidget>
#include <QTableView>
#include "global.h"
#include "HeaderView.h"
#include "headerView.h"
#include "TableHeaderView.h"
#include <QStandardItemModel>
#include <QComboBox>

View File

@ -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);

View File

@ -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()
@ -208,6 +227,7 @@ void CWaveDisPlay::ParseDataTimeWave(QJsonObject & objContent)
bFlag = true;
m_ListWaveData = m_WaveData.split(",");
ui->widget_wave->xAxis->setLabel("Time(s)");
ui->widget_wave->yAxis->setLabel(m_ChannelUnit);
QString str = QString("wave size = %1").arg(m_ListWaveData.size());
customLogMessageHandler(QtDebugMsg,str);
double gap = 0.0;
@ -290,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);
@ -302,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();
@ -443,28 +469,58 @@ void CWaveDisPlay::mouseMoveEvent(QMouseEvent *event)
tracer->setVisible(true);
tracerLabel->setVisible(true);
//将像素点转换成qcustomplot中的坐标值并通过setGraphKey将锚点值设为真实数据值。tracer->setGraphKey(xAxis->pixelToCoord(event->pos().x()));
int graphCount = ui->widget_wave->graphCount();
if(graphCount < 1)
return;
//获得鼠标位置处对应的横坐标数据x
double x = ui->widget_wave->xAxis->pixelToCoord(event->pos().x());
//遍历曲线
//for (int i = 0; i < graphCount && tracer->visible(); ++i)
{
//显示锚点
QCPGraph *mGraph = ui->widget_wave->graph(0);
tracer->setGraph(mGraph);//将锚点设置到被选中的曲线上
tracer->setGraphKey(x); //将游标横坐标设置成刚获得的横坐标数据x
tracer->updatePosition(); //使得刚设置游标的横纵坐标位置生效
double xValue = tracer->position->key();
double yValue = tracer->position->value();
tracerLabel->setVisible(true);
tracerLabel->setText(QString("X: %1 Y: %2").arg( QString::number(xValue)).arg(QString::number(yValue)));
//显示tip框
QCPDataContainer<QCPGraphData>::const_iterator coorPoint = ui->widget_wave->graph(0)->data().data()->findBegin(xValue, true);//true代表向左搜索
}
if(ui->Btn_Timewave->isChecked()){
//将像素点转换成qcustomplot中的坐标值并通过setGraphKey将锚点值设为真实数据值。tracer->setGraphKey(xAxis->pixelToCoord(event->pos().x()));
int graphCount = ui->widget_wave->graphCount();
if(graphCount < 1)
return;
//获得鼠标位置处对应的横坐标数据x
double x = ui->widget_wave->xAxis->pixelToCoord(event->pos().x());
//遍历曲线
//for (int i = 0; i < graphCount && tracer->visible(); ++i)
{
//显示锚点
QCPGraph *mGraph = ui->widget_wave->graph(0);
tracer->setGraph(mGraph);//将锚点设置到被选中的曲线上
tracer->setGraphKey(x); //将游标横坐标设置成刚获得的横坐标数据x
tracer->updatePosition(); //使得刚设置游标的横纵坐标位置生效
double xValue = tracer->position->key();
double yValue = tracer->position->value();
tracerLabel->setVisible(true);
tracerLabel->setText(QString("X: %1 Y: %2").arg( QString::number(xValue)).arg(QString::number(yValue)));
//显示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();
}

View File

@ -28,6 +28,7 @@ CWokingConditionConfig::CWokingConditionConfig(QWidget *parent) :
ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);
ui->treeView->setStyle(QStyleFactory::create("windows"));
treeModel = new QStandardItemModel(ui->treeView); //创建模型指定父类
ui->treeView->setModel(treeModel);
ui->treeView->setHeaderHidden(true);
@ -38,7 +39,7 @@ CWokingConditionConfig::CWokingConditionConfig(QWidget *parent) :
QRegExp exp("[0-9\\.-]+$");
QValidator *Validator = new QRegExpValidator(exp);
ui->lineEdit_Interval->setValidator(Validator);
ui->treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
}
CWokingConditionConfig::~CWokingConditionConfig()

View File

@ -3,7 +3,7 @@
#include <QWidget>
#include <QStandardItemModel> //数据模型类
#include "HeaderView.h"
#include "headerView.h"
#include "TableHeaderView.h"
#include "global.h"
#include "sqlitedb.h"

View File

@ -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);

View File

@ -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);
}

View File

@ -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

View File

@ -14,3 +14,4 @@ QString g_LocalFile ;
QString g_strVersion ;
QString g_strProject ;
QString g_strFre ;
QString g_strIOControl ;

View File

@ -16,6 +16,9 @@ extern QString g_LocalFile ;
extern QString g_strVersion ;
extern QString g_strProject ;
extern QString g_strFre ;
extern QString g_strIOControl ;
//#define NO_FILTER
typedef struct ChannelSetting{
double ChUnitCoeff;
int ChUnitDot;
@ -244,6 +247,8 @@ typedef struct _TriggerEvent{
int triggeredEquipmentID;
QString triggeredEventName;
QString triggeredFeatureName;
QString triggeredFileName;
QString triggereValue;
}TriggerEvent_t ;
typedef struct _TriggerAlarmStatusInfo{
@ -309,6 +314,9 @@ typedef struct _Charateristic{
double speedRPM;
int ChUnitDot;
QString channelType;
double InvertAlarm;
double InvertDanger;
} Charateristic_t;
typedef struct tag_WAVE_DATA{
QString channelId;

View File

@ -1,4 +1,4 @@
#include "HeaderView.h"
#include "headerView.h"
#include <QPainter>
#include <QCheckBox>
#include <QDebug>

161
include/ftp/qftp.h Normal file
View 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
View 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

View 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 ()

View 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

Binary file not shown.

BIN
lib/fftw/libfftw3.so.3.5.8 Normal file

Binary file not shown.

View 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}

View 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"
)

View 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()

View 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
View 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

Binary file not shown.

BIN
lib/ftp/libQt5Ftp.so.5.0 Normal file

Binary file not shown.

BIN
lib/ftp/libQt5Ftp.so.5.0.0 Normal file

Binary file not shown.

Binary file not shown.

View 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

View File

@ -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"
)

View File

@ -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")

View File

@ -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
View 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

Binary file not shown.

BIN
lib/mqtt/libQt5Qmqtt.so.1.0 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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

7
log.h
View File

@ -6,8 +6,13 @@
#include <QMutex>
#include <QString>
#define LOG_FILE_NAME QCoreApplication::applicationDirPath() + QString("\\Log\\") + QDateTime::currentDateTime().toString("yyyy-MM-dd") + QString(".log")
#ifdef Q_OS_WIN32
#define LOG_FILE_NAME QCoreApplication::applicationDirPath() + QString("\\Log\\") + QDateTime::currentDateTime().toString("yyyy-MM-dd") + QString(".log")
#endif
#ifdef Q_OS_LINUX
#define LOG_FILE_NAME QCoreApplication::applicationDirPath() + QString("/Log/") + QDateTime::currentDateTime().toString("yyyy-MM-dd") + QString(".log")
#endif
static int s_logLevel = 0;
static QMutex s_logMutex;
static QString s_logPath;

View File

@ -1,9 +1,11 @@
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();

View File

@ -20,8 +20,23 @@ MainWindow::MainWindow(QWidget *parent) :
g_FtpClient = new FtpClient();
//读取ini
<<<<<<< HEAD
QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini",QSettings::IniFormat);
g_strVersion = "SJ90C V1.1";
=======
#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
QDate buildDate = QLocale( QLocale::English ).toDate( QString(__DATE__).replace(" ", " 0"), "MMM dd yyyy");
QTime buildTime = QTime::fromString(__TIME__, "hh:mm:ss");
g_strVersion = "SJ90C V1.1_" + buildDate.toString("yyyyMMdd");
customLogMessageHandler(QtDebugMsg,g_strVersion + " " + buildTime.toString());
>>>>>>> font
g_strProject = settingsread.value("main/Project").toString();
g_strFre = settingsread.value("main/Fre").toString();
@ -243,16 +258,28 @@ void MainWindow::leftConfigClick()
delete pWaveDisPlay;
pWaveDisPlay = NULL;
}
if(pDIOBoard){
delete pDIOBoard;
pDIOBoard = NULL;
}
}else if(name == "特征值列表"){
ui->tabWidget_main->setCurrentWidget(pCharacteristcList);
if(pWaveDisPlay){
delete pWaveDisPlay;
pWaveDisPlay = NULL;
}
if(pDIOBoard){
delete pDIOBoard;
pDIOBoard = NULL;
}
}else if(name == "气隙监测"){
}else if(name == "波形图"){
if(pDIOBoard){
delete pDIOBoard;
pDIOBoard = NULL;
}
if(pWaveDisPlay == NULL)
pWaveDisPlay = new CWaveDisPlay(this);
ui->tabWidget_main->addTab(pWaveDisPlay,"");
@ -300,12 +327,26 @@ void MainWindow::leftConfigClick2()
}
if(name == "实时报警"){
if(pRealTimeAlarm == NULL)
pRealTimeAlarm = new CRealTimeAlarm (this);
ui->tabWidget_accidentTracing->addTab(pRealTimeAlarm,"");
ui->tabWidget_accidentTracing->setCurrentWidget(pRealTimeAlarm);
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);
}else if(name == "趋势分析"){
if(pRealTimeAlarm){
delete pRealTimeAlarm;
pRealTimeAlarm = NULL;
}
}/*else if(name == "趋势分析"){
ui->tabWidget_accidentTracing->setCurrentWidget(pTrendGraph);
}
}*/
}
void MainWindow::initLeft3()
@ -337,6 +378,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,15 +432,10 @@ void MainWindow::leftConfigClick3()
delete pTriggerConfig;
pTriggerConfig = NULL;
}
// if(pUnitConfiguration){
// delete pUnitConfiguration;
// pUnitConfiguration = NULL;
// }
// if(pTestForm){
// delete pTestForm;
// pTestForm = NULL;
// }
if(pConfiguration){
delete pConfiguration;
pConfiguration = NULL;
}
}else if(name == "工况配置"){
if(pWorkCondition == NULL)
@ -569,8 +621,10 @@ void MainWindow::buttonClick()
if (name == "实时监测") {
if(pRealTimeForm == NULL)
pRealTimeForm = new CRealTimeForm (this);
if(pDIOBoard == NULL)
pDIOBoard = new CDIO_Board (this);
ui->stackedWidget->setCurrentIndex(0);
ui->tabWidget_main->setCurrentIndex(0);
} else if (name == "事故追溯") {
ui->stackedWidget->setCurrentIndex(1);

File diff suppressed because it is too large Load Diff

View File

@ -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 ;

View File

@ -1,6 +1,7 @@
#include "sqlitedb.h"
SqliteDB* g_SqliteDB = NULL;
QSqlDatabase db;
SqliteDB::SqliteDB()
{
@ -16,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";
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
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();
@ -70,6 +81,7 @@ int SqliteDB::initTable()
iRet = ExeSqlData(strSql);
if(iRet == 0){
strSql = "ALTER TABLE t_TriggerConfig ADD COLUMN 'operate' integer DEFAULT 1";
<<<<<<< HEAD
ExeSqlData(strSql);
}
@ -78,11 +90,26 @@ int SqliteDB::initTable()
iRet = ExeSqlData(strSql);
if(iRet == 0){
strSql = "ALTER TABLE t_ChannelSetting ADD COLUMN 'filterStatus' integer";
=======
>>>>>>> font
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);
if(iRet == 0){
strSql = "ALTER TABLE t_ChannelSetting ADD COLUMN 'filterStatus' integer";
ExeSqlData(strSql);
}
//#endif
CreateDataBase();
}
int SqliteDB::CloseDataBase()
{
db.close();
}
int SqliteDB::CreateDataBase()
{
QString strCreateSQL = QString("create table if not exists t_UnitConfiguration(WorkConditionID,ChannelID,BoardNo,ChannelNoInBoard,Input,Operate);");
@ -472,7 +499,8 @@ SqliteDB::GetTriggerEvent(QString tablename,QString whereCon)
tempTriggerEvent.triggeredEquipmentID = sql_query.value(8).toInt();
tempTriggerEvent.triggeredEventName = sql_query.value(9).toString();
tempTriggerEvent.triggeredFeatureName = sql_query.value(10).toString();
tempTriggerEvent.triggeredFileName = sql_query.value(11).toString();
tempTriggerEvent.triggereValue = sql_query.value(12).toString();
vecResult.append(tempTriggerEvent);
}
}
@ -555,9 +583,10 @@ int SqliteDB::InsertData(QString& tablename,QString& sql)
QSqlQuery sql_query;
QString strSql = "INSERT INTO ";
strSql = strSql + tablename + sql;
qDebug() << "strSql" <<strSql << endl;
qDebug() << "strSql" << strSql << endl;
if(!sql_query.exec(strSql))
{
customLogMessageHandler(QtDebugMsg,sql_query.lastError().text());
qDebug() << sql_query.lastError();
}
else

View File

@ -19,6 +19,7 @@ public:
SqliteDB();
QSqlDatabase database;
int OpenDataBase();
int CloseDataBase();
int CreateDataBase();
int InsertData(QString& tablename,QString& sql);
int UpdataData(QString& tablename, QString& columnName, QString& columnValue, QString whereColName = "", QString whereColValue = "");