diff --git a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp index c667c1c3347732bbd8121ca0a5e510d1c14565da..5c233b4576f4e161e1b1bb50369ba0a10346c0e2 100644 --- a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp +++ b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp @@ -97,11 +97,6 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode } } -void ClipboardHistoryModel::update() -{ - did_update(); -} - void ClipboardHistoryModel::add_item(const GUI::Clipboard::DataAndType& item) { m_history_items.remove_first_matching([&](GUI::Clipboard::DataAndType& existing) { @@ -112,7 +107,7 @@ void ClipboardHistoryModel::add_item(const GUI::Clipboard::DataAndType& item) m_history_items.take_last(); m_history_items.prepend(item); - update(); + invalidate(); } void ClipboardHistoryModel::remove_item(int index) diff --git a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h index 58f3b9a212f5c4c7b012b393f78e5c94fc61bb4d..b5482acf98253589603fd18a3e150e445d2d8c38 100644 --- a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h +++ b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h @@ -35,7 +35,6 @@ private: virtual String column_name(int) const override; virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; } virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; // ^GUI::Clipboard::ClipboardClient virtual void clipboard_content_did_change(const String&) override { add_item(GUI::Clipboard::the().data_and_type()); } diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp index d6e96595e67cedbbea3d7b1e086dc66548863ea7..da12d7e7537e248123342395a40017481993a71d 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.cpp +++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp @@ -146,7 +146,7 @@ BookmarksBarWidget::BookmarksBarWidget(const String& bookmarks_file, bool enable fields.empend("title", "Title", Gfx::TextAlignment::CenterLeft); fields.empend("url", "Url", Gfx::TextAlignment::CenterRight); set_model(GUI::JsonArrayModel::create(bookmarks_file, move(fields))); - model()->update(); + model()->invalidate(); } BookmarksBarWidget::~BookmarksBarWidget() diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp index be50d4067d5f77861c78bd2469bb7437ccbe4024..547298730cf35b3939e03e84ffa5b96567133573 100644 --- a/Userland/Applications/Calendar/AddEventDialog.cpp +++ b/Userland/Applications/Calendar/AddEventDialog.cpp @@ -98,10 +98,6 @@ AddEventDialog::MonthListModel::~MonthListModel() { } -void AddEventDialog::MonthListModel::update() -{ -} - int AddEventDialog::MonthListModel::row_count(const GUI::ModelIndex&) const { return 12; diff --git a/Userland/Applications/Calendar/AddEventDialog.h b/Userland/Applications/Calendar/AddEventDialog.h index c400476764be627b16e3b84424cc563b7130328c..d63114f02bbc1a883f22f0d705e04558565be063 100644 --- a/Userland/Applications/Calendar/AddEventDialog.h +++ b/Userland/Applications/Calendar/AddEventDialog.h @@ -39,7 +39,6 @@ private: virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } virtual String column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; private: MonthListModel(); diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index 66739bd3ca73619724250ee65f2209b05e9bfc4c..b576ba49e0d390d7ba7fc83f51aa042ee774691a 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -360,7 +360,7 @@ void DirectoryView::open(String const& path) auto real_path = Core::File::real_path_for(path); if (model().root_path() == real_path) { - model().update(); + model().invalidate(); return; } @@ -382,7 +382,7 @@ void DirectoryView::open_parent_directory() void DirectoryView::refresh() { - model().update(); + model().invalidate(); } void DirectoryView::open_previous_directory() diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index e0384a23335207153a99c9d99f628292bc68a45c..523bed4cd251cc8fcf72f75cd31e43daef4755c8 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -500,7 +500,7 @@ int run_in_windowed_mode(RefPtr config, String initial_locatio }; auto refresh_tree_view = [&] { - directories_model->update(); + directories_model->invalidate(); auto current_path = directory_view.path(); diff --git a/Userland/Applications/Help/ManualModel.cpp b/Userland/Applications/Help/ManualModel.cpp index 9d2c04a2fca673c4695beb416321d22dbf758413..c69b6a4767b203e4423eaae6bf234d9e5a3c963a 100644 --- a/Userland/Applications/Help/ManualModel.cpp +++ b/Userland/Applications/Help/ManualModel.cpp @@ -172,8 +172,3 @@ TriState ManualModel::data_matches(const GUI::ModelIndex& index, const GUI::Vari return view_result.value().contains(term.as_string()) ? TriState::True : TriState::False; } - -void ManualModel::update() -{ - did_update(); -} diff --git a/Userland/Applications/Help/ManualModel.h b/Userland/Applications/Help/ManualModel.h index 39bd85360b1183b38bd94c2227ccb434d91265d5..9c2002f15f8677aa4edac4881bf200252f0abf1e 100644 --- a/Userland/Applications/Help/ManualModel.h +++ b/Userland/Applications/Help/ManualModel.h @@ -32,7 +32,6 @@ public: virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual TriState data_matches(const GUI::ModelIndex&, const GUI::Variant&) const override; - virtual void update() override; virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override; diff --git a/Userland/Applications/Help/main.cpp b/Userland/Applications/Help/main.cpp index 3c04aeb15fb067f8010e9c9b020cc2df9786ff62..3f88f099c230b13e82163676879c211d29acee19 100644 --- a/Userland/Applications/Help/main.cpp +++ b/Userland/Applications/Help/main.cpp @@ -109,11 +109,11 @@ int main(int argc, char* argv[]) if (auto model = search_list_view.model()) { auto& search_model = *static_cast(model); search_model.set_filter_term(search_box.text()); - search_model.update(); + search_model.invalidate(); } }; search_list_view.set_model(GUI::FilteringProxyModel::construct(model)); - search_list_view.model()->update(); + search_list_view.model()->invalidate(); tree_view.set_model(model); left_tab_bar.set_fixed_width(200); diff --git a/Userland/Applications/HexEditor/SearchResultsModel.h b/Userland/Applications/HexEditor/SearchResultsModel.h index c70e698bb1732c7c775f7bfbb8a3bbdeacc82767..edf9ec695a5c08681650f122c2efec42c51072ef 100644 --- a/Userland/Applications/HexEditor/SearchResultsModel.h +++ b/Userland/Applications/HexEditor/SearchResultsModel.h @@ -75,8 +75,6 @@ public: return {}; } - virtual void update() override { } - private: Vector m_matches; }; diff --git a/Userland/Applications/IRCClient/IRCAppWindow.cpp b/Userland/Applications/IRCClient/IRCAppWindow.cpp index 3916467b52023f387b6b8cb1d8920163daaff734..187e3dc29279ee5cfb8913679083b772ac828474 100644 --- a/Userland/Applications/IRCClient/IRCAppWindow.cpp +++ b/Userland/Applications/IRCClient/IRCAppWindow.cpp @@ -62,7 +62,7 @@ void IRCAppWindow::setup_client() return static_cast(m_container->active_widget()); }; m_client->aid_update_window_list = [this] { - m_window_list->model()->update(); + m_window_list->model()->invalidate(); }; m_client->on_nickname_changed = [this](const String&) { update_title(); diff --git a/Userland/Applications/IRCClient/IRCChannel.cpp b/Userland/Applications/IRCClient/IRCChannel.cpp index aba2668a6f116f5933da640103c925c6404ee0dc..7606b05a1f69264afb09455209ed21588bcdb513 100644 --- a/Userland/Applications/IRCClient/IRCChannel.cpp +++ b/Userland/Applications/IRCClient/IRCChannel.cpp @@ -36,7 +36,7 @@ void IRCChannel::add_member(const String& name, char prefix) } } m_members.append({ name, prefix }); - m_member_model->update(); + m_member_model->invalidate(); } void IRCChannel::remove_member(const String& name) @@ -69,7 +69,7 @@ void IRCChannel::handle_join(const String& nick, const String& hostmask) return; } add_member(nick, (char)0); - m_member_model->update(); + m_member_model->invalidate(); if (m_client.show_join_part_messages()) add_message(String::formatted("*** {} [{}] has joined {}", nick, hostmask, m_name), Color::MidGreen); } @@ -83,7 +83,7 @@ void IRCChannel::handle_part(const String& nick, const String& hostmask) } else { remove_member(nick); } - m_member_model->update(); + m_member_model->invalidate(); if (m_client.show_join_part_messages()) add_message(String::formatted("*** {} [{}] has parted from {}", nick, hostmask, m_name), Color::MidGreen); } @@ -97,7 +97,7 @@ void IRCChannel::handle_quit(const String& nick, const String& hostmask, const S } else { remove_member(nick); } - m_member_model->update(); + m_member_model->invalidate(); add_message(String::formatted("*** {} [{}] has quit ({})", nick, hostmask, message), Color::MidGreen); } @@ -114,7 +114,7 @@ void IRCChannel::notify_nick_changed(const String& old_nick, const String& new_n for (auto& member : m_members) { if (member.name == old_nick) { member.name = new_nick; - m_member_model->update(); + m_member_model->invalidate(); if (m_client.show_nick_change_messages()) add_message(String::formatted("~ {} changed nickname to {}", old_nick, new_nick), Color::MidMagenta); return; diff --git a/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp b/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp index 6ae117aba0639e5aba45e83e67a1a2dcbb19f3cc..3dbd0997d07c906a7e9bc99d7eb4d1b27dfd8036 100644 --- a/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp +++ b/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp @@ -50,11 +50,6 @@ GUI::Variant IRCChannelMemberListModel::data(const GUI::ModelIndex& index, GUI:: return {}; } -void IRCChannelMemberListModel::update() -{ - did_update(); -} - String IRCChannelMemberListModel::nick_at(const GUI::ModelIndex& index) const { return data(index, GUI::ModelRole::Display).to_string(); diff --git a/Userland/Applications/IRCClient/IRCChannelMemberListModel.h b/Userland/Applications/IRCClient/IRCChannelMemberListModel.h index 5d3145be62792b1eac3b63cdb1cf1e31bd1ed730..12ca9ca739d65ec174359a98d32e5e4e38f2200d 100644 --- a/Userland/Applications/IRCClient/IRCChannelMemberListModel.h +++ b/Userland/Applications/IRCClient/IRCChannelMemberListModel.h @@ -23,7 +23,6 @@ public: virtual int column_count(const GUI::ModelIndex&) const override; virtual String column_name(int column) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; virtual String nick_at(const GUI::ModelIndex& index) const; private: diff --git a/Userland/Applications/IRCClient/IRCClient.cpp b/Userland/Applications/IRCClient/IRCClient.cpp index 0b66e7f358d2b67dc380238356fef247f0d0b107..d4f3692ab1f4fb4b6407f3811c7b3a3cc81e67ed 100644 --- a/Userland/Applications/IRCClient/IRCClient.cpp +++ b/Userland/Applications/IRCClient/IRCClient.cpp @@ -817,7 +817,7 @@ void IRCClient::register_subwindow(IRCWindow& subwindow) subwindow.set_log_buffer(*m_log); } m_windows.append(&subwindow); - m_client_window_list_model->update(); + m_client_window_list_model->invalidate(); } void IRCClient::unregister_subwindow(IRCWindow& subwindow) @@ -831,7 +831,7 @@ void IRCClient::unregister_subwindow(IRCWindow& subwindow) break; } } - m_client_window_list_model->update(); + m_client_window_list_model->invalidate(); } void IRCClient::handle_user_command(const String& input) @@ -1079,7 +1079,7 @@ void IRCClient::handle_kick_user_action(const String& channel, const String& nic void IRCClient::handle_close_query_action(const String& nick) { m_queries.remove(nick); - m_client_window_list_model->update(); + m_client_window_list_model->invalidate(); } void IRCClient::handle_join_action(const String& channel) diff --git a/Userland/Applications/IRCClient/IRCWindowListModel.cpp b/Userland/Applications/IRCClient/IRCWindowListModel.cpp index 7b9fad505f0cd0ded20efe59a1bc893fc2a9a6df..76ef9623f9710572f95a0e882470b8c162f92dbc 100644 --- a/Userland/Applications/IRCClient/IRCWindowListModel.cpp +++ b/Userland/Applications/IRCClient/IRCWindowListModel.cpp @@ -64,8 +64,3 @@ GUI::Variant IRCWindowListModel::data(const GUI::ModelIndex& index, GUI::ModelRo } return {}; } - -void IRCWindowListModel::update() -{ - did_update(); -} diff --git a/Userland/Applications/IRCClient/IRCWindowListModel.h b/Userland/Applications/IRCClient/IRCWindowListModel.h index fce8f8e3c6ff8cb1bfc679f9e5c826e77be0d027..8de806cbccad1b676778d4230492958c19cf26ef 100644 --- a/Userland/Applications/IRCClient/IRCWindowListModel.h +++ b/Userland/Applications/IRCClient/IRCWindowListModel.h @@ -25,7 +25,6 @@ public: virtual int column_count(const GUI::ModelIndex&) const override; virtual String column_name(int column) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; private: explicit IRCWindowListModel(IRCClient&); diff --git a/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h b/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h index 2dc6f3df04a469b448f7e97ce5272dea2795eccd..88095ef537e544dd1fe3a5eb00e37175b094fadc 100644 --- a/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h +++ b/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h @@ -39,11 +39,6 @@ public: return {}; } - virtual void update() override - { - did_update(); - } - private: explicit CharacterMapFileListModel(Vector& filenames) : m_filenames(filenames) diff --git a/Userland/Applications/Mail/AccountHolder.cpp b/Userland/Applications/Mail/AccountHolder.cpp index 8226046427414350ccdea396a3b955c90db026d9..f2edd1b236b423399c67c76514dce1faccaadeb6 100644 --- a/Userland/Applications/Mail/AccountHolder.cpp +++ b/Userland/Applications/Mail/AccountHolder.cpp @@ -75,5 +75,5 @@ void AccountHolder::add_account_with_name_and_mailboxes(String name, Vectorupdate(); + m_mailbox_tree_model->invalidate(); } diff --git a/Userland/Applications/Mail/InboxModel.cpp b/Userland/Applications/Mail/InboxModel.cpp index bfac9a94e3a8c1b4855f2448caade2bd6a6ce242..4c1417e0ad51406f21be267cf0f529b39fdda3f6 100644 --- a/Userland/Applications/Mail/InboxModel.cpp +++ b/Userland/Applications/Mail/InboxModel.cpp @@ -43,8 +43,3 @@ GUI::Variant InboxModel::data(GUI::ModelIndex const& index, GUI::ModelRole role) } return {}; } - -void InboxModel::update() -{ - did_update(); -} diff --git a/Userland/Applications/Mail/InboxModel.h b/Userland/Applications/Mail/InboxModel.h index a2b6724de89f93d721f099eb14261bd8809be675..02d2f569d94cb25521e4eaa9154540b236c98585 100644 --- a/Userland/Applications/Mail/InboxModel.h +++ b/Userland/Applications/Mail/InboxModel.h @@ -33,7 +33,6 @@ public: virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } virtual String column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; private: InboxModel(Vector); diff --git a/Userland/Applications/Mail/MailboxTreeModel.cpp b/Userland/Applications/Mail/MailboxTreeModel.cpp index 4183e7fc5a3075dfbd781716d6e94d7c35f569ea..737a9fb927f3cb40be2a231040257f3a727b0a6e 100644 --- a/Userland/Applications/Mail/MailboxTreeModel.cpp +++ b/Userland/Applications/Mail/MailboxTreeModel.cpp @@ -113,8 +113,3 @@ GUI::Variant MailboxTreeModel::data(GUI::ModelIndex const& index, GUI::ModelRole return {}; } - -void MailboxTreeModel::update() -{ - did_update(); -} diff --git a/Userland/Applications/Mail/MailboxTreeModel.h b/Userland/Applications/Mail/MailboxTreeModel.h index d24a766ce3e9cb4d8a7bda9245780a8ad85122b3..3df0c1ba62391a5f78021fa329ccdc63e31d7379 100644 --- a/Userland/Applications/Mail/MailboxTreeModel.h +++ b/Userland/Applications/Mail/MailboxTreeModel.h @@ -25,7 +25,6 @@ public: virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override; - virtual void update() override; private: explicit MailboxTreeModel(AccountHolder const&); diff --git a/Userland/Applications/PDFViewer/OutlineModel.cpp b/Userland/Applications/PDFViewer/OutlineModel.cpp index 290b8194a7c09ea897cbaa3113e7e63354507334..be56f63140215d76535ae7c0a84762e1687880c1 100644 --- a/Userland/Applications/PDFViewer/OutlineModel.cpp +++ b/Userland/Applications/PDFViewer/OutlineModel.cpp @@ -61,11 +61,6 @@ GUI::Variant OutlineModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol } } -void OutlineModel::update() -{ - did_update(); -} - GUI::ModelIndex OutlineModel::parent_index(const GUI::ModelIndex& index) const { if (!index.is_valid()) diff --git a/Userland/Applications/PDFViewer/OutlineModel.h b/Userland/Applications/PDFViewer/OutlineModel.h index 2885647b7dad262acfd62ecc1700de5a0c9ce18b..e97fcb35747e2bbff19671c1142f9bb6416391a3 100644 --- a/Userland/Applications/PDFViewer/OutlineModel.h +++ b/Userland/Applications/PDFViewer/OutlineModel.h @@ -19,7 +19,6 @@ public: virtual int row_count(const GUI::ModelIndex&) const override; virtual int column_count(const GUI::ModelIndex&) const override; virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override; - virtual void update() override; virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override; diff --git a/Userland/Applications/Settings/main.cpp b/Userland/Applications/Settings/main.cpp index 90fc4222dc5f7ca7e997be56f4900590b25167c5..2a94138993c65c667fd0dbef48770e2c31ecae70 100644 --- a/Userland/Applications/Settings/main.cpp +++ b/Userland/Applications/Settings/main.cpp @@ -59,8 +59,6 @@ public: return {}; } - virtual void update() override { } - private: NonnullRefPtrVector m_apps; }; diff --git a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp index 21ee4f3de6b9a5f0c3dc7ef5c4032cf66a8fc27e..fb7e737b27c4ec9b4cc9eeea03c231ea7fc398b8 100644 --- a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp +++ b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp @@ -92,10 +92,6 @@ String PlaylistModel::column_name(int column) const VERIFY_NOT_REACHED(); } -void PlaylistModel::update() -{ -} - void PlaylistTableView::doubleclick_event(GUI::MouseEvent& event) { AbstractView::doubleclick_event(event); diff --git a/Userland/Applications/SoundPlayer/PlaylistWidget.h b/Userland/Applications/SoundPlayer/PlaylistWidget.h index 758003c152ef4072b725c6b1f88e3f58a7c599c8..5b19b6e79a18ec33bde086b3a4203ba842628856 100644 --- a/Userland/Applications/SoundPlayer/PlaylistWidget.h +++ b/Userland/Applications/SoundPlayer/PlaylistWidget.h @@ -24,7 +24,6 @@ public: int row_count(const GUI::ModelIndex&) const override { return m_playlist_items.size(); } int column_count(const GUI::ModelIndex&) const override { return 6; } GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - void update() override; String column_name(int column) const override; Vector& items() { return m_playlist_items; } diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index 63ebdda6ef29e07a2d6acc4df3bc517368c0eb47..e6eba8c455d2856865100d81102b8cf7d482c864 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -258,7 +258,7 @@ void SoundPlayerWidgetAdvancedView::read_playlist(StringView path) for (auto& item : *items) m_playlist_model->items().append(item); set_playlist_visible(true); - m_playlist_model->update(); + m_playlist_model->invalidate(); open_file(items->at(0).path); diff --git a/Userland/Applications/Spreadsheet/HelpWindow.cpp b/Userland/Applications/Spreadsheet/HelpWindow.cpp index f3f07f222cb37e0be262356a015e69c847ecac44..277a915f1b6c377e05caa0f9ae06adab6be2728d 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.cpp +++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp @@ -27,7 +27,6 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_keys.size(); } virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; } - virtual void update() override { } virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role = GUI::ModelRole::Display) const override { @@ -46,7 +45,7 @@ public: object.for_each_member([this](auto& name, auto&) { m_keys.append(name); }); - did_update(); + invalidate(); } private: diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp index 142c27f3fd93b46b2969f95bfd10f595bbaac90a..fdd11865f79cdffeae6a8cbd92b8d9c544474a3c 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp @@ -146,7 +146,7 @@ void SheetModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& valu auto& cell = m_sheet->ensure({ (size_t)index.column(), (size_t)index.row() }); cell.set_data(value.to_string()); - update(); + invalidate(); } void SheetModel::update() diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.h b/Userland/Applications/Spreadsheet/SpreadsheetModel.h index 0eb77e36007522511591616b979476bb3c6ae2c8..1536074e77336d5147ae483a7bb4e2eaf744f044 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.h +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.h @@ -23,11 +23,12 @@ public: virtual RefPtr mime_data(const GUI::ModelSelection&) const override; virtual bool is_editable(const GUI::ModelIndex&) const override; virtual void set_data(const GUI::ModelIndex&, const GUI::Variant&) override; - virtual void update() override; virtual bool is_column_sortable(int) const override { return false; } virtual StringView drag_data_type() const override { return "text/x-spreadsheet-data"; } Sheet& sheet() { return *m_sheet; } + void update(); + private: explicit SheetModel(Sheet& sheet) : m_sheet(sheet) diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp index 97cc81b2584765ffb5829b10951b5d4d12d49b57..f412dbfa282024a002c45c6ac8853da88658c18d 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp @@ -144,7 +144,7 @@ void InfinitelyScrollableTableView::mouseup_event(GUI::MouseEvent& event) void SpreadsheetView::update_with_model() { - m_table_view->model()->update(); + m_table_view->model()->invalidate(); m_table_view->update(); } diff --git a/Userland/Applications/SystemMonitor/DevicesModel.cpp b/Userland/Applications/SystemMonitor/DevicesModel.cpp index 569d3db8a8a6bdcbcf5a51dff92927e7bed40f64..eb8d5d104e6264435c4898a89dd500015cda9b82 100644 --- a/Userland/Applications/SystemMonitor/DevicesModel.cpp +++ b/Userland/Applications/SystemMonitor/DevicesModel.cpp @@ -118,8 +118,9 @@ GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol return {}; } -void DevicesModel::update() +void DevicesModel::invalidate() { + // FIXME: granularly update this. auto proc_devices = Core::File::construct("/proc/devices"); if (!proc_devices->open(Core::OpenMode::ReadOnly)) VERIFY_NOT_REACHED(); @@ -172,5 +173,5 @@ void DevicesModel::update() fill_in_paths_from_dir("/dev"); fill_in_paths_from_dir("/dev/pts"); - did_update(); + Model::invalidate(); } diff --git a/Userland/Applications/SystemMonitor/DevicesModel.h b/Userland/Applications/SystemMonitor/DevicesModel.h index 2358ae67d1a88b9ed795f78702cfd59bc132ab06..1e4a394f4645182a77c814974368657fe30ed072 100644 --- a/Userland/Applications/SystemMonitor/DevicesModel.h +++ b/Userland/Applications/SystemMonitor/DevicesModel.h @@ -28,7 +28,9 @@ public: virtual int column_count(const GUI::ModelIndex&) const override; virtual String column_name(int column) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; + + // FIXME: This should be moved to granularly updating itself. + virtual void invalidate() override; private: DevicesModel(); diff --git a/Userland/Applications/SystemMonitor/InterruptsWidget.cpp b/Userland/Applications/SystemMonitor/InterruptsWidget.cpp index 4a64d7f78f45cb3b80467a0250c68c70601f9c21..594ad29da91d1c99d61495f33a805b76fcb0b83a 100644 --- a/Userland/Applications/SystemMonitor/InterruptsWidget.cpp +++ b/Userland/Applications/SystemMonitor/InterruptsWidget.cpp @@ -44,5 +44,5 @@ InterruptsWidget::~InterruptsWidget() void InterruptsWidget::update_model() { - m_interrupt_table_view->model()->update(); + m_interrupt_model->invalidate(); } diff --git a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp index ce842ca1fb8cfa03d509d1ea3983e723fc4484aa..ec580f790f7b4c53cbee9a9481cd08ad2b2532c7 100644 --- a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp +++ b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp @@ -117,7 +117,7 @@ NetworkStatisticsWidget::~NetworkStatisticsWidget() void NetworkStatisticsWidget::update_models() { - m_adapter_table_view->model()->update(); - m_tcp_socket_table_view->model()->update(); - m_udp_socket_table_view->model()->update(); + m_adapter_model->invalidate(); + m_tcp_socket_model->invalidate(); + m_udp_socket_model->invalidate(); } diff --git a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp index 769ceacee843e495f2c2298a289ff1ed914f8ffc..ef4c156febcc8cef1bc443cf5776f67c3707581e 100644 --- a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp @@ -122,5 +122,5 @@ void ProcessMemoryMapWidget::set_pid(pid_t pid) void ProcessMemoryMapWidget::refresh() { if (m_pid != -1) - m_json_model->update(); + m_json_model->invalidate(); } diff --git a/Userland/Applications/SystemMonitor/ProcessModel.h b/Userland/Applications/SystemMonitor/ProcessModel.h index c679e51d754beae6cdb0f0df61381464d407b133..f6a77c4106d9b6b9e20114b84b45fcd46393f014 100644 --- a/Userland/Applications/SystemMonitor/ProcessModel.h +++ b/Userland/Applications/SystemMonitor/ProcessModel.h @@ -60,8 +60,8 @@ public: virtual int column_count(const GUI::ModelIndex&) const override; virtual String column_name(int column) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; virtual bool is_column_sortable(int column_index) const override { return column_index != Column::Icon; } + void update(); struct CpuInfo { u32 id; diff --git a/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp b/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp index 145ba2c1c9455d0c0d233f3b5fa9c7258ee773bf..05e6c4cadb237da82eb8fd6a2c97a02d7a3feaff 100644 --- a/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp @@ -57,11 +57,6 @@ public: return {}; } - virtual void update() override - { - did_update(GUI::Model::DontInvalidateIndices); - } - virtual void model_did_update([[maybe_unused]] unsigned flags) override { refresh(); @@ -77,7 +72,7 @@ public: break; } } - update(); + invalidate(); } private: diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index 84fe4c144c7ca2bd6f12f9e59e297575fe934c1d..fcc43dbc6138c2a6a1f680e0c11ab9da10bd95f7 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -225,11 +225,11 @@ int main(int argc, char** argv) process_table_view.set_column_visible(ProcessModel::Column::DirtyPrivate, true); process_table_view.set_key_column_and_sort_order(ProcessModel::Column::CPU, GUI::SortOrder::Descending); - process_table_view.model()->update(); + process_model->update(); auto& refresh_timer = window->add( 3000, [&] { - process_table_view.model()->update(); + process_model->update(); if (auto* memory_stats_widget = MemoryStatsWidget::the()) memory_stats_widget->refresh(); }); @@ -567,11 +567,12 @@ NonnullRefPtr build_file_systems_tab() df_fields.empend("free_inode_count", "Free inodes", Gfx::TextAlignment::CenterRight); df_fields.empend("total_inode_count", "Total inodes", Gfx::TextAlignment::CenterRight); df_fields.empend("block_size", "Block size", Gfx::TextAlignment::CenterRight); + fs_table_view.set_model(GUI::SortingProxyModel::create(GUI::JsonArrayModel::create("/proc/df", move(df_fields)))); fs_table_view.set_column_painting_delegate(3, make()); - fs_table_view.model()->update(); + fs_table_view.model()->invalidate(); }; return fs_widget; } @@ -629,7 +630,7 @@ NonnullRefPtr build_pci_devices_tab() }); pci_table_view.set_model(GUI::SortingProxyModel::create(GUI::JsonArrayModel::create("/proc/pci", move(pci_fields)))); - pci_table_view.model()->update(); + pci_table_view.model()->invalidate(); }; return pci_widget; @@ -645,7 +646,7 @@ NonnullRefPtr build_devices_tab() auto& devices_table_view = self.add(); devices_table_view.set_model(GUI::SortingProxyModel::create(DevicesModel::create())); - devices_table_view.model()->update(); + devices_table_view.model()->invalidate(); }; return devices_widget; @@ -748,8 +749,9 @@ NonnullRefPtr build_processors_tab() processors_field.empend("type", "Type", Gfx::TextAlignment::CenterRight); auto& processors_table_view = self.add(); - processors_table_view.set_model(GUI::JsonArrayModel::create("/proc/cpuinfo", move(processors_field))); - processors_table_view.model()->update(); + auto json_model = GUI::JsonArrayModel::create("/proc/cpuinfo", move(processors_field)); + processors_table_view.set_model(json_model); + json_model->invalidate(); }; return processors_widget; diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index 9bc0c985cdc1f23ecfc5af3aab13cfc4ac573cad..accce0e93a2d6df29489ccc0ce2c2205ab08a637 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -26,7 +26,6 @@ public: return Gfx::to_string(m_color_roles[(size_t)index.row()]); return {}; } - virtual void update() { did_update(); } explicit ColorRoleModel(const Vector& color_roles) : m_color_roles(color_roles) diff --git a/Userland/Demos/WidgetGallery/GalleryModels.h b/Userland/Demos/WidgetGallery/GalleryModels.h index 038a26b9cb82bd25ef96f13a77d2c9b398623bf7..85069ab3bc6800f2f6f1ee8640bdbf495bc61d6f 100644 --- a/Userland/Demos/WidgetGallery/GalleryModels.h +++ b/Userland/Demos/WidgetGallery/GalleryModels.h @@ -51,7 +51,7 @@ public: } return {}; } - virtual void update() override + virtual void update() { m_cursors.clear(); @@ -131,7 +131,7 @@ public: } return {}; } - virtual void update() override + virtual void update() { m_icon_sets.clear(); diff --git a/Userland/Demos/WidgetGallery/GalleryWidget.cpp b/Userland/Demos/WidgetGallery/GalleryWidget.cpp index f6d96a9400986b25b97f4193cf492e0cafd9bc3d..662057d8e314b63ab0e61057443af3aa683fbff6 100644 --- a/Userland/Demos/WidgetGallery/GalleryWidget.cpp +++ b/Userland/Demos/WidgetGallery/GalleryWidget.cpp @@ -290,7 +290,7 @@ GalleryWidget::GalleryWidget() m_cursors_tableview->set_model(sorting_proxy_model); m_cursors_tableview->set_key_column_and_sort_order(MouseCursorModel::Column::Name, GUI::SortOrder::Ascending); - m_cursors_tableview->model()->update(); + m_cursors_tableview->model()->invalidate(); m_cursors_tableview->set_column_width(0, 25); m_cursors_tableview->on_activation = [&](const GUI::ModelIndex& index) { @@ -363,7 +363,7 @@ GalleryWidget::GalleryWidget() m_icons_tableview->set_model(sorting_proxy_icons_model); m_icons_tableview->set_key_column_and_sort_order(FileIconsModel::Column::Name, GUI::SortOrder::Ascending); - m_icons_tableview->model()->update(); + m_icons_tableview->model()->invalidate(); m_icons_tableview->set_column_width(0, 36); m_icons_tableview->set_column_width(1, 20); } diff --git a/Userland/DevTools/HackStudio/ClassViewWidget.h b/Userland/DevTools/HackStudio/ClassViewWidget.h index 08d348b3e0499364f6e63323ae8e867ac256ac23..fa25c5f4649878fc27d19c9a29b954a408b0d422 100644 --- a/Userland/DevTools/HackStudio/ClassViewWidget.h +++ b/Userland/DevTools/HackStudio/ClassViewWidget.h @@ -45,7 +45,6 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; } virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole role) const override; - virtual void update() override { did_update(); } virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& parent_index = GUI::ModelIndex()) const override; diff --git a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h index 71000216eaa158fa167724df1c7d1ea5d4340bd7..cc4512aaeebafe96d198f64f5f7c50c0ae450c41 100644 --- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h +++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h @@ -33,7 +33,6 @@ public: virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override { } virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override; struct FrameInfo { diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp index 62a4bc0c16c459c333fd0b1d246a2600138a30cd..fdc43da6795c937a378590949ab5de4fed70fa11 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp @@ -111,9 +111,4 @@ GUI::Variant DisassemblyModel::data(const GUI::ModelIndex& index, GUI::ModelRole return {}; } -void DisassemblyModel::update() -{ - did_update(); -} - } diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h index ba856bcb6c3453107e4289773f75544ce024a696..a188951c179154c780843ce560ef6dc2e3f71ca2 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h @@ -46,7 +46,6 @@ public: virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } virtual String column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; private: DisassemblyModel(const Debug::DebugSession&, const PtraceRegisters&); diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp index d1c69090d3d837e663c60d72fc59624027347c32..1d62a924da676d354d4a912a675be2730a94d219 100644 --- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp @@ -136,9 +136,4 @@ GUI::Variant RegistersModel::data(const GUI::ModelIndex& index, GUI::ModelRole r return {}; } -void RegistersModel::update() -{ - did_update(); -} - } diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h index c685a61cfaa3fbd13e37487f72e546278046c3b2..86cd07a9f057186e837203f7bb57399a3663d2dc 100644 --- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h +++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h @@ -42,7 +42,6 @@ public: virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } virtual String column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; const PtraceRegisters& raw_registers() const { return m_raw_registers; } diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp index 8dfe5fb1ad5c81a009d75fe1052ad232e75e31f9..1bcae424feb17de0fee39b15b152ef675932aec5 100644 --- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp @@ -158,11 +158,6 @@ GUI::Variant VariablesModel::data(const GUI::ModelIndex& index, GUI::ModelRole r } } -void VariablesModel::update() -{ - did_update(); -} - RefPtr VariablesModel::create(const PtraceRegisters& regs) { auto lib = Debugger::the().session()->library_at(regs.ip()); diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h index 5b028f910be81b9b34323a1187f0272732c0fa0b..a6856b99e1d23e6fd4bd7c98141c121e2af74b4c 100644 --- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h +++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h @@ -23,7 +23,6 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; } virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override; - virtual void update() override; virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& = GUI::ModelIndex()) const override; diff --git a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp index c3fbe9aa501758587bc775452fb4bdc06e5b3062..f9f7a4481e6ddcf3334a9843bd7e67a22f05417b 100644 --- a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp @@ -24,7 +24,7 @@ ProjectTemplatesModel::ProjectTemplatesModel() if (!watcher_or_error.is_error()) { m_file_watcher = watcher_or_error.release_value(); m_file_watcher->on_change = [&](auto) { - update(); + invalidate(); }; auto watch_result = m_file_watcher->add_watch( diff --git a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h index 4674a738cfac11f1376a077ab6f1f03f0eda3312..4d0359f28cbb815cb6c8f035b6ed6fcc334b2f93 100644 --- a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h +++ b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h @@ -37,8 +37,8 @@ public: virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual String column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; + void update(); void rescan_templates(); private: diff --git a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp index 7bc50f0da8479e3df3b89568f772e243187db375..88fa1ad8991ee4f678aeb4edb233c7c430424407 100644 --- a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp +++ b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp @@ -76,7 +76,6 @@ public: return {}; } - virtual void update() override { } virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& = GUI::ModelIndex()) const override { if (row < 0 || row >= (int)m_matches.size()) diff --git a/Userland/DevTools/HackStudio/Git/GitFilesModel.h b/Userland/DevTools/HackStudio/Git/GitFilesModel.h index 1fcc0fa4f89aa57bef67e0319934be29e77c0ca7..a773f984913b7955a85475930bc33aa12ec83b35 100644 --- a/Userland/DevTools/HackStudio/Git/GitFilesModel.h +++ b/Userland/DevTools/HackStudio/Git/GitFilesModel.h @@ -27,7 +27,6 @@ public: virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override { } virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override; private: diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index ee240c1040e2846c963b41bf98d26a594225896d..d7da10e391cdd948d048db704a0bd4ed551c66fe 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -268,7 +268,7 @@ bool HackStudioWidget::open_file(const String& full_filename) } } - m_open_files_view->model()->update(); + m_open_files_view->model()->invalidate(); } current_editor().set_document(const_cast(new_project_file->document())); @@ -1115,7 +1115,7 @@ void HackStudioWidget::handle_external_file_deletion(const String& filepath) } } - m_open_files_view->model()->update(); + m_open_files_view->model()->invalidate(); } HackStudioWidget::~HackStudioWidget() diff --git a/Userland/DevTools/HackStudio/Locator.cpp b/Userland/DevTools/HackStudio/Locator.cpp index 705fd23f0762cbbd31b7f2c1b8986fd1d731aff0..3c81a189601735a45e1d2faf754f83a1d653d0a5 100644 --- a/Userland/DevTools/HackStudio/Locator.cpp +++ b/Userland/DevTools/HackStudio/Locator.cpp @@ -74,7 +74,6 @@ public: } return {}; } - virtual void update() override {}; const Vector& suggestions() const { return m_suggestions; } diff --git a/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp b/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp index 141fc27f31a763b5ccb5ceb68c5ac16bcac4a566..88fd1336d91c6891e7dfa2dd6032ea788eca4046 100644 --- a/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp +++ b/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp @@ -71,7 +71,6 @@ public: return {}; } - virtual void update() override { } virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& = GUI::ModelIndex()) const override { if (row < 0 || row >= (int)m_matches.size()) diff --git a/Userland/DevTools/Inspector/RemoteObject.cpp b/Userland/DevTools/Inspector/RemoteObject.cpp index 27e0c3d5842efd529e4636c451e33c8fa22f9d38..f4b0449143500b68ff9ef4519d671c46e98cfea5 100644 --- a/Userland/DevTools/Inspector/RemoteObject.cpp +++ b/Userland/DevTools/Inspector/RemoteObject.cpp @@ -16,7 +16,7 @@ RemoteObject::RemoteObject() RemoteObjectPropertyModel& RemoteObject::property_model() { - m_property_model->update(); + m_property_model->invalidate(); return *m_property_model; } diff --git a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp index 6ac721d98a5ec711dc5d2f1cd07af1427ab2ff96..fa910bc0c705eede241538797c843b89468e0709 100644 --- a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp +++ b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp @@ -95,9 +95,4 @@ GUI::Variant RemoteObjectGraphModel::data(const GUI::ModelIndex& index, GUI::Mod return {}; } -void RemoteObjectGraphModel::update() -{ - did_update(); -} - } diff --git a/Userland/DevTools/Inspector/RemoteObjectGraphModel.h b/Userland/DevTools/Inspector/RemoteObjectGraphModel.h index dd2aec794811693c97ad424173071aaafbf326ae..610f03a820b7664527c0cef4166eaf836262e84d 100644 --- a/Userland/DevTools/Inspector/RemoteObjectGraphModel.h +++ b/Userland/DevTools/Inspector/RemoteObjectGraphModel.h @@ -30,7 +30,6 @@ public: virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; - virtual void update() override; private: explicit RemoteObjectGraphModel(RemoteProcess&); diff --git a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp index 8244f012e512b3cdd444e5ff4623b7c426e9b759..85f3aa1936219cc9593461d4fa1f87e036889380 100644 --- a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp +++ b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp @@ -67,11 +67,6 @@ GUI::Variant RemoteObjectPropertyModel::data(const GUI::ModelIndex& index, GUI:: return {}; } -void RemoteObjectPropertyModel::update() -{ - did_update(); -} - void RemoteObjectPropertyModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& new_value) { if (!index.is_valid()) diff --git a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h index fca20109fe22c744ef8e13ee1eeba259fd32bf33..8dc7a3d1342daebcba3c751ddac4dd5eaedda8e9 100644 --- a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h +++ b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h @@ -34,7 +34,6 @@ public: virtual String column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual void set_data(const GUI::ModelIndex&, const GUI::Variant&) override; - virtual void update() override; virtual bool is_editable(const GUI::ModelIndex& index) const override { return index.column() == Column::Value; } virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; diff --git a/Userland/DevTools/Inspector/RemoteProcess.cpp b/Userland/DevTools/Inspector/RemoteProcess.cpp index 24a362da485142ab4ef82b11669fdc7499f99b95..9d744189af625b3421f68853fd9875b7ed00c173 100644 --- a/Userland/DevTools/Inspector/RemoteProcess.cpp +++ b/Userland/DevTools/Inspector/RemoteProcess.cpp @@ -71,7 +71,7 @@ void RemoteProcess::handle_get_all_objects_response(const JsonObject& response) } } - m_object_graph_model->update(); + m_object_graph_model->invalidate(); if (on_update) on_update(); diff --git a/Userland/DevTools/Profiler/DisassemblyModel.cpp b/Userland/DevTools/Profiler/DisassemblyModel.cpp index d68f9ac0027427c75826e31a291f01adcc3912be..39f1bbc648a4f98e117f0ac9aa34700b8545f3df 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.cpp +++ b/Userland/DevTools/Profiler/DisassemblyModel.cpp @@ -207,9 +207,4 @@ GUI::Variant DisassemblyModel::data(const GUI::ModelIndex& index, GUI::ModelRole return {}; } -void DisassemblyModel::update() -{ - did_update(); -} - } diff --git a/Userland/DevTools/Profiler/DisassemblyModel.h b/Userland/DevTools/Profiler/DisassemblyModel.h index ef36446477691d5b61c38438280975ecc90439ef..1cb07448b85c6e954ce9829e8a8e3889674cd4e4 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.h +++ b/Userland/DevTools/Profiler/DisassemblyModel.h @@ -47,7 +47,6 @@ public: virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } virtual String column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; virtual bool is_column_sortable(int) const override { return false; } private: diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.cpp b/Userland/DevTools/Profiler/IndividualSampleModel.cpp index 386d559910011810a3d3f0b47528e9279ddd6f6d..0f18a5c01edbbc2a599027e18893c9eca5bc79a8 100644 --- a/Userland/DevTools/Profiler/IndividualSampleModel.cpp +++ b/Userland/DevTools/Profiler/IndividualSampleModel.cpp @@ -67,9 +67,4 @@ GUI::Variant IndividualSampleModel::data(const GUI::ModelIndex& index, GUI::Mode return {}; } -void IndividualSampleModel::update() -{ - did_update(Model::InvalidateAllIndices); -} - } diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.h b/Userland/DevTools/Profiler/IndividualSampleModel.h index 95abc2541f19d1dab0ca267b681fc5befd3c66d7..567830d34fa7fdc7d8d438411dc17e7950f24254 100644 --- a/Userland/DevTools/Profiler/IndividualSampleModel.h +++ b/Userland/DevTools/Profiler/IndividualSampleModel.h @@ -32,7 +32,6 @@ public: virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual String column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; private: IndividualSampleModel(Profile&, size_t event_index); diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp index 86464140b4b6d8b424e2de7e755327527a12a242..c78ad405afa445d2f922a0f78db82eca565cf00a 100644 --- a/Userland/DevTools/Profiler/Profile.cpp +++ b/Userland/DevTools/Profiler/Profile.cpp @@ -187,7 +187,7 @@ void Profile::rebuild_tree() sort_profile_nodes(roots); m_roots = move(roots); - m_model->update(); + m_model->invalidate(); } Result, String> Profile::load_from_perfcore_file(const StringView& path) @@ -378,7 +378,7 @@ void Profile::set_timestamp_filter_range(u64 start, u64 end) m_timestamp_filter_range_end = max(start, end); rebuild_tree(); - m_samples_model->update(); + m_samples_model->invalidate(); } void Profile::clear_timestamp_filter_range() @@ -387,7 +387,7 @@ void Profile::clear_timestamp_filter_range() return; m_has_timestamp_filter_range = false; rebuild_tree(); - m_samples_model->update(); + m_samples_model->invalidate(); } void Profile::add_process_filter(pid_t pid, EventSerialNumber start_valid, EventSerialNumber end_valid) @@ -399,8 +399,8 @@ void Profile::add_process_filter(pid_t pid, EventSerialNumber start_valid, Event rebuild_tree(); if (m_disassembly_model) - m_disassembly_model->update(); - m_samples_model->update(); + m_disassembly_model->invalidate(); + m_samples_model->invalidate(); } void Profile::remove_process_filter(pid_t pid, EventSerialNumber start_valid, EventSerialNumber end_valid) @@ -414,8 +414,8 @@ void Profile::remove_process_filter(pid_t pid, EventSerialNumber start_valid, Ev rebuild_tree(); if (m_disassembly_model) - m_disassembly_model->update(); - m_samples_model->update(); + m_disassembly_model->invalidate(); + m_samples_model->invalidate(); } void Profile::clear_process_filter() @@ -425,8 +425,8 @@ void Profile::clear_process_filter() m_process_filters.clear(); rebuild_tree(); if (m_disassembly_model) - m_disassembly_model->update(); - m_samples_model->update(); + m_disassembly_model->invalidate(); + m_samples_model->invalidate(); } bool Profile::process_filter_contains(pid_t pid, EventSerialNumber serial) diff --git a/Userland/DevTools/Profiler/ProfileModel.cpp b/Userland/DevTools/Profiler/ProfileModel.cpp index 2879da41553dbad405a729b235bc4d99632cee77..26342039b163a66dbdc94c7e2af0236e91ec406c 100644 --- a/Userland/DevTools/Profiler/ProfileModel.cpp +++ b/Userland/DevTools/Profiler/ProfileModel.cpp @@ -135,9 +135,4 @@ GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol return {}; } -void ProfileModel::update() -{ - did_update(Model::InvalidateAllIndices); -} - } diff --git a/Userland/DevTools/Profiler/ProfileModel.h b/Userland/DevTools/Profiler/ProfileModel.h index 84c685940ed185513fab6f85cdf1a3c3bbca93a5..8adf6fb8c2dfc55ba2a04a811ba94553febc7493 100644 --- a/Userland/DevTools/Profiler/ProfileModel.h +++ b/Userland/DevTools/Profiler/ProfileModel.h @@ -35,7 +35,6 @@ public: virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; - virtual void update() override; virtual int tree_column() const override { return Column::StackFrame; } virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/SamplesModel.cpp b/Userland/DevTools/Profiler/SamplesModel.cpp index 49b2435e2e23b4b738ad55e07a9bfd4a507d951e..e0f461508d430f3c1de4341989f7ab05ef057aee 100644 --- a/Userland/DevTools/Profiler/SamplesModel.cpp +++ b/Userland/DevTools/Profiler/SamplesModel.cpp @@ -94,9 +94,4 @@ GUI::Variant SamplesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol return {}; } -void SamplesModel::update() -{ - did_update(Model::InvalidateAllIndices); -} - } diff --git a/Userland/DevTools/Profiler/SamplesModel.h b/Userland/DevTools/Profiler/SamplesModel.h index 8e89d5fc82731868750e82a02ffae9d4d939bf4d..5d190e9e0c1ee10dc98c8a7576df188a33284bbe 100644 --- a/Userland/DevTools/Profiler/SamplesModel.h +++ b/Userland/DevTools/Profiler/SamplesModel.h @@ -36,7 +36,6 @@ public: virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual String column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; virtual bool is_column_sortable(int) const override { return false; } private: diff --git a/Userland/Libraries/LibGUI/AbstractView.h b/Userland/Libraries/LibGUI/AbstractView.h index 69f734c87f93313cf4b9400eee5aa39f25d3d257..2fbb86ae64a9de90a3879141d30ae7f9b2880761 100644 --- a/Userland/Libraries/LibGUI/AbstractView.h +++ b/Userland/Libraries/LibGUI/AbstractView.h @@ -173,7 +173,6 @@ protected: bool m_editable { false }; bool m_searchable { true }; - ModelIndex m_edit_index; RefPtr m_edit_widget; Gfx::IntRect m_edit_widget_content_rect; OwnPtr 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: + ModelIndex m_selection_start_index; + ModelIndex m_cursor_index; + ModelIndex m_drop_candidate_index; + RefPtr m_model; ModelSelection m_selection; - ModelIndex m_selection_start_index; String m_searching; RefPtr m_searching_timer; - ModelIndex m_cursor_index; - ModelIndex m_drop_candidate_index; SelectionBehavior m_selection_behavior { SelectionBehavior::SelectItems }; SelectionMode m_selection_mode { SelectionMode::SingleSelection }; unsigned m_edit_triggers { EditTrigger::DoubleClicked | EditTrigger::EditKeyPressed }; diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp index 63e5ab18d7539a930f80939465a09e3e4a8abf12..25d60449350781d74e04965e700a23ac4b90f9ee 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp @@ -69,10 +69,6 @@ public: return {}; } - virtual void update() override - { - did_update(); - }; void set_suggestions(Vector&& suggestions) { m_suggestions = move(suggestions); } @@ -110,7 +106,7 @@ void AutocompleteBox::update_suggestions(Vector&& s m_suggestion_view->set_cursor(m_suggestion_view->model()->index(0), GUI::AbstractView::SelectionUpdate::Set); } - m_suggestion_view->model()->update(); + m_suggestion_view->model()->invalidate(); m_suggestion_view->update(); if (!has_suggestions) close(); diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index 5babccfca77333428097ca4491a7c30ad3f9e638..0a33540b3f140e80b5ebbba8bf6ba42612d17170 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -135,7 +135,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen if (rc < 0) { MessageBox::show(this, String::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(errno)), "Error", MessageBox::Type::Error); } else { - m_model->update(); + m_model->invalidate(); } } }, @@ -178,7 +178,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen m_context_menu->add_action(GUI::Action::create_checkable( "Show dotfiles", { Mod_Ctrl, Key_H }, [&](auto& action) { m_model->set_should_show_dotfiles(action.is_checked()); - m_model->update(); + m_model->invalidate(); }, this)); diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index 797affd754c095d1547629044abd7cc4eebc637b..61f8ee874243663312a9fdd53741d64ce0f543c8 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.cpp +++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp @@ -286,7 +286,7 @@ FileSystemModel::FileSystemModel(String root_path, Mode mode) did_update(); }; - update(); + invalidate(); } FileSystemModel::~FileSystemModel() @@ -364,7 +364,7 @@ void FileSystemModel::set_root_path(String root_path) m_root_path = {}; else m_root_path = LexicalPath::canonicalized_path(move(root_path)); - update(); + invalidate(); if (m_root->has_error()) { if (on_directory_change_error) @@ -374,7 +374,7 @@ void FileSystemModel::set_root_path(String root_path) } } -void FileSystemModel::update() +void FileSystemModel::invalidate() { m_root = adopt_own(*new Node(*this)); @@ -383,7 +383,7 @@ void FileSystemModel::update() m_root->reify_if_needed(); - did_update(); + Model::invalidate(); } int FileSystemModel::row_count(const ModelIndex& index) const @@ -665,7 +665,9 @@ void FileSystemModel::set_should_show_dotfiles(bool show) if (m_should_show_dotfiles == show) return; m_should_show_dotfiles = show; - update(); + + // FIXME: add a way to granularly update in this case. + invalidate(); } bool FileSystemModel::is_editable(const ModelIndex& index) const diff --git a/Userland/Libraries/LibGUI/FileSystemModel.h b/Userland/Libraries/LibGUI/FileSystemModel.h index f1984b3f3c6a3891127fccaa06deaee8bff1d77e..57af96a5f1d0ce9babcab032a4aab1d20229ad47 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.h +++ b/Userland/Libraries/LibGUI/FileSystemModel.h @@ -122,7 +122,6 @@ public: virtual int column_count(const ModelIndex& = ModelIndex()) const override; virtual String column_name(int column) const override; virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const override; - virtual void update() override; virtual ModelIndex parent_index(const ModelIndex&) const override; virtual ModelIndex index(int row, int column = 0, const ModelIndex& parent = ModelIndex()) const override; virtual StringView drag_data_type() const override { return "text/uri-list"; } @@ -132,6 +131,7 @@ public: virtual bool is_searchable() const override { return true; } virtual void set_data(const ModelIndex&, const Variant&) override; virtual Vector matches(const StringView&, unsigned = MatchesFlag::AllMatching, const ModelIndex& = ModelIndex()) override; + virtual void invalidate() override; static String timestamp_string(time_t timestamp) { diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp index 229e193a700d536e142d2b0e4613753dc805c7ad..eb66668aa08a0fbdc748f3315d322d668e5a4098 100644 --- a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp +++ b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp @@ -44,9 +44,9 @@ Variant FilteringProxyModel::data(const ModelIndex& index, ModelRole role) const return m_matching_indices[index.row()].data(role); } -void FilteringProxyModel::update() +void FilteringProxyModel::invalidate() { - m_model.update(); + m_model.invalidate(); filter(); did_update(); } @@ -84,7 +84,7 @@ void FilteringProxyModel::set_filter_term(const StringView& term) if (m_filter_term == term) return; m_filter_term = term; - update(); + invalidate(); } ModelIndex FilteringProxyModel::map(const ModelIndex& index) const diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.h b/Userland/Libraries/LibGUI/FilteringProxyModel.h index a83fb0f52fc42d20e008e59333f4d5704c6ed568..31b06b10693d91162856bdaf409cb28531d9bcdf 100644 --- a/Userland/Libraries/LibGUI/FilteringProxyModel.h +++ b/Userland/Libraries/LibGUI/FilteringProxyModel.h @@ -26,7 +26,7 @@ public: virtual int row_count(const ModelIndex& = ModelIndex()) const override; virtual int column_count(const ModelIndex& = ModelIndex()) const override; virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const override; - virtual void update() override; + virtual void invalidate() override; virtual ModelIndex index(int row, int column = 0, const ModelIndex& parent = ModelIndex()) const override; virtual bool is_searchable() const override; virtual Vector matches(const StringView&, unsigned = MatchesFlag::AllMatching, const ModelIndex& = ModelIndex()) override; diff --git a/Userland/Libraries/LibGUI/FontPicker.cpp b/Userland/Libraries/LibGUI/FontPicker.cpp index cf84c3875b29bb20a5948db7a2e10a0d6949bf7f..b15cca238141685f129ab53149d9462b2583a5d8 100644 --- a/Userland/Libraries/LibGUI/FontPicker.cpp +++ b/Userland/Libraries/LibGUI/FontPicker.cpp @@ -71,7 +71,7 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo if (m_weight.has_value()) index_of_old_weight_in_new_list = m_weights.find_first_index(m_weight.value()); - m_weight_list_view->model()->update(); + m_weight_list_view->model()->invalidate(); m_weight_list_view->set_cursor(m_weight_list_view->model()->index(index_of_old_weight_in_new_list.value_or(0)), GUI::AbstractView::SelectionUpdate::Set); update_font(); }; @@ -110,7 +110,7 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo } }); quick_sort(m_sizes); - m_size_list_view->model()->update(); + m_size_list_view->model()->invalidate(); m_size_list_view->set_selection_mode(GUI::AbstractView::SelectionMode::SingleSelection); if (m_size.has_value()) { @@ -188,8 +188,8 @@ void FontPicker::set_font(const Gfx::Font* font) m_size = {}; m_weights.clear(); m_sizes.clear(); - m_weight_list_view->model()->update(); - m_size_list_view->model()->update(); + m_weight_list_view->model()->invalidate(); + m_size_list_view->model()->invalidate(); return; } diff --git a/Userland/Libraries/LibGUI/ItemListModel.h b/Userland/Libraries/LibGUI/ItemListModel.h index fc6cbca461baa0aef4aee8b755a33b1bb3e12cbe..4d4cca79f448ffde9fc5734b2ed84505f44d22e3 100644 --- a/Userland/Libraries/LibGUI/ItemListModel.h +++ b/Userland/Libraries/LibGUI/ItemListModel.h @@ -77,11 +77,6 @@ public: return {}; } - virtual void update() override - { - did_update(); - } - protected: explicit ItemListModel(const Container& data, Optional row_count = {}) requires(!IsTwoDimensional) : m_data(data) diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.cpp b/Userland/Libraries/LibGUI/JsonArrayModel.cpp index f294083f142d88b861e225a73bcba3f277160ca7..409c8ed732f359df5066e580509517b678d474f8 100644 --- a/Userland/Libraries/LibGUI/JsonArrayModel.cpp +++ b/Userland/Libraries/LibGUI/JsonArrayModel.cpp @@ -10,7 +10,7 @@ namespace GUI { -void JsonArrayModel::update() +void JsonArrayModel::invalidate() { auto file = Core::File::construct(m_json_path); if (!file->open(Core::OpenMode::ReadOnly)) { @@ -131,7 +131,7 @@ void JsonArrayModel::set_json_path(const String& json_path) return; m_json_path = json_path; - update(); + invalidate(); } } diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.h b/Userland/Libraries/LibGUI/JsonArrayModel.h index c8233bd15e9d3004fb8e23b9fdb8444280f67635..e898f98146265503359b9bf0d909d45ae265a0d1 100644 --- a/Userland/Libraries/LibGUI/JsonArrayModel.h +++ b/Userland/Libraries/LibGUI/JsonArrayModel.h @@ -50,7 +50,7 @@ public: virtual int column_count(const ModelIndex& = ModelIndex()) const override { return m_fields.size(); } virtual String column_name(int column) const override { return m_fields[column].column_name; } virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const override; - virtual void update() override; + virtual void invalidate() override; const String& json_path() const { return m_json_path; } void set_json_path(const String& json_path); diff --git a/Userland/Libraries/LibGUI/Model.cpp b/Userland/Libraries/LibGUI/Model.cpp index 46420edfadb9e409f0fd2136a89062b96c2c1e8f..5a0406a1bbc37ef3dcae171fb426d3c39f525e8c 100644 --- a/Userland/Libraries/LibGUI/Model.cpp +++ b/Userland/Libraries/LibGUI/Model.cpp @@ -29,6 +29,11 @@ void Model::unregister_view(Badge, AbstractView& view) m_clients.remove(&view); } +void Model::invalidate() +{ + did_update(); +} + void Model::for_each_view(Function callback) { for (auto* view : m_views) diff --git a/Userland/Libraries/LibGUI/Model.h b/Userland/Libraries/LibGUI/Model.h index 8a314c45633f8b39353a24076f405c60a3e0658b..551a30964b2714b32ff7363de242ab038f964c4d 100644 --- a/Userland/Libraries/LibGUI/Model.h +++ b/Userland/Libraries/LibGUI/Model.h @@ -56,7 +56,7 @@ public: virtual String column_name(int) const { return {}; } virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const = 0; virtual TriState data_matches(const ModelIndex&, const Variant&) const { return TriState::Unknown; } - virtual void update() = 0; + virtual void invalidate(); virtual ModelIndex parent_index(const ModelIndex&) const { return {}; } virtual ModelIndex index(int row, int column = 0, const ModelIndex& parent = ModelIndex()) const; virtual bool is_editable(const ModelIndex&) const { return false; } diff --git a/Userland/Libraries/LibGUI/ProcessChooser.cpp b/Userland/Libraries/LibGUI/ProcessChooser.cpp index d49d19929c1aaf689a35ae91a0461f313337e50d..bd8b1b11439c994a655e34459094e041ae79807d 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.cpp +++ b/Userland/Libraries/LibGUI/ProcessChooser.cpp @@ -65,7 +65,7 @@ ProcessChooser::ProcessChooser(const StringView& window_title, const StringView& done(ExecCancel); }; - m_table_view->model()->update(); + m_table_view->model()->invalidate(); m_refresh_timer = add(); @@ -77,7 +77,7 @@ ProcessChooser::ProcessChooser(const StringView& window_title, const StringView& previous_selected_pid = pid_as_variant.as_i32(); } - m_table_view->model()->update(); + m_table_view->model()->invalidate(); if (previous_selected_pid == -1) { return; diff --git a/Userland/Libraries/LibGUI/RunningProcessesModel.h b/Userland/Libraries/LibGUI/RunningProcessesModel.h index 7b18e9a3370717800bfe94022a69adb637c8d9a9..f57017e8186f0ec39ad5ccf841e74da030227005 100644 --- a/Userland/Libraries/LibGUI/RunningProcessesModel.h +++ b/Userland/Libraries/LibGUI/RunningProcessesModel.h @@ -28,7 +28,8 @@ public: virtual int column_count(const GUI::ModelIndex&) const override; virtual String column_name(int column_index) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; + + void update(); private: RunningProcessesModel(); diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.cpp b/Userland/Libraries/LibGUI/SortingProxyModel.cpp index 7ae72e907ee3e6df635f84199fbe98e1589c3000..fd8a4dbb519724f3c1e25552dc653a6d9714d3c0 100644 --- a/Userland/Libraries/LibGUI/SortingProxyModel.cpp +++ b/Userland/Libraries/LibGUI/SortingProxyModel.cpp @@ -14,7 +14,7 @@ SortingProxyModel::SortingProxyModel(NonnullRefPtr source) : m_source(move(source)) { m_source->register_client(*this); - invalidate(); + update_sort(); } SortingProxyModel::~SortingProxyModel() @@ -22,7 +22,13 @@ SortingProxyModel::~SortingProxyModel() m_source->unregister_client(*this); } -void SortingProxyModel::invalidate(unsigned int flags) +void SortingProxyModel::invalidate() +{ + source().invalidate(); + Model::invalidate(); +} + +void SortingProxyModel::update_sort(unsigned flags) { if (flags == UpdateFlag::DontInvalidateIndices) { sort(m_last_key_column, m_last_sort_order); @@ -40,7 +46,7 @@ void SortingProxyModel::invalidate(unsigned int flags) void SortingProxyModel::model_did_update(unsigned flags) { - invalidate(flags); + update_sort(flags); } bool SortingProxyModel::accepts_drag(const ModelIndex& proxy_index, const Vector& mime_types) const @@ -110,11 +116,6 @@ Variant SortingProxyModel::data(const ModelIndex& proxy_index, ModelRole role) c return source().data(map_to_source(proxy_index), role); } -void SortingProxyModel::update() -{ - source().update(); -} - StringView SortingProxyModel::drag_data_type() const { return source().drag_data_type(); diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.h b/Userland/Libraries/LibGUI/SortingProxyModel.h index 22ce2935a4a7a3161dad16c92bb94e4afc9fd0d2..27d6c351322e461cf703bdfd14a10644c34dc53c 100644 --- a/Userland/Libraries/LibGUI/SortingProxyModel.h +++ b/Userland/Libraries/LibGUI/SortingProxyModel.h @@ -21,7 +21,7 @@ public: virtual int column_count(const ModelIndex& = ModelIndex()) const override; virtual String column_name(int) const override; virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const override; - virtual void update() override; + virtual void invalidate() override; virtual StringView drag_data_type() const override; virtual ModelIndex parent_index(const ModelIndex&) const override; virtual ModelIndex index(int row, int column, const ModelIndex& parent) const override; @@ -63,7 +63,7 @@ private: Model& source() { return *m_source; } const Model& source() const { return *m_source; } - void invalidate(unsigned flags = Model::UpdateFlag::DontInvalidateIndices); + void update_sort(unsigned = UpdateFlag::DontInvalidateIndices); InternalMapIterator build_mapping(const ModelIndex& proxy_index); NonnullRefPtr m_source; diff --git a/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp b/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp index a4a9300bc9024116e1dc826e3d1ef47e3044687f..dbff61cd718e54c6721af9c241733e0d926a5395 100644 --- a/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp +++ b/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp @@ -152,11 +152,6 @@ GUI::Variant DOMTreeJSONModel::data(const GUI::ModelIndex& index, GUI::ModelRole return {}; } -void DOMTreeJSONModel::update() -{ - did_update(); -} - void DOMTreeJSONModel::map_dom_nodes_to_parent(JsonObject const* parent, JsonObject const* node) { m_dom_node_to_parent_map.set(node, parent); diff --git a/Userland/Libraries/LibWeb/DOMTreeJSONModel.h b/Userland/Libraries/LibWeb/DOMTreeJSONModel.h index 90f6cfe862f229b83b6152fd9d04e375c6891419..f80f1b52b8c33525d6c8fb2a9b47f7c3196bf5f7 100644 --- a/Userland/Libraries/LibWeb/DOMTreeJSONModel.h +++ b/Userland/Libraries/LibWeb/DOMTreeJSONModel.h @@ -32,7 +32,6 @@ public: virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; - virtual void update() override; private: explicit DOMTreeJSONModel(JsonObject); diff --git a/Userland/Libraries/LibWeb/DOMTreeModel.cpp b/Userland/Libraries/LibWeb/DOMTreeModel.cpp index 35a2799cc0cb2cdc6421022d249ebc9cba91114e..df2209687a44063f841dc3cc65ab3bdbc8f9f025 100644 --- a/Userland/Libraries/LibWeb/DOMTreeModel.cpp +++ b/Userland/Libraries/LibWeb/DOMTreeModel.cpp @@ -131,9 +131,4 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol return {}; } -void DOMTreeModel::update() -{ - did_update(); -} - } diff --git a/Userland/Libraries/LibWeb/DOMTreeModel.h b/Userland/Libraries/LibWeb/DOMTreeModel.h index 7a0c6656e486db8de664b0fe16e22e0e419fe1d4..574c2b316c9e2a2f20e731f408b4a53d69687b9d 100644 --- a/Userland/Libraries/LibWeb/DOMTreeModel.h +++ b/Userland/Libraries/LibWeb/DOMTreeModel.h @@ -25,7 +25,6 @@ public: virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; - virtual void update() override; private: explicit DOMTreeModel(DOM::Document&); diff --git a/Userland/Libraries/LibWeb/LayoutTreeModel.cpp b/Userland/Libraries/LibWeb/LayoutTreeModel.cpp index 164b6a0b43b487d83a986b1247a9df5963cb9187..80f508486c121e879560f22b530895ac857ff669 100644 --- a/Userland/Libraries/LibWeb/LayoutTreeModel.cpp +++ b/Userland/Libraries/LibWeb/LayoutTreeModel.cpp @@ -134,9 +134,4 @@ GUI::Variant LayoutTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole return {}; } -void LayoutTreeModel::update() -{ - did_update(); -} - } diff --git a/Userland/Libraries/LibWeb/LayoutTreeModel.h b/Userland/Libraries/LibWeb/LayoutTreeModel.h index ec203227d27929be74ed886405ab59222e647308..c533a95e312670726262fbe6ea4a49b47c13b4ad 100644 --- a/Userland/Libraries/LibWeb/LayoutTreeModel.h +++ b/Userland/Libraries/LibWeb/LayoutTreeModel.h @@ -25,7 +25,6 @@ public: virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; - virtual void update() override; private: explicit LayoutTreeModel(DOM::Document&); diff --git a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp index fbc95c695823dc1c49043737e8a994422ac1c33e..50ebd5b5e76e311e1dbc88a215f2fa5e08bafaeb 100644 --- a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp +++ b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp @@ -53,9 +53,4 @@ GUI::Variant StylePropertiesModel::data(const GUI::ModelIndex& index, GUI::Model return {}; } -void StylePropertiesModel::update() -{ - did_update(); -} - } diff --git a/Userland/Libraries/LibWeb/StylePropertiesModel.h b/Userland/Libraries/LibWeb/StylePropertiesModel.h index eba051770848d346d87499cb3455a1b9836651bd..a5e84c617aa16b3be7412d70895d69cf812af750 100644 --- a/Userland/Libraries/LibWeb/StylePropertiesModel.h +++ b/Userland/Libraries/LibWeb/StylePropertiesModel.h @@ -28,7 +28,6 @@ public: virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } virtual String column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - virtual void update() override; private: explicit StylePropertiesModel(const CSS::StyleProperties& properties);