Update image crate and libcosmic

This commit is contained in:
Jeremy Soller 2024-11-11 09:14:03 -07:00
parent 5be3a951c7
commit e8df9bf285
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
5 changed files with 433 additions and 119 deletions

493
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -21,7 +21,7 @@ glob = "0.3"
icu_collator = "1.5"
icu_provider = { version = "1.5", features = ["sync"] }
ignore = "0.4"
image = "0.24"
image = "0.25"
libc = "0.2"
log = "0.4"
mime_guess = "2"

View file

@ -3259,7 +3259,7 @@ impl Application for App {
name,
archive_type,
} => {
let mut dialog = widget::dialog(fl!("create-archive"));
let mut dialog = widget::dialog().title(fl!("create-archive"));
let complete_maybe = if name.is_empty() {
None
@ -3331,7 +3331,8 @@ impl Application for App {
.spacing(space_xxs),
)
}
DialogPage::EmptyTrash => widget::dialog(fl!("empty-trash"))
DialogPage::EmptyTrash => widget::dialog()
.title(fl!("empty-trash"))
.body(fl!("empty-trash-warning"))
.primary_action(
widget::button::suggested(fl!("empty-trash")).on_press(Message::DialogComplete),
@ -3344,7 +3345,8 @@ impl Application for App {
let (operation, err) = self.failed_operations.get(id)?;
//TODO: nice description of error
widget::dialog("Failed operation")
widget::dialog()
.title("Failed operation")
.body(format!("{:#?}\n{}", operation, err))
.icon(widget::icon::from_name("dialog-error").size(64))
//TODO: retry action
@ -3356,7 +3358,8 @@ impl Application for App {
mounter_key: _,
item: _,
error,
} => widget::dialog(fl!("mount-error"))
} => widget::dialog()
.title(fl!("mount-error"))
.body(error)
.icon(widget::icon::from_name("dialog-error").size(64))
.primary_action(
@ -3451,7 +3454,8 @@ impl Application for App {
let mut parts = auth.message.splitn(2, '\n');
let title = parts.next().unwrap_or_default();
let body = parts.next().unwrap_or_default();
widget::dialog(title)
widget::dialog()
.title(title)
.body(body)
.control(widget::column::with_children(controls).spacing(space_s))
.primary_action(
@ -3476,7 +3480,8 @@ impl Application for App {
mounter_key: _,
uri: _,
error,
} => widget::dialog(fl!("network-drive-error"))
} => widget::dialog()
.title(fl!("network-drive-error"))
.body(error)
.icon(widget::icon::from_name("dialog-error").size(64))
.primary_action(
@ -3486,7 +3491,7 @@ impl Application for App {
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
),
DialogPage::NewItem { parent, name, dir } => {
let mut dialog = widget::dialog(if *dir {
let mut dialog = widget::dialog().title(if *dir {
fl!("create-new-folder")
} else {
fl!("create-new-file")
@ -3596,7 +3601,8 @@ impl Application for App {
);
}
let mut dialog = widget::dialog(fl!("open-with-title", name = name))
let mut dialog = widget::dialog()
.title(fl!("open-with-title", name = name))
.primary_action(
widget::button::suggested(fl!("open")).on_press(Message::DialogComplete),
)
@ -3621,7 +3627,7 @@ impl Application for App {
dir,
} => {
//TODO: combine logic with NewItem
let mut dialog = widget::dialog(if *dir {
let mut dialog = widget::dialog().title(if *dir {
fl!("rename-folder")
} else {
fl!("rename-file")
@ -3696,7 +3702,8 @@ impl Application for App {
apply_to_all,
tx,
} => {
let dialog = widget::dialog(fl!("replace-title", filename = to.name.as_str()))
let dialog = widget::dialog()
.title(fl!("replace-title", filename = to.name.as_str()))
.body(fl!("replace-warning-operation"))
.control(to.replace_view(fl!("original-file"), IconSizes::default()))
.control(from.replace_view(fl!("replace-with"), IconSizes::default()))
@ -3744,7 +3751,8 @@ impl Application for App {
Some(file_name) => file_name.to_str(),
None => path.as_os_str().to_str(),
};
widget::dialog(fl!("set-executable-and-launch"))
widget::dialog()
.title(fl!("set-executable-and-launch"))
.primary_action(
widget::button::text(fl!("set-and-launch"))
.class(theme::Button::Suggested)

View file

@ -831,7 +831,7 @@ impl Application for App {
let dialog = match dialog_page {
DialogPage::NewFolder { parent, name } => {
let mut dialog = widget::dialog(fl!("create-new-folder"));
let mut dialog = widget::dialog().title(fl!("create-new-folder"));
let complete_maybe = if name.is_empty() {
None
@ -888,17 +888,16 @@ impl Application for App {
.spacing(space_xxs),
)
}
DialogPage::Replace { filename } => {
widget::dialog(fl!("replace-title", filename = filename.as_str()))
.icon(widget::icon::from_name("dialog-question").size(64))
.body(fl!("replace-warning"))
.primary_action(
widget::button::suggested(fl!("replace")).on_press(Message::DialogComplete),
)
.secondary_action(
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
)
}
DialogPage::Replace { filename } => widget::dialog()
.title(fl!("replace-title", filename = filename.as_str()))
.icon(widget::icon::from_name("dialog-question").size(64))
.body(fl!("replace-warning"))
.primary_action(
widget::button::suggested(fl!("replace")).on_press(Message::DialogComplete),
)
.secondary_action(
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
),
};
Some(dialog.into())

View file

@ -1185,7 +1185,7 @@ impl ItemThumbnail {
}
} else if mime.type_() == mime::IMAGE && check_size("image", 64 * 1000 * 1000) {
// Try built-in image thumbnailer
match image::io::Reader::open(&path).and_then(|img| img.with_guessed_format()) {
match image::ImageReader::open(&path).and_then(|img| img.with_guessed_format()) {
Ok(reader) => match reader.decode() {
Ok(image) => {
let thumbnail =
@ -1244,7 +1244,7 @@ impl ItemThumbnail {
match command.status() {
Ok(status) => {
if status.success() {
match image::io::Reader::open(file.path())
match image::ImageReader::open(file.path())
.and_then(|img| img.with_guessed_format())
{
Ok(reader) => match reader.decode().map(|image| image.into_rgba8()) {