1. 增加猫眼镜头切换IRCUT; 2. 优化连续多次打开视频获取视频流导致的内存问题
This commit is contained in:
parent
09c5843358
commit
15eb213578
|
@ -134,7 +134,6 @@
|
||||||
<QtMoc Include="SourceCode\Network\mdns\qmdnsengine\src\server_p.h" />
|
<QtMoc Include="SourceCode\Network\mdns\qmdnsengine\src\server_p.h" />
|
||||||
<ClInclude Include="SourceCode\Network\mdns\qmdnsengine\src\service_p.h" />
|
<ClInclude Include="SourceCode\Network\mdns\qmdnsengine\src\service_p.h" />
|
||||||
<ClInclude Include="SourceCode\RecvDataHandler\MsgTpye.h" />
|
<ClInclude Include="SourceCode\RecvDataHandler\MsgTpye.h" />
|
||||||
<QtMoc Include="SourceCode\Widget\FocusWindow.h" />
|
|
||||||
<QtMoc Include="SourceCode\Media\VideoDecoder\FFmpegDecoder.h" />
|
<QtMoc Include="SourceCode\Media\VideoDecoder\FFmpegDecoder.h" />
|
||||||
<ClInclude Include="SourceCode\Media\VideoDecoder\RingBuffer.h" />
|
<ClInclude Include="SourceCode\Media\VideoDecoder\RingBuffer.h" />
|
||||||
<QtMoc Include="SourceCode\Network\DelUserWindows.h" />
|
<QtMoc Include="SourceCode\Network\DelUserWindows.h" />
|
||||||
|
|
|
@ -94,9 +94,6 @@
|
||||||
<QtMoc Include="SourceCode\Media\VideoDecoder\FFmpegDecoder.h">
|
<QtMoc Include="SourceCode\Media\VideoDecoder\FFmpegDecoder.h">
|
||||||
<Filter>Media\VideoDecoder</Filter>
|
<Filter>Media\VideoDecoder</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="SourceCode\Widget\FocusWindow.h">
|
|
||||||
<Filter>Widget</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="SourceCode\Network\DelUserWindows.h">
|
<QtMoc Include="SourceCode\Network\DelUserWindows.h">
|
||||||
<Filter>Network</Filter>
|
<Filter>Network</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
|
|
@ -14,6 +14,7 @@ public:
|
||||||
explicit LicenseConfirmWindow(const QString& message, QWidget* parent = nullptr)
|
explicit LicenseConfirmWindow(const QString& message, QWidget* parent = nullptr)
|
||||||
{
|
{
|
||||||
messageLabel = new QLabel(message, this);
|
messageLabel = new QLabel(message, this);
|
||||||
|
messageLabel->setStyleSheet("QLabel { color : red; }");
|
||||||
confirmButton = new QPushButton("确认", this);
|
confirmButton = new QPushButton("确认", this);
|
||||||
cancelButton = new QPushButton("取消", this);
|
cancelButton = new QPushButton("取消", this);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ FFmpegDecoder::~FFmpegDecoder()
|
||||||
|
|
||||||
void FFmpegDecoder::processVideo(int itemIndex)
|
void FFmpegDecoder::processVideo(int itemIndex)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 1
|
||||||
int width = 720;
|
int width = 720;
|
||||||
int height = 1280;
|
int height = 1280;
|
||||||
#elif 1
|
#elif 1
|
||||||
|
@ -43,6 +43,7 @@ void FFmpegDecoder::processVideo(int itemIndex)
|
||||||
int width = 480;
|
int width = 480;
|
||||||
int height = 640;
|
int height = 640;
|
||||||
#endif
|
#endif
|
||||||
|
qDebug() << "------ processVideo";
|
||||||
if (width * 16 == height * 9) {
|
if (width * 16 == height * 9) {
|
||||||
FocusWindowDialog* dialog = new FocusWindowDialog(nullptr, QSize(540, 960));
|
FocusWindowDialog* dialog = new FocusWindowDialog(nullptr, QSize(540, 960));
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
|
@ -75,11 +76,12 @@ void FFmpegDecoder::stopFFmpegDecoder()
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FFmpegDecoder::decodeFile(const QString& filePath, QLabel* videoDisplayLabel)
|
void FFmpegDecoder::decodeFile(const QString& videoFilePath, QLabel* videoDisplayLabel, QLineEdit* VideoResolutionEdit)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mutex);
|
QMutexLocker locker(&mutex);
|
||||||
this->filePath = filePath;
|
this->filePath = videoFilePath;
|
||||||
this->videoLabel = videoDisplayLabel;
|
this->videoLabel = videoDisplayLabel;
|
||||||
|
this->resolutionEdit = VideoResolutionEdit;
|
||||||
if (!isRunning()) {
|
if (!isRunning()) {
|
||||||
qDebug() << "Starting decoder thread";
|
qDebug() << "Starting decoder thread";
|
||||||
start(NormalPriority);
|
start(NormalPriority);
|
||||||
|
@ -107,8 +109,8 @@ void FFmpegDecoder::run()
|
||||||
QSize labelSize = currentVideoLabel->size();
|
QSize labelSize = currentVideoLabel->size();
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
|
|
||||||
if (labelSize.width() < 740 || labelSize.height() < 357) {
|
if (labelSize.width() < 220 || labelSize.height() < 357) {
|
||||||
labelSize = QSize(740, 357);
|
labelSize = QSize(220, 357);
|
||||||
currentVideoLabel->setFixedSize(labelSize);
|
currentVideoLabel->setFixedSize(labelSize);
|
||||||
qDebug() << "Adjusting video label size to: Width =" << labelSize.width() << ", Height =" << labelSize.height();
|
qDebug() << "Adjusting video label size to: Width =" << labelSize.width() << ", Height =" << labelSize.height();
|
||||||
}
|
}
|
||||||
|
@ -275,7 +277,9 @@ QImage FFmpegDecoder::avFrameToQImage(AVFrame* frame)
|
||||||
{
|
{
|
||||||
int width = frame->width;
|
int width = frame->width;
|
||||||
int height = frame->height;
|
int height = frame->height;
|
||||||
qDebug() << "H264 video resolution: Width =" << frame->width << ", Height =" << frame->height;
|
QString resolutionText = QString::number(width) + " x " + QString::number(height);
|
||||||
|
resolutionEdit->setText(resolutionText);
|
||||||
|
//qDebug() << "H264 video resolution: Width =" << frame->width << ", Height =" << frame->height;
|
||||||
|
|
||||||
AVPixelFormat pixFmt = (AVPixelFormat)frame->format;
|
AVPixelFormat pixFmt = (AVPixelFormat)frame->format;
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QLineEdit>
|
||||||
|
|
||||||
#include "RingBuffer.h"
|
#include "RingBuffer.h"
|
||||||
#include "FocusWindow.h"
|
#include "FocusWindow.h"
|
||||||
|
@ -38,7 +39,7 @@ public:
|
||||||
~FFmpegDecoder() override;
|
~FFmpegDecoder() override;
|
||||||
|
|
||||||
void initialize();
|
void initialize();
|
||||||
void decodeFile(const QString& filePath, QLabel* videoLabel);
|
void decodeFile(const QString& videoFilePath, QLabel* videoLabel, QLineEdit* VideoResolutionEdit);
|
||||||
void decodeSingleFrame(const QByteArray& data, QLabel* videoLabel); // 添加 videoLabel 参数
|
void decodeSingleFrame(const QByteArray& data, QLabel* videoLabel); // 添加 videoLabel 参数
|
||||||
void FFmpegDecoder::processVideo(int itemIndex);
|
void FFmpegDecoder::processVideo(int itemIndex);
|
||||||
bool initializeFFmpeg(const QString& filePath);
|
bool initializeFFmpeg(const QString& filePath);
|
||||||
|
@ -55,6 +56,7 @@ private:
|
||||||
QWaitCondition condition;
|
QWaitCondition condition;
|
||||||
QString filePath;
|
QString filePath;
|
||||||
QLabel* videoLabel;
|
QLabel* videoLabel;
|
||||||
|
QLineEdit* resolutionEdit;
|
||||||
bool abort;
|
bool abort;
|
||||||
bool restart;
|
bool restart;
|
||||||
|
|
||||||
|
|
|
@ -201,16 +201,22 @@ void ClientHandler::sendGetDevInfoItem(int itemIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送取图按键
|
// 发送取图按键
|
||||||
void ClientHandler::sendGetPicItem(int itemIndex, int lastClickedGetVideoCamIndex)
|
void ClientHandler::sendGetPicItem(int itemIndex, int GetPicCamIndex)
|
||||||
{
|
{
|
||||||
sendJsonItem(getPicJson, itemIndex, QString::number(lastClickedGetVideoCamIndex), "getPic");
|
sendJsonItem(getPicJson, itemIndex, QString::number(GetPicCamIndex), "getPic");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送拉视频按键
|
// 发送拉视频按键
|
||||||
void ClientHandler::sendGetVideoItem(int itemIndex, int video_flag)
|
void ClientHandler::sendGetVideoItem(int itemIndex, int GetVideoCamIndex)
|
||||||
{
|
{
|
||||||
qDebug() << "sendGetVideoItem itemIndex:" << itemIndex;
|
qDebug() << "sendGetVideoItem itemIndex:" << itemIndex;
|
||||||
sendJsonItem(getVideoJson, itemIndex, "", "handleVideo");
|
qDebug() << "sendGetVideoItem GetVideoCamIndex:" << GetVideoCamIndex;
|
||||||
|
if(isBackBoardOrAllBoard) {
|
||||||
|
sendJsonItem(getVideoJson, itemIndex, QString::number(GetVideoCamIndex), "handleVideo");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendJsonItem(getVideoJson, itemIndex, "", "handleVideo");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送License处理按键
|
// 发送License处理按键
|
||||||
|
|
|
@ -52,9 +52,9 @@ public:
|
||||||
// 发送获取设备信息按键
|
// 发送获取设备信息按键
|
||||||
void sendGetDevInfoItem(int itemIndex);
|
void sendGetDevInfoItem(int itemIndex);
|
||||||
// 发送取图按键
|
// 发送取图按键
|
||||||
void sendGetPicItem(int itemIndex, int lastClickedGetVideoCamIndex);
|
void sendGetPicItem(int itemIndex, int GetPicCamIndex);
|
||||||
// 发送拉视频流按键
|
// 发送拉视频流按键
|
||||||
void sendGetVideoItem(int itemIndex, int video_flag);
|
void sendGetVideoItem(int itemIndex, int GetVideoCamIndex);
|
||||||
// 发送License处理按键
|
// 发送License处理按键
|
||||||
void sendLicenseItem(int itemIndex, const QString text);
|
void sendLicenseItem(int itemIndex, const QString text);
|
||||||
void sendUuidItem(int itemIndex, const QString text);
|
void sendUuidItem(int itemIndex, const QString text);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../Network/ClientHandler.h"
|
#include "../Network/ClientHandler.h"
|
||||||
|
|
||||||
DataHandler::DataHandler(QLabel* leftLens_imageLabel, QLabel* rightLens_imageLabel, QLabel* videoLabel,
|
DataHandler::DataHandler(QLabel* leftLens_imageLabel, QLabel* rightLens_imageLabel, QLabel* videoLabel,
|
||||||
|
QLineEdit* VideoResolutionEdit,
|
||||||
QTextEdit* licenseHwInfoEdit, QMap<QString, QLineEdit*>* devInfoLineEdits,
|
QTextEdit* licenseHwInfoEdit, QMap<QString, QLineEdit*>* devInfoLineEdits,
|
||||||
QJsonArray frontBoardOneClickTest, QJsonArray frontBoardTest, QJsonArray frontBoardFuncConfig,
|
QJsonArray frontBoardOneClickTest, QJsonArray frontBoardTest, QJsonArray frontBoardFuncConfig,
|
||||||
QJsonArray frontBoardDevInfoJson, QJsonArray frontBoardLicenseJson,
|
QJsonArray frontBoardDevInfoJson, QJsonArray frontBoardLicenseJson,
|
||||||
|
@ -13,6 +14,7 @@ DataHandler::DataHandler(QLabel* leftLens_imageLabel, QLabel* rightLens_imageLab
|
||||||
leftLens_m_imageLabel(leftLens_imageLabel),
|
leftLens_m_imageLabel(leftLens_imageLabel),
|
||||||
rightLens_m_imageLabel(rightLens_imageLabel),
|
rightLens_m_imageLabel(rightLens_imageLabel),
|
||||||
videoLabel(videoLabel),
|
videoLabel(videoLabel),
|
||||||
|
VideoResolutionEdit(VideoResolutionEdit),
|
||||||
licenseHwInfoEdit(licenseHwInfoEdit),
|
licenseHwInfoEdit(licenseHwInfoEdit),
|
||||||
devInfoLineEdits(devInfoLineEdits),
|
devInfoLineEdits(devInfoLineEdits),
|
||||||
frontBoardOneClickTest(frontBoardOneClickTest), frontBoardTest(frontBoardTest),
|
frontBoardOneClickTest(frontBoardOneClickTest), frontBoardTest(frontBoardTest),
|
||||||
|
@ -48,6 +50,7 @@ DataHandler::~DataHandler()
|
||||||
void DataHandler::handleOpenFocusWindow(int itemIndex)
|
void DataHandler::handleOpenFocusWindow(int itemIndex)
|
||||||
{
|
{
|
||||||
if (ffmpegDecoder) {
|
if (ffmpegDecoder) {
|
||||||
|
qDebug() << "------- handleOpenFocusWindow";
|
||||||
ffmpegDecoder->processVideo(itemIndex); // 调用 FFmpegDecoder 的处理函数
|
ffmpegDecoder->processVideo(itemIndex); // 调用 FFmpegDecoder 的处理函数
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +89,7 @@ void DataHandler::showVideo(const QString& client, const QByteArray& valData)
|
||||||
|
|
||||||
if (!start_run) {
|
if (!start_run) {
|
||||||
start_run = 1;
|
start_run = 1;
|
||||||
ffmpegDecoder->decodeFile(h264filePath, videoLabel);
|
ffmpegDecoder->decodeFile(h264filePath, videoLabel, VideoResolutionEdit);
|
||||||
}
|
}
|
||||||
//ffmpegDecoder->decodeFile(filePath_1, videoLabel);
|
//ffmpegDecoder->decodeFile(filePath_1, videoLabel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ class DataHandler : public QObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DataHandler(QLabel* leftLens_imageLabel, QLabel* rightLens_imageLabel, QLabel* videoLabel,
|
explicit DataHandler(QLabel* leftLens_imageLabel, QLabel* rightLens_imageLabel, QLabel* videoLabel,
|
||||||
|
QLineEdit* VideoResolutionEdit,
|
||||||
QTextEdit* licenseHwInfoEdit, QMap<QString, QLineEdit*>* devInfoLineEdits,
|
QTextEdit* licenseHwInfoEdit, QMap<QString, QLineEdit*>* devInfoLineEdits,
|
||||||
QJsonArray frontBoardOneClickTest, QJsonArray frontBoardTest, QJsonArray frontBoardFuncConfig,
|
QJsonArray frontBoardOneClickTest, QJsonArray frontBoardTest, QJsonArray frontBoardFuncConfig,
|
||||||
QJsonArray frontBoardDevInfoJson, QJsonArray frontBoardLicenseJson,
|
QJsonArray frontBoardDevInfoJson, QJsonArray frontBoardLicenseJson,
|
||||||
|
@ -69,6 +70,7 @@ private:
|
||||||
QLabel* leftLens_m_imageLabel;
|
QLabel* leftLens_m_imageLabel;
|
||||||
QLabel* rightLens_m_imageLabel;
|
QLabel* rightLens_m_imageLabel;
|
||||||
QLabel* videoLabel;
|
QLabel* videoLabel;
|
||||||
|
QLineEdit* VideoResolutionEdit;
|
||||||
QTextEdit* licenseHwInfoEdit;
|
QTextEdit* licenseHwInfoEdit;
|
||||||
QByteArray allRecvData; // 完整的一帧数据
|
QByteArray allRecvData; // 完整的一帧数据
|
||||||
int remain = 0;
|
int remain = 0;
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
#include <QDialog>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
class NewButtonDialog : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
NewButtonDialog(QWidget* parent = nullptr, const QSize& labelSize = QSize(480, 640)) : QDialog(parent)
|
|
||||||
{
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
|
||||||
QLabel* label = new QLabel("This is a new window opened by clicking the new button.", this);
|
|
||||||
label->setFixedSize(labelSize); // 设置QLabel的固定大小
|
|
||||||
layout->addWidget(label);
|
|
||||||
|
|
||||||
QPushButton* closeButton = new QPushButton("Close", this);
|
|
||||||
layout->addWidget(closeButton);
|
|
||||||
connect(closeButton, &QPushButton::clicked, this, &NewButtonDialog::accept);
|
|
||||||
|
|
||||||
setLayout(layout);
|
|
||||||
setWindowTitle("SL100 视频播放窗口");
|
|
||||||
//resize(500, 700); // 设置对话框的大小
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,10 +1,11 @@
|
||||||
// MainWidget.cpp
|
// MainWidget.cpp
|
||||||
#include "MainWidget.h"
|
#include "MainWidget.h"
|
||||||
|
|
||||||
void onThreadFinished(QThread* thread, ClientHandler* handler)
|
void onThreadFinished(QThread* thread, ClientHandler* handler, DataHandler* dataHandler)
|
||||||
{
|
{
|
||||||
qDebug() << "Thread finished. Deleting handler and thread.";
|
qDebug() << "Thread finished. Deleting handler and thread.";
|
||||||
handler->deleteLater();
|
handler->deleteLater();
|
||||||
|
dataHandler->deleteLater();
|
||||||
thread->deleteLater();
|
thread->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,44 +35,11 @@ MainWidget::MainWidget(QWidget* parent) :
|
||||||
licenseHwInfoEdit = new QTextEdit(this);
|
licenseHwInfoEdit = new QTextEdit(this);
|
||||||
UuidHwInfoEdit = new QTextEdit(this);
|
UuidHwInfoEdit = new QTextEdit(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 创建 mDNS 服务的 Server 和 Hostname 对象
|
|
||||||
QMdnsEngine::Server myserver;
|
|
||||||
QMdnsEngine::Hostname hostname(&myserver);
|
|
||||||
|
|
||||||
// 创建服务提供者(Provider)
|
|
||||||
QMdnsEngine::Provider provider(&myserver, &hostname);
|
|
||||||
|
|
||||||
// 定义要广播的服务
|
|
||||||
QMdnsEngine::Service service;
|
|
||||||
service.setName("Test Service");
|
|
||||||
service.setType("_test._tcp"); // 服务类型,包括 _tcp 或 _udp
|
|
||||||
service.setPort(12345); // 服务使用的端口号
|
|
||||||
|
|
||||||
// 启动服务广播
|
|
||||||
provider.update(service);
|
|
||||||
|
|
||||||
qDebug() << "mDNS service started. Broadcasting service:"
|
|
||||||
<< service.name() << service.type() << "on port" << service.port();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setupUI();
|
setupUI();
|
||||||
// 打印线程池状态信息
|
// 打印线程池状态信息
|
||||||
setupTimerForThreadPoolInfo();
|
setupTimerForThreadPoolInfo();
|
||||||
server = new QTcpServer(this);
|
server = new QTcpServer(this);
|
||||||
/*
|
|
||||||
// 创建 DataHandler 对象并连接信号
|
|
||||||
DataHandler* dataHandler = new DataHandler(leftLens_imageLabel, rightLens_imageLabel, videoLabel, licenseHwInfoEdit, &devInfoLineEdits,
|
|
||||||
frontBoardOneClickTest, frontBoardTest, frontBoardFuncConfig,
|
|
||||||
frontBoardDevInfoJson, frontBoardLicenseJson,
|
|
||||||
backBoardOneClickTest, backBoardTest, backBoardFuncConfig, backBoardDevInfoJson,
|
|
||||||
backBoardUuidJson, getPicJson, getVideoJson, this);
|
|
||||||
|
|
||||||
connect(this, &MainWidget::openFocusWindowRequested, dataHandler, &DataHandler::handleOpenFocusWindow);
|
|
||||||
connect(dataHandler, &DataHandler::statusUpdated, this, &MainWidget::onStatusUpdated);
|
|
||||||
*/
|
|
||||||
connect(server, &QTcpServer::newConnection, this, [this]() {
|
connect(server, &QTcpServer::newConnection, this, [this]() {
|
||||||
// 检查是否有挂起的连接
|
// 检查是否有挂起的连接
|
||||||
while (server->hasPendingConnections()) {
|
while (server->hasPendingConnections()) {
|
||||||
|
@ -124,13 +92,21 @@ MainWidget::MainWidget(QWidget* parent) :
|
||||||
backBoardOneClickTest, backBoardTest, backBoardFuncConfig, backBoardDevInfoJson,
|
backBoardOneClickTest, backBoardTest, backBoardFuncConfig, backBoardDevInfoJson,
|
||||||
backBoardUuidJson, getPicJson, getVideoJson, clientId, isBackBoardOrAllBoard, nullptr);
|
backBoardUuidJson, getPicJson, getVideoJson, clientId, isBackBoardOrAllBoard, nullptr);
|
||||||
|
|
||||||
// 将 ClientHandler 移动到线程池中的线程
|
// 将 ClientHandler 移到线程池中的线程
|
||||||
handler->moveToThread(thread);
|
handler->moveToThread(thread);
|
||||||
|
|
||||||
// 当线程结束时删除 handler
|
// 创建 DataHandler 对象并连接信号
|
||||||
connect(thread, &QThread::finished, this, [=]() {
|
DataHandler* dataHandler = new DataHandler(leftLens_imageLabel, rightLens_imageLabel, videoLabel,
|
||||||
onThreadFinished(thread, handler);
|
VideoResolutionEdit,
|
||||||
});
|
licenseHwInfoEdit, &devInfoLineEdits,
|
||||||
|
frontBoardOneClickTest, frontBoardTest, frontBoardFuncConfig,
|
||||||
|
frontBoardDevInfoJson, frontBoardLicenseJson,
|
||||||
|
backBoardOneClickTest, backBoardTest, backBoardFuncConfig, backBoardDevInfoJson,
|
||||||
|
backBoardUuidJson, getPicJson, getVideoJson, nullptr);
|
||||||
|
qDebug() << "dataHandler->moveToThread(thread)";
|
||||||
|
// 将 DataHandler 移到线程池中的线程
|
||||||
|
dataHandler->moveToThread(thread);
|
||||||
|
|
||||||
|
|
||||||
// 将sendData信号连接到主线程中的槽上
|
// 将sendData信号连接到主线程中的槽上
|
||||||
connect(handler, &ClientHandler::sendData, this, [socket](const QByteArray& data, int isBoardType) {
|
connect(handler, &ClientHandler::sendData, this, [socket](const QByteArray& data, int isBoardType) {
|
||||||
|
@ -160,9 +136,6 @@ MainWidget::MainWidget(QWidget* parent) :
|
||||||
this->onStartTimeout(clientId, timeout);
|
this->onStartTimeout(clientId, timeout);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 启动新的线程
|
|
||||||
thread->start();
|
|
||||||
|
|
||||||
clients.append(handler);
|
clients.append(handler);
|
||||||
clients_1[clientId] = handler;
|
clients_1[clientId] = handler;
|
||||||
clientThreads[clientId] = thread;
|
clientThreads[clientId] = thread;
|
||||||
|
@ -171,22 +144,23 @@ MainWidget::MainWidget(QWidget* parent) :
|
||||||
connect(handler, &ClientHandler::allItemsProcessed, this, &MainWidget::onAllItemsProcessed);
|
connect(handler, &ClientHandler::allItemsProcessed, this, &MainWidget::onAllItemsProcessed);
|
||||||
connect(handler, &ClientHandler::selectClientDisconnected, this, &MainWidget::onDisconnectClient);
|
connect(handler, &ClientHandler::selectClientDisconnected, this, &MainWidget::onDisconnectClient);
|
||||||
|
|
||||||
#if 1
|
|
||||||
// 创建 DataHandler 对象并连接信号
|
|
||||||
DataHandler* dataHandler = new DataHandler(leftLens_imageLabel, rightLens_imageLabel, videoLabel, licenseHwInfoEdit, &devInfoLineEdits,
|
|
||||||
frontBoardOneClickTest, frontBoardTest, frontBoardFuncConfig,
|
|
||||||
frontBoardDevInfoJson, frontBoardLicenseJson,
|
|
||||||
backBoardOneClickTest, backBoardTest, backBoardFuncConfig, backBoardDevInfoJson,
|
|
||||||
backBoardUuidJson, getPicJson, getVideoJson, this);
|
|
||||||
dataHandlers[clientId] = dataHandler;
|
dataHandlers[clientId] = dataHandler;
|
||||||
connect(this, &MainWidget::openFocusWindowRequested, dataHandler, &DataHandler::handleOpenFocusWindow);
|
connect(handler, &ClientHandler::dataReceived, dataHandler, &DataHandler::handleData);
|
||||||
connect(handler, &ClientHandler::dataReceived, dataHandler, &DataHandler::handleData);
|
connect(dataHandler, &DataHandler::statusUpdated, this, &MainWidget::onStatusUpdated);
|
||||||
connect(dataHandler, &DataHandler::statusUpdated, this, &MainWidget::onStatusUpdated);
|
// 当线程结束时删除 handler
|
||||||
#else
|
connect(thread, &QThread::finished, this, [=]() {
|
||||||
connect(handler, &ClientHandler::dataReceived, dataHandler, &DataHandler::handleData);
|
onThreadFinished(thread, handler, dataHandler);
|
||||||
#endif
|
});
|
||||||
|
// 启动新的线程
|
||||||
|
thread->start();
|
||||||
|
|
||||||
connect(handler, &ClientHandler::startReadTimer, this, &MainWidget::startClientReadTimer);
|
connect(handler, &ClientHandler::startReadTimer, this, &MainWidget::startClientReadTimer);
|
||||||
connect(handler, &ClientHandler::stopReadTimer, this, &MainWidget::stopClientReadTimer);
|
connect(handler, &ClientHandler::stopReadTimer, this, &MainWidget::stopClientReadTimer);
|
||||||
|
//handler->getClientId() == handler->preVideoClientId
|
||||||
|
qDebug() << "---- handler->getClientId():" << handler->getClientId();
|
||||||
|
qDebug() << "---- handler->preVideoClientId:" << handler->preVideoClientId;
|
||||||
|
connect(this, &MainWidget::openFocusWindowRequested, dataHandler, &DataHandler::handleOpenFocusWindow);
|
||||||
|
|
||||||
// 创建和管理定时器
|
// 创建和管理定时器
|
||||||
QTimer* readTimer = new QTimer(this);
|
QTimer* readTimer = new QTimer(this);
|
||||||
|
@ -924,13 +898,20 @@ void MainWidget::onLicenseButtonClicked()
|
||||||
QString dataStr = "";
|
QString dataStr = "";
|
||||||
if (jsonObject["lable"].toString() == "get_license") {
|
if (jsonObject["lable"].toString() == "get_license") {
|
||||||
QString hwInfoText = licenseHwInfoEdit->toPlainText();
|
QString hwInfoText = licenseHwInfoEdit->toPlainText();
|
||||||
|
if (hwInfoText.count("0x") != PIX_HARDWARE_INFO_BYTES) {
|
||||||
|
isRequestSuccessful = 0;
|
||||||
|
//licenseHwInfoEdit->setPlainText("您使用了License去获取License,这是不允许的!!!");
|
||||||
|
LicenseConfirmWindow dialog("您使用了License去获取License,这是不允许的!!!");
|
||||||
|
dialog.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
dataStr = hwInfoText.remove(","); // 去掉所有的逗号
|
dataStr = hwInfoText.remove(","); // 去掉所有的逗号
|
||||||
QString sendToHttpServerDataStr = dataStr.replace("0x", "").replace(" ", ""); // 去掉0x和空格
|
QString sendToHttpServerDataStr = dataStr.replace("0x", "").replace(" ", ""); // 去掉0x和空格
|
||||||
#if 1
|
#if 1
|
||||||
qDebug() << "sendToHttpServerDataStr:" << sendToHttpServerDataStr;
|
qDebug() << "sendToHttpServerDataStr:" << sendToHttpServerDataStr;
|
||||||
FactoryToolSendGetLicenseToHttpServer(sendToHttpServerDataStr);
|
FactoryToolSendGetLicenseToHttpServer(sendToHttpServerDataStr);
|
||||||
while (isRequestSuccessful == 0) {
|
while (isRequestSuccessful == 0) {
|
||||||
QCoreApplication::processEvents(); // 防止阻塞UI线程
|
QCoreApplication::processEvents(); // 防止阻塞线程
|
||||||
}
|
}
|
||||||
qDebug() << "isRequestSuccessful:" << isRequestSuccessful;
|
qDebug() << "isRequestSuccessful:" << isRequestSuccessful;
|
||||||
if (isRequestSuccessful == 2) {
|
if (isRequestSuccessful == 2) {
|
||||||
|
@ -960,18 +941,18 @@ void MainWidget::onLicenseButtonClicked()
|
||||||
qDebug() << "License Key set in licenseHwInfoEdit:" << licenseKey;
|
qDebug() << "License Key set in licenseHwInfoEdit:" << licenseKey;
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
QByteArray dataByteArray = QByteArray::fromHex(dataStr.toUtf8());
|
QByteArray dataByteArray = QByteArray::fromHex(dataStr.toUtf8());
|
||||||
memcpy(hardware_info, dataByteArray.data(), qMin(dataByteArray.size(), PIX_HARDWARE_INFO_BYTES));
|
memcpy(hardware_info, dataByteArray.data(), qMin(dataByteArray.size(), PIX_HARDWARE_INFO_BYTES));
|
||||||
//unsigned char hardware_info[PIX_HARDWARE_INFO_BYTES] = { 0x46,0x0b,0x5d,0x11,0x58,0x17,0x4d,0x5e,0x55,0x5c,0x51,0x4a,0x5a,0x07,0x59,0x4c,0x5f,0x45,0x5b,0x5f,0x5a,0x45,0x1c,0x5a,0x45,0x43,0x44,0x47,0x51,0x5e,0x44,0x30 };
|
//unsigned char hardware_info[PIX_HARDWARE_INFO_BYTES] = { 0x46,0x0b,0x5d,0x11,0x58,0x17,0x4d,0x5e,0x55,0x5c,0x51,0x4a,0x5a,0x07,0x59,0x4c,0x5f,0x45,0x5b,0x5f,0x5a,0x45,0x1c,0x5a,0x45,0x43,0x44,0x47,0x51,0x5e,0x44,0x30 };
|
||||||
LicenseConfirmWindow dialog("你确定要获取此授权吗?\n请确认你的hw_info是否正确");
|
LicenseConfirmWindow dialog("你确定要获取此授权吗?\n请确认你的hw_info是否正确");
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
#if !MANUAL_UPLOAD_LICENSE
|
#if !MANUAL_UPLOAD_LICENSE
|
||||||
if (!(licenseGenerate(hardware_info, license_info))) {
|
if (!(licenseGenerate(hardware_info, license_info))) {
|
||||||
qDebug() << "从U盘获取License失败" ;
|
qDebug() << "从U盘获取License失败";
|
||||||
isRequestSuccessful = 0;
|
isRequestSuccessful = 0;
|
||||||
licenseHwInfoEdit->setPlainText("从U盘获取License失败,请检查U盘是否插入电脑!!!");
|
licenseHwInfoEdit->setPlainText("从U盘获取License失败,请检查U盘是否插入电脑!!!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString licenseInfoHex = QByteArray(reinterpret_cast<char*>(license_info), PIX_LICENCE_BYTES).toHex().toUpper();
|
QString licenseInfoHex = QByteArray(reinterpret_cast<char*>(license_info), PIX_LICENCE_BYTES).toHex().toUpper();
|
||||||
#else
|
#else
|
||||||
//unsigned char license_info_1[PIX_LICENCE_BYTES] = { 0x07, 0xe8, 0xf3, 0x80, 0xa8, 0x07, 0x72, 0xa1, 0x17, 0xfe, 0xda, 0x67, 0xbd, 0x4a, 0x5a, 0xb5, 0xbb, 0x8b, 0x2d, 0xb2, 0xbf, 0x89, 0x74, 0xe5, 0xb0, 0x99, 0x70, 0x74, 0x3c, 0x6f, 0xf8, 0x82, 0x79, 0xab, 0x31, 0x9c, 0xdf, 0xe8, 0x9e, 0x75, 0x8f, 0x42, 0xb3, 0xcf, 0x00, 0x60, 0xa0, 0x38, 0xa4, 0xb8, 0xbe, 0xa6, 0x5d, 0x9f, 0x8b, 0x41, 0xf3, 0x0a, 0x69, 0xf6, 0x50, 0x94, 0x3f, 0xd0, 0xa5, 0xee, 0x88, 0x20, 0x93, 0x9a, 0x1c, 0xe9, 0x64, 0xd3, 0xaf, 0x9f, 0xc7, 0x66, 0x00, 0x7d, 0x7d, 0x68, 0xf1, 0xa4, 0xe1, 0x58, 0x00, 0x1d, 0x03, 0x0d, 0x40, 0x08, 0xa4, 0xcc, 0x0b, 0xd8, 0x19, 0x70, 0x9a, 0x83, 0x81, 0xbf, 0x27, 0x35, 0xb8, 0xec, 0x59, 0xa8, 0xd0, 0x03, 0xdb, 0xf6, 0xcf, 0x83, 0xaa, 0x0e, 0xfc, 0x95, 0x29, 0x77, 0xec, 0x89, 0xc5, 0x79, 0x10, 0x40, 0xd8, 0xbb };
|
//unsigned char license_info_1[PIX_LICENCE_BYTES] = { 0x07, 0xe8, 0xf3, 0x80, 0xa8, 0x07, 0x72, 0xa1, 0x17, 0xfe, 0xda, 0x67, 0xbd, 0x4a, 0x5a, 0xb5, 0xbb, 0x8b, 0x2d, 0xb2, 0xbf, 0x89, 0x74, 0xe5, 0xb0, 0x99, 0x70, 0x74, 0x3c, 0x6f, 0xf8, 0x82, 0x79, 0xab, 0x31, 0x9c, 0xdf, 0xe8, 0x9e, 0x75, 0x8f, 0x42, 0xb3, 0xcf, 0x00, 0x60, 0xa0, 0x38, 0xa4, 0xb8, 0xbe, 0xa6, 0x5d, 0x9f, 0x8b, 0x41, 0xf3, 0x0a, 0x69, 0xf6, 0x50, 0x94, 0x3f, 0xd0, 0xa5, 0xee, 0x88, 0x20, 0x93, 0x9a, 0x1c, 0xe9, 0x64, 0xd3, 0xaf, 0x9f, 0xc7, 0x66, 0x00, 0x7d, 0x7d, 0x68, 0xf1, 0xa4, 0xe1, 0x58, 0x00, 0x1d, 0x03, 0x0d, 0x40, 0x08, 0xa4, 0xcc, 0x0b, 0xd8, 0x19, 0x70, 0x9a, 0x83, 0x81, 0xbf, 0x27, 0x35, 0xb8, 0xec, 0x59, 0xa8, 0xd0, 0x03, 0xdb, 0xf6, 0xcf, 0x83, 0xaa, 0x0e, 0xfc, 0x95, 0x29, 0x77, 0xec, 0x89, 0xc5, 0x79, 0x10, 0x40, 0xd8, 0xbb };
|
||||||
|
@ -995,7 +976,7 @@ void MainWidget::onLicenseButtonClicked()
|
||||||
printf("\n");
|
printf("\n");
|
||||||
licenseHwInfoEdit->setPlainText(licenseInfoStr);
|
licenseHwInfoEdit->setPlainText(licenseInfoStr);
|
||||||
isRequestSuccessful = 0;
|
isRequestSuccessful = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -1211,6 +1192,9 @@ void MainWidget::onSendGetPicClicked()
|
||||||
button->setStyleSheet("background-color: green;");
|
button->setStyleSheet("background-color: green;");
|
||||||
if (lastClickedGetPicCamIndex != -1 && lastClickedGetPicCamIndex != itemIndex) {
|
if (lastClickedGetPicCamIndex != -1 && lastClickedGetPicCamIndex != itemIndex) {
|
||||||
getPicButtons[lastClickedGetPicCamIndex]->setStyleSheet("");
|
getPicButtons[lastClickedGetPicCamIndex]->setStyleSheet("");
|
||||||
|
if (lastClickedGetPicDevIndex != -1) {
|
||||||
|
getPicButtons[lastClickedGetPicDevIndex]->setStyleSheet("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lastClickedGetPicCamIndex = itemIndex;
|
lastClickedGetPicCamIndex = itemIndex;
|
||||||
}
|
}
|
||||||
|
@ -1254,26 +1238,27 @@ void MainWidget::onSendGetVideoClicked()
|
||||||
QPushButton* button = qobject_cast<QPushButton*>(sender());
|
QPushButton* button = qobject_cast<QPushButton*>(sender());
|
||||||
int itemIndex = button->property("getVideoIndex").toInt();
|
int itemIndex = button->property("getVideoIndex").toInt();
|
||||||
|
|
||||||
if (itemIndex < 2) {
|
if (itemIndex < 4) {
|
||||||
button->setStyleSheet("background-color: green;");
|
button->setStyleSheet("background-color: green;");
|
||||||
if (lastClickedGetVideoCamIndex != -1 && lastClickedGetVideoCamIndex != itemIndex) {
|
if (lastClickedGetVideoCamIndex != -1 && lastClickedGetVideoCamIndex != itemIndex) {
|
||||||
getVideoButtons[lastClickedGetVideoCamIndex]->setStyleSheet("");
|
getVideoButtons[lastClickedGetVideoCamIndex]->setStyleSheet("");
|
||||||
|
if (lastClickedGetVideoDevIndex != -1) {
|
||||||
|
getVideoButtons[lastClickedGetVideoDevIndex - 2]->setStyleSheet("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lastClickedGetVideoCamIndex = itemIndex;
|
lastClickedGetVideoCamIndex = itemIndex;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (lastClickedGetVideoCamIndex == -1) {
|
if (lastClickedGetVideoCamIndex == -1) {
|
||||||
QListWidgetItem* listItem = new QListWidgetItem(QString("Please select IR or RGB lens to get video!!!"), statusListWidget);
|
QListWidgetItem* listItem = new QListWidgetItem(QString("Please select lens to get video!!!"), statusListWidget);
|
||||||
listItem->setBackground(Qt::red);
|
listItem->setBackground(Qt::red);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (itemIndex - 6 >= connectedClientsCount) {
|
if (itemIndex - 8 >= connectedClientsCount) {
|
||||||
QListWidgetItem* listItem = new QListWidgetItem(QString("This device is not connected !!!").arg(itemIndex - 4), statusListWidget);
|
QListWidgetItem* listItem = new QListWidgetItem(QString("This device is not connected !!!").arg(itemIndex - 6), statusListWidget);
|
||||||
listItem->setBackground(Qt::red);
|
listItem->setBackground(Qt::red);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//qDebug() << "lastClickedGetVideoDevIndex:" << lastClickedGetVideoDevIndex;
|
|
||||||
//qDebug() << "itemIndex:" << itemIndex;
|
|
||||||
button->setStyleSheet("background-color: green;");
|
button->setStyleSheet("background-color: green;");
|
||||||
if (lastClickedGetVideoDevIndex != -1 && lastClickedGetVideoDevIndex != itemIndex) {
|
if (lastClickedGetVideoDevIndex != -1 && lastClickedGetVideoDevIndex != itemIndex) {
|
||||||
//qDebug() << "itemIndex:" << itemIndex;
|
//qDebug() << "itemIndex:" << itemIndex;
|
||||||
|
@ -1283,11 +1268,11 @@ void MainWidget::onSendGetVideoClicked()
|
||||||
//QMutexLocker locker(&mutex);
|
//QMutexLocker locker(&mutex);
|
||||||
for (ClientHandler* handler : clients) {
|
for (ClientHandler* handler : clients) {
|
||||||
if (handler->getClientId() == handler->controlClientId) {
|
if (handler->getClientId() == handler->controlClientId) {
|
||||||
handler->sendGetVideoItem(itemIndex - 5, lastClickedGetVideoCamIndex);
|
handler->sendGetVideoItem(itemIndex - 7, lastClickedGetVideoCamIndex);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getVideoButtons[2]->setEnabled(true);
|
getVideoButtons[FOCUS_WINDOWS_BUTTON]->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1303,9 +1288,15 @@ void MainWidget::onOpenFocusWindowClicked()
|
||||||
QPushButton* button = qobject_cast<QPushButton*>(sender());
|
QPushButton* button = qobject_cast<QPushButton*>(sender());
|
||||||
if (button) {
|
if (button) {
|
||||||
int itemIndex = button->property("getVideoIndex").toInt();
|
int itemIndex = button->property("getVideoIndex").toInt();
|
||||||
//qDebug() << "New Button clicked with itemIndex:" << itemIndex;
|
qDebug() << "New Button clicked with itemIndex:" << itemIndex;
|
||||||
if (itemIndex == 2) {
|
if (itemIndex == FOCUS_WINDOWS_BUTTON) {
|
||||||
emit openFocusWindowRequested(itemIndex); // 发送信号
|
for (ClientHandler* handler : clients) {
|
||||||
|
if (handler->getClientId() == handler->preVideoClientId) {
|
||||||
|
emit openFocusWindowRequested(itemIndex); // 发送信号
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
#include "../Network/mdns/servicemodel.h"
|
#include "../Network/mdns/servicemodel.h"
|
||||||
#include "../Network/ClientHandler.h"
|
#include "../Network/ClientHandler.h"
|
||||||
#include "../Network/httpClient.h"
|
#include "../Network/httpClient.h"
|
||||||
#include "FocusWindow.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "../Network/mdns/qmdnsengine/include/server.h"
|
#include "../Network/mdns/qmdnsengine/include/server.h"
|
||||||
|
@ -63,8 +62,8 @@
|
||||||
|
|
||||||
#define TEST_UDP_BROADCAST 0 // 用于测试 UDP 组播实现 mdns 功能 非标准 mdns
|
#define TEST_UDP_BROADCAST 0 // 用于测试 UDP 组播实现 mdns 功能 非标准 mdns
|
||||||
#define MANUAL_UPLOAD_LICENSE 0 // 打开手动上传 License的功能
|
#define MANUAL_UPLOAD_LICENSE 0 // 打开手动上传 License的功能
|
||||||
#define START_MDNS 1
|
#define START_MDNS 1
|
||||||
|
#define FOCUS_WINDOWS_BUTTON 4 // 大窗口播放视频的按键编号
|
||||||
#define TCP_CONNECT_PORT 12412 // TCP监听的端口
|
#define TCP_CONNECT_PORT 12412 // TCP监听的端口
|
||||||
|
|
||||||
class MainWidget : public QWidget
|
class MainWidget : public QWidget
|
||||||
|
@ -209,6 +208,8 @@ private:
|
||||||
QPushButton* selectFileButton; // Save Log 按键
|
QPushButton* selectFileButton; // Save Log 按键
|
||||||
QPushButton* clearLogButton; // clear Log 按键
|
QPushButton* clearLogButton; // clear Log 按键
|
||||||
QLineEdit* filePathLineEdit; // 文件路径显示
|
QLineEdit* filePathLineEdit; // 文件路径显示
|
||||||
|
QLineEdit* VideoResolutionEdit; // 视频分辨率显示
|
||||||
|
//QLineEdit* frameRateEdit; // 视频帧率显示
|
||||||
QLabel* leftLens_imageLabel; // 左边镜头图像显示
|
QLabel* leftLens_imageLabel; // 左边镜头图像显示
|
||||||
QLabel* rightLens_imageLabel; // 右边镜头图像显示
|
QLabel* rightLens_imageLabel; // 右边镜头图像显示
|
||||||
QLabel* videoLabel; // 视频显示
|
QLabel* videoLabel; // 视频显示
|
||||||
|
|
|
@ -186,7 +186,6 @@ QWidget* MainWidget::createFunctionConfigTab(const QJsonArray& BoardFuncConfig,
|
||||||
return functionConfigTab;
|
return functionConfigTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QWidget* MainWidget::createImageDisplayTab()
|
QWidget* MainWidget::createImageDisplayTab()
|
||||||
{
|
{
|
||||||
QWidget* imageDisplayTab = new QWidget(this);
|
QWidget* imageDisplayTab = new QWidget(this);
|
||||||
|
@ -245,13 +244,16 @@ QWidget* MainWidget::createVideoDisplayTab()
|
||||||
QWidget* videoDisplayTab = new QWidget(this);
|
QWidget* videoDisplayTab = new QWidget(this);
|
||||||
QVBoxLayout* videoDisplayLayout = new QVBoxLayout(videoDisplayTab);
|
QVBoxLayout* videoDisplayLayout = new QVBoxLayout(videoDisplayTab);
|
||||||
QVBoxLayout* videoButtonsColumnLayout = new QVBoxLayout;
|
QVBoxLayout* videoButtonsColumnLayout = new QVBoxLayout;
|
||||||
|
|
||||||
for (int i = 0; i < 6; ++i) {
|
for (int i = 0; i < 6; ++i) {
|
||||||
QHBoxLayout* videoButtonsRowLayout = new QHBoxLayout;
|
QHBoxLayout* videoButtonsRowLayout = new QHBoxLayout;
|
||||||
|
|
||||||
for (int j = 0; j < 2; ++j) {
|
for (int j = 0; j < 2; ++j) {
|
||||||
QPushButton* button;
|
QPushButton* button;
|
||||||
|
|
||||||
if (i == 0 && j == 0) {
|
if (i == 0 && j == 0) {
|
||||||
button = new QPushButton(QString("左边镜头"), this);
|
button = new QPushButton(QString("猫眼镜头(IR)"), this);
|
||||||
button->setFixedSize(73, 50);
|
button->setFixedSize(110, 50);
|
||||||
videoButtonsRowLayout->addWidget(button);
|
videoButtonsRowLayout->addWidget(button);
|
||||||
button->setProperty("getVideoIndex", i * 2 + j);
|
button->setProperty("getVideoIndex", i * 2 + j);
|
||||||
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
|
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
|
||||||
|
@ -259,8 +261,8 @@ QWidget* MainWidget::createVideoDisplayTab()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (i == 0 && j == 1) {
|
else if (i == 0 && j == 1) {
|
||||||
button = new QPushButton(QString("右边镜头"), this);
|
button = new QPushButton(QString("猫眼镜头(RGB)"), this);
|
||||||
button->setFixedSize(73, 50);
|
button->setFixedSize(110, 50);
|
||||||
videoButtonsRowLayout->addWidget(button);
|
videoButtonsRowLayout->addWidget(button);
|
||||||
button->setProperty("getVideoIndex", i * 2 + j);
|
button->setProperty("getVideoIndex", i * 2 + j);
|
||||||
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
|
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
|
||||||
|
@ -268,27 +270,47 @@ QWidget* MainWidget::createVideoDisplayTab()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调价调焦窗口按键
|
|
||||||
if (i == 1 && j == 0) {
|
if (i == 1 && j == 0) {
|
||||||
|
button = new QPushButton(QString("左边镜头"), this);
|
||||||
|
button->setFixedSize(110, 50);
|
||||||
|
videoButtonsRowLayout->addWidget(button);
|
||||||
|
button->setProperty("getVideoIndex", i * 2 + j);
|
||||||
|
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
|
||||||
|
getVideoButtons.append(button);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (i == 1 && j == 1) {
|
||||||
|
button = new QPushButton(QString("右边镜头"), this);
|
||||||
|
button->setFixedSize(110, 50);
|
||||||
|
videoButtonsRowLayout->addWidget(button);
|
||||||
|
button->setProperty("getVideoIndex", i * 2 + j);
|
||||||
|
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
|
||||||
|
getVideoButtons.append(button);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == 2 && j == 0) {
|
||||||
button = new QPushButton(QString("大窗口播放视频"), this);
|
button = new QPushButton(QString("大窗口播放视频"), this);
|
||||||
button->setFixedSize(150, 50);
|
button->setFixedSize(224, 50);
|
||||||
button->setEnabled(false);
|
button->setEnabled(false);
|
||||||
videoButtonsRowLayout->addWidget(button);
|
videoButtonsRowLayout->addWidget(button);
|
||||||
button->setProperty("getVideoIndex", i * 2 + j);
|
button->setProperty("getVideoIndex", i * 2 + j);
|
||||||
connect(button, &QPushButton::clicked, this, &MainWidget::onOpenFocusWindowClicked);
|
connect(button, &QPushButton::clicked, this, &MainWidget::onOpenFocusWindowClicked);
|
||||||
getVideoButtons.append(button);
|
getVideoButtons.append(button);
|
||||||
break; // 跳出内层循环,只添加一个按键
|
break; // 跳出内层循环,只添加一个按键
|
||||||
}
|
}
|
||||||
if (i >= 2 && i <= 5) {
|
|
||||||
if(j == 0)
|
if (i >= 3 && i <= 5) {
|
||||||
button = new QPushButton(QString("Device %1\n打开视频").arg(i - 1), this);
|
if (j == 0)
|
||||||
else if(j == 1)
|
button = new QPushButton(QString("Device %1\n打开视频").arg(i - 2), this);
|
||||||
button = new QPushButton(QString("Device %1\n关闭视频").arg(i - 1), this);
|
else if (j == 1)
|
||||||
|
button = new QPushButton(QString("Device %1\n关闭视频").arg(i - 2), this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
button = new QPushButton(QString("Device %1").arg(i * 2 + (j * 1 - 1) - 3), this);
|
continue;
|
||||||
}
|
}
|
||||||
button->setFixedSize(73, 50);
|
|
||||||
|
button->setFixedSize(110, 50);
|
||||||
videoButtonsRowLayout->addWidget(button);
|
videoButtonsRowLayout->addWidget(button);
|
||||||
button->setProperty("getVideoIndex", i * 2 + j + 1);
|
button->setProperty("getVideoIndex", i * 2 + j + 1);
|
||||||
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
|
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
|
||||||
|
@ -298,10 +320,23 @@ QWidget* MainWidget::createVideoDisplayTab()
|
||||||
}
|
}
|
||||||
|
|
||||||
QHBoxLayout* videoAndButtonsLayout = new QHBoxLayout;
|
QHBoxLayout* videoAndButtonsLayout = new QHBoxLayout;
|
||||||
|
QFormLayout* formLayout = new QFormLayout;
|
||||||
|
QLabel* VideoResolution = new QLabel("分辨率:");
|
||||||
|
VideoResolutionEdit = new QLineEdit;
|
||||||
|
VideoResolutionEdit->setFixedWidth(120);
|
||||||
|
formLayout->addRow(VideoResolution, VideoResolutionEdit);
|
||||||
|
/*QLabel* frameRate = new QLabel("帧率:");
|
||||||
|
frameRateEdit = new QLineEdit;
|
||||||
|
frameRateEdit->setFixedWidth(120);
|
||||||
|
formLayout->addRow(frameRate, frameRateEdit);*/
|
||||||
videoLabel = new QLabel(this);
|
videoLabel = new QLabel(this);
|
||||||
videoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
videoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
videoAndButtonsLayout->addLayout(videoButtonsColumnLayout, 1);
|
videoAndButtonsLayout->addLayout(videoButtonsColumnLayout);
|
||||||
videoAndButtonsLayout->addWidget(videoLabel, 6);
|
videoAndButtonsLayout->addLayout(formLayout);
|
||||||
|
videoAndButtonsLayout->addWidget(videoLabel);
|
||||||
|
videoAndButtonsLayout->setStretch(0, 1);
|
||||||
|
videoAndButtonsLayout->setStretch(1, 1);
|
||||||
|
videoAndButtonsLayout->setStretch(2, 1);
|
||||||
videoDisplayLayout->addLayout(videoAndButtonsLayout);
|
videoDisplayLayout->addLayout(videoAndButtonsLayout);
|
||||||
|
|
||||||
return videoDisplayTab;
|
return videoDisplayTab;
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
//将“子系统”设置为“Windows(/ SUBSYSTEM)”而不是“控制台(/ SUBSYSTEM)”。
|
//将“子系统”设置为“Windows(/ SUBSYSTEM)”而不是“控制台(/ SUBSYSTEM)”。
|
||||||
//这种方法不需要任何额外的代码,且最为简洁。如果你已经在代码中使用了WinMain而不是main函数,这个设置就是默认的。
|
//这种方法不需要任何额外的代码,且最为简洁。如果你已经在代码中使用了WinMain而不是main函数,这个设置就是默认的。
|
||||||
//
|
//
|
||||||
//通过这些方法,你应该可以彻底隐藏或者关闭控制台窗口。
|
|
||||||
|
|
||||||
// 关闭控制台窗口的函数
|
// 关闭控制台窗口的函数
|
||||||
void closeConsole() {
|
void closeConsole() {
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
device ID: 1 - Item 1: 人脸单角度注册 ---> NG
|
|
||||||
device ID: 1 - Item 2: 人脸多角度注册 ---> NG
|
|
||||||
device ID: 1 - Item 3: 掌静脉注册 ---> NG
|
|
||||||
device ID: 1 - Item 4: 人脸识别 ---> NG
|
|
||||||
device ID: 1 - Item 5: 掌静脉识别 ---> NG
|
|
||||||
device ID: 1 - Item 6: 删除用户 ---> NG
|
|
||||||
device ID: 1 - Item 7: 删除所有用户 ---> NG
|
|
||||||
device ID: 1 - Item 8: 获取用户 ---> NG
|
|
||||||
device ID: 1 - Item 9: 获取所有用户 ---> NG
|
|
||||||
device ID: 1 - Item 10: 密码注册 ---> NG
|
|
||||||
device ID: 1 - Item 11: 图片注册 ---> NG
|
|
||||||
device ID:-1 ---> All 25 items test completed !!!
|
|
|
@ -1,24 +0,0 @@
|
||||||
device ID: 1 - Item 1: 人脸单角度注册 ---> NG
|
|
||||||
device ID: 1 - Item 2: 人脸多角度注册 ---> NG
|
|
||||||
device ID: 1 - Item 3: 掌静脉注册 ---> NG
|
|
||||||
device ID: 1 - Item 4: 人脸识别 ---> NG
|
|
||||||
device ID: 1 - Item 5: 掌静脉识别 ---> NG
|
|
||||||
device ID: 1 - Item 6: 删除用户 ---> NG
|
|
||||||
device ID: 1 - Item 7: 删除所有用户 ---> NG
|
|
||||||
device ID: 1 - Item 8: 获取用户 ---> NG
|
|
||||||
device ID: 1 - Item 9: 获取所有用户 ---> NG
|
|
||||||
device ID: 1 - Item 10: 密码注册 ---> NG
|
|
||||||
device ID: 1 - Item 11: 图片注册 ---> NG
|
|
||||||
device ID:-1 ---> All 25 items test completed !!!
|
|
||||||
device ID: 1 - Item 1: 人脸单角度注册 ---> NG
|
|
||||||
device ID: 1 - Item 2: 人脸多角度注册 ---> NG
|
|
||||||
device ID: 1 - Item 3: 掌静脉注册 ---> NG
|
|
||||||
device ID: 1 - Item 4: 人脸识别 ---> NG
|
|
||||||
device ID: 1 - Item 5: 掌静脉识别 ---> NG
|
|
||||||
device ID: 1 - Item 6: 删除用户 ---> NG
|
|
||||||
device ID: 1 - Item 7: 删除所有用户 ---> NG
|
|
||||||
device ID: 1 - Item 8: 获取用户 ---> NG
|
|
||||||
device ID: 1 - Item 9: 获取所有用户 ---> NG
|
|
||||||
device ID: 1 - Item 10: 密码注册 ---> NG
|
|
||||||
device ID: 1 - Item 11: 图片注册 ---> NG
|
|
||||||
device ID:-1 ---> All 25 items test completed !!!
|
|
|
@ -1,6 +0,0 @@
|
||||||
device ID: 1 - Item 0: ---> NG
|
|
||||||
device ID: 1 - Item 0: ---> NG
|
|
||||||
device ID: 1 - Item 0: ---> NG
|
|
||||||
device ID: 1 - Item 0: ---> NG
|
|
||||||
device ID: 1 - Item 0: ---> NG
|
|
||||||
device ID:-1 ---> All 5 items test completed !!!
|
|
Binary file not shown.
Loading…
Reference in New Issue