You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
  1. #include "editCameraDialog.h"
  2. guiEditCameraDialog::guiEditCameraDialog():QDialog(){
  3. m_pCamera = NULL;
  4. m_pFileBrowse = NULL;
  5. memset(&m_pCameraInfo, 0, sizeof(basicCameraInfo));
  6. memset(&m_pPTZInfo, 0, sizeof(basicPTZCameraInfo));
  7. QDialog::setWindowTitle("Video Source Settings");
  8. QDialog::setWindowIcon(QIcon(":pictures/appbar.cog.png"));
  9. QGroupBox *grpBox = new QGroupBox(this);
  10. grpBox->setGeometry(QRect(10, 5, 215, 45));
  11. grpBox->setTitle("Source Type");
  12. m_pSourceType = new QComboBox(grpBox);
  13. m_pSourceType->addItem("Local Device");
  14. m_pSourceType->addItem("IP Stream");
  15. m_pSourceType->addItem("Local File");
  16. connect(m_pSourceType,
  17. static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
  18. this,
  19. &guiEditCameraDialog::handleSourceTypeChange);
  20. m_pSourceType->setGeometry(QRect(5, 15, 100, 20));
  21. m_pControlType = new QComboBox(grpBox);
  22. m_pControlType->addItem("Static Camera");
  23. m_pControlType->addItem("PTZ Camera");
  24. connect(m_pControlType,
  25. static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
  26. this,
  27. &guiEditCameraDialog::handleControlTypeChange);
  28. m_pControlType->setGeometry(QRect(110, 15, 100, 20));
  29. grpBox = new QGroupBox(this);
  30. grpBox->setGeometry(QRect(10, 50, 215, 45));
  31. grpBox->setTitle("Local Device");
  32. grpBox = new QGroupBox(this);
  33. grpBox->setGeometry(QRect(10, 100, 215, 45));
  34. grpBox->setTitle("RTSP URI (IP path)");
  35. grpBox->setEnabled(false);
  36. grpBox = new QGroupBox(this);
  37. grpBox->setGeometry(QRect(10, 150, 215, 45));
  38. grpBox->setTitle("Local File");
  39. m_pFileBrowse = new QFileDialog(grpBox);
  40. QPushButton *pushBtn;
  41. pushBtn = new QPushButton(grpBox);
  42. pushBtn->setText("Browse");
  43. connect(pushBtn, &QPushButton::clicked, this, &guiEditCameraDialog::handleFileChoose);
  44. //grpBox->setEnabled(false);
  45. //QObject::connect(acceptButton, SIGNAL(clicked()), this, SLOT(accept()));
  46. //QObject::connect(rejectButton, SIGNAL(clicked()), this, SLOT(reject()));
  47. };
  48. guiEditCameraDialog::~guiEditCameraDialog(){
  49. };
  50. void guiEditCameraDialog::show(void){
  51. if (m_pCamera != NULL){
  52. basicCameraInfo *tBasic;
  53. basicPTZCameraInfo *tPTZ;
  54. tBasic = m_pCamera->getBasicInfo();
  55. tPTZ = m_pCamera->getPtzInfo();
  56. if (tBasic != NULL) memcpy(&m_pCameraInfo, tBasic, sizeof(basicCameraInfo));
  57. if (tPTZ != NULL) memcpy(&m_pPTZInfo, tPTZ, sizeof(basicPTZCameraInfo));
  58. };
  59. m_pSourceType->setCurrentIndex(m_pCameraInfo.m_iSourceType);
  60. m_pControlType->setCurrentIndex(m_pCameraInfo.m_iCameraType);
  61. QDialog::show();
  62. };
  63. bool guiEditCameraDialog::attachCamera(basicCameraPTZ *ptr){
  64. if (ptr == NULL)return false;
  65. m_pCamera = ptr;
  66. };
  67. void guiEditCameraDialog::handleSourceTypeChange(int index){
  68. m_pCameraInfo.m_iSourceType = index;
  69. if (m_pCameraInfo.m_iSourceType == 2){
  70. // File -> Disable Camera Control
  71. m_pCameraInfo.m_iCameraType = 0;
  72. m_pControlType->setEnabled(false);
  73. m_pControlType->setCurrentIndex(m_pCameraInfo.m_iCameraType);
  74. } else {
  75. m_pControlType->setEnabled(true);
  76. };
  77. if (m_pCamera != NULL){
  78. };
  79. };
  80. void guiEditCameraDialog::handleControlTypeChange(int index){
  81. m_pCameraInfo.m_iCameraType = index;
  82. switch (m_pCameraInfo.m_iCameraType){
  83. case 0: // Static Camera
  84. break;
  85. case 1: // PTZ Camera
  86. break;
  87. };
  88. if (m_pCamera != NULL){
  89. };
  90. };
  91. void guiEditCameraDialog::handleFileChoose(void){
  92. if (m_pFileBrowse == NULL){
  93. m_pFileBrowse = new QFileDialog();
  94. };
  95. if (m_pFileBrowse != NULL){
  96. int dialogCode = m_pFileBrowse->exec();
  97. };
  98. };