⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsform.cpp

📁 强大的QT,GTK的学习Demo.包含DSP驱动以及所使用库文件资源。
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    LabelBrightnessL = new QLabel(groupBoxVI, "LabelBrightnessL");
    LabelBrightnessL->setGeometry(QRect(10, 20, 59, 20));

    LabelContrastL = new QLabel(groupBoxVI, "LabelContrastL");
    LabelContrastL->setGeometry(QRect(10, 45, 55, 20));

    SliderContrastL = new QSlider(groupBoxVI, "SliderContrastL");
    SliderContrastL->setGeometry(QRect(78, 45, 110, 20));
    SliderContrastL->setOrientation(QSlider::Horizontal);

    LabelSaturationL = new QLabel(groupBoxVI, "LabelSaturationL");
    LabelSaturationL->setGeometry(QRect(10, 70, 57, 20));

    SliderSaturationL = new QSlider(groupBoxVI, "SliderSaturationL");
    SliderSaturationL->setGeometry(QRect(78, 70, 110, 20));
    SliderSaturationL->setOrientation(QSlider::Horizontal);

    LabelHueL = new QLabel(groupBoxVI, "LabelHueL");
    LabelHueL->setGeometry(QRect(10, 95, 42, 20));

    SliderHueL = new QSlider(groupBoxVI, "SliderHueL");
    SliderHueL->setGeometry(QRect(78, 95, 110, 20));
    SliderHueL->setOrientation(QSlider::Horizontal);

    SliderBrightnessL = new QSlider(groupBoxVI, "SliderBrightnessL");
    SliderBrightnessL->setGeometry(QRect(78, 20, 110, 20));
    SliderBrightnessL->setCursor(QCursor(0));
    SliderBrightnessL->setOrientation(QSlider::Horizontal);

    ButtonVideoRestoreL = new QPushButton(groupBoxVI, "ButtonVideoRestoreL");
    ButtonVideoRestoreL->setGeometry(QRect(42, 120, 120, 29));

    CBChannelL = new QComboBox(FALSE, groupBox7, "CBChannelL");
    CBChannelL->setGeometry(QRect(113, 5, 83, 20));
    CBChannelL->setCurrentItem(0);

    groupBox9 = new QGroupBox(groupBox7, "groupBox9");
    groupBox9->setGeometry(QRect(2, 30, 196, 60));

    CheckMinorRecordL = new QCheckBox(groupBox9, "CheckMinorRecordL");
    CheckMinorRecordL->setGeometry(QRect(101, 30, 90, 20));

    CheckMajorRecordL = new QCheckBox(groupBox9, "CheckMajorRecordL");
    CheckMajorRecordL->setGeometry(QRect(4, 30, 86, 20));

    CheckPreviewLl = new QCheckBox(groupBox9, "CheckPreviewLl");
    CheckPreviewLl->setGeometry(QRect(5, 5, 100, 20));

    groupBoxCD = new QGroupBox(groupBox7, "groupBoxCD");
    groupBoxCD->setGeometry(QRect(0, 90, 196, 380));

    LabelMajorStreamL = new QLabel(groupBoxCD, "LabelMajorStreamL");
    LabelMajorStreamL->setGeometry(QRect(10, 28, 86, 20));

    CBMajorStreamL = new QComboBox(FALSE, groupBoxCD, "CBMajorStreamL");
    CBMajorStreamL->setGeometry(QRect(108, 28, 83, 20));

    LabelMinorStreamL = new QLabel(groupBoxCD, "LabelMinorStreamL");
    LabelMinorStreamL->setGeometry(QRect(10, 66, 86, 20));

    CBMinorStreamL = new QComboBox(FALSE, groupBoxCD, "CBMinorStreamL");
    CBMinorStreamL->setGeometry(QRect(108, 67, 83, 20));

    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)
{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -