diff --git a/Cargo.lock b/Cargo.lock index 94c1db4..073a3a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -442,6 +442,12 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + [[package]] name = "bincode" version = "2.0.1" @@ -792,6 +798,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -805,9 +821,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", "core-graphics-types", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -818,7 +834,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", "libc", ] @@ -885,6 +901,16 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" +[[package]] +name = "der" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a878c850e9e421b20262e9b41f9c860e4785fa07541c266b62ff9d1ef998a80a" +dependencies = [ + "pem-rfc7468", + "zeroize", +] + [[package]] name = "derive_more" version = "2.1.1" @@ -1118,6 +1144,12 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" +[[package]] +name = "fax" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" + [[package]] name = "fdeflate" version = "0.3.7" @@ -1267,6 +1299,15 @@ dependencies = [ "yeslogic-fontconfig-sys", ] +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared 0.1.1", +] + [[package]] name = "foreign-types" version = "0.5.0" @@ -1274,7 +1315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", - "foreign-types-shared", + "foreign-types-shared 0.3.1", ] [[package]] @@ -1288,6 +1329,12 @@ dependencies = [ "syn 3.0.9", ] +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "foreign-types-shared" version = "0.3.1" @@ -1623,9 +1670,15 @@ dependencies = [ name = "halation-core" version = "0.1.0" dependencies = [ + "image", "serde", "serde_json", + "tiff", + "ureq", + "webp", + "windows", "windows-sys 0.61.2", + "zip", ] [[package]] @@ -1717,6 +1770,22 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48ce8546b993eaf241d69ded33b1be6d205dd9857ec879d9d18bd05d3676e144" +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + [[package]] name = "i-slint-backend-linuxkms" version = "1.18.1" @@ -2231,9 +2300,14 @@ checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" dependencies = [ "bytemuck", "byteorder-lite", + "color_quant", + "gif", + "image-webp", "moxcms", "num-traits", "png", + "qoi", + "tiff", "zune-core", "zune-jpeg", ] @@ -2442,6 +2516,16 @@ dependencies = [ "redox_syscall 0.9.5", ] +[[package]] +name = "libwebp-sys" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54cd30df7c7165ce74a456e4ca9732c603e8dc5e60784558c1c6dc047f876733" +dependencies = [ + "cc", + "glob", +] + [[package]] name = "linebender_resource_handle" version = "0.1.1" @@ -2677,6 +2761,23 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "native-tls" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "natord" version = "1.0.9" @@ -3110,6 +3211,49 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "openssl" +version = "0.10.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "foreign-types 0.3.2", + "libc", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "openssl-sys" +version = "0.9.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "orbclient" version = "0.3.55" @@ -3221,6 +3365,15 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "pem-rfc7468" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6305423e0e7738146434843d1694d621cce767262b2a86910beab705e4493d9" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.3.2" @@ -3476,6 +3629,15 @@ version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + [[package]] name = "quick-error" version = "2.0.1" @@ -3745,6 +3907,15 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + [[package]] name = "rustversion" version = "1.0.23" @@ -3760,6 +3931,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "scoped-tls" version = "1.0.1" @@ -3791,6 +3971,29 @@ dependencies = [ "tiny-skia 0.11.4", ] +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.28" @@ -4329,6 +4532,20 @@ dependencies = [ "syn 3.0.9", ] +[[package]] +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + [[package]] name = "tiny-skia" version = "0.11.4" @@ -4530,6 +4747,12 @@ dependencies = [ "serde", ] +[[package]] +name = "typed-path" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54ec2755506471f54baf5e4bb5499d8e510cc1caf271270e778a736bd2d7336c" + [[package]] name = "uds_windows" version = "1.2.1" @@ -4601,6 +4824,35 @@ version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" +[[package]] +name = "ureq" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde93ff05758a36a851a398a772b0b79a82fbe3c186a46f2696baaeaf84c966b" +dependencies = [ + "base64", + "der", + "log", + "native-tls", + "percent-encoding", + "rustls-pki-types", + "ureq-proto", + "utf8-zero", + "webpki-root-certs", +] + +[[package]] +name = "ureq-proto" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841583fc36089d7d59419568ae157f43a5a03a2e5a81ba87c77d1596ef46e922" +dependencies = [ + "base64", + "http", + "httparse", + "log", +] + [[package]] name = "url" version = "2.5.8" @@ -4641,6 +4893,12 @@ dependencies = [ "xmlwriter", ] +[[package]] +name = "utf8-zero" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" + [[package]] name = "utf8_iter" version = "1.0.4" @@ -4658,6 +4916,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" @@ -4907,6 +5171,24 @@ dependencies = [ "web-sys", ] +[[package]] +name = "webp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c071456adef4aca59bf6a583c46b90ff5eb0b4f758fc347cea81290288f37ce1" +dependencies = [ + "libwebp-sys", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58ec80e73fd8baf57bf0d9615554c75348bda990d6d5bbeab964dd068319fecb" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weezl" version = "0.1.12" @@ -5426,7 +5708,7 @@ dependencies = [ "calloop 0.13.0", "cfg_aliases", "concurrent-queue", - "core-foundation", + "core-foundation 0.9.4", "core-graphics", "cursor-icon", "dpi", @@ -5787,6 +6069,12 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zeroize" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" + [[package]] name = "zerotrie" version = "0.2.5" @@ -5822,6 +6110,20 @@ dependencies = [ "syn 3.0.9", ] +[[package]] +name = "zip" +version = "8.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b" +dependencies = [ + "crc32fast", + "flate2", + "indexmap", + "memchr", + "typed-path", + "zopfli", +] + [[package]] name = "zlib-rs" version = "0.6.8" @@ -5834,6 +6136,18 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" +[[package]] +name = "zopfli" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf7fc5d30c28483d93805c4a5e12b05bbb52407fa67c5f8bd552374cd01fb11" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] + [[package]] name = "zune-core" version = "0.5.3" diff --git a/THIRD_PARTY.md b/THIRD_PARTY.md index 61098b4..8cdea34 100644 --- a/THIRD_PARTY.md +++ b/THIRD_PARTY.md @@ -18,6 +18,9 @@ Bundled in `app/dist/fonts` as WOFF2 subsets (Latin), taken from the Fontsource | UnifrakturCook | Copyright (c) 2010 j. 'mach' wust with Reserved Font Name UnifrakturCook. Copyright (c) 2009 Peter Wiegel. | | JetBrains Mono | Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) | | Inter | Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter) | +| Schibsted Grotesk (the native beta's interface) | Copyright 2023 The Schibsted-Grotesk Project Authors (https://github.com/schibsted/schibsted-grotesk) | +| Italiana (the native beta's page titles) | Copyright (c) 2011, Santiago Orozco (hi@typemade.mx), with Reserved Font Name "Italiana". | +| Bodoni Moda (the native beta's HALATION wordmark, converted to outlines) | Copyright 2020 The Bodoni Moda Project Authors (https://github.com/indestructible-type/Bodoni) | | Archivo (variable, width and weight) | Copyright 2020 The Archivo Project Authors (https://github.com/Omnibus-Type/Archivo) | | Figtree | Copyright 2022 The Figtree Project Authors (https://github.com/erikdkennedy/figtree) | | Roboto | Copyright 2011 The Roboto Project Authors (https://github.com/googlefonts/roboto-classic) | @@ -76,6 +79,16 @@ Halation does not ship these programs. When a feature needs them, it uses an exi ## Rust crates +### Native media Converter + +The native workspace uses `image` 0.25.10 (MIT OR Apache-2.0), `tiff` 0.11.3 (MIT), `webp` 0.3.1 +(MIT OR Apache-2.0, with BSD-3-Clause libwebp through `libwebp-sys`), `ureq` 3.5.0 +and `native-tls` (MIT OR Apache-2.0), and `zip` 8.6.0 (MIT). These are compatible +with Halation's GPL-3.0-or-later license. The libwebp notice below applies to the native app too. +FFmpeg remains an external GPL build downloaded from yt-dlp/FFmpeg-Builds, never linked or bundled. +The native beta installs it only on request under its isolated profile's `tools/ffmpeg` directory; +it does not read the published Tauri app's component directory or settings. + Direct dependencies of `app/src-tauri`: | Crate | License | diff --git a/assets/README.md b/assets/README.md index fbfb9c0..0c8cdff 100644 --- a/assets/README.md +++ b/assets/README.md @@ -1,14 +1,19 @@ # Asset provenance -`halation-mark.png` is an unchanged copy of the existing pure Halation identity asset -`docs/media/brand/halation-mark-source.png` (SHA-256 `79DADA76D9075E018641D90642D27E63D8DEEEEA02F6022DC5BFEEDC2F478AC4`). -It is used only as the product mark. The static Home reference image is kept outside the source tree under ignored +`halation-mark.png` is the Halation logo (Java, 2026-10-22): a hand-drawn vector stroke, +`docs/media/brand/source/halation-mark.svg`, rendered at 512 px by `tools/render-brand.js` (an identity asset, drawn for +this project). `halation-app-icon.png` is the window and taskbar icon from the same script: the mark on a flat +`#111111` rounded square. The static Home reference image is kept outside the source tree under ignored `.tools/ui-rebuild-native/home-reference/`; it is composition guidance only and is not embedded in the application. -`halation-wordmark.svg` is the Halation wordmark as the original app renders it on Home (one path, identity asset). +`halation-wordmark.svg` is the HALATION wordmark (one path, identity asset): Bodoni Moda (SIL OFL 1.1) at weight 600, +optical size 60, tracked 0.20 em, converted to outlines (Java's choice, 2026-10-22). +`halation-wordmark-glow.png` is the wordmark's halation glow (960 x 428, the wordmark plus 180 px around it), drawn +from the wordmark by `tools/render-wordmark-glow.js` with Java's settings (2026-10-22). `drop-outline.svg` is the dashed outline of Home's drop zone, drawn for this crate. -`fonts/Inter.ttf` is the Inter typeface (variable weight, Latin subset), SIL Open Font License 1.1, © The Inter -Project Authors (https://github.com/rsms/inter); the original app uses the same typeface. +`fonts/SchibstedGrotesk.ttf` (variable weight, © The Schibsted-Grotesk Project Authors) is the interface face and +`fonts/Italiana.ttf` (© Santiago Orozco, Reserved Font Name "Italiana", unmodified) the page-title face; both SIL Open +Font License 1.1, from the Google Fonts repository. `drape-loop.mp4`, `drape-tint.bin` and `drape-still.jpg` are recordings of the original Halation's Drape background: a seamless two-minute loop of 1800 frames of 320 x 180 at 15 fps stored as lifted luma in H.264, the colour of each diff --git a/assets/fonts/Inter.ttf b/assets/fonts/Inter.ttf deleted file mode 100644 index 572c206..0000000 Binary files a/assets/fonts/Inter.ttf and /dev/null differ diff --git a/assets/fonts/Italiana.ttf b/assets/fonts/Italiana.ttf new file mode 100644 index 0000000..e053492 Binary files /dev/null and b/assets/fonts/Italiana.ttf differ diff --git a/assets/fonts/SchibstedGrotesk.ttf b/assets/fonts/SchibstedGrotesk.ttf new file mode 100644 index 0000000..78ad61c Binary files /dev/null and b/assets/fonts/SchibstedGrotesk.ttf differ diff --git a/assets/halation-app-icon.png b/assets/halation-app-icon.png new file mode 100644 index 0000000..e5742f1 Binary files /dev/null and b/assets/halation-app-icon.png differ diff --git a/assets/halation-mark.png b/assets/halation-mark.png index 89829ff..3c9a534 100644 Binary files a/assets/halation-mark.png and b/assets/halation-mark.png differ diff --git a/assets/halation-wordmark-glow.png b/assets/halation-wordmark-glow.png new file mode 100644 index 0000000..f5a59c8 Binary files /dev/null and b/assets/halation-wordmark-glow.png differ diff --git a/assets/halation-wordmark.svg b/assets/halation-wordmark.svg index d6f15ab..4151abb 100644 --- a/assets/halation-wordmark.svg +++ b/assets/halation-wordmark.svg @@ -1 +1 @@ - + \ No newline at end of file diff --git a/crates/halation-app/Cargo.toml b/crates/halation-app/Cargo.toml index f086bd8..10ce70c 100644 --- a/crates/halation-app/Cargo.toml +++ b/crates/halation-app/Cargo.toml @@ -46,12 +46,16 @@ windows-sys = { version = "=0.61.2", features = [ ] } [features] -# Diagnostic renderer comparison only; the shipping beta uses winit + Skia. +# The shipping beta: winit + Skia over desktop OpenGL (planning/decisions.md). Slint's default Skia path on +# Windows is Direct3D 12, which measured ~122 MB private against ~50 MB for desktop OpenGL. +default = ["skia-opengl"] +skia-opengl = ["slint/renderer-skia-opengl"] +# Diagnostic renderer comparison only. diag-femtovg = ["slint/renderer-femtovg"] diag-software = ["slint/renderer-software"] # Headless page snapshots (`--screenshot`) through the software renderer; never part of the shipping build. diag-screenshot = ["slint/renderer-software"] -diag-skia-opengl = ["slint/renderer-skia-opengl"] +diag-skia-opengl = ["skia-opengl"] diag-skia-vulkan = ["slint/renderer-skia-vulkan"] [build-dependencies] diff --git a/crates/halation-app/src/app.rs b/crates/halation-app/src/app.rs index 86d1d12..1b94bbe 100644 --- a/crates/halation-app/src/app.rs +++ b/crates/halation-app/src/app.rs @@ -81,6 +81,7 @@ pub(crate) struct Controller { weak: Weak, services: Rc>, diagnostic_timer: RefCell>>, + converter: Rc, } pub fn run() -> Result<(), Box> { @@ -160,8 +161,14 @@ pub fn run() -> Result<(), Box> { } impl Controller { + #[cfg(feature = "diag-screenshot")] + pub(crate) fn add_converter_files(&self, paths: Vec) { + self.converter.add(paths); + } /// Closing the window: every job process still running stops with it. pub(crate) fn shutdown(&self) { + self.converter.cancel_probe(); + self.converter.suspend_preview(); self.services.borrow().jobs.shutdown(); } @@ -186,9 +193,16 @@ impl Controller { profile.links_path(), ))); - let backdrop = Rc::new(BackdropPlayer::new(weak.clone(), &crate::assets::locate())); + let backdrop = Rc::new(BackdropPlayer::new( + weak.clone(), + &crate::assets::locate(), + theme_of(settings.current()).0, + )); + let converter = + crate::converter::Converter::new(weak.clone(), profile.clone(), jobs.engine().clone()); Ok(Self { weak, + converter, diagnostic_timer: RefCell::new(None), services: Rc::new(RefCell::new(Services { profile, @@ -222,9 +236,23 @@ impl Controller { let Some(ui) = self.weak.upgrade() else { return; }; - apply_theme(&ui); + let settings_services = self.services.clone(); + let settings_weak = self.weak.clone(); + self.converter.install(move || { + let services = settings_services.borrow(); + if !services.settings.current().save_location_chosen { + if let Some(ui) = settings_weak.upgrade() { + ui.set_export_choice_visible(true); + } + None + } else { + Some(services.settings.current().save_mode) + } + }); + let (tone, hue) = theme_of(self.services.borrow().settings.current()); + apply_theme(&ui, &theme::colours(tone, hue)); let assets = crate::assets::locate(); - crate::assets::apply(&ui, &assets); + crate::assets::apply(&ui, &assets, tone); // Home shows the loop's first frame until the decoder delivers ui.set_backdrop(ui.global::().get_still()); let missing = crate::assets::missing(&assets); @@ -284,6 +312,7 @@ impl Controller { { let weak = self.weak.clone(); let services = self.services.clone(); + let converter = self.converter.clone(); ui.on_navigate(move |page| { let Some(ui) = weak.upgrade() else { return; @@ -293,8 +322,15 @@ impl Controller { && s.nav.select(page) { s.notice.clear(); + if page != Page::Converter { + converter.suspend_preview(); + } else { + ui.set_page(page.index()); + converter.open(); + } if page == Page::Settings { measure_storage(&s.profile, &weak); + converter.open(); } } refresh(&ui, &s); @@ -336,10 +372,28 @@ impl Controller { log_line(&s.profile, &format!("settings save failed: {error}")); } } + // The saved theme, which also ends a live accent preview + if matches!(key.as_str(), "theme" | "accent-hue") { + retheme(&ui, &s); + } refresh(&ui, &s); }); } + { + let weak = self.weak.clone(); + let services = self.services.clone(); + ui.on_preview_accent(move |hue| { + let Some(ui) = weak.upgrade() else { + return; + }; + let s = services.borrow(); + let (tone, _) = theme_of(s.settings.current()); + let hue = u16::try_from(hue.rem_euclid(360)).unwrap_or(0); + apply_theme(&ui, &theme::colours(tone, Some(hue))); + }); + } + { let weak = self.weak.clone(); let services = self.services.clone(); @@ -366,11 +420,16 @@ impl Controller { { let weak = self.weak.clone(); let services = self.services.clone(); + let converter = self.converter.clone(); ui.on_dock_action(move |action| { let Some(ui) = weak.upgrade() else { return; }; let mut s = services.borrow_mut(); + if action.as_str() == "install:FFmpeg" { + converter.install_ffmpeg(); + return; + } s.notice = match action.as_str() { "folder" => open_folder(s.profile.root()), "open:main" => open_folder(s.profile.root()), @@ -381,7 +440,13 @@ impl Controller { .parent() .unwrap_or(s.profile.root()), ), - "activity" => format!("Activity: {}.", s.jobs.capability()), + "activity" => { + let jobs = s.jobs.jobs(); + let active = jobs.iter().filter(|j| !j.finished).count(); + let done = jobs.iter().filter(|j| j.finished && !j.failed).count(); + let failed = jobs.iter().filter(|j| j.failed).count(); + format!("Activity: {active} active · {done} finished · {failed} failed. Converter shows job details.") + }, other => unavailable_notice(other).to_owned(), }; refresh(&ui, &s); @@ -532,6 +597,7 @@ impl Controller { s.notice = format!("Could not reset settings: {error}"); } } + retheme(&ui, &s); refresh(&ui, &s); }); } @@ -539,13 +605,19 @@ impl Controller { { let weak = self.weak.clone(); let services = self.services.clone(); + let converter = self.converter.clone(); ui.on_tool_activated(move |id| { let Some(ui) = weak.upgrade() else { return; }; let mut s = services.borrow_mut(); if let Some(tool) = catalog::tool(id.as_str()) { - if tool.id == "library" { + if tool.id == "converter" { + s.nav.select(Page::Converter); + s.notice.clear(); + ui.set_page(Page::Converter.index()); + converter.open(); + } else if tool.id == "library" { if let Some(page) = Page::from_index(1) { s.nav.select(page); } @@ -602,6 +674,7 @@ impl Controller { { let weak = self.weak.clone(); let services = self.services.clone(); + let converter = self.converter.clone(); ui.on_jobs_changed(move || { let Some(ui) = weak.upgrade() else { return; @@ -609,6 +682,12 @@ impl Controller { let s = services.borrow(); update_jobs_model(&ui, &s.jobs.jobs(), &s.jobs_model); ui.set_jobs_capability(SharedString::from(s.jobs.capability())); + drop(s); + if let Some(notice) = converter.jobs_changed() { + let mut s = services.borrow_mut(); + s.notice = notice; + refresh(&ui, &s); + } }); } @@ -1175,6 +1254,8 @@ fn prefs(settings: &Settings) -> Prefs { budget: choice(settings.budget), updates: choice(settings.updates), whats_new: settings.whats_new, + theme: choice(settings.theme), + accent_hue: i32::from(settings.accent_hue), } } @@ -1221,9 +1302,9 @@ fn open_folder(path: &Path) -> String { fn unavailable_notice(action: &str) -> &'static str { match action { "install" | "update-engine" => "Components cannot be installed in this beta yet.", - "shortcuts" => "Keyboard shortcuts come with the tools.", + "shortcuts" => "Ctrl+B: sidebar · Converter: Ctrl+Alt+B for Files, Ctrl+Alt+I for Output.", "language" => "The beta is in English only for now.", - "session" => "There is no session to save until the tools are connected.", + "session" => "Session persistence is not connected in this beta yet.", "test-notification" => "Notifications are not connected in this beta yet.", "search-sites" => "Searching other sites is not connected in this beta yet.", "check-updates" | "changelog" => { @@ -1277,9 +1358,9 @@ struct BackdropPlayer { } impl BackdropPlayer { - fn new(weak: Weak, assets: &Path) -> Self { + fn new(weak: Weak, assets: &Path, tone: theme::Tone) -> Self { let deliver_to = weak.clone(); - let player = crate::backdrop::Player::start(assets, move |frame| { + let player = crate::backdrop::Player::start(assets, tone, move |frame| { // A closed window is a normal lifecycle end let _ = deliver_to.upgrade_in_event_loop(move |ui| { ui.set_backdrop(Image::from_rgba8_premultiplied(frame)) @@ -1293,6 +1374,22 @@ impl BackdropPlayer { } } + /// Recolours the loop and the still frame for `tone`; the frame on screen changes with the next one decoded, or at + /// once when the still frame shows + fn set_tone(&self, tone: theme::Tone) { + if let Some(player) = &self.player { + player.set_tone(tone); + } + let Some(ui) = self.weak.upgrade() else { + return; + }; + let still = crate::assets::still(&crate::assets::locate(), tone); + ui.global::().set_still(still.clone()); + if self.still.get() || self.player.is_none() || !self.timer.running() { + ui.set_backdrop(still); + } + } + fn sync(self: &Rc, on_home: bool, reduced_motion: bool) { let playing = on_home && !reduced_motion && self.player.is_some(); if !playing { @@ -1344,47 +1441,77 @@ fn apply_motion(ui: &AppWindow, tokens: motion::Tokens) { global.set_press_scale(tokens.press_scale); } -fn apply_theme(ui: &AppWindow) { +/// Sets the theme's colours (docs/features/themes.md): at start and whenever Settings changes the theme or the accent; +/// the window repaints once +fn apply_theme(ui: &AppWindow, colours: &theme::Colours) { let theme = ui.global::(); - theme.set_chrome(color(theme::CHROME)); - theme.set_canvas(color(theme::CANVAS)); - theme.set_canvas_deep(color(theme::CANVAS_DEEP)); - theme.set_control(color(theme::CONTROL)); - theme.set_control_hover(color(theme::CONTROL_HOVER)); - theme.set_control_active(color(theme::CONTROL_ACTIVE)); - theme.set_line(color(theme::LINE)); - theme.set_line_strong(color(theme::LINE_STRONG)); - theme.set_text(color(theme::TEXT)); - theme.set_muted(color(theme::MUTED)); - theme.set_subtle(color(theme::SUBTLE)); - theme.set_accent(color(theme::ACCENT)); - theme.set_activity(color(theme::ACTIVITY)); - theme.set_warning(color(theme::WARNING)); - theme.set_beta(color(theme::BETA)); - theme.set_danger(color(theme::DANGER)); - theme.set_success(color(theme::SUCCESS)); + theme.set_chrome(color(colours.chrome)); + theme.set_canvas(color(colours.canvas)); + theme.set_canvas_deep(color(colours.canvas_deep)); + theme.set_control(color(colours.control)); + theme.set_control_hover(color(colours.control_hover)); + theme.set_control_active(color(colours.control_active)); + theme.set_line(color(colours.line)); + theme.set_line_strong(color(colours.line_strong)); + theme.set_line_hover(color(colours.line_hover)); + theme.set_text(color(colours.text)); + theme.set_muted(color(colours.muted)); + theme.set_subtle(color(colours.subtle)); + theme.set_accent(color(colours.accent)); + theme.set_activity(color(colours.activity)); + theme.set_warning(color(colours.warning)); + theme.set_beta(color(colours.beta)); + theme.set_danger(color(colours.danger)); + theme.set_success(color(colours.success)); + theme.set_raised(color(colours.raised)); + theme.set_raised_press(color(colours.raised_press)); + theme.set_well(color(colours.well)); + theme.set_bubble(color(colours.bubble)); + theme.set_popover(color(colours.popover)); + theme.set_key(color(colours.key)); + theme.set_primary_press(color(colours.primary_press)); +} + +/// Applies the saved theme and accent to the window and Home's backdrop +fn retheme(ui: &AppWindow, s: &Services) { + let (tone, hue) = theme_of(s.settings.current()); + apply_theme(ui, &theme::colours(tone, hue)); + s.backdrop.set_tone(tone); +} + +/// The theme and accent of the settings +fn theme_of(settings: &Settings) -> (theme::Tone, Option) { + let hue = (settings.accent_hue < crate::settings::THEME_ACCENT).then_some(settings.accent_hue); + (theme::Tone::from_setting(settings.theme), hue) } fn color(value: theme::Rgb) -> slint::Color { slint::Color::from_rgb_u8(value.0, value.1, value.2) } -/// Diagnostic renderer selection (`HALATION_RENDERER`, default `skia`). A renderer that is not -/// compiled in or cannot start is an error; there is no fallback to another renderer. +/// Renderer selection (`HALATION_RENDERER`): `skia-opengl` (desktop OpenGL) by default when the shipping +/// feature is compiled, `skia` otherwise. A renderer that is not compiled in or cannot start is an error; +/// there is no fallback to another renderer. fn select_renderer() -> Result> { - let requested = std::env::var("HALATION_RENDERER").unwrap_or_else(|_| "skia".to_owned()); + let requested = std::env::var("HALATION_RENDERER").unwrap_or_else(|_| { + if cfg!(feature = "skia-opengl") { + "skia-opengl".to_owned() + } else { + "skia".to_owned() + } + }); let selector = slint::BackendSelector::new().backend_name("winit".into()); let selector = match requested.as_str() { "skia" => selector.renderer_name("skia".into()), "skia-d3d" => selector.renderer_name("skia".into()).require_d3d(), #[cfg(feature = "diag-skia-vulkan")] "skia-vulkan" => selector.renderer_name("skia".into()).require_vulkan(), - #[cfg(feature = "diag-skia-opengl")] + #[cfg(feature = "skia-opengl")] // Desktop OpenGL: Slint's default GLES 3.0 context does not draw stroked paths on some drivers. "skia-opengl" => selector .renderer_name("skia-opengl".into()) .require_opengl(), - #[cfg(feature = "diag-skia-opengl")] + #[cfg(feature = "skia-opengl")] "skia-opengl-es" => selector .renderer_name("skia-opengl".into()) .require_opengl_es(), @@ -1457,4 +1584,78 @@ mod tests { assert_eq!(model.row_count(), 1); assert_eq!(model.row_data(0).unwrap().name.as_str(), "Renamed.png"); } + + #[test] + fn dragging_the_accent_strip_recolours_and_saves_the_hue() { + use crate::profile::{LaunchOptions, Profile}; + use crate::ui::{AppWindow, Theme}; + use slint::ComponentHandle; + use slint::platform::{PointerEventButton, WindowEvent}; + + i_slint_backend_testing::init_no_event_loop(); + let root = std::env::temp_dir().join(format!("halation-accent-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&root); + let profile = Profile::at(root.clone()); + profile.ensure().unwrap(); + let ui = AppWindow::new().unwrap(); + ui.show().unwrap(); + // Short enough that the page scrolls + ui.window().set_size(slint::LogicalSize::new(960.0, 420.0)); + ui.window().dispatch_event(WindowEvent::Resized { + size: slint::LogicalSize::new(960.0, 420.0), + }); + let controller = + super::Controller::new(ui.as_weak(), profile, LaunchOptions::default()).unwrap(); + controller.install(false); + ui.invoke_navigate(3); + ui.set_settings_category(1); + i_slint_backend_testing::mock_elapsed_time(std::time::Duration::from_millis(1000)); + slint::platform::update_timers_and_animations(); + let before = ui.global::().get_accent(); + + let strip = i_slint_backend_testing::ElementHandle::find_by_accessible_label(&ui, "Accent") + .find(|e| e.accessible_role() == Some(i_slint_backend_testing::AccessibleRole::Slider)) + .expect("the accent strip is on Interface"); + let (pos, size) = (strip.absolute_position(), strip.size()); + let at = + |f: f32| slint::LogicalPosition::new(pos.x + size.width * f, pos.y + size.height / 2.0); + let button = PointerEventButton::Left; + ui.window() + .dispatch_event(WindowEvent::PointerMoved { position: at(0.2) }); + let wait = |ms| { + i_slint_backend_testing::mock_elapsed_time(std::time::Duration::from_millis(ms)); + slint::platform::update_timers_and_animations(); + }; + ui.window().dispatch_event(WindowEvent::PointerPressed { + position: at(0.2), + button, + }); + wait(16); + ui.window() + .dispatch_event(WindowEvent::PointerMoved { position: at(0.3) }); + wait(16); + ui.window() + .dispatch_event(WindowEvent::PointerMoved { position: at(0.4) }); + wait(150); + assert_ne!( + ui.global::().get_accent(), + before, + "dragging previews the hue" + ); + ui.window() + .dispatch_event(WindowEvent::PointerMoved { position: at(0.5) }); + wait(16); + ui.window().dispatch_event(WindowEvent::PointerReleased { + position: at(0.5), + button, + }); + slint::platform::update_timers_and_animations(); + let hue = controller.services.borrow().settings.current().accent_hue; + assert!( + (160..=200).contains(&hue), + "the middle of the strip saves about 180°, got {hue}" + ); + assert_ne!(ui.global::().get_accent(), before); + let _ = std::fs::remove_dir_all(&root); + } } diff --git a/crates/halation-app/src/assets.rs b/crates/halation-app/src/assets.rs index 10751ab..5d971bc 100644 --- a/crates/halation-app/src/assets.rs +++ b/crates/halation-app/src/assets.rs @@ -1,8 +1,9 @@ //! The app's files beside the executable, in `assets\` (Java, 2026-10-21: assets ship apart from the exe, installer -//! only): the mark and wordmark, the icons, the Inter typeface, and Home's backdrop loop. `build.rs` copies +//! only): the mark and wordmark, the icons, the typefaces (Schibsted Grotesk, Italiana), and Home's backdrop loop. `build.rs` copies //! the crate's `assets/` there for development builds. A missing file is reported to the user and logged; the app still //! runs without it. +use crate::theme::Tone; use crate::ui::{AppWindow, Assets}; use slint::{ComponentHandle, Image}; use std::path::{Path, PathBuf}; @@ -90,12 +91,15 @@ fn set_icon(assets: &Assets<'_>, name: &str, image: Image) { pub fn required() -> Vec { let mut files: Vec = [ "halation-mark.png", + "halation-app-icon.png", "halation-wordmark.svg", + "halation-wordmark-glow.png", "drop-outline.svg", "drape-still.jpg", "drape-loop.mp4", "drape-tint.bin", - "fonts/Inter.ttf", + "fonts/SchibstedGrotesk.ttf", + "fonts/Italiana.ttf", ] .iter() .map(|file| (*file).to_owned()) @@ -112,33 +116,65 @@ pub fn missing(dir: &Path) -> Vec { .collect() } -/// Registers the Inter typeface with Slint's font collection; it must run before the window is created +/// The typefaces the interface uses, in `fonts/` +pub const FONTS: [&str; 2] = ["SchibstedGrotesk.ttf", "Italiana.ttf"]; + +/// Registers the typefaces with Slint's font collection; it must run before the window is created pub fn register_fonts(dir: &Path) -> Result<(), String> { - let path = dir.join("fonts").join("Inter.ttf"); - let bytes = std::fs::read(&path).map_err(|error| format!("{}: {error}", path.display()))?; - let blob = slint::fontique_011::fontique::Blob::new(std::sync::Arc::new(bytes)); let mut collection = slint::fontique_011::shared_collection(); - if collection.register_fonts(blob, None).is_empty() { - return Err(format!("{}: not a usable font", path.display())); + for file in FONTS { + let path = dir.join("fonts").join(file); + let bytes = std::fs::read(&path).map_err(|error| format!("{}: {error}", path.display()))?; + let blob = slint::fontique_011::fontique::Blob::new(std::sync::Arc::new(bytes)); + if collection.register_fonts(blob, None).is_empty() { + return Err(format!("{}: not a usable font", path.display())); + } } Ok(()) } /// Loads the images into the interface's `Assets` global; files that are missing or unreadable stay empty -pub fn apply(ui: &AppWindow, dir: &Path) { +pub fn apply(ui: &AppWindow, dir: &Path, tone: Tone) { let assets = ui.global::(); let load = |file: &str| Image::load_from_path(&dir.join(file)).unwrap_or_default(); assets.set_mark(load("halation-mark.png")); + assets.set_app_icon(load("halation-app-icon.png")); assets.set_wordmark(load("halation-wordmark.svg")); + assets.set_wordmark_glow(load("halation-wordmark-glow.png")); assets.set_drop_outline(load("drop-outline.svg")); // Generated, not a file: a standard static grain assets.set_grain(Image::from_rgba8(crate::backdrop::grain_tile())); - assets.set_still(load("drape-still.jpg")); + assets.set_still(still(dir, tone)); for name in ICONS { set_icon(&assets, name, load(&format!("icons/{name}.svg"))); } } +/// Home's still frame in the theme's colour (docs/features/themes.md): the recorded file in Silver, recoloured like +/// the loop in Gold; empty when the file is missing or unreadable +pub fn still(dir: &Path, tone: Tone) -> Image { + let image = Image::load_from_path(&dir.join("drape-still.jpg")).unwrap_or_default(); + if tone == Tone::Silver { + return image; + } + let byte = |value: f32| value.round().clamp(0.0, 255.0) as u8; + if let Some(mut pixels) = image.to_rgb8() { + for pixel in pixels.make_mut_slice() { + let [r, g, b] = tone.drape(f32::from(pixel.r), f32::from(pixel.g), f32::from(pixel.b)); + (pixel.r, pixel.g, pixel.b) = (byte(r), byte(g), byte(b)); + } + return Image::from_rgb8(pixels); + } + if let Some(mut pixels) = image.to_rgba8() { + for pixel in pixels.make_mut_slice() { + let [r, g, b] = tone.drape(f32::from(pixel.r), f32::from(pixel.g), f32::from(pixel.b)); + (pixel.r, pixel.g, pixel.b) = (byte(r), byte(g), byte(b)); + } + return Image::from_rgba8(pixels); + } + image +} + #[cfg(test)] mod tests { use super::*; diff --git a/crates/halation-app/src/backdrop.rs b/crates/halation-app/src/backdrop.rs index 29295ce..18015c5 100644 --- a/crates/halation-app/src/backdrop.rs +++ b/crates/halation-app/src/backdrop.rs @@ -47,6 +47,11 @@ impl Palette { } pub fn from_tint(tint: &[u8]) -> Result { + Self::toned(tint, crate::theme::Tone::Silver) + } + + /// The colour table in a theme's colours (`Tone::drape`) + pub fn toned(tint: &[u8], tone: crate::theme::Tone) -> Result { if tint.len() != 256 * 3 { return Err(format!( "the backdrop tint holds {} bytes, not 768", @@ -64,8 +69,9 @@ impl Palette { let (low, t) = (l.floor() as usize, l.fract()); let high = (low + 1).min(255); let at = |index: usize, channel: usize| f32::from(tint[index * 3 + channel]); - [0, 1, 2] - .map(|c| ((at(low, c) * (1.0 - t) + at(high, c) * t) * 256.0).round() as i32) + let [r, g, b] = [0, 1, 2].map(|c| at(low, c) * (1.0 - t) + at(high, c) * t); + tone.drape(r, g, b) + .map(|v| (v.min(255.0) * 256.0).round() as i32) }) .collect(); let dither = (0..DITHER * DITHER) @@ -276,26 +282,37 @@ fn gaussian(x: u32, y: u32) -> f32 { /// Plays the loop on a decoding thread: `request` asks for the next frame at a size, `deliver` gets it on that thread pub struct Player { requests: std::sync::mpsc::SyncSender<(u32, u32)>, + /// The theme the frames are coloured in (0 Silver, 1 Gold); the thread rebuilds its table when it changes + tone: std::sync::Arc, } impl Player { /// Starts the decoding thread for the loop in `assets`; `None` when the loop cannot play (missing files), and Home /// keeps its still frame - pub fn start(assets: &Path, deliver: F) -> Option + pub fn start(assets: &Path, tone: crate::theme::Tone, deliver: F) -> Option where F: Fn(SharedPixelBuffer) + Send + 'static, { - let palette = Palette::load(&assets.join("drape-tint.bin")).ok()?; + let tint = std::fs::read(assets.join("drape-tint.bin")).ok()?; + Palette::from_tint(&tint).ok()?; let video = assets.join("drape-loop.mp4"); if !video.is_file() { return None; } let (requests, wanted) = std::sync::mpsc::sync_channel::<(u32, u32)>(1); + let tone = std::sync::Arc::new(std::sync::atomic::AtomicU8::new(tone as u8)); + let seen = tone.clone(); std::thread::Builder::new() .name("backdrop".into()) - .spawn(move || decode_loop(&video, &palette, &wanted, &deliver)) + .spawn(move || decode_loop(&video, &tint, &seen, &wanted, &deliver)) .ok()?; - Some(Self { requests }) + Some(Self { requests, tone }) + } + + /// Colours the next frames in `tone` + pub fn set_tone(&self, tone: crate::theme::Tone) { + self.tone + .store(tone as u8, std::sync::atomic::Ordering::Relaxed); } /// Asks for the next frame for a window of `width` x `height` pixels; skipped while the previous request is still @@ -308,12 +325,25 @@ impl Player { /// The decoding thread: one frame per request until the player is dropped or the decoder fails fn decode_loop( video: &Path, - palette: &Palette, + tint: &[u8], + tone: &std::sync::atomic::AtomicU8, wanted: &std::sync::mpsc::Receiver<(u32, u32)>, deliver: &F, ) where F: Fn(SharedPixelBuffer), { + let toned = |value: u8| { + let tone = if value == crate::theme::Tone::Gold as u8 { + crate::theme::Tone::Gold + } else { + crate::theme::Tone::Silver + }; + Palette::toned(tint, tone) + }; + let mut current = tone.load(std::sync::atomic::Ordering::Relaxed); + let Ok(mut palette) = toned(current) else { + return; + }; let Ok(mut decoder) = mf::Decoder::open(video) else { return; }; @@ -324,6 +354,14 @@ fn decode_loop( let mut frames: [Option>; 2] = [None, None]; let mut turn = 0; while let Ok((out_w, out_h)) = wanted.recv() { + // The theme changed: one new colour table (256 entries), then on as before + let now = tone.load(std::sync::atomic::Ordering::Relaxed); + if now != current + && let Ok(next) = toned(now) + { + palette = next; + current = now; + } match decoder.next(&mut plane) { Ok((width, height, pitch)) => { let mut frame = match frames[turn].take() { @@ -517,6 +555,22 @@ mod tests { assert!(Palette::from_tint(&[0; 10]).is_err()); } + #[test] + fn the_gold_theme_turns_the_drape_warm_at_the_same_brightness() { + let tint = std::fs::read(shipped().join("drape-tint.bin")).unwrap(); + let silver = Palette::toned(&tint, crate::theme::Tone::Silver).unwrap(); + let gold = Palette::toned(&tint, crate::theme::Tone::Gold).unwrap(); + let mid = (30.0 * (COLOURS - 1) as f32 / LIFT) as usize; + let [r, g, b] = gold.colour[mid]; + assert!(r > b, "lighter parts lean gold"); + let luma = |[r, g, b]: [i32; 3]| 0.2126 * r as f32 + 0.7152 * g as f32 + 0.0722 * b as f32; + let (before, after) = (luma(silver.colour[mid]), luma([r, g, b])); + assert!( + (before - after).abs() <= before * 0.02 + 256.0, + "{before} vs {after}" + ); + } + #[test] fn a_frame_covers_the_window_with_a_one_level_dither() { // A flat grey of luma 40 (tint: colour equals luma) stays within one level of it, and the dither reaches both diff --git a/crates/halation-app/src/catalog.rs b/crates/halation-app/src/catalog.rs index 8ecfd9c..03bfb7e 100644 --- a/crates/halation-app/src/catalog.rs +++ b/crates/halation-app/src/catalog.rs @@ -33,12 +33,12 @@ pub const TOOLS: [ToolSpec; 11] = [ id: "converter", name: "Converter", icon: "convert", - summary: "Uses FFmpeg (optional), Pandoc (text documents) (optional), LibreOffice (office documents) (optional), PDFium (PDF pages) (optional)", + summary: "Converts images locally; audio and video use FFmpeg (installable on demand). Documents are not supported yet.", group: 1, beta: true, missing: "", - available: false, - reason: ENGINE_OFF, + available: true, + reason: "", }, ToolSpec { id: "vocal-remover", @@ -178,7 +178,7 @@ pub const COMPONENTS: [(&str, &str); 13] = [ pub fn settings_section(query: &str) -> Option { const SECTIONS: [&str; 8] = [ "general language english spanish espanol reduce animations motion processes dock notify notification job finishes", - "interface dock compact expand keep open activity window maximized full screen", + "interface theme silver gold accent colour color hue dock compact expand keep open activity window maximized full screen", "you artist name youtube spotify soundcloud instagram tiktok links profile", "files save export location ask halation folder name template video image", "processing mode quiet balanced fast graphics card gpu vocal remover processor jobs downloads minimized", diff --git a/crates/halation-app/src/converter.rs b/crates/halation-app/src/converter.rs new file mode 100644 index 0000000..6a0452a --- /dev/null +++ b/crates/halation-app/src/converter.rs @@ -0,0 +1,1894 @@ +//! Native Converter controller. Input/plan/job state survives lazy page destruction. +use crate::{ + profile::Profile, + ui::{AppWindow, ConvertRow, FormatRow}, +}; +use halation_core::{ + components::{self, Ffmpeg}, + convert::{self, Class, Plan, Source}, + destinations::{Destinations, ExportLocation, SaveMode, SavePicker}, + engine::JobEngine, + folders, + playback::{self, Picture, Player}, + queue::{JobSpec, JobState, Lane}, +}; +use slint::{ + ComponentHandle, Image, Model, ModelRc, Rgba8Pixel, SharedPixelBuffer, VecModel, Weak, +}; +use std::{ + cell::RefCell, + collections::HashSet, + path::{Path, PathBuf}, + rc::Rc, + sync::{ + Arc, Mutex, + atomic::{AtomicBool, AtomicU64, Ordering}, + }, + time::Duration, +}; + +static WORKSPACE: AtomicU64 = AtomicU64::new(0); + +struct Input { + path: PathBuf, + source: Result, + plans: Vec, + target: String, + job: Option, + output: Option, + status: String, + subfolder: Option, + /// Size of the finished output, shown beside the original's + bytes_out: Option, +} + +struct Loaded { + inputs: Vec, + ffmpeg: Option, + encoders: Option>, + limited: bool, +} + +#[derive(Default)] +struct State { + inputs: Vec, + selected: usize, + busy: bool, + opened: bool, + ffmpeg: Option, + encoders: Option>, + install_job: Option, + message: String, + destinations: Destinations, + location: ExportLocation, + location_writable: bool, + /// What was last written to export-location.json; an unchanged location is not written (and synced) again + location_saved: Option>, + left_open: bool, + inspector_open: bool, +} + +pub(crate) struct Converter { + weak: Weak, + state: RefCell, + inbox: Arc>>, + rows: Rc>, + formats: Rc>, + engine: JobEngine, + profile: Profile, + preview_path: RefCell>, + preview_job: RefCell>, + preview_generation: Arc, + probe_cancel: Arc, + /// The remembered export location is written off the UI thread (a synced write); the newest write wins and a + /// failure comes back here + location_writes: Arc>, + audio: RefCell