Compare commits

...

3 Commits

@ -16,12 +16,14 @@ QMAKE_PROJECT_DEPTH = 0
SOURCES += \ SOURCES += \
global.cpp \ global.cpp \
SDFPDlg.cpp \ SDFPDlg.cpp \
imageswitch.cpp \
main.cpp \ main.cpp \
mainwindow.cpp \ mainwindow.cpp \
HEADERS += \ HEADERS += \
SDFPDlg.h \ SDFPDlg.h \
global.h \ global.h \
imageswitch.h \
mainwindow.h \ mainwindow.h \
FORMS += \ FORMS += \

@ -13,6 +13,7 @@ SDFPDlg::SDFPDlg(QWidget *parent)
//嵌入到主窗口 //嵌入到主窗口
setWindowFlags(Qt::CustomizeWindowHint|Qt::FramelessWindowHint); setWindowFlags(Qt::CustomizeWindowHint|Qt::FramelessWindowHint);
hide(); hide();
ui->label_version->setText(g_SoftwareVersion);
} }
SDFPDlg::~SDFPDlg() SDFPDlg::~SDFPDlg()

@ -2,6 +2,7 @@
#define SDFPDLG_H #define SDFPDLG_H
#include <QWidget> #include <QWidget>
#include "global.h"
namespace Ui { namespace Ui {
class SDFPDlg; class SDFPDlg;

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>768</width> <width>955</width>
<height>440</height> <height>518</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -16,9 +16,39 @@
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QGridLayout" name="gridLayout">
<item> <item row="0" column="2">
<spacer name="horizontalSpacer"> <widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">image: url(:/res/981csNew.png);</string>
</property>
</widget>
</item>
<item row="1" column="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_version">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>版本号V0.00.00</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Orientation::Horizontal</enum> <enum>Qt::Orientation::Horizontal</enum>
</property> </property>
@ -33,15 +63,8 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item> <item row="0" column="0">
<widget class="QWidget" name="widget" native="true"> <spacer name="horizontalSpacer">
<property name="styleSheet">
<string notr="true">image: url(:/res/981csNew.png);</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Orientation::Horizontal</enum> <enum>Qt::Orientation::Horizontal</enum>
</property> </property>

@ -70,6 +70,15 @@ void GDDCCmdDlg::initParam() {
ui->comboBox_4_2->addItem("6"); ui->comboBox_4_2->addItem("6");
ui->comboBox_4_2->addItem("7"); ui->comboBox_4_2->addItem("7");
m_paramInfraredWarning = 0;
ui->swtichButton_4_1->setChecked(false);
ui->swtichButton_4_1->setFixedSize(100,20);
ui->swtichButton_4_1->setButtonStyle(ImageSwitch::ButtonStyle_1);
//绑定选中切换信号
connect(ui->swtichButton_4_1, SIGNAL(checkedChanged(bool)), this, SLOT(checkedChangedSlot(bool)));
/*稳定平台*/ /*稳定平台*/
ui->comboBox_5_1->addItem("非常慢"); ui->comboBox_5_1->addItem("非常慢");
ui->comboBox_5_1->addItem("很慢"); ui->comboBox_5_1->addItem("很慢");
@ -654,6 +663,29 @@ void GDDCCmdDlg::on_pushButton_4_18_pressed() {
} }
void GDDCCmdDlg::on_pushButton_4_18_released() { clearTJDCCmdBuffer(); } void GDDCCmdDlg::on_pushButton_4_18_released() { clearTJDCCmdBuffer(); }
// 红外报警设置
void GDDCCmdDlg::on_pushButton_4_19_pressed()
{
UINT8 Bit0 = 0b00000001; // 测温型
int sel = ui->lineEdit_4_2->text().toDouble()*10;
TJDCCmdBuffer[0] = (std::byte)(m_paramInfraredWarning+Bit0);
TJDCCmdBuffer[1] = (std::byte)sel;
TJDCCmdBuffer[2] = (std::byte)(sel>>8);
}
void GDDCCmdDlg::on_pushButton_4_19_released(){ clearTJDCCmdBuffer(); }
// 开启/关闭温度报警或者阈值检测功能
void GDDCCmdDlg::checkedChangedSlot(bool param)
{
if(!param) {
m_paramInfraredWarning = 0b00000000;// 关闭
} else {
m_paramInfraredWarning = 0b10000000;// 开启
}
}
// 俯仰+ // 俯仰+
void GDDCCmdDlg::on_pushButton_5_1_pressed() { void GDDCCmdDlg::on_pushButton_5_1_pressed() {
if (paramIsFrame) { if (paramIsFrame) {
@ -928,3 +960,6 @@ void GDDCCmdDlg::on_pushButton_6_8_clicked() {
ui->pushButton_6_8->setDown(false); ui->pushButton_6_8->setDown(false);
} }
} }

@ -17,6 +17,7 @@
#include <QWidget> #include <QWidget>
#include <vector> #include <vector>
#include <windows.h> #include <windows.h>
#include "imageswitch.h"
#define cmdLength 44 #define cmdLength 44
namespace Ui { namespace Ui {
@ -51,6 +52,7 @@ public:
bool detectionAreaSetting; // 检测区域设置 bool detectionAreaSetting; // 检测区域设置
void setTabWidgetGeometry(int, int, int, int); // 设置tabwidget的几何位置 void setTabWidgetGeometry(int, int, int, int); // 设置tabwidget的几何位置
void setAIDetcLineEditText(QString, QString); // 设置AI监测lineEdit的内容 void setAIDetcLineEditText(QString, QString); // 设置AI监测lineEdit的内容
UINT8 m_paramInfraredWarning; // 红外告警参数
private slots: private slots:
/*系统控制*/ /*系统控制*/
void on_pushButton_1_1_pressed(); void on_pushButton_1_1_pressed();
@ -174,6 +176,9 @@ private slots:
void on_pushButton_4_17_released(); void on_pushButton_4_17_released();
void on_pushButton_4_18_pressed(); void on_pushButton_4_18_pressed();
void on_pushButton_4_18_released(); void on_pushButton_4_18_released();
void on_pushButton_4_19_pressed();
void on_pushButton_4_19_released();
void checkedChangedSlot(bool);
/*云台控制*/ /*云台控制*/
void on_pushButton_5_1_pressed(); void on_pushButton_5_1_pressed();
void on_pushButton_5_1_released(); void on_pushButton_5_1_released();
@ -225,6 +230,7 @@ private slots:
void on_pushButton_6_7_pressed(); void on_pushButton_6_7_pressed();
void on_pushButton_6_7_released(); void on_pushButton_6_7_released();
void on_pushButton_6_8_clicked(); void on_pushButton_6_8_clicked();
}; };
#endif // GDDCCMDDLG_H #endif // GDDCCMDDLG_H

@ -1171,7 +1171,7 @@
<widget class="QPushButton" name="pushButton_4_18"> <widget class="QPushButton" name="pushButton_4_18">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>600</x> <x>590</x>
<y>50</y> <y>50</y>
<width>100</width> <width>100</width>
<height>30</height> <height>30</height>
@ -1347,7 +1347,7 @@
<widget class="QComboBox" name="comboBox_4_1"> <widget class="QComboBox" name="comboBox_4_1">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>490</x> <x>480</x>
<y>10</y> <y>10</y>
<width>101</width> <width>101</width>
<height>31</height> <height>31</height>
@ -1357,7 +1357,7 @@
<widget class="QPushButton" name="pushButton_4_17"> <widget class="QPushButton" name="pushButton_4_17">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>600</x> <x>590</x>
<y>10</y> <y>10</y>
<width>101</width> <width>101</width>
<height>30</height> <height>30</height>
@ -1373,13 +1373,107 @@
<widget class="QComboBox" name="comboBox_4_2"> <widget class="QComboBox" name="comboBox_4_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>490</x> <x>480</x>
<y>50</y> <y>50</y>
<width>101</width> <width>101</width>
<height>31</height> <height>31</height>
</rect> </rect>
</property> </property>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_4_1">
<property name="geometry">
<rect>
<x>710</x>
<y>10</y>
<width>181</width>
<height>151</height>
</rect>
</property>
<property name="title">
<string>红外报警设置</string>
</property>
<widget class="QPushButton" name="pushButton_4_19">
<property name="geometry">
<rect>
<x>80</x>
<y>110</y>
<width>71</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>设置</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_4_2">
<property name="geometry">
<rect>
<x>75</x>
<y>70</y>
<width>81</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_4_3">
<property name="geometry">
<rect>
<x>160</x>
<y>70</y>
<width>14</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>℃</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>5</x>
<y>70</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>温度阈值</string>
</property>
</widget>
<widget class="ImageSwitch" name="swtichButton_4_1" native="true">
<property name="geometry">
<rect>
<x>60</x>
<y>30</y>
<width>71</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_13">
<property name="geometry">
<rect>
<x>5</x>
<y>30</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>检测开关</string>
</property>
</widget>
</widget>
</widget> </widget>
<widget class="QWidget" name="tab_5"> <widget class="QWidget" name="tab_5">
<attribute name="title"> <attribute name="title">
@ -2110,6 +2204,14 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
</widget> </widget>
</widget> </widget>
</widget> </widget>
<customwidgets>
<customwidget>
<class>ImageSwitch</class>
<extends>QWidget</extends>
<header>imageswitch.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

@ -26,11 +26,14 @@ void GDDCSet::initWindow() {
} }
void GDDCSet::initUDPSocket() {} void GDDCSet::initUDPSocket() {}
void GDDCSet::initParam() { void GDDCSet::initParam() {
m_FlowType = "";
// m_myPairNetwork("",0,"",0); // m_myPairNetwork("",0,"",0);
// QSettings setting("./sentence.ini",QSettings::IniFormat); // QSettings setting("./sentence.ini",QSettings::IniFormat);
// setting.setIniCodec(QTextCodec::codecForName("UTF-8")); //重点 // setting.setIniCodec(QTextCodec::codecForName("UTF-8")); //重点
ui->comboBox_streamType->addItem("RTSP"); ui->comboBox_streamType->addItem("RTSP");
ui->comboBox_streamType->addItem("RTMP");
// ui->comboBox_streamType->addItem("UDP Raw"); // ui->comboBox_streamType->addItem("UDP Raw");
// ui->comboBox_streamType->addItem("UDP 422"); // ui->comboBox_streamType->addItem("UDP 422");
// ui->comboBox_streamType->addItem("UDP TS"); // ui->comboBox_streamType->addItem("UDP TS");
@ -52,10 +55,20 @@ void GDDCSet::initParam() {
char *strSysIniName = m_configIniPath.data(); // 系统配置文件路径 char *strSysIniName = m_configIniPath.data(); // 系统配置文件路径
char inBuf[100]; char inBuf[100];
::GetPrivateProfileStringA("光电吊舱-视频连接-显示窗口2", "播放URL", "-1", ::GetPrivateProfileStringA("光电吊舱-视频连接-显示窗口1", "流类型", "-1",
inBuf, 100, strSysIniName);
m_FlowType = streamTypeToflowType(QString::fromUtf8(inBuf));
ui->comboBox_streamType->setCurrentText(flowTypeTostreamType(m_FlowType));
::GetPrivateProfileStringA("光电吊舱-视频连接-显示窗口1", "播放URL", "-1",
inBuf, 100, strSysIniName); inBuf, 100, strSysIniName);
m_playURL2 = QString::fromUtf8(inBuf); m_playURL1 = QString::fromUtf8(inBuf);
ui->lineEdit_playURL2->setText(m_playURL2); ui->comboBox_playURL1->setCurrentText(m_playURL1);
// ::GetPrivateProfileStringA("光电吊舱-视频连接-显示窗口2", "播放URL", "-1",
// inBuf, 100, strSysIniName);
// m_playURL2 = QString::fromUtf8(inBuf);
// ui->lineEdit_playURL2->setText(m_playURL2);
::GetPrivateProfileStringA("光电吊舱-推流", "推流URL", "-1", inBuf, 100, ::GetPrivateProfileStringA("光电吊舱-推流", "推流URL", "-1", inBuf, 100,
strSysIniName); strSysIniName);
@ -145,10 +158,10 @@ void GDDCSet::on_pushButton_pushURL_clicked() {
saveDataToLocalIni(); saveDataToLocalIni();
if (ui->pushButton_pushURL->text() == "推送") { if (ui->pushButton_pushURL->text() == "推送") {
emit SignalStartConnect(6); emit SignalStartConnect(6);
ui->pushButton_pushURL->setText("停止推送"); //ui->pushButton_pushURL->setText("停止推送");
} else { } else {
emit SignalStopConnect(6); emit SignalStopConnect(6);
ui->pushButton_pushURL->setText("推送"); //ui->pushButton_pushURL->setText("推送");
} }
} }
@ -182,12 +195,26 @@ void GDDCSet::saveDataToLocalIni() {
::WritePrivateProfileStringA("光电吊舱-网络控制", "远端Port", inBuf, ::WritePrivateProfileStringA("光电吊舱-网络控制", "远端Port", inBuf,
strSysIniName); strSysIniName);
m_playURL2 = ui->lineEdit_playURL2->text(); QString streamType = ui->comboBox_streamType->currentText();
ba = m_playURL2.toLocal8Bit(); m_FlowType = streamTypeToflowType(streamType);
ba = streamType.toLocal8Bit();
inBuf = ba.data(); inBuf = ba.data();
::WritePrivateProfileStringA("光电吊舱-视频连接-显示窗口2", "播放URL", inBuf, ::WritePrivateProfileStringA("光电吊舱-视频连接-显示窗口1", "流类型", inBuf,
strSysIniName); strSysIniName);
m_playURL1 = ui->comboBox_playURL1->currentText();
ba = m_playURL1.toLocal8Bit();
inBuf = ba.data();
::WritePrivateProfileStringA("光电吊舱-视频连接-显示窗口1", "播放URL", inBuf,
strSysIniName);
// m_playURL2 = ui->lineEdit_playURL2->text();
// ba = m_playURL2.toLocal8Bit();
// inBuf = ba.data();
// ::WritePrivateProfileStringA("光电吊舱-视频连接-显示窗口2", "播放URL", inBuf,
// strSysIniName);
m_pushURL = ui->lineEdit_pushURL->text(); m_pushURL = ui->lineEdit_pushURL->text();
ba = m_pushURL.toLocal8Bit(); ba = m_pushURL.toLocal8Bit();
inBuf = ba.data(); inBuf = ba.data();
@ -196,3 +223,65 @@ void GDDCSet::saveDataToLocalIni() {
m_playURL1 = ui->comboBox_playURL1->currentText(); m_playURL1 = ui->comboBox_playURL1->currentText();
} }
// //流类型
// void GDDCSet::on_comboBox_streamType_currentIndexChanged(int index)
// {
// switch(index)
// {
// case 0:
// m_FlowType = "TCP";
// break;
// case 1:
// m_FlowType = "UDP";
// break;
// default:
// break;
// }
// }
QString GDDCSet::streamTypeToflowType(QString type)
{
if(type == "RTSP")
{
return "TCP";
}
else if(type == "RTMP")
{
return "UDP";
}
else
return "TCP";
}
QString GDDCSet::flowTypeTostreamType(QString type)
{
if(type == "TCP")
{
return "RTSP";
}
else if(type == "UDP")
{
return "RTMP";
}
else
return "RTSP";
}
void GDDCSet::setConnectURL1Text(QString param)
{
ui->pushButton_ConnectURL1->setText(param);
}
void GDDCSet::setConnectURL2Text(QString param)
{
ui->pushButton_ConnectURL1->setText(param);
}
void GDDCSet::setNetCtrlText(QString param)
{
ui->pushButton_NetCtrlConnect->setText(param);
}
void GDDCSet::setPushStreamText(QString param)
{
ui->pushButton_pushURL->setText(param);
}

@ -32,6 +32,17 @@ public:
QString m_playURL2; // 光电吊舱-视频连接-显示窗口2-URL地址 QString m_playURL2; // 光电吊舱-视频连接-显示窗口2-URL地址
QString m_pushURL; // 光电吊舱-推流URL地址 QString m_pushURL; // 光电吊舱-推流URL地址
MyPairNetwork m_myPairNetwork; // 网络通信结构体 MyPairNetwork m_myPairNetwork; // 网络通信结构体
QString m_FlowType; // 流类型
QString streamTypeToflowType(QString);
QString flowTypeTostreamType(QString);
void setConnectURL1Text(QString);
void setConnectURL2Text(QString);
void setNetCtrlText(QString);
void setPushStreamText(QString);
signals: signals:
/* int a /* int a
* 11 * 11
@ -50,6 +61,7 @@ private slots:
void on_pushButton_serialControlConnect_clicked(); // 串口控制-连接 void on_pushButton_serialControlConnect_clicked(); // 串口控制-连接
void on_pushButton_NetCtrlConnect_clicked(); // 网络控制-连接 void on_pushButton_NetCtrlConnect_clicked(); // 网络控制-连接
void on_pushButton_pushURL_clicked(); // 推流 void on_pushButton_pushURL_clicked(); // 推流
//void on_comboBox_streamType_currentIndexChanged(int index);
}; };
#endif // GDDCSET_H #endif // GDDCSET_H

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>761</width> <width>761</width>
<height>360</height> <height>342</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -22,7 +22,7 @@
<x>30</x> <x>30</x>
<y>10</y> <y>10</y>
<width>701</width> <width>701</width>
<height>181</height> <height>141</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
@ -34,8 +34,8 @@
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>440</x>
<y>30</y> <y>60</y>
<width>61</width> <width>61</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -47,8 +47,8 @@
<widget class="QComboBox" name="comboBox_streamType"> <widget class="QComboBox" name="comboBox_streamType">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>90</x> <x>510</x>
<y>30</y> <y>60</y>
<width>72</width> <width>72</width>
<height>23</height> <height>23</height>
</rect> </rect>
@ -58,7 +58,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>70</y> <y>30</y>
<width>61</width> <width>61</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -71,7 +71,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>20</x>
<y>100</y> <y>60</y>
<width>71</width> <width>71</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -84,8 +84,8 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>90</x> <x>90</x>
<y>100</y> <y>60</y>
<width>491</width> <width>331</width>
<height>23</height> <height>23</height>
</rect> </rect>
</property> </property>
@ -94,7 +94,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>600</x> <x>600</x>
<y>100</y> <y>60</y>
<width>80</width> <width>80</width>
<height>23</height> <height>23</height>
</rect> </rect>
@ -156,7 +156,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>20</x>
<y>140</y> <y>100</y>
<width>71</width> <width>71</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -169,7 +169,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>90</x> <x>90</x>
<y>140</y> <y>100</y>
<width>491</width> <width>491</width>
<height>23</height> <height>23</height>
</rect> </rect>
@ -179,7 +179,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>600</x> <x>600</x>
<y>140</y> <y>100</y>
<width>80</width> <width>80</width>
<height>23</height> <height>23</height>
</rect> </rect>
@ -281,9 +281,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>30</x>
<y>200</y> <y>166</y>
<width>701</width> <width>701</width>
<height>141</height> <height>131</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
@ -309,7 +309,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>28</y> <y>30</y>
<width>97</width> <width>97</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -322,7 +322,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>500</x> <x>500</x>
<y>98</y> <y>90</y>
<width>81</width> <width>81</width>
<height>23</height> <height>23</height>
</rect> </rect>
@ -332,7 +332,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>420</x> <x>420</x>
<y>68</y> <y>60</y>
<width>71</width> <width>71</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -345,7 +345,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>500</x> <x>500</x>
<y>68</y> <y>60</y>
<width>81</width> <width>81</width>
<height>23</height> <height>23</height>
</rect> </rect>
@ -355,7 +355,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>30</x>
<y>68</y> <y>60</y>
<width>53</width> <width>53</width>
<height>15</height> <height>15</height>
</rect> </rect>
@ -368,7 +368,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>90</x> <x>90</x>
<y>68</y> <y>60</y>
<width>301</width> <width>301</width>
<height>23</height> <height>23</height>
</rect> </rect>
@ -378,7 +378,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>90</x> <x>90</x>
<y>98</y> <y>90</y>
<width>301</width> <width>301</width>
<height>23</height> <height>23</height>
</rect> </rect>
@ -388,7 +388,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>30</x>
<y>98</y> <y>90</y>
<width>53</width> <width>53</width>
<height>15</height> <height>15</height>
</rect> </rect>
@ -401,7 +401,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>90</x> <x>90</x>
<y>28</y> <y>30</y>
<width>97</width> <width>97</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -414,7 +414,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>420</x> <x>420</x>
<y>103</y> <y>90</y>
<width>71</width> <width>71</width>
<height>20</height> <height>20</height>
</rect> </rect>

@ -51,6 +51,7 @@ GDDCdlg::GDDCdlg(QWidget *parent) : QWidget(parent), ui(new Ui::GDDCdlg) {
GDDCdlg::~GDDCdlg() { GDDCdlg::~GDDCdlg() {
// 停止所有通信 // 停止所有通信
stopPushURL();
stopConnectURL1(); stopConnectURL1();
stopConnectURL2(); stopConnectURL2();
stopConnectSerialCtrl(); stopConnectSerialCtrl();
@ -340,7 +341,7 @@ void GDDCdlg::resizeUI() {
// 定时器处理 // 定时器处理
void GDDCdlg::GDDCControlTimeOut() { void GDDCdlg::GDDCControlTimeOut() {
if (m_GDDCCmdDlg->sendTimes > 0) { if (m_GDDCCmdDlg->sendTimes > 0) { // 优先发送次数指令
m_GDDCCmdDlg->sendTimes -= 1; m_GDDCCmdDlg->sendTimes -= 1;
// UDP控制 // UDP控制
@ -356,7 +357,7 @@ void GDDCdlg::GDDCControlTimeOut() {
if (m_GDDCCmdDlg->sendTimes == 0) { if (m_GDDCCmdDlg->sendTimes == 0) {
m_GDDCCmdDlg->clearTJDCCmdBuffer(); m_GDDCCmdDlg->clearTJDCCmdBuffer();
} }
} else { } else { // 发送常发帧或长按指令
m_GDDCCmdDlg->UpdateDataTJDC(); m_GDDCCmdDlg->UpdateDataTJDC();
// UDP控制 // UDP控制
if (connectFlag[3]) { if (connectFlag[3]) {
@ -375,9 +376,9 @@ void GDDCdlg::GDDCControlTimeOut() {
void GDDCdlg::startConnectURL1() { void GDDCdlg::startConnectURL1() {
if (!connectFlag[0]) { if (!connectFlag[0]) {
connectFlag[0] = true; connectFlag[0] = true;
// Is_openVideo = true;
// ui->WgtffmpegVideo->Isplay(Is_openVideo); // 开始拉流
// ui->WgtffmpegVideo->m_PlayStatus = Is_openVideo; ui->WgtffmpegVideo->m_flowType = m_DlgGDDCSet->m_FlowType;
ui->WgtffmpegVideo->play(m_DlgGDDCSet->m_playURL1); ui->WgtffmpegVideo->play(m_DlgGDDCSet->m_playURL1);
} }
} }
@ -468,61 +469,77 @@ void GDDCdlg::stopConnectTCPCtrl() {
// 开始视频推流 // 开始视频推流
void GDDCdlg::startPushURL() { void GDDCdlg::startPushURL() {
if (!connectFlag[5]) { if (!connectFlag[5]) {
process = new QProcess();
connect(process, &QProcess::readyReadStandardOutput, this, [=]() mutable {
QString Output = process->readAllStandardOutput();
qDebug() << "Output:" << Output;
});
connect(process, &QProcess::readyReadStandardError, this, [=]() mutable {
QString Error = process->readAllStandardError();
qDebug() << "Error Output:" << Error;
});
// process->start("cmd",QStringList()<<"/c"<<"ffmpeg -i
// rtmp://liteavapp.qcloud.com/live/liteavdemoplayerstreamid -c copy -f flv
// rtmp://182.92.130.23/app/test");
QStringList m_cmd;
QString str;
str = "ffmpeg -i " + m_DlgGDDCSet->m_playURL1 + " -c copy -f flv " +
m_DlgGDDCSet->m_pushURL;
// str = "TaskList";
m_cmd << "/c" << str;
// m_cmd<<"/c"<<"ping"<<"baidu.com";
process->start("cmd", m_cmd);
connectFlag[5] = true;
// process->waitForStarted(); //等待程序启动 // //方式1命令行推流
// process->waitForFinished(); //等待程序关闭 // process = new QProcess();
// connect(process, &QProcess::readyReadStandardOutput, this, [=]() mutable {
// QString Output = process->readAllStandardOutput();
// qDebug() << "Output:" << Output;
// });
// connect(process, &QProcess::readyReadStandardError, this, [=]() mutable {
// QString Error = process->readAllStandardError();
// qDebug() << "Error Output:" << Error;
// });
// // process->start("cmd",QStringList()<<"/c"<<"ffmpeg -i
// // rtmp://liteavapp.qcloud.com/live/liteavdemoplayerstreamid -c copy -f flv
// // rtmp://182.92.130.23/app/test");
// QStringList m_cmd;
// QString str;
// // str = "ffmpeg -i " + m_DlgGDDCSet->m_playURL1 + " -c copy -f flv " +
// // m_DlgGDDCSet->m_pushURL;
// str = "ffmpeg -rtsp_transport tcp -i " + m_DlgGDDCSet->m_playURL1 + " -c:v libx264 -c:a copy -f flv " +
// m_DlgGDDCSet->m_pushURL;
// m_cmd << "/c" << str;
// process->start("cmd", m_cmd);
// //方式2代码推流
// if(!connectFlag[0])
// {
// QMessageBox::information(NULL, tr("提示"), "请先开始连接", QMessageBox::Ok);
// m_DlgGDDCSet->setPushStreamText("推送");
// return;
// }
ui->WgtffmpegVideo->setPushStreamIP(m_DlgGDDCSet->m_pushURL);
m_DlgGDDCSet->setPushStreamText("停止推送");
connectFlag[5] = true;
} }
} }
// 停止视频推流 // 停止视频推流
void GDDCdlg::stopPushURL() { void GDDCdlg::stopPushURL() {
if (connectFlag[5]) { if (connectFlag[5]) {
if (process != nullptr) {
process->terminate(); // //方式1命令行推流
process->close(); // if (process != nullptr) {
process->kill(); // process->terminate();
// 检查进程退出状态 // process->close();
if (process->exitStatus() == QProcess::CrashExit) { // process->kill();
qDebug() << "Process crashed"; // // 检查进程退出状态
} else { // if (process->exitStatus() == QProcess::CrashExit) {
qDebug() << "Process exited normally"; // qDebug() << "Process crashed";
} // } else {
delete process; // qDebug() << "Process exited normally";
// }
// 推流进程未自动关闭,手动关闭 // delete process;
int pids = GetmPid(L"ffmpeg.exe");
qDebug() << "ffmpeg.exe进程的pid为:" << pids; // // 推流进程未自动关闭,手动关闭
if (pids != 0) { // int pids = GetmPid(L"ffmpeg.exe");
// QString cmd; // qDebug() << "ffmpeg.exe进程的pid为:" << pids;
// cmd = "taskkill /pid "+QString::number(pids)+" -f"; // if (pids != 0) {
QStringList m_cmd; // QStringList m_cmd;
m_cmd << "/c" << "taskkill /pid " << QString::number(pids) << " -f"; // m_cmd << "/c" << "taskkill /pid " << QString::number(pids) << " -f";
QProcess::startDetached("cmd", m_cmd); // QProcess::startDetached("cmd", m_cmd);
} // }
} // }
//方式2代码推流
ui->WgtffmpegVideo->setPushStreamIP("");
m_DlgGDDCSet->setPushStreamText("推送");
connectFlag[5] = false; connectFlag[5] = false;
} }
} }

@ -23,6 +23,8 @@
// #include "ui_gddcSet.h" // #include "ui_gddcSet.h"
#include "QProcess" #include "QProcess"
#include <QThread> #include <QThread>
#include <QMessageBox>
#define cmdLength 44 #define cmdLength 44
namespace Ui { namespace Ui {
class GDDCdlg; class GDDCdlg;

@ -98,6 +98,7 @@ void HomePageSetingWidget::on_oneKeyButton_clicked() {
on_lLinkButton_clicked(); on_lLinkButton_clicked();
on_netButton_clicked(); on_netButton_clicked();
on_sateliteButton_clicked(); on_sateliteButton_clicked();
on_modelCameraButton_clicked();
} }
/************************************************* /*************************************************
* @func getAllParam * @func getAllParam

@ -38,7 +38,7 @@ bool Cffmpeg_decode::open_input_file() {
// 设置缓存大小1080p可将值调大 // 设置缓存大小1080p可将值调大
av_dict_set(&avdic, "buffer_size", "2048000", 0); av_dict_set(&avdic, "buffer_size", "2048000", 0);
// 以udp方式打开如果以tcp方式打开将udp替换为tcp // 以udp方式打开如果以tcp方式打开将udp替换为tcp
av_dict_set(&avdic, "rtsp_transport", "tcp", 0); av_dict_set(&avdic, "rtsp_transport", m_rtsp_transport.toUtf8().data(), 0);
// 设置超时断开连接时间,单位微秒//listen_timeout // 设置超时断开连接时间,单位微秒//listen_timeout
// av_dict_set(&avdic, "listen_timeout", "200000", 0); // av_dict_set(&avdic, "listen_timeout", "200000", 0);
av_dict_set(&avdic, "stimeout", "200000", 0); av_dict_set(&avdic, "stimeout", "200000", 0);
@ -333,3 +333,8 @@ void Cffmpeg_decode::saveDone() {
// m_videoStreamOut = nullptr; // m_videoStreamOut = nullptr;
} }
} }
void Cffmpeg_decode::setFlowType(QString param)
{
m_rtsp_transport = param;
}

@ -27,6 +27,7 @@ public:
* @param fileDirPath * @param fileDirPath
*/ */
void setSaveFileDirPath(QString fileDirPath); void setSaveFileDirPath(QString fileDirPath);
void setFlowType(QString);//设置拉流打开方式
public slots: public slots:
void run(); void run();
void setUrl(QString url); void setUrl(QString url);
@ -76,6 +77,9 @@ private:
QString m_strCodecName; // 编解码器名称 QString m_strCodecName; // 编解码器名称
AVStream *m_videoStreamOut = nullptr; // 输出视频流 AVStream *m_videoStreamOut = nullptr; // 输出视频流
bool m_writeHeader = false; // 是否写入文件头 bool m_writeHeader = false; // 是否写入文件头
QString m_rtsp_transport = ""; //拉流打开方式UDP或TCP
private: private:
bool openSave(); bool openSave();
void saveDone(); void saveDone();

@ -7,6 +7,8 @@ ffmpegvideoDlg::ffmpegvideoDlg(QWidget *parent)
ui->setupUi(this); ui->setupUi(this);
ffmpegPushStream = nullptr; ffmpegPushStream = nullptr;
pushStreamThread = nullptr; pushStreamThread = nullptr;
// iniWindow();
m_flowType = "";
} }
ffmpegvideoDlg::~ffmpegvideoDlg() { ffmpegvideoDlg::~ffmpegvideoDlg() {
@ -31,8 +33,12 @@ void ffmpegvideoDlg::play(QString url) {
ffmpeg = new Cffmpeg_decode; ffmpeg = new Cffmpeg_decode;
ffmpeg->setSaveFileDirPath(videoSaveDirPath); ffmpeg->setSaveFileDirPath(videoSaveDirPath);
ffmpeg->IsstopPlay = false; ffmpeg->IsstopPlay = false;
if (!pushStreamIP.isEmpty()) // 推流
startPushStream(); if (!pushStreamIP.isEmpty()){
startPushStream();
}
ffmpeg->setFlowType(m_flowType);
ffmpeg->moveToThread(&workerThread); ffmpeg->moveToThread(&workerThread);
connect(&workerThread, &QThread::finished, ffmpeg, connect(&workerThread, &QThread::finished, ffmpeg,
@ -45,7 +51,6 @@ void ffmpegvideoDlg::play(QString url) {
SLOT(receiveQImage(QImage))); // 发送解析的图片 SLOT(receiveQImage(QImage))); // 发送解析的图片
connect(ffmpeg, SIGNAL(sendConnectFail(int)), this, connect(ffmpeg, SIGNAL(sendConnectFail(int)), this,
SLOT(showMessagBox(int))); // 发送错误信息提示 SLOT(showMessagBox(int))); // 发送错误信息提示
workerThread.start(); workerThread.start();
emit this->setUrlSign(url); // 设置URL emit this->setUrlSign(url); // 设置URL
emit this->operate(); // 启用线程信号 emit this->operate(); // 启用线程信号
@ -111,6 +116,12 @@ bool ffmpegvideoDlg::Isplay(bool IsstopPlay) {
return ffmpeg->IsstopPlay = IsstopPlay; return ffmpeg->IsstopPlay = IsstopPlay;
} }
// 设置推流地址
void ffmpegvideoDlg::setPushStreamIP(QString pushStreamURL) {
pushStreamIP = pushStreamURL;
}
// 开始推流
void ffmpegvideoDlg::startPushStream() { void ffmpegvideoDlg::startPushStream() {
if (ffmpegPushStream == nullptr) { if (ffmpegPushStream == nullptr) {
ffmpegPushStream = new FFmpegPushStream; ffmpegPushStream = new FFmpegPushStream;
@ -128,9 +139,6 @@ void ffmpegvideoDlg::startPushStream() {
&FFmpegPushStream::pushStream); &FFmpegPushStream::pushStream);
connect(ffmpeg, &Cffmpeg_decode::sendStopPushStream_Signal, ffmpegPushStream, connect(ffmpeg, &Cffmpeg_decode::sendStopPushStream_Signal, ffmpegPushStream,
&FFmpegPushStream::stopPush); &FFmpegPushStream::stopPush);
ffmpeg->bPushStreamFlag = true;
}
void ffmpegvideoDlg::setPushStreamIP(QString pushStreamURL) { ffmpeg->bPushStreamFlag = true;
pushStreamIP = pushStreamURL;
} }

@ -25,11 +25,14 @@ public:
void setVedioSaveFileDirPath(QString saveDirPath); void setVedioSaveFileDirPath(QString saveDirPath);
//拉流
void play(QString); void play(QString);
void stop(); void stop();
bool Isplay(bool IsstopPlay); bool Isplay(bool IsstopPlay);
void startPushStream();
//推流
void setPushStreamIP(QString pushStreamURL); void setPushStreamIP(QString pushStreamURL);
void startPushStream();
private: private:
Ui::ffmpegvideoDlg *ui; Ui::ffmpegvideoDlg *ui;
@ -41,6 +44,7 @@ public:
double m_ax; double m_ax;
double m_ay; double m_ay;
QString m_flowType;
protected: protected:
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);

@ -1,12 +1,10 @@
#include "global.h" #include "global.h"
global::global() {}
QString g_SoftwareVersion = "版本号V1.00.00";
QColor g_themeColor(51, 51, 51); QColor g_themeColor(51, 51, 51);
QString g_PushBtnStyle = /**正常情况下样式**/ QString g_PushBtnStyle = /**正常情况下样式**/
"QPushButton{" "QPushButton{"
"font: 12pt '微软雅黑';" "font: 12pt '微软雅黑';"
@ -155,4 +153,4 @@ uint16_t calCRC16(const uint8_t *cpu8Data, uint16_t u16Len)
return u16CRC; return u16CRC;
} }
global::global() {}

@ -3,6 +3,7 @@
#include <QColor> #include <QColor>
extern QString g_SoftwareVersion; //软件版本号
/*******************系统颜色***************************************/ /*******************系统颜色***************************************/
extern QColor g_themeColor; extern QColor g_themeColor;

@ -0,0 +1,89 @@
#include "imageswitch.h"
#include <QPainter>
ImageSwitch::ImageSwitch(QWidget *parent) : QWidget(parent)
{
isChecked = false;
buttonStyle = ButtonStyle_1;
imgOffFile = ":/res/switch/switch_close.png";
imgOnFile = ":/res/switch/switch_open.png";
imgFile = imgOffFile;
}
void ImageSwitch::mousePressEvent(QMouseEvent *)
{
imgFile = isChecked ? imgOffFile : imgOnFile;
isChecked = !isChecked;
emit checkedChanged(isChecked);
this->update();
}
void ImageSwitch::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.setRenderHints(QPainter::SmoothPixmapTransform);
QImage img(imgFile);
img = img.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
//按照比例自动居中绘制
int pixX = rect().center().x() - img.width() / 2;
int pixY = rect().center().y() - img.height() / 2;
QPoint point(pixX, pixY);
painter.drawImage(point, img);
}
QSize ImageSwitch::sizeHint() const
{
return QSize(87, 28);
}
QSize ImageSwitch::minimumSizeHint() const
{
return QSize(87, 28);
}
bool ImageSwitch::getChecked() const
{
return isChecked;
}
void ImageSwitch::setChecked(bool isChecked)
{
if (this->isChecked != isChecked) {
this->isChecked = isChecked;
imgFile = isChecked ? imgOnFile : imgOffFile;
this->update();
}
}
ImageSwitch::ButtonStyle ImageSwitch::getButtonStyle() const
{
return this->buttonStyle;
}
void ImageSwitch::setButtonStyle(const ImageSwitch::ButtonStyle &buttonStyle)
{
if (this->buttonStyle != buttonStyle) {
this->buttonStyle = buttonStyle;
if (buttonStyle == ButtonStyle_1) {
imgOffFile = ":/res/switch/switch_close.png";
imgOnFile = ":/res/switch/switch_open.png";
this->resize(87, 28);
} else if (buttonStyle == ButtonStyle_2) {
imgOffFile = ":/res/switch/switch_close1.png";
imgOnFile = ":/res/switch/switch_open1.png";
this->resize(87, 28);
} else if (buttonStyle == ButtonStyle_3) {
imgOffFile = ":/res/switch/switch_close3.png";
imgOnFile = ":/res/switch/switch_open3.png";
this->resize(96, 38);
}
imgFile = isChecked ? imgOnFile : imgOffFile;
setChecked(isChecked);
this->update();
updateGeometry();
}
}

@ -0,0 +1,56 @@
#ifndef IMAGESWITCH_H
#define IMAGESWITCH_H
#include <QWidget>
class ImageSwitch : public QWidget
{
Q_OBJECT
Q_ENUMS(ButtonStyle)
Q_PROPERTY(bool isChecked READ getChecked WRITE setChecked)
Q_PROPERTY(ButtonStyle buttonStyle READ getButtonStyle WRITE setButtonStyle)
public:
ImageSwitch();
enum ButtonStyle {
ButtonStyle_1 = 0, //开关样式1
ButtonStyle_2 = 1, //开关样式2
ButtonStyle_3 = 2 //开关样式3
};
explicit ImageSwitch(QWidget *parent = 0);
protected:
void mousePressEvent(QMouseEvent *);
void paintEvent(QPaintEvent *event);
private:
bool isChecked; //是否选中
ButtonStyle buttonStyle; //按钮样式
QString imgOffFile; //关闭图片
QString imgOnFile; //开启图片
QString imgFile; //当前图片
public:
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
//获取和设置是否选中
bool getChecked() const;
void setChecked(bool isChecked);
//获取和设置按钮样式
ButtonStyle getButtonStyle() const;
void setButtonStyle(const ImageSwitch::ButtonStyle &buttonStyle);
signals:
void checkedChanged(bool checked);
};
#endif // IMAGESWITCH_H

@ -30,5 +30,13 @@
<file>res/lamp/red.png</file> <file>res/lamp/red.png</file>
<file>res/lamp/white.png</file> <file>res/lamp/white.png</file>
<file>res/lamp/yellow.png</file> <file>res/lamp/yellow.png</file>
<file>res/switch/switch_close.png</file>
<file>res/switch/switch_open.png</file>
<file>res/switch/switch_close1.png</file>
<file>res/switch/switch_close2.png</file>
<file>res/switch/switch_open1.png</file>
<file>res/switch/switch_open2.png</file>
<file>res/switch/switch_close3.png</file>
<file>res/switch/switch_open3.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Loading…
Cancel
Save