Commit graph

59 commits

Author SHA1 Message Date
Sophie Herold
8669b870af image: Fix textures and bg color not reloading
The reload procedure for changed image files is triggered
but the old data has to be deleted to be re-generated.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/176>
2023-04-18 21:03:02 +00:00
Sophie Herold
5a93ec71da image: Do not require monitor information
Before, monitor information not being available lead to panic.

Closes #77

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/167>
2023-04-18 17:08:35 +00:00
Sophie Herold
fad8bb7939 decoder: Use GFile instead of PathBuf
This allows to show images from locations that don't
have a representation with path.

This also works around not being able to read files in trash:///

Closes #56

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/174>
2023-04-18 16:22:49 +00:00
Sophie Herold
032707a210 fileModel: Use GFile with URI as key
Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/174>
2023-04-18 16:22:49 +00:00
Sophie Herold
f8cc9f5f84 i18n: Use gettext function instead of wrapper
No need to deviate from the default here.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/170>
2023-04-12 12:58:40 +00:00
Sophie Herold
8b3cfd000a cargo: Remove gtk-macros dependency
Using the crate is depreacted. Replaced spawn! macro
with our own spawn function
2023-04-06 21:08:33 +00:00
Sophie Herold
1b18486826 image: Move background color guess to other thread
Also, skip it completely for JPEG and BMP

Issue #111
2023-04-04 22:13:36 +00:00
Sophie Herold
5d7cbe026f image: Remove debug prints from bg color guesser
Closes #111
2023-04-03 16:56:54 +02:00
Sophie Herold
7bf9baa581 image: Ensure contrast for transparent images
Determine if the image is transparent and has low
contrast with default background color. If so,
use a different background color.

Closes #31

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/151>
2023-04-02 23:08:51 +00:00
Sophie Herold
533158bb69 image: Request tiles on size_allocate
Fixes tiles for SVG might be missing when enlarging window.

Closes #104

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/155>
2023-04-02 21:36:24 +00:00
Sophie Herold
750fbfd305 image: Settle with either rotate or zoom gesture
Add thresholds after which the gesture is assumed to be
only zoom or rotate.

Closes #95, #29

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/145>
2023-04-02 16:47:57 +00:00
Sophie Herold
e5fc4bc85c image: Add high DPI support
Always interpret the scaling percentag in physical pixels.
This makes 100% show the image 1:1 in screen pixels.

Closes #37
2023-04-02 15:22:12 +00:00
Sophie Herold
67207bb215 image: Use mipmaps for zoom-out and NN for zoom-in
Before we always used "linear" filtering. This gave
a harsh image with moire patterns when zooming out
and washed out images when zooming in.

Closes #68, #71

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/125>
2023-03-25 15:32:31 +00:00
Sophie Herold
0e24f347e6 imagePage: Move popover out of LpImage
It cause 'not measured' errors and we have enough
things to handle in LpImage already.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/146>
2023-03-18 21:24:45 +00:00
Sophie Herold
f33c4bd470 decoder: Support animated formats (GIF, WEBP, APNG)
Closes #27
2023-03-18 20:23:08 +00:00
Sophie Herold
889c818c14 code: Use pub(super) in GObject impl structs
This helps with getting warnings for fields we no longer use

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/143>
2023-03-14 21:25:45 +00:00
Sophie Herold
b8d5f833f3 decoder: Cleanup and better image format detection
Closes #97

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/140>
2023-03-14 03:59:21 +01:00
Sophie Herold
42d558d22f propertiesView: Use image dimensions from decoder
This also shows the units for SVG dimensions if not pixels.

Issue #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/136>
2023-03-14 02:31:07 +00:00
Sophie Herold
a2a9b4134b propertiesView: Use decoder format
Use the format that we actually used when decoding.
The mime type is usually derived from the file extension
which might not always be correct.

Issue #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/132>
2023-03-14 00:50:40 +00:00
Sophie Herold
a0ce234946 image: Limit SVG zoom to RSVG limits
See <https://gitlab.gnome.org/GNOME/librsvg/-/issues/938>
for details about the problem.

Closes #88
2023-03-11 00:06:51 +00:00
Sophie Herold
05ef429b86 image: Add newly designed thumbnail for DnD
The old method stopped working with the new decoder setup.

The new design features a frame for contrast and rotates
images based on EXIF information.

Closes #89
2023-03-08 01:48:34 +00:00
Sophie Herold
f12ff1ea4d widgets: Add some widget descriptions 2023-03-06 22:59:40 +01:00
Sophie Herold
f80ec7db56 decoder: Use image-rs, libheif-rs, librsvg
This adds proper support for a lot of image formats including SVGs.
It will be the basis for many features to come. The technical core
is an asynchronous renderer that can arrange textures in smaller tiles
which might be generated on demand.

Closes #34, #40, #41, #49

Basis for fixing the following issues #7, #27, #36, #43, #68, #71
2023-03-04 21:48:51 -05:00
Sophie Herold
257d154f08 image: Fix high-res mouse wheel zoom
High res scrolling is reported as wheel deltas < 1. Use a
formula that works for all delta values.

Closes #63
2023-03-01 20:31:56 +01:00
Lubosz Sarnecki
30136f9050 code: Fix some typos.
Fix some typos, mainly in comments with the power of
Builder's spell correction.
2023-02-21 00:19:05 +01:00
Sophie Herold
449742173b image: Fix pan direction for pinch on touchscreen 2023-02-19 01:45:57 +00:00
Sophie Herold
004ebd5615 cargo: Update dependencies 2023-02-15 17:04:59 +01:00
Sophie Herold
9c51dea6d1 image: Fix rotation gesture on touchscreens
Use angle-delta instead of total angle. Total angle is
absolute on touchscreens.
2023-02-12 20:24:28 +00:00
Sophie Herold
caefec74b4 image: Limit rubberbanding zoom and add stiffness 2023-02-07 21:56:00 +01:00
Sophie Herold
169dd454cc image: Add double click for zoom/fullscreen
Zooms on touchscreens and fullscreens otherwise.
Using the fullscreen behavior for now, since that's what
a lot of other apps do.
2023-02-06 18:40:32 +01:00
Sophie Herold
4eb8b939b3 application: Add shortcuts for paning the view
Closes #54
2023-01-31 04:56:58 +00:00
Sophie Herold
74d148572f image: Fix image centering creates blur
Ensure to only move by physical pixel values
2023-01-30 04:25:01 +00:00
Sophie Herold
fc553d108c image: Fix minimal scrollbar with best-fit
For larger images minimal float errors can add up to having
an image size being minimally larger than the widget.
This leads to fake scrollbars that don't even scroll.
Rounding to physical pixel size fixes this.

Fixes #47
2023-01-30 04:25:01 +00:00
Sophie Herold
f2357513da imageView: Use custom slide widget and IndexSet
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
2023-01-30 01:08:57 +00:00
Christopher Davis
6c59e21264 image: Load Texture directly
`gdk::Texture::from_file ()` automatically falls back to
GdkPixbuf for file types Texture doesn't support natively.
2023-01-22 20:16:55 +00:00
Christopher Davis
469e721d2b image: Use async function to load file info
GdkPixbuf provides `file_info_future ()` to load the file
info asynchronously, using the gio thread pool. That
means we don't need to spawn a thread ourselves for it.
2023-01-22 20:16:55 +00:00
Sophie Herold
65808f5894 propertiesView: Show basic EXIF data
Use libgweather to determine the city for EXIF GPS coordinates.
Make ImageMetadata a GObject to use it's properties in UI.
2022-12-12 11:31:27 -05:00
Sophie Herold
e04992b46d window: Adjust to image size when opening
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.
2022-12-12 15:54:24 +00:00
Sophie Herold
ccfbcf60a8 image: Calculate next zoom step from target
This fixes that clicking a button/key during an animation
does not give you the expected zoom speedup.
2022-11-29 00:04:13 +01:00
Sophie Herold
78e528d299 image: Also snap into 'best-fit' if close to it
If only 1/4 of a zoom step zoomed in, assume best-fit.
This helps with floating point precision when zooming in and
out again. It also removes akward other minimal zoom steps.
This change centralizes part of the best-fit detection.
2022-11-28 23:43:56 +01:00
Sophie Herold
c1a3cc353d image: Limit zoom to 2000% 2022-11-28 23:24:12 +01:00
Sophie Herold
d6ab100062 image: Use FileList in ContentProvider
Makes dragging an image out of Loupe work in most cases.
There seems to be an issue with dragging from flatpak to host.
Removing the png from the provider seems to avoid gdk crashes
but not 100% sure that was the cause.
2022-11-28 19:34:18 +01:00
Sophie Herold
f1593203a0 window: Add missing shortcuts
Add shortcuts
- F9 Image properties
- F10 Main menu
- Ctrl +/- for zoom
- Ctrl 0 for best fit
- Ctrl [Shift] R for rotate
- Escape to leave fullscrenen
Updated help overlay accordingly.
2022-11-25 15:46:35 +01:00
Sophie Herold
029c0c9244 image: Add zoom and scrolling support
Zoom via
- Scroll event controller
- Zoom gesture
- Overlay buttons
- Fixed zoom level shortcuts (1=100%, 2=200%)
Scrolling via
- Scrolled window
- Drag gesture
Changes
- Implement best-fit via calculating a zoom level
- Gesture for carousel no longer working because of scrolled window
- Split control overlays into two to not steal inputs in area between

Closes #17
2022-11-23 00:57:43 +01:00
Sophie Herold
49e595cda2 image: Support rotate gesture 2022-11-10 20:25:11 +01:00
Sophie Herold
c2e3bb2f83 menus: Add rotate left and right buttons 2022-11-06 17:58:02 +01:00
Sophie Herold
0f7115fe8b imageMetadata: Implement debug 2022-11-04 20:12:44 +01:00
Sophie Herold
a2e6767584 image: Add rotation and auto rotate based on exif 2022-11-04 18:52:33 +01:00
Sophie Herold
3d6564377a cargo: Update dependencies 2022-11-03 00:57:18 +01:00
Christopher Davis
2aa480eee5 widgets: Rework image_view with AdwCarousel, add ImagePage
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.
2022-04-20 13:12:45 -07:00