parent
0943138060
commit
40d425ac80
5 changed files with 86 additions and 1 deletions
3
data/resources/edit.css
Normal file
3
data/resources/edit.css
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
.saving-overlay {
|
||||||
|
background: rgba(25, 25, 25, 0.8);
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
@import 'edit.css';
|
||||||
@import 'edit_crop.css';
|
@import 'edit_crop.css';
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// Copyright (c) 2024-2025 Sophie Herold
|
// Copyright (c) 2024-2025 Sophie Herold
|
||||||
|
// Copyright (c) 2025 Hubert Figuière
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,12 @@ mod imp {
|
||||||
cancel: TemplateChild<gtk::Button>,
|
cancel: TemplateChild<gtk::Button>,
|
||||||
#[template_child]
|
#[template_child]
|
||||||
pub(crate) done: TemplateChild<gtk::MenuButton>,
|
pub(crate) done: TemplateChild<gtk::MenuButton>,
|
||||||
|
#[template_child]
|
||||||
|
saving_revealer: TemplateChild<gtk::Revealer>,
|
||||||
|
#[template_child]
|
||||||
|
saving_status: TemplateChild<gtk::Label>,
|
||||||
|
#[template_child]
|
||||||
|
saving_info: TemplateChild<gtk::Revealer>,
|
||||||
|
|
||||||
#[property(get, construct_only)]
|
#[property(get, construct_only)]
|
||||||
original_image: OnceCell<LpImage>,
|
original_image: OnceCell<LpImage>,
|
||||||
|
|
@ -208,6 +214,7 @@ mod imp {
|
||||||
|
|
||||||
obj.edit_crop().apply_crop();
|
obj.edit_crop().apply_crop();
|
||||||
|
|
||||||
|
self.set_saving_status(Some(gettext("Editing Image")));
|
||||||
let editor = glycin::Editor::new(current_file);
|
let editor = glycin::Editor::new(current_file);
|
||||||
if let Some(operations) = obj.operations() {
|
if let Some(operations) = obj.operations() {
|
||||||
log::debug!("Computing edited image.");
|
log::debug!("Computing edited image.");
|
||||||
|
|
@ -232,6 +239,8 @@ mod imp {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Ok(data) => {
|
Ok(data) => {
|
||||||
|
self.set_saving_status(Some(gettext("Saving Image")));
|
||||||
|
|
||||||
if let Err(err) = new_file
|
if let Err(err) = new_file
|
||||||
.replace_contents_future(
|
.replace_contents_future(
|
||||||
data,
|
data,
|
||||||
|
|
@ -255,8 +264,34 @@ mod imp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.set_saving_status(None);
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_saving_status(&self, message: Option<String>) {
|
||||||
|
let is_saving = message.is_some();
|
||||||
|
self.saving_status.set_label(&message.unwrap_or_default());
|
||||||
|
self.saving_revealer.set_reveal_child(is_saving);
|
||||||
|
self.done.set_sensitive(!is_saving);
|
||||||
|
|
||||||
|
if is_saving {
|
||||||
|
// Show text and spinner delayed
|
||||||
|
glib::timeout_add_local_once(
|
||||||
|
std::time::Duration::from_millis(
|
||||||
|
self.saving_revealer.transition_duration().into(),
|
||||||
|
),
|
||||||
|
glib::clone!(
|
||||||
|
#[weak(rename_to=imp)]
|
||||||
|
self,
|
||||||
|
move || {
|
||||||
|
imp.saving_info.set_reveal_child(true);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
self.saving_info.set_reveal_child(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,52 @@
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="AdwToolbarView" id="toolbar_view">
|
<object class="AdwToolbarView" id="toolbar_view">
|
||||||
<property name="top-bar-style">raised</property>
|
<property name="top-bar-style">raised</property>
|
||||||
<property name="content" bind-source="LpEditWindow" bind-property="edit_crop" />
|
<property name="content">
|
||||||
|
<object class="GtkOverlay">
|
||||||
|
<property name="child" bind-source="LpEditWindow" bind-property="edit_crop" />
|
||||||
|
<child type="overlay">
|
||||||
|
<object class="GtkRevealer" id="saving_revealer">
|
||||||
|
<property name="transition-type">crossfade</property>
|
||||||
|
<property name="transition-duration">500</property>
|
||||||
|
<property name="can-target" bind-source="saving_revealer" bind-property="reveal-child" bind-flags="sync-create" />
|
||||||
|
<property name="child">
|
||||||
|
<object class="AdwBin">
|
||||||
|
<style>
|
||||||
|
<class name="saving-overlay" />
|
||||||
|
</style>
|
||||||
|
<property name="child">
|
||||||
|
<object class="GtkRevealer" id="saving_info">
|
||||||
|
<property name="transition-type">crossfade</property>
|
||||||
|
<property name="transition-duration">500</property>
|
||||||
|
<property name="child">
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<property name="spacing">18</property>
|
||||||
|
<child>
|
||||||
|
<object class="AdwSpinner">
|
||||||
|
<property name="width-request">64</property>
|
||||||
|
<property name="height-request">64</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="saving_status">
|
||||||
|
<property name="label">Preparing to Save Image</property>
|
||||||
|
<style>
|
||||||
|
<class name="title-2" />
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
<child type="top">
|
<child type="top">
|
||||||
<object class="AdwHeaderBar">
|
<object class="AdwHeaderBar">
|
||||||
<property name="show-start-title-buttons">false</property>
|
<property name="show-start-title-buttons">false</property>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue