From aaf649cb05dfec82f5c10e1c0c381a626f3b5873 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Sat, 13 Dec 2025 22:07:44 +0100 Subject: [PATCH] feat: update ui to use iced 0.14 --- Cargo.toml | 2 +- ui/Cargo.toml | 15 ++++----------- ui/src/main.rs | 33 +++++++++++++++++---------------- 3 files changed, 22 insertions(+), 28 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7defb1b..f9f67b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "cert-tools" description = "Application to show, check and cleanup content of PEM files" version = "0.4.1" -edition = "2021" +edition = "2024" license = "GPL-3.0-or-later" authors = ["Paul-Christian Volkmer"] diff --git a/ui/Cargo.toml b/ui/Cargo.toml index 79a5fcf..656be73 100644 --- a/ui/Cargo.toml +++ b/ui/Cargo.toml @@ -1,20 +1,13 @@ [package] name = "cert-tools-ui" version = "0.4.1" -edition = "2021" +edition = "2024" [dependencies] cert-tools = { path = ".." } -iced = { version = "0.13", features = ["wgpu", "tiny-skia", "tokio", "web-colors", "image"], default-features = false } -rfd = "0.15" +iced = { version = "0.14", features = ["wayland", "x11", "wgpu", "tiny-skia", "tokio", "web-colors", "image", "advanced"], default-features = false } +rfd = "0.16" itertools = "0.14" [build-dependencies] -winresource = "0.1" - -[profile.release] -opt-level = "z" -codegen-units = 1 -lto = true -strip = true -panic = "abort" \ No newline at end of file +winresource = "0.1" \ No newline at end of file diff --git a/ui/src/main.rs b/ui/src/main.rs index 3a34cb9..2e02729 100644 --- a/ui/src/main.rs +++ b/ui/src/main.rs @@ -23,7 +23,7 @@ use cert_tools::{read_p12_file, save_p12_file, Chain, PrivateKey}; use iced::border::Radius; use iced::widget::text_editor::{default, Content, Status}; use iced::widget::{ - self, button, column, container, horizontal_rule, horizontal_space, row, text, text_editor, + self, button, column, container, rule, space, row, text, text_editor, text_input, Container, Scrollable, }; use iced::{alignment, application, clipboard, color, window, Background, Border, Color, Element, Font, Length, Padding, Pixels, Settings, Size, Task}; @@ -33,7 +33,8 @@ use std::time::SystemTime; use iced::window::settings::PlatformSpecific; fn main() -> iced::Result { - application(Ui::title, Ui::update, Ui::view) + application(Ui::new, Ui::update, Ui::view) + .title(Ui::title) .settings(Settings { default_text_size: Pixels::from(13), ..Settings::default() @@ -54,7 +55,7 @@ fn main() -> iced::Result { }) .resizable(false) .window_size(Size::new(1020.0, 800.0)) - .run_with(Ui::new) + .run() } enum File { @@ -294,7 +295,7 @@ impl Ui { }; match &self.chain { None => {} - Some(ref chain) => match file { + Some(chain) => match file { Ok(file) => { match save_p12_file(&file, &self.password_1, chain.certs(), private_key) { @@ -338,9 +339,9 @@ impl Ui { file: &'a File, ) -> text_input::TextInput<'a, Message> { let text = match file { - File::Invalid(ref file) - | File::Certificates(ref file, _) - | File::PrivateKey(ref file, _) => file.display().to_string(), + File::Invalid(file) + | File::Certificates(file, _) + | File::PrivateKey(file, _) => file.display().to_string(), _ => String::new(), }; @@ -474,7 +475,7 @@ impl Ui { text(" "), clip_button, cleanup_button, - horizontal_space(), + space::horizontal(), ] } else { row![ @@ -485,7 +486,7 @@ impl Ui { text(" "), clip_button, cleanup_button, - horizontal_space(), + space::horizontal(), ] } .spacing(2); @@ -539,7 +540,7 @@ impl Ui { container(text("")) } ], - horizontal_rule(1), + rule::horizontal(1), row![text("Issuer: ").width(160), text(cert.issuer().to_string())], row![ text("Gültigkeit: ").width(160), @@ -559,7 +560,7 @@ impl Ui { row![ text("SHA-1-Fingerprint: ").width(160), monospace_text(cert.fingerprint().sha1.to_string()), - horizontal_space(), + space::horizontal(), button("Copy to Clipboard") .style(button::secondary) .padding(1) @@ -571,7 +572,7 @@ impl Ui { row![ text("SHA-256-Fingerprint: ").width(160), monospace_text(cert.fingerprint().sha256.to_string()), - horizontal_space(), + space::horizontal(), button("Copy to Clipboard") .style(button::secondary) .padding(1) @@ -863,19 +864,19 @@ impl Ui { indicator.center_y(96), ] .spacing(40), - horizontal_rule(1), + rule::horizontal(1), buttons, - horizontal_rule(1), + rule::horizontal(1), match self.mode { UiMode::CertList => column![certs, chain_info], UiMode::Output => column![output], UiMode::ImportPassphrase => column![ask_for_import_password], UiMode::ExportPassphrase => column![ask_for_export_password], }, - horizontal_rule(1), + rule::horizontal(1), row![ text(&self.status), - horizontal_space(), + space::horizontal(), text(format!("Version {}", env!("CARGO_PKG_VERSION"))).style(|_| text::Style { color: Some(color!(0x888888)) }),