2022-07-30 11:50:01 +08:00
|
|
|
#ifndef MAINWIDGET_H
|
|
|
|
|
#define MAINWIDGET_H
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
|
|
#include "BaseWgt.h"
|
|
|
|
|
#include "global.h"
|
|
|
|
|
#include "DataParsing.h"
|
|
|
|
|
#include "sqlitedb.h"
|
|
|
|
|
#include "Adddeviceform.h"
|
|
|
|
|
#include "Reportform.h"
|
|
|
|
|
#include "SettingForm.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ChildForm;
|
|
|
|
|
class CIDWUdp;
|
|
|
|
|
class NetMgr;
|
|
|
|
|
class QTreeWidgetItem;
|
|
|
|
|
class QMenu;
|
|
|
|
|
class SqliteDB;
|
|
|
|
|
class global;
|
|
|
|
|
|
|
|
|
|
struct FileData
|
|
|
|
|
{
|
|
|
|
|
QString sfileName;
|
|
|
|
|
int iCreatTime;
|
|
|
|
|
int iFileSize;
|
|
|
|
|
FileData()
|
|
|
|
|
{
|
|
|
|
|
iCreatTime = 0;
|
|
|
|
|
iFileSize = 0;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
namespace Ui { class MainWidget; }
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
class MainWidget : public BaseWgt
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
MainWidget(QWidget *parent = nullptr);
|
|
|
|
|
~MainWidget();
|
|
|
|
|
SqliteDB sql_db;
|
|
|
|
|
void InitDevList();
|
|
|
|
|
public slots:
|
|
|
|
|
void TrendChartPlotSlot();
|
|
|
|
|
void TimeDomainPlotSlot();
|
|
|
|
|
void FrequencyDomainPlotSlot();
|
|
|
|
|
void EnvelopeAnalysisPlotSlot();
|
|
|
|
|
void WaterFallPlotSlot();
|
|
|
|
|
void OrbitPlotSlot();
|
|
|
|
|
void PolarplotSlot();
|
|
|
|
|
void BodePlotSlot();
|
|
|
|
|
void ShaftCenterlinePlotSlot();
|
2022-11-07 14:02:09 +08:00
|
|
|
void TimeWave();
|
2022-07-30 11:50:01 +08:00
|
|
|
void OutSlot();
|
|
|
|
|
void ReturnSlot();
|
|
|
|
|
void View3D();
|
|
|
|
|
void Dat2Csv();
|
|
|
|
|
//网络请求数据响应
|
|
|
|
|
void slotNetMgr(QString sAddr,const QVariant& msg);
|
|
|
|
|
void slotItemDoubleClicked(QTreeWidgetItem *pItem, int column);
|
|
|
|
|
private slots:
|
|
|
|
|
void TabBarCloseSlot();
|
|
|
|
|
void InitSignalandSlot();
|
|
|
|
|
void ItemCheckStateSlot(QString strID, bool bChecked);
|
|
|
|
|
void OpenFileSlot();
|
|
|
|
|
|
|
|
|
|
void WebBtnSlot(QString sAddr = "");
|
|
|
|
|
void RefreshBtnSlot();
|
|
|
|
|
void SearchSlot(QString strIP = "",bool AutoSearch = true);
|
|
|
|
|
void SlidervalueChangedSlot(int value);
|
|
|
|
|
QPixmap CreateWatermarkBg(uint16_t w, uint16_t h, QString content);
|
|
|
|
|
//定时器槽函数
|
|
|
|
|
void TimerSlot();
|
|
|
|
|
|
|
|
|
|
void PlayBtnSlot();
|
|
|
|
|
void Back1SBtnSlot();
|
|
|
|
|
void Back2SBtnSlot();
|
|
|
|
|
void Back3SBtnSlot();
|
|
|
|
|
void Add1SBtnSlot();
|
|
|
|
|
void Add2SBtnSlot();
|
|
|
|
|
void Add3SBtnSlot();
|
|
|
|
|
void OutPDF(QStringList strResult,QString filePath);
|
|
|
|
|
void AddDevice();
|
|
|
|
|
void HideDev();
|
|
|
|
|
void Report();
|
|
|
|
|
void ExitFile();
|
|
|
|
|
void InitData();
|
|
|
|
|
void Setting();
|
|
|
|
|
//接收数据槽函数
|
|
|
|
|
void RetSlot(QString strjson,QString strip);
|
|
|
|
|
void IpSlot(QString strip,QString strMAC = "",QString strName = "");
|
|
|
|
|
|
|
|
|
|
//tree widget 右击信号
|
|
|
|
|
void slotCustomContextMenuRequested(const QPoint &pos);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
bool m_HideDevList;
|
|
|
|
|
void Init();
|
|
|
|
|
void EnableGraph(bool isOpen = false);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void doDownLoad(QTreeWidgetItem *pItem, QString sPath);
|
|
|
|
|
//解析HTTP数据 1、文件列表 2、文件配置信息
|
|
|
|
|
void parseFileListData(QString sAddr,const QVariant& msg);
|
|
|
|
|
void parseFileInfoData(QString sAddr,const QVariant& msg);
|
|
|
|
|
void paraseChannelInfo(QString aAddr,const QVariant& msg); //设备通道信息
|
|
|
|
|
void addChildItem(QTreeWidgetItem *pDataItem,QTreeWidgetItem *pNoItem, QString sfileName, int sTime);
|
|
|
|
|
|
|
|
|
|
QTreeWidgetItem *findDataItemByIP(QString sIP);
|
|
|
|
|
QTreeWidgetItem *findNameItemByIP(QString sIP);
|
|
|
|
|
QTreeWidgetItem *findNOItemByIP(QString sIP);
|
|
|
|
|
|
|
|
|
|
QString getServerAddrByEquipNo(QString sEquipNo); // 通过设备号查找服务器地址
|
|
|
|
|
|
|
|
|
|
QStringList getFileListUnderDir(const QString &dirPath);
|
|
|
|
|
void ReadDatData(QString strPath,QString strFileName,QString strIP=""); //读取dat文件
|
|
|
|
|
void ReadCsvData(QString strPath); //读取csv文件
|
|
|
|
|
private:
|
|
|
|
|
Ui::MainWidget *ui;
|
|
|
|
|
QString m_strDatTime; //dat文件时间
|
|
|
|
|
QString m_strDatPath; //dat文件路径
|
|
|
|
|
QString m_sEquipNo; //设备号
|
|
|
|
|
QString m_strDeviceName; //设备名称
|
|
|
|
|
QString m_strCollectTime; //采集时间
|
|
|
|
|
QVector<WAVE_DATA> m_vecPushData; //推送的原始数据
|
|
|
|
|
QVector<WAVE_ALLDATA> m_vecAllData; //推送的原始数据
|
|
|
|
|
QMap<QString,QVector<WAVE_DATA>> mapWaveData;
|
|
|
|
|
QVector<WAVE_INFO> m_vecWaveInfo;
|
|
|
|
|
QVector<ChildForm *> m_vecChildForm; //图形集合
|
|
|
|
|
QVector<GroupData> m_vecGroupdata; //趋势数据
|
|
|
|
|
WAVE_CSVDATA m_vecCsvData[32];
|
|
|
|
|
QMap<ChildForm *, QVector<QString>> m_mapChildFormToChannelID; //
|
|
|
|
|
QMap<QPushButton*, ChildForm *> m_mapTabBtnToForm; //tab页关闭按钮和tab页的映射
|
|
|
|
|
int m_iCount; //总时间
|
|
|
|
|
int m_iCurCount; //当前时间
|
|
|
|
|
int m_iRealCount; //实际读出的秒数
|
|
|
|
|
bool m_backPlay;
|
|
|
|
|
QTimer *m_pTimer;
|
|
|
|
|
DataParsing *m_pDealdat; //趋势数据解析
|
|
|
|
|
DEVICE_INFO m_DeviceInfo;
|
|
|
|
|
QString m_strIP;
|
|
|
|
|
CIDWUdp *m_pCIDWUdp; //UDP通信模块实例化
|
|
|
|
|
AddDeviceForm *pAddDevice;
|
|
|
|
|
ReportForm *pReport;
|
|
|
|
|
SettingForm *pSetting;
|
|
|
|
|
QThread *m_pThread;
|
|
|
|
|
NetMgr *m_pNetMgr; //HTTP消息类对象
|
|
|
|
|
QMap<QString, QVector<FileData>> m_mapAddrToFiles;//地址对应的子文件名
|
|
|
|
|
};
|
|
|
|
|
#endif // MAINWIDGET_H
|