Update image crate and libcosmic
This commit is contained in:
parent
5be3a951c7
commit
e8df9bf285
5 changed files with 433 additions and 119 deletions
493
Cargo.lock
generated
493
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -21,7 +21,7 @@ glob = "0.3"
|
||||||
icu_collator = "1.5"
|
icu_collator = "1.5"
|
||||||
icu_provider = { version = "1.5", features = ["sync"] }
|
icu_provider = { version = "1.5", features = ["sync"] }
|
||||||
ignore = "0.4"
|
ignore = "0.4"
|
||||||
image = "0.24"
|
image = "0.25"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
mime_guess = "2"
|
mime_guess = "2"
|
||||||
|
|
|
||||||
30
src/app.rs
30
src/app.rs
|
|
@ -3259,7 +3259,7 @@ impl Application for App {
|
||||||
name,
|
name,
|
||||||
archive_type,
|
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() {
|
let complete_maybe = if name.is_empty() {
|
||||||
None
|
None
|
||||||
|
|
@ -3331,7 +3331,8 @@ impl Application for App {
|
||||||
.spacing(space_xxs),
|
.spacing(space_xxs),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
DialogPage::EmptyTrash => widget::dialog(fl!("empty-trash"))
|
DialogPage::EmptyTrash => widget::dialog()
|
||||||
|
.title(fl!("empty-trash"))
|
||||||
.body(fl!("empty-trash-warning"))
|
.body(fl!("empty-trash-warning"))
|
||||||
.primary_action(
|
.primary_action(
|
||||||
widget::button::suggested(fl!("empty-trash")).on_press(Message::DialogComplete),
|
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)?;
|
let (operation, err) = self.failed_operations.get(id)?;
|
||||||
|
|
||||||
//TODO: nice description of error
|
//TODO: nice description of error
|
||||||
widget::dialog("Failed operation")
|
widget::dialog()
|
||||||
|
.title("Failed operation")
|
||||||
.body(format!("{:#?}\n{}", operation, err))
|
.body(format!("{:#?}\n{}", operation, err))
|
||||||
.icon(widget::icon::from_name("dialog-error").size(64))
|
.icon(widget::icon::from_name("dialog-error").size(64))
|
||||||
//TODO: retry action
|
//TODO: retry action
|
||||||
|
|
@ -3356,7 +3358,8 @@ impl Application for App {
|
||||||
mounter_key: _,
|
mounter_key: _,
|
||||||
item: _,
|
item: _,
|
||||||
error,
|
error,
|
||||||
} => widget::dialog(fl!("mount-error"))
|
} => widget::dialog()
|
||||||
|
.title(fl!("mount-error"))
|
||||||
.body(error)
|
.body(error)
|
||||||
.icon(widget::icon::from_name("dialog-error").size(64))
|
.icon(widget::icon::from_name("dialog-error").size(64))
|
||||||
.primary_action(
|
.primary_action(
|
||||||
|
|
@ -3451,7 +3454,8 @@ impl Application for App {
|
||||||
let mut parts = auth.message.splitn(2, '\n');
|
let mut parts = auth.message.splitn(2, '\n');
|
||||||
let title = parts.next().unwrap_or_default();
|
let title = parts.next().unwrap_or_default();
|
||||||
let body = parts.next().unwrap_or_default();
|
let body = parts.next().unwrap_or_default();
|
||||||
widget::dialog(title)
|
widget::dialog()
|
||||||
|
.title(title)
|
||||||
.body(body)
|
.body(body)
|
||||||
.control(widget::column::with_children(controls).spacing(space_s))
|
.control(widget::column::with_children(controls).spacing(space_s))
|
||||||
.primary_action(
|
.primary_action(
|
||||||
|
|
@ -3476,7 +3480,8 @@ impl Application for App {
|
||||||
mounter_key: _,
|
mounter_key: _,
|
||||||
uri: _,
|
uri: _,
|
||||||
error,
|
error,
|
||||||
} => widget::dialog(fl!("network-drive-error"))
|
} => widget::dialog()
|
||||||
|
.title(fl!("network-drive-error"))
|
||||||
.body(error)
|
.body(error)
|
||||||
.icon(widget::icon::from_name("dialog-error").size(64))
|
.icon(widget::icon::from_name("dialog-error").size(64))
|
||||||
.primary_action(
|
.primary_action(
|
||||||
|
|
@ -3486,7 +3491,7 @@ impl Application for App {
|
||||||
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
|
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
|
||||||
),
|
),
|
||||||
DialogPage::NewItem { parent, name, dir } => {
|
DialogPage::NewItem { parent, name, dir } => {
|
||||||
let mut dialog = widget::dialog(if *dir {
|
let mut dialog = widget::dialog().title(if *dir {
|
||||||
fl!("create-new-folder")
|
fl!("create-new-folder")
|
||||||
} else {
|
} else {
|
||||||
fl!("create-new-file")
|
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(
|
.primary_action(
|
||||||
widget::button::suggested(fl!("open")).on_press(Message::DialogComplete),
|
widget::button::suggested(fl!("open")).on_press(Message::DialogComplete),
|
||||||
)
|
)
|
||||||
|
|
@ -3621,7 +3627,7 @@ impl Application for App {
|
||||||
dir,
|
dir,
|
||||||
} => {
|
} => {
|
||||||
//TODO: combine logic with NewItem
|
//TODO: combine logic with NewItem
|
||||||
let mut dialog = widget::dialog(if *dir {
|
let mut dialog = widget::dialog().title(if *dir {
|
||||||
fl!("rename-folder")
|
fl!("rename-folder")
|
||||||
} else {
|
} else {
|
||||||
fl!("rename-file")
|
fl!("rename-file")
|
||||||
|
|
@ -3696,7 +3702,8 @@ impl Application for App {
|
||||||
apply_to_all,
|
apply_to_all,
|
||||||
tx,
|
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"))
|
.body(fl!("replace-warning-operation"))
|
||||||
.control(to.replace_view(fl!("original-file"), IconSizes::default()))
|
.control(to.replace_view(fl!("original-file"), IconSizes::default()))
|
||||||
.control(from.replace_view(fl!("replace-with"), 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(),
|
Some(file_name) => file_name.to_str(),
|
||||||
None => path.as_os_str().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(
|
.primary_action(
|
||||||
widget::button::text(fl!("set-and-launch"))
|
widget::button::text(fl!("set-and-launch"))
|
||||||
.class(theme::Button::Suggested)
|
.class(theme::Button::Suggested)
|
||||||
|
|
|
||||||
|
|
@ -831,7 +831,7 @@ impl Application for App {
|
||||||
|
|
||||||
let dialog = match dialog_page {
|
let dialog = match dialog_page {
|
||||||
DialogPage::NewFolder { parent, name } => {
|
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() {
|
let complete_maybe = if name.is_empty() {
|
||||||
None
|
None
|
||||||
|
|
@ -888,17 +888,16 @@ impl Application for App {
|
||||||
.spacing(space_xxs),
|
.spacing(space_xxs),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
DialogPage::Replace { filename } => {
|
DialogPage::Replace { filename } => widget::dialog()
|
||||||
widget::dialog(fl!("replace-title", filename = filename.as_str()))
|
.title(fl!("replace-title", filename = filename.as_str()))
|
||||||
.icon(widget::icon::from_name("dialog-question").size(64))
|
.icon(widget::icon::from_name("dialog-question").size(64))
|
||||||
.body(fl!("replace-warning"))
|
.body(fl!("replace-warning"))
|
||||||
.primary_action(
|
.primary_action(
|
||||||
widget::button::suggested(fl!("replace")).on_press(Message::DialogComplete),
|
widget::button::suggested(fl!("replace")).on_press(Message::DialogComplete),
|
||||||
)
|
)
|
||||||
.secondary_action(
|
.secondary_action(
|
||||||
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
|
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
|
||||||
)
|
),
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(dialog.into())
|
Some(dialog.into())
|
||||||
|
|
|
||||||
|
|
@ -1185,7 +1185,7 @@ impl ItemThumbnail {
|
||||||
}
|
}
|
||||||
} else if mime.type_() == mime::IMAGE && check_size("image", 64 * 1000 * 1000) {
|
} else if mime.type_() == mime::IMAGE && check_size("image", 64 * 1000 * 1000) {
|
||||||
// Try built-in image thumbnailer
|
// 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(reader) => match reader.decode() {
|
||||||
Ok(image) => {
|
Ok(image) => {
|
||||||
let thumbnail =
|
let thumbnail =
|
||||||
|
|
@ -1244,7 +1244,7 @@ impl ItemThumbnail {
|
||||||
match command.status() {
|
match command.status() {
|
||||||
Ok(status) => {
|
Ok(status) => {
|
||||||
if status.success() {
|
if status.success() {
|
||||||
match image::io::Reader::open(file.path())
|
match image::ImageReader::open(file.path())
|
||||||
.and_then(|img| img.with_guessed_format())
|
.and_then(|img| img.with_guessed_format())
|
||||||
{
|
{
|
||||||
Ok(reader) => match reader.decode().map(|image| image.into_rgba8()) {
|
Ok(reader) => match reader.decode().map(|image| image.into_rgba8()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue