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.

106 lines
3.1 KiB

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