📄 dsform.cpp
字号:
groupBoxVQ = new QGroupBox( groupBoxCD, "groupBoxVQ" ); groupBoxVQ->setGeometry( QRect( 2, 90, 192, 95 ) ); LabelIQuantL = new QLabel( groupBoxVQ, "LabelIQuantL" ); LabelIQuantL->setGeometry( QRect( 10, 20, 48, 20 ) ); EditIQuantL = new QLineEdit( groupBoxVQ, "EditIQuantL" ); EditIQuantL->setGeometry( QRect( 105, 20, 83, 20 ) ); EditBQuantL = new QLineEdit( groupBoxVQ, "EditBQuantL" ); EditBQuantL->setGeometry( QRect( 105, 44, 83, 20 ) ); LabelBQuantL = new QLabel( groupBoxVQ, "LabelBQuantL" ); LabelBQuantL->setGeometry( QRect( 10, 44, 48, 20 ) ); EditPQuantL = new QLineEdit( groupBoxVQ, "EditPQuantL" ); EditPQuantL->setGeometry( QRect( 105, 68, 83, 20 ) ); LabelPQuantL = new QLabel( groupBoxVQ, "LabelPQuantL" ); LabelPQuantL->setGeometry( QRect( 10, 68, 48, 20 ) ); groupBoxFS = new QGroupBox( groupBoxCD, "groupBoxFS" ); groupBoxFS->setGeometry( QRect( 2, 186, 192, 116 ) ); LabelKeyFrameL = new QLabel( groupBoxFS, "LabelKeyFrameL" ); LabelKeyFrameL->setGeometry( QRect( 2, 20, 104, 20 ) ); EditBFramesL = new QLineEdit( groupBoxFS, "EditBFramesL" ); EditBFramesL->setGeometry( QRect( 105, 44, 83, 20 ) ); LabelBFramesL = new QLabel( groupBoxFS, "LabelBFramesL" ); LabelBFramesL->setGeometry( QRect( 20, 44, 48, 20 ) ); EditPFramesL = new QLineEdit( groupBoxFS, "EditPFramesL" ); EditPFramesL->setGeometry( QRect( 105, 68, 83, 20 ) ); EditPFramesL->setReadOnly ( TRUE ); LabelPFramesL = new QLabel( groupBoxFS, "LabelPFramesL" ); LabelPFramesL->setGeometry( QRect( 20, 68, 48, 20 ) ); LabelFramesRL = new QLabel( groupBoxFS, "LabelFramesRL" ); LabelFramesRL->setGeometry( QRect( 11, 92, 68, 20 ) ); EditFramesRL = new QLineEdit( groupBoxFS, "EditFramesRL" ); EditFramesRL->setGeometry( QRect( 105, 92, 83, 20 ) ); EditKeyFrameL = new QLineEdit( groupBoxFS, "EditKeyFrameL" ); EditKeyFrameL->setGeometry( QRect( 105, 20, 83, 20 ) ); groupBoxPF = new QGroupBox( groupBoxCD, "groupBoxPF" ); groupBoxPF->setGeometry( QRect( 2, 303, 192, 72 ) ); CBMinorEncoderL = new QComboBox( FALSE, groupBoxPF, "CBMinorEncoderL" ); CBMinorEncoderL->setGeometry( QRect( 105, 47, 83, 20 ) ); LabelMinorEncoderL = new QLabel( groupBoxPF, "LabelMinorEncoderL" ); LabelMinorEncoderL->setGeometry( QRect( 3, 47, 85, 20 ) ); CBMajorEncoderL = new QComboBox( FALSE, groupBoxPF, "CBMajorEncoderL" ); CBMajorEncoderL->setGeometry( QRect( 105, 20, 83, 20 ) ); LabelMajorEncoderL = new QLabel( groupBoxPF, "LabelMajorEncoderL" ); LabelMajorEncoderL->setGeometry( QRect( 2, 20, 90, 20 ) ); Qsv -> addChild(groupBox7); tabWidget3->insertTab( tab_2, "" ); tab_3 = new QWidget( tabWidget3, "tab_3" ); groupBoxInformation = new QGroupBox( tab_3, "groupBoxInformation" ); groupBoxInformation->setGeometry( QRect( 0, 0, 223, 678 ) ); groupBoxBoard = new QGroupBox( groupBoxInformation, "groupBoxBoard" ); groupBoxBoard->setGeometry( QRect( 2, 2, 219, 224 ) ); EditBoard = new QTextEdit( groupBoxBoard, "EditBoard" ); EditBoard->setGeometry( QRect( 2, 16, 214, 205 ) ); EditBoard->setWordWrap( QTextEdit::WidgetWidth ); EditBoard->setReadOnly( TRUE ); groupBoxDSP = new QGroupBox( groupBoxInformation, "groupBoxDSP" ); groupBoxDSP->setGeometry( QRect( 2, 228, 219, 224 ) ); EditDsp = new QTextEdit( groupBoxDSP, "EditDsp" ); EditDsp->setGeometry( QRect( 2, 16, 214, 205 ) ); EditDsp->setWordWrap( QTextEdit::WidgetWidth ); EditDsp->setWrapColumnOrWidth( 210 ); EditDsp->setWrapPolicy( QTextEdit::AtWordOrDocumentBoundary ); EditDsp->setReadOnly( TRUE ); groupBoxChannel = new QGroupBox( groupBoxInformation, "groupBoxChannel" ); groupBoxChannel->setGeometry( QRect( 2, 454, 219, 220 ) ); EditChannel = new QTextEdit( groupBoxChannel, "EditChannel" ); EditChannel->setGeometry( QRect( 2, 16, 214, 201 ) ); EditChannel->setWordWrap( QTextEdit::WidgetWidth ); EditChannel->setWrapColumnOrWidth( 210 ); EditChannel->setWrapPolicy( QTextEdit::AtWordOrDocumentBoundary ); EditChannel->setReadOnly( TRUE ); tabWidget3->insertTab( tab_3, "" ); show(); w_full_area->Createdsclass(); video_info* temp; temp = w_full_area->GetVideoParam(); SliderBrightnessL->setValue(temp->Brightness); SliderContrastL->setValue(temp->Contrast); SliderSaturationL->setValue(temp->Saturation); SliderHueL->setValue(temp->Hue); TitleEdit->setText(QString("HikVision demo - loop test for DS-40xxHC card") + Qs+ QString("Start time: ") + Dt.date().toString(" yyyy-MM-dd ") + Dt.time().toString(" hh:mm:ss ")); dstimer = new QTimer(this); connect (dstimer, SIGNAL(timeout()), this, SLOT(changeEdit())); dstimer->start(200); //200ms w_channel ->setText(QString(" 0")); w_audio_frame ->setText(QString(" 0")); w_totalframe->setText(QString(" 0")); w_bit_rate->setText(QString(" 0")); w_video_frame->setText(QString(" 0")); w_netusercount ->setText(QString(" 0")); w_channel -> setReadOnly(TRUE); w_audio_frame -> setReadOnly(TRUE); w_totalframe -> setReadOnly(TRUE); w_bit_rate -> setReadOnly(TRUE); w_video_frame -> setReadOnly(TRUE); w_netusercount -> setReadOnly(TRUE); DateEdit->setReadOnly ( TRUE ); TimeEdit->setReadOnly ( TRUE ); FreespaceEdit->setReadOnly ( TRUE ); SetComBox(); CBChannelL->setCurrentItem(0); SetBoardDspChannelInf(); SetAllEnabled(FALSE); languageChange(); resize( QSize(1024, 710).expandedTo(minimumSizeHint()) ); checkspace(); w_full_area -> installEventFilter( this ); GSelectPort = 0; GFullArea = FALSE; connect(CBChannelL, SIGNAL(activated (int)), SLOT(OpenSetting(int))); connect(tabWidget3, SIGNAL(currentChanged (QWidget *)), SLOT(PageChange(QWidget *))); connect( w_full_area, SIGNAL(clicked(int)), SLOT(areaClick(int))); connect( w_full_area, SIGNAL(audioChange(int,float)), SLOT(audioChangeSet(int,float))); connect( w_full_area, SIGNAL(videoChange(int,float)), SLOT(videoChangeSet(int,float))); connect( w_full_area, SIGNAL(totalChange(int,int)), SLOT(totalChangeSet(int,int))); connect( w_full_area, SIGNAL(bitRateChange(int,int)), SLOT(bitRateChangeSet(int,int))); connect( w_full_area, SIGNAL(countChange(int)), SLOT(countChangeSet(int))); connect( w_full_area, SIGNAL(fullSpace()), SLOT(fullSpaceSet())); connect(ButtonEnableG, SIGNAL(clicked()), SLOT(dsPreviewSet())); connect(w_preview, SIGNAL(toggled(bool)), w_full_area, SLOT(PreviewAllSet(bool))); connect(w_channel, SIGNAL(textChanged ( const QString & )), SLOT(dsChannel(const QString &))); connect(w_net_transfer, SIGNAL(toggled(bool)), w_full_area, SLOT(NetTransferSet(bool))); connect(w_stringtoclient, SIGNAL(toggled(bool)), w_full_area, SLOT(StringToClientSet(bool))); connect(w_full_area, SIGNAL(noNet()), SLOT(noNetSet())); connect(w_exit, SIGNAL( clicked() ), this, SLOT( close() ) ); connect(w_record, SIGNAL(toggled(bool)), w_full_area, SLOT(RecordAllSet(bool))); pthread_mutex_init(&mutex,NULL); ConnectCheck(); }/* * Destroys the object and frees any allocated resources */dsForm::~dsForm(){ // no need to delete child widgets, Qt does it all for us delete dstimer; pthread_mutex_destroy(&mutex); }void dsForm::dsPreviewSet(){ int port = atoi(w_channel -> text()); DSDEMO *temp = w_full_area -> GetDsinfo(port); if (temp -> bPreviewOpen) w_full_area->PreviewSet(FALSE); else w_full_area->PreviewSet(TRUE);}void dsForm::dsImageStreamSet(bool on){ int index = CBChannelL -> currentItem(); int width = 704/(1 << (CBImageStreamWL -> currentItem())); int height = atoi(CBImageStreamHL ->text(0))/(1 << (CBImageStreamHL -> currentItem())); OutputDebugString("ImageStreamSet width : %d****height:%d *****\n", width, height); if (index == 1) w_full_area -> ImageStreamAllSet(on, width, height); else if (index >= 2) w_full_area -> ImageStreamSet(on, width, height); if ( on ) { CBImageStreamWL -> setEnabled(FALSE); CBImageStreamHL -> setEnabled(FALSE); } else { CBImageStreamWL -> setEnabled(TRUE); CBImageStreamHL -> setEnabled(TRUE); }}void dsForm::dsBmpSet(bool on){ if ( on || RadioJpegL -> isChecked() ) ButtonCaptureL -> setEnabled(TRUE); else ButtonCaptureL -> setEnabled(FALSE);}void dsForm::dsJpegSet(bool on){ if ( on || RadioBmpL -> isChecked() ) ButtonCaptureL -> setEnabled(TRUE); else ButtonCaptureL -> setEnabled(FALSE);}void dsForm::dsCaptureButtonClicked(){ static int count = 1; int index = CBChannelL -> currentItem(); if (index == 1) { if ( RadioBmpL -> isChecked() ) w_full_area -> GetBmpAllPicture(count); if ( RadioJpegL -> isChecked() ) w_full_area -> GetJpegAllPicture(count, SliderPictureQL -> value()); } else if (index >= 2) { if ( RadioBmpL -> isChecked() ) w_full_area -> GetBmpPicture(count); if ( RadioJpegL -> isChecked() ) w_full_area -> GetJpegPicture(count, SliderPictureQL -> value()); } count++;}void dsForm::dsMotionSenSet(int value){ int index = CBChannelL -> currentItem(); if (index == 1) w_full_area -> MotionSenAllSet(value); else if (index >= 2) { w_full_area -> MotionSenSet(value); }}void dsForm::dsAudioSet(bool on){ w_full_area -> AudioSet(on);}void dsForm::dsMotionSet(bool on){ int index = CBChannelL -> currentItem(); if (index == 1) w_full_area -> MotionAllSet(on); else if (index >= 2) { w_full_area -> MotionSet(on); } SliderMotionSensL -> setEnabled(on);}void dsForm::dsMaskSet(bool on){ int index = CBChannelL -> currentItem(); OutputDebugString("In function dsMaskSet\n"); if ( index == 1) w_full_area -> MaskEnableAllSet(on); else if (index >= 2) w_full_area -> MaskEnableSet(on); if ( on ) { CBRectangleL -> setEnabled(TRUE); EditBoundL -> setText(""); EditBoundL -> setEnabled(FALSE); ButtonNewL -> setEnabled(TRUE); ButtonDeleteL -> setEnabled(FALSE); } else { CBRectangleL -> setEnabled(FALSE); EditBoundL -> setEnabled(FALSE); ButtonNewL -> setEnabled(FALSE); ButtonDeleteL -> setEnabled(FALSE); }}void dsForm::dsNewButtonClicked(){ EditBoundL -> setText(""); EditBoundL -> setEnabled(TRUE); }void dsForm::dsDeleteButtonClicked(){ int index = CBRectangleL -> currentItem(); int Channel = CBChannelL -> currentItem(); if ( Channel == 1) w_full_area -> MaskDelAllSet(index); else if ( Channel >= 2) w_full_area -> MaskDelSet(index); CBRectangleL -> removeItem ( index ); EditBoundL -> setText(""); EditBoundL -> setEnabled(FALSE); if (CBRectangleL->count() == 0) ButtonDeleteL -> setEnabled(FALSE); }void dsForm::dsRectangleChange(int index){ EditBoundL -> setText(CBRectangleL -> text(index) ); EditBoundL -> setEnabled(FALSE); if (CBRectangleL->count() > 0) ButtonDeleteL -> setEnabled(TRUE); }void dsForm::dsMaskEditPress(){ RECT temp; int i, j; bool ok; QString qs = (EditBoundL -> text()).stripWhiteSpace(); QString qstemp; if ( qs.contains(',',false) != 3) { EditBoundL -> setText(""); return; } i = qs.find(',', 0, false); qstemp = qs.mid(0, i); temp.RectTop = qstemp.toInt(&ok, 10); if ( (!ok) || temp.RectTop < 0 ) { EditBoundL -> setText(""); return; } j = i; i = qs.find(',', j+1, false); qstemp = qs.mid(j+1, i-j-1); temp.RectBottom = qstemp.toInt(&ok, 10); if ( (!ok) || temp.RectBottom < 0 ) { EditBoundL -> setText(""); return; } j = i; i = qs.find(',', j+1, false); qstemp = qs.mid(j+1, i-j-1); temp.RectLeft = qstemp.toInt(&ok, 10); if ( (!ok) || temp.RectLeft < 0 ) { EditBoundL -> setText(""); return; } j = i; i = qs.length(); qstemp = qs.mid(j+1, i-j-1); temp.RectRight = qstemp.toInt(&ok, 10); if ( (!ok) || temp.RectRight < 0 ) { EditBoundL -> setText(""); return; } if ((temp.RectRight <= temp.RectLeft )||(temp.RectBottom <= temp.RectTop) ||(temp.RectRight > 703)||(temp.RectBottom > 575)) //NTSC { EditBoundL -> setText(""); return; } temp.RectRight = (temp.RectRight - temp.RectLeft)/8 * 8 + temp.RectLeft; temp.RectBottom = (temp.RectBottom - temp.RectTop)/8 * 8 + temp.RectTop; int indexC = CBChannelL -> currentItem(); if (indexC == 1) { w_full_area -> MaskAddAllSet(&temp); } else if (indexC >= 2) { w_full_area -> MaskAddSet(&temp); } CBRectangleL -> insertItem(qs.sprintf("%d,%d,%d,%d", temp.RectTop, temp.RectBottom, temp.RectLeft, temp.RectRight)); if (CBRectangleL->count() == 5) ButtonNewL -> setEnabled(FALSE); EditBoundL -> setText(""); EditBoundL -> setEnabled(FALSE);}void dsForm::dsLogoChangeSet(int value){ int index = CBChannelL -> currentItem(); QSlider* Qtemp = (QSlider*)(this->sender()); const char *str = Qtemp->name(); if (index == 1) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -