advotracker_client: introduce Windows icon handling
* include `windres` crate * create a `build.rs` * include a `hotline.svg` that is converted to advotracker.ico using inkscape and imagemagick * crate a `README.md` Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -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"
|
||||
|
||||
38
crates/advotracker_client/README.md
Normal file
38
crates/advotracker_client/README.md
Normal file
@@ -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.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 132 KiB |
143
crates/advotracker_client/assets/images/Hotline.svg
Normal file
143
crates/advotracker_client/assets/images/Hotline.svg
Normal file
@@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="181.41733"
|
||||
height="181.41733"
|
||||
viewBox="0 0 48 48"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
sodipodi:docname="Hotline.svg"
|
||||
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
|
||||
inkscape:export-filename="/data/development/advotracker/images/Hotline.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
<title
|
||||
id="title903">Hotline</title>
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="3.5001171"
|
||||
inkscape:cx="106.62221"
|
||||
inkscape:cy="103.19504"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:document-rotation="0"
|
||||
showgrid="false"
|
||||
units="px"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:window-height="656"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
showguides="false"
|
||||
inkscape:guide-bbox="true">
|
||||
<sodipodi:guide
|
||||
position="-2.2601038,30.435621"
|
||||
orientation="0,-1"
|
||||
id="guide1331" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Hotline</dc:title>
|
||||
<cc:license
|
||||
rdf:resource="http://artlibre.org/licence/lal" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://artlibre.org/licence/lal">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Hotline-Icon"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
style="display:inline">
|
||||
<g
|
||||
id="g1369"
|
||||
transform="translate(47.971251,-0.00147642)">
|
||||
<path
|
||||
style="fill:#ffc49b;fill-opacity:0.470588;stroke:#d1b5a4;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.988588;paint-order:markers fill stroke"
|
||||
d="m -43.193278,41.999791 c 1.49691,-2.40444 3.504494,-4.137234 3.97049,-7.897551 -8.897002,-20.115732 11.448594,-39.761883 23.320156,-25.6774766 4.111107,0.7296566 15.904257,0.2419988 9.448496,27.2025326 0.655793,2.44805 2.687955,4.433014 5.1147,6.285219 -7.038787,4.303603 -14.139814,3.119543 -21.26392,-0.09939 -7.121959,1.345389 -14.838126,5.638639 -20.589922,0.186666 z"
|
||||
id="path954"
|
||||
sodipodi:nodetypes="ccccccc" />
|
||||
<path
|
||||
style="fill:#fff69f;fill-opacity:1;stroke:#d1b4a3;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.992157;paint-order:markers fill stroke"
|
||||
d="m -16.566294,17.564379 c 2.321537,1.627329 4.680103,3.221015 5.43583,6.271019 l -0.128201,11.537305 c -1.500786,4.68743 -3.897101,6.738521 -6.558077,8.314102 -1.547997,0.916578 -2.915462,2.596633 -4.733266,2.74464 -2.358949,0.192067 -3.335981,-1.37334 -4.702985,-2.208498 -10.561198,-6.452258 -9.299955,-15.045913 -3.54451,-18.563078 5.999351,-1.157234 11.292071,-3.485647 14.231209,-8.09549 z"
|
||||
id="path956"
|
||||
sodipodi:nodetypes="cccssscc" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:1;stroke:#acbac7;stroke-width:0.999997;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
|
||||
d="m -5.8305041,36.150455 c 0.3952343,5.0031 -3.5482004,3.771616 -15.3273579,3.956909"
|
||||
id="path1001"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<g
|
||||
id="g1357">
|
||||
<circle
|
||||
style="opacity:0.902314;fill:#8c8c8c;fill-opacity:1;stroke:none;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.470588;paint-order:markers fill stroke"
|
||||
id="path1314"
|
||||
cx="-16.847094"
|
||||
cy="31.137058"
|
||||
r="1.6374409" />
|
||||
<circle
|
||||
style="opacity:0.902314;fill:#8c8c8c;fill-opacity:1;stroke:none;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.470588;paint-order:markers fill stroke"
|
||||
id="circle1316"
|
||||
cx="-29.12112"
|
||||
cy="31.137058"
|
||||
r="1.6374409" />
|
||||
<ellipse
|
||||
style="opacity:0.902314;fill:#8c8c8c;fill-opacity:1;stroke:none;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.470588;paint-order:markers fill stroke"
|
||||
id="path1301"
|
||||
ry="1.5932699"
|
||||
rx="2.0367212"
|
||||
cy="39.994835"
|
||||
cx="-22.984106" />
|
||||
</g>
|
||||
<g
|
||||
id="g1337"
|
||||
transform="translate(0,1.7607786)">
|
||||
<rect
|
||||
style="opacity:1;vector-effect:none;fill:#d9e0e5;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="rect1293"
|
||||
width="4.1744041"
|
||||
height="8.3096123"
|
||||
x="-7.5382333"
|
||||
y="25.556793" />
|
||||
<path
|
||||
style="opacity:0.902314;mix-blend-mode:normal;fill:none;fill-opacity:0.975108;stroke:#acbac7;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
|
||||
d="m -7.6299573,25.267021 c 0,0 4.3765084,-0.627056 4.3333554,0.61985 -0.090936,2.627603 0.2119865,5.547594 -0.1762703,7.668357 -0.2291003,1.251407 -4.3491445,0.568011 -4.3491445,0.568011 z"
|
||||
id="path999"
|
||||
sodipodi:nodetypes="csscc" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.4 KiB |
19
crates/advotracker_client/build.rs
Normal file
19
crates/advotracker_client/build.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* advotracker - Hotline tackingtool for Advocats
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
1
crates/advotracker_client/resources.rc
Normal file
1
crates/advotracker_client/resources.rc
Normal file
@@ -0,0 +1 @@
|
||||
advotracker ICON "./assets/icons/advotracker/advotracker.ico"
|
||||
Reference in New Issue
Block a user