1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:47:35 +00:00

Assistant: Make Result bitmaps virtual/lazy

Result classes now return their bitmap via a virtual Gfx::Bitmap*
getter. This effectively makes bitmap fetching lazier, since only
results that end up on screen actually get asked for their bitmap.

This drastically reduces the amount of work done by the FileProvider
background worker.
This commit is contained in:
Andreas Kling 2021-07-03 17:46:26 +02:00
parent 1c29e2f3f7
commit 513e67e2eb
2 changed files with 37 additions and 11 deletions

View file

@ -112,6 +112,11 @@ void CalculatorProvider::query(String const& query, Function<void(NonnullRefPtrV
on_complete(results);
}
Gfx::Bitmap const* FileResult::bitmap() const
{
return GUI::Icon::default_icon("filetype-folder").bitmap_for_size(16);
}
void FileProvider::query(const String& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
{
build_filesystem_cache();