diff --git a/crates/advotracker_client/Cargo.toml b/crates/advotracker_client/Cargo.toml index bc737d1..f729c62 100644 --- a/crates/advotracker_client/Cargo.toml +++ b/crates/advotracker_client/Cargo.toml @@ -7,11 +7,17 @@ readme = "README.md" license = "(0BSD OR MIT)" edition = "2018" default-run = "advotracker" +build = "build.rs" [target.'cfg(windows)'.dependencies] -winapi = { version = "0.3", features = ["winuser"] } +winapi = { version = "0.3", features = [ "winuser" ] } #diesel = { version = "1.4", features = [ "postgres", "sqlite" ] } +[target.'cfg(target_os = "windows")'.build-dependencies] +winres = { version = "0.1" } +# for language constants +winapi = { version = "0.3", features = [ "winnt" ] } + [dependencies] async-stream = "~0.2" chrono = { version = "~0.4.0", features = ["serde"] } @@ -37,6 +43,9 @@ tracing = { version = "~0.1" } tracing-subscriber = { version = "~0.2.0", features = ["tracing-log"] } viperus = { git = "https://github.com/maurocordioli/viperus", features = ["cache", "fmt-clap", "fmt-env", "global", "watch"] } +[build-dependencies] +winres = { version = "0.1" } + #[dev-dependencies] [features] @@ -50,6 +59,9 @@ identifier = "nwx.advotracker" short_description = "Online legal advice helper." description = "Supports lawyers to capture relevant data encountered during an online legal advice.\n" +[package.metadata.winres] +LegalCopyright = "Copyright © 2020-2021" + #[[bin]] #//name = "policycheck" #path = "src/bin/policycheck.rs" diff --git a/crates/advotracker_client/README.md b/crates/advotracker_client/README.md new file mode 100644 index 0000000..899091c --- /dev/null +++ b/crates/advotracker_client/README.md @@ -0,0 +1,38 @@ +# About + +This is the client component of `advotracker`. + +## Windows specific + +We like to support an icon an object attributes for the compiled +version of `advotracker`. While searching for a solution, the description of this +[Web link][https://graphicdesign.stackexchange.com/questions/77359/how-to-convert-a-square-svg-to-all-size-ico] +was adapted and combined with a `windres` crate. + +### Icon creation + +This commandline solution will create an icon that can be linked into the Windows binary. + +* create the `svg` art file + You may use `inkscape`, a versitile and user frendly + tool to create your vector graphics art. Save it as `advotracker.svg`. Next export the scaled png files. + +``` +inkscape -w 16 -h 16 -o advotracker_16.png -l advotracker.svg +inkscape -w 32 -h 32 -o advotracker_32.png -l advotracker.svg +inkscape -w 48 -h 48 -o advotracker_48.png -l advotracker.svg +inkscape -w 64 -h 64 -o advotracker_64.png -l advotracker.svg +``` +* create the `ico` file + The ico format can handle multiple layes with different resolutions. + We make use of ImageMagick to create the icon file like this: + +``` +convert advotracker_16.png advotracker_32.png advotracker_48.png advotracker_64.png advotracker.ico +``` + +* link in the icon + +rust offers the `windres` crate, that will handle the linking of icons +as well as the definition of binary objet resources. `advotracker` +will define the needed settings in its `build.rs` file. diff --git a/crates/advotracker_client/assets/icons/advotracker/advotracker.ico b/crates/advotracker_client/assets/icons/advotracker/advotracker.ico new file mode 100644 index 0000000..17b2d14 Binary files /dev/null and b/crates/advotracker_client/assets/icons/advotracker/advotracker.ico differ diff --git a/crates/advotracker_client/assets/images/Hotline.svg b/crates/advotracker_client/assets/images/Hotline.svg new file mode 100644 index 0000000..4b57e6b --- /dev/null +++ b/crates/advotracker_client/assets/images/Hotline.svg @@ -0,0 +1,143 @@ + + + Hotline + + + + + + + + image/svg+xml + + Hotline + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/crates/advotracker_client/build.rs b/crates/advotracker_client/build.rs new file mode 100644 index 0000000..ae87e42 --- /dev/null +++ b/crates/advotracker_client/build.rs @@ -0,0 +1,19 @@ +/* + * advotracker - Hotline tackingtool for Advocats + * + * Copyright 2021 Ralf Zerres + * SPDX-License-Identifier: (0BSD or MIT) + */ + +use winres; + +fn main() { + if cfg!(target_os = "windows") { + let mut res = winres::WindowsResource::new(); + res.set_icon("assets/icons/adovtracker/advotracker.ico") + .set("InternalName", "ADVOTRACKER.EXE") + // manually set version 0.1.5.2 + .set_version_info(winres::VersionInfo::PRODUCTVERSION, 0x0000000100050002); + res.compile().unwrap(); + } +} diff --git a/crates/advotracker_client/resources.rc b/crates/advotracker_client/resources.rc new file mode 100644 index 0000000..1857579 --- /dev/null +++ b/crates/advotracker_client/resources.rc @@ -0,0 +1 @@ +advotracker ICON "./assets/icons/advotracker/advotracker.ico"