176 lines
4.0 KiB
C++
Executable File
176 lines
4.0 KiB
C++
Executable File
/**
|
|
* @file ModelStatusWidget.h
|
|
* @author jinchao
|
|
* @brief 模型状态窗口类
|
|
* @version 1.0
|
|
* @date 2025-03-10
|
|
*
|
|
* @copyright Copyright (c) 2025 COMAC
|
|
*
|
|
*/
|
|
#pragma once
|
|
|
|
#include <QWidget>
|
|
#include <QSplitter>
|
|
#include <QTableWidget>
|
|
#include <QVector>
|
|
#include "../TypeDefine.h"
|
|
#include "ModelInfoUpdateThread.h"
|
|
#include "../SystemStatusWidget/SystemStatusWidget.h"
|
|
|
|
/**
|
|
* @brief 模型状态窗口类
|
|
*/
|
|
class ModelStatusWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
/**
|
|
* @brief 构造函数
|
|
* @param parent 父对象
|
|
* @param systemStatusWidget 系统状态窗口对象
|
|
*/
|
|
ModelStatusWidget(QWidget *parent = nullptr, SystemStatusWidget *systemStatusWidget = nullptr);
|
|
/**
|
|
* @brief 析构函数
|
|
*/
|
|
~ModelStatusWidget();
|
|
|
|
signals:
|
|
/**
|
|
* @brief 更新模型绘图数据的信号
|
|
*/
|
|
void updateModelCutomPlotData();
|
|
/**
|
|
* @brief 控制线程的信号
|
|
*/
|
|
void controlModelInfoThread(bool bActive);
|
|
public slots:
|
|
/**
|
|
* @brief 设置当前选中的标签页索引的槽函数
|
|
* @param index 标签页索引
|
|
*/
|
|
void onSetCurrentTabIndex(int index);
|
|
/**
|
|
* @brief 更新绘图数据的槽函数
|
|
* @param newXData 新的X数据
|
|
* @param newYData 新的Y数据
|
|
*/
|
|
void updatePlotData(const QVector<double> &newXData, const QVector<double> &newYData);
|
|
/**
|
|
* @brief 显示/隐藏线程信息槽函数
|
|
*/
|
|
void toggleThreadInfo();
|
|
/**
|
|
* @brief 更新线程信息页面的槽函数
|
|
* @param threadID 线程ID
|
|
* @param data 线程数据
|
|
*/
|
|
void updateThreadInfoPage(unsigned int threadID, const XNRuntimeData &data);
|
|
/**
|
|
* @brief 模型运行状态表格选择改变的槽函数
|
|
*/
|
|
void onModelStatusTableSelectionChanged();
|
|
/**
|
|
* @brief 更新模型运行数据的槽函数
|
|
* @param data 模型数据
|
|
*/
|
|
void updateModelData(const XNRuntimeData &data);
|
|
/**
|
|
* @brief 显示图表右键菜单的槽函数
|
|
* @param pos 鼠标位置
|
|
*/
|
|
void showChartContextMenu(const QPoint &pos);
|
|
/**
|
|
* @brief 显示频率的槽函数
|
|
*/
|
|
void onShowFrequency();
|
|
/**
|
|
* @brief 显示周期的槽函数
|
|
*/
|
|
void onShowPeriod();
|
|
|
|
private:
|
|
/**
|
|
* @brief 初始化模型信息线程的槽函数
|
|
*/
|
|
void InitialModelInfoThread();
|
|
/**
|
|
* @brief 设置模型状态标签页的槽函数
|
|
*/
|
|
void setupTabModelStatus();
|
|
/**
|
|
* @brief 设置模型状态左面板的槽函数
|
|
* @param splitter 分割器
|
|
*/
|
|
void setupTabModelStatusLeftPanel(QSplitter *splitter);
|
|
/**
|
|
* @brief 创建线程信息页面的槽函数
|
|
* @param threadID 线程ID
|
|
* @return 线程信息页面
|
|
*/
|
|
QWidget *createThreadInfoPage(unsigned int threadID);
|
|
/**
|
|
* @brief 更新线程信息值的槽函数
|
|
* @param threadID 线程ID
|
|
* @param index 索引
|
|
* @param newValue 新值
|
|
*/
|
|
void updateThreadInfoValue(unsigned int threadID, int index, const QString &newValue);
|
|
/**
|
|
* @brief 设置模型状态右面板的槽函数
|
|
* @param splitter 分割器
|
|
*/
|
|
void setupTabModelStatusRightPanel(QSplitter *splitter);
|
|
/**
|
|
* @brief 设置模型状态表格的槽函数
|
|
* @param tableWidget 表格
|
|
*/
|
|
void setupModelStatusTableWidget(QTableWidget *tableWidget);
|
|
/**
|
|
* @brief 设置模型状态图表的槽函数
|
|
* @param chartWidget 图表
|
|
*/
|
|
void setupModelStatusChartWidget(QWidget *chartWidget);
|
|
/**
|
|
* @brief 更新模型表格数据的槽函数
|
|
* @param data 模型数据
|
|
* @param rowIndex 行索引
|
|
*/
|
|
void updateModelTableData(const XNRuntimeData &data, int rowIndex);
|
|
/**
|
|
* @brief 提取字符串末尾数字的槽函数
|
|
* @param str 字符串
|
|
* @param count 数量
|
|
* @return 数字
|
|
*/
|
|
int extractTrailingNumbers(const QString &str, int count);
|
|
|
|
private:
|
|
/**
|
|
* @brief 频率或周期索引
|
|
*/
|
|
int freqOrPeriodIndex = 0;
|
|
/**
|
|
* @brief 当前选中的标签页索引
|
|
*/
|
|
int currentTabIndex = 0;
|
|
/**
|
|
* @brief 模型数据向量
|
|
*/
|
|
QVector<XNRuntimeData> modelDataVec;
|
|
/**
|
|
* @brief 模型信息更新线程
|
|
*/
|
|
ModelInfoUpdateThread *modelThread;
|
|
/**
|
|
* @brief 互斥锁
|
|
*/
|
|
QMutex mutex;
|
|
/**
|
|
* @brief 系统运行状态窗口指针
|
|
*/
|
|
SystemStatusWidget *systemStatusWidget;
|
|
};
|