| 419 | } |
| 420 | |
| 421 | bool SequenceReviewPage::validatePage() |
| 422 | { |
| 423 | const QString triggerScene = field("seqTriggerScene").toString(); |
| 424 | const std::string name = ("Sequence: " + triggerScene).toStdString(); |
| 425 | |
| 426 | auto *triggerPage = qobject_cast<SequenceTriggerPage *>( |
| 427 | wizard()->page(PAGE_SEQ_TRIGGER)); |
| 428 | const Duration triggerDuration = |
| 429 | triggerPage ? triggerPage->GetTriggerDuration() : Duration(5.0); |
| 430 | |
| 431 | auto *seqPage = qobject_cast<SequenceScenesPage *>( |
| 432 | wizard()->page(PAGE_SEQ_SCENES)); |
| 433 | if (!seqPage) { |
| 434 | return true; |
| 435 | } |
| 436 | const auto steps = seqPage->GetSteps(); |
| 437 | |
| 438 | _macro = std::make_shared<Macro>(name, GetGlobalMacroSettings()); |
| 439 | if (!_macro) { |
| 440 | blog(LOG_WARNING, |
| 441 | "FirstRunWizard: sequence macro allocation failed"); |
| 442 | return true; |
| 443 | } |
| 444 | _macro->SetRunInParallel(true); |
| 445 | |
| 446 | // --- Condition --- |
| 447 | OBSDataAutoRelease condData = |
| 448 | buildSceneConditionData(triggerScene, triggerDuration); |
| 449 | if (!detail::addCondition(_macro.get(), "scene", condData)) { |
| 450 | _macro.reset(); |
| 451 | QMessageBox::warning( |
| 452 | this, |
| 453 | obs_module_text("FirstRunWizard.seqReview.errorTitle"), |
| 454 | obs_module_text("FirstRunWizard.seqReview.errorBody")); |
| 455 | return true; |
| 456 | } |
| 457 | |
| 458 | // --- Actions: scene_switch interleaved with wait --- |
| 459 | for (int i = 0; i < steps.size(); ++i) { |
| 460 | OBSDataAutoRelease switchData = |
| 461 | buildSceneSwitchData(steps[i].first); |
| 462 | if (!detail::addAction(_macro.get(), "scene_switch", |
| 463 | switchData)) { |
| 464 | _macro.reset(); |
| 465 | QMessageBox::warning( |
| 466 | this, |
| 467 | obs_module_text( |
| 468 | "FirstRunWizard.seqReview.errorTitle"), |
| 469 | obs_module_text( |
| 470 | "FirstRunWizard.seqReview.errorBody")); |
| 471 | return true; |
| 472 | } |
| 473 | |
| 474 | const bool isLastStep = (i == steps.size() - 1); |
| 475 | if (!isLastStep) { |
| 476 | OBSDataAutoRelease waitData = |
| 477 | buildWaitData(steps[i].second); |
| 478 | if (!detail::addAction(_macro.get(), "wait", |
nothing calls this directly
no test coverage detected