Add the option to execute another macro's actions

This commit is contained in:
WarmUpTill 2021-11-23 21:29:01 +01:00 committed by WarmUpTill
parent f9afbcbc59
commit f2570e1deb
3 changed files with 10 additions and 0 deletions

View File

@ -305,6 +305,7 @@ AdvSceneSwitcher.action.macro="Macro"
AdvSceneSwitcher.action.macro.type.pause="Pause"
AdvSceneSwitcher.action.macro.type.unpause="Unpause"
AdvSceneSwitcher.action.macro.type.resetCounter="Reset counter"
AdvSceneSwitcher.action.macro.type.run="Run"
AdvSceneSwitcher.action.macro.entry="{{actions}} {{macros}}"
AdvSceneSwitcher.action.pluginState="Plugin state"
AdvSceneSwitcher.action.pluginState.type.stop="Stop the Advanced Scene Switcher plugin"

View File

@ -8,6 +8,7 @@ enum class PerformMacroAction {
PAUSE,
UNPAUSE,
RESET_COUNTER,
RUN,
};
class MacroActionMacro : public MacroRefAction {

View File

@ -15,6 +15,7 @@ const static std::map<PerformMacroAction, std::string> actionTypes = {
"AdvSceneSwitcher.action.macro.type.unpause"},
{PerformMacroAction::RESET_COUNTER,
"AdvSceneSwitcher.action.macro.type.resetCounter"},
{PerformMacroAction::RUN, "AdvSceneSwitcher.action.macro.type.run"},
};
bool MacroActionMacro::PerformAction()
@ -33,6 +34,9 @@ bool MacroActionMacro::PerformAction()
case PerformMacroAction::RESET_COUNTER:
_macro->ResetCount();
break;
case PerformMacroAction::RUN:
_macro->PerformAction();
break;
default:
break;
}
@ -55,6 +59,10 @@ void MacroActionMacro::LogAction()
vblog(LOG_INFO, "reset counter for \"%s\"",
_macro->Name().c_str());
break;
case PerformMacroAction::RUN:
vblog(LOG_INFO, "run nested macro \"%s\"",
_macro->Name().c_str());
break;
default:
break;
}