1
0
mirror of https://github.com/pcvolkmer/cert-tools.git synced 2025-04-19 09:06:49 +00:00

chore: add app icon

This commit is contained in:
Paul-Christian Volkmer 2025-01-24 15:17:20 +01:00
parent 557ca5602d
commit 75455843ee
6 changed files with 65 additions and 6 deletions

View File

@ -2,6 +2,7 @@
!define APP_NAME "Cert Tools" !define APP_NAME "Cert Tools"
!define APP_EXE "cert-tools-ui.exe" !define APP_EXE "cert-tools-ui.exe"
!define MUI_ICON "resources\icon.ico"
!define UNINSTALLER_EXE "uninstaller.exe" !define UNINSTALLER_EXE "uninstaller.exe"
!define INSTALL_DIR "$LocalAppData\Programs\${APP_NAME}" !define INSTALL_DIR "$LocalAppData\Programs\${APP_NAME}"

BIN
resources/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -16,18 +16,19 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
use std::cmp::Ordering;
use itertools::Itertools;
use openssl::asn1::Asn1Time; use openssl::asn1::Asn1Time;
use openssl::hash::MessageDigest; use openssl::hash::MessageDigest;
use openssl::nid::Nid; use openssl::nid::Nid;
use openssl::pkey::{PKey, PKeyRef, Public}; use openssl::pkey::{PKey, PKeyRef, Public};
use openssl::x509::X509; use openssl::x509::X509;
use std::cmp::Ordering;
use std::fmt::Display; use std::fmt::Display;
use std::fs; use std::fs;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::path::Path; use std::path::Path;
use std::time::{SystemTime, UNIX_EPOCH}; use std::time::{SystemTime, UNIX_EPOCH};
use itertools::Itertools;
pub fn hex_encode<T: AsRef<[u8]>>(s: T) -> String { pub fn hex_encode<T: AsRef<[u8]>>(s: T) -> String {
s.as_ref() s.as_ref()

View File

@ -5,6 +5,10 @@ edition = "2021"
[dependencies] [dependencies]
cert-tools = { path = "..", version = "*" } cert-tools = { path = "..", version = "*" }
iced = { version = "0.13", features = ["wgpu", "tiny-skia", "tokio", "web-colors"], default-features = false } iced = { version = "0.13", features = ["wgpu", "tiny-skia", "tokio", "web-colors", "image"], default-features = false }
rfd = "0.15" rfd = "0.15"
itertools = "0.14" itertools = "0.14"
image = {version = "0.25", features = ["ico"], default-features = false }
[build-dependencies]
winresource = "0.1"

26
ui/build.rs Normal file
View File

@ -0,0 +1,26 @@
/*
* This file is part of cert-tools
*
* Copyright (C) 2025 the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
fn main() {
if std::env::var_os("CARGO_CFG_WINDOWS").is_some() {
let mut res = winresource::WindowsResource::new();
res.set_icon("../resources/icon.ico");
res.compile().unwrap();
}
}

View File

@ -1,3 +1,22 @@
/*
* This file is part of cert-tools
*
* Copyright (C) 2025 the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#![windows_subsystem = "windows"] #![windows_subsystem = "windows"]
use cert_tools::{Chain, PrivateKey}; use cert_tools::{Chain, PrivateKey};
@ -7,9 +26,10 @@ use iced::widget::{
self, button, column, container, horizontal_rule, horizontal_space, row, text, text_editor, self, button, column, container, horizontal_rule, horizontal_space, row, text, text_editor,
text_input, Container, Scrollable, text_input, Container, Scrollable,
}; };
use iced::window::icon;
use iced::{ use iced::{
alignment, application, clipboard, color, Background, Border, Color, Element, Font, Length, alignment, application, clipboard, color, window, Background, Border, Color, Element, Font,
Pixels, Settings, Size, Task, Length, Pixels, Settings, Size, Task,
}; };
use std::fs; use std::fs;
use std::path::PathBuf; use std::path::PathBuf;
@ -21,6 +41,13 @@ fn main() -> iced::Result {
default_text_size: Pixels::from(13), default_text_size: Pixels::from(13),
..Settings::default() ..Settings::default()
}) })
.window(window::Settings {
icon: match image::load_from_memory(include_bytes!("../../resources/icon.ico")) {
Ok(image) => icon::from_rgba(image.as_bytes().to_vec(), 128, 128).ok(),
_ => None,
},
..window::Settings::default()
})
.resizable(false) .resizable(false)
.window_size(Size::new(1020.0, 800.0)) .window_size(Size::new(1020.0, 800.0))
.run_with(Ui::new) .run_with(Ui::new)