MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / HandleCycle

Function HandleCycle

Telegram/SourceFiles/core/external_control.cpp:193–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193[[nodiscard]] QByteArray HandleCycle() {
194 const auto windows = CollectWindows();
195 if (windows.empty()) {
196 return Error(u"no windows"_q);
197 }
198 const auto active = App().activeWindow();
199 auto current = 0;
200 for (auto i = 0, count = int(windows.size()); i != count; ++i) {
201 if (windows[i].controller.get() == active) {
202 current = i;
203 break;
204 }
205 }
206 const auto next = (current + 1) % int(windows.size());
207 windows[next].controller->activate();
208 auto object = QJsonObject();
209 object.insert(u"ok"_q, true);
210 object.insert(u"activated"_q, next);
211 return Pack(object);
212}
213
214} // namespace
215

Callers 1

HandleExternalControlFunction · 0.85

Calls 11

CollectWindowsFunction · 0.85
AppClass · 0.85
activeWindowMethod · 0.80
ErrorFunction · 0.70
PackFunction · 0.70
QJsonObjectClass · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
activateMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected