Add button to manually run macro actions

This commit is contained in:
WarmUpTill 2021-11-27 17:28:43 +01:00 committed by WarmUpTill
parent eafad7fe7f
commit 9dd47b811b
4 changed files with 22 additions and 3 deletions

View File

@ -66,6 +66,7 @@ AdvSceneSwitcher.macroTab.edit.condition="Condition type:"
AdvSceneSwitcher.macroTab.edit.action="Action type:"
AdvSceneSwitcher.macroTab.add="Add new macro"
AdvSceneSwitcher.macroTab.name="Name:"
AdvSceneSwitcher.macroTab.run="Run macro"
AdvSceneSwitcher.macroTab.defaultname="Macro %1"
AdvSceneSwitcher.macroTab.exists="Macro name exists already"
AdvSceneSwitcher.macroTab.copy="Create copy"

View File

@ -722,7 +722,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_34">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18" stretch="0,0,0">
<layout class="QHBoxLayout" name="horizontalLayout_18" stretch="0,0,0,0">
<item>
<widget class="QLabel" name="label_20">
<property name="text">
@ -733,6 +733,13 @@
<item>
<widget class="QLineEdit" name="macroName"/>
</item>
<item>
<widget class="QPushButton" name="runMacro">
<property name="text">
<string>AdvSceneSwitcher.macroTab.run</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_13">
<property name="orientation">
@ -763,7 +770,7 @@
<x>0</x>
<y>0</y>
<width>767</width>
<height>220</height>
<height>218</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_35" stretch="10,1">
@ -862,7 +869,7 @@
<x>0</x>
<y>0</y>
<width>767</width>
<height>219</height>
<height>218</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33" stretch="10,1">

View File

@ -115,6 +115,7 @@ public slots:
void on_macroUp_clicked();
void on_macroDown_clicked();
void on_macroName_editingFinished();
void on_runMacro_clicked();
void on_macros_currentRowChanged(int idx);
void on_macros_itemChanged(QListWidgetItem *);
void on_conditionAdd_clicked();

View File

@ -173,6 +173,16 @@ void AdvSceneSwitcher::on_macroName_editingFinished()
emit MacroRenamed(oldName, newName);
}
void AdvSceneSwitcher::on_runMacro_clicked()
{
Macro *macro = getSelectedMacro();
if (!macro) {
return;
}
macro->PerformAction();
}
void AdvSceneSwitcher::PopulateMacroActions(Macro &m, uint32_t afterIdx)
{
auto &actions = m.Actions();