mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
LibGUI: Implement granular updates for FileSystemModel
FileSystemModel will now react to specific events from Core::FileWatcher in order to granularly update its data based on addition or removal of files from the tree. Metadata changes are currently not handled, but in the future they can be used to re-stat() a file to get its updated statistics.
This commit is contained in:
parent
e377b508b7
commit
8c9c2f46c7
2 changed files with 95 additions and 42 deletions
|
@ -93,7 +93,9 @@ public:
|
|||
ModelIndex index(int column) const;
|
||||
void traverse_if_needed();
|
||||
void reify_if_needed();
|
||||
bool fetch_data(const String& full_path, bool is_root);
|
||||
bool fetch_data(String const& full_path, bool is_root);
|
||||
|
||||
OwnPtr<Node> create_child(String const& child_name);
|
||||
};
|
||||
|
||||
static NonnullRefPtr<FileSystemModel> create(String root_path = "/", Mode mode = Mode::FilesAndDirectories)
|
||||
|
@ -155,6 +157,8 @@ private:
|
|||
bool fetch_thumbnail_for(const Node& node);
|
||||
GUI::Icon icon_for(const Node& node) const;
|
||||
|
||||
void handle_file_event(Core::FileWatcherEvent const& event);
|
||||
|
||||
String m_root_path;
|
||||
Mode m_mode { Invalid };
|
||||
OwnPtr<Node> m_root { nullptr };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue