增加光电吊舱通信设置页面和配置功能、增加控制区域隐藏与显示功能

pull/3/head
caoyuhui 8 months ago
parent bf1961df46
commit 04ce4e937e

@ -12,11 +12,12 @@ QMAKE_PROJECT_DEPTH = 0
SOURCES += \ SOURCES += \
Src/GDDC/gddcSet.cpp \
cffmpeg_decode.cpp \ cffmpeg_decode.cpp \
customwebenginepage.cpp \ customwebenginepage.cpp \
cwebengineview.cpp \ cwebengineview.cpp \
ffmpegvideodlg.cpp \ ffmpegvideodlg.cpp \
gddcdlg.cpp \ Src/GDDC/gddcdlg.cpp \
global.cpp \ global.cpp \
homepagedlg.cpp \ homepagedlg.cpp \
main.cpp \ main.cpp \
@ -25,19 +26,22 @@ SOURCES += \
HEADERS += \ HEADERS += \
DCFrameCkCmd.h \ DCFrameCkCmd.h \
Src/GDDC/gddcSet.h \
Src/GDDC/structDefineMyslef.h \
cffmpeg_decode.h \ cffmpeg_decode.h \
customwebenginepage.h \ customwebenginepage.h \
cwebengineview.h \ cwebengineview.h \
ffmpegvideodlg.h \ ffmpegvideodlg.h \
gddcdlg.h \ Src/GDDC/gddcdlg.h \
global.h \ global.h \
homepagedlg.h \ homepagedlg.h \
mainwindow.h \ mainwindow.h \
qweb.h qweb.h
FORMS += \ FORMS += \
Src/GDDC/gddcSet.ui \
ffmpegvideodlg.ui \ ffmpegvideodlg.ui \
gddcdlg.ui \ Src/GDDC/gddcdlg.ui \
homepagedlg.ui \ homepagedlg.ui \
mainwindow.ui \ mainwindow.ui \
qweb.ui qweb.ui

@ -0,0 +1,206 @@
#include "gddcSet.h"
#include "ui_gddcSet.h"
#include <QSettings>
//#pragma execution_character_set(“utf-8”)
GDDCSet::GDDCSet(QWidget *parent)
: QWidget(parent)
, ui(new Ui::GDDCSet)
{
ui->setupUi(this);
initWindow();
initParam();
initUDPSocket();
}
GDDCSet::~GDDCSet()
{
delete ui;
}
void GDDCSet::initWindow()
{
this->setWindowTitle("通信设置");
}
void GDDCSet::initUDPSocket()
{
}
void GDDCSet::initParam()
{
//m_myPairNetwork("",0,"",0);
// QSettings setting("./sentence.ini",QSettings::IniFormat);
// setting.setIniCodec(QTextCodec::codecForName("UTF-8")); //重点
ui->comboBox_streamType->addItem("RTSP");
ui->comboBox_streamType->addItem("UDP Raw");
ui->comboBox_streamType->addItem("UDP 422");
ui->comboBox_streamType->addItem("UDP TS");
ui->comboBox_playURL1->addItem("rtsp://192.168.1.160:554/live/track0");
ui->comboBox_playURL1->setEditable(true);
/*"rtsp://192.168.1.160:554/live/track0"*/
/*"rtmp://liteavapp.qcloud.com/live/liteavdemoplayerstreamid"*/
ui->lineEdit_playport1->setText("10008");
ui->lineEdit_playport2->setText("0");
ui->radioButton_NetCtrlUDP->setChecked(true);
ui->radioButton_NetCtrlTCP->setChecked(false);
//读取本机网络设备
QString name = QDir::currentPath()+"/../../config.ini";
m_configIniPath = name.toLatin1();
char* strSysIniName = m_configIniPath.data();//系统配置文件路径
char inBuf[100];
::GetPrivateProfileStringA("光电吊舱-视频连接-显示窗口2", "播放URL", "-1", inBuf, 100, strSysIniName);
m_playURL2 = QString::fromUtf8(inBuf);
ui->lineEdit_playURL2->setText(m_playURL2);
::GetPrivateProfileStringA("光电吊舱-视频连接-显示窗口2", "播放Port", "-1", inBuf, 100, strSysIniName);
m_playPort2 = atoi(inBuf);;
ui->lineEdit_playport2->setText(QString::number(m_playPort2));
::GetPrivateProfileStringA("光电吊舱-视频连接-显示窗口1", "播放Port", "-1", inBuf, 100, strSysIniName);
m_playPort1 = atoi(inBuf);;
ui->lineEdit_playport1->setText(QString::number(m_playPort1));
::GetPrivateProfileStringA("光电吊舱-网络控制", "远端IP", "-1", inBuf, 100, strSysIniName);
m_myPairNetwork.setRemoteIP(QString::fromUtf8(inBuf));
::GetPrivateProfileStringA("光电吊舱-网络控制", "远端Port", "-1", inBuf, 100, strSysIniName);
m_myPairNetwork.setRemotePort(atoi(inBuf));
::GetPrivateProfileStringA("光电吊舱-网络控制", "本地IP", "-1", inBuf, 100, strSysIniName);
m_myPairNetwork.setLocalIP(QString::fromUtf8(inBuf));
::GetPrivateProfileStringA("光电吊舱-网络控制", "本地Port", "-1", inBuf, 100, strSysIniName);
m_myPairNetwork.setLocalPort(atoi(inBuf));
ui->lineEdit_NetCtrlRemoteIp->setText(m_myPairNetwork.getRemoteIP());
ui->lineEdit_NetCtrlRemotePort->setText(QString::number(m_myPairNetwork.getRemotePort()));
ui->lineEdit_NetCtrlLocalIp->setText(m_myPairNetwork.getLocalIP());
ui->lineEdit_NetCtrlLocalPort->setText(QString::number(m_myPairNetwork.getLocalPort()));
}
//视频连接-显示窗口1-连接
void GDDCSet::on_pushButton_ConnectURL1_clicked()
{
saveDataToLocalIni();
if(ui->pushButton_ConnectURL1->text()=="连接")
{
emit SignalStartConnect(1);
ui->pushButton_ConnectURL1->setText("断开");
}
else
{
emit SignalStopConnect(1);
ui->pushButton_ConnectURL1->setText("连接");
}
}
//视频连接-显示窗口2-连接
void GDDCSet::on_pushButton_ConnectURL2_clicked()
{
saveDataToLocalIni();
if(ui->pushButton_ConnectURL2->text()=="连接")
{
emit SignalStartConnect(2);
ui->pushButton_ConnectURL2->setText("断开");
}
else
{
emit SignalStopConnect(2);
ui->pushButton_ConnectURL2->setText("连接");
}
}
//串口控制-刷新
void GDDCSet::on_pushButton_serialControlRefalsh_clicked()
{
saveDataToLocalIni();
}
//串口控制-连接
void GDDCSet::on_pushButton_serialControlConnect_clicked()
{
saveDataToLocalIni();
if(ui->pushButton_serialControlConnect->text()=="连接")
{
emit SignalStartConnect(3);
ui->pushButton_serialControlConnect->setText("断开");
}
else
{
emit SignalStopConnect(3);
ui->pushButton_serialControlConnect->setText("连接");
}
}
//网络控制-连接
void GDDCSet::on_pushButton_NetCtrlConnect_clicked()
{
saveDataToLocalIni();
if(ui->pushButton_NetCtrlConnect->text()=="连接")
{
if(ui->radioButton_NetCtrlUDP->isChecked())
{
emit SignalStartConnect(4);
}
else
{
emit SignalStartConnect(5);
}
ui->pushButton_NetCtrlConnect->setText("断开");
}
else
{
emit SignalStopConnect(4);
emit SignalStopConnect(5);
ui->pushButton_NetCtrlConnect->setText("连接");
}
}
//保存数据至本地ini文件
void GDDCSet::saveDataToLocalIni()
{
char* strSysIniName = m_configIniPath.data();//系统配置文件路径
char* inBuf;
QByteArray ba;
m_myPairNetwork.setLocalIP(ui->lineEdit_NetCtrlLocalIp->text());
ba = m_myPairNetwork.getLocalIP().toLocal8Bit();
inBuf = ba.data();//toLatin1,toUtf8
::WritePrivateProfileStringA("光电吊舱-网络控制", "本地IP", inBuf, strSysIniName);
m_myPairNetwork.setLocalPort(ui->lineEdit_NetCtrlLocalPort->text().toInt());
_itoa_s(m_myPairNetwork.getLocalPort(),inBuf,10,10);//要转换的数字,存放转换结果的字符串,存放结果的字符数组长度,转化的进制数2表示2进制10表示10进制
::WritePrivateProfileStringA("光电吊舱-网络控制", "本地Port", inBuf, strSysIniName);
m_myPairNetwork.setRemoteIP(ui->lineEdit_NetCtrlRemoteIp->text());
ba = m_myPairNetwork.getRemoteIP().toLocal8Bit();
inBuf = ba.data();
::WritePrivateProfileStringA("光电吊舱-网络控制", "远端IP", inBuf, strSysIniName);
m_myPairNetwork.setRemotePort(ui->lineEdit_NetCtrlRemotePort->text().toInt());
_itoa_s(m_myPairNetwork.getRemotePort(),inBuf,10,10);
::WritePrivateProfileStringA("光电吊舱-网络控制", "远端Port", inBuf, strSysIniName);
m_playURL2 = ui->lineEdit_playURL2->text();
ba = m_playURL2.toLocal8Bit();
inBuf = ba.data();
::WritePrivateProfileStringA("光电吊舱-视频连接-显示窗口2", "播放URL", inBuf, strSysIniName);
m_playPort2 = ui->lineEdit_playport2->text().toInt();
_itoa_s(m_playPort2,inBuf,10,10);
::WritePrivateProfileStringA("光电吊舱-视频连接-显示窗口2", "播放Port", inBuf, strSysIniName);
m_playURL1 = ui->comboBox_playURL1->currentText();
m_playPort1 = ui->lineEdit_playport1->text().toInt();
_itoa_s(m_playPort1,inBuf,10,10);
::WritePrivateProfileStringA("光电吊舱-视频连接-显示窗口1", "播放Port", inBuf, strSysIniName);
}

@ -0,0 +1,48 @@
#ifndef GDDCSET_H
#define GDDCSET_H
#include <QWidget>
#include <QByteArray>
#include <QDir>
#include <windows.h>
#include "Src/GDDC/structDefineMyslef.h"
namespace Ui {
class GDDCSet;
}
class GDDCSet : public QWidget
{
Q_OBJECT
public:
explicit GDDCSet(QWidget *parent = nullptr);
~GDDCSet();
private:
Ui::GDDCSet *ui;
public:
void initUDPSocket(); //初始化UDPSocket
void initWindow(); //初始化窗口
void initParam(); //初始化参数
void saveDataToLocalIni(); //保存数据至本地ini文件
QByteArray m_configIniPath; //ini配置文件路径
QString m_playURL1; //光电吊舱-视频连接-显示窗口1-URL地址
int m_playPort1; //光电吊舱-视频连接-显示窗口-1端口
QString m_playURL2; //光电吊舱-视频连接-显示窗口2-URL地址
int m_playPort2; //光电吊舱-视频连接-显示窗口-2端口
MyPairNetwork m_myPairNetwork;//网络通信结构体
signals:
void SignalStartConnect(int a); //信号开始连接
void SignalStopConnect(int a); //信号停止连接
private slots:
void on_pushButton_ConnectURL1_clicked();
void on_pushButton_ConnectURL2_clicked();
void on_pushButton_serialControlRefalsh_clicked();
void on_pushButton_serialControlConnect_clicked();
void on_pushButton_NetCtrlConnect_clicked();
};
#endif // GDDCSET_H

@ -0,0 +1,440 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GDDCSet</class>
<widget class="QWidget" name="GDDCSet">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>761</width>
<height>506</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>30</x>
<y>10</y>
<width>701</width>
<height>211</height>
</rect>
</property>
<property name="title">
<string>视频连接</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>53</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>流类型:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_streamType">
<property name="geometry">
<rect>
<x>90</x>
<y>30</y>
<width>72</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>显示窗口1</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>20</x>
<y>100</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>播放URL:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_playURL1">
<property name="geometry">
<rect>
<x>90</x>
<y>100</y>
<width>301</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>440</x>
<y>100</y>
<width>53</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>端口:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_playport1">
<property name="geometry">
<rect>
<x>500</x>
<y>100</y>
<width>81</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_ConnectURL1">
<property name="geometry">
<rect>
<x>600</x>
<y>100</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>连接</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>10</x>
<y>140</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>显示窗口2</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>20</x>
<y>170</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>播放URL:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_playURL2">
<property name="geometry">
<rect>
<x>90</x>
<y>170</y>
<width>301</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>440</x>
<y>170</y>
<width>53</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>端口:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_playport2">
<property name="geometry">
<rect>
<x>500</x>
<y>170</y>
<width>81</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_ConnectURL2">
<property name="geometry">
<rect>
<x>600</x>
<y>170</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>连接</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>30</x>
<y>230</y>
<width>701</width>
<height>80</height>
</rect>
</property>
<property name="title">
<string>串口控制</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<widget class="QPushButton" name="pushButton_serialControlConnect">
<property name="geometry">
<rect>
<x>600</x>
<y>40</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>连接</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_serialControlBaudRate">
<property name="geometry">
<rect>
<x>310</x>
<y>40</y>
<width>72</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>250</x>
<y>40</y>
<width>53</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>波特率:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_serialControlNumber">
<property name="geometry">
<rect>
<x>90</x>
<y>40</y>
<width>72</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_serialControlRefalsh">
<property name="geometry">
<rect>
<x>500</x>
<y>40</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>刷新</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>30</x>
<y>40</y>
<width>53</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>串口号:</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
<rect>
<x>30</x>
<y>330</y>
<width>701</width>
<height>141</height>
</rect>
</property>
<property name="title">
<string>网络控制</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<widget class="QPushButton" name="pushButton_NetCtrlConnect">
<property name="geometry">
<rect>
<x>600</x>
<y>80</y>
<width>80</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>连接</string>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_NetCtrlUDP">
<property name="geometry">
<rect>
<x>10</x>
<y>28</y>
<width>97</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>UDP</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_NetCtrlLocalPort">
<property name="geometry">
<rect>
<x>500</x>
<y>98</y>
<width>81</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>420</x>
<y>68</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>设备端口:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_NetCtrlRemotePort">
<property name="geometry">
<rect>
<x>500</x>
<y>68</y>
<width>81</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>30</x>
<y>68</y>
<width>53</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>远端IP</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_NetCtrlRemoteIp">
<property name="geometry">
<rect>
<x>90</x>
<y>68</y>
<width>301</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_NetCtrlLocalIp">
<property name="geometry">
<rect>
<x>90</x>
<y>98</y>
<width>301</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>30</x>
<y>98</y>
<width>53</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>本机IP</string>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_NetCtrlTCP">
<property name="geometry">
<rect>
<x>90</x>
<y>28</y>
<width>97</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>TCP</string>
</property>
</widget>
<widget class="QLabel" name="label_13">
<property name="geometry">
<rect>
<x>420</x>
<y>103</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>本地端口:</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

@ -20,7 +20,7 @@ GDDCdlg::GDDCdlg(QWidget *parent)
initWindow(); initWindow();
initParam(); initParam();
initUDPSocket(); initSignalSlot();
/*启动定时器*/ /*启动定时器*/
GDDCControlTimer = new QTimer(); GDDCControlTimer = new QTimer();
@ -35,9 +35,14 @@ GDDCdlg::~GDDCdlg()
{ {
//关闭定时器 //关闭定时器
GDDCControlTimer->stop(); GDDCControlTimer->stop();
//关闭套接字,并丢弃写缓冲区中的所有待处理数据。
udpSocket->abort(); //停止所有通信
delete udpSocket; stopConnectURL1();
stopConnectURL2();
stopConnectSerialCtrl();
stopConnectUDPCtrl();
stopConnectTCPCtrl();
delete ui; delete ui;
} }
@ -57,6 +62,7 @@ void GDDCdlg::initWindow()
setWindowFlags(Qt::CustomizeWindowHint|Qt::FramelessWindowHint); setWindowFlags(Qt::CustomizeWindowHint|Qt::FramelessWindowHint);
hide(); hide();
m_DlgGDDCSet = new GDDCSet();
} }
//初始化参数 //初始化参数
@ -151,50 +157,71 @@ void GDDCdlg::initParam()
ui->lineEdit_6_2->setText("540"); ui->lineEdit_6_2->setText("540");
detectionAreaSetting = false; detectionAreaSetting = false;
ui->lineUrl->setText("rtsp://192.168.1.160:554/live/track0"); connectFlag.resize(10,false);
/*"rtsp://192.168.1.160:554/live/track0"*/ ui->pushButShowCmdArea->setIcon(QIcon(":/res/down.png"));
/*"rtmp://liteavapp.qcloud.com/live/liteavdemoplayerstreamid"*/ }
//初始化信号与槽
void GDDCdlg::initSignalSlot()
{
connect(m_DlgGDDCSet,SIGNAL(SignalStartConnect(int)),this,SLOT(startConnect(int)));
connect(m_DlgGDDCSet,SIGNAL(SignalStopConnect(int)),this,SLOT(stopConnect(int)));
} }
//初始化udp通信 //槽函数开始连接
void GDDCdlg::initUDPSocket() void GDDCdlg::startConnect(int type)
{ {
switch(type)
//读取本机网络设备 {
char inBuf[100]; case 1://播放视频1
char* strSysIniName; //系统配置文件路径 stopConnectURL2();
startConnectURL1();
QString str1 = QDir::currentPath()+"/../../config.ini"; break;
QByteArray ba = str1.toLatin1(); case 2://播放视频2
strSysIniName = ba.data(); stopConnectURL1();
startConnectURL2();
::GetPrivateProfileStringA("光电吊舱", "远端ip", "-1", inBuf, 20, strSysIniName); break;
RemoteIP = QString::fromUtf8(inBuf); case 3://串口控制
::GetPrivateProfileStringA("光电吊舱", "远端端口", "-1", inBuf, 20, strSysIniName); startConnectSerialCtrl();
RemotePort = atoi(inBuf); break;
::GetPrivateProfileStringA("光电吊舱", "本地ip", "-1", inBuf, 20, strSysIniName); case 4://UDP控制
localIP = QString::fromUtf8(inBuf); stopConnectTCPCtrl();
::GetPrivateProfileStringA("光电吊舱", "本地端口", "-1", inBuf, 20, strSysIniName); startConnectUDPCtrl();
localPort = atoi(inBuf); break;
case 5://TCP控制
//创建udp socket对象 stopConnectUDPCtrl();
udpSocket = new QUdpSocket(this); startConnectTCPCtrl();
//RemoteIP = "192.168.1.160"; //目标IP break;
RemoteAddr.setAddress(RemoteIP); default:
//RemotePort = 10000;//目标port break;
}
/*接收*/
//获取本机ip
QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
udpSocket->bind(localPort);
} }
//槽函数停止连接
void GDDCdlg::stopConnect(int type)
{
switch(type)
{
case 1:
stopConnectURL1();
break;
case 2:
stopConnectURL2();
break;
case 3:
stopConnectSerialCtrl();
break;
case 4:
stopConnectUDPCtrl();
break;
case 5:
stopConnectTCPCtrl();
break;
default :
break;
}
}
// bool GDDCdlg::eventFilter(QObject *watched, QEvent *event) // bool GDDCdlg::eventFilter(QObject *watched, QEvent *event)
// { // {
// qDebug() << this->geometry().x(); // qDebug() << this->geometry().x();
@ -214,13 +241,6 @@ void GDDCdlg::mousePressEvent(QMouseEvent *event)
{ {
//如果鼠标左键按下 //如果鼠标左键按下
if (event->type() == QEvent::MouseButtonPress) { if (event->type() == QEvent::MouseButtonPress) {
//获取鼠标在事件接收者中的位置pos
//qDebug() << event->pos();
///获取控件X Y坐标
//textX = ui->labelImage->x();
//textY = ui->labelImage->y();
//AI检测区域设置 //AI检测区域设置
if(detectionAreaSetting==true) if(detectionAreaSetting==true)
{ {
@ -289,21 +309,37 @@ void GDDCdlg::mouseMoveEvent(QMouseEvent *event)
} }
} }
//区域重绘
void GDDCdlg::resizeEvent(QResizeEvent *event) void GDDCdlg::resizeEvent(QResizeEvent *event)
{ {
resizeUI(); //重新设置布局
}
//重新设置布局
void GDDCdlg::resizeUI()
{
/* -------------->x
* | (0,0)
* |
* |
* |
* |
* y
*/
double GDDCPageHeight = (double)(this->height()); double GDDCPageHeight = (double)(this->height());
double GDDCPageWidth = (double)(this->width()); double GDDCPageWidth = (double)(this->width());
//qDebug()<<"宽度,高度:"<<GDDCPageHeight<<GDDCPageWidth; //qDebug()<<"宽度,高度:"<<GDDCPageHeight<<GDDCPageWidth;
/*控制指令区域位置和大小设置*/ /******控制指令区域位置和大小设置*****/
double cmdAreaHeight = 250; double cmdAreaHeight;
double cmdAreaWidth = GDDCPageWidth; double cmdAreaWidth = GDDCPageWidth;
if(ui->tabWidget->isVisible()){cmdAreaHeight = 250;}
else{cmdAreaHeight = 0;}
ui->tabWidget->setGeometry(0,GDDCPageHeight-cmdAreaHeight,(int)cmdAreaWidth,(int)cmdAreaHeight); ui->tabWidget->setGeometry(0,GDDCPageHeight-cmdAreaHeight,(int)cmdAreaWidth,(int)cmdAreaHeight);
//qDebug()<<"Cmd宽度,高度:"<<cmdAreaWidth<<cmdAreaHeight;
/*视频区域位置和大小设置*/ /*******视频区域位置和大小设置********/
double VideoAreaHeight = GDDCPageHeight-cmdAreaHeight; double VideoAreaHeight = GDDCPageHeight-cmdAreaHeight; //视频区域高度
double VideoAreaWidth = GDDCPageWidth; double VideoAreaWidth = GDDCPageWidth; //视频区域宽度
//高度值相对比较大 //高度值相对比较大
if(VideoAreaHeight*16>VideoAreaWidth*9) if(VideoAreaHeight*16>VideoAreaWidth*9)
{ {
@ -319,14 +355,32 @@ void GDDCdlg::resizeEvent(QResizeEvent *event)
ui->WgtffmpegVideo->setGeometry(0.5*(GDDCPageWidth-setVideoAreaWidth),0,(int)setVideoAreaWidth,(int)setVideoAreaHeight); ui->WgtffmpegVideo->setGeometry(0.5*(GDDCPageWidth-setVideoAreaWidth),0,(int)setVideoAreaWidth,(int)setVideoAreaHeight);
} }
/**************设置按钮****************/
ui->pushButtonSet->setGeometry(GDDCPageWidth-40,10,40,40);
/**********控制指令区显示隐藏按钮********/
ui->pushButShowCmdArea->setGeometry(GDDCPageWidth*0.5,GDDCPageHeight-cmdAreaHeight-20,20,20);
ui->pushButShowCmdArea->raise();
} }
//定时器处理 //定时器处理
void GDDCdlg::GDDCControlTimeOut() void GDDCdlg::GDDCControlTimeOut()
{ {
if(sendTimes>0) if(sendTimes>0)
{ {
sendTimes-=1; sendTimes-=1;
udpSocket->writeDatagram(m_DCcmdBuffer,RemoteAddr,RemotePort);
//UDP控制
if(connectFlag[3])
{
udpSocket->writeDatagram(m_DCcmdBuffer,m_DlgGDDCSet->m_myPairNetwork.getRemoteAddr(),m_DlgGDDCSet->m_myPairNetwork.getRemotePort());
}
//TCP控制
//串口控制
if(sendTimes==0) if(sendTimes==0)
{ {
clearTJDCCmdBuffer(); clearTJDCCmdBuffer();
@ -335,7 +389,18 @@ void GDDCdlg::GDDCControlTimeOut()
else else
{ {
UpdateDataTJDC(); UpdateDataTJDC();
udpSocket->writeDatagram(m_DCcmdBuffer,RemoteAddr,RemotePort);
//UDP控制
if(connectFlag[3])
{
udpSocket->writeDatagram(m_DCcmdBuffer,m_DlgGDDCSet->m_myPairNetwork.getRemoteAddr(),m_DlgGDDCSet->m_myPairNetwork.getRemotePort());
}
//TCP控制
//串口控制
} }
} }
@ -1523,33 +1588,139 @@ void GDDCdlg::on_pushButton_6_8_clicked()
} }
} }
//播放视频 //播放视频1
void GDDCdlg::on_Video_Btnplay_clicked() void GDDCdlg::startConnectURL1()
{ {
if(!connectFlag[0])
if(!Is_openVideo)
{ {
Is_openVideo = true ; connectFlag[0] = true ;
//ui->WgtffmpegVideo->Isplay(Is_openVideo); //ui->WgtffmpegVideo->Isplay(Is_openVideo);
ui->WgtffmpegVideo->play(); ui->WgtffmpegVideo->play();
ui->WgtffmpegVideo->setUrl(ui->lineUrl->text()); ui->WgtffmpegVideo->setUrl(m_DlgGDDCSet->m_playURL1);
ui->WgtffmpegVideo->m_PlayStatus =Is_openVideo; ui->WgtffmpegVideo->m_PlayStatus =Is_openVideo;
}
}
//关闭视频1
void GDDCdlg::stopConnectURL1()
{
if(connectFlag[0])
{
connectFlag[0] = false ;
ui->WgtffmpegVideo->m_PlayStatus = Is_openVideo;
ui->WgtffmpegVideo->stop();
}
}
//播放视频2
void GDDCdlg::startConnectURL2()
{
if(!connectFlag[1])
{
connectFlag[1] = true ;
} }
}
//关闭视频2
void GDDCdlg::stopConnectURL2()
{
if(connectFlag[1])
{
connectFlag[1] = false ;
}
}
void GDDCdlg::startConnectSerialCtrl()
{
if(!connectFlag[2])
{
connectFlag[2] = true ;
}
}
void GDDCdlg::stopConnectSerialCtrl()
{
if(connectFlag[2])
{
connectFlag[2] = false ;
}
}
//开始UDP控制通信
void GDDCdlg::startConnectUDPCtrl()
{
if(!connectFlag[3])
{
//创建udp socket对象
udpSocket = new QUdpSocket(this);
/*接收*/
//QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();//获取本机ip
udpSocket->bind(m_DlgGDDCSet->m_myPairNetwork.getLocalPort());
connect(udpSocket,SIGNAL(readyRead()),this,SLOT(UDPMessageReceive()));
connectFlag[3] = true;
}
}
//停止UDP控制通信
void GDDCdlg::stopConnectUDPCtrl()
{
if(connectFlag[3])
{
udpSocket->abort();//关闭套接字,并丢缓冲区中的所有待处理数据
connectFlag[3] = false;
}
}
//开始TCP控制通信
void GDDCdlg::startConnectTCPCtrl()
{
if(!connectFlag[4])
{
connectFlag[4] = true;
}
}
//停止TCP控制通信
void GDDCdlg::stopConnectTCPCtrl()
{
if(connectFlag[4])
{
connectFlag[4] = false;
}
}
//设置页面弹出
void GDDCdlg::on_pushButtonSet_clicked()
{
m_DlgGDDCSet->show();
}
//udp数据接收
void GDDCdlg::UDPMessageReceive()
{
QByteArray data;
data.resize(udpSocket->pendingDatagramSize());
QHostAddress addr;
quint16 port;
udpSocket->readDatagram(data.data(),data.size(),&addr,&port);
//const char* chardata= data.constData();
qDebug()<<data.data();
} }
//关闭视频 //控制页面隐藏与显示
void GDDCdlg::on_Video_BtnClosed_clicked() void GDDCdlg::on_pushButShowCmdArea_clicked()
{ {
if(Is_openVideo) if(isCmdAreaShow)
{ {
Is_openVideo = false ; ui->tabWidget->setVisible(false);
ui->WgtffmpegVideo->m_PlayStatus =Is_openVideo; isCmdAreaShow = false;
ui->WgtffmpegVideo->stop(); resizeUI();
ui->pushButShowCmdArea->setIcon(QIcon(":/res/up.png"));
//ui->pushButton->setGeometry(this->width()/2,this->height()-50,50,50);
} }
else
{
ui->tabWidget->setVisible(true);
isCmdAreaShow = true;
resizeUI();
ui->pushButShowCmdArea->setIcon(QIcon(":/res/down.png"));
//ui->pushButton->setGeometry(this->width()/2,ui->tabWidget->height(),50,50);
}
} }

@ -13,6 +13,10 @@
#include <string> #include <string>
#include "cffmpeg_decode.h" #include "cffmpeg_decode.h"
#include "Src/GDDC/gddcSet.h"
#include <vector>
#define cmdLength 44 #define cmdLength 44
namespace Ui { namespace Ui {
class GDDCdlg; class GDDCdlg;
@ -31,9 +35,11 @@ private:
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
public slots: public:
void GDDCControlTimeOut(); void initWindow(); //初始化窗口
void initParam(); //初始化参数
void initSignalSlot(); //初始化信号与槽
void resizeUI(); //重新设置布局
public: public:
QByteArray m_DCcmdBuffer;//存储吊舱控制指令 QByteArray m_DCcmdBuffer;//存储吊舱控制指令
std::byte TJDCCmdBuffer[10]; std::byte TJDCCmdBuffer[10];
@ -43,21 +49,29 @@ public:
void sendCurDate(std::byte *,int);//发送当前数据:内容,发送次数 void sendCurDate(std::byte *,int);//发送当前数据:内容,发送次数
//socket对象 //socket对象
QUdpSocket *udpSocket; QUdpSocket *udpSocket;
QString RemoteIP; //目标IP // QString RemoteIP; //目标IP
QHostAddress RemoteAddr; //目标地址 // QHostAddress RemoteAddr; //目标地址
quint16 RemotePort; //目标port // quint16 RemotePort; //目标port
QString localIP; //本地IP QString localIP; //本地IP
QHostAddress localAddr; //本地地址 QHostAddress localAddr; //本地地址
quint16 localPort; //本地port quint16 localPort; //本地port
void initUDPSocket(); //初始化UDPSocket GDDCSet *m_DlgGDDCSet; //光电吊舱设置对话框
void initWindow(); //初始化窗口
void initParam(); //初始化参数
//bool eventFilter(QObject *,QEvent *); //事件过滤器 //bool eventFilter(QObject *,QEvent *); //事件过滤器
void mousePressEvent(QMouseEvent *event); //事件过滤器 void mousePressEvent(QMouseEvent *event); //事件过滤器
void mouseMoveEvent(QMouseEvent *event); //事件过滤器 void mouseMoveEvent(QMouseEvent *event); //事件过滤器
void startConnectURL1();
void stopConnectURL1();
void startConnectURL2();
void stopConnectURL2();
void startConnectSerialCtrl();
void stopConnectSerialCtrl();
void startConnectUDPCtrl();
void stopConnectUDPCtrl();
void startConnectTCPCtrl();
void stopConnectTCPCtrl();
public: public:
bool pointSelectionTracking = false; //选点跟踪 bool pointSelectionTracking = false; //选点跟踪
bool param_pushButton_3_9; bool param_pushButton_3_9;
@ -65,7 +79,14 @@ public:
bool paramIsFrame; //是否是框架/陀螺校准 bool paramIsFrame; //是否是框架/陀螺校准
bool detectionAreaSetting;//检测区域设置 bool detectionAreaSetting;//检测区域设置
bool Is_openVideo =false;//视频是否已打开,默认未打开 bool Is_openVideo = false;//视频是否已打开,默认未打开
std::vector<bool> connectFlag; // 0视频流11视频流22串口通信3网口通信
bool isCmdAreaShow = true;//控制区域是否显示
public slots:
void GDDCControlTimeOut();
void startConnect(int); //开始连接
void stopConnect(int); //停止连接
void UDPMessageReceive(); //udp数据接收
private slots: private slots:
/*系统控制*/ /*系统控制*/
void on_pushButton_11_pressed(); void on_pushButton_11_pressed();
@ -243,8 +264,8 @@ private slots:
void on_pushButton_6_7_released(); void on_pushButton_6_7_released();
void on_pushButton_6_8_clicked(); void on_pushButton_6_8_clicked();
void on_Video_Btnplay_clicked(); void on_pushButtonSet_clicked();
void on_Video_BtnClosed_clicked(); void on_pushButShowCmdArea_clicked();
}; };
#endif // GDDCDLG_H #endif // GDDCDLG_H

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1165</width> <width>1399</width>
<height>759</height> <height>683</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -46,15 +46,106 @@
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
<widget class="ffmpegvideoDlg" name="WgtffmpegVideo" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>35</x>
<y>53</y>
<width>381</width>
<height>187</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>192</width>
<height>108</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1920</width>
<height>1080</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>200</width>
<height>100</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(85, 85, 127);</string>
</property>
</widget>
<widget class="QPushButton" name="pushButShowCmdArea">
<property name="geometry">
<rect>
<x>530</x>
<y>300</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="pushButtonSet">
<property name="geometry">
<rect>
<x>1000</x>
<y>10</y>
<width>81</width>
<height>36</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../mainwindow.qrc">
<normaloff>:/res/settings.png</normaloff>:/res/settings.png</iconset>
</property>
<property name="iconSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
</widget>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>7</x> <x>10</x>
<y>496</y> <y>350</y>
<width>1131</width> <width>1201</width>
<height>250</height> <height>250</height>
</rect> </rect>
</property> </property>
@ -367,55 +458,6 @@
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QLabel" name="label_Url">
<property name="geometry">
<rect>
<x>680</x>
<y>80</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>视频流地址</string>
</property>
</widget>
<widget class="QLineEdit" name="lineUrl">
<property name="geometry">
<rect>
<x>680</x>
<y>110</y>
<width>421</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="Video_Btnplay">
<property name="geometry">
<rect>
<x>700</x>
<y>150</y>
<width>92</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>打开视频</string>
</property>
</widget>
<widget class="QPushButton" name="Video_BtnClosed">
<property name="geometry">
<rect>
<x>960</x>
<y>160</y>
<width>92</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>关闭视频</string>
</property>
</widget>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tab_2">
<attribute name="title"> <attribute name="title">
@ -994,7 +1036,7 @@
<string>透雾模式设置</string> <string>透雾模式设置</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
<widget class="QComboBox" name="comboBox_3_1"> <widget class="QComboBox" name="comboBox_3_1">
<property name="geometry"> <property name="geometry">
@ -1730,8 +1772,8 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
<rect> <rect>
<x>10</x> <x>10</x>
<y>40</y> <y>40</y>
<width>53</width> <width>41</width>
<height>15</height> <height>16</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
@ -1743,8 +1785,8 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
<rect> <rect>
<x>10</x> <x>10</x>
<y>80</y> <y>80</y>
<width>53</width> <width>41</width>
<height>15</height> <height>16</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
@ -1875,31 +1917,6 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QPushButton" name="pushButton_5_10">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>780</x>
<y>120</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_5_2"> <widget class="QRadioButton" name="radioButton_5_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -2008,7 +2025,7 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
<rect> <rect>
<x>380</x> <x>380</x>
<y>10</y> <y>10</y>
<width>231</width> <width>241</width>
<height>201</height> <height>201</height>
</rect> </rect>
</property> </property>
@ -2018,7 +2035,7 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
<widget class="QPushButton" name="pushButton_6_6"> <widget class="QPushButton" name="pushButton_6_6">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>70</x> <x>80</x>
<y>150</y> <y>150</y>
<width>100</width> <width>100</width>
<height>30</height> <height>30</height>
@ -2034,7 +2051,7 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
<widget class="QComboBox" name="comboBox_6_2"> <widget class="QComboBox" name="comboBox_6_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>130</x> <x>140</x>
<y>50</y> <y>50</y>
<width>91</width> <width>91</width>
<height>21</height> <height>21</height>
@ -2044,7 +2061,7 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
<widget class="QComboBox" name="comboBox_6_3"> <widget class="QComboBox" name="comboBox_6_3">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>130</x> <x>140</x>
<y>90</y> <y>90</y>
<width>91</width> <width>91</width>
<height>21</height> <height>21</height>
@ -2081,7 +2098,7 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
<widget class="QGroupBox" name="groupBox_12"> <widget class="QGroupBox" name="groupBox_12">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>630</x> <x>640</x>
<y>10</y> <y>10</y>
<width>221</width> <width>221</width>
<height>201</height> <height>201</height>
@ -2185,7 +2202,7 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
<string>AI跟踪</string> <string>AI跟踪</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
<widget class="QPushButton" name="pushButton_6_5"> <widget class="QPushButton" name="pushButton_6_5">
<property name="geometry"> <property name="geometry">
@ -2218,7 +2235,7 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
<rect> <rect>
<x>12</x> <x>12</x>
<y>50</y> <y>50</y>
<width>101</width> <width>81</width>
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
@ -2231,7 +2248,7 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
<rect> <rect>
<x>10</x> <x>10</x>
<y>100</y> <y>100</y>
<width>91</width> <width>81</width>
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
@ -2252,61 +2269,6 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
</widget> </widget>
</widget> </widget>
</widget> </widget>
<widget class="ffmpegvideoDlg" name="WgtffmpegVideo" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>50</x>
<y>37</y>
<width>601</width>
<height>331</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>192</width>
<height>108</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1920</width>
<height>1080</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>200</width>
<height>100</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(85, 85, 127);</string>
</property>
</widget>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
@ -2316,6 +2278,8 @@ font: 12pt &quot;Microsoft YaHei UI&quot;;</string>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources>
<include location="../../mainwindow.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

@ -0,0 +1,49 @@
#ifndef STRUCTDEFINEMYSLEF_H
#define STRUCTDEFINEMYSLEF_H
#endif // STRUCTDEFINEMYSLEF_H
#include <QString>
#include <QHostAddress>
struct MyPairNetwork
{
public:
MyPairNetwork(){};
MyPairNetwork(QString a,int b,QString c,int d){
localIP = a;
localPort = b;
remoteIP = c;
remotePort = d;
localAddr.setAddress(localIP);
remoteAddr.setAddress(remoteIP);
}
private:
QString localIP;
quint16 localPort;
QHostAddress localAddr;
QString remoteIP;
quint16 remotePort;
QHostAddress remoteAddr;
public:
void setLocalIP(QString ip){
localIP = ip;
localAddr.setAddress(localIP);
}
void setLocalPort(quint16 port){
localPort = port;
}
void setRemoteIP(QString ip){
remoteIP = ip;
remoteAddr.setAddress(remoteIP);
}
void setRemotePort(quint16 port){
remotePort = port;
}
QString getLocalIP(){return localIP;}
quint16 getLocalPort(){return localPort;}
QHostAddress getLocalAddr(){return localAddr;}
QString getRemoteIP(){return remoteIP;}
quint16 getRemotePort(){return remotePort;}
QHostAddress getRemoteAddr(){return remoteAddr;}
};

@ -1,6 +1,19 @@
[光电吊舱] [光电吊舱-网络控制]
远端ip=192.168.1.160 本地ip=192.168.1.110
远端端口=10000 本地端口=10000
本地ip=192.168.1.121 远端p=192.168.1.111
本地端口=10000 远端端口=10000
[GDDC-NetControl]
localIP=123
localPort=-1
[鍏夌數鍚婅埍-缃戠粶鎺у埗]
<EFBFBD>湴IP=172.10.1.183
<EFBFBD>湴Port=10001
<EFBFBD>湴绔<EFBFBD>=10008
杩滅<EFBFBD>ip=172.10.1.183
杩滅<EFBFBD>Port=10002
[鍏夌數鍚婅埍-瑙嗛<E79199>杩炴帴-鏄剧ず绐楀彛2]
<EFBFBD>斁URL=rtmp://liteavapp.qcloud.com/live/liteavdemoplayerstreamid
<EFBFBD>斁Port=10003
[鍏夌數鍚婅埍-瑙嗛<E79199>杩炴帴-鏄剧ず绐楀彛1]
<EFBFBD>斁Port=123

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1510</width> <width>1441</width>
<height>989</height> <height>434</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HomePageDlg</class>
<widget class="QWidget" name="HomePageDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1510</width>
<height>989</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<property name="styleSheet">
<string notr="true">background-image: url(:/res/981csP.png);
background-repeat: no-repeat;
background-position: center;
background-attachment: fixed;
background-size: cover;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

@ -25,31 +25,11 @@ MainWindow::MainWindow(QWidget *parent)
process = new QProcess(this); process = new QProcess(this);
// connect(ui->toolbar_action1,&QAction::triggered,this,[this](){
// qDebug("1111");
// //m_GDDCdlg->setWindowModality(Qt::ApplicationModal); //设置模态窗口,即窗口没关闭不允许其他操作
// m_HomePagedlg->move(200,200);
// m_HomePagedlg->show(); //显示窗口
// m_GDDCdlg->hide();
// });
// connect(ui->toolbar_action2,&QAction::triggered,this,[this](){
// qDebug("2222");
// //m_GDDCdlg->setWindowModality(Qt::ApplicationModal); //设置模态窗口,即窗口没关闭不允许其他操作
// m_GDDCdlg->move(200,200);
// m_GDDCdlg->show(); //显示窗口
// m_HomePagedlg->hide();
// });
// QFile file(":/qss/style.qss");
// file.open(QIODevice::ReadOnly);
// QString stylesheet = QLatin1String(file.readAll());
// file.colse();
// qApp->setStyleSheet(stylesheet);
//apply the qss //apply the qss
QFile file(":/res/Qss/qss.qss"); QFile file(":/res/Qss/qss.qss");
if(file.open(QFile::ReadOnly)) if(file.open(QFile::ReadOnly))
{ {
file.open(QFile::ReadOnly); //file.open(QFile::ReadOnly);
QString style = QLatin1String(file.readAll()); QString style = QLatin1String(file.readAll());
qApp->setStyleSheet(style); qApp->setStyleSheet(style);

@ -2,7 +2,7 @@
#define MAINWINDOW_H #define MAINWINDOW_H
#include <QMainWindow> #include <QMainWindow>
#include "gddcdlg.h" #include "Src/GDDC/gddcdlg.h"
#include "homepagedlg.h" #include "homepagedlg.h"
#include <QPushButton> #include <QPushButton>

@ -12,5 +12,8 @@
<file>res/WIFI.png</file> <file>res/WIFI.png</file>
<file>res/wifi4G.png</file> <file>res/wifi4G.png</file>
<file>res/981csP.png</file> <file>res/981csP.png</file>
<file>res/settings.png</file>
<file>res/down.png</file>
<file>res/up.png</file>
</qresource> </qresource>
</RCC> </RCC>

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1286</width> <width>884</width>
<height>761</height> <height>462</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -42,10 +42,7 @@
<enum>Qt::NoContextMenu</enum> <enum>Qt::NoContextMenu</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="2"> <item row="2" column="0">
<layout class="QVBoxLayout" name="SubPage"/>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
@ -347,20 +344,23 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="2"> <item row="3" column="2">
<layout class="QHBoxLayout" name="horizontalLayout"> <spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<spacer name="horizontalSpacer"> <layout class="QVBoxLayout" name="SubPage"/>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</item> </item>
@ -377,8 +377,8 @@ color:rgb(20,200,200);</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1286</width> <width>884</width>
<height>25</height> <height>20</height>
</rect> </rect>
</property> </property>
</widget> </widget>

@ -1,3 +1,9 @@
/************************QWidget窗体设置****************************/
QWidget{
background-color: rgb(50, 50, 50);
}
/************************QPushButton按钮设置****************************/
/*hover样式*/ /*hover样式*/
QPushButton:hover{ QPushButton:hover{
background-color: rgb(155,155,155); background-color: rgb(155,155,155);
@ -12,16 +18,84 @@ QPushButton{
border-radius: 2px; border-radius: 2px;
border: 1px groove gray; border: 1px groove gray;
border-style: outset; border-style: outset;
font: 12pt "Microsoft YaHei UI"; font: 12pt "Microsoft YaHei";
}
QGroupBox{
color:rgb(153,255,153);
font-family:Consolas;
font-size:12pt;
} }
/**************************QLineEdit编辑框设置*************************/
QLineEdit{
color:rgb(255,255,255);
border-radius: 2px;
border: 1px groove gray;
border-style: outset;
font: 12pt "Microsoft YaHei";
}
/*设置TabWidget中tab_1的样式*/ /***************************QComboBox下拉框设置************************/
QComboBox
{
border-radius:3px;
background-color:rgba(60,60,60,200);
font: 75 11pt "Microsoft YaHei";
color:rgb(255,255,255);
border:0px ;
padding-top: 2px;
padding-left: 2px;
border-width: 0.5px;
border-style: solid;
border-color: rgb(255,255,255);
}
QComboBox:disabled
{
background-color:rgba(50,50,50,200);
font: 75 11pt "Microsoft YaHei";
color:rgb(160,160,160);
}
QComboBox:hover
{
background-color:rgba(45,45,45,200);
border:1px solid rgb(31,156,220) ;
}
/*点击combox的样式*/
QComboBox:on
{
border-radius:3px;
background-color:rgba(35,35,35);
font: 75 11pt "Microsoft YaHei";
color:rgb(255,255,255);
border:1px solid rgb(31,156,220) ;
}
/*下拉框的样式*/
QComboBox QAbstractItemView
{
outline: 0px solid gray; /*取消选中虚线*/
border: 1px solid rgb(31,156,220);
font: 75 11pt "Microsoft YaHei";
color: rgb(255,255,255);
background-color: rgb(45,45,45);
selection-background-color: rgb(90,90,90);
}
/*选中每一项高度*/
QComboBox QAbstractItemView::item
{
height: 25px;
}
/*选中每一项的字体颜色和背景颜色*/
QComboBox QAbstractItemView::item:selected
{
color: rgb(31,163,246);
background-color: rgb(90,90,90);
}
/**********************设置TabWidget中的样式*****************/
TabWidget::tab
{
border:1px solid rgb(31,156,220);
}
TabWidget::pane
{
border-top:3px;
/*border:none;*/
}
/**********************设置TabWidget中tab_x的样式*****************/
#tab_1.QWidget{ #tab_1.QWidget{
background-color: rgb(50, 50, 50); background-color: rgb(50, 50, 50);
} }
@ -41,7 +115,7 @@ QGroupBox{
background-color: rgb(50, 50, 50); background-color: rgb(50, 50, 50);
} }
/*设置TabWidget中QTabBar的样式*/ /************************QTabBar设置************************/
QTabBar::tab{ QTabBar::tab{
background-color: #0B0E11; background-color: #0B0E11;
font-family:Consolas; /*设置tab中的文本的字体*/ font-family:Consolas; /*设置tab中的文本的字体*/
@ -53,46 +127,72 @@ QTabBar::tab{
padding: 5px; padding: 5px;
background-color: rgb(50, 50, 50); background-color: rgb(50, 50, 50);
} }
/*设置TabWidget中QTabBar的tab被选中时的样式*/ /*设置TabWidget中QTabBar的tab被选中时的样式*/
QTabBar::tab:selected{ QTabBar::tab:selected{
background-color: rgb(204, 229, 255); background-color: rgb(204, 229, 255);
color: rgb(50, 50, 50); color: rgb(50, 50, 50);
} }
/*设置TabWidget中鼠标悬浮在QTabBar的tab上但未选中该Tab的样式*/ /*设置TabWidget中鼠标悬浮在QTabBar的tab上但未选中该Tab的样式*/
QTabBar::tab:hover:!selected { QTabBar::tab:hover:!selected {
background-color: rgb(224, 224, 224); background-color: rgb(224, 224, 224);
color: rgb(50, 50, 50); color: rgb(50, 50, 50);
} }
/*设置TabWidget的边框的样式*/ /*设置TabWidget的边框的样式*/
QTabWidget::pane { QTabWidget::pane {
border: 1px solid rgb(108, 117, 125); border: 1px solid rgb(108, 117, 125);
} }
/*当打开多个tab右侧出现点击后可以向前向后的按钮的样式*/ /*当打开多个tab右侧出现点击后可以向前向后的按钮的样式*/
QTabBar QToolButton { QTabBar QToolButton {
border: none; border: none;
color: rgb(255, 206, 6); color: rgb(255, 206, 6);
background-color: #0b0e11; background-color: #0b0e11;
} }
QTabBar QToolButton:hover { QTabBar QToolButton:hover {
background-color: rgb(50, 50, 50); background-color: rgb(50, 50, 50);
} }
/****************************QLabel设置************************/
/*QLabel设置*/
QLabel{ QLabel{
color: rgb(255, 255, 255); color: rgb(255, 255, 255);
font-family:Consolas; font-family:Consolas;
font-size:11pt; font-size:11pt;
} }
/***************************QSpinBox设置***********************/
QComboBox{ QSpinBox{
color: rgb(0, 0, 0); border-radius:1px;
background-color: rgb(250, 250, 250); background-color:rgba(60,60,60,200);
border-color:rgb(255, 255, 255);/*边框颜色*/ font: 12pt "Microsoft YaHei";
color:rgb(255,255,255);
border-width: 0.5px;
border-style: solid;
border-color: rgb(255,255,255);
}
/***************************QGroupBox设置***********************/
QGroupBox{
border:1px solid rgb(255,255,255);
border-radius:5px;
margin-top:2ex;/*文字在方框中位置的偏离度*/
color:rgb(153,255,153);
font-family:Consolas;
font-size:12pt;
/*font:bold 12px;*/
}
QGroupBox::title
{
subcontrol-origin:margin;
subcontrol-position:top center;
right:5px;
left:0px;
padding:0 1px 0 1px;
}
/***************************QRadioButton设置***********************/
QRadioButton{
color: rgb(255, 255, 255);
font-family:Consolas;
font-size:11pt; font-size:11pt;
} }
/***************************QFrame***********************/
QFrame#frameGDDCPage
{
border:1px solid rgb(0,255,0);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.
Loading…
Cancel
Save