IncCamera.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #pragma once
  2. #include <QMainWindow>
  3. #include "ui_IncCamera.h"
  4. //set a struct to save the camera information
  5. typedef struct CAMERAINFO
  6. {
  7. //the camera User name
  8. QString szUserName;
  9. //the camera password
  10. QString szPassword;
  11. //the camera ip address
  12. QString szIpAddress1;
  13. QString szIpAddress2;
  14. QString szIpAddress3;
  15. QString szIpAddress4;
  16. //the camera port
  17. int nPort;
  18. //the camera channel
  19. int nChannel;
  20. //the camera stream type
  21. int nStreamType;
  22. //the camera horizon offset
  23. int nHorizonOffset;
  24. //the camera vertical offset
  25. int nVerticalOffset;
  26. //the camera light offset
  27. int nLightOffset;
  28. //set a flags to indicate the right check is checked
  29. bool bIsCheckRight;
  30. //define two int to record the camera item row and col index
  31. int nColIndex;
  32. int nRowIndex;
  33. //set a constructor to init the value
  34. CAMERAINFO()
  35. {
  36. szUserName = "";
  37. szPassword = "";
  38. szIpAddress1 = "";
  39. szIpAddress2 = "";
  40. szIpAddress3 = "";
  41. szIpAddress4 = "";
  42. nPort = 0;
  43. nChannel = 0;
  44. nStreamType = 0;
  45. nHorizonOffset = 0;
  46. nVerticalOffset = 0;
  47. nLightOffset = 0;
  48. nColIndex = 0;
  49. nRowIndex = 0;
  50. bIsCheckRight = false;
  51. }
  52. //set a function to output complete camera ip address
  53. QString GetCompleteIpAddress()
  54. {
  55. QString szCompleteIpAddress = "";
  56. //set a branch to judge the right check is checked
  57. if (bIsCheckRight)
  58. {
  59. szCompleteIpAddress = "rtsp://" + szUserName + ":" + szPassword + "@"
  60. + szIpAddress1 + "." + szIpAddress2 + "." + szIpAddress3 + "." + szIpAddress4
  61. + ":" + QString::number(nPort) + "/0/" + QString::number(nChannel) + "/" + QString::number(nStreamType);
  62. }
  63. else
  64. {
  65. szCompleteIpAddress = "rtsp://"
  66. + szIpAddress1 + "." + szIpAddress2 + "." + szIpAddress3 + "." + szIpAddress4
  67. + ":" + QString::number(nPort) + "/0/" + QString::number(nChannel) + "/" + QString::number(nStreamType);
  68. }
  69. return szCompleteIpAddress;
  70. }
  71. }CAMERA_INFO,*LPCAMERA_INFO;
  72. class IncCamera : public QMainWindow
  73. {
  74. Q_OBJECT
  75. public:
  76. IncCamera(QWidget *parent = nullptr);
  77. ~IncCamera();
  78. //use to set connect the signal and slot
  79. void SetConnect();
  80. //set a ok button slot
  81. void OnOKBtnClicked();
  82. //set a cancel button slot
  83. void OnCancelBtnClicked();
  84. //set a function to get the camera information
  85. CAMERAINFO GetCameraInfo();
  86. //set a function to get the ok button is clicked
  87. bool GetIsOKBtnClicked();
  88. //set a slot to set the main stream select radio button is clicked
  89. void OnMainSteamSelectRadioClicked();
  90. //set a slot to set the right check is checked
  91. void OnIsCheckRightCheckClicked();
  92. private:
  93. Ui::IncCameraClass ui;
  94. //set a struct to save the camera information
  95. CAMERAINFO m_CameraInfo;
  96. //set a flags to indicate the ok button is clicked
  97. bool m_bIsOKBtnClicked;
  98. };