|
|
|
@ -78,6 +78,8 @@ StreamPublishWindow::StreamPublishWindow(StreamPublishEngine* engine, uint64_t g |
|
|
|
} |
|
|
|
} |
|
|
|
m_rotation->button(0)->setChecked(true); angles->addStretch(); form->addRow(text("Rotation"), rotationRow); |
|
|
|
m_rotation->button(0)->setChecked(true); angles->addStretch(); form->addRow(text("Rotation"), rotationRow); |
|
|
|
m_audio = new QCheckBox(text("Microphone enabled"), settings); m_audio->setChecked(true); form->addRow(m_audio); |
|
|
|
m_audio = new QCheckBox(text("Microphone enabled"), settings); m_audio->setChecked(true); form->addRow(m_audio); |
|
|
|
|
|
|
|
m_cursor = new QCheckBox(text("Show mouse cursor"), settings); m_cursor->setChecked(true); |
|
|
|
|
|
|
|
m_cursor->setObjectName(QStringLiteral("streamShowCursor")); form->insertRow(2, m_cursor); |
|
|
|
m_microphone = new QComboBox(settings); m_microphone->addItem(text("Default microphone"), QString()); |
|
|
|
m_microphone = new QComboBox(settings); m_microphone->addItem(text("Default microphone"), QString()); |
|
|
|
for (const auto& device : SoundManager::enumerateCaptureDevices()) m_microphone->addItem(device.name, device.id); |
|
|
|
for (const auto& device : SoundManager::enumerateCaptureDevices()) m_microphone->addItem(device.name, device.id); |
|
|
|
form->addRow(text("Microphone"), m_microphone); |
|
|
|
form->addRow(text("Microphone"), m_microphone); |
|
|
|
@ -100,6 +102,7 @@ StreamPublishWindow::StreamPublishWindow(StreamPublishEngine* engine, uint64_t g |
|
|
|
for (auto* box : {m_mode, m_codec, m_bitrate}) connect(box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &StreamPublishWindow::apply); |
|
|
|
for (auto* box : {m_mode, m_codec, m_bitrate}) connect(box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &StreamPublishWindow::apply); |
|
|
|
connect(m_microphone, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &StreamPublishWindow::apply); |
|
|
|
connect(m_microphone, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &StreamPublishWindow::apply); |
|
|
|
connect(m_audio, &QCheckBox::toggled, this, &StreamPublishWindow::apply); |
|
|
|
connect(m_audio, &QCheckBox::toggled, this, &StreamPublishWindow::apply); |
|
|
|
|
|
|
|
connect(m_cursor, &QCheckBox::toggled, this, &StreamPublishWindow::apply); |
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) |
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) |
|
|
|
connect(m_rotation, &QButtonGroup::idClicked, this, &StreamPublishWindow::apply); |
|
|
|
connect(m_rotation, &QButtonGroup::idClicked, this, &StreamPublishWindow::apply); |
|
|
|
#else |
|
|
|
#else |
|
|
|
@ -153,6 +156,7 @@ void StreamPublishWindow::restoreSettings() { |
|
|
|
if (auto* button = m_rotation->button(m_settings.value("rotation").toInt())) button->setChecked(true); |
|
|
|
if (auto* button = m_rotation->button(m_settings.value("rotation").toInt())) button->setChecked(true); |
|
|
|
else DEBUG_WARN(DEBUG_CATEGORY_STREAM, "desktop saved capture rotation invalid"); |
|
|
|
else DEBUG_WARN(DEBUG_CATEGORY_STREAM, "desktop saved capture rotation invalid"); |
|
|
|
m_audio->setChecked(m_settings.value("audio").toBool(true)); |
|
|
|
m_audio->setChecked(m_settings.value("audio").toBool(true)); |
|
|
|
|
|
|
|
m_cursor->setChecked(m_settings.value("show_cursor").toBool(true)); |
|
|
|
select(m_microphone, m_settings.value("microphone").toString(), "microphone"); |
|
|
|
select(m_microphone, m_settings.value("microphone").toString(), "microphone"); |
|
|
|
m_updating = false; |
|
|
|
m_updating = false; |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop capture settings restored: %s", QJsonDocument(m_settings).toJson(QJsonDocument::Compact).constData()); |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop capture settings restored: %s", QJsonDocument(m_settings).toJson(QJsonDocument::Compact).constData()); |
|
|
|
@ -173,6 +177,7 @@ void StreamPublishWindow::saveSettings() { |
|
|
|
if (m_codec->currentIndex() >= 0) saved["codec"] = config.video.codec; |
|
|
|
if (m_codec->currentIndex() >= 0) saved["codec"] = config.video.codec; |
|
|
|
saved["bitrate"] = m_bitrate->currentData().toInt(); saved["rotation"] = config.video.rotation; |
|
|
|
saved["bitrate"] = m_bitrate->currentData().toInt(); saved["rotation"] = config.video.rotation; |
|
|
|
saved["audio"] = config.audio; saved["microphone"] = config.microphone; |
|
|
|
saved["audio"] = config.audio; saved["microphone"] = config.microphone; |
|
|
|
|
|
|
|
saved["show_cursor"] = config.showCursor; |
|
|
|
if (saved == m_settings) return; |
|
|
|
if (saved == m_settings) return; |
|
|
|
m_settings = saved; |
|
|
|
m_settings = saved; |
|
|
|
auto json = QJsonDocument(saved).toJson(QJsonDocument::Compact); |
|
|
|
auto json = QJsonDocument(saved).toJson(QJsonDocument::Compact); |
|
|
|
@ -263,6 +268,7 @@ StreamPublishConfig StreamPublishWindow::selection() const { |
|
|
|
config.video.bitrate = m_bitrate->currentData().toInt(); |
|
|
|
config.video.bitrate = m_bitrate->currentData().toInt(); |
|
|
|
config.automaticBitrate = !config.video.bitrate; |
|
|
|
config.automaticBitrate = !config.video.bitrate; |
|
|
|
if (config.automaticBitrate) config.video.bitrate = std::clamp(config.video.width * config.video.height * config.video.fps / 11, 250000, 16000000); |
|
|
|
if (config.automaticBitrate) config.video.bitrate = std::clamp(config.video.width * config.video.height * config.video.fps / 11, 250000, 16000000); |
|
|
|
|
|
|
|
config.showCursor = m_cursor->isChecked(); |
|
|
|
config.microphone = m_microphone->currentData().toString(); config.audio = m_audio->isChecked(); return config; |
|
|
|
config.microphone = m_microphone->currentData().toString(); config.audio = m_audio->isChecked(); return config; |
|
|
|
} |
|
|
|
} |
|
|
|
void StreamPublishWindow::apply() { |
|
|
|
void StreamPublishWindow::apply() { |
|
|
|
@ -293,5 +299,8 @@ void StreamPublishWindow::synchronize() { |
|
|
|
m_bitrate->setCurrentIndex(bitrateIndex); |
|
|
|
m_bitrate->setCurrentIndex(bitrateIndex); |
|
|
|
if (auto* button = m_rotation->button(config.video.rotation)) button->setChecked(true); |
|
|
|
if (auto* button = m_rotation->button(config.video.rotation)) button->setChecked(true); |
|
|
|
m_audio->setChecked(config.audio); m_microphone->setCurrentIndex(m_microphone->findData(config.microphone)); |
|
|
|
m_audio->setChecked(config.audio); m_microphone->setCurrentIndex(m_microphone->findData(config.microphone)); |
|
|
|
|
|
|
|
m_cursor->setChecked(config.showCursor); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
m_cursor->setVisible(StreamPublishEngine::cursorSupported(selection().source)); |
|
|
|
|
|
|
|
m_cursor->setEnabled(!active || m_engine->running()); |
|
|
|
} |
|
|
|
} |
|
|
|
|