| 638 | } |
| 639 | |
| 640 | void AdvSceneSwitcher::SetupMacroTab() |
| 641 | { |
| 642 | ui->macros->installEventFilter(this); |
| 643 | |
| 644 | auto ¯os = GetTopLevelMacros(); |
| 645 | |
| 646 | if (macros.size() == 0 && !switcher->disableHints) { |
| 647 | addPulse = HighlightWidget(ui->macroAdd, QColor(Qt::green)); |
| 648 | } |
| 649 | |
| 650 | auto macroControls = setupToolBar({{ui->macroAdd, ui->macroRemove}, |
| 651 | {ui->macroUp, ui->macroDown}}); |
| 652 | ui->macroControlLayout->addWidget(macroControls); |
| 653 | |
| 654 | ui->macros->Reset(macros, GetGlobalMacroSettings()._highlightExecuted); |
| 655 | connect(ui->macros, SIGNAL(MacroSelectionChanged()), this, |
| 656 | SLOT(MacroSelectionChanged())); |
| 657 | ui->runMacro->SetMacroTree(ui->macros); |
| 658 | |
| 659 | ui->macros->setContextMenuPolicy(Qt::CustomContextMenu); |
| 660 | connect(ui->macros, &QWidget::customContextMenuRequested, this, |
| 661 | &AdvSceneSwitcher::ShowMacroContextMenu); |
| 662 | |
| 663 | SetMacroEditAreaDisabled(true); |
| 664 | ui->macroPriorityWarning->setVisible( |
| 665 | switcher->functionNamesByPriority[0] != macro_func); |
| 666 | |
| 667 | lastOnChangeHighlightCheckTime = |
| 668 | std::chrono::high_resolution_clock::now(); |
| 669 | onChangeHighlightTimer.setInterval(1500); |
| 670 | connect(&onChangeHighlightTimer, SIGNAL(timeout()), this, |
| 671 | SLOT(HighlightOnChange())); |
| 672 | onChangeHighlightTimer.start(); |
| 673 | |
| 674 | SetupMacroSearchWidgets(ui->macroSearchLayout, ui->macroSearchText, |
| 675 | ui->macroSearchClear, ui->macroSearchType, |
| 676 | ui->macroSearchRegex, |
| 677 | ui->macroSearchShowSettings, |
| 678 | [this]() { ui->macros->RefreshFilter(); }); |
| 679 | |
| 680 | static const std::vector< |
| 681 | std::pair<Macro::ActionTriggerMode, const char *>> |
| 682 | actionTriggerModes = { |
| 683 | {Macro::ActionTriggerMode::ALWAYS, |
| 684 | "AdvSceneSwitcher.macroTab.actionTriggerMode.always"}, |
| 685 | {Macro::ActionTriggerMode::MACRO_RESULT_CHANGED, |
| 686 | "AdvSceneSwitcher.macroTab.actionTriggerMode.onOverallChange"}, |
| 687 | {Macro::ActionTriggerMode::ANY_CONDITION_CHANGED, |
| 688 | "AdvSceneSwitcher.macroTab.actionTriggerMode.onAnyConditionChange"}, |
| 689 | {Macro::ActionTriggerMode::ANY_CONDITION_TRIGGERED, |
| 690 | "AdvSceneSwitcher.macroTab.actionTriggerMode.onAnyConditionTriggered"}, |
| 691 | }; |
| 692 | |
| 693 | for (const auto &[mode, name] : actionTriggerModes) { |
| 694 | ui->actionTriggerMode->addItem(obs_module_text(name), |
| 695 | static_cast<int>(mode)); |
| 696 | } |
| 697 |
nothing calls this directly
no test coverage detected