Skip to content

Commit cd0b730

Browse files
authored
update version to 1.4.1 (#94)
1 parent acde7e9 commit cd0b730

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/kiorg/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "kiorg"
3-
version = "1.4.0"
3+
version = "1.4.1"
44
edition = "2024"
55
rust-version = "1.87"
66
authors = ["houqp"]

plugins/heif/src/main.rs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,31 @@ struct HeifPlugin {
1313
metadata: PluginMetadata,
1414
}
1515

16+
struct HeifData {
17+
filename: String,
18+
png_data: Vec<u8>,
19+
metadata_rows: Vec<Vec<String>>,
20+
}
21+
1622
impl PluginHandler for HeifPlugin {
1723
fn on_preview(&mut self, path: &str) -> PluginResponse {
1824
match self.process_heif(path) {
19-
Ok((filename, png_data, metadata_rows)) => PluginResponse::Preview {
25+
Ok(data) => PluginResponse::Preview {
2026
components: vec![
21-
Component::Title(TitleComponent { text: filename }),
27+
Component::Title(TitleComponent {
28+
text: data.filename,
29+
}),
2230
Component::Image(ImageComponent {
2331
source: ImageSource::Bytes {
2432
format: ImageFormat::Png,
25-
data: png_data,
33+
data: data.png_data,
2634
uid: path.to_string(),
2735
},
2836
interactive: false,
2937
}),
3038
Component::Table(TableComponent {
3139
headers: None,
32-
rows: metadata_rows,
40+
rows: data.metadata_rows,
3341
}),
3442
],
3543
},
@@ -41,11 +49,11 @@ impl PluginHandler for HeifPlugin {
4149

4250
fn on_preview_popup(&mut self, path: &str) -> PluginResponse {
4351
match self.process_heif(path) {
44-
Ok((_, png_data, _)) => PluginResponse::Preview {
52+
Ok(data) => PluginResponse::Preview {
4553
components: vec![Component::Image(ImageComponent {
4654
source: ImageSource::Bytes {
4755
format: ImageFormat::Png,
48-
data: png_data,
56+
data: data.png_data,
4957
uid: path.to_string(),
5058
},
5159
interactive: true,
@@ -63,10 +71,7 @@ impl PluginHandler for HeifPlugin {
6371
}
6472

6573
impl HeifPlugin {
66-
fn process_heif(
67-
&self,
68-
path: &str,
69-
) -> Result<(String, Vec<u8>, Vec<Vec<String>>), Box<dyn std::error::Error>> {
74+
fn process_heif(&self, path: &str) -> Result<HeifData, Box<dyn std::error::Error>> {
7075
let lib_heif = LibHeif::new();
7176
let ctx = HeifContext::read_from_file(path)?;
7277
let handle = ctx.primary_image_handle()?;
@@ -171,7 +176,11 @@ impl HeifPlugin {
171176
.unwrap_or("HEIF Preview")
172177
.to_string();
173178

174-
Ok((filename, png_data, metadata_rows))
179+
Ok(HeifData {
180+
filename,
181+
png_data,
182+
metadata_rows,
183+
})
175184
}
176185
}
177186

0 commit comments

Comments
 (0)