Commit graph

154 commits

Author SHA1 Message Date
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
acd8bea356 README: Add bundle download url and screenshot 2022-12-08 17:55:57 +01: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
Sophie Herold
29198b68f9 doap: Add doap file 2022-11-23 19:05:52 +00:00
Sophie Herold
ab4981a4e1 data: Add metainfo 2022-11-23 18:13:01 +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
Christopher Davis
e48517d646 README: Check off pan/zoom item 2022-11-22 19:54:10 -05: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
AsciiWolf
743577757f data: Rename appdata to metainfo
The appdata file/directory name is deprecated.

Also change the desktop component type to desktop-application. Same reason.
2022-10-06 16:38:46 +02: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
Elton A Rodrigues
2f9c7793c8 window: Add "open..." to menu
add an option in menu to open new image
2022-08-17 21:20:02 -03:00
Sophie Herold
7029e6129b cargo: Update dependencies and rust edition 2022-08-12 15:56:30 +02: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
Christopher Davis
1db46013d9 general: Add translation infrastructure 2022-08-05 19:09:17 -04:00
Christopher Davis
58a77ec9fa properties_view: Only show decimal places when dimensions are fractional 2022-08-05 17:56:07 -04:00
Christopher Davis
36cf667cc8 properties_view: Use glib::format_size() for file size
This handles appropriate localized unit names and rounding for us.
2022-08-05 17:19:47 -04:00
Christopher Davis
3395de4661 flatpak: Use mold linker 2022-08-05 00:55:26 -04:00
Christopher Davis
3825dc5598 flatpak: app-id -> id
app-id is deprecated
2022-08-05 00:55:13 -04:00
Christopher Davis
d8e8541059 build: Replace deprecated build_root() and source_root() calls
Also use variables since we call these functions multiple times
- might as well cache them since they stay the same the whole
time.
2022-08-05 00:39:50 -04:00
Christopher Davis
7b68bd78a0 build: Drop unused name_suffix variable 2022-08-05 00:39:50 -04:00
Christopher Davis
d443107146 build: Drop join_paths() in favor of / 2022-08-05 00:39:50 -04:00
Christopher Davis
8fd63ab9b7 build: Drop custom cargo script 2022-08-05 00:39:50 -04:00
Christopher Davis
38c00cc2ec build: Use gnome.post_install()
Allows us to remove the custom postinstall.py script.
2022-08-05 00:39:50 -04:00
Christopher Davis
bc091248d0 ci: Add flatpak aarch64 CI builds 2022-08-04 15:14:41 +00:00
Christopher Davis
d921cd8044 window: Take toast text as impl AsRef instead of &impl AsRef 2022-08-04 01:04:04 -04:00
Christopher Davis
37f170b165 general: Name spawned threads
This is for easier debugging in case a panic happens -
instead of dealing with "thread <unnamed> paniced...", etc.,
we get a name relevant to our context.
2022-08-03 19:53:32 -04:00
Christopher Davis
d99215bfd1 general: Use gtk_macros::spawn!()
Makes the code a tad cleaner because we're not manually
getting `glib::MainContext` every time we want to spawn
a future.
2022-08-03 19:37:03 -04:00
Christopher Davis
386b41e482 properties_view: Ignore result of sending SVG metadata across threads
`parse_svg_file_future()` is called in a cancellable async
block. This means that after it's called it can be cancelled,
which drops the receiver. When we fetch the metadata, we try
sending the result to the dropped receiver.

This is expected behavior in this case - the receiver
being gone at the time of sending the metadata is perfectly
valid. However, previously we would cause the thread to panic.
This didn't break anything but made for scary log message.

Since this is expected behavior we can use `_` to tell the
compiler that we don't care about the outcome of sending.
This is valid in this instance because we will only get an
error if the receiver is gone.
2022-08-02 21:15:45 -04:00
Christopher Davis
ba4661031f Implement Properties
Implement a properties sidebar. In order to prevent
the UI from freezing, we use futures to load and cancel
loading file information. We also make use of
`gdk_pixbuf` and `svg_metadata` in order to get the file's
metadata before the file fully loads, meaning there's
little to no delay between changing files and seeing
the metadata for large images.

The properties widget uses expressions and
properties to avoid glue code for setting each label,
allowing us to have a clean separation between UI
and data.
2022-08-02 19:31:44 -04:00