Fix edit vertical settings

This commit is contained in:
Exeldro 2024-07-29 16:44:28 +02:00
parent 25140bfd29
commit 71b0e6e123
No known key found for this signature in database
GPG Key ID: 97269A83FC715751
3 changed files with 95 additions and 99 deletions

View File

@ -124,7 +124,6 @@ OBSBasicSettings::OBSBasicSettings(QMainWindow *parent) : QDialog(parent)
buttonLayout->addWidget(generalHelpButton, 0); buttonLayout->addWidget(generalHelpButton, 0);
buttonLayout->addWidget(generalSupportAitumButton, 0); buttonLayout->addWidget(generalSupportAitumButton, 0);
buttonGroupBox->setLayout(buttonLayout); buttonGroupBox->setLayout(buttonLayout);
generalPageLayout->addWidget(infoBox, 0); generalPageLayout->addWidget(infoBox, 0);
@ -375,7 +374,6 @@ OBSBasicSettings::OBSBasicSettings(QMainWindow *parent) : QDialog(parent)
connect(generalHelpButton, &QPushButton::clicked, [this] { listWidget->setCurrentRow(listWidget->count() - 2); }); connect(generalHelpButton, &QPushButton::clicked, [this] { listWidget->setCurrentRow(listWidget->count() - 2); });
connect(generalSupportAitumButton, &QPushButton::clicked, [this] { listWidget->setCurrentRow(listWidget->count() - 1); }); connect(generalSupportAitumButton, &QPushButton::clicked, [this] { listWidget->setCurrentRow(listWidget->count() - 1); });
} }
OBSBasicSettings::~OBSBasicSettings() OBSBasicSettings::~OBSBasicSettings()
@ -499,10 +497,6 @@ void OBSBasicSettings::AddServer(QFormLayout *outputsLayout, obs_data_t *setting
streaming_title->setStyleSheet(QString::fromUtf8("font-weight: bold;")); streaming_title->setStyleSheet(QString::fromUtf8("font-weight: bold;"));
server_title_layout->addWidget(streaming_title, 1, Qt::AlignLeft); server_title_layout->addWidget(streaming_title, 1, Qt::AlignLeft);
// Config Button
auto configButton = new QPushButton;
configButton->setMinimumHeight(30);
// Advanced settings // Advanced settings
const bool advanced = obs_data_get_bool(settings, "advanced"); const bool advanced = obs_data_get_bool(settings, "advanced");
auto advancedGroup = new QGroupBox(QString::fromUtf8(obs_module_text("AdvancedGroupHeader"))); auto advancedGroup = new QGroupBox(QString::fromUtf8(obs_module_text("AdvancedGroupHeader")));
@ -898,6 +892,7 @@ void OBSBasicSettings::AddServer(QFormLayout *outputsLayout, obs_data_t *setting
// Reload // Reload
LoadSettings(this->settings); LoadSettings(this->settings);
LoadVerticalSettings(false);
} }
delete outputDialog; delete outputDialog;
@ -917,14 +912,14 @@ void OBSBasicSettings::AddServer(QFormLayout *outputsLayout, obs_data_t *setting
outputsLayout->addRow(serverGroup); outputsLayout->addRow(serverGroup);
} }
void OBSBasicSettings::LoadVerticalSettings() void OBSBasicSettings::LoadVerticalSettings(bool load)
{ {
while (verticalOutputsLayout->rowCount() > 1) { while (verticalOutputsLayout->rowCount() > 1) {
auto i = verticalOutputsLayout->takeRow(1).fieldItem; auto i = verticalOutputsLayout->takeRow(1).fieldItem;
RemoveLayoutItem(i); RemoveLayoutItem(i);
verticalOutputsLayout->removeRow(1); verticalOutputsLayout->removeRow(1);
} }
if (load) {
auto ph = obs_get_proc_handler(); auto ph = obs_get_proc_handler();
struct calldata cd; struct calldata cd;
calldata_init(&cd); calldata_init(&cd);
@ -937,6 +932,8 @@ void OBSBasicSettings::LoadVerticalSettings()
if (vertical_outputs) if (vertical_outputs)
obs_data_array_release(vertical_outputs); obs_data_array_release(vertical_outputs);
vertical_outputs = (obs_data_array_t *)calldata_ptr(&cd, "outputs"); vertical_outputs = (obs_data_array_t *)calldata_ptr(&cd, "outputs");
calldata_free(&cd);
}
obs_data_array_enum( obs_data_array_enum(
vertical_outputs, vertical_outputs,
[](obs_data_t *data, void *param) { [](obs_data_t *data, void *param) {
@ -944,7 +941,6 @@ void OBSBasicSettings::LoadVerticalSettings()
d->AddServer(d->verticalOutputsLayout, data, d->vertical_outputs); d->AddServer(d->verticalOutputsLayout, data, d->vertical_outputs);
}, },
this); this);
calldata_free(&cd);
} }
void OBSBasicSettings::SaveVerticalSettings() void OBSBasicSettings::SaveVerticalSettings()

View File

@ -75,7 +75,7 @@ public:
~OBSBasicSettings(); ~OBSBasicSettings();
void LoadSettings(obs_data_t *settings); void LoadSettings(obs_data_t *settings);
void LoadVerticalSettings(); void LoadVerticalSettings(bool load);
void SaveVerticalSettings(); void SaveVerticalSettings();
void LoadOutputStats(std::vector<video_t *> *oldVideos); void LoadOutputStats(std::vector<video_t *> *oldVideos);
void SetNewerVersion(QString newer_version_available); void SetNewerVersion(QString newer_version_available);

View File

@ -288,7 +288,7 @@ MultistreamDock::MultistreamDock(QWidget *parent) : QFrame(parent)
if (current_config) if (current_config)
obs_data_apply(settings, current_config); obs_data_apply(settings, current_config);
configDialog->LoadSettings(settings); configDialog->LoadSettings(settings);
configDialog->LoadVerticalSettings(); configDialog->LoadVerticalSettings(true);
configDialog->LoadOutputStats(&oldVideo); configDialog->LoadOutputStats(&oldVideo);
configDialog->SetNewerVersion(newer_version_available); configDialog->SetNewerVersion(newer_version_available);
configDialog->setResult(QDialog::Rejected); configDialog->setResult(QDialog::Rejected);