| 260 | } |
| 261 | |
| 262 | void PluginListComponent::addPluginItems(const std::vector<int> indexes) { |
| 263 | auto types = m_list.getTypes(); |
| 264 | int numTypes = types.size(); |
| 265 | int numBlacklistedFiles = m_list.getBlacklistedFiles().size(); |
| 266 | std::vector<String> names; |
| 267 | |
| 268 | for (int index : indexes) { |
| 269 | if (index >= (numTypes + numBlacklistedFiles)) { |
| 270 | index -= numTypes; |
| 271 | index -= numBlacklistedFiles; |
| 272 | auto it = m_excludeList.begin(); |
| 273 | while (index-- > 0 && it != m_excludeList.end()) it++; |
| 274 | if (it != m_excludeList.end()) { |
| 275 | auto name = *it; |
| 276 | names.push_back(name); |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | for (auto& name : names) { |
| 282 | m_excludeList.erase(name); |
| 283 | } |
| 284 | |
| 285 | if (auto srv = getApp()->getServer()) { |
| 286 | srv->saveConfig(); |
| 287 | srv->addPlugins(names, [this, names](bool success, const String& name) { |
| 288 | if (!success) { |
| 289 | m_excludeList.insert(name); |
| 290 | } |
| 291 | }); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | void PluginListComponent::rescanPluginItems(const std::vector<int> indexes) { |
| 296 | auto types = m_list.getTypes(); |
nothing calls this directly
no test coverage detected