bool
-ScreensPanel::matches_search(shared_ptr<const Cinema> cinema, string lower_case_search)
+ScreensPanel::matches_search(shared_ptr<const Cinema> cinema, string search)
{
- if (lower_case_search.empty()) {
+ if (search.empty()) {
return true;
}
- auto name = cinema->name;
- convert_to_lower(name);
- return name.find(lower_case_search) != string::npos;
+ return _collator.find(search, cinema->name);
}
optional<wxTreeListItem>
ScreensPanel::add_cinema (shared_ptr<Cinema> cinema, wxTreeListItem previous)
{
- auto search = wx_to_std (_search->GetValue ());
- convert_to_lower(search);
+ auto const search = wx_to_std(_search->GetValue());
if (!matches_search(cinema, search)) {
return {};
}
wxTreeListItem previous = wxTLI_FIRST;
bool found = false;
- auto search = wx_to_std(_search->GetValue());
- convert_to_lower(search);
+ auto const search = wx_to_std(_search->GetValue());
for (auto existing_cinema: cinemas) {
if (!matches_search(existing_cinema, search)) {
continue;
void clear_and_re_add();
void config_changed(Config::Property);
void convert_to_lower(std::string& s);
- bool matches_search(std::shared_ptr<const Cinema> cinema, std::string lower_case_search);
+ bool matches_search(std::shared_ptr<const Cinema> cinema, std::string search);
std::list<std::shared_ptr<Cinema>> sorted_cinemas() const;
std::shared_ptr<Cinema> item_to_cinema (wxTreeListItem item) const;