Commit graph

186 commits

Author SHA1 Message Date
Sophie Herold
ce1cb0d299 slidingView: Add RTL support
Issue #38
2023-01-31 01:08:56 +00:00
Sophie Herold
d533124daa slidingView: Implement swipe gesture (AdwSwipeable) 2023-01-31 01:08:56 +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
Sophie Herold
3b08851cce CI: Generate code docs and publish for main 2023-01-26 17:51:56 +01:00
Christopher Davis
8de0b42d9d util: Use proper file collation API
glib-rs provides an API to get file collation keys that
can be used for comparison. This means we do not need to
use the function for this ourselves.

This commit gets rid of the manual binding for
`g_utf8_collate_key_by_filename ()` in favor of the glib-rs
API.
2023-01-22 22:56:16 +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
Christopher Davis
7b7435f50a general: Use spawn! less
Because widgets can install async actions, we can simply
turn our callbacks into async functions.
2023-01-22 19:55:42 +00:00
Christopher Davis
eae81ebc60 window: Use GtkFileLauncher
GtkFileLauncher handles using the portal when
appropriate.
2023-01-18 20:21:48 -05:00
Christopher Davis
9d7dae408b properties_view: Use GtkFileLauncher for opening directory
GtkFileLauncher handles opening the containing folder for
us, using the portal when appropriate
2023-01-18 20:21:15 -05:00
Christopher Davis
1dce6b75ae application: Use gio API for help
`show_uri ()` is deprecated
2023-01-14 14:44:50 -05:00
Christopher Davis
947b2101b2 application: Use gtk_window_present() instead of gtk_widget_show () 2023-01-14 14:43:46 -05:00
Christopher Davis
2757e94e08 window: Update use of FileDialog.open_future()
Requires an updated gtk-rs
2023-01-14 14:23:54 -05:00
Sophie Herold
ec45132a97 exif: Do not display city if more than 100 km away
Display GPS coordiantes instead
2022-12-19 19:24:23 +01:00
Sophie Herold
4b9c91f8df exif: Show device maker more consitently
Also, don't call it camera because it can be a scanner etc as well
2022-12-19 18:44:08 +01:00
Sabri Ünal
cbde386126 help-overlay: Improve some shortcuts and help-overlay 2022-12-17 17:07:22 +00:00
Sophie Herold
36000ff65c window: Put prev/next accels at window level
Tried to make things more stateless and RefCell usage for robust
- Use object properties to control the action enabled/disabled
- Borrow model RefCell for only one line or use .replace()
- Don't pass models around and borrow as short as possible instead

Fixes #20
2022-12-16 18:27:45 +00:00
Christopher Davis
ba77ee1a32 window: Use new async FileDialog API
GTK 4.10 deprecates the old GtkFileChooser* APIs in favor of a
new GtkFileDialog utility. This new utility uses async functions
instead of a `response` signal, so we can make use of Rust's
async/await patterns.
2022-12-12 17:52:06 +00:00
Sophie Herold
01bebfef38 imageView: Include overlay controls in min size
This stops the overlay controls to overlap for very small
window sizes and properties opened.

LpImageView already does custom measure and overlay is it's
direct child. So added it here.

Fixes #32
2022-12-12 12:01:24 -05: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
68221bacba file_model: Load opened image first add dir later
- 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
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
b202c1d2d2 i18n: Remove regex usage 2022-11-26 02:03:53 +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
Christopher Davis
583794a3ec general: Use glib::Object::builder for objects w/ props
Builders are more idiomatic rust code than the old
pattern.
2022-11-24 13:06:53 -05:00
Christopher Davis
d1d53e4f4a properties_view: Use ParamSpec builders for props 2022-11-24 13:06:53 -05:00
Sophie Herold
3876f55b4c about: Change app name to Loupe and update devs
- Rename to Loupe to avoid confusion during incubation
  and potentially allow for release on Flathub
- Replace GNOME as developer since it violates software policy
- Put a more useful copyright statement
- Add me as developer
2022-11-23 21:10:03 +00:00
Christopher Davis
aa781d3864 application: Use gio::ActionEntryBuilder for actions
Allows us to drop the action! macro and usage of the clone! macro
in the application file.

The first occurrence of clone! is now in window.rs, so the comment
explaining it has moved there.
2022-11-23 19:56:51 +00:00
Christopher Davis
94086b1650 properties_view: Add comment explaining the purpose of build_dimensions()
Sophie Herold mentioned that it's not entirely clear why we're
loading the image data again here. This comment should explain why
to future readers.
2022-11-23 01:30:14 +00: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
73a1702c47 meson: Cleanup and fix warnings 2022-11-10 19:48:34 +00: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
57f573f98a ui: Fix quotation marks 2022-11-04 20:48:32 +01:00
Sophie Herold
0f7115fe8b imageMetadata: Implement debug 2022-11-04 20:12:44 +01:00
Sophie Herold
db69cbe64e window: Do not panic on failed drag-and-drop 2022-11-04 20:12:15 +01:00
Sophie Herold
165861568c imageView: Fix two panics when file not exists 2022-11-04 19:28:48 +01:00
Sophie Herold
369b71b15c code: Fix clippy warnings 2022-11-04 19:27:43 +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
20c336b17f image_view: Fix carousel scrolling when loading files in same dir
With https://gitlab.gnome.org/GNOME/libadwaita/-/merge_requests/652
merged
we no longer crash when loading files from the same directory.
Now that we don't crash, we've exposed a logic error: we were
changing the state of the carousel while scrolling through it,
which ends with the carousel in a weird state.

This commit delays clearing and refilling the carousel until
after the `page-changed` signal is emitted.
2022-08-19 12:06:07 -04:00
Elton A Rodrigues
8679734a43 general: change wallpaper to background
- Change wallpaper term to background(string and code)
- Remove toast error when cancel background portal
2022-08-18 09:42:25 -03:00
Christopher Davis
ca6e6c639c application: Port to AdwAboutWindow 2022-08-06 00:54:34 -04:00
Christopher Davis
81273c736e general: Update libadwaita-rs
Allows us to clean up our imports a bit.
2022-08-06 00:48:52 -04:00