|
@@ -1,8 +1,6 @@
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
#include "settings_page.h"
|
|
#include "settings_page.h"
|
|
|
-#include "encoder/video_encoder.h"
|
|
|
|
|
#include <QFileDialog>
|
|
#include <QFileDialog>
|
|
|
|
|
+#include "encoder/video_encoder.h"
|
|
|
|
|
|
|
|
SettingsPage::SettingsPage(Param* param, QWidget* parent)
|
|
SettingsPage::SettingsPage(Param* param, QWidget* parent)
|
|
|
: QDialog(parent)
|
|
: QDialog(parent)
|
|
@@ -15,13 +13,9 @@ SettingsPage::SettingsPage(Param* param, QWidget* parent)
|
|
|
|
|
|
|
|
void SettingsPage::_InitConnect()
|
|
void SettingsPage::_InitConnect()
|
|
|
{
|
|
{
|
|
|
- connect(_applyBtn, &QPushButton::released, [this] {
|
|
|
|
|
- _WriteSettings();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ connect(_applyBtn, &QPushButton::released, [this] { _WriteSettings(); });
|
|
|
|
|
|
|
|
- connect(_cancelBtn, &QPushButton::released, [this] {
|
|
|
|
|
- this->close();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ connect(_cancelBtn, &QPushButton::released, [this] { this->close(); });
|
|
|
|
|
|
|
|
connect(_yesBtn, &QPushButton::released, [this] {
|
|
connect(_yesBtn, &QPushButton::released, [this] {
|
|
|
_WriteSettings();
|
|
_WriteSettings();
|
|
@@ -29,7 +23,10 @@ void SettingsPage::_InitConnect()
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
connect(_selDirBtn, &QPushButton::released, [this] {
|
|
connect(_selDirBtn, &QPushButton::released, [this] {
|
|
|
- QString selectedDir = QFileDialog::getExistingDirectory(this, "选择输出目录", "./", QFileDialog::ShowDirsOnly);
|
|
|
|
|
|
|
+ QString selectedDir = QFileDialog::getExistingDirectory(this,
|
|
|
|
|
+ "选择输出目录",
|
|
|
|
|
+ "./",
|
|
|
|
|
+ QFileDialog::ShowDirsOnly);
|
|
|
// 若目录路径不为空
|
|
// 若目录路径不为空
|
|
|
if (!selectedDir.isEmpty()) {
|
|
if (!selectedDir.isEmpty()) {
|
|
|
// 显示选择的目录路径
|
|
// 显示选择的目录路径
|
|
@@ -45,8 +42,8 @@ void SettingsPage::_WriteSettings()
|
|
|
_param->videoParam.name = _videoEncoderBox->currentText().toStdString();
|
|
_param->videoParam.name = _videoEncoderBox->currentText().toStdString();
|
|
|
_param->audioParam.bitRate = _audioBitRateBox->value() * 1000;
|
|
_param->audioParam.bitRate = _audioBitRateBox->value() * 1000;
|
|
|
_param->outputDir = _fileDirEdit->text().toStdString();
|
|
_param->outputDir = _fileDirEdit->text().toStdString();
|
|
|
- _param->liveUrl = _liveUrlEdit->text().toStdString();
|
|
|
|
|
- _param->liveName = _liveNameEdit->text().toStdString();
|
|
|
|
|
|
|
+ // _param->liveUrl = _liveUrlEdit->text().toStdString();
|
|
|
|
|
+ // _param->liveName = _liveNameEdit->text().toStdString();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void SettingsPage::_InitUi()
|
|
void SettingsPage::_InitUi()
|
|
@@ -56,7 +53,6 @@ void SettingsPage::_InitUi()
|
|
|
layout->addWidget(_InitVideoUi());
|
|
layout->addWidget(_InitVideoUi());
|
|
|
layout->addWidget(_InitAudioUi());
|
|
layout->addWidget(_InitAudioUi());
|
|
|
layout->addWidget(_InitOutputUi());
|
|
layout->addWidget(_InitOutputUi());
|
|
|
- layout->addWidget(_InitLiveUi());
|
|
|
|
|
auto hLayout = new QHBoxLayout;
|
|
auto hLayout = new QHBoxLayout;
|
|
|
_applyBtn = new QPushButton("应用");
|
|
_applyBtn = new QPushButton("应用");
|
|
|
_cancelBtn = new QPushButton("取消");
|
|
_cancelBtn = new QPushButton("取消");
|
|
@@ -87,9 +83,14 @@ QGroupBox* SettingsPage::_InitVideoUi()
|
|
|
_videoEncoderBox->addItem(encoder.c_str());
|
|
_videoEncoderBox->addItem(encoder.c_str());
|
|
|
}
|
|
}
|
|
|
_videoEncoderBox->setCurrentText(_param->videoParam.name.c_str());
|
|
_videoEncoderBox->setCurrentText(_param->videoParam.name.c_str());
|
|
|
- layout->addLayout(_CreateDescription("比特率(kB):", "越高的比特率越清晰, 但越占用硬件资源", _videoBitRateBox));
|
|
|
|
|
- layout->addLayout(_CreateDescription("帧率:", "越高的帧率越流畅, 但越占用硬件资源", _videoFpsBox));
|
|
|
|
|
- layout->addLayout(_CreateDescription("编码器:", "libx264 为软件编码, CPU占用高但兼容性强, 其他为硬件编码, 效果与软件编码相反", _videoEncoderBox));
|
|
|
|
|
|
|
+ layout->addLayout(
|
|
|
|
|
+ _CreateDescription("比特率(kB):", "越高的比特率越清晰, 但越占用硬件资源", _videoBitRateBox));
|
|
|
|
|
+ layout->addLayout(
|
|
|
|
|
+ _CreateDescription("帧率:", "越高的帧率越流畅, 但越占用硬件资源", _videoFpsBox));
|
|
|
|
|
+ layout->addLayout(_CreateDescription(
|
|
|
|
|
+ "编码器:",
|
|
|
|
|
+ "libx264 为软件编码, CPU占用高但兼容性强, 其他为硬件编码, 效果与软件编码相反",
|
|
|
|
|
+ _videoEncoderBox));
|
|
|
groupBox->setLayout(layout);
|
|
groupBox->setLayout(layout);
|
|
|
return groupBox;
|
|
return groupBox;
|
|
|
}
|
|
}
|
|
@@ -101,7 +102,8 @@ QGroupBox* SettingsPage::_InitAudioUi()
|
|
|
_audioBitRateBox->setMinimum(0);
|
|
_audioBitRateBox->setMinimum(0);
|
|
|
_audioBitRateBox->setMaximum(INT_MAX);
|
|
_audioBitRateBox->setMaximum(INT_MAX);
|
|
|
_audioBitRateBox->setValue(_param->audioParam.bitRate / 1000);
|
|
_audioBitRateBox->setValue(_param->audioParam.bitRate / 1000);
|
|
|
- layout->addLayout(_CreateDescription("比特率(kB):", "越高的比特率越清晰, 但越占用硬件资源", _audioBitRateBox));
|
|
|
|
|
|
|
+ layout->addLayout(
|
|
|
|
|
+ _CreateDescription("比特率(kB):", "越高的比特率越清晰, 但越占用硬件资源", _audioBitRateBox));
|
|
|
groupBox->setLayout(layout);
|
|
groupBox->setLayout(layout);
|
|
|
return groupBox;
|
|
return groupBox;
|
|
|
}
|
|
}
|
|
@@ -118,24 +120,9 @@ QGroupBox* SettingsPage::_InitOutputUi()
|
|
|
return groupBox;
|
|
return groupBox;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-QGroupBox* SettingsPage::_InitLiveUi()
|
|
|
|
|
-{
|
|
|
|
|
- auto groupBox = new QGroupBox("直播");
|
|
|
|
|
- auto layout = new QVBoxLayout;
|
|
|
|
|
- _liveUrlEdit = new QLineEdit(_param->liveUrl.c_str());
|
|
|
|
|
- _liveNameEdit = new QLineEdit(_param->liveName.c_str());
|
|
|
|
|
- auto liveUrlLayout = new QHBoxLayout();
|
|
|
|
|
- liveUrlLayout->addWidget(new QLabel("地址:"));
|
|
|
|
|
- liveUrlLayout->addWidget(_liveUrlEdit);
|
|
|
|
|
- auto liveNameLayout = new QHBoxLayout();
|
|
|
|
|
- liveNameLayout->addWidget(new QLabel("名称(密钥):"));
|
|
|
|
|
- liveNameLayout->addWidget(_liveNameEdit);
|
|
|
|
|
- layout->addLayout(liveUrlLayout);
|
|
|
|
|
- layout->addLayout(liveNameLayout);
|
|
|
|
|
- groupBox->setLayout(layout);
|
|
|
|
|
- return groupBox;
|
|
|
|
|
-}
|
|
|
|
|
-QHBoxLayout* SettingsPage::_CreateDescription(std::string_view text, std::string_view textEx, QWidget* widget)
|
|
|
|
|
|
|
+QHBoxLayout* SettingsPage::_CreateDescription(std::string_view text,
|
|
|
|
|
+ std::string_view textEx,
|
|
|
|
|
+ QWidget* widget)
|
|
|
{
|
|
{
|
|
|
auto layout = new QHBoxLayout;
|
|
auto layout = new QHBoxLayout;
|
|
|
auto label = new QLabel(text.data());
|
|
auto label = new QLabel(text.data());
|
|
@@ -143,4 +130,4 @@ QHBoxLayout* SettingsPage::_CreateDescription(std::string_view text, std::string
|
|
|
layout->addWidget(label);
|
|
layout->addWidget(label);
|
|
|
layout->addWidget(widget);
|
|
layout->addWidget(widget);
|
|
|
return layout;
|
|
return layout;
|
|
|
-}
|
|
|
|
|
|
|
+}
|