代码拉取完成,页面将自动刷新
#include "videosetting.h"
#include "ui_videosetting.h"
#define BUTTON_DELAY_TIME (500)
VideoSetting::VideoSetting(QWidget *parent) :
QWidget(parent),
ui(new Ui::VideoSetting)
{
ui->setupUi(this);
this->hide();
m_VideoChannelSetting = new VideoChannelSetting;
m_NetWorkCameraChannel1 = NetWorkCameraChannel1::GetInstance();
QObjectList list = this->children();
QFrame *W;
foreach(QObject *obj,list)
{
W = qobject_cast<QFrame*>(obj);
if(W)
{
list += W->children();
}
}
QLineEdit *Line;
foreach(QObject *obj,list)
{
Line = qobject_cast<QLineEdit*>(obj);
if(Line)
{
Line->setInputMethodHints(Qt::ImhDigitsOnly);
}
}
m_DataDictionary = DataDictionary::GetInstance();
m_UpPbTimer = new QTimer;
m_UpPbTimer->setInterval(BUTTON_DELAY_TIME);
m_DownPbTimer = new QTimer;
m_DownPbTimer->setInterval(BUTTON_DELAY_TIME);
m_LeftPbTimer = new QTimer;
m_LeftPbTimer->setInterval(BUTTON_DELAY_TIME);
m_RightPbTimer = new QTimer;
m_RightPbTimer->setInterval(BUTTON_DELAY_TIME);
m_EnlargePbTimer = new QTimer;
m_EnlargePbTimer->setInterval(BUTTON_DELAY_TIME);
m_NarrowPbTimer = new QTimer;
m_NarrowPbTimer->setInterval(BUTTON_DELAY_TIME);
// ui->VideoImageBox->setStyleSheet("QCheckBox\
// {\
// height:24px;\
// font: 30px 'Ubuntu';\
// font:bold;\
// color: rgb(255, 255, 255);\
// border:0px solid;\
// }\
// QCheckBox::indicator\
// {\
// width:20px;\
// height:20px;\
// border:1px solid;\
// border-color: rgb(255, 255, 255);\
// }");
ui->CameraTypeBox->setStyleSheet("QCheckBox\
{\
height:24px;\
font: 30px 'Ubuntu';\
font:bold;\
color: rgb(255, 255, 255);\
border:0px solid;\
}\
QCheckBox::indicator\
{\
width:20px;\
height:20px;\
border:1px solid;\
border-color: rgb(255, 255, 255);\
}\
QCheckBox::indicator:unchecked\
{\
image:url(:/image/Transparent.png);\
}\
QCheckBox::indicator:checked\
{\
image:url(:/image/VolumeCircle.png);\
}");
Diaplay();
SetAllAlias();
connect(m_UpPbTimer,SIGNAL(timeout()),this,SLOT(SetVRaiseValue()));
connect(m_DownPbTimer,SIGNAL(timeout()),this,SLOT(SetVLessenValue()));
connect(m_LeftPbTimer,SIGNAL(timeout()),this,SLOT(SetHLessenValue()));
connect(m_RightPbTimer,SIGNAL(timeout()),this,SLOT(SetHRaiseValue()));
connect(m_EnlargePbTimer,SIGNAL(timeout()),this,SLOT(SetZoomRaiseValue()));
connect(m_NarrowPbTimer,SIGNAL(timeout()),this,SLOT(SetZoomLessenValue()));
}
VideoSetting::~VideoSetting()
{
delete ui;
}
void VideoSetting::showEvent(QShowEvent *event)
{
m_NetWorkCameraChannel1->Show(ui->Video,0,0);
m_NetWorkCameraChannel1->resize(ui->Video->size());
ScreenSwitchButton::GetInstance()->Show(this);
Diaplay();
connect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
this,SLOT(MisDataChangeProcess(MisDataIndex_t)));
connect(m_DataDictionary,SIGNAL(CameraCtlDataChange(CameraCtlIndex_t)),
this,SLOT(CameraCtlDataChangeProcess(CameraCtlIndex_t)));
connect(m_DataDictionary,SIGNAL(MonitorRtDataChange(MonitorRtDataIndex_t)),
this,SLOT(MonitorRtDataChangeProcess(MonitorRtDataIndex_t)));
}
void VideoSetting::hideEvent(QHideEvent *event)
{
disconnect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
this,SLOT(MisDataChangeProcess(MisDataIndex_t)));
disconnect(m_DataDictionary,SIGNAL(CameraCtlDataChange(CameraCtlIndex_t)),
this,SLOT(CameraCtlDataChangeProcess(CameraCtlIndex_t)));
disconnect(m_DataDictionary,SIGNAL(MonitorRtDataChange(MonitorRtDataIndex_t)),
this,SLOT(MonitorRtDataChangeProcess(MonitorRtDataIndex_t)));
}
void VideoSetting::SetAllAlias()
{
ui->ZoomMultiple->SetAlias("最大倍数百分比");
ui->MaxDistance->SetAlias("最大距离");
ui->HAim->SetAlias("水平对准");
ui->HAngle->SetAlias("水平角度");
ui->VAngle->SetAlias("垂直角度");
ui->AlignVAngle->SetAlias("垂直角度校准");
ui->AlignVHeight->SetAlias("垂直距离校准");
ui->HeightRatio->SetAlias("高度系数");
//ui->FollowHookfrq->SetAlias("跟勾频率");
}
void VideoSetting::Diaplay()
{
ui->Height->setText(m_DataDictionary->GetMonitorRtData(M_HEIGHT));
ui->Scope->setText(m_DataDictionary->GetMonitorRtData(M_SCOPE));
DispCameraStep();
DispCameraMaxZoom();
DispCameraMaxDistance();
DispCurHAngle();
DispCurVAngle();
ui->AlignVHeight->setText(m_DataDictionary->GetMisData(MIS_ALIGN_V_HEIGHT));
ui->AlignVAngle->setText(m_DataDictionary->GetMisData(MIS_ALIGN_V_ANGLE));
ui->HeightRatio->setText(m_DataDictionary->GetMisData(MIS_ALIGN_V_HEIGHT_RATIO));
SetAlignSta(m_DataDictionary->GetMisData(MIS_ALIGN_STA).toUInt());
if(m_DataDictionary->GetMisData(MIS_CAMERA_GUN_STA).toUInt() == CAMERA_GUN_CHECK)
{
ui->CameraTypeBox->setChecked(true);
}else {
ui->CameraTypeBox->setChecked(false);
}
ui->HAim->setText(m_DataDictionary->GetMisData(MIS_H_ANGLE_INIT));
ui->FollowHookfrq->setText(m_DataDictionary->GetMisData(MIS_FOLLOW_HOOK_FRQ));
}
void VideoSetting::DisableAllCtl()
{
ui->Shield->show();
}
void VideoSetting::EnableAllCtl()
{
ui->Shield->hide();
}
void VideoSetting::SetAlignSta(bool Sta)
{
if(Sta){
ui->AlignDisable->setStyleSheet("border:2px solid rgb(255,255,255);\
font: 24px'Ubuntu';\
font:bold;\
color: rgb(255, 255, 255);");
ui->AlignEnable->setStyleSheet("background-color: rgb(251, 160, 57);\
border:2px solid rgb(251, 160, 57);\
font: 24px'Ubuntu';\
font:bold;\
color: rgb(255, 255, 255);");
ui->AlignEnable->setEnabled(false);
ui->AlignDisable->setEnabled(true);
DisableAllCtl();
}else{
ui->AlignEnable->setStyleSheet("border:2px solid rgb(255,255,255);\
font: 24px'Ubuntu';\
font:bold;\
color: rgb(255, 255, 255);");
ui->AlignDisable->setStyleSheet("background-color: rgb(251, 160, 57);\
border:2px solid rgb(251, 160, 57);\
font: 24px'Ubuntu';\
font:bold;\
color: rgb(255, 255, 255);");
ui->AlignEnable->setEnabled(true);
ui->AlignDisable->setEnabled(false);
EnableAllCtl();
}
}
void VideoSetting::DispCurHAngle()
{
ui->HAngle->setText(m_DataDictionary->GetCameraCtlData(CAM_CUR_H_ANGLE));
}
void VideoSetting::DispCurVAngle()
{
ui->VAngle->setText(m_DataDictionary->GetCameraCtlData(CAM_CUR_V_ANGLE));
}
void VideoSetting::DispCameraStep()
{
QString str = m_DataDictionary->GetMisData(MIS_CAMERA_STEP);
str.setNum(str.toUInt());
ui->Step->setCurrentText(str);
}
void VideoSetting::DispCameraMaxZoom()
{
QString str;
str = m_DataDictionary->GetMisData(MIS_CAMERA_MAX_ZOOM);
str.setNum(str.toUInt());
ui->ZoomMultiple->setText(str);
}
void VideoSetting::DispCameraMaxDistance()
{
ui->MaxDistance->setText(m_DataDictionary->GetMisData(MIS_CAMERA_MAX_DISTANCE));
}
void VideoSetting::MisDataChangeProcess(MisDataIndex_t Index)
{
switch(Index)
{
case MIS_CAMERA_STEP:
DispCameraStep();
break;
case MIS_CAMERA_MAX_ZOOM:
DispCameraMaxZoom();
break;
case MIS_CAMERA_MAX_DISTANCE:
DispCameraMaxDistance();
break;
case MIS_ALIGN_V_ANGLE:
ui->AlignVAngle->setText(m_DataDictionary->GetMisData(Index));
break;
case MIS_ALIGN_V_HEIGHT:
ui->AlignVHeight->setText(m_DataDictionary->GetMisData(Index));
break;
case MIS_ALIGN_V_HEIGHT_RATIO:
ui->HeightRatio->setText(m_DataDictionary->GetMisData(Index));
break;
case MIS_FOLLOW_HOOK_FRQ:
ui->FollowHookfrq->setText(m_DataDictionary->GetMisData(Index));
break;
default:
break;
}
}
void VideoSetting::CameraCtlDataChangeProcess(CameraCtlIndex_t Index)
{
switch(Index)
{
case CAM_CUR_H_ANGLE:
DispCurHAngle();
break;
case CAM_CUR_V_ANGLE:
DispCurVAngle();
break;
default:
break;
}
}
void VideoSetting::MonitorRtDataChangeProcess(MonitorRtDataIndex_t index)
{
switch (index) {
case M_HEIGHT:
ui->Height->setText(m_DataDictionary->GetMonitorRtData(index));
break;
case M_SCOPE:
ui->Scope->setText(m_DataDictionary->GetMonitorRtData(index));
break;
default:
break;
}
}
void VideoSetting::SetHRaiseValue()
{
double CurV = m_DataDictionary->GetCameraCtlData(CAM_CUR_H_VALUE).toDouble();
double Step = m_DataDictionary->GetMisData(MIS_CAMERA_STEP_CAL).toDouble();
m_DataDictionary->SetCameraCtlData(CAM_REQ_H_VALUE,CurV+Step);
}
void VideoSetting::SetHLessenValue()
{
double CurV = m_DataDictionary->GetCameraCtlData(CAM_CUR_H_VALUE).toDouble();
double Step = m_DataDictionary->GetMisData(MIS_CAMERA_STEP_CAL).toDouble();
m_DataDictionary->SetCameraCtlData(CAM_REQ_H_VALUE,CurV-Step);
}
void VideoSetting::SetVRaiseValue()
{
double CurV = m_DataDictionary->GetCameraCtlData(CAM_CUR_V_VALUE).toDouble();
double Step = m_DataDictionary->GetMisData(MIS_CAMERA_STEP_CAL).toDouble();
m_DataDictionary->SetCameraCtlData(CAM_REQ_V_VALUE,CurV+Step);
}
void VideoSetting::SetVLessenValue()
{
double CurV = m_DataDictionary->GetCameraCtlData(CAM_CUR_V_VALUE).toDouble();
double Step = m_DataDictionary->GetMisData(MIS_CAMERA_STEP_CAL).toDouble();
m_DataDictionary->SetCameraCtlData(CAM_REQ_V_VALUE,CurV-Step);
}
void VideoSetting::SetZoomRaiseValue()
{
double CurV = m_DataDictionary->GetCameraCtlData(CAM_CUR_ZOOM_VALUE).toDouble();
double Step = m_DataDictionary->GetMisData(MIS_CAMERA_STEP_CAL).toDouble();
m_DataDictionary->SetCameraCtlData(CAM_REQ_ZOOM_VALUE,CurV+Step);
}
void VideoSetting::SetZoomLessenValue()
{
double CurV = m_DataDictionary->GetCameraCtlData(CAM_CUR_ZOOM_VALUE).toDouble();
double Step = m_DataDictionary->GetMisData(MIS_CAMERA_STEP_CAL).toDouble();
m_DataDictionary->SetCameraCtlData(CAM_REQ_ZOOM_VALUE,CurV-Step);
}
void VideoSetting::on_PztUp_pressed()
{
SetVRaiseValue();
m_UpPbTimer->start();
}
void VideoSetting::on_PztUp_released()
{
m_UpPbTimer->stop();
}
void VideoSetting::on_PztEnlarge_pressed()
{
SetZoomRaiseValue();
m_EnlargePbTimer->start();
}
void VideoSetting::on_PztEnlarge_released()
{
m_EnlargePbTimer->stop();
}
void VideoSetting::on_PztNarrow_pressed()
{
SetZoomLessenValue();
m_NarrowPbTimer->start();
}
void VideoSetting::on_PztNarrow_released()
{
m_NarrowPbTimer->stop();
}
void VideoSetting::on_PztRight_pressed()
{
SetHRaiseValue();
m_RightPbTimer->start();
}
void VideoSetting::on_PztRight_released()
{
m_RightPbTimer->stop();
}
void VideoSetting::on_PtzDown_pressed()
{
SetVLessenValue();
m_DownPbTimer->start();
}
void VideoSetting::on_PtzDown_released()
{
m_DownPbTimer->stop();
}
void VideoSetting::on_PztLeft_pressed()
{
SetHLessenValue();
m_LeftPbTimer->start();
}
void VideoSetting::on_PztLeft_released()
{
m_LeftPbTimer->stop();
}
void VideoSetting::on_ChannelSettingButton_clicked()
{
m_VideoChannelSetting->show();
}
void VideoSetting::on_AlignEnable_clicked()
{
SetAlignSta(true);
if(m_DataDictionary->GetMisData(MIS_ALIGN_STA).toUInt() == ALIGN_DISABLE){
m_DataDictionary->SetMisData(MIS_ALIGN_STA,ALIGN_ENABLE);
}
}
void VideoSetting::on_AlignDisable_clicked()
{
SetAlignSta(false);
if(m_DataDictionary->GetMisData(MIS_ALIGN_STA).toUInt() == ALIGN_ENABLE){
m_DataDictionary->SetMisData(MIS_ALIGN_STA,ALIGN_DISABLE);
}
}
void VideoSetting::on_Step_currentTextChanged(const QString &arg1)
{
disconnect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
this,SLOT(MisDataChangeProcess(MisDataIndex_t)));
m_DataDictionary->SetMisData(MIS_CAMERA_STEP,(arg1.toUInt()));
connect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
this,SLOT(MisDataChangeProcess(MisDataIndex_t)));
}
void VideoSetting::on_ZoomMultiple_returnPressed()
{
disconnect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),this,
SLOT(MisDataChangeProcess(MisDataIndex_t)));
QString str;
int v = ui->ZoomMultiple->text().toInt();
v = (v > 100)?100:v;
v = (v < 0)?0:v;
str.setNum(v);
ui->ZoomMultiple->setText(str);
m_DataDictionary->SetMisData(MIS_CAMERA_MAX_ZOOM,v);
connect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),this,
SLOT(MisDataChangeProcess(MisDataIndex_t)));
}
void VideoSetting::on_MaxDistance_returnPressed()
{
QString str;
str = str.sprintf("%0.3f",ui->MaxDistance->text().toDouble());
ui->MaxDistance->setText(str);
disconnect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),this,
SLOT(MisDataChangeProcess(MisDataIndex_t)));
m_DataDictionary->SetMisData(MIS_CAMERA_MAX_DISTANCE,str.toDouble());
connect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),this,
SLOT(MisDataChangeProcess(MisDataIndex_t)));
}
void VideoSetting::on_HAim_returnPressed()
{
m_DataDictionary->SetCameraCtlData(CAM_REQ_H_ANGLE,ui->HAim->text().toDouble());
m_DataDictionary->SetMisData(MIS_H_ANGLE_INIT,ui->HAngle->text());
}
void VideoSetting::on_AlignVAngle_returnPressed()
{
disconnect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
this,SLOT(MisDataChangeProcess(MisDataIndex_t)));
m_DataDictionary->SetMisData(MIS_ALIGN_V_ANGLE,ui->AlignVAngle->text());
connect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
this,SLOT(MisDataChangeProcess(MisDataIndex_t)));
}
void VideoSetting::on_AlignVHeight_returnPressed()
{
disconnect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
this,SLOT(MisDataChangeProcess(MisDataIndex_t)));
m_DataDictionary->SetMisData(MIS_ALIGN_V_HEIGHT,ui->AlignVHeight->text());
connect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
this,SLOT(MisDataChangeProcess(MisDataIndex_t)));
}
void VideoSetting::on_HeightRatio_returnPressed()
{
disconnect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
this,SLOT(MisDataChangeProcess(MisDataIndex_t)));
m_DataDictionary->SetMisData(MIS_ALIGN_V_HEIGHT_RATIO,ui->HeightRatio->text());
connect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
this,SLOT(MisDataChangeProcess(MisDataIndex_t)));
}
void VideoSetting::on_pushButton_3_clicked()
{
double VAngle = m_DataDictionary->GetCameraCtlData(CAM_CUR_V_ANGLE).toDouble();
m_DataDictionary->SetMisData(MIS_ALIGN_V_ANGLE,VAngle);
}
void VideoSetting::on_pushButton_4_clicked()
{
double AlignVHeight;
double VAngle = (m_DataDictionary->GetCameraCtlData(CAM_CUR_V_ANGLE).toDouble() - m_DataDictionary->GetMisData(MIS_ALIGN_V_ANGLE).toDouble());
double HDistance = m_DataDictionary->GetDevParamData(D_ARM_LENGTH).toInt() - m_DataDictionary->GetMonitorRtData(M_SCOPE).toDouble();
double BaseHeight = 0;
double AlignVRatio = m_DataDictionary->GetMisData(MIS_ALIGN_V_HEIGHT_RATIO).toDouble();
AlignVHeight = qTan(qDegreesToRadians(VAngle)) * HDistance;
if(m_DataDictionary->GetMisData(MIS_HEIGHT_ZERO_POS).toUInt() == LAND_ZERO_POS)
{
BaseHeight =m_DataDictionary->GetDevParamData(D_HEIGHT).toDouble() - m_DataDictionary->GetMonitorRtData(M_HEIGHT).toDouble();
}
else
{
BaseHeight = m_DataDictionary->GetMonitorRtData(M_HEIGHT).toDouble();
}
AlignVHeight = BaseHeight- AlignVHeight;
// if(AlignVRatio > 0)
// {
// AlignVHeight = AlignVHeight/AlignVRatio;
// }
m_DataDictionary->SetMisData(MIS_ALIGN_V_HEIGHT,AlignVHeight);
}
void VideoSetting::on_SetAngle_clicked()
{
m_DataDictionary->SetCameraCtlData(CAM_REQ_H_ANGLE,QString("%1").arg(ui->HAngle->text().toDouble(),0,'f',1));
m_DataDictionary->SetCameraCtlData(CAM_REQ_V_ANGLE,QString("%1").arg(ui->VAngle->text().toDouble(),0,'f',1));
}
void VideoSetting::on_CameraTypeBox_stateChanged(int arg1)
{
if(arg1 == Qt::Unchecked)
{
m_DataDictionary->SetMisData(MIS_CAMERA_GUN_STA,CAMERA_GUN_UNCHECK);
}
else if(arg1 == Qt::Checked)
{
m_DataDictionary->SetMisData(MIS_CAMERA_GUN_STA,CAMERA_GUN_CHECK);
}
}
void VideoSetting::on_VideoImageBox_stateChanged(int arg1)
{
if(arg1 == Qt::Unchecked)
{
m_DataDictionary->SetMisData(MIS_CAMERA_IMAGE,CAMERA_GUN_UNCHECK);
}
else if(arg1 == Qt::Checked)
{
m_DataDictionary->SetMisData(MIS_CAMERA_IMAGE,CAMERA_GUN_CHECK);
}
}
void VideoSetting::on_FollowHookfrq_returnPressed()
{
m_DataDictionary->SetMisData(MIS_FOLLOW_HOOK_FRQ,ui->FollowHookfrq->text());
}
void VideoSetting::on_Reset_clicked()
{
m_DataDictionary->SetMisData(MIS_ALIGN_V_HEIGHT_RATIO,\
m_DataDictionary->GetResetData(RESET_ALIGN_V_HEIGHT_RATIO));
m_DataDictionary->SetMisData(MIS_ALIGN_V_ANGLE,\
m_DataDictionary->GetResetData(RESET_ALIGN_V_ANGLE));
m_DataDictionary->SetMisData(MIS_ALIGN_V_HEIGHT,\
m_DataDictionary->GetResetData(RESET_ALIGN_V_HEIGHT));
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。