Commit graph

1236 commits

Author SHA1 Message Date
Christopher Davis
8acf76bd5e image_view: Clear the carousel when creating a new model
This way we properly handle switching directories within the
same window.
2022-06-28 21:28:55 -04:00
Christopher Davis
3557b15034 image_view: Rework model loading and page navigation
Rework the model loading to not care about the edges.
Now we only care about where we are in the model and
the number of buffer pages. This algorithm handles
the edges without special casing.
2022-06-28 18:59:33 -04:00
Christopher Davis
2b63f57d5b image_view: Make d-n-d gesture exclusive
Drag and drop does not work on touchscreens.
2022-04-20 13:12:47 -07:00
Christopher Davis
7b24523079 image_page: Claim event sequences 2022-04-20 13:12:47 -07:00
Christopher Davis
48b8ce9455 window: Use path instead of URI for "Open With"
Fixes an issue where paths with spaces or anything
else encoded within the URI could not be opened
externally.
2022-04-20 13:12:47 -07: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
Christopher Davis
3bb48155a0 general: Use a custom ListModel for file tracking
This is more robust than manually keeping a
vector and using indexing.
2022-02-04 16:25:44 -08:00
Christopher Davis
ca3c02a5c2 window: Use GString's display implementation for toast 2022-02-05 00:11:39 +00:00
Christopher Davis
f88c48ca69 desktop: Add Loupe as a keyword
Allows us to search by code/bin name in GNOME
Shell
2022-02-04 23:58:53 +00:00
Christopher Davis
69e9c1b4fc image: Remove new()
Since we already `#[derive(Default)]`, we don't need
a `new()` function to do the same thing
2022-02-04 15:48:14 -08:00
Christopher Davis
1737db370b thumbnail: Remove ParentType
We don't need it for glib::Object
2022-02-04 15:44:42 -08:00
Christopher Davis
f06875de73 main: Remove gtk::init() and adw::init()
We don't need these since we use adw::Application

Part of https://gitlab.gnome.org/BrainBlasted/loupe/-/issues/8
2022-02-04 15:44:08 -08:00
Christopher Davis
3092f7ed88 application: Remove gtk::Settings
These were unused.

Part of https://gitlab.gnome.org/BrainBlasted/loupe/-/issues/8
2022-02-04 15:42:11 -08:00
Christopher Davis
8ac85e8fa5 build: Update Rust dependencies
Part of https://gitlab.gnome.org/BrainBlasted/loupe/-/issues/8
2022-02-04 15:40:52 -08:00
Christopher Davis
4c81f4d286 image: Use clearer ratio names
`ratio` and `pic_ratio` were confusing names. Rename
them to `widget_ratio` and `texture_ratio` to be
more clear.
2022-01-19 19:16:57 -08:00
Christopher Davis
f7151e93d1 build: Use the latest stable Rust dependencies
Now that there's a release with template callback support,
we don't need to use git.
2022-01-19 17:29:46 -08:00
Maximiliano Sandoval R
13d7a21501 Implement drag source on images
Using a 128x128 thumbnail.
2022-01-09 00:22:50 -08:00
Christopher Davis
fc6d3668c0 Update gtk-rs deps for return value nullability trust 2022-01-08 22:18:40 -08:00
Maximiliano Sandoval R
be09d49756
image: Implement Copy to clipboard 2022-01-08 23:59:56 +01:00
Christopher Davis
7b760f85f4 image_view: Use window identifier for wallpaper portal
Makes the dialog modal.
2021-12-29 18:46:55 -08:00
Christopher Davis
a12e7eed43 window: Use portal to open files in other apps
Calling `xdg-open` is the wrong thing to do, and has
flaky reliability. What we want is to use the portal
directly with the exact behavior we want.

When using the portal we can't just pass the uri -
we need to own a file descriptor.
2021-12-29 17:43:58 -08:00
Christopher Davis
56a47fb447 Update gtk-rs
This brings us a neat new function, `imp()`,
that lets us drop `from_instance()` everywhere.
2021-12-29 14:02:48 -08:00
Christopher Davis
400672b6b6 window: Add ToastOverlay and use toasts for feedback 2021-12-28 16:40:58 -08:00
Felix Häcker
084304cadc
build: Fix cargo home variable 2021-12-28 09:40:39 +01:00
Christopher Davis
be70bdafe5 window: Implement drag and drop
The main page is no longer a lie.
2021-12-27 22:05:29 -08:00
Christopher Davis
5d9567507c window: Add "Open File..." button, remove gesture
This gives users a very intuitive way to open files.
The gesture was awkard and didn't match any common patterns
across GNOME. The button is simple and obvious.
2021-12-23 20:35:22 -08:00
Christopher Davis
5893d4b764 cargo: Use gtk-rs master
Needed to take advantage of template callbacks
and new APIs.
2021-12-22 18:17:38 -08:00
Christopher Davis
5c25a6a270 application: Use standard shortcut for help overlay
Ctrl+F1 never really worked - that was chosen based
on the mockups, but in reality it only opened Help.
Apps usually use Ctrl+?.
2021-12-22 16:02:17 -08:00
Christopher Davis
1ae7316b32 general: Consolidate explicit dependencies down to adw and gtk4
Use the exported dependencies for everything else.
2021-12-21 16:09:48 -08:00
Christopher Davis
f9cbad9ad9 general: Use adw alias for libadwaita
This will make writing libadwaita-based code a bit
nicer, and make it nicer when we use crates that
libadwaita's API re-exports.

Also clean up the unused imports exposed by
this change.
2021-12-21 14:56:25 -08:00
Felix Häcker
ec0f13d250
build: Fix rust-analyzer 2021-12-21 20:38:13 +01:00
Felix Häcker
2bb8e70196
cargo: Disable verbose output 2021-12-21 20:37:25 +01:00
Christopher Davis
d4fca8aae3 general: Iv* to Lp*
We're probably going to be keeping `loupe` as the codename
and binary name going forward.
2021-12-21 10:55:02 -08:00
Christopher Davis
4d1141a675 widgets: split view and image
This will make implementing a more comprehensive photo view simpler.
2021-12-20 08:37:50 -08:00
Christopher Davis
5e7965ff4a window: Disable swipes on the flap
We don't want or need these for this case.
2021-10-08 05:50:49 -07:00
Christopher Davis
5314547625 flatpak: Remove libadwaita from manifest
libadwaita is included in the SDK now.
2021-10-03 04:19:48 -07:00
Christopher Davis
59898b8e83 flatpak: Update logging domain 2021-09-29 12:30:07 -07:00
Christopher Davis
125d843413 image_view: Remove unused import 2021-09-29 01:08:57 -07:00
Christopher Davis
363cbc85bc image_view: Remove present()
Using a layout manager actually does this for us.
2021-09-29 01:00:31 -07:00
Christopher Davis
80502064ce Add pre-commit hook
This is something we can use to check formatting before
any commits are pushed.
2021-09-29 00:48:00 -07:00
Christopher Davis
8361c3a7d4 image_view: Show previews for wallpapers
In case we decide to do cool things the preview later.
2021-09-29 00:42:53 -07:00
Christopher Davis
3ca0eb4d02 application: Update year 2021-09-29 00:38:07 -07:00
Christopher Davis
1e0732ac92 ui: Add tooltips to buttons 2021-09-29 00:38:07 -07:00
Christopher Davis
f7553e02a4 More typography fixes 2021-09-29 00:38:07 -07:00
Christopher Davis
02694cc8da window: Adjust sentence casing and typography 2021-09-29 00:38:07 -07:00
Christopher Davis
0d37d123c9 image_view: Add note to investigate printing
This is one of the features we need for the MVP,
but printing is a bit beyond my current knowledge.
So, I need to research this. Onto other things for
now, so I'll add note.
2021-09-29 00:38:07 -07:00
Christopher Davis
945aff3029 image_view: Load images once
We don't need to load the file twice just to get the
dimensions. We can load a GdkTexture, use it's APIs
for the width and height, and return that as a result
to the window. This allows us to kill the `dimensions-loaded`
signal and one of the places where we need to load a file.
2021-09-29 00:38:04 -07:00
Christopher Davis
e0820e0881 README: Add info to install section
Directory navigation does not work without the app
installed on the system.
2021-09-28 18:38:01 -07:00
Christopher Davis
6fbad6d6ce application: Formatting 2021-09-28 17:56:33 -07:00
Christopher Davis
cced598239 general: Rename to Loupe
Sets the codename, binary name, and app ID name to Loupe.
The user-visible name is still Image Viewer.
2021-09-28 17:44:26 -07:00