diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-08-04 21:22:32 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-08-04 23:29:33 +0800 |
| commit | 390aa8de50e36d69027c87d1670f5b73369526af (patch) | |
| tree | 9650dec3c4f4ba928a6f7e86e71cb5e2245ce5d9 /qml_plugin/src | |
| parent | 20231f0900c2fd07e40faafcd5cdbe4aff9f1375 (diff) | |
duckduckgo: preview_image -> image
Diffstat (limited to 'qml_plugin/src')
| -rw-r--r-- | qml_plugin/src/launcher/duckduckgo.rs | 11 | ||||
| -rw-r--r-- | qml_plugin/src/web/duckduckgo.rs | 8 |
2 files changed, 9 insertions, 10 deletions
diff --git a/qml_plugin/src/launcher/duckduckgo.rs b/qml_plugin/src/launcher/duckduckgo.rs index 1de7161..a2785f2 100644 --- a/qml_plugin/src/launcher/duckduckgo.rs +++ b/qml_plugin/src/launcher/duckduckgo.rs @@ -27,8 +27,7 @@ mod qobject { description_html )] #[qproperty( - QString, - preview_image + QString, image )] type DuckDuckGo = super::DuckDuckGoRs; @@ -46,7 +45,7 @@ mod qobject { pub struct QmlDuckDuckGo { pub title: QString, pub description_html: QString, - pub preview_image: QString, + pub image: QString, } #[derive(Default)] @@ -54,7 +53,7 @@ pub struct DuckDuckGoRs { ok: bool, title: QString, description_html: QString, - preview_image: QString, + image: QString, executor: ExclusiveExecutor, } @@ -83,7 +82,7 @@ impl qobject::DuckDuckGo { qo.as_mut() .set_description_html(r.description_html); qo.as_mut() - .set_preview_image(r.preview_image); + .set_image(r.image); } Err(_) => qo.set_ok(false), }, @@ -101,6 +100,6 @@ impl qobject::DuckDuckGo { self.as_mut() .set_description_html("".into()); self.as_mut() - .set_preview_image("".into()); + .set_image("".into()); } } diff --git a/qml_plugin/src/web/duckduckgo.rs b/qml_plugin/src/web/duckduckgo.rs index 3b73501..6de39af 100644 --- a/qml_plugin/src/web/duckduckgo.rs +++ b/qml_plugin/src/web/duckduckgo.rs @@ -14,7 +14,7 @@ const DUCKDUCKGO: &str = "https://duckduckgo.com"; pub struct DuckDuckGoContent { title: String, description_html: String, - preview_image: Option<Url>, + image: Option<Url>, } impl From<DuckDuckGoContent> for QmlDuckDuckGo { @@ -26,8 +26,8 @@ impl From<DuckDuckGoContent> for QmlDuckDuckGo { description_html: value .description_html .into(), - preview_image: value - .preview_image + image: value + .image .map( |u| { u.to_string() @@ -143,7 +143,7 @@ pub async fn query(input: &str) -> anyhow::Result<DuckDuckGoContent> { .unwrap_or(alt_desc), ), // TODO: try also Results[*].Icon.URL and RelatedTopics[*].Icon.URL - preview_image: resp + image: resp .image .and_then(|i| Url::parse(&format!("{DUCKDUCKGO}{i}",)).ok()), }, |
