1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

Everywhere: Replace Model::update() with Model::invalidate()

Most of the models were just calling did_update anyway, which is
pointless since it can be unified to the base Model class. Instead, code
calling update() will now call invalidate(), which functions identically
and is more obvious in what it does.

Additionally, a default implementation is provided, which removes the
need to add empty implementations of update() for each model subclass.

Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
This commit is contained in:
sin-ack 2021-05-25 14:13:19 +00:00 committed by Andreas Kling
parent 5cd2e0f3a2
commit ca2c81251a
100 changed files with 116 additions and 261 deletions

View file

@ -173,7 +173,6 @@ protected:
bool m_editable { false };
bool m_searchable { true };
ModelIndex m_edit_index;
RefPtr<Widget> m_edit_widget;
Gfx::IntRect m_edit_widget_content_rect;
OwnPtr<ModelEditingDelegate> m_editing_delegate;
@ -181,20 +180,22 @@ protected:
Gfx::IntPoint m_left_mousedown_position;
bool m_might_drag { false };
ModelIndex m_hovered_index;
ModelIndex m_highlighted_search_index;
int m_key_column { -1 };
SortOrder m_sort_order;
ModelIndex m_edit_index;
ModelIndex m_hovered_index;
ModelIndex m_highlighted_search_index;
private:
RefPtr<Model> m_model;
ModelSelection m_selection;
ModelIndex m_selection_start_index;
String m_searching;
RefPtr<Core::Timer> m_searching_timer;
ModelIndex m_cursor_index;
ModelIndex m_drop_candidate_index;
RefPtr<Model> m_model;
ModelSelection m_selection;
String m_searching;
RefPtr<Core::Timer> m_searching_timer;
SelectionBehavior m_selection_behavior { SelectionBehavior::SelectItems };
SelectionMode m_selection_mode { SelectionMode::SingleSelection };
unsigned m_edit_triggers { EditTrigger::DoubleClicked | EditTrigger::EditKeyPressed };