| 134 | } |
| 135 | |
| 136 | [[nodiscard]] std::vector<WindowEntry> CollectWindows() { |
| 137 | auto result = std::vector<WindowEntry>(); |
| 138 | for (const auto widget : QApplication::topLevelWidgets()) { |
| 139 | const auto controller = App().findWindow(widget); |
| 140 | if (!controller) { |
| 141 | continue; |
| 142 | } |
| 143 | auto already = false; |
| 144 | for (const auto &entry : result) { |
| 145 | if (entry.controller.get() == controller) { |
| 146 | already = true; |
| 147 | break; |
| 148 | } |
| 149 | } |
| 150 | if (!already) { |
| 151 | result.push_back({ controller, widget->window() }); |
| 152 | } |
| 153 | } |
| 154 | ranges::sort(result, [](const WindowEntry &a, const WindowEntry &b) { |
| 155 | if (a.controller->isPrimary() != b.controller->isPrimary()) { |
| 156 | return a.controller->isPrimary(); |
| 157 | } |
| 158 | return a.controller.get() < b.controller.get(); |
| 159 | }); |
| 160 | return result; |
| 161 | } |
| 162 | |
| 163 | [[nodiscard]] QByteArray HandleWindows() { |
| 164 | const auto active = App().activeWindow(); |
no test coverage detected