| 26 | }; |
| 27 | |
| 28 | bool 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 ¯o : macros) { |
| 79 | updateMacro(macro.get()); |
| 80 | } |
| 81 | return true; |
| 82 | } |
| 83 | |
| 84 | void MacroActionTimer::LogAction() const |
| 85 | { |
nothing calls this directly
no test coverage detected