From 5ff339f86a436b8412f7f2f44a01748b3feca671 Mon Sep 17 00:00:00 2001 From: cbwu <504-wuchengbo@htsdfp.com> Date: Mon, 11 Nov 2024 18:56:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=8E=A8=E6=B5=81?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E7=94=9F=E6=88=90=E4=BA=A4=E4=BA=92=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PayloadAPP.pro | 2 +- Src/GDDC/gddcSet.cpp | 76 +++++++++++++++++++++++++++++++++++++------- Src/GDDC/gddcSet.h | 6 +++- Src/GDDC/gddcSet.ui | 21 +++++++++++- global.cpp | 39 +++++++++++++++++++---- global.h | 21 +++++++++--- res/Qss/qss.qss | 11 +++++++ 7 files changed, 151 insertions(+), 25 deletions(-) diff --git a/PayloadAPP.pro b/PayloadAPP.pro index cd6288f..225f98a 100644 --- a/PayloadAPP.pro +++ b/PayloadAPP.pro @@ -14,7 +14,7 @@ QMAKE_PROJECT_DEPTH = 0 # QMAKE_LFLAGS += /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\" #程序版本 -VERSION = 1.0.2.1 +VERSION = 1.0.2.2 #程序版本 QMAKE_TARGET_COMPANY = "HTSDFP" diff --git a/Src/GDDC/gddcSet.cpp b/Src/GDDC/gddcSet.cpp index 08f73ae..c70f50e 100644 --- a/Src/GDDC/gddcSet.cpp +++ b/Src/GDDC/gddcSet.cpp @@ -50,8 +50,10 @@ void GDDCSet::initParam() { ui->comboBox_streamSource->addItem("载荷端"); ui->comboBox_streamSource->setCurrentIndex(0); - ui->comboBox_pushURL->addItem(QStringLiteral("-1")); - ui->comboBox_pushURL->addItem(QStringLiteral("-1")); + // 应急厅指挥平台----->push.uavideo.cn + ui->comboBox_pushURL->addItem(QStringLiteral("应急厅指挥平台")); + // 应急厅铁塔平台----->182.92.130.23 + ui->comboBox_pushURL->addItem(QStringLiteral("应急厅铁塔平台")); ui->radioButton_NetCtrlUDP->setChecked(true); ui->radioButton_NetCtrlTCP->setChecked(false); @@ -223,7 +225,24 @@ void GDDCSet::saveDataToLocalIni() { // inBuf, // strSysIniName); - m_pushURL = ui->comboBox_pushURL->currentText(); + int uavID = ui->uavIDSpinBox->value(); + if (ui->radioButton->isChecked()) { + m_pushURL = ui->comboBox_pushURL->currentText(); + } else { + if (ui->comboBox_pushURL->currentIndex() == 0) { + auto iter = mapPushURL_yjzh.find(uavID); + if (iter != mapPushURL_yjzh.end()) { + m_pushURL = iter->second; + } + } else if (ui->comboBox_pushURL->currentIndex() == 1) { + auto iter = mapPushURL_yjtt.find(uavID); + if (iter != mapPushURL_yjtt.end()) { + m_pushURL = iter->second; + } + } + } + qDebug() << "推流地址:" << m_pushURL; + // m_pushURL = ui->comboBox_pushURL->currentText(); ba = m_pushURL.toLocal8Bit(); inBuf = ba.data(); ::WritePrivateProfileStringA("光电吊舱-推流", "推流URL", inBuf, @@ -296,14 +315,28 @@ void GDDCSet::on_uavIDSpinBox_valueChanged(int arg1) { if ("地面端" == streamSource) { QString pushURL = generatePushURL(uavID, QString::fromStdString(iter->second)); + mapPushURL_yjzh[uavID] = pushURL; // 应急厅指挥平台 + qDebug() << pushURL; + QString pushURL2 = generatePushURL2(uavID, QString::fromStdString(iter->second)); - ui->comboBox_pushURL->setItemText(0, pushURL); - ui->comboBox_pushURL->setItemText(1, pushURL2); + mapPushURL_yjtt[uavID] = pushURL2; // 应急厅铁塔平台 + qDebug() << pushURL2; + + // ui->comboBox_pushURL->setItemText(0, pushURL); + // ui->comboBox_pushURL->setItemText(1, pushURL2); } else { - QString pullURL = - generatePullURL(uavID, QString::fromStdString(iter->second)); - ui->comboBox_playURL1->setItemText(0, pullURL); + if (!ui->radioButton->isChecked()) { + if (ui->comboBox_pushURL->currentIndex() == 0) { + QString pullURL = + generatePullURL(uavID, QString::fromStdString(iter->second)); + ui->comboBox_playURL1->setItemText(0, pullURL); + } else if (ui->comboBox_pushURL->currentIndex() == 1) { + QString pullURL = + generatePullURL2(uavID, QString::fromStdString(iter->second)); + ui->comboBox_playURL1->setItemText(0, pullURL); + } + } } } else { } @@ -319,9 +352,30 @@ void GDDCSet::on_comboBox_streamSource_currentIndexChanged(int index) { int uavID = ui->uavIDSpinBox->value(); auto iter = g_mapAppName.find(uavID); if (iter != g_mapAppName.end()) { - QString pullURL = - generatePullURL(uavID, QString::fromStdString(iter->second)); - ui->comboBox_playURL1->setItemText(0, pullURL); + // QString pullURL = + // generatePullURL(uavID, QString::fromStdString(iter->second)); + // ui->comboBox_playURL1->setItemText(0, pullURL); + if (!ui->radioButton->isChecked()) { + if (ui->comboBox_pushURL->currentIndex() == 0) { + QString pullURL = + generatePullURL(uavID, QString::fromStdString(iter->second)); + ui->comboBox_playURL1->setItemText(0, pullURL); + } else if (ui->comboBox_pushURL->currentIndex() == 1) { + QString pullURL = + generatePullURL2(uavID, QString::fromStdString(iter->second)); + ui->comboBox_playURL1->setItemText(0, pullURL); + } + } } } } + +void GDDCSet::on_radioButton_clicked() { + if (ui->radioButton->isChecked()) { + ui->comboBox_pushURL->setEditable(true); + ui->uavIDSpinBox->setEnabled(false); + } else { + ui->comboBox_pushURL->setEditable(false); + ui->uavIDSpinBox->setEnabled(true); + } +} diff --git a/Src/GDDC/gddcSet.h b/Src/GDDC/gddcSet.h index 32cd274..5022e2a 100644 --- a/Src/GDDC/gddcSet.h +++ b/Src/GDDC/gddcSet.h @@ -6,8 +6,8 @@ #include #include #include +#include #include - namespace Ui { class GDDCSet; } @@ -22,6 +22,9 @@ public: private: Ui::GDDCSet *ui; + std::map mapPushURL_yjzh; + std::map mapPushURL_yjtt; + public: void initUDPSocket(); // 初始化UDPSocket void initWindow(); // 初始化窗口 @@ -64,6 +67,7 @@ private slots: // void on_comboBox_streamType_currentIndexChanged(int index); void on_uavIDSpinBox_valueChanged(int arg1); void on_comboBox_streamSource_currentIndexChanged(int index); + void on_radioButton_clicked(); }; #endif // GDDCSET_H diff --git a/Src/GDDC/gddcSet.ui b/Src/GDDC/gddcSet.ui index 06b2d4e..d6c4ea0 100644 --- a/Src/GDDC/gddcSet.ui +++ b/Src/GDDC/gddcSet.ui @@ -247,10 +247,29 @@ 80 100 - 421 + 321 23 + + false + + + + + + 410 + 100 + 101 + 25 + + + + + + + 自定义推流 + diff --git a/global.cpp b/global.cpp index 196ab29..7b5f66b 100644 --- a/global.cpp +++ b/global.cpp @@ -2,7 +2,7 @@ global::global() {} -QString g_SoftwareVersion = "版本号:V1.0.2.1_20241106"; +QString g_SoftwareVersion = "版本号:V1.0.2.2_20241111"; QColor g_themeColor(51, 51, 51); QString g_PushBtnStyle = /**正常情况下样式**/ @@ -176,9 +176,9 @@ QString calculateMD5(const QString &str) { * @param expireTime: 过期时间(单位是秒),默认1h。 * @return 返回推流地址 */ -QString generatePushURL(int uavID, QString appName, QString uavName, - int clientID, QString pushDomain, long expireTime, - QString pushKey) { +QString generatePushURL(int uavID, QString appName, QString pushKey, + QString uavName, int clientID, QString pushDomain, + long expireTime) { QString clientName = ""; if (0 == clientID) { clientName = "gcs"; // 地面端 @@ -215,9 +215,9 @@ std::map g_mapAppName; * @param pullKey: 拉流域名配置的鉴权Key * @return 返回拉流地址 */ -QString generatePullURL(int uavID, QString appName, QString uavName, - int clientID, QString pullDomain, long expireTime, - QString pullKey) { +QString generatePullURL(int uavID, QString appName, QString pullKey, + QString uavName, int clientID, QString pullDomain, + long expireTime) { QString rtmpUrl = ""; QString clientName = ""; if (0 == clientID) { @@ -275,3 +275,28 @@ QString generatePushURL2(int uavID, QString appName, QString uavName, rtmpUrl = "rtmp://" + pushDomain + "/" + appName + "/" + streamName; return rtmpUrl; } + +/** + * @brief 生成拉流地址,应急厅铁塔平台 + * @param uavID: 飞控ID + * @param appName: app名称 + * @param uavName: 飞机型号,默认981cs + * @param clientID: 数据推流端ID,0为地面端,1为载荷端。 + * @param pullDomain: 拉流域名 + * @return 返回拉流地址 + */ +QString generatePullURL2(int uavID, QString appName, QString uavName, + int clientID, QString pullDomain) { + QString clientName = ""; + if (0 == clientID) { + clientName = "gcs"; // 地面端 + } else { + clientName = "uav"; // 载荷端 + } + QString streamName = + uavName + "_" + QString::number(uavID) + "_" + clientName; + QString pushURL = ""; + pushURL = "rtsp://" + pullDomain + "/" + appName + "/" + streamName; + + return pushURL; +} diff --git a/global.h b/global.h index 3c92f37..381929a 100644 --- a/global.h +++ b/global.h @@ -45,10 +45,10 @@ extern QString calculateMD5(const QString &str); * @return 返回推流地址 */ extern QString generatePushURL(int uavID, QString appName = "nmyj", + QString pushKey = "ZRjGVcPYGhKib0rdgH", QString uavName = "981cs", int clientID = 0, QString pushDomain = "push.uavideo.cn", - long expireTime = 6 * 3600, - QString pushKey = "ZRjGVcPYGhKib0rdgH"); + long expireTime = 6 * 3600); /** * @brief 生成公司推流平台地址 @@ -75,10 +75,23 @@ extern QString generatePushURL2(int uavID, QString appName = "nmyj", * @return 返回拉流地址 */ extern QString generatePullURL(int uavID, QString appName = "nmyj", + QString pullKey = "HDaMVkLnIcr0mGhV8d", QString uavName = "981cs", int clientID = 0, QString pullDomain = "play.uavideo.cn", - long expireTime = 6 * 3600, - QString pullKey = "HDaMVkLnIcr0mGhV8d"); + long expireTime = 6 * 3600); + +/** + * @brief 生成拉流地址,应急厅铁塔平台 + * @param uavID: 飞控ID + * @param appName: app名称 + * @param uavName: 飞机型号,默认981cs + * @param clientID: 数据推流端ID,0为地面端,1为载荷端。 + * @param pullDomain: 拉流域名 + * @return 返回拉流地址 + */ +extern QString generatePullURL2(int uavID, QString appName = "nmyj", + QString uavName = "981cs", int clientID = 0, + QString pullDomain = "182.92.130.23"); extern std::map g_mapAppName; diff --git a/res/Qss/qss.qss b/res/Qss/qss.qss index 575c8ae..af2ee69 100644 --- a/res/Qss/qss.qss +++ b/res/Qss/qss.qss @@ -191,6 +191,17 @@ QRadioButton{ font-family:"微软雅黑"; font-size:10pt; } +QRadioButton::indicator { + width: 12px; + height: 12px; + border-radius: 7px; /* 让其看起来更圆 */ + border: 1px solid #5A5A5A; /* 边框颜色 */ +} +/* 如果没有合适的图片,可以使用伪元素模拟 */ +QRadioButton::indicator:checked::enabled { + background-color: rgb(27,217,40); + image: none; /* 移除图片,使用纯色 */ +} /***************************QFrame***********************/ QFrame#frameGDDCPage {