📄 mdform.cpp
字号:
chan = Qstemp.toInt(&ok, 10);
if((!ok) || chan < 0 || chan > 36)
{
OutputErrorString("Wrong ServerChan, %d\n", chan);
w_full_area->ServerChanSet(0);
w_set_serverchan->setText("0");
return;
}
w_full_area->ServerChanSet(chan);
}
/*
=======================================================================================================================
*
=======================================================================================================================
*/
void mdForm::StatusChanged(int status)
{
QString Qs;
disconnect(w_decodefile, 0, 0, 0);
disconnect(w_decodestream, 0, 0, 0);
if(status == 1)
{
w_decodefile->setChecked(TRUE);
w_decodefile->setEnabled(TRUE);
w_fileposition->setEnabled(TRUE);
w_fileposition->setText(w_full_area->RetFilePosition());
w_decodestream->setChecked(FALSE);
w_decodestream->setEnabled(FALSE);
w_set_serverip->setEnabled(FALSE);
w_set_serverchan->setEnabled(FALSE);
w_sound->setEnabled(TRUE);
}
else if(status == 2)
{
w_decodefile->setChecked(FALSE);
w_decodefile->setEnabled(FALSE);
w_fileposition->setEnabled(FALSE);
w_fileposition->clear();
w_decodestream->setChecked(TRUE);
w_decodestream->setEnabled(TRUE);
w_set_serverip->setEnabled(TRUE);
w_set_serverip->setText(w_full_area->RetIP());
w_set_serverchan->setEnabled(TRUE);
w_set_serverchan->setText(Qs.sprintf("%d", w_full_area->RetChan()));
w_sound->setEnabled(TRUE);
}
else if(status == 0)
{
w_decodefile->setChecked(FALSE);
w_decodefile->setEnabled(TRUE);
w_fileposition->setEnabled(TRUE);
w_fileposition->clear();
w_decodestream->setChecked(FALSE);
w_decodestream->setEnabled(TRUE);
w_set_serverip->setEnabled(TRUE);
w_set_serverchan->setEnabled(TRUE);
w_full_area->ServerChanSet(0);
w_set_serverchan->setText("0");
w_sound->setChecked(FALSE);
w_sound->setEnabled(FALSE);
}
connect(w_decodefile, SIGNAL(clicked()), this, SLOT(OpenFile()));
connect(w_decodestream, SIGNAL(clicked()), this, SLOT(OpenStream()));
}
/*
=======================================================================================================================
*
=======================================================================================================================
*/
void mdForm::AreaChanged(int port)
{
QString qS;
OutputDebugString("now it's turn to channel number\n");
w_channel->setText(qS.sprintf("%d", port));
disconnect(w_sound, 0, 0, 0);
if(port != w_full_area->RetSoundPort())
w_sound->setChecked(FALSE);
else
w_sound->setChecked(TRUE);
connect(w_sound, SIGNAL(clicked()), this, SLOT(SoundSet()));
}
/*
=======================================================================================================================
*
=======================================================================================================================
*/
void mdForm::OpenFile()
{
if(w_decodefile->isChecked() == FALSE)
{
OutputDebugString("Close Decode File\n");
w_decodestream->setEnabled(TRUE);
w_videoout->setChecked(FALSE);
w_videoout->setEnabled(FALSE);
w_full_area->FileStreamClose(DECODEFILE);
w_fileposition->clear();
w_set_serverchan->setEnabled(TRUE);
w_set_serverip->setEnabled(TRUE);
w_full_area->erase();
return;
}
QString SelectFile;
OutputDebugString("OpenFile for decode\n");
QFileDialog* fd = new QFileDialog(this);
fd->setMode(QFileDialog::ExistingFile);
fd->setFilter("HikVision Files(*.mp4 *.264)");
connect(fd, SIGNAL(fileSelected (const QString&)), w_full_area, SLOT(FileOpen (const QString&)));
if(fd->exec() == QDialog::Accepted)
{
OutputDebugString("Open File for decode\n");
w_decodestream->setEnabled(FALSE);
w_fileposition->setText(fd->selectedFile());
w_set_serverchan->setEnabled(FALSE);
w_set_serverip->setEnabled(FALSE);
w_videoout->setEnabled(TRUE);
}
else
{
disconnect(w_decodefile, 0, 0, 0);
w_decodefile->setChecked(FALSE);
connect(w_decodefile, SIGNAL(clicked()), this, SLOT(OpenFile()));
}
delete fd;
}
/*
=======================================================================================================================
*
=======================================================================================================================
*/
void mdForm::OpenStream()
{
if(w_decodestream->isChecked() == FALSE)
{
OutputDebugString("Close Decode Stream\n");
w_decodefile->setEnabled(TRUE);
w_videoout->setChecked(FALSE);
w_videoout->setEnabled(FALSE);
w_full_area->FileStreamClose(DECODESTREAM);
w_full_area->erase();
w_fileposition->setEnabled(TRUE);
return;
}
OutputDebugString("-------------------------\n");
if(w_full_area->OpenStream() == -1)
{
OutputDebugString("here initial the net error\n");
disconnect(w_decodestream, 0, 0, 0);
w_decodestream->setChecked(FALSE);
w_fileposition->setEnabled(TRUE);
connect(w_decodestream, SIGNAL(clicked()), this, SLOT(OpenStream()));
}
else
{
w_decodefile->setEnabled(FALSE);
w_videoout->setEnabled(TRUE);
}
}
/*
=======================================================================================================================
*
=======================================================================================================================
*/
void mdForm::OpenVideoOut()
{
if(w_videoout->isChecked() == FALSE)
{
OutputDebugString("Close Video Out\n");
w_full_area->CloseVideoOut();
return;
}
w_full_area->OpenVideoOut();
}
/*
=======================================================================================================================
*
=======================================================================================================================
*/
void mdForm::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 mdForm::BitRateSet(int Select, int data)
{
QString qS;
if(Select == atoi(w_channel->text()))
w_bit_rate->setText(qS.sprintf("%d", data));
}
/*
=======================================================================================================================
*
=======================================================================================================================
*/
void mdForm::FrameRateSet(int Select, unsigned long data)
{
QString qS;
if(Select == atoi(w_channel->text()))
w_decode_framerate->setText(qS.sprintf("%ld", data));
}
/*
=======================================================================================================================
*
=======================================================================================================================
*/
void mdForm::FrameSet(int Select, unsigned long data)
{
QString qS;
if(Select == atoi(w_channel->text()))
w_totalframe->setText(qS.sprintf("%ld", data));
}
/*
=======================================================================================================================
* Sets the strings of the subwidgets using the current language.
=======================================================================================================================
*/
void mdForm::languageChange()
{
setCaption(tr("mdForm"));
groupBoxGSI->setTitle(tr("Status Information"));
DateLabel->setText(tr(" Date"));
TimeLabel->setText(tr(" Time"));
FreeSpaceLabel->setText(tr("Free Space"));
groupBoxCInfo->setTitle(tr("Channel Info"));
TotalFramesLabel->setText(tr("Total Frames"));
FrameRateLabel->setText(tr("FrameRate"));
BitRateLabel->setText(tr("BitRate(bps)"));
ServerChanLabel->setText(tr("Server Chan"));
ServerIpLabel->setText(tr("Server Ip"));
ChannelNumLabel->setText(tr("Channel Num"));
FilePositionLabel->setText(tr("Decode File"));
groupBoxDecode->setTitle(tr("Decode On MD"));
AllSetCheckButton->setText(tr(" ALL"));
w_decodefile->setText(tr(" Decode Files"));
w_decodestream->setText(tr(" Decode Stream"));
w_videoout->setText(tr(" Video Audio Out"));
w_sound->setText(tr(" Audio Preview"));
ButtonExit->setText(tr("Exit"));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -