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.
120 lines
5 KiB
XML
120 lines
5 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<interface>
|
|
<template class="LpWindow" parent="AdwApplicationWindow">
|
|
<property name="default-width">600</property>
|
|
<property name="default-height">498</property>
|
|
<property name="width-request">360</property>
|
|
<property name="title">Image Viewer</property>
|
|
<property name="content">
|
|
<object class="AdwFlap" id="flap">
|
|
<property name="orientation">vertical</property>
|
|
<property name="fold-policy">never</property>
|
|
<property name="swipe-to-open">False</property>
|
|
<property name="swipe-to-close">False</property>
|
|
<property name="locked">true</property>
|
|
<property name="modal">false</property>
|
|
<property name="flap">
|
|
<object class="GtkHeaderBar" id="headerbar">
|
|
<property name="show_title_buttons" bind-source="LpWindow" bind-property="fullscreened" bind-flags="sync-create|invert-boolean"/>
|
|
<child type="end">
|
|
<object class="GtkMenuButton" id="menu_button">
|
|
<property name="icon-name">open-menu-symbolic</property>
|
|
<property name="menu-model">primary_menu</property>
|
|
<property name="tooltip-text" translatable="yes">Primary Menu</property>
|
|
</object>
|
|
</child>
|
|
<child type="end">
|
|
<object class="GtkButton" id="fullscreen_button">
|
|
<property name="icon-name">view-fullscreen-symbolic</property>
|
|
<property name="action-name">win.toggle-fullscreen</property>
|
|
<property name="tooltip-text" translatable="yes">Toggle Fullscreen</property>
|
|
</object>
|
|
</child>
|
|
</object>
|
|
</property>
|
|
<property name="content">
|
|
<object class="AdwToastOverlay" id="toast_overlay">
|
|
<property name="child">
|
|
<object class="GtkStack" id="stack">
|
|
<property name="visible-child">status_page</property>
|
|
<property name="vexpand">True</property>
|
|
<child>
|
|
<object class="AdwStatusPage" id="status_page">
|
|
<property name="title" translatable="yes">Image Viewer</property>
|
|
<property name="description" translatable="yes">Click "Open File…" or drag an image here.</property>
|
|
<child>
|
|
<object class="GtkButton">
|
|
<property name="halign">center</property>
|
|
<property name="label" translatable="yes">Open File…</property>
|
|
<property name="action-name">win.open</property>
|
|
<style>
|
|
<class name="pill"/>
|
|
<class name="suggested-action"/>
|
|
</style>
|
|
</object>
|
|
</child>
|
|
</object>
|
|
</child>
|
|
<child>
|
|
<object class="LpImageView" id="image_view"/>
|
|
</child>
|
|
<child>
|
|
<object class="GtkDropTarget" id="drop_target">
|
|
<property name="actions">copy</property>
|
|
</object>
|
|
</child>
|
|
</object>
|
|
</property>
|
|
</object>
|
|
</property>
|
|
<style>
|
|
<class name="fullscreen-widget"/>
|
|
</style>
|
|
</object>
|
|
</property>
|
|
</template>
|
|
<menu id="primary_menu">
|
|
<section>
|
|
<item>
|
|
<attribute name="label" translatable="yes">_New Window</attribute>
|
|
<attribute name="action">app.new-window</attribute>
|
|
</item>
|
|
</section>
|
|
<section>
|
|
<item>
|
|
<attribute name="label" translatable="yes">_Open With…</attribute>
|
|
<attribute name="action">win.open-with</attribute>
|
|
</item>
|
|
<!--<item>
|
|
<attribute name="label" translatable="yes">_Display On…</attribute>
|
|
<attribute name="action">win.display-on</attribute>
|
|
</item>-->
|
|
<item>
|
|
<attribute name="label" translatable="yes">_Print…</attribute>
|
|
<attribute name="action">win.print</attribute>
|
|
</item>
|
|
<!--<item>
|
|
<attribute name="label" translatable="yes">_Rotate</attribute>
|
|
<attribute name="action">win.rotate-image</attribute>
|
|
</item>-->
|
|
<item>
|
|
<attribute name="label" translatable="yes">_Set as Wallpaper</attribute>
|
|
<attribute name="action">win.set-wallpaper</attribute>
|
|
</item>
|
|
</section>
|
|
<section>
|
|
<item>
|
|
<attribute name="label" translatable="yes">_Help</attribute>
|
|
<attribute name="action">app.help</attribute>
|
|
</item>
|
|
<item>
|
|
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
|
|
<attribute name="action">win.show-help-overlay</attribute>
|
|
</item>
|
|
<item>
|
|
<attribute name="label" translatable="yes">_About Image Viewer</attribute>
|
|
<attribute name="action">app.about</attribute>
|
|
</item>
|
|
</section>
|
|
</menu>
|
|
</interface>
|