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
106 lines
3.1 KiB
#include "editCameraDialog.h"
|
|
guiEditCameraDialog::guiEditCameraDialog():QDialog(){
|
|
m_pCamera = NULL;
|
|
m_pFileBrowse = NULL;
|
|
memset(&m_sInfo, 0, sizeof(SOURCE_INFO));
|
|
|
|
QDialog::setWindowTitle("Video Source Settings");
|
|
QDialog::setWindowIcon(QIcon(":pictures/appbar.cog.png"));
|
|
QGroupBox *grpBox = new QGroupBox(this);
|
|
grpBox->setGeometry(QRect(10, 5, 215, 45));
|
|
grpBox->setTitle("Source Type");
|
|
m_pSourceType = new QComboBox(grpBox);
|
|
m_pSourceType->addItem("Local Device");
|
|
m_pSourceType->addItem("IP Stream");
|
|
m_pSourceType->addItem("Local File");
|
|
connect(m_pSourceType,
|
|
static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
this,
|
|
&guiEditCameraDialog::handleSourceTypeChange);
|
|
m_pSourceType->setGeometry(QRect(5, 15, 100, 20));
|
|
m_pControlType = new QComboBox(grpBox);
|
|
m_pControlType->addItem("Static Camera");
|
|
m_pControlType->addItem("PTZ Camera");
|
|
connect(m_pControlType,
|
|
static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
this,
|
|
&guiEditCameraDialog::handleControlTypeChange);
|
|
m_pControlType->setGeometry(QRect(110, 15, 100, 20));
|
|
|
|
grpBox = new QGroupBox(this);
|
|
grpBox->setGeometry(QRect(10, 50, 215, 45));
|
|
grpBox->setTitle("Local Device");
|
|
|
|
grpBox = new QGroupBox(this);
|
|
grpBox->setGeometry(QRect(10, 100, 215, 45));
|
|
grpBox->setTitle("RTSP URI (IP path)");
|
|
grpBox->setEnabled(false);
|
|
|
|
grpBox = new QGroupBox(this);
|
|
grpBox->setGeometry(QRect(10, 150, 215, 45));
|
|
grpBox->setTitle("Local File");
|
|
m_pFileBrowse = new QFileDialog(grpBox);
|
|
QPushButton *pushBtn;
|
|
pushBtn = new QPushButton(grpBox);
|
|
pushBtn->setText("Browse");
|
|
connect(pushBtn, &QPushButton::clicked, this, &guiEditCameraDialog::handleFileChoose);
|
|
//grpBox->setEnabled(false);
|
|
//QObject::connect(acceptButton, SIGNAL(clicked()), this, SLOT(accept()));
|
|
//QObject::connect(rejectButton, SIGNAL(clicked()), this, SLOT(reject()));
|
|
};
|
|
|
|
guiEditCameraDialog::~guiEditCameraDialog(){
|
|
|
|
};
|
|
|
|
void guiEditCameraDialog::show(void){
|
|
if (m_pCamera != NULL){
|
|
SOURCE_INFO *tInfo;
|
|
tInfo = m_pCamera->getInfo();
|
|
if (tInfo != NULL) memcpy(&m_sInfo, tInfo, sizeof(SOURCE_INFO));
|
|
};
|
|
m_pControlType->setCurrentIndex(m_sInfo.type);
|
|
m_pSourceType->setCurrentIndex(m_sInfo.subtype);
|
|
QDialog::show();
|
|
};
|
|
|
|
bool guiEditCameraDialog::attachCamera(basicCameraPTZ *ptr){
|
|
if (ptr == NULL)return false;
|
|
m_pCamera = ptr;
|
|
};
|
|
|
|
void guiEditCameraDialog::handleSourceTypeChange(int index){
|
|
m_sInfo.subtype = index;
|
|
if (m_sInfo.subtype == 2){
|
|
// File -> Disable Camera Control
|
|
m_sInfo.type = 0;
|
|
m_pControlType->setEnabled(false);
|
|
m_pControlType->setCurrentIndex(m_sInfo.type);
|
|
} else {
|
|
m_pControlType->setEnabled(true);
|
|
};
|
|
if (m_pCamera != NULL){
|
|
};
|
|
};
|
|
|
|
void guiEditCameraDialog::handleControlTypeChange(int index){
|
|
m_sInfo.type = index;
|
|
switch (m_sInfo.type){
|
|
case 0: // Static Camera
|
|
break;
|
|
case 1: // PTZ Camera
|
|
break;
|
|
};
|
|
if (m_pCamera != NULL){
|
|
};
|
|
};
|
|
|
|
void guiEditCameraDialog::handleFileChoose(void){
|
|
if (m_pFileBrowse == NULL){
|
|
m_pFileBrowse = new QFileDialog();
|
|
};
|
|
if (m_pFileBrowse != NULL){
|
|
int dialogCode = m_pFileBrowse->exec();
|
|
|
|
};
|
|
};
|