device_log_dialog.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * @file device_log_dialog.h
  3. * @brief 设备日志对话框 - 显示设备加载历史和状态信息
  4. */
  5. #ifndef DEVICE_LOG_DIALOG_H
  6. #define DEVICE_LOG_DIALOG_H
  7. #include <QDialog>
  8. #include <QString>
  9. #include "soft_bus_core/soft_bus_core.h"
  10. class QLabel;
  11. class QTextEdit;
  12. class QPushButton;
  13. class QVBoxLayout;
  14. class QHBoxLayout;
  15. class DeviceBusCore;
  16. /**
  17. * @brief 设备日志对话框 - 显示设备加载历史和状态信息
  18. */
  19. class DeviceLogDialog : public QDialog
  20. {
  21. Q_OBJECT
  22. public:
  23. explicit DeviceLogDialog(QWidget* parent = nullptr);
  24. ~DeviceLogDialog();
  25. /**
  26. * @brief 设置设备信息并显示日志
  27. * @param deviceInfo 设备信息
  28. * @param busCore 设备总线核心(用于查询历史数据)
  29. */
  30. void setDeviceInfo(const DeviceInfo& deviceInfo, DeviceBusCore* busCore = nullptr);
  31. private slots:
  32. void onRefresh();
  33. void onClose();
  34. private:
  35. /**
  36. * @brief 更新日志内容
  37. */
  38. void updateLog();
  39. /**
  40. * @brief 获取设备加载历史文本
  41. */
  42. QString getDeviceHistoryText() const;
  43. private:
  44. DeviceInfo m_deviceInfo;
  45. DeviceBusCore* m_busCore;
  46. QLabel* m_deviceNameLabel;
  47. QLabel* m_deviceInfoLabel;
  48. QTextEdit* m_logTextEdit;
  49. QPushButton* m_refreshButton;
  50. QPushButton* m_closeButton;
  51. QVBoxLayout* m_mainLayout;
  52. QHBoxLayout* m_buttonLayout;
  53. };
  54. #endif // DEVICE_LOG_DIALOG_H