dialog.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef DIALOG_H
  2. #define DIALOG_H
  3. #include <QDialog>
  4. #include <QStandardItemModel>
  5. #include <list>
  6. #include "dhnetsdk.h"
  7. namespace Ui {
  8. class Dialog;
  9. }
  10. // TableView 表的表头
  11. typedef enum
  12. {
  13. LISTCOLUMN_INDEX = 0,
  14. LISTCOLUMN_TIME,
  15. LISTCOLUMN_CHANNEL,
  16. LISTCOLUMN_ALARM_MESSAGE
  17. }LISTVIEW_COLUMN;
  18. // 报警信息
  19. struct AlarmInfo
  20. {
  21. int nType;
  22. int nChannel;
  23. };
  24. class Dialog : public QDialog
  25. {
  26. Q_OBJECT
  27. public:
  28. explicit Dialog(QWidget *parent = 0);
  29. ~Dialog();
  30. private slots:
  31. void on_Login_pushButton_clicked();
  32. void on_StartListen_pushButton_clicked();
  33. protected:
  34. virtual void keyPressEvent(QKeyEvent* );
  35. private:
  36. // 初始化界面
  37. void InitWidget();
  38. // 初始化SDK
  39. void InitNetsdk();
  40. // 反初始化
  41. void UnInit();
  42. // 将登陆错误码转换为字符串
  43. void ConvertLoginError2String(int nErrorCode , QString &strErrorCode);
  44. // 在列表中查找报警,可以选择查找后删除
  45. bool FindAlarmInList(int nType, int nChannel, bool isDelete);
  46. // 在tableView中显示报警信息
  47. void ShowAlarmInfoInTableView(AlarmInfo stAlarmInfo, bool bAlarmStatus);
  48. // 将报警枚举转换为字符串
  49. void ConvertAlarmType2String(int nType, bool status, QString& AlarmType);
  50. public:
  51. // 报警信息上报函数
  52. void SetAlarmMessage(int nType, char* pBuf, int nSize);
  53. private:
  54. Ui::Dialog* ui;
  55. QStandardItemModel m_Model;
  56. // 登陆句柄
  57. LLONG m_lLoginId;
  58. // 是否订阅了报警
  59. bool m_bSubcribe;
  60. // 报警信息列表,值保存正在报警的报警信息
  61. std::list<AlarmInfo> m_listAlarmInfo;
  62. };
  63. #endif // DIALOG_H