1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:37:35 +00:00

LibGUI: Rename AbstractView::m_searching => m_highlighted_search

This commit is contained in:
Dawid Wolosowicz 2021-09-04 15:00:18 +02:00 committed by Ali Mohammad Pur
parent aeffd9024e
commit 9225b45c2d
2 changed files with 7 additions and 7 deletions

View file

@ -566,7 +566,7 @@ void AbstractView::keydown_event(KeyEvent& event)
//if (event.modifiers() == Mod_Ctrl) { //if (event.modifiers() == Mod_Ctrl) {
// TODO: delete last word // TODO: delete last word
//} //}
Utf8View view(m_searching); Utf8View view(m_highlighted_search);
size_t n_code_points = view.length(); size_t n_code_points = view.length();
if (n_code_points > 1) { if (n_code_points > 1) {
n_code_points--; n_code_points--;
@ -595,7 +595,7 @@ void AbstractView::keydown_event(KeyEvent& event)
} }
} else if (event.key() != KeyCode::Key_Tab && !event.ctrl() && !event.alt() && event.code_point() != 0) { } else if (event.key() != KeyCode::Key_Tab && !event.ctrl() && !event.alt() && event.code_point() != 0) {
StringBuilder sb; StringBuilder sb;
sb.append(m_searching); sb.append(m_highlighted_search);
sb.append_code_point(event.code_point()); sb.append_code_point(event.code_point());
do_search(sb.to_string()); do_search(sb.to_string());
start_searching_timer(); start_searching_timer();
@ -610,7 +610,7 @@ void AbstractView::keydown_event(KeyEvent& event)
void AbstractView::cancel_searching() void AbstractView::cancel_searching()
{ {
m_searching = nullptr; m_highlighted_search = nullptr;
if (m_searching_timer) if (m_searching_timer)
m_searching_timer->stop(); m_searching_timer->stop();
if (m_highlighted_search_index.is_valid()) { if (m_highlighted_search_index.is_valid()) {
@ -643,7 +643,7 @@ void AbstractView::do_search(String&& searching)
if (!found_indices.is_empty() && found_indices[0].is_valid()) { if (!found_indices.is_empty() && found_indices[0].is_valid()) {
auto& index = found_indices[0]; auto& index = found_indices[0];
m_highlighted_search_index = index; m_highlighted_search_index = index;
m_searching = move(searching); m_highlighted_search = move(searching);
set_selection(index); set_selection(index);
scroll_into_view(index); scroll_into_view(index);
update(); update();
@ -677,7 +677,7 @@ void AbstractView::draw_item_text(Gfx::Painter& painter, const ModelIndex& index
else else
text_color = index.data(ModelRole::ForegroundColor).to_color(palette().color(foreground_role())); text_color = index.data(ModelRole::ForegroundColor).to_color(palette().color(foreground_role()));
if (index == m_highlighted_search_index) { if (index == m_highlighted_search_index) {
Utf8View searching_text(m_searching); Utf8View searching_text(m_highlighted_search);
auto searching_length = searching_text.length(); auto searching_length = searching_text.length();
if (searching_length > search_highlighting_offset) if (searching_length > search_highlighting_offset)
searching_length -= search_highlighting_offset; searching_length -= search_highlighting_offset;

View file

@ -162,7 +162,7 @@ protected:
void activate_selected(); void activate_selected();
void update_edit_widget_position(); void update_edit_widget_position();
bool is_searching() const { return !m_searching.is_null(); } bool is_searching() const { return !m_highlighted_search.is_null(); }
void cancel_searching(); void cancel_searching();
void start_searching_timer(); void start_searching_timer();
void do_search(String&&); void do_search(String&&);
@ -192,7 +192,7 @@ private:
RefPtr<Model> m_model; RefPtr<Model> m_model;
ModelSelection m_selection; ModelSelection m_selection;
String m_searching; String m_highlighted_search;
RefPtr<Core::Timer> m_searching_timer; RefPtr<Core::Timer> m_searching_timer;
SelectionBehavior m_selection_behavior { SelectionBehavior::SelectItems }; SelectionBehavior m_selection_behavior { SelectionBehavior::SelectItems };
SelectionMode m_selection_mode { SelectionMode::SingleSelection }; SelectionMode m_selection_mode { SelectionMode::SingleSelection };