|
| | FileThumbnails (ITextSystem &textSystem, size_t capacity=512, Reader reader=ShellReader(), std::chrono::milliseconds inUse=std::chrono::milliseconds(500)) |
| | ~FileThumbnails () |
| | FileThumbnails (const FileThumbnails &)=delete |
| FileThumbnails & | operator= (const FileThumbnails &)=delete |
| IconID | Get (const std::filesystem::path &file, std::filesystem::file_time_type modified, uint32_t pixels) |
| | The thumbnail of the file file on the disk, last written at modified, at most pixels square (the icon's size on screen, in pixels).
|
| void | SetOnRead (std::function< void()> onRead) |
| | Called on the reading thread each time a file was read, with a thumbnail or without: ask for a frame there (GUIApplication::RequestRedraw), so a view that waits for input shows it.
|
| size_t | Count () const |
| | How many are kept, read or still being read.
|
| size_t | Reading () |
| | How many of those are still being read.
|
A file's thumbnail, registered with a text system as a picture icon (ITextSystem::RegisterIconFromPixels).
Thumbnails are read on a thread of their own, so Get gives IconID::Invalid until one is ready, and for a file without one: a view shows the file's type icon (FileIcons) meanwhile. Read from the Windows shell (what Explorer shows); elsewhere there are none.
Kept by path, modification time and size, so a file that changed is read again. At most capacity are kept: past that, the one asked for longest ago is let go, and its icon unregistered (ITextSystem::UnregisterIcon). One asked for within inUse (on screen still) isn't let go: a file past those gets no thumbnail until one is, rather than all of them being read over and over. Destroy it before the text system.
| IconID tachyon::FileThumbnails::Get |
( |
const std::filesystem::path & | file, |
|
|
std::filesystem::file_time_type | modified, |
|
|
uint32_t | pixels ) |
The thumbnail of the file file on the disk, last written at modified, at most pixels square (the icon's size on screen, in pixels).
Starts reading it the first time; IconID::Invalid until it's ready, for a file without one, and for an empty path (a file that's only in memory).