MCPcopy Create free account
hub / github.com/audacity/audacity / UpdateFilter

Method UpdateFilter

src/PluginDataModel.cpp:316–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316void 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
357bool PluginDataModel::IsFilterEmpty() const
358{

Callers

nothing calls this directly

Calls 15

MakeRowFunction · 0.85
GetEffectTypeMethod · 0.80
GetPluginTypeMethod · 0.80
TranslationMethod · 0.80
wxFileNameClass · 0.70
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45
FindMethod · 0.45
GetSymbolMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected