| 314 | } |
| 315 | |
| 316 | void PluginDataModel::UpdateFilter() |
| 317 | { |
| 318 | auto textFilters = wxSplit(mFilterExpr, ' '); |
| 319 | std::for_each( |
| 320 | textFilters.begin(), |
| 321 | textFilters.end(), |
| 322 | [](wxString& str) { str.MakeLower(); } |
| 323 | ); |
| 324 | mIndexFilterMap.clear(); |
| 325 | |
| 326 | auto filterFn = [=](PluginDescriptor* desc, bool state) |
| 327 | { |
| 328 | if((!mFilterType.empty() && desc->GetProviderID() != mFilterType) || |
| 329 | (mFilterState != -1 && state != static_cast<bool>(mFilterState)) || |
| 330 | (mFilterCategory != -1 && mFilterCategory != desc->GetEffectType())) |
| 331 | { |
| 332 | return false; |
| 333 | } |
| 334 | |
| 335 | for(auto& filter : textFilters) |
| 336 | { |
| 337 | if((desc->GetPluginType() != PluginTypeEffect || |
| 338 | desc->GetSymbol().Translation().Lower().Find(filter) == wxNOT_FOUND) && |
| 339 | (desc->GetPluginType() != PluginTypeStub || |
| 340 | wxFileName(desc->GetPath()).GetName().Lower().Find(filter) == wxNOT_FOUND)) |
| 341 | { |
| 342 | return false; |
| 343 | } |
| 344 | } |
| 345 | return true; |
| 346 | }; |
| 347 | |
| 348 | for(uint32_t i = 0; i < mPluginStateModel.size(); ++i) |
| 349 | { |
| 350 | const auto [desc, state] = mPluginStateModel[i]; |
| 351 | if(filterFn(desc, state)) |
| 352 | mIndexFilterMap.push_back(MakeRow(i)); |
| 353 | } |
| 354 | Cleared(); |
| 355 | } |
| 356 | |
| 357 | bool PluginDataModel::IsFilterEmpty() const |
| 358 | { |
nothing calls this directly
no test coverage detected