| 275 | } |
| 276 | |
| 277 | void OutputSettings::onFormAccepted() |
| 278 | { |
| 279 | auto config = Config::Current(); |
| 280 | auto last_config = *config; |
| 281 | |
| 282 | config->OutputEnabled = ui->mainOutputGroupBox->isChecked(); |
| 283 | config->OutputName = ui->mainOutputName->text(); |
| 284 | config->OutputGroups = ui->mainOutputGroups->text(); |
| 285 | |
| 286 | config->PreviewOutputEnabled = ui->previewOutputGroupBox->isChecked(); |
| 287 | config->PreviewOutputName = ui->previewOutputName->text(); |
| 288 | config->PreviewOutputGroups = ui->previewOutputGroups->text(); |
| 289 | |
| 290 | config->TallyProgramEnabled = ui->tallyProgramCheckBox->isChecked(); |
| 291 | config->TallyPreviewEnabled = ui->tallyPreviewCheckBox->isChecked(); |
| 292 | |
| 293 | config->AutoCheckForUpdates(ui->checkBoxAutoCheckForUpdates->isChecked()); |
| 294 | |
| 295 | auto mainSupported = ui->mainOutputGroupBox->isEnabled(); |
| 296 | |
| 297 | obs_log(LOG_INFO, "Main output supported='%d'", mainSupported); |
| 298 | |
| 299 | // Output settings for debugging & diagnosis |
| 300 | obs_log(LOG_INFO, |
| 301 | "Output Settings set to MainEnabled='%d', MainName='%s', MainGroup='%s', PreviewEnabled='%d', PreviewName='%s', PreviewGroup='%s'", |
| 302 | config->OutputEnabled, config->OutputName.toUtf8().constData(), |
| 303 | config->OutputGroups.toUtf8().constData(), config->PreviewOutputEnabled, |
| 304 | config->PreviewOutputName.toUtf8().constData(), config->PreviewOutputGroups.toUtf8().constData()); |
| 305 | |
| 306 | config->Save(); |
| 307 | |
| 308 | if (mainSupported && config->OutputEnabled && !config->OutputName.isEmpty()) { |
| 309 | if ((last_config.OutputEnabled != config->OutputEnabled) || |
| 310 | (last_config.OutputName != config->OutputName) || |
| 311 | (last_config.OutputGroups != config->OutputGroups)) { |
| 312 | // The Output is supported and enabled, OutputName exists and a Name or GroupName has changed since last form submission |
| 313 | obs_log(LOG_INFO, "Initializing Main output"); |
| 314 | main_output_init(); |
| 315 | } |
| 316 | } else { |
| 317 | main_output_deinit(); |
| 318 | } |
| 319 | if (config->PreviewOutputEnabled && !config->PreviewOutputName.isEmpty()) { |
| 320 | if ((last_config.PreviewOutputEnabled != config->PreviewOutputEnabled) || |
| 321 | (last_config.PreviewOutputName != config->PreviewOutputName) || |
| 322 | (last_config.PreviewOutputGroups != config->PreviewOutputGroups)) { |
| 323 | // The Preview Output is enabled, OutputName exists and a Name or GroupName has changed since last form submission |
| 324 | obs_log(LOG_INFO, "Initializing Preview output"); |
| 325 | preview_output_init(); |
| 326 | } |
| 327 | } else { |
| 328 | preview_output_deinit(); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | void OutputSettings::showEvent(QShowEvent *) |
| 333 | { |
nothing calls this directly
no test coverage detected