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

📄 dsform.cpp

📁 强大的QT,GTK的学习Demo.包含DSP驱动以及所使用库文件资源。
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    if(ChannelNum == 1)
    {
        if(on)
        {
            CBMinorEncoderL->setEnabled(FALSE);
            CBMinorStreamL->setEnabled(FALSE);
            w_full_area->StreamTypeSubAllSet(CBMinorStreamL->currentItem() + 1);
            w_full_area->EncoderSubAllSet(pictureFormat);
        }
        else
        {
            CBMinorEncoderL->setEnabled(TRUE);
            CBMinorStreamL->setEnabled(TRUE);
        }

        w_full_area->RecordSubAllSet(on);
    }
    else if(ChannelNum >= 2)
    {
        if(on)
        {
            CBMinorEncoderL->setEnabled(FALSE);
            CBMinorStreamL->setEnabled(FALSE);
            w_full_area->EncoderSubSet(pictureFormat);
            w_full_area->StreamTypeSubSet(CBMinorStreamL->currentItem() + 1);
        }
        else
        {
            CBMinorEncoderL->setEnabled(TRUE);
            CBMinorStreamL->setEnabled(TRUE);
        }

        w_full_area->RecordSubSet(on);
    }
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::dsMajorRecordSet(bool on)
{
    int             ChannelNum = CBChannelL->currentItem();
    int             index = CBMajorEncoderL->currentItem();
    PictureFormat_t pictureFormat = ENC_CIF_FORMAT;

    if(index == 0)
        pictureFormat = ENC_4CIF_FORMAT;
    else if(index == 1)
        pictureFormat = ENC_2CIF_FORMAT;
    else if(index == 2)
        pictureFormat = ENC_DCIF_FORMAT;
    else if(index == 3)
        pictureFormat = ENC_CIF_FORMAT;
    else if(index == 4)
        pictureFormat = ENC_QCIF_FORMAT;

    if(ChannelNum == 1)
    {
        if(on)
        {
            CBMajorEncoderL->setEnabled(FALSE);
            CBMajorStreamL->setEnabled(FALSE);
            w_full_area->EncoderAllSet(pictureFormat);
            w_full_area->StreamTypeAllSet(CBMajorStreamL->currentItem() + 1);
        }
        else
        {
            CBMajorEncoderL->setEnabled(TRUE);
            CBMajorStreamL->setEnabled(TRUE);
        }

        w_full_area->RecordAllSet(on);
    }
    else if(ChannelNum >= 2)
    {
        if(on)
        {
            CBMajorEncoderL->setEnabled(FALSE);
            CBMajorStreamL->setEnabled(FALSE);
            w_full_area->EncoderSet(pictureFormat);
            w_full_area->StreamTypeSet(CBMajorStreamL->currentItem() + 1);
        }
        else
        {
            CBMajorEncoderL->setEnabled(TRUE);
            CBMajorStreamL->setEnabled(TRUE);
        }

        w_full_area->RecordSet(on);
    }
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::areaClick(int click)
{
    static int  fullflag = 1;
    int         port;
    QString     qS;

    port = w_full_area->GetSelectPort();

    w_channel->setText(qS.sprintf("%9d", port));

    if(click == RIGHTCLICKED)
    {
        if(fullflag)
        {
            disconnect(tabWidget3, 0, 0, 0);
            TitleEdit->hide();
            tabWidget3->hide();
            showFullScreen();
            w_full_area->resize(1024, 768);
            fullflag = 0;
        }
        else
        {
            w_full_area->resize(800, 700);
            showNormal();
            TitleEdit->show();
            tabWidget3->show();
            fullflag = 1;
            connect(tabWidget3, SIGNAL(currentChanged (QWidget*)), SLOT(PageChange (QWidget*)));
        }
    }
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::audioChangeSet(int Select, float data)
{
    QString qS;

    if(Select == atoi(w_channel->text()))
        w_audio_frame->setText(qS.sprintf("%10.1f", data));
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::videoChangeSet(int Select, float data)
{
    QString qS;

    if(Select == atoi(w_channel->text()))
        w_video_frame->setText(qS.sprintf("%10.1f", data));
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::totalChangeSet(int Select, int data)
{
    QString qS;

    if(Select == atoi(w_channel->text()))
        w_totalframe->setText(qS.sprintf("%9d", data));
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::bitRateChangeSet(int Select, int data)
{
    QString qS;

    if(Select == atoi(w_channel->text()))
        w_bit_rate->setText(qS.sprintf("%9d", data));
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::countChangeSet(int data)
{
    QString qS;

    w_netusercount->setText(qS.sprintf("%9d", data));
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::fullSpaceSet()
{
    static int  run = 0;
    FormInfo*   forminf;

    pthread_mutex_lock(&mutex);
    if(!run)
    {
        forminf = new FormInfo(this, "Information", Qt::WType_TopLevel);
        forminf->setGeometry(QRect(300, 300, 200, 120));
        forminf->show();
        run = 1;
    }

    pthread_mutex_unlock(&mutex);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::noNetSet()
{
    QMessageBox::warning(this, "MessageBox", "The net transfer setting isn't opened!",
                         QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::netChangeSet(bool on)
{
    OutputDebugString("In netChangeSet \n");
    w_full_area->NetTransferSet(on);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::checkspace()
{
    char            savepath[10] = ".";
    int             freespace;
    struct statfs   bbuf;

    if(statfs(savepath, &bbuf) < 0)
    {
        OutputErrorString("statsfs() faied, error: %d\n", errno);
    }
    else
    {
        freespace = bbuf.f_bavail * (bbuf.f_bsize / 1024);
        if(freespace < RunQuest)
        {
            OutputErrorString("The Space of Disk isn't enough!! So you'd better stop Recording\n");
            CheckMajorRecordL->setEnabled(FALSE);
            CheckMinorRecordL->setEnabled(FALSE);
            CheckImageCaptureL->setEnabled(FALSE);
        }
    }
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::changeEdit()
{
    char            savepath[10] = ".";
    char            tmp = '%';
    int             freespace;
    struct statfs   bbuf;

    QDateTime       Dtchange = QDateTime::currentDateTime();
    QString         Qschange;

    DateEdit->setText(Dtchange.date().toString("yyyy-MM-dd"));
    TimeEdit->setText(Dtchange.time().toString("hh:mm:ss"));

    if(statfs(savepath, &bbuf) < 0)
    {
        OutputErrorString("statsfs() faied, error: %d\n", errno);
    }
    else
    {
        freespace = (100 * bbuf.f_bavail) / bbuf.f_blocks;
        Qschange.sprintf(" %3d%c", freespace, tmp);
    }

    FreespaceEdit->setText(Qschange);
}

/*
 =======================================================================================================================
 *
 =======================================================================================================================
 */
void dsForm::PageChange(QWidget* CurrentPage)   /* 状态切换的时候,注意以前的状态 */
{
    static int  index = 0;
    static int  index_before = 0;
    int         tempindex;
    bool        tempfull;

    if(!strcmp(CurrentPage->name(), "tab"))
    {
        if(index == 2 && index_before == 0)
        {
            index = 0;
            return;
        }

        tempindex = CBChannelL->currentItem();
        tempfull = w_full_area->GetFullState();

        if(GFullArea)
        {
            w_full_area->SetSelectPort(GSelectPort);
            if(tempfull)
                w_full_area->ChangeFullPort();
            else
                w_full_area->SetFullEnable(TRUE);
        }
        else
        {
            if(tempfull)
                w_full_area->SetFullEnable(FALSE);
            w_full_area->SetSelectPort(GSelectPort);
        }

        disconnect(w_preview, 0, 0, 0);
        w_preview->setChecked(TRUE);
        connect(w_preview, SIGNAL(toggled(bool)), w_full_area, SLOT(PreviewAllSet(bool)));

        disconnect(w_record, 0, 0, 0);
        w_record->setChecked(bool(w_full_area->AllRecordStatus()));
        connect(w_record, SIGNAL(toggled(bool)), w_full_area, SLOT(RecordAllSet(bool)));

        GSelectPort = tempindex;
        GFullArea = tempfull;
        index = 0;
    }
    else if(!strcmp(CurrentPage->name(), "tab_2"))
    {
        fprintf(stderr, "Enter Page Two\n");
        if(index == 2 && index_before == 1)
        {
            index = 1;
            return;
        }

        w_full_area->PreviewAllSet(TRUE);   /* 保证切换到Localsetting时是正确的 */

        /*
         * disconnect(CheckMajorRecordL, 0, 0,0);
         * *CheckMajorRecordL->setChecked(w_record->isChecked());
         * *connect(CheckMajorRecordL, SIGNAL(toggled(bool)), SLOT(dsMajorRecordSet(bool)));
         */
        tempindex = w_full_area->GetSelectPort();
        tempfull = w_full_area->GetFullState();

        if(GFullArea)
        {
            if(GSelectPort == 0)
            {
                SetAllEnabled(FALSE);
                w_full_area->SetSelectPort(w_full_area->GetLastPort());
                w_full_area->SetFullEnable(TRUE);
            }
            else
            {
                w_full_area->SetSelectPort(GSelectPort - 2)

⌨️ 快捷键说明

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