Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thumbnails #1262

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft

Thumbnails #1262

wants to merge 19 commits into from

Conversation

leejuyuu
Copy link
Collaborator

@leejuyuu leejuyuu commented Feb 2, 2025

No description provided.

leejuyuu added 14 commits March 1, 2025 00:59
The byte array parameter of this function is always empty. Remove it for
simplicity.
- Return early if scaling is not needed in DkImage::createThumb
- Change duplicated code in DkThumbNail::computeIntern into
  DkImage::createThumb call.
- Remove unused maxThumbSize parameter of DkThumbNail::computeIntern
- Remove unused mMaxThumbSize member of DkThumbNail
- Remove the unused forceLoad flag of DkThumbNail::compute()
- Absorb common DkImage::createThumb() call into
  DkThumbNail::computeIntern().
- Use the QtConcurrent::run() feature to pass arguments instead of using
  lambda. The copying is handled by Qt.
This is part of the effort to move DkThumbNailT out of DkImageContainer.
The widgets that needs thumbnails should make their own.

- Add function to create DkThumbNailT from DkImageContainer because the
  creation accesses internal state for zip files.
- Create the DkThumbNailT inside DkThumbSaver instead of using
  DkImageContainer::getThumb().
- Remove the excess DkThumbSaver::loadNext call
This is part of the effort to move DkThumbNailT out of DkImageContainer.
The widgets that needs thumbnails should make their own.
- Remove the confusing icon variable
- Return early if input is invalid, specify empty initializer
This is part of the effort to move DkThumbNailT out of DkImageContainer.

Get the icon for the tab bar from the actual image instead of the
DkThumbNailT. This does not change the behavior because
DkImageContainerT::loadingFinished writes the loaded image to the
DkThumbNailT. Therefore we are still getting the same data.
Pass the icon size into getIcon() for caching the scaled image.
Remove the unused mThumb and its getter and setters from
DkImageContainer.
Split DkThumbNail::computeIntern into smaller functions to make it
easier to understand. Separate the reading and writing part so we can
reuse the reading. Remove unnecessary scalings.
Use the loadThumbnail function instead, to reduce the API surface of
DkThumbNail.
leejuyuu added 4 commits March 1, 2025 19:03
Originally, the thumbnails were loaded concurrently with DkThumbNailT.
However, since the thumbnails we load generally lives in a single
directory, i.e. one I/O device, reading the files concurrently probably
does not help.

Add DkThumbLoader to spawn a thread and accept requests for thumbnails.
The requests can be automatically queued by the QueuedConnection.
With the queue, we can prioritize reading the files that has EXIF
thumbnails and come back to decode the full image for those doesn't
later.

Place the DkThumbLoader in DkCentralWidget, the lowest common ancestor
of the widgets that use thumbnails. Rewrite DkThumbLabel so it uses
DkThumbLoader and no longer holds DkThumbNailT.

Closes nomacs#648
Thumbnails should be the preview of the files on the disk,
so they only update when the edits are written to the file.
Do not read thumbnail from the image containers in DkFilePreview.
Then we can make the DkFilePreview not dependent on DkImageContainerT.
Also gets rid of various syncing issues.

Fixes nomacs#663
Fixes nomacs#787
Closes nomacs#1263
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant