Don't query for the actual GFile in the list, because we already have
the information from the iterator. Cache the other path segments since
they are likely to be repeated.
On a local SMB share folder with 10,000 images and 4 path segments, this
reduces the loading time from 30 seconds to 1 second.
Fixes#534
GVfs smb does not provide a FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE if the
content type is ambiguous. This happens for png/apng. Since we only need
to know if something is probably an image, we can use the fast content
type instead.
Closes#339
The files are stored in an index map.
When removing from that map, `remove` does not guarantee to preserve order.
However `shift_remove` does.
Fixes#270
Before, the code would not continue to listing the files
if connecting to the file monitor failed. Therefore, browsing
files was not available on SMB where file monitors don't work.
Closes#200
Rust's standard library now provides a drop-in replacement
for `OnceCell`. It requires no API changes from `once_cell`'s
version.
This commit replaces the version from `once_cell` with the
new `std` struct where possible. We still need to use
`once_cell` for properties until
https://github.com/gtk-rs/gtk-rs-core/pull/1113
is merged. We also still need it for Lazy until that lands.
Part-of: <https://gitlab.gnome.org/GNOME/Incubator/loupe/-/merge_requests/241>
Use IndexSet to allow direct access by Path and also allow
an arbitrary ordering that was not possible with Vec. Also
add monitoring of file changes in the directory.
Use a custom LpSlidingView instead of AdwCarousel because
Carousel was never designed for this job and suffered of
bugs. LpSlidingView does not support swiping gestures yet
since they currently don't work yet anyways #24.
Use a new algorithm to fill the LpSlidingView that is
stateless and covers all potential changes in the directory.
This not only fixes bugs but would also work with changed
sorting orders.
This also adds build time template XML validation since it
was useful for the refactoring #46.
Closes#9, #11, #30, #33, #42
Give LpImage a native with that should feel nice.
When opening a new window with a new image the window size
is determined by LpImage's natural width.
The image size and EXIF data is loaded before the image such
that the window can be shown in the right dimension while
loading the actual image.
- Fixes image cannot be opened when directory unreadable
- Avoids bugs with wrong images being selected for an instant.
Mostly important for adjusting the window size to image.
- Basis for prioritizing loading the important image first
Binary search is a fast method to sort for an item within
a sorted list. We have a sorted list, so we can take advantage
of binary search instead of having a linear traversal through
the list.
Because binary search requires a sorted list, we need to use
the same logic for sorting and searching. Here we factor out
the filename comparison logic into `util::compare_by_name()`.
In the future we may want to have a module for sorting algorithm
logic and checking what sorting algortihm Nautilus uses.
These functions required iterating to find the
index of a file and then adding one to it.
We can be smarter, using an index we already
have and adding or subtracting where appropriate.
Previously we loaded images synchronously and manually
changed `LpImage`. This could cause freezes when loading
large images and SVGs. We also had no proper feedback for
when a corrupted or unsupported image was loaded.
This commit introduces a major rework to how we handle
images and the gallery. It introduces a swipeable gallery
that loads files asynchronously via a new widget: LpImagePage.
LpImagePage owns the file and information related to the file,
and on creation it spawns a future that either loads an error
page when it can't load something (file deleted, corrupted, or
unsupported) or the actual image via LpImage. LpImagePage
now holds the right-click popover and the associated gestures.
The gestures needed to be moved to LpImagePage in order to
rework LpImageView's overlay - instead of having an overlay
child that's a box with a few buttons, we now have the buttons
as individual overlay children. This could cause them
to overlap each other at certain sizes, but it's required
in order to allow input to reach the carousel below.
Right now this comes with a few regressions:
* Occasionally input gets blocked across the applications. It's
hard to tell if this is caused by swipes or right clicking. This
input issue can cause a crash - no Rust backtrace, so a debugger
is needed.
* The "current" page doesn't seem to be properly loaded by the
time `set_image_from_file ()` finishes, so we need to rework
resizing from image dimensions
* We need to re-implement loading different directories and
files within directories
There also seems to be an issue on touchscreens, swiping between
images on a touchscreen causes responsiveness issues not present
when swiping on a touchpad. My guess is that it's related to
the long press gesture.