2024-06-13 11:58:07 +02:00
|
|
|
#include "config-dialog.hpp"
|
|
|
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QFormLayout>
|
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QListWidget>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QScrollArea>
|
|
|
|
#include <QSpinBox>
|
|
|
|
#include <QStackedWidget>
|
|
|
|
#include <QTextEdit>
|
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QPlainTextEdit>
|
|
|
|
#include <QCompleter>
|
|
|
|
#include <QDesktopServices>
|
|
|
|
#include <QUrl>
|
2024-07-22 21:26:19 +02:00
|
|
|
#include <QIcon>
|
2024-07-23 16:31:32 +02:00
|
|
|
#include <QTabWidget>
|
2024-07-29 12:06:21 +02:00
|
|
|
#include <QDialogButtonBox>
|
2024-06-13 11:58:07 +02:00
|
|
|
|
|
|
|
#include "obs-module.h"
|
|
|
|
#include "version.h"
|
|
|
|
#include <util/dstr.h>
|
|
|
|
|
2024-06-17 14:24:45 +02:00
|
|
|
#include <sstream>
|
2024-06-17 14:31:10 +02:00
|
|
|
#include <util/platform.h>
|
2024-07-29 10:43:26 +02:00
|
|
|
#include <util/config-file.h>
|
2024-07-16 15:16:40 +02:00
|
|
|
#include "output-dialog.hpp"
|
2024-07-26 15:18:09 +02:00
|
|
|
#include "config-utils.hpp"
|
2024-06-17 14:24:45 +02:00
|
|
|
|
|
|
|
template<typename T> std::string to_string_with_precision(const T a_value, const int n = 6)
|
|
|
|
{
|
|
|
|
std::ostringstream out;
|
|
|
|
out.precision(n);
|
|
|
|
out << std::fixed << a_value;
|
|
|
|
return std::move(out).str();
|
|
|
|
}
|
|
|
|
|
2024-06-14 10:36:42 +02:00
|
|
|
void RemoveWidget(QWidget *widget);
|
|
|
|
void RemoveLayoutItem(QLayoutItem *item);
|
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
OBSBasicSettings::OBSBasicSettings(QMainWindow *parent) : QDialog(parent)
|
|
|
|
{
|
|
|
|
setMinimumWidth(983);
|
|
|
|
setMinimumHeight(480);
|
|
|
|
setWindowTitle(obs_module_text("AitumMultistreamSettings"));
|
|
|
|
setSizeGripEnabled(true);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
const auto main_window = static_cast<QMainWindow *>(obs_frontend_get_main_window());
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
listWidget = new QListWidget(this);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
listWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
|
|
|
|
listWidget->setMaximumWidth(180);
|
|
|
|
QListWidgetItem *listwidgetitem = new QListWidgetItem(listWidget);
|
2024-07-29 12:13:00 +02:00
|
|
|
listwidgetitem->setIcon(QIcon(QString::fromUtf8(":/settings/images/settings/general.svg")));
|
|
|
|
//listwidgetitem->setProperty("themeID", QVariant(QString::fromUtf8("configIconSmall")));
|
2024-10-06 21:11:02 +02:00
|
|
|
//listwidgetitem->setProperty("class", "icon-gear");
|
2024-07-29 12:13:00 +02:00
|
|
|
//cogsIcon
|
|
|
|
listwidgetitem->setText(QString::fromUtf8(obs_module_text("General")));
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 12:13:00 +02:00
|
|
|
listwidgetitem = new QListWidgetItem(listWidget);
|
2024-06-13 11:58:07 +02:00
|
|
|
listwidgetitem->setIcon(QIcon(QString::fromUtf8(":/settings/images/settings/stream.svg")));
|
|
|
|
listwidgetitem->setText(QString::fromUtf8(obs_module_text("MainCanvas")));
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-11 13:54:58 +02:00
|
|
|
listwidgetitem = new QListWidgetItem(listWidget);
|
|
|
|
listwidgetitem->setIcon(QIcon(QString::fromUtf8(":/settings/images/settings/stream.svg")));
|
|
|
|
listwidgetitem->setText(QString::fromUtf8(obs_module_text("VerticalCanvas")));
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
listwidgetitem = new QListWidgetItem(listWidget);
|
|
|
|
listwidgetitem->setIcon(main_window->property("defaultIcon").value<QIcon>());
|
|
|
|
listwidgetitem->setText(QString::fromUtf8(obs_module_text("SetupTroubleshooter")));
|
2024-07-29 16:00:01 +02:00
|
|
|
listwidgetitem->setHidden(true);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
listwidgetitem = new QListWidgetItem(listWidget);
|
|
|
|
listwidgetitem->setIcon(main_window->property("defaultIcon").value<QIcon>());
|
|
|
|
listwidgetitem->setText(QString::fromUtf8(obs_module_text("Help")));
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 16:00:01 +02:00
|
|
|
listwidgetitem = new QListWidgetItem(listWidget);
|
|
|
|
listwidgetitem->setIcon(QIcon(QString::fromUtf8(":/aitum/media/aitum.png")));
|
|
|
|
listwidgetitem->setText(QString::fromUtf8(obs_module_text("SupportButton")));
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
listWidget->setCurrentRow(0);
|
|
|
|
listWidget->setSpacing(1);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
auto settingsPages = new QStackedWidget;
|
|
|
|
settingsPages->setContentsMargins(0, 0, 0, 0);
|
|
|
|
settingsPages->setFrameShape(QFrame::NoFrame);
|
|
|
|
settingsPages->setLineWidth(0);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 12:13:00 +02:00
|
|
|
QWidget *generalPage = new QWidget;
|
2024-07-29 12:43:29 +02:00
|
|
|
auto generalPageLayout = new QVBoxLayout;
|
|
|
|
generalPage->setLayout(generalPageLayout);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 12:43:29 +02:00
|
|
|
auto infoBox = ConfigUtils::generateSettingsGroupBox(QString::fromUtf8(obs_module_text("WelcomeTitle")));
|
|
|
|
infoBox->setStyleSheet("padding-top: 12px");
|
|
|
|
auto infoLayout = new QVBoxLayout;
|
|
|
|
infoBox->setLayout(infoLayout);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 12:43:29 +02:00
|
|
|
auto infoLabel = new QLabel(QString::fromUtf8(obs_module_text("WelcomeText")));
|
|
|
|
infoLabel->setWordWrap(true);
|
|
|
|
infoLayout->addWidget(infoLabel, 1);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 12:43:29 +02:00
|
|
|
auto buttonGroupBox = new QWidget();
|
|
|
|
auto buttonLayout = new QHBoxLayout;
|
|
|
|
buttonLayout->setSpacing(8);
|
|
|
|
buttonLayout->setAlignment(Qt::AlignCenter);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 13:21:27 +02:00
|
|
|
generalMainButton = ConfigUtils::generateMenuButton(QString::fromUtf8(obs_module_text("SettingsMainOutputsButton")),
|
2024-07-29 16:44:28 +02:00
|
|
|
QIcon(QString::fromUtf8(":/settings/images/settings/stream.svg")));
|
2024-07-29 13:21:27 +02:00
|
|
|
generalVerticalButton = ConfigUtils::generateMenuButton(QString::fromUtf8(obs_module_text("SettingsVerticalOutputsButton")),
|
2024-07-29 16:44:28 +02:00
|
|
|
QIcon(QString::fromUtf8(":/settings/images/settings/stream.svg")));
|
2024-07-29 13:21:27 +02:00
|
|
|
generalHelpButton = ConfigUtils::generateMenuButton(QString::fromUtf8(obs_module_text("SettingsHelpButton")),
|
2024-07-29 16:44:28 +02:00
|
|
|
main_window->property("defaultIcon").value<QIcon>());
|
2024-07-29 16:00:01 +02:00
|
|
|
generalSupportAitumButton = ConfigUtils::generateMenuButton(QString::fromUtf8(obs_module_text("SupportButton")),
|
2024-07-29 16:44:28 +02:00
|
|
|
QIcon(QString::fromUtf8(":/aitum/media/aitum.png")));
|
|
|
|
|
2024-07-29 13:21:27 +02:00
|
|
|
buttonLayout->addWidget(generalMainButton, 0);
|
|
|
|
buttonLayout->addWidget(generalVerticalButton, 0);
|
|
|
|
buttonLayout->addWidget(generalHelpButton, 0);
|
2024-07-29 16:00:01 +02:00
|
|
|
buttonLayout->addWidget(generalSupportAitumButton, 0);
|
2024-07-29 13:21:27 +02:00
|
|
|
|
2024-07-29 16:00:01 +02:00
|
|
|
buttonGroupBox->setLayout(buttonLayout);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 12:43:29 +02:00
|
|
|
generalPageLayout->addWidget(infoBox, 0);
|
|
|
|
generalPageLayout->addWidget(buttonGroupBox, 1);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 12:13:00 +02:00
|
|
|
QScrollArea *scrollArea = new QScrollArea;
|
|
|
|
scrollArea->setWidget(generalPage);
|
|
|
|
scrollArea->setWidgetResizable(true);
|
|
|
|
scrollArea->setLineWidth(0);
|
|
|
|
scrollArea->setFrameShape(QFrame::NoFrame);
|
|
|
|
settingsPages->addWidget(scrollArea);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
auto mainOutputsPage = new QGroupBox;
|
2024-06-14 09:28:34 +02:00
|
|
|
mainOutputsPage->setProperty("customTitle", QVariant(true));
|
|
|
|
mainOutputsPage->setStyleSheet(QString("QGroupBox[customTitle=\"true\"]{ padding-top: 4px;}"));
|
2024-06-13 11:58:07 +02:00
|
|
|
mainOutputsPage->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 12:13:00 +02:00
|
|
|
scrollArea = new QScrollArea;
|
2024-06-13 11:58:07 +02:00
|
|
|
scrollArea->setWidget(mainOutputsPage);
|
|
|
|
scrollArea->setWidgetResizable(true);
|
|
|
|
scrollArea->setLineWidth(0);
|
|
|
|
scrollArea->setFrameShape(QFrame::NoFrame);
|
|
|
|
settingsPages->addWidget(scrollArea);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-11 13:54:58 +02:00
|
|
|
auto verticalOutputsPage = new QGroupBox;
|
|
|
|
verticalOutputsPage->setProperty("customTitle", QVariant(true));
|
|
|
|
verticalOutputsPage->setStyleSheet(QString("QGroupBox[customTitle=\"true\"]{ padding-top: 4px;}"));
|
|
|
|
verticalOutputsPage->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
scrollArea = new QScrollArea;
|
|
|
|
scrollArea->setWidget(verticalOutputsPage);
|
|
|
|
scrollArea->setWidgetResizable(true);
|
|
|
|
scrollArea->setLineWidth(0);
|
|
|
|
scrollArea->setFrameShape(QFrame::NoFrame);
|
2024-07-11 13:54:58 +02:00
|
|
|
settingsPages->addWidget(scrollArea);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-17 14:24:45 +02:00
|
|
|
troubleshooterText = new QTextEdit;
|
|
|
|
troubleshooterText->setReadOnly(true);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
scrollArea = new QScrollArea;
|
2024-06-17 14:24:45 +02:00
|
|
|
scrollArea->setWidget(troubleshooterText);
|
2024-06-13 11:58:07 +02:00
|
|
|
scrollArea->setWidgetResizable(true);
|
|
|
|
scrollArea->setLineWidth(0);
|
|
|
|
scrollArea->setFrameShape(QFrame::NoFrame);
|
|
|
|
settingsPages->addWidget(scrollArea);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-31 15:24:39 +02:00
|
|
|
// Help page
|
2024-06-13 11:58:07 +02:00
|
|
|
auto helpPage = new QWidget;
|
2024-07-31 15:24:39 +02:00
|
|
|
auto helpPageLayout = new QVBoxLayout;
|
|
|
|
helpPage->setLayout(helpPageLayout);
|
2024-06-13 11:58:07 +02:00
|
|
|
scrollArea = new QScrollArea;
|
|
|
|
scrollArea->setWidget(helpPage);
|
|
|
|
scrollArea->setWidgetResizable(true);
|
|
|
|
scrollArea->setLineWidth(0);
|
|
|
|
scrollArea->setFrameShape(QFrame::NoFrame);
|
2024-08-02 08:01:36 +02:00
|
|
|
|
2024-07-31 15:24:39 +02:00
|
|
|
auto helpInfoBox = ConfigUtils::generateSettingsGroupBox(QString::fromUtf8(obs_module_text("HelpTitle")));
|
|
|
|
helpInfoBox->setStyleSheet("padding-top: 12px");
|
|
|
|
auto helpLayout = new QVBoxLayout;
|
|
|
|
helpInfoBox->setLayout(helpLayout);
|
2024-08-02 08:01:36 +02:00
|
|
|
|
2024-07-31 15:24:39 +02:00
|
|
|
auto helpLabel = new QLabel(QString::fromUtf8(obs_module_text("HelpText")));
|
|
|
|
helpLabel->setStyleSheet("font-size: 14px");
|
|
|
|
helpLabel->setWordWrap(true);
|
|
|
|
helpLabel->setTextFormat(Qt::RichText);
|
|
|
|
helpLabel->setOpenExternalLinks(true);
|
|
|
|
helpLayout->addWidget(helpLabel, 1);
|
|
|
|
helpPageLayout->addWidget(helpInfoBox, 1, Qt::AlignTop);
|
2024-08-02 08:01:36 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
settingsPages->addWidget(scrollArea);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
//mainOutputsPage
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
mainOutputsLayout = new QFormLayout;
|
|
|
|
mainOutputsLayout->setContentsMargins(9, 2, 9, 9);
|
|
|
|
mainOutputsLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
mainOutputsLayout->setLabelAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
auto streaming_title_layout = new QHBoxLayout;
|
|
|
|
auto streaming_title = new QLabel(QString::fromUtf8(obs_module_text("MainCanvas")));
|
|
|
|
streaming_title->setStyleSheet(QString::fromUtf8("font-weight: bold;"));
|
|
|
|
streaming_title_layout->addWidget(streaming_title, 0, Qt::AlignLeft);
|
|
|
|
//auto guide_link = new QLabel(QString::fromUtf8("<a href=\"https://l.aitum.tv/vh-streaming-settings\">") + QString::fromUtf8(obs_module_text("ViewGuide")) + QString::fromUtf8("</a>"));
|
|
|
|
//guide_link->setOpenExternalLinks(true);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
auto addButton = new QPushButton(QIcon(":/res/images/plus.svg"), QString::fromUtf8(obs_module_text("AddOutput")));
|
|
|
|
addButton->setProperty("themeID", QVariant(QString::fromUtf8("addIconSmall")));
|
2024-10-06 21:11:02 +02:00
|
|
|
addButton->setProperty("class", "icon-plus");
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-18 18:27:42 +02:00
|
|
|
connect(addButton, &QPushButton::clicked, [this] {
|
2024-07-31 11:08:09 +02:00
|
|
|
QStringList otherNames;
|
2024-08-02 08:23:34 +02:00
|
|
|
auto main_outputs = obs_data_get_array(main_settings, "outputs");
|
2024-07-31 11:08:09 +02:00
|
|
|
obs_data_array_enum(
|
2024-08-02 08:23:34 +02:00
|
|
|
main_outputs,
|
2024-08-02 08:01:36 +02:00
|
|
|
[](obs_data_t *data2, void *param) {
|
|
|
|
((QStringList *)param)->append(QString::fromUtf8(obs_data_get_string(data2, "name")));
|
2024-07-31 11:08:09 +02:00
|
|
|
},
|
|
|
|
&otherNames);
|
2024-08-02 08:23:34 +02:00
|
|
|
obs_data_array_release(main_outputs);
|
2024-07-31 11:08:09 +02:00
|
|
|
otherNames.removeDuplicates();
|
|
|
|
auto outputDialog = new OutputDialog(this, otherNames);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-16 20:52:59 +02:00
|
|
|
outputDialog->setWindowModality(Qt::WindowModal);
|
|
|
|
outputDialog->setModal(true);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-16 15:16:40 +02:00
|
|
|
if (outputDialog->exec() == QDialog::Accepted) {
|
2024-07-18 16:18:56 +02:00
|
|
|
// create a new output
|
2024-08-02 08:01:36 +02:00
|
|
|
if (!main_settings)
|
2024-07-18 16:18:56 +02:00
|
|
|
return;
|
2024-08-02 08:01:36 +02:00
|
|
|
auto outputs = obs_data_get_array(main_settings, "outputs");
|
2024-07-18 16:18:56 +02:00
|
|
|
if (!outputs) {
|
|
|
|
outputs = obs_data_array_create();
|
2024-08-02 08:01:36 +02:00
|
|
|
obs_data_set_array(main_settings, "outputs", outputs);
|
2024-07-18 16:18:56 +02:00
|
|
|
}
|
|
|
|
auto s = obs_data_create();
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-18 16:18:56 +02:00
|
|
|
// Set the info from the output dialog
|
|
|
|
obs_data_set_string(s, "name", outputDialog->outputName.toUtf8().constData());
|
|
|
|
obs_data_set_string(s, "stream_server", outputDialog->outputServer.toUtf8().constData());
|
|
|
|
obs_data_set_string(s, "stream_key", outputDialog->outputKey.toUtf8().constData());
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-18 16:18:56 +02:00
|
|
|
obs_data_array_push_back(outputs, s);
|
2024-07-18 19:32:31 +02:00
|
|
|
AddServer(mainOutputsLayout, s, outputs);
|
2024-07-18 16:18:56 +02:00
|
|
|
obs_data_array_release(outputs);
|
|
|
|
obs_data_release(s);
|
2024-07-16 15:16:40 +02:00
|
|
|
}
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-16 15:16:40 +02:00
|
|
|
delete outputDialog;
|
|
|
|
});
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
//streaming_title_layout->addWidget(guide_link, 0, Qt::AlignRight);
|
|
|
|
streaming_title_layout->addWidget(addButton, 0, Qt::AlignRight);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
mainOutputsLayout->addRow(streaming_title_layout);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
auto serverGroup = new QGroupBox;
|
|
|
|
serverGroup->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
|
|
|
|
serverGroup->setStyleSheet(QString("QGroupBox{background-color: %1; padding-top: 4px;}")
|
2024-07-29 16:44:28 +02:00
|
|
|
.arg(palette().color(QPalette::ColorRole::Mid).name(QColor::HexRgb)));
|
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
auto serverLayout = new QFormLayout;
|
|
|
|
serverLayout->setContentsMargins(9, 2, 9, 9);
|
|
|
|
serverLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
serverLayout->setLabelAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-16 15:16:40 +02:00
|
|
|
auto mainTitle = new QLabel(QString::fromUtf8(obs_module_text("SettingsMainCanvasTitle")));
|
2024-07-29 12:43:29 +02:00
|
|
|
mainTitle->setStyleSheet("font-weight: bold;");
|
2024-07-16 15:16:40 +02:00
|
|
|
serverLayout->addRow(mainTitle);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-16 15:16:40 +02:00
|
|
|
auto mainDescription = new QLabel(QString::fromUtf8(obs_module_text("SettingsMainCanvasDescription")));
|
2024-07-23 09:28:13 +02:00
|
|
|
// mainTitle->setStyleSheet(QString::fromUtf8("font-weight: bold;"));
|
2024-07-16 15:16:40 +02:00
|
|
|
serverLayout->addRow(mainDescription);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
serverGroup->setLayout(serverLayout);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
mainOutputsLayout->addRow(serverGroup);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
mainOutputsPage->setLayout(mainOutputsLayout);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-11 13:54:58 +02:00
|
|
|
verticalOutputsLayout = new QFormLayout;
|
|
|
|
verticalOutputsLayout->setContentsMargins(9, 2, 9, 9);
|
|
|
|
verticalOutputsLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
verticalOutputsLayout->setLabelAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-11 13:54:58 +02:00
|
|
|
streaming_title_layout = new QHBoxLayout;
|
|
|
|
streaming_title = new QLabel(QString::fromUtf8(obs_module_text("VerticalCanvas")));
|
|
|
|
streaming_title->setStyleSheet(QString::fromUtf8("font-weight: bold;"));
|
|
|
|
streaming_title_layout->addWidget(streaming_title, 0, Qt::AlignLeft);
|
|
|
|
//auto guide_link = new QLabel(QString::fromUtf8("<a href=\"https://l.aitum.tv/vh-streaming-settings\">") + QString::fromUtf8(obs_module_text("ViewGuide")) + QString::fromUtf8("</a>"));
|
|
|
|
//guide_link->setOpenExternalLinks(true);
|
2024-07-23 09:28:13 +02:00
|
|
|
// addButton = new QPushButton(QIcon(":/res/images/plus.svg"), QString::fromUtf8(obs_module_text("AddOutput")));
|
|
|
|
// addButton->setProperty("themeID", QVariant(QString::fromUtf8("addIconSmall")));
|
2024-10-06 21:11:02 +02:00
|
|
|
// addButton->setProperty("class", "icon-plus");
|
2024-07-23 09:28:13 +02:00
|
|
|
// connect(addButton, &QPushButton::clicked, [this] {
|
|
|
|
// if (!vertical_outputs)
|
|
|
|
// return;
|
|
|
|
// auto s = obs_data_create();
|
|
|
|
// obs_data_set_string(s, "name", obs_module_text("Unnamed"));
|
|
|
|
// obs_data_array_push_back(vertical_outputs, s);
|
|
|
|
// AddServer(verticalOutputsLayout, s);
|
|
|
|
// obs_data_release(s);
|
|
|
|
// });
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-18 19:32:31 +02:00
|
|
|
verticalAddButton = new QPushButton(QIcon(":/res/images/plus.svg"), QString::fromUtf8(obs_module_text("AddOutput")));
|
|
|
|
verticalAddButton->setProperty("themeID", QVariant(QString::fromUtf8("addIconSmall")));
|
2024-10-06 21:11:02 +02:00
|
|
|
verticalAddButton->setProperty("class", "icon-plus");
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-18 19:32:31 +02:00
|
|
|
connect(verticalAddButton, &QPushButton::clicked, [this] {
|
2024-07-31 11:08:09 +02:00
|
|
|
QStringList otherNames;
|
|
|
|
obs_data_array_enum(
|
|
|
|
vertical_outputs,
|
2024-08-02 08:01:36 +02:00
|
|
|
[](obs_data_t *data2, void *param) {
|
|
|
|
((QStringList *)param)->append(QString::fromUtf8(obs_data_get_string(data2, "name")));
|
2024-07-31 11:08:09 +02:00
|
|
|
},
|
|
|
|
&otherNames);
|
|
|
|
otherNames.removeDuplicates();
|
|
|
|
auto outputDialog = new OutputDialog(this, otherNames);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-18 18:27:42 +02:00
|
|
|
outputDialog->setWindowModality(Qt::WindowModal);
|
|
|
|
outputDialog->setModal(true);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-18 18:27:42 +02:00
|
|
|
if (outputDialog->exec() == QDialog::Accepted) {
|
|
|
|
// create a new output
|
|
|
|
if (!vertical_outputs)
|
|
|
|
return;
|
|
|
|
auto s = obs_data_create();
|
2024-08-03 09:22:08 +02:00
|
|
|
obs_data_set_bool(s, "enabled", true);
|
2024-07-18 18:27:42 +02:00
|
|
|
obs_data_set_string(s, "name", outputDialog->outputName.toUtf8().constData());
|
|
|
|
obs_data_set_string(s, "stream_server", outputDialog->outputServer.toUtf8().constData());
|
|
|
|
obs_data_set_string(s, "stream_key", outputDialog->outputKey.toUtf8().constData());
|
|
|
|
obs_data_array_push_back(vertical_outputs, s);
|
2024-07-18 19:32:31 +02:00
|
|
|
AddServer(verticalOutputsLayout, s, vertical_outputs);
|
2024-07-18 18:27:42 +02:00
|
|
|
obs_data_release(s);
|
|
|
|
}
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-18 18:27:42 +02:00
|
|
|
delete outputDialog;
|
2024-07-11 13:54:58 +02:00
|
|
|
});
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-18 19:32:31 +02:00
|
|
|
streaming_title_layout->addWidget(verticalAddButton, 0, Qt::AlignRight);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-11 13:54:58 +02:00
|
|
|
verticalOutputsLayout->addRow(streaming_title_layout);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-11 13:54:58 +02:00
|
|
|
verticalOutputsPage->setLayout(verticalOutputsLayout);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 16:00:01 +02:00
|
|
|
// Support page
|
|
|
|
QWidget *supportPage = new QWidget;
|
|
|
|
auto supportPageLayout = new QVBoxLayout;
|
|
|
|
supportPage->setLayout(supportPageLayout);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 16:00:01 +02:00
|
|
|
auto supportInfoBox = ConfigUtils::generateSettingsGroupBox(QString::fromUtf8(obs_module_text("SupportTitle")));
|
|
|
|
supportInfoBox->setStyleSheet("padding-top: 12px");
|
|
|
|
auto supportLayout = new QVBoxLayout;
|
|
|
|
supportInfoBox->setLayout(supportLayout);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 16:00:01 +02:00
|
|
|
auto supportLabel = new QLabel(QString::fromUtf8(obs_module_text("SupportText")));
|
|
|
|
supportLabel->setStyleSheet("font-size: 14px");
|
|
|
|
supportLabel->setWordWrap(true);
|
|
|
|
supportLabel->setTextFormat(Qt::RichText);
|
|
|
|
supportLabel->setOpenExternalLinks(true);
|
|
|
|
supportLayout->addWidget(supportLabel, 1);
|
|
|
|
supportPageLayout->addWidget(supportInfoBox, 1, Qt::AlignTop);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 16:00:01 +02:00
|
|
|
settingsPages->addWidget(supportPage);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 16:00:01 +02:00
|
|
|
///
|
2024-06-13 11:58:07 +02:00
|
|
|
const auto version =
|
|
|
|
new QLabel(QString::fromUtf8(obs_module_text("Version")) + " " + QString::fromUtf8(PROJECT_VERSION) + " " +
|
|
|
|
QString::fromUtf8(obs_module_text("MadeBy")) + " <a href=\"https://aitum.tv\">Aitum</a>");
|
|
|
|
version->setOpenExternalLinks(true);
|
|
|
|
version->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-18 08:34:29 +02:00
|
|
|
newVersion = new QLabel;
|
|
|
|
newVersion->setProperty("themeID", "warning");
|
2024-11-01 15:40:17 +01:00
|
|
|
newVersion->setProperty("class", "text-warning");
|
2024-06-18 08:34:29 +02:00
|
|
|
newVersion->setVisible(false);
|
|
|
|
newVersion->setOpenExternalLinks(true);
|
|
|
|
newVersion->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 12:06:21 +02:00
|
|
|
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 12:06:21 +02:00
|
|
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
|
|
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
QHBoxLayout *bottomLayout = new QHBoxLayout;
|
|
|
|
bottomLayout->addWidget(version, 1, Qt::AlignLeft);
|
2024-06-18 08:34:29 +02:00
|
|
|
bottomLayout->addWidget(newVersion, 1, Qt::AlignLeft);
|
2024-07-29 12:06:21 +02:00
|
|
|
bottomLayout->addWidget(buttonBox, 0, Qt::AlignRight);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
QHBoxLayout *contentLayout = new QHBoxLayout;
|
|
|
|
contentLayout->addWidget(listWidget);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
contentLayout->addWidget(settingsPages, 1);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
listWidget->connect(listWidget, &QListWidget::currentRowChanged, settingsPages, &QStackedWidget::setCurrentIndex);
|
2024-07-29 12:43:29 +02:00
|
|
|
listWidget->setCurrentRow(0);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
QVBoxLayout *vlayout = new QVBoxLayout;
|
|
|
|
vlayout->setContentsMargins(11, 11, 11, 11);
|
|
|
|
vlayout->addLayout(contentLayout);
|
|
|
|
vlayout->addLayout(bottomLayout);
|
|
|
|
setLayout(vlayout);
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 12:43:29 +02:00
|
|
|
// Button connects for general page, clean this up in the future when we abstract pages
|
2024-07-29 13:21:27 +02:00
|
|
|
connect(generalMainButton, &QPushButton::clicked, [this] { listWidget->setCurrentRow(1); });
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 13:21:27 +02:00
|
|
|
connect(generalVerticalButton, &QPushButton::clicked, [this] { listWidget->setCurrentRow(2); });
|
2024-07-29 16:44:28 +02:00
|
|
|
|
2024-07-29 16:00:01 +02:00
|
|
|
connect(generalHelpButton, &QPushButton::clicked, [this] { listWidget->setCurrentRow(listWidget->count() - 2); });
|
2024-07-29 13:21:27 +02:00
|
|
|
|
2024-07-29 16:44:28 +02:00
|
|
|
connect(generalSupportAitumButton, &QPushButton::clicked, [this] { listWidget->setCurrentRow(listWidget->count() - 1); });
|
2024-06-13 11:58:07 +02:00
|
|
|
}
|
|
|
|
|
2024-06-14 13:08:14 +02:00
|
|
|
OBSBasicSettings::~OBSBasicSettings()
|
|
|
|
{
|
2024-07-11 13:54:58 +02:00
|
|
|
if (vertical_outputs)
|
|
|
|
obs_data_array_release(vertical_outputs);
|
2024-07-30 21:10:13 +02:00
|
|
|
for (auto it = video_encoder_properties.begin(); it != video_encoder_properties.end(); it++)
|
|
|
|
obs_properties_destroy(it->second);
|
|
|
|
for (auto it = audio_encoder_properties.begin(); it != audio_encoder_properties.end(); it++)
|
2024-06-14 13:08:14 +02:00
|
|
|
obs_properties_destroy(it->second);
|
|
|
|
}
|
2024-06-13 11:58:07 +02:00
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetGeneralIcon() const
|
|
|
|
{
|
|
|
|
return listWidget->item(0)->icon();
|
|
|
|
}
|
|
|
|
|
2024-08-26 12:08:12 +02:00
|
|
|
QIcon OBSBasicSettings::GetAppearanceIcon() const
|
|
|
|
{
|
|
|
|
return QIcon();
|
|
|
|
}
|
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
QIcon OBSBasicSettings::GetStreamIcon() const
|
|
|
|
{
|
|
|
|
return listWidget->item(1)->icon();
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetOutputIcon() const
|
|
|
|
{
|
|
|
|
return QIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetAudioIcon() const
|
|
|
|
{
|
|
|
|
return QIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetVideoIcon() const
|
|
|
|
{
|
|
|
|
return QIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetHotkeysIcon() const
|
|
|
|
{
|
|
|
|
return QIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetAccessibilityIcon() const
|
|
|
|
{
|
|
|
|
return QIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetAdvancedIcon() const
|
|
|
|
{
|
|
|
|
return QIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetGeneralIcon(const QIcon &icon)
|
|
|
|
{
|
2024-07-29 12:13:00 +02:00
|
|
|
listWidget->item(0)->setIcon(icon);
|
2024-06-13 11:58:07 +02:00
|
|
|
}
|
|
|
|
|
2024-08-26 12:08:12 +02:00
|
|
|
void OBSBasicSettings::SetAppearanceIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
UNUSED_PARAMETER(icon);
|
|
|
|
}
|
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
void OBSBasicSettings::SetStreamIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
listWidget->item(1)->setIcon(icon);
|
2024-07-29 12:13:00 +02:00
|
|
|
listWidget->item(2)->setIcon(icon);
|
2024-07-29 13:21:27 +02:00
|
|
|
generalVerticalButton->setIcon(icon);
|
|
|
|
generalMainButton->setIcon(icon);
|
2024-06-13 11:58:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetOutputIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
UNUSED_PARAMETER(icon);
|
2024-07-29 12:13:00 +02:00
|
|
|
//listWidget->item(2)->setIcon(icon);
|
2024-06-13 11:58:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetAudioIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
UNUSED_PARAMETER(icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetVideoIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
UNUSED_PARAMETER(icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetHotkeysIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
UNUSED_PARAMETER(icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetAccessibilityIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
UNUSED_PARAMETER(icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetAdvancedIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
UNUSED_PARAMETER(icon);
|
|
|
|
}
|
|
|
|
|
2024-07-18 19:32:31 +02:00
|
|
|
void OBSBasicSettings::AddServer(QFormLayout *outputsLayout, obs_data_t *settings, obs_data_array_t *outputs)
|
2024-06-13 11:58:07 +02:00
|
|
|
{
|
|
|
|
auto serverGroup = new QGroupBox;
|
|
|
|
serverGroup->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
|
|
|
|
serverGroup->setProperty("altColor", QVariant(true));
|
2024-06-14 17:37:45 +02:00
|
|
|
serverGroup->setProperty("customTitle", QVariant(true));
|
|
|
|
serverGroup->setStyleSheet(
|
|
|
|
QString("QGroupBox[altColor=\"true\"]{background-color: %1;} QGroupBox[customTitle=\"true\"]{padding-top: 4px;}")
|
|
|
|
.arg(palette().color(QPalette::ColorRole::Mid).name(QColor::HexRgb)));
|
2024-06-13 11:58:07 +02:00
|
|
|
|
|
|
|
auto serverLayout = new QFormLayout;
|
2024-07-22 21:26:19 +02:00
|
|
|
serverLayout->setContentsMargins(9, 2, 9, 2);
|
2024-07-23 09:28:13 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
serverLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
serverLayout->setLabelAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
|
|
|
|
2024-07-22 21:26:19 +02:00
|
|
|
// Title
|
2024-06-13 11:58:07 +02:00
|
|
|
auto server_title_layout = new QHBoxLayout;
|
2024-07-23 09:28:13 +02:00
|
|
|
|
2024-07-22 21:26:19 +02:00
|
|
|
auto platformIconLabel = new QLabel;
|
2024-07-29 10:43:26 +02:00
|
|
|
auto platformIcon =
|
|
|
|
ConfigUtils::getPlatformIconFromEndpoint(QString::fromUtf8(obs_data_get_string(settings, "stream_server")));
|
2024-11-15 19:36:00 +01:00
|
|
|
platformIconLabel->setPixmap(platformIcon.pixmap(36, 36));
|
2024-07-22 21:26:19 +02:00
|
|
|
server_title_layout->addWidget(platformIconLabel, 0);
|
2024-07-23 09:28:13 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
auto streaming_title = new QLabel(QString::fromUtf8(obs_data_get_string(settings, "name")));
|
|
|
|
streaming_title->setStyleSheet(QString::fromUtf8("font-weight: bold;"));
|
2024-07-22 21:26:19 +02:00
|
|
|
server_title_layout->addWidget(streaming_title, 1, Qt::AlignLeft);
|
2024-06-13 11:58:07 +02:00
|
|
|
|
2024-07-22 21:26:19 +02:00
|
|
|
// Advanced settings
|
2024-06-13 11:58:07 +02:00
|
|
|
const bool advanced = obs_data_get_bool(settings, "advanced");
|
2024-07-23 16:31:32 +02:00
|
|
|
auto advancedGroup = new QGroupBox(QString::fromUtf8(obs_module_text("AdvancedGroupHeader")));
|
|
|
|
advancedGroup->setContentsMargins(0, 4, 0, 0);
|
2024-07-24 11:44:30 +02:00
|
|
|
|
|
|
|
advancedGroup->setProperty("customTitle", QVariant(true));
|
|
|
|
advancedGroup->setStyleSheet(
|
|
|
|
"QGroupBox[customTitle=\"true\"]::title { subcontrol-origin: margin; subcontrol-position: top right; padding: 12px 18px 0 0; }"
|
|
|
|
"QGroupBox[customTitle=\"true\"] { padding-top: 4px; padding-bottom: 0;}");
|
|
|
|
if (!advanced)
|
|
|
|
advancedGroup->setVisible(false);
|
2024-06-13 11:58:07 +02:00
|
|
|
|
2024-07-23 16:31:32 +02:00
|
|
|
auto advancedGroupLayout = new QVBoxLayout;
|
|
|
|
advancedGroup->setLayout(advancedGroupLayout);
|
2024-07-24 11:44:30 +02:00
|
|
|
|
2024-07-23 16:31:32 +02:00
|
|
|
// Tab widget
|
2024-07-23 20:49:03 +02:00
|
|
|
// 1 = bg for active tab + pane, 2 = inactive tabs, 3 = tab text colour, 4 = border colour for pane
|
2024-07-24 11:44:30 +02:00
|
|
|
auto tabStyles =
|
|
|
|
QString("QTabWidget::pane { background: %1; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-right-radius: 4px; margin-top: -1px; padding-top: 8px; border: 1px solid %4; } QTabWidget::tab-bar { margin-bottom: 0; padding-bottom: 0; border-color: %4; } QTabBar::tab { color: %3; padding: 10px; margin-bottom: 0; border: 1px solid %4; } QTabBar::tab:selected { background: %1; font-weight: bold; border-bottom: none; } QTabBar::tab:!selected { background: %2; }")
|
|
|
|
.arg(palette().color(QPalette::ColorRole::Mid).name(QColor::HexRgb),
|
|
|
|
palette().color(QPalette::ColorRole::Light).name(QColor::HexRgb),
|
|
|
|
palette().color(QPalette::ColorRole::Text).name(QColor::HexRgb),
|
|
|
|
palette().color(QPalette::ColorRole::Light).name(QColor::HexRgb));
|
|
|
|
|
2024-07-23 16:31:32 +02:00
|
|
|
auto advancedTabWidget = new QTabWidget;
|
|
|
|
advancedTabWidget->setContentsMargins(0, 0, 0, 0);
|
|
|
|
advancedTabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
2024-07-23 20:49:03 +02:00
|
|
|
advancedTabWidget->setStyleSheet(tabStyles);
|
2024-07-24 11:44:30 +02:00
|
|
|
// advancedTabWidget->setStyleSheet("QTabWidget::tab-bar { border: 1px solid gray; }"
|
|
|
|
// "QTabBar::tab { background: gray; color: white; padding: 10px; }"
|
|
|
|
// "QTabBar::tab:selected { background: lightgray; }"
|
|
|
|
// "QTabWidget::pane { border: none; background: pink; }");
|
|
|
|
|
|
|
|
// auto pageStyle = QString("QWidget[page=\"true\"] { border: 1px solid %1; padding-top: 0; margin-top: 0; }")
|
|
|
|
// .arg(QPalette().color(QPalette::ColorRole::Mid).name(QColor::HexRgb));
|
|
|
|
//
|
2024-07-23 16:31:32 +02:00
|
|
|
auto videoPage = new QWidget;
|
|
|
|
videoPage->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
2024-07-24 11:44:30 +02:00
|
|
|
// videoPage->setStyleSheet(pageStyle);
|
|
|
|
// videoPage->setProperty("page", true);
|
2024-07-23 16:31:32 +02:00
|
|
|
auto videoPageLayout = new QFormLayout;
|
|
|
|
videoPage->setLayout(videoPageLayout);
|
2024-07-24 11:44:30 +02:00
|
|
|
|
2024-07-23 16:31:32 +02:00
|
|
|
auto audioPage = new QWidget;
|
|
|
|
audioPage->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
2024-07-24 11:44:30 +02:00
|
|
|
// audioPage->setStyleSheet(pageStyle);
|
|
|
|
// audioPage->setProperty("page", true);
|
2024-07-23 16:31:32 +02:00
|
|
|
auto audioPageLayout = new QFormLayout;
|
|
|
|
audioPage->setLayout(audioPageLayout);
|
2024-07-24 11:44:30 +02:00
|
|
|
|
2024-08-02 08:23:34 +02:00
|
|
|
const bool main = outputsLayout == mainOutputsLayout;
|
|
|
|
|
2024-07-23 16:31:32 +02:00
|
|
|
// VIDEO ENCODER
|
2024-06-13 11:58:07 +02:00
|
|
|
auto videoEncoder = new QComboBox;
|
2024-08-02 08:50:25 +02:00
|
|
|
videoEncoder->addItem(QString::fromUtf8(obs_module_text(main ? "MainEncoder" : "VerticalEncoder")),
|
|
|
|
QVariant(QString::fromUtf8("")));
|
2024-08-02 08:23:34 +02:00
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
videoEncoder->setCurrentIndex(0);
|
2024-07-23 16:31:32 +02:00
|
|
|
videoPageLayout->addRow(QString::fromUtf8(obs_module_text("VideoEncoder")), videoEncoder);
|
2024-06-13 11:58:07 +02:00
|
|
|
|
2024-07-29 16:13:22 +02:00
|
|
|
bool allEmpty = false;
|
2024-08-02 08:01:36 +02:00
|
|
|
QComboBox *videoEncoderIndex = nullptr;
|
|
|
|
if (main) {
|
|
|
|
videoEncoderIndex = new QComboBox;
|
|
|
|
for (int i = 0; i < MAX_OUTPUT_VIDEO_ENCODERS; i++) {
|
|
|
|
QString settingName = QString::fromUtf8("video_encoder_description") + QString::number(i);
|
|
|
|
auto description = obs_data_get_string(main_settings, settingName.toUtf8().constData());
|
|
|
|
if (!description || description[0] == '\0') {
|
|
|
|
if (i != 0 && !allEmpty) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
allEmpty = true;
|
2024-07-29 16:13:22 +02:00
|
|
|
}
|
2024-08-02 08:01:36 +02:00
|
|
|
videoEncoderIndex->addItem(QString::number(i + 1) + " " + description);
|
2024-07-29 16:13:22 +02:00
|
|
|
}
|
2024-08-02 08:01:36 +02:00
|
|
|
videoEncoderIndex->setCurrentIndex((int)obs_data_get_int(settings, "video_encoder_index"));
|
2024-06-13 11:58:07 +02:00
|
|
|
|
2024-08-02 08:01:36 +02:00
|
|
|
connect(videoEncoderIndex, &QComboBox::currentIndexChanged, [videoEncoderIndex, settings] {
|
|
|
|
if (videoEncoderIndex->currentIndex() >= 0)
|
|
|
|
obs_data_set_int(settings, "video_encoder_index", videoEncoderIndex->currentIndex());
|
|
|
|
});
|
|
|
|
videoPageLayout->addRow(QString::fromUtf8(obs_module_text("VideoEncoderIndex")), videoEncoderIndex);
|
|
|
|
|
|
|
|
if (videoEncoderIndex->currentIndex() != 0 ||
|
|
|
|
!config_get_bool(obs_frontend_get_profile_config(), "Stream1", "EnableMultitrackVideo"))
|
|
|
|
videoPageLayout->setRowVisible(videoEncoderIndex, false);
|
|
|
|
}
|
2024-07-29 13:01:10 +02:00
|
|
|
|
|
|
|
auto videoEncoderGroup = new QWidget();
|
2024-06-13 11:58:07 +02:00
|
|
|
videoEncoderGroup->setProperty("altColor", QVariant(true));
|
|
|
|
auto videoEncoderGroupLayout = new QFormLayout();
|
|
|
|
videoEncoderGroup->setLayout(videoEncoderGroupLayout);
|
2024-07-23 16:31:32 +02:00
|
|
|
videoPageLayout->addRow(videoEncoderGroup);
|
2024-06-13 11:58:07 +02:00
|
|
|
|
2024-07-24 11:44:30 +02:00
|
|
|
if (main) {
|
|
|
|
struct obs_video_info ovi;
|
|
|
|
obs_get_video_info(&ovi);
|
|
|
|
double fps = ovi.fps_den > 0 ? (double)ovi.fps_num / (double)ovi.fps_den : 0.0;
|
|
|
|
auto fpsDivisor = new QComboBox;
|
|
|
|
auto frd = obs_data_get_int(settings, "frame_rate_divisor");
|
|
|
|
for (int i = 1; i <= 10; i++) {
|
|
|
|
if (i == 1) {
|
|
|
|
fpsDivisor->addItem(
|
|
|
|
QString::number(fps, 'g', 3) + " " + QString::fromUtf8(obs_module_text("Original")), i);
|
|
|
|
fpsDivisor->setCurrentIndex(0);
|
|
|
|
} else {
|
|
|
|
fpsDivisor->addItem(QString::number(fps / i, 'g', 3), i);
|
|
|
|
if (frd == i) {
|
|
|
|
fpsDivisor->setCurrentIndex(fpsDivisor->count() - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
videoEncoderGroupLayout->addRow(QString::fromUtf8(obs_frontend_get_locale_string("Basic.Settings.Video.FPS")),
|
|
|
|
fpsDivisor);
|
|
|
|
//obs_encoder_get_frame_rate_divisor
|
|
|
|
|
|
|
|
auto scale = new QGroupBox(QString::fromUtf8(obs_frontend_get_locale_string("Basic.Settings.Output.Adv.Rescale")));
|
|
|
|
scale->setCheckable(true);
|
|
|
|
scale->setChecked(obs_data_get_bool(settings, "scale"));
|
|
|
|
|
|
|
|
connect(scale, &QGroupBox::toggled,
|
|
|
|
[scale, settings] { obs_data_set_bool(settings, "scale", scale->isChecked()); });
|
|
|
|
|
|
|
|
auto scaleLayout = new QFormLayout();
|
|
|
|
scale->setLayout(scaleLayout);
|
|
|
|
|
|
|
|
auto downscale = new QComboBox;
|
|
|
|
|
|
|
|
auto downscale_type = obs_data_get_int(settings, "scale_type");
|
2024-08-02 08:50:25 +02:00
|
|
|
if (downscale_type == OBS_SCALE_DISABLE) {
|
|
|
|
downscale_type = OBS_SCALE_BILINEAR;
|
|
|
|
obs_data_set_int(settings, "scale_type", downscale_type);
|
|
|
|
}
|
2024-07-24 11:44:30 +02:00
|
|
|
downscale->addItem(
|
|
|
|
QString::fromUtf8(obs_frontend_get_locale_string("Basic.Settings.Video.DownscaleFilter.Bilinear")),
|
|
|
|
OBS_SCALE_BILINEAR);
|
|
|
|
if (downscale_type == OBS_SCALE_BILINEAR)
|
2024-08-02 08:50:25 +02:00
|
|
|
downscale->setCurrentIndex(0);
|
2024-07-24 11:44:30 +02:00
|
|
|
downscale->addItem(QString::fromUtf8(obs_frontend_get_locale_string("Basic.Settings.Video.DownscaleFilter.Area")),
|
|
|
|
OBS_SCALE_AREA);
|
|
|
|
if (downscale_type == OBS_SCALE_AREA)
|
2024-08-02 08:50:25 +02:00
|
|
|
downscale->setCurrentIndex(1);
|
2024-07-24 11:44:30 +02:00
|
|
|
downscale->addItem(
|
|
|
|
QString::fromUtf8(obs_frontend_get_locale_string("Basic.Settings.Video.DownscaleFilter.Bicubic")),
|
|
|
|
OBS_SCALE_BICUBIC);
|
|
|
|
if (downscale_type == OBS_SCALE_BICUBIC)
|
2024-08-02 08:50:25 +02:00
|
|
|
downscale->setCurrentIndex(2);
|
2024-07-24 11:44:30 +02:00
|
|
|
downscale->addItem(
|
|
|
|
QString::fromUtf8(obs_frontend_get_locale_string("Basic.Settings.Video.DownscaleFilter.Lanczos")),
|
|
|
|
OBS_SCALE_LANCZOS);
|
|
|
|
if (downscale_type == OBS_SCALE_LANCZOS)
|
2024-08-02 08:50:25 +02:00
|
|
|
downscale->setCurrentIndex(3);
|
2024-07-24 11:44:30 +02:00
|
|
|
|
|
|
|
connect(downscale, &QComboBox::currentIndexChanged,
|
|
|
|
[downscale, settings] { obs_data_set_int(settings, "scale_type", downscale->currentData().toInt()); });
|
|
|
|
|
|
|
|
scaleLayout->addRow(QString::fromUtf8(obs_frontend_get_locale_string("Basic.Settings.Video.DownscaleFilter")),
|
|
|
|
downscale);
|
|
|
|
|
|
|
|
auto resolution = new QComboBox;
|
|
|
|
resolution->setEditable(true);
|
|
|
|
resolution->addItem("1280x720");
|
|
|
|
resolution->addItem("1920x1080");
|
|
|
|
resolution->addItem("2560x1440");
|
|
|
|
resolution->setCurrentText(QString::number(obs_data_get_int(settings, "width")) + "x" +
|
|
|
|
QString::number(obs_data_get_int(settings, "height")));
|
|
|
|
if (resolution->currentText() == "0x0")
|
|
|
|
resolution->setCurrentText(QString::number(ovi.output_width) + "x" + QString::number(ovi.output_height));
|
|
|
|
|
|
|
|
connect(resolution, &QComboBox::currentTextChanged, [settings, resolution] {
|
|
|
|
const auto res = resolution->currentText();
|
|
|
|
uint32_t width, height;
|
|
|
|
if (sscanf(res.toUtf8().constData(), "%dx%d", &width, &height) == 2 && width > 0 && height > 0) {
|
|
|
|
obs_data_set_int(settings, "width", width);
|
|
|
|
obs_data_set_int(settings, "height", height);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
scaleLayout->addRow(QString::fromUtf8(obs_frontend_get_locale_string("Basic.Settings.Video.ScaledResolution")),
|
|
|
|
resolution);
|
|
|
|
|
|
|
|
videoEncoderGroupLayout->addRow(scale);
|
|
|
|
}
|
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
connect(videoEncoder, &QComboBox::currentIndexChanged,
|
2024-07-23 16:31:32 +02:00
|
|
|
[this, serverGroup, advancedGroupLayout, videoPageLayout, videoEncoder, videoEncoderIndex, videoEncoderGroup,
|
2024-07-24 11:44:30 +02:00
|
|
|
videoEncoderGroupLayout, settings, videoPage, main] {
|
2024-06-13 11:58:07 +02:00
|
|
|
auto encoder_string = videoEncoder->currentData().toString().toUtf8();
|
|
|
|
auto encoder = encoder_string.constData();
|
2024-08-08 09:15:15 +02:00
|
|
|
const bool encoder_changed = strcmp(obs_data_get_string(settings, "video_encoder"), encoder) != 0;
|
|
|
|
if (encoder_changed)
|
|
|
|
obs_data_set_string(settings, "video_encoder", encoder);
|
2024-06-13 11:58:07 +02:00
|
|
|
if (!encoder || encoder[0] == '\0') {
|
2024-08-02 08:01:36 +02:00
|
|
|
if (!videoEncoderIndex) {
|
|
|
|
} else if (config_get_bool(obs_frontend_get_profile_config(), "Stream1", "EnableMultitrackVideo")) {
|
2024-07-29 10:43:26 +02:00
|
|
|
videoPageLayout->setRowVisible(videoEncoderIndex, true);
|
|
|
|
} else {
|
|
|
|
videoPageLayout->setRowVisible(videoEncoderIndex, false);
|
|
|
|
if (videoEncoderIndex->currentIndex() != 0)
|
|
|
|
videoEncoderIndex->setCurrentIndex(0);
|
|
|
|
}
|
2024-06-13 11:58:07 +02:00
|
|
|
videoEncoderGroup->setVisible(false);
|
|
|
|
} else {
|
2024-08-02 08:01:36 +02:00
|
|
|
if (videoEncoderIndex)
|
|
|
|
videoPageLayout->setRowVisible(videoEncoderIndex, false);
|
2024-07-24 11:44:30 +02:00
|
|
|
if (!videoEncoderGroup->isVisibleTo(videoPage))
|
|
|
|
videoEncoderGroup->setVisible(true);
|
2024-07-30 21:10:13 +02:00
|
|
|
auto t = video_encoder_properties.find(serverGroup);
|
|
|
|
if (t != video_encoder_properties.end()) {
|
2024-06-13 11:58:07 +02:00
|
|
|
obs_properties_destroy(t->second);
|
2024-07-30 21:10:13 +02:00
|
|
|
video_encoder_properties.erase(t);
|
2024-06-13 11:58:07 +02:00
|
|
|
}
|
2024-07-24 11:44:30 +02:00
|
|
|
for (int i = videoEncoderGroupLayout->rowCount() - 1; i >= (main ? 2 : 0); i--) {
|
2024-06-13 11:58:07 +02:00
|
|
|
videoEncoderGroupLayout->removeRow(i);
|
|
|
|
}
|
2024-08-08 09:15:15 +02:00
|
|
|
auto ves = encoder_changed ? nullptr : obs_data_get_obj(settings, "video_encoder_settings");
|
2024-06-13 11:58:07 +02:00
|
|
|
if (!ves) {
|
2024-08-09 15:37:00 +02:00
|
|
|
auto defaults = obs_encoder_defaults(encoder);
|
|
|
|
if (defaults) {
|
|
|
|
ves = obs_data_get_defaults(defaults);
|
|
|
|
obs_data_release(defaults);
|
|
|
|
} else {
|
|
|
|
ves = obs_data_create();
|
|
|
|
}
|
2024-06-13 11:58:07 +02:00
|
|
|
obs_data_set_obj(settings, "video_encoder_settings", ves);
|
|
|
|
}
|
|
|
|
auto stream_encoder_properties = obs_get_encoder_properties(encoder);
|
2024-07-30 21:10:13 +02:00
|
|
|
video_encoder_properties[serverGroup] = stream_encoder_properties;
|
2024-06-13 11:58:07 +02:00
|
|
|
|
|
|
|
obs_property_t *property = obs_properties_first(stream_encoder_properties);
|
|
|
|
while (property) {
|
2024-06-14 17:37:45 +02:00
|
|
|
AddProperty(stream_encoder_properties, property, ves, videoEncoderGroupLayout);
|
2024-06-13 11:58:07 +02:00
|
|
|
obs_property_next(&property);
|
|
|
|
}
|
|
|
|
obs_data_release(ves);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const char *current_type = obs_data_get_string(settings, "video_encoder");
|
|
|
|
const char *type;
|
|
|
|
size_t idx = 0;
|
|
|
|
while (obs_enum_encoder_types(idx++, &type)) {
|
|
|
|
if (obs_get_encoder_type(type) != OBS_ENCODER_VIDEO)
|
|
|
|
continue;
|
|
|
|
uint32_t caps = obs_get_encoder_caps(type);
|
|
|
|
if ((caps & (OBS_ENCODER_CAP_DEPRECATED | OBS_ENCODER_CAP_INTERNAL)) != 0)
|
|
|
|
continue;
|
|
|
|
const char *codec = obs_get_encoder_codec(type);
|
|
|
|
if (astrcmpi(codec, "h264") != 0 && astrcmpi(codec, "hevc") != 0 && astrcmpi(codec, "av1") != 0)
|
|
|
|
continue;
|
|
|
|
videoEncoder->addItem(QString::fromUtf8(obs_encoder_get_display_name(type)), QVariant(QString::fromUtf8(type)));
|
|
|
|
if (strcmp(type, current_type) == 0)
|
|
|
|
videoEncoder->setCurrentIndex(videoEncoder->count() - 1);
|
|
|
|
}
|
2024-07-29 16:13:22 +02:00
|
|
|
if (videoEncoder->currentIndex() <= 0)
|
2024-07-24 11:44:30 +02:00
|
|
|
videoEncoderGroup->setVisible(false);
|
2024-06-13 11:58:07 +02:00
|
|
|
|
2024-06-14 17:37:45 +02:00
|
|
|
auto audioEncoder = new QComboBox;
|
2024-07-23 16:31:32 +02:00
|
|
|
audioPageLayout->addRow(QString::fromUtf8(obs_module_text("AudioEncoder")), audioEncoder);
|
2024-06-14 17:37:45 +02:00
|
|
|
|
|
|
|
auto audioTrack = new QComboBox;
|
|
|
|
for (int i = 0; i < 6; i++) {
|
2024-08-08 09:15:15 +02:00
|
|
|
auto trackConfigName = QString::fromUtf8("Track") + QString::number(i + 1) + QString::fromUtf8("Name");
|
|
|
|
auto trackName = QString::fromUtf8(
|
|
|
|
config_get_string(obs_frontend_get_profile_config(), "AdvOut", trackConfigName.toUtf8().constData()));
|
|
|
|
if (trackName.isEmpty()) {
|
|
|
|
auto trackTranslationName =
|
|
|
|
QString::fromUtf8("Basic.Settings.Output.Adv.Audio.Track") + QString::number(i + 1);
|
|
|
|
trackName = QString::fromUtf8(obs_frontend_get_locale_string(trackTranslationName.toUtf8().constData()));
|
|
|
|
}
|
|
|
|
if (trackName.isEmpty())
|
|
|
|
trackName = QString::number(i + 1);
|
|
|
|
audioTrack->addItem(trackName);
|
2024-06-14 17:37:45 +02:00
|
|
|
}
|
2024-08-02 08:01:36 +02:00
|
|
|
audioTrack->setCurrentIndex((int)obs_data_get_int(settings, "audio_track"));
|
2024-06-14 17:37:45 +02:00
|
|
|
connect(audioTrack, &QComboBox::currentIndexChanged, [audioTrack, settings] {
|
|
|
|
if (audioTrack->currentIndex() >= 0)
|
|
|
|
obs_data_set_int(settings, "audio_track", audioTrack->currentIndex());
|
|
|
|
});
|
2024-07-23 16:31:32 +02:00
|
|
|
audioPageLayout->addRow(QString::fromUtf8(obs_module_text("AudioTrack")), audioTrack);
|
2024-06-14 17:37:45 +02:00
|
|
|
|
2024-07-29 13:01:10 +02:00
|
|
|
auto audioEncoderGroup = new QWidget();
|
2024-06-14 17:37:45 +02:00
|
|
|
audioEncoderGroup->setProperty("altColor", QVariant(true));
|
|
|
|
auto audioEncoderGroupLayout = new QFormLayout();
|
|
|
|
audioEncoderGroup->setLayout(audioEncoderGroupLayout);
|
2024-07-23 16:31:32 +02:00
|
|
|
audioPageLayout->addRow(audioEncoderGroup);
|
2024-06-14 17:37:45 +02:00
|
|
|
|
2024-08-09 12:24:24 +02:00
|
|
|
int audio_encoder_index = 0;
|
|
|
|
current_type = obs_data_get_string(settings, "audio_encoder");
|
|
|
|
idx = 0;
|
|
|
|
while (obs_enum_encoder_types(idx++, &type)) {
|
|
|
|
if (obs_get_encoder_type(type) != OBS_ENCODER_AUDIO)
|
|
|
|
continue;
|
|
|
|
uint32_t caps = obs_get_encoder_caps(type);
|
|
|
|
if ((caps & (OBS_ENCODER_CAP_DEPRECATED | OBS_ENCODER_CAP_INTERNAL)) != 0)
|
|
|
|
continue;
|
|
|
|
const char *codec = obs_get_encoder_codec(type);
|
|
|
|
if (astrcmpi(codec, "aac") != 0 && astrcmpi(codec, "opus") != 0)
|
|
|
|
continue;
|
|
|
|
audioEncoder->addItem(QString::fromUtf8(obs_encoder_get_display_name(type)), QVariant(QString::fromUtf8(type)));
|
|
|
|
if (strcmp(type, current_type) == 0)
|
|
|
|
audio_encoder_index = audioEncoder->count() - 1;
|
|
|
|
}
|
|
|
|
|
2024-06-14 17:37:45 +02:00
|
|
|
connect(audioEncoder, &QComboBox::currentIndexChanged,
|
2024-08-08 09:15:15 +02:00
|
|
|
[this, serverGroup, advancedGroupLayout, audioPageLayout, audioEncoder, audioEncoderGroup, audioEncoderGroupLayout,
|
|
|
|
audioTrack, settings, audioPage] {
|
2024-06-14 17:37:45 +02:00
|
|
|
auto encoder_string = audioEncoder->currentData().toString().toUtf8();
|
|
|
|
auto encoder = encoder_string.constData();
|
2024-08-09 12:24:24 +02:00
|
|
|
const bool encoder_changed = !encoder_string.isEmpty() &&
|
|
|
|
strcmp(obs_data_get_string(settings, "audio_encoder"), encoder) != 0;
|
2024-08-08 09:15:15 +02:00
|
|
|
if (encoder_changed)
|
|
|
|
obs_data_set_string(settings, "audio_encoder", encoder);
|
|
|
|
|
|
|
|
auto t = audio_encoder_properties.find(serverGroup);
|
|
|
|
if (t != audio_encoder_properties.end()) {
|
|
|
|
obs_properties_destroy(t->second);
|
|
|
|
audio_encoder_properties.erase(t);
|
|
|
|
}
|
|
|
|
for (int i = audioEncoderGroupLayout->rowCount() - 1; i >= 0; i--) {
|
|
|
|
audioEncoderGroupLayout->removeRow(i);
|
|
|
|
}
|
|
|
|
auto aes = encoder_changed ? nullptr : obs_data_get_obj(settings, "audio_encoder_settings");
|
|
|
|
if (!aes) {
|
2024-08-09 15:37:00 +02:00
|
|
|
auto defaults = obs_encoder_defaults(encoder);
|
|
|
|
if (defaults) {
|
|
|
|
aes = obs_data_get_defaults(defaults);
|
|
|
|
obs_data_release(defaults);
|
|
|
|
} else {
|
|
|
|
aes = obs_data_create();
|
|
|
|
}
|
2024-08-08 09:15:15 +02:00
|
|
|
obs_data_set_obj(settings, "audio_encoder_settings", aes);
|
|
|
|
}
|
|
|
|
auto stream_encoder_properties = obs_get_encoder_properties(encoder);
|
|
|
|
audio_encoder_properties[serverGroup] = stream_encoder_properties;
|
2024-06-14 17:37:45 +02:00
|
|
|
|
2024-08-08 09:15:15 +02:00
|
|
|
obs_property_t *property = obs_properties_first(stream_encoder_properties);
|
|
|
|
while (property) {
|
|
|
|
AddProperty(stream_encoder_properties, property, aes, audioEncoderGroupLayout);
|
|
|
|
obs_property_next(&property);
|
2024-06-14 17:37:45 +02:00
|
|
|
}
|
2024-08-08 09:15:15 +02:00
|
|
|
obs_data_release(aes);
|
2024-06-14 17:37:45 +02:00
|
|
|
});
|
|
|
|
|
2024-08-09 12:24:24 +02:00
|
|
|
if (audio_encoder_index == audioEncoder->currentIndex())
|
|
|
|
audioEncoder->setCurrentIndex(-1);
|
|
|
|
audioEncoder->setCurrentIndex(audio_encoder_index);
|
2024-06-14 17:37:45 +02:00
|
|
|
|
2024-07-22 21:26:19 +02:00
|
|
|
auto advancedButton = new QPushButton(QString::fromUtf8(obs_module_text("EditEncoderSettings")));
|
2024-06-13 11:58:07 +02:00
|
|
|
advancedButton->setProperty("themeID", "configIconSmall");
|
2024-10-06 21:11:02 +02:00
|
|
|
advancedButton->setProperty("class", "icon-gear");
|
2024-06-13 11:58:07 +02:00
|
|
|
advancedButton->setCheckable(true);
|
|
|
|
advancedButton->setChecked(advanced);
|
|
|
|
connect(advancedButton, &QPushButton::clicked, [advancedButton, advancedGroup, settings] {
|
2024-08-02 08:01:36 +02:00
|
|
|
const bool is_advanced = advancedButton->isChecked();
|
|
|
|
advancedGroup->setVisible(is_advanced);
|
|
|
|
obs_data_set_bool(settings, "advanced", is_advanced);
|
2024-06-13 11:58:07 +02:00
|
|
|
});
|
|
|
|
|
2024-07-23 16:31:32 +02:00
|
|
|
// Hook up
|
2024-07-23 20:49:03 +02:00
|
|
|
advancedTabWidget->addTab(videoPage, QString::fromUtf8(obs_module_text("VideoEncoderSettings")));
|
|
|
|
advancedTabWidget->addTab(audioPage, QString::fromUtf8(obs_module_text("AudioEncoderSettings")));
|
2024-07-23 16:31:32 +02:00
|
|
|
advancedGroupLayout->addWidget(advancedTabWidget, 1);
|
2024-07-24 11:44:30 +02:00
|
|
|
|
2024-07-22 21:26:19 +02:00
|
|
|
// Remove button
|
2024-07-23 09:28:13 +02:00
|
|
|
auto removeButton =
|
|
|
|
new QPushButton(QIcon(":/res/images/minus.svg"), QString::fromUtf8(obs_frontend_get_locale_string("Remove")));
|
2024-06-13 11:58:07 +02:00
|
|
|
removeButton->setProperty("themeID", QVariant(QString::fromUtf8("removeIconSmall")));
|
2024-10-06 21:11:02 +02:00
|
|
|
removeButton->setProperty("class", "icon-minus");
|
2024-07-18 19:32:31 +02:00
|
|
|
connect(removeButton, &QPushButton::clicked, [this, outputsLayout, serverGroup, settings, outputs] {
|
2024-06-13 11:58:07 +02:00
|
|
|
outputsLayout->removeWidget(serverGroup);
|
2024-06-14 10:36:42 +02:00
|
|
|
RemoveWidget(serverGroup);
|
2024-06-13 11:58:07 +02:00
|
|
|
auto count = obs_data_array_count(outputs);
|
|
|
|
for (size_t i = 0; i < count; i++) {
|
|
|
|
auto item = obs_data_array_item(outputs, i);
|
|
|
|
if (item == settings) {
|
|
|
|
obs_data_array_erase(outputs, i);
|
|
|
|
obs_data_release(item);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
obs_data_release(item);
|
|
|
|
}
|
|
|
|
});
|
2024-07-23 09:28:13 +02:00
|
|
|
|
2024-07-22 21:26:19 +02:00
|
|
|
// Edit button
|
|
|
|
auto editButton = new QPushButton(QString::fromUtf8(obs_module_text("EditServerSettings")));
|
|
|
|
editButton->setProperty("themeID", "configIconSmall");
|
2024-10-06 21:11:02 +02:00
|
|
|
editButton->setProperty("class", "icon-gear");
|
2024-07-22 21:26:19 +02:00
|
|
|
|
2024-07-31 11:08:09 +02:00
|
|
|
connect(editButton, &QPushButton::clicked, [this, settings, outputs] {
|
|
|
|
QStringList otherNames;
|
|
|
|
obs_data_array_enum(
|
|
|
|
outputs,
|
2024-08-02 08:01:36 +02:00
|
|
|
[](obs_data_t *data2, void *param) {
|
|
|
|
((QStringList *)param)->append(QString::fromUtf8(obs_data_get_string(data2, "name")));
|
2024-07-31 11:08:09 +02:00
|
|
|
},
|
|
|
|
&otherNames);
|
|
|
|
otherNames.removeDuplicates();
|
|
|
|
otherNames.removeOne(QString::fromUtf8(obs_data_get_string(settings, "name")));
|
2024-07-23 09:28:13 +02:00
|
|
|
auto outputDialog = new OutputDialog(this, obs_data_get_string(settings, "name"),
|
|
|
|
obs_data_get_string(settings, "stream_server"),
|
2024-07-31 11:08:09 +02:00
|
|
|
obs_data_get_string(settings, "stream_key"), otherNames);
|
2024-07-19 21:19:54 +02:00
|
|
|
|
|
|
|
outputDialog->setWindowModality(Qt::WindowModal);
|
|
|
|
outputDialog->setModal(true);
|
2024-07-23 09:28:13 +02:00
|
|
|
|
2024-07-19 21:19:54 +02:00
|
|
|
if (outputDialog->exec() == QDialog::Accepted) { // edit an output
|
2024-07-23 09:28:13 +02:00
|
|
|
if (!settings)
|
|
|
|
return;
|
|
|
|
|
2024-08-03 09:22:08 +02:00
|
|
|
if (outputs == vertical_outputs)
|
|
|
|
obs_data_set_bool(settings, "enabled", true);
|
2024-07-19 21:19:54 +02:00
|
|
|
// Set the info from the output dialog
|
|
|
|
obs_data_set_string(settings, "name", outputDialog->outputName.toUtf8().constData());
|
|
|
|
obs_data_set_string(settings, "stream_server", outputDialog->outputServer.toUtf8().constData());
|
|
|
|
obs_data_set_string(settings, "stream_key", outputDialog->outputKey.toUtf8().constData());
|
2024-07-23 09:28:13 +02:00
|
|
|
|
2024-07-22 21:26:19 +02:00
|
|
|
// Reload
|
2024-08-02 08:01:36 +02:00
|
|
|
LoadSettings(main_settings);
|
2024-07-29 16:44:28 +02:00
|
|
|
LoadVerticalSettings(false);
|
2024-07-19 21:19:54 +02:00
|
|
|
}
|
2024-07-23 09:28:13 +02:00
|
|
|
|
2024-07-19 21:19:54 +02:00
|
|
|
delete outputDialog;
|
|
|
|
});
|
2024-07-23 09:28:13 +02:00
|
|
|
|
2024-07-22 21:26:19 +02:00
|
|
|
// Buttons to layout
|
|
|
|
server_title_layout->addWidget(editButton, 0, Qt::AlignRight);
|
|
|
|
server_title_layout->addWidget(advancedButton, 0, Qt::AlignRight);
|
2024-06-13 11:58:07 +02:00
|
|
|
server_title_layout->addWidget(removeButton, 0, Qt::AlignRight);
|
|
|
|
|
|
|
|
serverLayout->addRow(server_title_layout);
|
|
|
|
|
|
|
|
serverLayout->addRow(advancedGroup);
|
|
|
|
|
|
|
|
serverGroup->setLayout(serverLayout);
|
|
|
|
|
|
|
|
outputsLayout->addRow(serverGroup);
|
|
|
|
}
|
|
|
|
|
2024-07-29 16:44:28 +02:00
|
|
|
void OBSBasicSettings::LoadVerticalSettings(bool load)
|
2024-07-11 13:54:58 +02:00
|
|
|
{
|
|
|
|
while (verticalOutputsLayout->rowCount() > 1) {
|
|
|
|
auto i = verticalOutputsLayout->takeRow(1).fieldItem;
|
|
|
|
RemoveLayoutItem(i);
|
|
|
|
verticalOutputsLayout->removeRow(1);
|
|
|
|
}
|
2024-07-29 16:44:28 +02:00
|
|
|
if (load) {
|
|
|
|
auto ph = obs_get_proc_handler();
|
|
|
|
struct calldata cd;
|
|
|
|
calldata_init(&cd);
|
|
|
|
if (!proc_handler_call(ph, "aitum_vertical_get_stream_settings", &cd)) {
|
|
|
|
// Disable button if we don't have vertical
|
|
|
|
verticalAddButton->setEnabled(false);
|
|
|
|
calldata_free(&cd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (vertical_outputs)
|
|
|
|
obs_data_array_release(vertical_outputs);
|
|
|
|
vertical_outputs = (obs_data_array_t *)calldata_ptr(&cd, "outputs");
|
2024-07-11 13:54:58 +02:00
|
|
|
calldata_free(&cd);
|
|
|
|
}
|
|
|
|
obs_data_array_enum(
|
|
|
|
vertical_outputs,
|
2024-08-02 08:01:36 +02:00
|
|
|
[](obs_data_t *data2, void *param) {
|
2024-07-11 13:54:58 +02:00
|
|
|
auto d = (OBSBasicSettings *)param;
|
2024-08-02 08:01:36 +02:00
|
|
|
d->AddServer(d->verticalOutputsLayout, data2, d->vertical_outputs);
|
2024-07-11 13:54:58 +02:00
|
|
|
},
|
|
|
|
this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SaveVerticalSettings()
|
|
|
|
{
|
|
|
|
if (!vertical_outputs)
|
|
|
|
return;
|
|
|
|
auto ph = obs_get_proc_handler();
|
|
|
|
struct calldata cd;
|
|
|
|
calldata_init(&cd);
|
|
|
|
calldata_set_ptr(&cd, "outputs", vertical_outputs);
|
|
|
|
proc_handler_call(ph, "aitum_vertical_set_stream_settings", &cd);
|
|
|
|
calldata_free(&cd);
|
|
|
|
}
|
|
|
|
|
2024-06-13 11:58:07 +02:00
|
|
|
void OBSBasicSettings::LoadSettings(obs_data_t *settings)
|
|
|
|
{
|
|
|
|
while (mainOutputsLayout->rowCount() > 2) {
|
|
|
|
auto i = mainOutputsLayout->takeRow(2).fieldItem;
|
2024-06-14 10:36:42 +02:00
|
|
|
RemoveLayoutItem(i);
|
2024-06-13 11:58:07 +02:00
|
|
|
mainOutputsLayout->removeRow(2);
|
|
|
|
}
|
2024-08-02 08:01:36 +02:00
|
|
|
main_settings = settings;
|
2024-06-13 11:58:07 +02:00
|
|
|
auto outputs = obs_data_get_array(settings, "outputs");
|
|
|
|
obs_data_array_enum(
|
|
|
|
outputs,
|
2024-08-02 08:01:36 +02:00
|
|
|
[](obs_data_t *data2, void *param) {
|
2024-06-13 11:58:07 +02:00
|
|
|
auto d = (OBSBasicSettings *)param;
|
2024-08-02 08:01:36 +02:00
|
|
|
auto outputs2 = obs_data_get_array(d->main_settings, "outputs");
|
|
|
|
d->AddServer(d->mainOutputsLayout, data2, outputs2);
|
|
|
|
obs_data_array_release(outputs2);
|
2024-06-13 11:58:07 +02:00
|
|
|
},
|
|
|
|
this);
|
|
|
|
obs_data_array_release(outputs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::AddProperty(obs_properties_t *properties, obs_property_t *property, obs_data_t *settings,
|
2024-06-14 17:37:45 +02:00
|
|
|
QFormLayout *layout)
|
2024-06-13 11:58:07 +02:00
|
|
|
{
|
|
|
|
obs_property_type type = obs_property_get_type(property);
|
|
|
|
if (type == OBS_PROPERTY_BOOL) {
|
|
|
|
auto widget = new QCheckBox(QString::fromUtf8(obs_property_description(property)));
|
|
|
|
widget->setChecked(obs_data_get_bool(settings, obs_property_name(property)));
|
|
|
|
layout->addWidget(widget);
|
|
|
|
if (!obs_property_visible(property)) {
|
|
|
|
widget->setVisible(false);
|
|
|
|
int row = 0;
|
|
|
|
layout->getWidgetPosition(widget, &row, nullptr);
|
|
|
|
auto item = layout->itemAt(row, QFormLayout::LabelRole);
|
|
|
|
if (item) {
|
|
|
|
auto w = item->widget();
|
|
|
|
if (w)
|
|
|
|
w->setVisible(false);
|
|
|
|
}
|
|
|
|
}
|
2024-06-14 17:37:45 +02:00
|
|
|
encoder_property_widgets.emplace(property, widget);
|
|
|
|
connect(widget, &QCheckBox::stateChanged, [this, properties, property, settings, widget, layout] {
|
2024-06-13 11:58:07 +02:00
|
|
|
obs_data_set_bool(settings, obs_property_name(property), widget->isChecked());
|
|
|
|
if (obs_property_modified(property, settings)) {
|
2024-06-14 17:37:45 +02:00
|
|
|
RefreshProperties(properties, layout);
|
2024-06-13 11:58:07 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (type == OBS_PROPERTY_INT) {
|
|
|
|
auto widget = new QSpinBox();
|
|
|
|
widget->setEnabled(obs_property_enabled(property));
|
|
|
|
widget->setMinimum(obs_property_int_min(property));
|
|
|
|
widget->setMaximum(obs_property_int_max(property));
|
|
|
|
widget->setSingleStep(obs_property_int_step(property));
|
|
|
|
widget->setValue((int)obs_data_get_int(settings, obs_property_name(property)));
|
|
|
|
widget->setToolTip(QString::fromUtf8(obs_property_long_description(property)));
|
|
|
|
widget->setSuffix(QString::fromUtf8(obs_property_int_suffix(property)));
|
|
|
|
auto label = new QLabel(QString::fromUtf8(obs_property_description(property)));
|
|
|
|
layout->addRow(label, widget);
|
|
|
|
if (!obs_property_visible(property)) {
|
|
|
|
widget->setVisible(false);
|
|
|
|
label->setVisible(false);
|
|
|
|
}
|
2024-06-14 17:37:45 +02:00
|
|
|
encoder_property_widgets.emplace(property, widget);
|
|
|
|
connect(widget, &QSpinBox::valueChanged, [this, properties, property, settings, widget, layout] {
|
2024-06-13 11:58:07 +02:00
|
|
|
obs_data_set_int(settings, obs_property_name(property), widget->value());
|
|
|
|
if (obs_property_modified(property, settings)) {
|
2024-06-14 17:37:45 +02:00
|
|
|
RefreshProperties(properties, layout);
|
2024-06-13 11:58:07 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (type == OBS_PROPERTY_FLOAT) {
|
|
|
|
auto widget = new QDoubleSpinBox();
|
|
|
|
widget->setEnabled(obs_property_enabled(property));
|
|
|
|
widget->setMinimum(obs_property_float_min(property));
|
|
|
|
widget->setMaximum(obs_property_float_max(property));
|
|
|
|
widget->setSingleStep(obs_property_float_step(property));
|
|
|
|
widget->setValue(obs_data_get_double(settings, obs_property_name(property)));
|
|
|
|
widget->setToolTip(QString::fromUtf8(obs_property_long_description(property)));
|
|
|
|
widget->setSuffix(QString::fromUtf8(obs_property_float_suffix(property)));
|
|
|
|
auto label = new QLabel(QString::fromUtf8(obs_property_description(property)));
|
|
|
|
layout->addRow(label, widget);
|
|
|
|
if (!obs_property_visible(property)) {
|
|
|
|
widget->setVisible(false);
|
|
|
|
label->setVisible(false);
|
|
|
|
}
|
2024-06-14 17:37:45 +02:00
|
|
|
encoder_property_widgets.emplace(property, widget);
|
|
|
|
connect(widget, &QDoubleSpinBox::valueChanged, [this, properties, property, settings, widget, layout] {
|
2024-06-13 11:58:07 +02:00
|
|
|
obs_data_set_double(settings, obs_property_name(property), widget->value());
|
|
|
|
if (obs_property_modified(property, settings)) {
|
2024-06-14 17:37:45 +02:00
|
|
|
RefreshProperties(properties, layout);
|
2024-06-13 11:58:07 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (type == OBS_PROPERTY_TEXT) {
|
|
|
|
obs_text_type text_type = obs_property_text_type(property);
|
|
|
|
if (text_type == OBS_TEXT_MULTILINE) {
|
|
|
|
auto widget = new QPlainTextEdit;
|
|
|
|
widget->document()->setDefaultStyleSheet("font { white-space: pre; }");
|
|
|
|
widget->setTabStopDistance(40);
|
|
|
|
widget->setPlainText(QString::fromUtf8(obs_data_get_string(settings, obs_property_name(property))));
|
|
|
|
auto label = new QLabel(QString::fromUtf8(obs_property_description(property)));
|
|
|
|
layout->addRow(label, widget);
|
|
|
|
if (!obs_property_visible(property)) {
|
|
|
|
widget->setVisible(false);
|
|
|
|
label->setVisible(false);
|
|
|
|
}
|
2024-06-14 17:37:45 +02:00
|
|
|
encoder_property_widgets.emplace(property, widget);
|
|
|
|
connect(widget, &QPlainTextEdit::textChanged, [this, properties, property, settings, widget, layout] {
|
|
|
|
obs_data_set_string(settings, obs_property_name(property), widget->toPlainText().toUtf8());
|
|
|
|
if (obs_property_modified(property, settings)) {
|
|
|
|
RefreshProperties(properties, layout);
|
|
|
|
}
|
|
|
|
});
|
2024-06-13 11:58:07 +02:00
|
|
|
} else {
|
|
|
|
auto widget = new QLineEdit();
|
|
|
|
widget->setText(QString::fromUtf8(obs_data_get_string(settings, obs_property_name(property))));
|
|
|
|
if (text_type == OBS_TEXT_PASSWORD)
|
|
|
|
widget->setEchoMode(QLineEdit::Password);
|
|
|
|
auto label = new QLabel(QString::fromUtf8(obs_property_description(property)));
|
|
|
|
layout->addRow(label, widget);
|
|
|
|
if (!obs_property_visible(property)) {
|
|
|
|
widget->setVisible(false);
|
|
|
|
label->setVisible(false);
|
|
|
|
}
|
2024-06-14 17:37:45 +02:00
|
|
|
encoder_property_widgets.emplace(property, widget);
|
2024-06-13 11:58:07 +02:00
|
|
|
if (text_type != OBS_TEXT_INFO) {
|
2024-06-14 17:37:45 +02:00
|
|
|
connect(widget, &QLineEdit::textChanged, [this, properties, property, settings, widget, layout] {
|
|
|
|
obs_data_set_string(settings, obs_property_name(property), widget->text().toUtf8());
|
|
|
|
if (obs_property_modified(property, settings)) {
|
|
|
|
RefreshProperties(properties, layout);
|
|
|
|
}
|
|
|
|
});
|
2024-06-13 11:58:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (type == OBS_PROPERTY_LIST) {
|
|
|
|
auto widget = new QComboBox();
|
|
|
|
widget->setMaxVisibleItems(40);
|
|
|
|
widget->setToolTip(QString::fromUtf8(obs_property_long_description(property)));
|
|
|
|
auto list_type = obs_property_list_type(property);
|
|
|
|
obs_combo_format format = obs_property_list_format(property);
|
|
|
|
|
|
|
|
size_t count = obs_property_list_item_count(property);
|
|
|
|
for (size_t i = 0; i < count; i++) {
|
|
|
|
QVariant var;
|
|
|
|
if (format == OBS_COMBO_FORMAT_INT) {
|
|
|
|
long long val = obs_property_list_item_int(property, i);
|
|
|
|
var = QVariant::fromValue<long long>(val);
|
|
|
|
|
|
|
|
} else if (format == OBS_COMBO_FORMAT_FLOAT) {
|
|
|
|
double val = obs_property_list_item_float(property, i);
|
|
|
|
var = QVariant::fromValue<double>(val);
|
|
|
|
|
|
|
|
} else if (format == OBS_COMBO_FORMAT_STRING) {
|
|
|
|
var = QByteArray(obs_property_list_item_string(property, i));
|
|
|
|
}
|
|
|
|
widget->addItem(QString::fromUtf8(obs_property_list_item_name(property, i)), var);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (list_type == OBS_COMBO_TYPE_EDITABLE)
|
|
|
|
widget->setEditable(true);
|
|
|
|
|
|
|
|
auto name = obs_property_name(property);
|
|
|
|
QVariant value;
|
|
|
|
switch (format) {
|
|
|
|
case OBS_COMBO_FORMAT_INT:
|
|
|
|
value = QVariant::fromValue(obs_data_get_int(settings, name));
|
|
|
|
break;
|
|
|
|
case OBS_COMBO_FORMAT_FLOAT:
|
|
|
|
value = QVariant::fromValue(obs_data_get_double(settings, name));
|
|
|
|
break;
|
|
|
|
case OBS_COMBO_FORMAT_STRING:
|
|
|
|
value = QByteArray(obs_data_get_string(settings, name));
|
|
|
|
break;
|
|
|
|
default:;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (format == OBS_COMBO_FORMAT_STRING && list_type == OBS_COMBO_TYPE_EDITABLE) {
|
|
|
|
widget->lineEdit()->setText(value.toString());
|
|
|
|
} else {
|
|
|
|
auto idx = widget->findData(value);
|
|
|
|
if (idx != -1)
|
|
|
|
widget->setCurrentIndex(idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (obs_data_has_autoselect_value(settings, name)) {
|
|
|
|
switch (format) {
|
|
|
|
case OBS_COMBO_FORMAT_INT:
|
|
|
|
value = QVariant::fromValue(obs_data_get_autoselect_int(settings, name));
|
|
|
|
break;
|
|
|
|
case OBS_COMBO_FORMAT_FLOAT:
|
|
|
|
value = QVariant::fromValue(obs_data_get_autoselect_double(settings, name));
|
|
|
|
break;
|
|
|
|
case OBS_COMBO_FORMAT_STRING:
|
|
|
|
value = QByteArray(obs_data_get_autoselect_string(settings, name));
|
|
|
|
break;
|
|
|
|
default:;
|
|
|
|
}
|
|
|
|
int id = widget->findData(value);
|
|
|
|
|
|
|
|
auto idx = widget->currentIndex();
|
|
|
|
if (id != -1 && id != idx) {
|
|
|
|
QString actual = widget->itemText(id);
|
|
|
|
QString selected = widget->itemText(widget->currentIndex());
|
|
|
|
QString combined = QString::fromUtf8(
|
|
|
|
obs_frontend_get_locale_string("Basic.PropertiesWindow.AutoSelectFormat"));
|
|
|
|
widget->setItemText(idx, combined.arg(selected).arg(actual));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
auto label = new QLabel(QString::fromUtf8(obs_property_description(property)));
|
|
|
|
layout->addRow(label, widget);
|
|
|
|
if (!obs_property_visible(property)) {
|
|
|
|
widget->setVisible(false);
|
|
|
|
label->setVisible(false);
|
|
|
|
}
|
2024-06-14 17:37:45 +02:00
|
|
|
encoder_property_widgets.emplace(property, widget);
|
2024-06-13 11:58:07 +02:00
|
|
|
switch (format) {
|
|
|
|
case OBS_COMBO_FORMAT_INT:
|
2024-06-14 17:37:45 +02:00
|
|
|
connect(widget, &QComboBox::currentIndexChanged, [this, properties, property, settings, widget, layout] {
|
|
|
|
obs_data_set_int(settings, obs_property_name(property), widget->currentData().toInt());
|
|
|
|
if (obs_property_modified(property, settings)) {
|
|
|
|
RefreshProperties(properties, layout);
|
|
|
|
}
|
|
|
|
});
|
2024-06-13 11:58:07 +02:00
|
|
|
break;
|
|
|
|
case OBS_COMBO_FORMAT_FLOAT:
|
2024-06-14 17:37:45 +02:00
|
|
|
connect(widget, &QComboBox::currentIndexChanged, [this, properties, property, settings, widget, layout] {
|
|
|
|
obs_data_set_double(settings, obs_property_name(property), widget->currentData().toDouble());
|
|
|
|
if (obs_property_modified(property, settings)) {
|
|
|
|
RefreshProperties(properties, layout);
|
|
|
|
}
|
|
|
|
});
|
2024-06-13 11:58:07 +02:00
|
|
|
break;
|
|
|
|
case OBS_COMBO_FORMAT_STRING:
|
|
|
|
if (list_type == OBS_COMBO_TYPE_EDITABLE) {
|
|
|
|
connect(widget, &QComboBox::currentTextChanged,
|
2024-06-14 17:37:45 +02:00
|
|
|
[this, properties, property, settings, widget, layout] {
|
2024-06-13 11:58:07 +02:00
|
|
|
obs_data_set_string(settings, obs_property_name(property),
|
|
|
|
widget->currentText().toUtf8().constData());
|
|
|
|
if (obs_property_modified(property, settings)) {
|
2024-06-14 17:37:45 +02:00
|
|
|
RefreshProperties(properties, layout);
|
2024-06-13 11:58:07 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
connect(widget, &QComboBox::currentIndexChanged,
|
2024-06-14 17:37:45 +02:00
|
|
|
[this, properties, property, settings, widget, layout] {
|
2024-06-13 11:58:07 +02:00
|
|
|
obs_data_set_string(settings, obs_property_name(property),
|
|
|
|
widget->currentData().toString().toUtf8().constData());
|
|
|
|
if (obs_property_modified(property, settings)) {
|
2024-06-14 17:37:45 +02:00
|
|
|
RefreshProperties(properties, layout);
|
2024-06-13 11:58:07 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// OBS_PROPERTY_PATH
|
|
|
|
// OBS_PROPERTY_COLOR
|
|
|
|
// OBS_PROPERTY_BUTTON
|
|
|
|
// OBS_PROPERTY_FONT
|
|
|
|
// OBS_PROPERTY_EDITABLE_LIST
|
|
|
|
// OBS_PROPERTY_FRAME_RATE
|
|
|
|
// OBS_PROPERTY_GROUP
|
|
|
|
// OBS_PROPERTY_COLOR_ALPHA
|
|
|
|
}
|
|
|
|
obs_property_modified(property, settings);
|
|
|
|
}
|
|
|
|
|
2024-06-14 17:37:45 +02:00
|
|
|
void OBSBasicSettings::RefreshProperties(obs_properties_t *properties, QFormLayout *layout)
|
2024-06-13 11:58:07 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
obs_property_t *property = obs_properties_first(properties);
|
|
|
|
while (property) {
|
2024-06-14 17:37:45 +02:00
|
|
|
auto widget = encoder_property_widgets.at(property);
|
2024-06-13 11:58:07 +02:00
|
|
|
auto visible = obs_property_visible(property);
|
|
|
|
if (widget->isVisible() != visible) {
|
|
|
|
widget->setVisible(visible);
|
|
|
|
int row = 0;
|
|
|
|
layout->getWidgetPosition(widget, &row, nullptr);
|
|
|
|
auto item = layout->itemAt(row, QFormLayout::LabelRole);
|
|
|
|
if (item) {
|
|
|
|
widget = item->widget();
|
|
|
|
if (widget)
|
|
|
|
widget->setVisible(visible);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
obs_property_next(&property);
|
|
|
|
}
|
|
|
|
}
|
2024-06-18 08:34:29 +02:00
|
|
|
static bool obs_encoder_parent_video_loaded = false;
|
|
|
|
static video_t *(*obs_encoder_parent_video_wrapper)(const obs_encoder_t *encoder) = nullptr;
|
2024-06-17 14:24:45 +02:00
|
|
|
|
2024-07-16 09:52:05 +02:00
|
|
|
void OBSBasicSettings::LoadOutputStats(std::vector<video_t *> *oldVideos)
|
2024-06-17 14:24:45 +02:00
|
|
|
{
|
2024-06-18 08:34:29 +02:00
|
|
|
if (!obs_encoder_parent_video_loaded) {
|
|
|
|
void *dl = os_dlopen("obs");
|
|
|
|
if (dl) {
|
|
|
|
auto sym = os_dlsym(dl, "obs_encoder_parent_video");
|
|
|
|
if (sym)
|
|
|
|
obs_encoder_parent_video_wrapper = (video_t * (*)(const obs_encoder_t *encoder)) sym;
|
|
|
|
os_dlclose(dl);
|
|
|
|
}
|
|
|
|
obs_encoder_parent_video_loaded = true;
|
|
|
|
}
|
2024-06-17 14:24:45 +02:00
|
|
|
std::vector<std::tuple<video_t *, obs_encoder_t *, obs_output_t *>> refs;
|
|
|
|
obs_enum_outputs(
|
2024-08-02 08:01:36 +02:00
|
|
|
[](void *param, obs_output_t *output) {
|
|
|
|
auto refs2 = (std::vector<std::tuple<video_t *, obs_encoder_t *, obs_output_t *>> *)param;
|
2024-06-17 14:24:45 +02:00
|
|
|
auto ec = 0;
|
|
|
|
for (size_t i = 0; i < MAX_OUTPUT_VIDEO_ENCODERS; i++) {
|
|
|
|
auto venc = obs_output_get_video_encoder2(output, i);
|
|
|
|
if (!venc)
|
|
|
|
continue;
|
|
|
|
ec++;
|
2024-06-18 08:34:29 +02:00
|
|
|
video_t *video = obs_encoder_parent_video_wrapper ? obs_encoder_parent_video_wrapper(venc)
|
|
|
|
: obs_encoder_video(venc);
|
|
|
|
if (!video)
|
|
|
|
video = obs_output_video(output);
|
2024-08-02 08:01:36 +02:00
|
|
|
refs2->push_back(std::tuple<video_t *, obs_encoder_t *, obs_output_t *>(video, venc, output));
|
2024-06-17 14:24:45 +02:00
|
|
|
}
|
|
|
|
if (!ec) {
|
2024-08-02 08:01:36 +02:00
|
|
|
refs2->push_back(std::tuple<video_t *, obs_encoder_t *, obs_output_t *>(obs_output_video(output),
|
|
|
|
nullptr, output));
|
2024-06-17 14:24:45 +02:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
&refs);
|
|
|
|
std::sort(refs.begin(), refs.end(),
|
|
|
|
[](std::tuple<video_t *, obs_encoder_t *, obs_output_t *> const &a,
|
|
|
|
std::tuple<video_t *, obs_encoder_t *, obs_output_t *> const &b) {
|
|
|
|
video_t *va;
|
|
|
|
video_t *vb;
|
|
|
|
obs_encoder_t *ea;
|
|
|
|
obs_encoder_t *eb;
|
|
|
|
obs_output_t *oa;
|
|
|
|
obs_output_t *ob;
|
|
|
|
std::tie(va, ea, oa) = a;
|
|
|
|
std::tie(vb, eb, ob) = b;
|
|
|
|
if (va == vb) {
|
|
|
|
if (ea == eb) {
|
|
|
|
return oa < ob;
|
|
|
|
}
|
|
|
|
return va < vb;
|
|
|
|
}
|
|
|
|
return va < vb;
|
|
|
|
});
|
|
|
|
std::string stats;
|
|
|
|
video_t *last_video = nullptr;
|
|
|
|
auto video_count = 0;
|
|
|
|
video_t *vertical_video = nullptr;
|
|
|
|
auto ph = obs_get_proc_handler();
|
|
|
|
struct calldata cd;
|
|
|
|
calldata_init(&cd);
|
2024-06-17 14:31:10 +02:00
|
|
|
if (proc_handler_call(ph, "aitum_vertical_get_video", &cd))
|
2024-06-17 14:24:45 +02:00
|
|
|
vertical_video = (video_t *)calldata_ptr(&cd, "video");
|
|
|
|
calldata_free(&cd);
|
|
|
|
for (auto it = refs.begin(); it != refs.end(); it++) {
|
|
|
|
video_t *video;
|
|
|
|
obs_encoder_t *encoder;
|
|
|
|
obs_output_t *output;
|
|
|
|
std::tie(video, encoder, output) = *it;
|
|
|
|
|
|
|
|
if (!video) {
|
|
|
|
stats += "No Canvas ";
|
|
|
|
} else if (vertical_video && vertical_video == video) {
|
|
|
|
stats += "Vertical Canvas ";
|
|
|
|
} else if (video == obs_get_video()) {
|
|
|
|
stats += "Main Canvas ";
|
2024-07-16 09:52:05 +02:00
|
|
|
} else if (std::find(oldVideos->begin(), oldVideos->end(), video) != oldVideos->end()) {
|
|
|
|
stats += "Old Main Canvas ";
|
2024-06-17 14:24:45 +02:00
|
|
|
} else {
|
|
|
|
if (last_video != video) {
|
|
|
|
video_count++;
|
|
|
|
last_video = video;
|
|
|
|
}
|
|
|
|
stats += "Custom Canvas ";
|
|
|
|
stats += std::to_string(video_count);
|
|
|
|
stats += " ";
|
|
|
|
}
|
2024-07-16 09:52:05 +02:00
|
|
|
if (video && std::find(oldVideos->begin(), oldVideos->end(), video) != oldVideos->end()) {
|
|
|
|
stats += obs_output_active(output) ? "Active " : "Inactive ";
|
|
|
|
} else if (encoder) {
|
2024-06-17 14:24:45 +02:00
|
|
|
stats += "(";
|
|
|
|
stats += std::to_string(obs_encoder_get_width(encoder));
|
|
|
|
stats += "x";
|
|
|
|
stats += std::to_string(obs_encoder_get_height(encoder));
|
|
|
|
stats += ") ";
|
|
|
|
stats += obs_encoder_get_name(encoder);
|
|
|
|
stats += "(";
|
|
|
|
stats += obs_encoder_get_id(encoder);
|
|
|
|
stats += ") ";
|
|
|
|
stats += to_string_with_precision(
|
|
|
|
video_output_get_frame_rate(video) / obs_encoder_get_frame_rate_divisor(encoder), 2);
|
|
|
|
stats += "fps ";
|
|
|
|
stats += obs_encoder_active(encoder) ? "Active " : "Inactive ";
|
2024-07-16 09:52:05 +02:00
|
|
|
if (video) {
|
|
|
|
stats += "skipped frames ";
|
|
|
|
stats += std::to_string(video_output_get_skipped_frames(video));
|
|
|
|
stats += "/";
|
|
|
|
stats += std::to_string(video_output_get_total_frames(video));
|
|
|
|
stats += " ";
|
|
|
|
}
|
2024-06-17 14:24:45 +02:00
|
|
|
} else if (video) {
|
|
|
|
stats += "(";
|
|
|
|
stats += std::to_string(video_output_get_width(video));
|
|
|
|
stats += "x";
|
|
|
|
stats += std::to_string(video_output_get_height(video));
|
|
|
|
stats += ") ";
|
|
|
|
stats += to_string_with_precision(video_output_get_frame_rate(video), 2);
|
|
|
|
stats += "fps ";
|
|
|
|
stats += video_output_active(video) ? "Active " : "Inactive ";
|
2024-07-16 09:52:05 +02:00
|
|
|
stats += "skipped frames ";
|
|
|
|
stats += std::to_string(video_output_get_skipped_frames(video));
|
|
|
|
stats += "/";
|
|
|
|
stats += std::to_string(video_output_get_total_frames(video));
|
|
|
|
stats += " ";
|
2024-06-17 14:24:45 +02:00
|
|
|
} else {
|
|
|
|
stats += "(";
|
|
|
|
stats += std::to_string(obs_output_get_width(output));
|
|
|
|
stats += "x";
|
|
|
|
stats += std::to_string(obs_output_get_height(output));
|
|
|
|
stats += ") ";
|
|
|
|
stats += obs_output_active(output) ? "Active " : "Inactive ";
|
|
|
|
}
|
|
|
|
stats += obs_output_get_name(output);
|
|
|
|
stats += "(";
|
|
|
|
stats += obs_output_get_id(output);
|
2024-06-18 08:34:29 +02:00
|
|
|
stats += ") ";
|
2024-06-17 14:24:45 +02:00
|
|
|
stats += std::to_string(obs_output_get_connect_time_ms(output));
|
|
|
|
stats += "ms ";
|
|
|
|
//obs_output_get_total_bytes(output);
|
|
|
|
stats += "dropped frames ";
|
|
|
|
stats += std::to_string(obs_output_get_frames_dropped(output));
|
|
|
|
stats += "/";
|
|
|
|
stats += std::to_string(obs_output_get_total_frames(output));
|
|
|
|
obs_service_t *service = obs_output_get_service(output);
|
|
|
|
if (service) {
|
|
|
|
stats += " ";
|
|
|
|
stats += obs_service_get_name(service);
|
|
|
|
stats += "(";
|
|
|
|
stats += obs_service_get_id(service);
|
|
|
|
stats += ")";
|
|
|
|
auto url = obs_service_get_connect_info(service, OBS_SERVICE_CONNECT_INFO_SERVER_URL);
|
|
|
|
if (url) {
|
|
|
|
stats += " ";
|
|
|
|
stats += url;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stats += "\n";
|
|
|
|
}
|
|
|
|
troubleshooterText->setText(QString::fromUtf8(stats));
|
|
|
|
}
|
2024-06-18 08:34:29 +02:00
|
|
|
|
|
|
|
void OBSBasicSettings::SetNewerVersion(QString newer_version_available)
|
|
|
|
{
|
|
|
|
if (newer_version_available.isEmpty())
|
|
|
|
return;
|
|
|
|
newVersion->setText(QString::fromUtf8(obs_module_text("NewVersion")).arg(newer_version_available));
|
|
|
|
newVersion->setVisible(true);
|
|
|
|
}
|