1. 增加猫眼镜头切换IRCUT; 2. 优化连续多次打开视频获取视频流导致的内存问题

This commit is contained in:
2024-09-02 18:37:24 +08:00
parent 09c5843358
commit 15eb213578
19 changed files with 153 additions and 181 deletions

View File

@@ -186,7 +186,6 @@ QWidget* MainWidget::createFunctionConfigTab(const QJsonArray& BoardFuncConfig,
return functionConfigTab;
}
QWidget* MainWidget::createImageDisplayTab()
{
QWidget* imageDisplayTab = new QWidget(this);
@@ -245,13 +244,16 @@ QWidget* MainWidget::createVideoDisplayTab()
QWidget* videoDisplayTab = new QWidget(this);
QVBoxLayout* videoDisplayLayout = new QVBoxLayout(videoDisplayTab);
QVBoxLayout* videoButtonsColumnLayout = new QVBoxLayout;
for (int i = 0; i < 6; ++i) {
QHBoxLayout* videoButtonsRowLayout = new QHBoxLayout;
for (int j = 0; j < 2; ++j) {
QPushButton* button;
if (i == 0 && j == 0) {
button = new QPushButton(QString("左边镜头"), this);
button->setFixedSize(73, 50);
button = new QPushButton(QString("猫眼镜头(IR)"), this);
button->setFixedSize(110, 50);
videoButtonsRowLayout->addWidget(button);
button->setProperty("getVideoIndex", i * 2 + j);
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
@@ -259,8 +261,8 @@ QWidget* MainWidget::createVideoDisplayTab()
continue;
}
else if (i == 0 && j == 1) {
button = new QPushButton(QString("右边镜头"), this);
button->setFixedSize(73, 50);
button = new QPushButton(QString("猫眼镜头(RGB)"), this);
button->setFixedSize(110, 50);
videoButtonsRowLayout->addWidget(button);
button->setProperty("getVideoIndex", i * 2 + j);
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
@@ -268,27 +270,47 @@ QWidget* MainWidget::createVideoDisplayTab()
continue;
}
// 调价调焦窗口按键
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->setFixedSize(150, 50);
button->setFixedSize(224, 50);
button->setEnabled(false);
videoButtonsRowLayout->addWidget(button);
button->setProperty("getVideoIndex", i * 2 + j);
connect(button, &QPushButton::clicked, this, &MainWidget::onOpenFocusWindowClicked);
getVideoButtons.append(button);
break; // 跳出内层循环,只添加一个按键
}
if (i >= 2 && i <= 5) {
if(j == 0)
button = new QPushButton(QString("Device %1\n打开视频").arg(i - 1), this);
else if(j == 1)
button = new QPushButton(QString("Device %1\n关闭视频").arg(i - 1), this);
}
if (i >= 3 && i <= 5) {
if (j == 0)
button = new QPushButton(QString("Device %1\n打开视频").arg(i - 2), this);
else if (j == 1)
button = new QPushButton(QString("Device %1\n关闭视频").arg(i - 2), this);
}
else {
button = new QPushButton(QString("Device %1").arg(i * 2 + (j * 1 - 1) - 3), this);
}
button->setFixedSize(73, 50);
continue;
}
button->setFixedSize(110, 50);
videoButtonsRowLayout->addWidget(button);
button->setProperty("getVideoIndex", i * 2 + j + 1);
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
@@ -298,10 +320,23 @@ QWidget* MainWidget::createVideoDisplayTab()
}
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->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
videoAndButtonsLayout->addLayout(videoButtonsColumnLayout, 1);
videoAndButtonsLayout->addWidget(videoLabel, 6);
videoAndButtonsLayout->addLayout(videoButtonsColumnLayout);
videoAndButtonsLayout->addLayout(formLayout);
videoAndButtonsLayout->addWidget(videoLabel);
videoAndButtonsLayout->setStretch(0, 1);
videoAndButtonsLayout->setStretch(1, 1);
videoAndButtonsLayout->setStretch(2, 1);
videoDisplayLayout->addLayout(videoAndButtonsLayout);
return videoDisplayTab;