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.
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.
- 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
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.
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
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.
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.
`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.
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.
The GFile is more useful for other data. The window can
use expressions to calculate an appropriate title, so
we no longer need to call `set_title()` or connect to
a signal manually.
This commit also adjusts the `uri()` and `print()`
functions to use `active_file()`
Allan Day's latest mockups have the fullscreen icon on the bottom
left of the image. This commit moves the icon there, using a
GtkExpression for the icon name.
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.
Previously we used `prev_index` everywhere, which could
get confusing - it's not really the "previous" index
until we've moved. So, only `page_changed_cb ()` refers
to it as `prev_index`. Everywhere else it's called
`current_model_index`.
In accordance with this change, we can get rid
of a call to `current_page()` and `index_of()`
since we already know the index of the current page.
Due to the latest refactoring passes, it was possible
for the model to be borrowed twice when navigating
to a file. This commit makes model an argument
to update_action_state() so we don't need to acquire
another borrow. We have the model already in all cases
where we use update_action_state().
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.
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.