MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / PerformAction

Method PerformAction

plugins/base/macro-action-timer.cpp:28–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26};
27
28bool MacroActionTimer::PerformAction()
29{
30 auto macro = _macro.GetMacro();
31 if (!macro) {
32 return true;
33 }
34
35 const auto updateCondition = [this](MacroCondition *condition) {
36 if (condition->GetId() != id) {
37 return;
38 }
39
40 auto timerCondition =
41 dynamic_cast<MacroConditionTimer *>(condition);
42 if (!timerCondition) {
43 return;
44 }
45
46 switch (_actionType) {
47 case Action::PAUSE:
48 timerCondition->Pause();
49 break;
50 case Action::CONTINUE:
51 timerCondition->Continue();
52 break;
53 case Action::RESET:
54 timerCondition->Reset();
55 break;
56 case Action::SET_TIME_REMAINING:
57 timerCondition->_duration.SetTimeRemaining(
58 _duration.Seconds());
59 break;
60 default:
61 break;
62 }
63 };
64
65 const auto updateMacro = [&](Macro *macro) {
66 auto conditions = *GetMacroConditions(macro);
67 for (auto condition : conditions) {
68 updateCondition(condition.get());
69 }
70 };
71
72 if (!IsGroupMacro(macro.get())) {
73 updateMacro(macro.get());
74 return true;
75 }
76
77 auto macros = GetGroupMacroEntries(macro.get());
78 for (const auto &macro : macros) {
79 updateMacro(macro.get());
80 }
81 return true;
82}
83
84void MacroActionTimer::LogAction() const
85{

Callers

nothing calls this directly

Calls 10

IsGroupMacroFunction · 0.85
GetGroupMacroEntriesFunction · 0.85
PauseMethod · 0.80
ContinueMethod · 0.80
SecondsMethod · 0.80
GetMacroMethod · 0.45
GetIdMethod · 0.45
ResetMethod · 0.45
SetTimeRemainingMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected