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

Method RunningClicked

lib/macro/macro-tree.cpp:126–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126void MacroTreeItem::RunningClicked(bool running)
127{
128 const auto updateWidget = [this](Macro *macro) {
129 if (!macro) {
130 return;
131 }
132
133 const auto &macros = GetTopLevelMacros();
134
135 bool found = false;
136 int idx = 0;
137 for (const auto &m : macros) {
138 if (m.get() == macro) {
139 found = true;
140 break;
141 }
142 idx++;
143 }
144
145 if (!found) {
146 return;
147 }
148
149 const auto widget = _tree->GetItemWidget(idx);
150 if (widget) {
151 widget->UpdateRunning();
152 }
153 };
154
155 if (!_macro->IsGroup()) {
156 _macro->SetPaused(!running);
157 if (!_macro->IsSubitem()) {
158 return;
159 }
160
161 const auto group = _macro->Parent();
162 updateWidget(group.get());
163 return;
164 }
165
166 const auto macros = GetGroupMacroEntries(_macro.get());
167 for (const auto &macro : macros) {
168 macro->SetPaused(!running);
169 }
170
171 // Update backend values before updating UI to prevent flickering in
172 // running state of the group
173 for (const auto &macro : macros) {
174 updateWidget(macro.get());
175 }
176 UpdateRunning();
177}
178
179void MacroTreeItem::UpdateRunning()
180{

Callers

nothing calls this directly

Calls 8

GetGroupMacroEntriesFunction · 0.85
GetItemWidgetMethod · 0.80
UpdateRunningMethod · 0.80
IsGroupMethod · 0.80
SetPausedMethod · 0.80
IsSubitemMethod · 0.80
ParentMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected