2025-03-13 15:21:23 +08:00
|
|
|
|
#include "CDebugTool.h"
|
|
|
|
|
|
#include "ui_CDebugTool.h"
|
|
|
|
|
|
#include <QIcon>
|
|
|
|
|
|
#include "CommonSheet.h"
|
|
|
|
|
|
#include "pub_utility_api/FileUtil.h"
|
|
|
|
|
|
|
|
|
|
|
|
CDebugTool::CDebugTool(CSystemResources *pSystemResources, QWidget *parent):
|
|
|
|
|
|
m_pSystemResources(pSystemResources),
|
|
|
|
|
|
CustomUiMainWindow(parent),
|
|
|
|
|
|
m_pFessim(NULL),
|
|
|
|
|
|
m_pUpdateThread(NULL),
|
|
|
|
|
|
m_pEventFormShow(NULL),
|
|
|
|
|
|
ui(new Ui::CDebugTool)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
|
|
//setMinimumSize(1200,755);
|
2025-08-26 23:55:59 +08:00
|
|
|
|
setWindowTitle(tr("调试助手工具"));
|
2025-03-13 15:21:23 +08:00
|
|
|
|
setWindowIcon(QIcon(":/debug_tool.ico"));
|
|
|
|
|
|
CommonSheet sheetStyle;
|
|
|
|
|
|
QString sheet;
|
|
|
|
|
|
if(sheetStyle.getSheet(sheet))
|
|
|
|
|
|
{
|
|
|
|
|
|
setStyleSheet(sheet);
|
|
|
|
|
|
}else
|
|
|
|
|
|
{
|
|
|
|
|
|
LOGERROR("MainWindow::initSheet():获取样式文件失败!");
|
|
|
|
|
|
}
|
|
|
|
|
|
initDebugTool();
|
|
|
|
|
|
|
|
|
|
|
|
setTitleWidget(ui->mainmenu);
|
|
|
|
|
|
connect(ui->tabWidget,&QTabWidget::currentChanged,this,&CDebugTool::changeTab);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CDebugTool::~CDebugTool()
|
|
|
|
|
|
{
|
|
|
|
|
|
//releaseResouce();
|
|
|
|
|
|
if(m_pUpdateThread)
|
|
|
|
|
|
{
|
|
|
|
|
|
delete m_pUpdateThread;
|
|
|
|
|
|
m_pUpdateThread =NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
delete ui;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugTool::initDebugTool()
|
|
|
|
|
|
{
|
|
|
|
|
|
initLogSystem();
|
|
|
|
|
|
initVariable();
|
|
|
|
|
|
initView();
|
|
|
|
|
|
connectSignalSlot();
|
|
|
|
|
|
|
|
|
|
|
|
m_pUpdateThread->start();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugTool::initVariable()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pRealDataSelect = new CRealDataSelect;
|
|
|
|
|
|
m_pRealDataWatch = new CRealDataWatch;
|
|
|
|
|
|
m_pRealDatabaseSelect = new CRealDatabaseSelect;
|
|
|
|
|
|
m_pRealDatabaseShow = new CRealDatabaseShow;
|
|
|
|
|
|
m_pUpdateThread = new CUpdateThread;
|
|
|
|
|
|
m_pEventFormShow = new CEventFormShow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugTool::initView()
|
|
|
|
|
|
{
|
|
|
|
|
|
addRealData();
|
|
|
|
|
|
addRealAlarm();
|
|
|
|
|
|
addRealEvent();
|
|
|
|
|
|
addHistoryEvent();
|
|
|
|
|
|
addRealDataBase();
|
|
|
|
|
|
|
|
|
|
|
|
ui->splitter_2->setSizes(QList<int>()<<200<<900);
|
|
|
|
|
|
ui->splitter->setSizes(QList<int>()<<200<<900);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugTool::addRealData()
|
|
|
|
|
|
{
|
|
|
|
|
|
QGridLayout *gridLayout = new QGridLayout(ui->groupBox_1);
|
|
|
|
|
|
gridLayout->setSpacing(6);
|
|
|
|
|
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
gridLayout->addWidget(m_pRealDataSelect, 0, 0, 1, 1);
|
|
|
|
|
|
m_pRealDataSelect->setSystemResources(m_pSystemResources);
|
|
|
|
|
|
m_pRealDataSelect->initSelect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gridLayout = new QGridLayout(ui->groupBox_2);
|
|
|
|
|
|
gridLayout->setSpacing(6);
|
|
|
|
|
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
gridLayout->addWidget(m_pRealDataWatch, 0, 0, 1, 1);
|
|
|
|
|
|
m_pRealDataWatch->setSystemResources(m_pSystemResources);
|
|
|
|
|
|
m_pRealDataWatch->initWatch();
|
|
|
|
|
|
ui->textEdit_status->setToolTip("具体状态");
|
|
|
|
|
|
|
|
|
|
|
|
m_pRealDataSelect->setRealDataWatch(m_pRealDataWatch);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
void CDebugTool::addRealAlarm()
|
|
|
|
|
|
{
|
|
|
|
|
|
QGridLayout *gridLayout = new QGridLayout(ui->tab);
|
|
|
|
|
|
ui->textEdit_status->setHidden(true);
|
|
|
|
|
|
ui->tab->setLayout(gridLayout);
|
|
|
|
|
|
gridLayout->setSpacing(6);
|
|
|
|
|
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
gridLayout->addWidget(m_pEventFormShow, 0, 0, 1, 1);
|
|
|
|
|
|
m_pEventFormShow->setSystemResources(m_pSystemResources);
|
|
|
|
|
|
m_pEventFormShow->initRealModel();
|
|
|
|
|
|
//m_pEventFormShow->setSystemResources(m_pSystemResources);
|
|
|
|
|
|
// m_pAlarmFormShow->initSelect();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
void CDebugTool::addRealEvent()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
void CDebugTool::addHistoryEvent()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
void CDebugTool::addRealDataBase()
|
|
|
|
|
|
{
|
|
|
|
|
|
QGridLayout *gridLayout4 = new QGridLayout(ui->groupBox_4);
|
|
|
|
|
|
gridLayout4->setSpacing(6);
|
|
|
|
|
|
gridLayout4->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
gridLayout4->addWidget(m_pRealDatabaseSelect, 0, 0, 1, 1);
|
|
|
|
|
|
m_pRealDatabaseSelect->initRealDb(m_pSystemResources);
|
|
|
|
|
|
|
|
|
|
|
|
QGridLayout * gridLayout5 = new QGridLayout(ui->groupBox_5);
|
|
|
|
|
|
gridLayout5->setSpacing(6);
|
|
|
|
|
|
gridLayout5->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
gridLayout5->addWidget(m_pRealDatabaseShow, 0, 0, 1, 1);
|
|
|
|
|
|
m_pRealDatabaseShow->initRealDatabaseShow(m_pSystemResources);
|
|
|
|
|
|
}
|
|
|
|
|
|
void CDebugTool::addNodeStatus()
|
|
|
|
|
|
{
|
|
|
|
|
|
// QGridLayout *gridLayout = new QGridLayout(ui->tab_nodeStatus);
|
|
|
|
|
|
// gridLayout->setSpacing(6);
|
|
|
|
|
|
// gridLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
// gridLayout->addWidget(m_pNodeStatus, 0, 0, 1, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugTool::addFessim()
|
|
|
|
|
|
{
|
|
|
|
|
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_fes);
|
|
|
|
|
|
gridLayout->setSpacing(6);
|
|
|
|
|
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
gridLayout->addWidget(m_pFessim, 0, 0, 1, 1);
|
|
|
|
|
|
m_pFessim->Init();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugTool::initLogSystem()
|
|
|
|
|
|
{
|
|
|
|
|
|
// QString app = QString::fromStdString(CN_AppName_BASE);
|
|
|
|
|
|
// iot_public::StartLogSystem(app.toStdString().c_str(),CN_ProcName_debug_tool.c_str());
|
|
|
|
|
|
// LOGINFO("initLogSystem()成功!");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugTool::initMsgBus()
|
|
|
|
|
|
{
|
|
|
|
|
|
//< 初始化消息总线库
|
|
|
|
|
|
if (!(iot_net::initMsgBus("debugToolAppName", "debugToolProcessName")))
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "Initialize message bus failed, exit !" << endl;
|
|
|
|
|
|
LOGERROR("Initialize message bus failed, exit !");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "Initialize message bus successed !" << endl;
|
|
|
|
|
|
LOGINFO("Initialize message bus successed !");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
iot_service::CDpcdaForApp::initGlobalThread();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugTool::releaseResouce()
|
|
|
|
|
|
{
|
|
|
|
|
|
iot_service::CDpcdaForApp::releaseGlobalThread();
|
|
|
|
|
|
|
|
|
|
|
|
//< 释放消息总线库
|
|
|
|
|
|
iot_net::releaseMsgBus();
|
|
|
|
|
|
|
|
|
|
|
|
//< 停止日志系统
|
|
|
|
|
|
//iot_public::StopLogSystem();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugTool::connectSignalSlot()
|
|
|
|
|
|
{
|
|
|
|
|
|
connect(m_pRealDataSelect,SIGNAL(signal_addPoint(QString,uint,QString,uint,QString,QString,QString,QString,QString,QString,QString,int,QString)),
|
|
|
|
|
|
m_pRealDataWatch,SLOT(slot_addPoint(QString,uint,QString,uint,QString,QString,QString,QString,QString,QString,QString,int,QString)));
|
|
|
|
|
|
connect(m_pUpdateThread,SIGNAL(signal_updateAi(QString,float,uint)),
|
|
|
|
|
|
m_pRealDataWatch,SLOT(slot_updateAi(QString,float,uint)));
|
|
|
|
|
|
connect(m_pUpdateThread,SIGNAL(signal_updateDi(QString,int,uint)),
|
|
|
|
|
|
m_pRealDataWatch,SLOT(slot_updateDi(QString,int,uint)));
|
|
|
|
|
|
connect(m_pUpdateThread,SIGNAL(signal_updatePi(QString,double,uint)),
|
|
|
|
|
|
m_pRealDataWatch,SLOT(slot_updatePi(QString,double,uint)));
|
|
|
|
|
|
connect(m_pUpdateThread,SIGNAL(signal_updateMi(QString,int,uint)),
|
|
|
|
|
|
m_pRealDataWatch,SLOT(slot_updateMi(QString,int,uint)));
|
|
|
|
|
|
connect(m_pRealDatabaseSelect,SIGNAL(signal_showTable(QString,QVector<QString>*,int,int,int,int,QMap<int,bool>,QString,QString)),
|
|
|
|
|
|
m_pRealDatabaseShow,SLOT(slot_showTable(QString,QVector<QString>*,int,int,int,int,QMap<int,bool>,QString,QString)));
|
|
|
|
|
|
connect(m_pRealDatabaseSelect,SIGNAL(signal_showOrHideColumn(int,int)),
|
|
|
|
|
|
m_pRealDatabaseShow,SLOT(slot_showOrHindColumn(int,int)));
|
|
|
|
|
|
connect(m_pRealDataWatch,SIGNAL(signal_selectTextEdit(QString ,QString , int )),
|
|
|
|
|
|
this,SLOT(slot_selectTextEdit(QString,QString, int )));
|
|
|
|
|
|
connect(m_pRealDataWatch,SIGNAL(signal_paging()),m_pRealDataSelect,SLOT(slot_paging()));
|
|
|
|
|
|
connect(m_pRealDatabaseShow,SIGNAL(signal_selectTextEdit(QString)),
|
|
|
|
|
|
this,SLOT(slot_selectTextEdit(QString)));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugTool::changeTab(int index)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (index) {
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
ui->textEdit_status->setHidden(true);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
ui->textEdit_status->setHidden(false);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:{
|
|
|
|
|
|
ui->textEdit_status->setHidden(false);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->textEdit_status->setHidden(true);
|
|
|
|
|
|
if(m_pFessim == NULL)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pFessim = new CFessim;
|
|
|
|
|
|
addFessim();
|
|
|
|
|
|
}
|
|
|
|
|
|
//此处判断是否连接 若连接 则不做处理 若断开状态 则直接调用连接
|
|
|
|
|
|
if(!m_pFessim->isConnect())
|
|
|
|
|
|
{
|
|
|
|
|
|
if(!m_pFessim->slot_connect())
|
|
|
|
|
|
{
|
|
|
|
|
|
return ;
|
|
|
|
|
|
}
|
|
|
|
|
|
int index = m_pFessim->getCurrentIndex();
|
|
|
|
|
|
m_pFessim->setActiveWindow(index);
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugTool::slot_selectTextEdit(QString allStatus, QString m_allName, int m_value)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->textEdit_status->setReadOnly(true);
|
|
|
|
|
|
ui->textEdit_status->setText("当前标签为"+m_allName+", 值为"
|
|
|
|
|
|
+QString::number(m_value)+", 状态为"
|
|
|
|
|
|
+allStatus);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
void CDebugTool::slot_selectTextEdit(QString allQString)
|
|
|
|
|
|
{ ui->textEdit_status->setReadOnly(true);
|
|
|
|
|
|
ui->textEdit_status->setText(allQString);
|
|
|
|
|
|
}
|