30 Commits

Author SHA1 Message Date
0b5e222318 advotracker_client: update windows resource handling
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-11-12 15:53:33 +01:00
ba76d87785 parse_args: cleanup
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-11-12 15:52:52 +01:00
e68be43861 advotracker_client: introduce fluent_light theming
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-11-12 15:52:14 +01:00
1343018e2d advotracker_client: bump version to (0.1.8)
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-11-12 15:51:06 +01:00
cc4a7045ca bump advotracker_client to version (0.1.8)
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-11-12 15:50:35 +01:00
c8f6a6d272 linter updates
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-11-12 15:48:17 +01:00
c1a4547261 Cargo.toml: bump advotracker_client to version (0.1.7)
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-07-15 01:27:24 +02:00
ff3362e92e cheet_sheet: update
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-07-15 01:26:42 +02:00
ceb1c429ff crate
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-07-15 01:26:10 +02:00
4ba5f1325d policycheck_view: update form identifier
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-07-15 01:15:07 +02:00
3ebf44e8fe services:allianzdirectcall: don't use idomatic variable names
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-07-15 01:12:45 +02:00
2a001a67d8 main_view: typo correction
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-07-15 01:11:30 +02:00
9d11661299 consume crate direcories
* provides target agnostic directory locations
* find config file in a target system standard location

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-07-15 01:07:38 +02:00
6f8cd04e5b main.rs: update lang_id handling
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-07-15 01:06:29 +02:00
ef0fce5021 advotracker_client: new mail recipient
* add "kooperation@rightmart.de" as valid recipient

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-07-15 01:05:03 +02:00
a0e9e14e3f Cargo.toml: bump advotracker_client to version (0.1.6-alpha1)
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-06-11 16:15:29 +02:00
90869c8305 Lint updates: introduce documentation strings
*  correctemitted missind strings emitted via 'missing_docs' macro

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-06-11 16:15:29 +02:00
05f6e13dae advotrackerd: update head
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-06-11 16:15:29 +02:00
d0035ecebb advotracker_db: update head
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-06-11 16:15:29 +02:00
9b6b128e59 advotracker_client: structure update consuming orbtk (#448)
* orbtk 0.3.1-alpha4 including merge #448

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-06-11 16:15:28 +02:00
541e516099 lib.rs: active warning for missing documentation strings
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-06-11 16:15:28 +02:00
dc463df476 twine: update i18n usage
* update to use latest twain crate
* activate feature vor serialization, deserialization (consuming 'serde')
* use (t!) macro from twain crate consuming i18n.rs
* i18n.rs is compiled via build.rs from source
* update docu hint in translation source

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-06-11 16:15:22 +02:00
5a21958325 send_ticketdata: update lettre usage
* update Cargo.toml to new lettre crate (v0.10.0-rc.3)
* use TEXT_PLAIN method

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-06-11 12:58:28 +02:00
e06545aa92 Update copyright and year
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-05-23 14:36:35 +02:00
9837ae0d0d static: New index file for node handling
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-05-21 12:50:14 +02:00
b0b90c3d6b Include new submodule names
* advotracker_db
* advotrackerd

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-05-21 12:49:11 +02:00
473c31d9ea New assets
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-05-21 12:48:45 +02:00
a5981b31a1 Include SDL2 dynamic library (OS=Windows)
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-05-21 12:48:04 +02:00
f7a0a97f34 Introduce 'Windows' resource handling
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-05-21 12:47:33 +02:00
78be428e7d Flatten create structure
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-05-21 12:46:33 +02:00
219 changed files with 2058 additions and 4419 deletions

7
.gitmodules vendored
View File

@@ -1,6 +1,9 @@
[submodule "advotrackerdb"] [submodule "advotrackerdb"]
path = crates/advotrackerdb path = advotrackerdb
url = https://gitea.networkx.de:50443/rzerres/advotrackerdb url = https://gitea.networkx.de:50443/rzerres/advotrackerdb
[submodule "advotrackerd"] [submodule "advotrackerd"]
path = crates/advotrackerd path = advotrackerd
url = https://gitea.networkx.de:50443/rzerres/advotrackerd url = https://gitea.networkx.de:50443/rzerres/advotrackerd
[submodule "advotracker_db"]
path = advotracker_db
url = https://gitea.networkx.de:50443/rzerres/advotracker_db

View File

@@ -14,20 +14,20 @@ keywords = [
] ]
edition = "2018" edition = "2018"
publish = false publish = false
#default-run = "crates/advotracker_client" #default-run = "advotracker_client"
[dependencies] [dependencies]
advotrackerdb = { version = "0.1.0-alpha1", path = "crates/advotrackerdb" } advotracker_db = { version = "0.1.0-alpha1", path = "advotracker_db" }
advotrackerd = { version = "0.1.0-alpha1", path = "crates/advotrackerd", default-features = false } advotrackerd = { version = "0.1.0-alpha1", path = "advotrackerd", default-features = false }
advotracker_client = { version = "0.1.5-alpha2", path = "crates/advotracker_client", default-features = false } advotracker_client = { version = "0.1.8", path = "advotracker_client", default-features = false }
[features] [features]
default = ["sqlite"] default = ["sqlite"]
# enable optional db backends # enable optional db backends
sqlite = [] sqlite = []
#sqlite = ["advotrackerdb_sqlite"] #sqlite = ["advotracker_db_sqlite"]
#postgresql = ["advotrackerdb_pstgresql"] #postgresql = ["advotracker_db_pstgresql"]
[profile.dev] [profile.dev]
#opt-level = 0 #opt-level = 0
@@ -63,7 +63,7 @@ overflow-checks = true
[workspace] [workspace]
members = [ members = [
"crates/advotrackerd", "advotrackerd",
"crates/advotrackerdb", "advotracker_db",
"crates/advotracker_client", "advotracker_client",
] ]

View File

@@ -0,0 +1,6 @@
#[target.x86_64-pc-windows-msvc]
#linker = "lld-link"
#linker = "/usr/local/msvc-wine-rust/linker-scripts/linkx64.sh"
#[target.i686-pc-windows-msvc]
#linker = "/usr/local/msvc-wine-rust/linker-scripts/linkx32.sh"

View File

@@ -0,0 +1,72 @@
[package]
name = "advotracker_client"
version = "0.1.8"
authors = ["Ralf Zerres <ralf.zerres@networkx.de>"]
description = "Frontend component that supports lawyers to capture relevant data encountered during an online legal advice."
readme = "README.md"
license = "(0BSD OR MIT)"
edition = "2018"
default-run = "advotracker"
build = "build.rs"
[build-dependencies]
#twine = { version = "0.3.9", features = ["serde"] }
## twine with PR's
twine = { path = "../../twine", features = ["serde"] }
winres = { version = "0.1" }
winapi = { version = "0.3", features = ["winnt", "winuser"] }
[dependencies]
async-stream = "~0.2"
chrono = { version = "0.4.0", features = ["serde"] }
cfg-if = { version = "1.0" }
clap = { version = "2.33", features = ["suggestions", "color"] }
csv = { version = "1.1" }
directories = { version = "3.0" }
dotenv = { version = "0.15.0" }
envy = { version = "0.4" }
lettre ={ version = "0.10.0-rc.3" }
lazy_static = { version = "1.4.0" }
log = { version = "0.4.8" }
maud = { version = "0.22.1" }
orbtk = { git = "https://github.com/redox-os/orbtk.git", branch = "develop" }
#orbtk = { path = "../../../orbtk", branch="next" }
serde = { version = "1", features = ["derive"] }
sdl2 = { version = "0.34", features = ["bundled"] }
substring = { version = "1" }
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"] }
viperus = { git = "https://github.com/maurocordioli/viperus", default-features = false }
winapi = { version = "0.3", features = ["winuser"] }
[features]
default = ["parse_cli"]
debug = ["orbtk/debug"]
light = []
parse_cli = ["viperus/cache", "viperus/fmt-clap", "viperus/fmt-env", "viperus/global"]
[package.metadata.bundle]
name = "advotracker"
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]
OriginalFilename = "advotracker.exe"
FileDescription = "Windows frontend that supports lawyers to capture relevant data encountered during an online legal advice.❤"
LegalCopyright = "Copyright © 2020-2021"
#[target.'cfg(target_os="windows")'.build-dependencies]
[target.'cfg(windows)'.build-dependencies]
cfg-if = { version = "1.0" }
winapi = { version = "0.3", features = ["winnt"] }
winres = { version = "0.1" }
#windres = { version = "0.2" }
#[target.x86_64-pc-windows-gnu]
#linker = "lld-link"
[[bin]]
name = "advotracker"
path = "src/main.rs"

BIN
advotracker_client/SDL2.dll Executable file

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,179 @@
Theme (
styles: {
"button_action": (
base: "button",
properties: {
//"background": "transparent",
"border_radius": 3,
"h_align": "center",
"v_align": "center",
},
),
"button_menu": (
base: "button_single_content",
properties: {
"h_align": "end",
//"icon": "material_icons_font::MD_MENU",
},
),
"combo_box_form": (
base: "combo_box",
properties: {
"width": 200,
//"height": 28,
},
),
"combo_box_popup": (
base: "popup_box_popup",
properties: {
"height": 80,
"min_height": 80,
"width": 160,
"min_width": 80,
},
),
"mail_label": (
base: "base",
properties: {
"h_align": "end",
"v_align": "center",
},
),
"mail_to": (
base: "combo_box_form",
properties: {
"h_align": "end",
},
),
"mail_cc": (
base: "combo_box_form",
properties: {
"h_align": "end",
},
),
"configuration_form": (
base: "container",
properties: {
"margin": 4,
},
),
"container_action": (
base: "container_form",
properties: {
"border_width": 1,
"padding": {
"left": 14,
"top": 0,
"right": 14,
"bottom": 0,
},
"h_align": "center",
},
),
"container_form": (
base: "container",
properties: {
"padding": 14,
"border_brush": "$CONTAINER_BORDER",
"border_radius": 0,
"border_width": 1,
"min_height": 330,
},
),
"container_mail": (
base: "container_form",
properties: {
"border_width": 0,
"padding": {
"left": 14,
"top": 0,
"right": 14,
"bottom": 14,
}
},
),
"container_progress": (
base: "container",
properties: {
"border_brush": "$CONTAINER_BORDER",
"h_align": "center",
"padding": 14,
"v_align": "center",
},
),
"header_bar": (
base: "header",
properties: {
//"h_align": "center",
//"v_align": "center",
"min_height": 32,
//"padding": 14,
}
),
"header_text": (
base: "header",
properties: {
"h_align": "center",
"v_align": "center",
}
),
"popup_menu": (
//base: "popup",
properties: {
"width": 300,
"hight": 200,
"border_radius": 0,
"border_width": 1,
"h_align": "center",
},
),
"popup_progress": (
base: "popup",
properties: {
"padding": 4,
},
),
"stack_action": (
//base: "stack",
properties: {
//"min_height": 50,
"orientation": "Horizontal",
"spacing": 50,
},
),
"stack_progress": (
base: "container",
properties: {
"spacing": 10,
},
),
"ticket_data_form_label": (
base: "container_form",
properties: {
"padding": 1,
"h_align": "end",
"v_align": "center",
"margin": {
"left": 0,
"top": 0,
"right": 0,
"bottom": 0,
},
"min_size": 300,
"max_size": 400,
},
),
"ticket_data_form_input": (
base: "ticket_data_form_label",
properties: {
"h_align": "start",
},
),
"text_block_progress": (
base: "small_text",
properties: {
"background": "$PROGRESS_BAR_BACKGROUND",
},
),
}
)

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

View File

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

View File

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

View File

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 289 B

View File

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 126 B

View File

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 158 B

View File

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 351 B

View File

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 130 B

View File

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 193 B

View File

Before

Width:  |  Height:  |  Size: 452 B

After

Width:  |  Height:  |  Size: 452 B

View File

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,152 @@
<?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="105mm"
height="74mm"
viewBox="0 0 105 74"
version="1.1"
id="svg8"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
sodipodi:docname="Hiedemann_Logo.svg">
<title
id="title850">Hiedemann Rechtsanwälte</title>
<defs
id="defs2" />
<sodipodi:namedview
units="mm"
inkscape:snap-global="true"
inkscape:snap-grids="true"
inkscape:snap-nodes="true"
inkscape:window-maximized="1"
inkscape:window-y="27"
inkscape:window-x="0"
inkscape:window-height="1088"
inkscape:window-width="2048"
showgrid="false"
inkscape:document-rotation="0"
inkscape:current-layer="layer1"
inkscape:document-units="mm"
inkscape:cy="285.11146"
inkscape:cx="343.98278"
inkscape:zoom="1.4564683"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base" />
<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>Hiedemann Rechtsanwälte</dc:title>
<dc:creator>
<cc:Agent>
<dc:title>Hiedemann Rechtsanwälte</dc:title>
</cc:Agent>
</dc:creator>
<dc:publisher>
<cc:Agent>
<dc:title>Networkx GmbH</dc:title>
</cc:Agent>
</dc:publisher>
</cc:Work>
</rdf:RDF>
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:title>Hiedemann Rechtsanwälte</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
style="display:inline"
inkscape:label="Rahmen"
id="layer2"
inkscape:groupmode="layer" />
<g
style="display:inline"
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Logo">
<g
inkscape:export-ydpi="96"
inkscape:export-xdpi="96"
inkscape:export-filename="/data/development/advotracker/advotracker/resources/images/hiedemann_logo.png"
transform="matrix(0.5,0,0,0.5,26.483775,16.188821)"
id="g1005">
<g
id="g910"
style="display:inline"
transform="translate(-1.958558,18.772823)"
inkscape:export-filename="/data/development/advotracker/advotracker/resources/images/hiedemann_logo.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
ry="6.2927017"
rx="0.08973857"
y="1.2013354"
x="4.9724188"
height="24.806967"
width="99.907379"
id="rect852"
style="vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.0926207;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
<g
id="g1098"
transform="matrix(1.3250965,0,0,1.3250965,-38.983201,-118.19402)"
inkscape:export-filename="/data/development/advotracker/advotracker/resources/images/hiedemann_logo.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<text
transform="scale(0.95388348,1.0483461)"
id="text835"
y="108.37959"
x="36.210163"
style="font-size:8.71712px;line-height:125%;font-family:FreeSans;-inkscape-font-specification:'FreeSans, Normal';letter-spacing:2.60261px;word-spacing:0px;writing-mode:lr-tb;fill:#c46069;fill-opacity:1;stroke:#000000;stroke-width:0.363212px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8.71712px;font-family:'Cyntho Pro';-inkscape-font-specification:'Cyntho Pro, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#c46069;fill-opacity:1;stroke:none;stroke-width:0.363212px"
y="108.37959"
x="36.210163"
id="tspan833"
sodipodi:role="line">HIEDE<tspan
id="tspan889"
style="letter-spacing:1.31762px">M</tspan><tspan
id="tspan883"
style="letter-spacing:1.31762px;stroke-width:0.363212px">A</tspan>NN</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.58611px;line-height:125%;font-family:FreeSans;-inkscape-font-specification:'FreeSans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:3.43958px;word-spacing:0px;writing-mode:lr-tb;fill:#9d9b9b;fill-opacity:1;stroke:none;stroke-width:0.444725px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="40.402027"
y="104.09837"
id="text853"
transform="scale(0.86606999,1.1546411)"><tspan
sodipodi:role="line"
id="tspan851"
x="40.402027"
y="104.09837"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333px;font-family:'Cyntho Pro';-inkscape-font-specification:'Cyntho Pro';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#9d9b9b;fill-opacity:1;stroke:none;stroke-width:0.444725px"><tspan
id="tspan925"
style="letter-spacing:3.70417px">REC</tspan><tspan
style="letter-spacing:3.33375px"
id="tspan1083">HT</tspan><tspan
style="letter-spacing:2.92894px"
id="tspan1075">S</tspan><tspan
style="letter-spacing:3.23585px"
id="tspan1069">AN</tspan><tspan
id="tspan921"
style="letter-spacing:2.94746px">WÄLTE</tspan></tspan></text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 768 B

After

Width:  |  Height:  |  Size: 768 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 455 KiB

After

Width:  |  Height:  |  Size: 455 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 237 KiB

After

Width:  |  Height:  |  Size: 237 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -0,0 +1,43 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use std::error::Error;
use twine::build_translations;
fn set_winres() -> Result<(), Box<dyn Error>> {
use winres::WindowsResource;
//use winapi::{shared::windef::MAKELANGID, um::winuser::LANG_GERMAN};
if cfg!(target_os="windows") {
println!("cargo: build windows resources");
cfg!(target_env="gnu");
let mut res = WindowsResource::new();
res.set_icon("assets/icons/advotracker/advotracker.ico");
// .set_language(MAKELANGID(LANG_GERMAN));
// winapi::um::winnt::MAKELANGID(
// winapi::um::winnt::LANG_ENGLISH,
// winapi::um::winnt::SUBLANG_ENGLISH_US);
//res.set("InternalName", "ADVOTRACKER.EXE")
// manually set version 0.1.8.0
//.set_version_info(VersionInfo::PRODUCTVERSION, 0x0000000100080000);
res.compile()?;
}
Ok(())
}
fn main() -> Result<(), Box<dyn Error>> {
println!("cargo: rerun-if-changed=build.rs");
build_translations(&["./src/i18n/localization.ini"], "i18n.rs").unwrap();
if cfg!(target_os="windows") {
set_winres()?;
}
Ok(())
}

View File

@@ -0,0 +1,23 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use std::error::Error;
use twine::build_translations;
//#[cfg(windows)]
use windres::Build;
fn main() -> Result<(), Box<dyn Error>> {
println!("cargo: rerun-if-changed=build.rs");
build_translations(&["./src/i18n/localization.ini"], "i18n.rs").unwrap();
println!("cargo: compile windows ressource");
//#[cfg(windows)]
Build::new().compile("advotracker.rc").unwrap();
Ok(())
}

View File

@@ -0,0 +1,59 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use cfg_if::cfg_if;
use std::error::Error;
use twine::build_translations;
#[cfg(target_os="windows")]
use winres::{VersionInfo, WindowsResource};
#[cfg(target_os="windows")]
use winapi;
//cfg_if! {
// if #[cfg(windows)] {
fn set_winres() -> Result<(), Box<dyn Error>> {
println!("cargo: build windows resources");
cfg!(target_env="gnu");
let mut res = WindowsResource::new();
//res.set_icon("assets/icons/advotracker/advotracker.ico")
res.set_icon("icon.ico")
// needs winapi feature "winnt"
.set_language(
winapi::um::winnt::MAKELANGID(
winapi::um::winnt::LANG_GERMAN
)
// winapi::um::winnt::MAKELANGID(
// winapi::um::winnt::LANG_ENGLISH,
// winapi::um::winnt::SUBLANG_ENGLISH_US
);
//res.set_icon("advotracker.ico")
//res.set("InternalName", "ADVOTRACKER.EXE")
// manually set version 0.1.8.0
//.set_version_info(VersionInfo::PRODUCTVERSION, 0x0000000100080000);
res.compile()?;
Ok(())
}
// }
//}
fn main() -> Result<(), Box<dyn Error>> {
println!("cargo: rerun-if-changed=build.rs");
build_translations(&["./src/i18n/localization.ini"], "i18n.rs").unwrap();
println!("Target-OS: windows!");
set_winres()?;
// cfg_if! {
// if #[cfg(windows)] {
// println!("Target-OS: windows!");
// set_winres()?;
// }
// }
Ok(())
}

View File

@@ -0,0 +1,5 @@
[target.x86_64-pc-windows-msvc]
linker = "/path/to/msvc-wine-rust/linker-scripts/linkx64.sh"
[target.i686-pc-windows-msvc]
linker = "/path/to/msvc-wine-rust/linker-scripts/linkx32.sh"

View File

@@ -7,11 +7,10 @@
// use orbtk::prelude::*; // use orbtk::prelude::*;
// /* // /* * WidgetContainer = entity */
// * WidgetContainer = entity // associated functions: get, get_mut, try_get, try_get_mut and clone
// */ // ctx.widget() returns a WidgetContainer object, that wraps
// // methods get, get_mut, try_get, try_get_mut and clone // the current state of that widget (i.e properties)
// // ctx.widget returns a WidgetContainer that wraps the current widget of the state
// let mut widget_container: WidgetContainer = ctx.widget(); // let mut widget_container: WidgetContainer = ctx.widget();
// // property handling (componets) // // property handling (componets)
@@ -23,7 +22,6 @@
// // .set<PropertyType>("property_name", property_value); // // .set<PropertyType>("property_name", property_value);
// widget_container.set::<String16>("text", "my_text"); // widget_container.set::<String16>("text", "my_text");
// /* // /*
// * Child WidgetContainer = child entity // * Child WidgetContainer = child entity
// */ // */
@@ -48,11 +46,9 @@
// // set child field attributes // // set child field attributes
// text_box.set_text("My new text"); // text_box.set_text("My new text");
// /* // /*
// * Registry handling // * Registry handling
// */ // */
// // register service // // register service
// fn update(registry: &mut Registry, _: &mut Context) { // fn update(registry: &mut Registry, _: &mut Context) {
// registry.register("my_db_serve", MyDBServie::new()); // registry.register("my_db_serve", MyDBServie::new());
@@ -62,11 +58,9 @@
// let mut my_db_service: MyDBSerivce = registry.get_mut("my_db_service"); // let mut my_db_service: MyDBSerivce = registry.get_mut("my_db_service");
// } // }
// API Update: access properties of widgets in states // API Update: access properties of widgets in states
// Old style // Old style (associated functions)
// let text = *button(&mut ctx.widget()).text(); // let text = *button(&mut ctx.widget()).text();
// let text = Button::get(&mut ctx.widget()).text(); // let text = Button::get(&mut ctx.widget()).text();
// let text = *button(&mut ctx.widget()).clone_text(); // let text = *button(&mut ctx.widget()).clone_text();
@@ -76,7 +70,7 @@
// button(&mut ctx.widget()).set_text(String16::from("test")); // button(&mut ctx.widget()).set_text(String16::from("test"));
// Button::get(&mut ctx.widget()).set_text(String16::from("test")); // Button::get(&mut ctx.widget()).set_text(String16::from("test"));
// Current style // Current style (trait functions)
// let text = Button::text_clone(&ctx.widget()); // let text = Button::text_clone(&ctx.widget());
// Button::text_mut(&mut ctx.widget()).push_str("test"); // Button::text_mut(&mut ctx.widget()).push_str("test");
// Button::text_set(&mut ctx.widget(), String16::from("test")); // Button::text_set(&mut ctx.widget(), String16::from("test"));
@@ -85,5 +79,4 @@
// or // or
// ctx.get_widget(self.text_block).set("offset", offset); // ctx.get_widget(self.text_block).set("offset", offset);
fn main() {} fn main() {}

View File

@@ -8,25 +8,25 @@
// suppress creation of a new console window on window // suppress creation of a new console window on window
#![windows_subsystem = "windows"] #![windows_subsystem = "windows"]
use cfg_if::cfg_if;
use locales::t; use locales::t;
use orbtk::{ use orbtk::{
prelude::*, prelude::*,
theme_default::{THEME_DEFAULT, THEME_DEFAULT_COLORS_DARK, THEME_DEFAULT_FONTS}, theme_default::{THEME_DEFAULT, THEME_DEFAULT_COLORS_DARK, THEME_DEFAULT_FONTS},
theming::config::ThemeConfig, theming::config::ThemeConfig,
}; };
use cfg_if::cfg_if;
use serde::Deserialize; use serde::Deserialize;
use std::env; use std::env;
use std::time::SystemTime; use std::time::SystemTime;
use tracing::{Level, info, trace}; use tracing::{info, trace, Level};
use advotracker::{ use advotracker::{
data::{constants::*, structures::Email}, data::{constants::*, structures::Email},
widgets::global_state::GlobalState, widgets::global_state::GlobalState,
widgets::main_view,
//services::exports::send_ticketdata::sendticketdata, //services::exports::send_ticketdata::sendticketdata,
widgets::policycheck::*, widgets::policycheck::*,
widgets::policycheck_state::*, widgets::policycheck_state::*,
widgets::main_view,
widgets::ticketdata::*, widgets::ticketdata::*,
}; };
@@ -36,7 +36,7 @@ use orbtk::theme_fluent::{THEME_FLUENT, THEME_FLUENT_COLORS_DARK, THEME_FLUENT_F
pub enum TicketdataAction { pub enum TicketdataAction {
ClearForm(), ClearForm(),
SendForm(), SendForm(),
UpdatePolicyCode(String) UpdatePolicyCode(String),
} }
// German localization file. // German localization file.
@@ -46,7 +46,7 @@ static ADVOTRACKER_DE_DE: &str = include_str!("../assets/advotracker/advotracker
fn get_lang() -> String { fn get_lang() -> String {
// get system environment // get system environment
let mut lang = env::var("LANG").unwrap_or_else(|_| "C".to_string()); let mut lang = env::var("LANG").unwrap_or_else(|_| "C".to_string());
lang = lang.substring(0,5).to_string(); // "de_DE.UTF-8" -> "de_DE" lang = lang.substring(0, 5).to_string(); // "de_DE.UTF-8" -> "de_DE"
info!("GUI-Language: preset to {:?}", lang); info!("GUI-Language: preset to {:?}", lang);
// return the active language // return the active language
@@ -92,7 +92,6 @@ cfg_if! {
// Main // Main
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
// initialize the tracing subsystem // initialize the tracing subsystem
// a drop in replacement for classical logging // a drop in replacement for classical logging
// reference: https://tokio.rs/blog/2019-08-tracing/ // reference: https://tokio.rs/blog/2019-08-tracing/
@@ -167,18 +166,13 @@ widget!(MainView {
policycheck_view: PolicyCheck policycheck_view: PolicyCheck
}); });
impl Template for MainView { impl Template for MainView {
fn template(self, _id: Entity, ctx: &mut BuildContext<'_>) -> Self { fn template(self, _id: Entity, ctx: &mut BuildContext<'_>) -> Self {
let ticketdata_view = TicketdataView::new() let ticketdata_view = TicketdataView::new().build(ctx);
.build(ctx);
let policycheck_view = PolicycheckView::new() let policycheck_view = PolicycheckView::new().target(ticketdata_view.0).build(ctx);
.target(ticketdata_view.0)
.build(ctx);
self.name("MainView") self.name("MainView").child(
.child(
TabWidget::new() TabWidget::new()
.tab(ID_POLICY_CHECK_VIEW, policycheck_view) .tab(ID_POLICY_CHECK_VIEW, policycheck_view)
.tab(ID_TICKET_DATA_VIEW, ticketdata_view) .tab(ID_TICKET_DATA_VIEW, ticketdata_view)
@@ -232,7 +226,7 @@ impl Template for TicketdataView {
TextBlock::new() TextBlock::new()
.margin((0, 9, 48, 0)) .margin((0, 9, 48, 0))
.text("©Networkx GmbH") .text("©Networkx GmbH")
.build(ctx) .build(ctx),
) )
.build(ctx), .build(ctx),
) )
@@ -263,7 +257,7 @@ impl Template for TicketdataView {
.push("auto") // Label .push("auto") // Label
.push(16) // Delimiter .push(16) // Delimiter
.push("*") // Data .push("*") // Data
.push(32) // Delimiter (2x margin) .push(32), // Delimiter (2x margin)
) )
.rows( .rows(
Rows::create() Rows::create()
@@ -280,7 +274,7 @@ impl Template for TicketdataView {
.push("auto") // Row 10 .push("auto") // Row 10
.push(14) // Seperator .push(14) // Seperator
.push("auto") // Row 12 .push("auto") // Row 12
.push(14) // Seperator .push(14), // Seperator
) )
.child( .child(
TextBlock::new() TextBlock::new()
@@ -470,10 +464,7 @@ impl Template for TicketdataView {
let items_mail_to_count = items_mail_to.len(); let items_mail_to_count = items_mail_to.len();
// vector with valid carbon copy recipients addresses (mail_to) // vector with valid carbon copy recipients addresses (mail_to)
let items_mail_cc = vec![ let items_mail_cc = vec![PROP_MAIL_CC_1, PROP_MAIL_CC_2];
PROP_MAIL_CC_1,
PROP_MAIL_CC_2,
];
let items_mail_cc_count = items_mail_cc.len(); let items_mail_cc_count = items_mail_cc.len();
let ticket_data_form_mail = Container::new() let ticket_data_form_mail = Container::new()
@@ -490,14 +481,14 @@ impl Template for TicketdataView {
.push("stretch") // Label .push("stretch") // Label
.push(16) // Delimiter .push(16) // Delimiter
.push("auto") // MailAddress .push("auto") // MailAddress
.push("32") // Delimiter (2x margin) .push("32"), // Delimiter (2x margin)
) )
.rows( .rows(
Rows::create() Rows::create()
.push("auto") // Row 0 .push("auto") // Row 0
.push(2) // Seperator .push(2) // Seperator
.push("auto") // Row 2 .push("auto") // Row 2
.push(2) // Seperator .push(2), // Seperator
) )
.child( .child(
TextBlock::new() TextBlock::new()
@@ -517,7 +508,9 @@ impl Template for TicketdataView {
.style(STYLE_MAIL_TO) .style(STYLE_MAIL_TO)
.count(items_mail_to_count) .count(items_mail_to_count)
.items_builder(move |ibc, index| { .items_builder(move |ibc, index| {
let text_mail_to = TicketdataView::items_mail_to_ref(&ibc.get_widget(id))[index].clone(); let text_mail_to =
TicketdataView::items_mail_to_ref(&ibc.get_widget(id))[index]
.clone();
TextBox::new() TextBox::new()
.text(text_mail_to) .text(text_mail_to)
.v_align("center") .v_align("center")
@@ -543,7 +536,9 @@ impl Template for TicketdataView {
.style(STYLE_MAIL_CC) .style(STYLE_MAIL_CC)
.count(items_mail_cc_count) .count(items_mail_cc_count)
.items_builder(move |ibc, index| { .items_builder(move |ibc, index| {
let text_mail_cc = TicketdataView::items_mail_cc_ref(&ibc.get_widget(id))[index].clone(); let text_mail_cc =
TicketdataView::items_mail_cc_ref(&ibc.get_widget(id))[index]
.clone();
TextBox::new() TextBox::new()
.text(text_mail_cc) .text(text_mail_cc)
.v_align("center") .v_align("center")
@@ -584,7 +579,7 @@ impl Template for TicketdataView {
Columns::create() Columns::create()
.push(50) // Left margin .push(50) // Left margin
.push("*") // Content .push("*") // Content
.push(50) // Right margin .push(50), // Right margin
) )
.rows( .rows(
Rows::create() Rows::create()
@@ -592,9 +587,8 @@ impl Template for TicketdataView {
.push("auto") // Mail_Form .push("auto") // Mail_Form
.push("*") // Input_Form .push("*") // Input_Form
.push("auto") // Action .push("auto") // Action
.push("auto") // Bottom_Bar .push("auto"), // Bottom_Bar
) )
.child(ticket_data_header_bar) // row 0 .child(ticket_data_header_bar) // row 0
.child(ticket_data_form_mail) // row 1 .child(ticket_data_form_mail) // row 1
.child(ticket_data_form) // row 2 .child(ticket_data_form) // row 2
@@ -613,14 +607,26 @@ impl TicketdataState {
/// Clear the text property of all children of the given form entity /// Clear the text property of all children of the given form entity
pub fn clear_form(entity: Entity, ctx: &mut Context<'_>) { pub fn clear_form(entity: Entity, ctx: &mut Context<'_>) {
if let Some(count) = ctx.get_widget(entity).children_count() { if let Some(count) = ctx.get_widget(entity).children_count() {
info!("Widget name: {:?}", ctx.get_widget(entity).get::<String>("name")); info!(
info!("Widget id: {:?}", ctx.get_widget(entity).get::<String>("id")); "Widget name: {:?}",
ctx.get_widget(entity).get::<String>("name")
);
info!(
"Widget id: {:?}",
ctx.get_widget(entity).get::<String>("id")
);
} }
// identify the form by its id // identify the form by its id
if let form_entity = ctx.child(ID_TICKET_DATA_GRID).entity() { if let form_entity = ctx.child(ID_TICKET_DATA_GRID).entity() {
info!("Form id: {:?}", ctx.get_widget(form_entity).get::<String>("id")); info!(
info!("Form node name: {:?}", ctx.get_widget(form_entity).get::<String>("name")); "Form id: {:?}",
ctx.get_widget(form_entity).get::<String>("id")
);
info!(
"Form node name: {:?}",
ctx.get_widget(form_entity).get::<String>("name")
);
// Loop through children // Loop through children
if let Some(count) = ctx.get_widget(form_entity).children_count() { if let Some(count) = ctx.get_widget(form_entity).children_count() {
@@ -633,7 +639,6 @@ impl TicketdataState {
} }
pub fn send_form(entity: Entity, ctx: &mut Context<'_>, lang: &str) { pub fn send_form(entity: Entity, ctx: &mut Context<'_>, lang: &str) {
// type conversion (String -> u64) // type conversion (String -> u64)
//let policy_code = ctx.child(ID_TICKET_DATA_POLICY_CODE).get::<String>("text").unwrap().parse::<u64>().unwrap(); //let policy_code = ctx.child(ID_TICKET_DATA_POLICY_CODE).get::<String>("text").unwrap().parse::<u64>().unwrap();
@@ -647,20 +652,40 @@ impl TicketdataState {
//mail_to: ctx.child(ID_TICKET_DATA_MAIL_TO).get::<String>("text").to_string(), //mail_to: ctx.child(ID_TICKET_DATA_MAIL_TO).get::<String>("text").to_string(),
// WIP: mail_cc -> selected index auslesen // WIP: mail_cc -> selected index auslesen
//mail_cc: ctx.child(ID_TICKET_DATA_MAIL_CC).get::<String>("text").to_string(), //mail_cc: ctx.child(ID_TICKET_DATA_MAIL_CC).get::<String>("text").to_string(),
mail_to: PROP_MAIL_TO_1.to_string(), mail_to: PROP_MAIL_TO_1.to_string(),
mail_cc: PROP_MAIL_CC_1.to_string(), mail_cc: PROP_MAIL_CC_1.to_string(),
mail_bcc: PROP_MAIL_BCC_1.to_string(), mail_bcc: PROP_MAIL_BCC_1.to_string(),
mail_from: PROP_MAIL_FROM.to_string(), mail_from: PROP_MAIL_FROM.to_string(),
mail_reply: PROP_MAIL_REPLY.to_string(), mail_reply: PROP_MAIL_REPLY.to_string(),
subject: PROP_MAIL_SUBJECT.to_string(), subject: PROP_MAIL_SUBJECT.to_string(),
policy_code: ctx.child(ID_TICKET_DATA_POLICY_CODE).get::<String>("text").to_string(), policy_code: ctx
policy_holder: ctx.child(ID_TICKET_DATA_POLICY_HOLDER).get::<String>("text").to_string(), .child(ID_TICKET_DATA_POLICY_CODE)
deductible: ctx.child(ID_TICKET_DATA_DEDUCTIBLE).get::<String>("text").to_string(), .get::<String>("text")
callback_number: ctx.child(ID_TICKET_DATA_CALLBACK_NUMBER).get::<String>("text").to_string(), .to_string(),
callback_date: ctx.child(ID_TICKET_DATA_CALLBACK_DATE).get::<String>("text").to_string(), policy_holder: ctx
harm_type: ctx.child(ID_TICKET_DATA_HARM_TYPE).get::<String>("text").to_string(), .child(ID_TICKET_DATA_POLICY_HOLDER)
ivr_comment: ctx.child(ID_TICKET_DATA_IVR_COMMENT).get::<String>("text").to_string(), .get::<String>("text")
.to_string(),
deductible: ctx
.child(ID_TICKET_DATA_DEDUCTIBLE)
.get::<String>("text")
.to_string(),
callback_number: ctx
.child(ID_TICKET_DATA_CALLBACK_NUMBER)
.get::<String>("text")
.to_string(),
callback_date: ctx
.child(ID_TICKET_DATA_CALLBACK_DATE)
.get::<String>("text")
.to_string(),
harm_type: ctx
.child(ID_TICKET_DATA_HARM_TYPE)
.get::<String>("text")
.to_string(),
ivr_comment: ctx
.child(ID_TICKET_DATA_IVR_COMMENT)
.get::<String>("text")
.to_string(),
}; };
info!("WIP: Sending form to construct eMail to {:?}", email); info!("WIP: Sending form to construct eMail to {:?}", email);
@@ -673,7 +698,7 @@ impl TicketdataState {
impl State for TicketdataState { impl State for TicketdataState {
/// Initialize the state of widgets inside `TicketState` /// Initialize the state of widgets inside `TicketState`
fn init(&mut self, _: &mut Registry, ctx: &mut Context<'_>) { fn init(&mut self, _: &mut Registry, ctx: &mut Context<'_>) {
let time_start= SystemTime::now(); let time_start = SystemTime::now();
trace!(target: "advotracker", ticketdata_state = "init", status = "started"); trace!(target: "advotracker", ticketdata_state = "init", status = "started");
@@ -682,8 +707,11 @@ impl State for TicketdataState {
.entity_of_child(ID_TICKET_DATA_BUTTON_MENU) .entity_of_child(ID_TICKET_DATA_BUTTON_MENU)
.expect("TicketState.init: Can't find resource entity 'ID_TICKET_DATA_BUTTON_MENU'."); .expect("TicketState.init: Can't find resource entity 'ID_TICKET_DATA_BUTTON_MENU'.");
self.target = Entity::from(ctx.widget().try_clone::<u32>("target") self.target = Entity::from(
.expect("TicketState.init: Can't find resource entity 'target'.")); ctx.widget()
.try_clone::<u32>("target")
.expect("TicketState.init: Can't find resource entity 'target'."),
);
// Get language from environment // Get language from environment
self.lang = TicketdataState::get_lang(); self.lang = TicketdataState::get_lang();
@@ -710,7 +738,9 @@ impl State for TicketdataState {
info!("message: {:?} recieved", message); info!("message: {:?} recieved", message);
TicketdataState::send_form(ctx.entity(), ctx, &self.lang); TicketdataState::send_form(ctx.entity(), ctx, &self.lang);
} }
_ => { println!("messages: action not implemented!"); } _ => {
println!("messages: action not implemented!");
}
} }
} }
for message in messages.read::<PolicycheckAction>() { for message in messages.read::<PolicycheckAction>() {
@@ -719,7 +749,9 @@ impl State for TicketdataState {
info!("Message received: 'PolicycheckAction::UpdatePolicyCode'"); info!("Message received: 'PolicycheckAction::UpdatePolicyCode'");
TextBlock::text_set(&mut ctx.child(ID_TICKET_DATA_POLICY_CODE), policy_code); TextBlock::text_set(&mut ctx.child(ID_TICKET_DATA_POLICY_CODE), policy_code);
} }
_ => { println!("messages: action not implemented!"); } _ => {
println!("messages: action not implemented!");
}
} }
} }
} }
@@ -737,13 +769,14 @@ impl State for TicketdataState {
//ctx.send_message(TicketdataAction::SendForm(), self.ID_TICKETDATA_FORM); //ctx.send_message(TicketdataAction::SendForm(), self.ID_TICKETDATA_FORM);
info!("update: send_message {:?}", action); info!("update: send_message {:?}", action);
} }
_ => { println!("TicketdataAction: action not implemented!"); } _ => {
println!("TicketdataAction: action not implemented!");
}
} }
} }
} }
} }
/// send ticket data via eMail /// send ticket data via eMail
pub fn sendticketdata(email: &Email, lang: &str) -> Result<(), Box<dyn Error>> { pub fn sendticketdata(email: &Email, lang: &str) -> Result<(), Box<dyn Error>> {
let mut res = t!("sendticketdata.export.started", lang); let mut res = t!("sendticketdata.export.started", lang);
@@ -751,13 +784,27 @@ pub fn sendticketdata(email: &Email, lang: &str) -> Result<(), Box<dyn Error>> {
trace!(target: "sendticketdata", process = ?res, state = ?state); trace!(target: "sendticketdata", process = ?res, state = ?state);
let ascii_body = String::new() let ascii_body = String::new()
+ &"Vers.-Schein/Schadennummer".to_string() + &(email.policy_code) + &"\n" + &"Vers.-Schein/Schadennummer".to_string()
+ &"Versicherungsnehmer: ".to_string() + &(email.policy_holder) + &"\n" + &(email.policy_code)
+ &"Selbstbehalt: ".to_string() + &(email.deductible) + &"\n" + &"\n"
+ &"Rückrufnummer: ".to_string()+ &(email.callback_number) + &"\n" + &"Versicherungsnehmer: ".to_string()
+ &"Erreichbarkeit: ".to_string() + &(email.callback_date) + &"\n" + &(email.policy_holder)
+ &"Rechtsproblem: ".to_string() + &(email.harm_type) + &"\n" + &"\n"
+ &"Rechtsrat: ".to_string() + &(email.ivr_comment) + &"\n"; + &"Selbstbehalt: ".to_string()
+ &(email.deductible)
+ &"\n"
+ &"Rückrufnummer: ".to_string()
+ &(email.callback_number)
+ &"\n"
+ &"Erreichbarkeit: ".to_string()
+ &(email.callback_date)
+ &"\n"
+ &"Rechtsproblem: ".to_string()
+ &(email.harm_type)
+ &"\n"
+ &"Rechtsrat: ".to_string()
+ &(email.ivr_comment)
+ &"\n";
info!("email body: {:?}", ascii_body); info!("email body: {:?}", ascii_body);
@@ -770,11 +817,12 @@ pub fn sendticketdata(email: &Email, lang: &str) -> Result<(), Box<dyn Error>> {
//.cc((email.mail_cc).parse().unwrap()) //.cc((email.mail_cc).parse().unwrap())
//.bcc((email.mail_bcc).parse().unwrap()) //.bcc((email.mail_bcc).parse().unwrap())
.from((email.mail_from).parse().unwrap()) .from((email.mail_from).parse().unwrap())
.subject(String::new() .subject(
String::new()
+ &email.subject.to_string() + &email.subject.to_string()
+ &" (".to_string() + &" (".to_string()
+ &email.policy_code.to_string() + &email.policy_code.to_string()
+ &")".to_string() + &")".to_string(),
) )
.multipart( .multipart(
MultiPart::alternative() // This is composed of two parts. MultiPart::alternative() // This is composed of two parts.
@@ -784,11 +832,10 @@ pub fn sendticketdata(email: &Email, lang: &str) -> Result<(), Box<dyn Error>> {
"text/plain; charset=utf8".parse().unwrap(), "text/plain; charset=utf8".parse().unwrap(),
)) ))
.body(String::from(ascii_body)), .body(String::from(ascii_body)),
) ),
) )
.expect("failed to build email"); .expect("failed to build email");
info!("message: {:?}", message); info!("message: {:?}", message);
trace!(target: "sendticketdata", email = ?email); trace!(target: "sendticketdata", email = ?email);

View File

@@ -1,11 +1,11 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use chrono::{Local, DateTime}; use chrono::{DateTime, Local};
use locales::t; use locales::t;
//use serde::{Deserialize, Serialize}; //use serde::{Deserialize, Serialize};
use serde::Deserialize; use serde::Deserialize;
@@ -17,7 +17,7 @@ use std::{
}; };
use tracing::{debug, trace, Level}; use tracing::{debug, trace, Level};
use advotracker::data::structures::{PolicyCode, PolicyList, PolicyDataList, PolicyData}; use advotracker::data::structures::{PolicyCode, PolicyData, PolicyDataList, PolicyList};
// include modules // include modules
mod parse_args; mod parse_args;
@@ -77,12 +77,15 @@ fn export(p: &mut String, lang: &String) -> Result<u64, Box<dyn Error>> {
/// import from csv format /// import from csv format
/// https://docs.rs/csv/1.1.3/csv/cookbook/index.html /// https://docs.rs/csv/1.1.3/csv/cookbook/index.html
/// https://blog.burntsushi.net/csv/ /// https://blog.burntsushi.net/csv/
fn import(p: &mut String, data_list: &mut PolicyDataList, fn import(
policy_numbers: &mut HashMap<u64, PolicyCode>, lang: &String) p: &mut String,
-> Result<u64, Box<dyn Error>> { data_list: &mut PolicyDataList,
policy_numbers: &mut HashMap<u64, PolicyCode>,
lang: &String,
) -> Result<u64, Box<dyn Error>> {
use std::ffi::OsStr;
use std::fs::File; use std::fs::File;
use std::path::Path; use std::path::Path;
use std::ffi::OsStr;
let mut res = t!("csv.import.started", lang); let mut res = t!("csv.import.started", lang);
let mut state = t!("state.started", lang); let mut state = t!("state.started", lang);
@@ -142,7 +145,7 @@ fn import(p: &mut String, data_list: &mut PolicyDataList,
// push record as new vector elements // push record as new vector elements
data_list.push(record); data_list.push(record);
count +=1; count += 1;
} }
let dt_end: DateTime<Local> = Local::now(); let dt_end: DateTime<Local> = Local::now();
@@ -163,10 +166,12 @@ fn import(p: &mut String, data_list: &mut PolicyDataList,
#[allow(dead_code)] #[allow(dead_code)]
/// validate a given policy number /// validate a given policy number
/// result will return true or false /// result will return true or false
fn is_valid(policy_number: &u64, policy_list: &PolicyDataList, fn is_valid(
policy_numbers: &mut HashMap<u64, PolicyCode>, lang: &String) policy_number: &u64,
-> Result<bool, Box<dyn std::error::Error>> { policy_list: &PolicyDataList,
policy_numbers: &mut HashMap<u64, PolicyCode>,
lang: &String,
) -> Result<bool, Box<dyn std::error::Error>> {
let mut res = t!("policy.validation.started", lang); let mut res = t!("policy.validation.started", lang);
let mut state = t!("state.started", lang); let mut state = t!("state.started", lang);
let dt_start: DateTime<Local> = Local::now(); let dt_start: DateTime<Local> = Local::now();
@@ -186,7 +191,6 @@ fn is_valid(policy_number: &u64, policy_list: &PolicyDataList,
// println!("policy_list: {:?} (with {:?} elements)", // println!("policy_list: {:?} (with {:?} elements)",
// policy_list.name, policy_list.policy_data.len()); // policy_list.name, policy_list.policy_data.len());
// policy_list.into_iter() // policy_list.into_iter()
// .filter(|num| matches(w, w1)) // .filter(|num| matches(w, w1))
// .clone // .clone
@@ -230,14 +234,13 @@ fn is_valid(policy_number: &u64, policy_list: &PolicyDataList,
match policy_numbers.get(&policy_number) { match policy_numbers.get(&policy_number) {
Some(&policy_code) => { Some(&policy_code) => {
let res = t!("policy.validation.success", lang); let res = t!("policy.validation.success", lang);
println!("policy_number: {} ({:?})", println!("policy_number: {} ({:?})", policy_number, policy_code);
policy_number, policy_code);
result = true; result = true;
trace!(target: "csv-test", trace!(target: "csv-test",
policy_number = ?policy_number, policy_number = ?policy_number,
validation = ?res, validation = ?res,
policy_code = ?policy_code); policy_code = ?policy_code);
}, }
_ => { _ => {
let res = t!("policy.validation.failed", lang); let res = t!("policy.validation.failed", lang);
//println!("Noop! Number isn't valid!"); //println!("Noop! Number isn't valid!");
@@ -245,9 +248,8 @@ fn is_valid(policy_number: &u64, policy_list: &PolicyDataList,
trace!(target: "csv-test", trace!(target: "csv-test",
policy_number = ?policy_number, policy_number = ?policy_number,
validation = ?res); validation = ?res);
},
} }
}
let dt_end: DateTime<Local> = Local::now(); let dt_end: DateTime<Local> = Local::now();
let duration = dt_end.signed_duration_since(dt_start); let duration = dt_end.signed_duration_since(dt_start);
@@ -296,9 +298,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenv().ok(); dotenv().ok();
match envy::from_env::<Environment>() { match envy::from_env::<Environment>() {
Ok(environment) => { Ok(environment) => {
if environment.test_lang != lang { lang = environment.test_lang; } if environment.test_lang != lang {
}, lang = environment.test_lang;
Err(e) => { debug!(target: "csv-test", "{}", e); } }
}
Err(e) => {
debug!(target: "csv-test", "{}", e);
}
} }
// how to handle unumplemented lang resources?? // how to handle unumplemented lang resources??
res = t!("parse.environment", lang); res = t!("parse.environment", lang);
@@ -331,11 +337,15 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut policy_data = PolicyDataList::new("Allianz-Import 20200628"); let mut policy_data = PolicyDataList::new("Allianz-Import 20200628");
println!("Policy Data List {:?} ", policy_data.name); println!("Policy Data List {:?} ", policy_data.name);
let mut policy_numbers : HashMap<u64, PolicyCode> = HashMap::new(); let mut policy_numbers: HashMap<u64, PolicyCode> = HashMap::new();
let mut csv_import_path = v.get::<String>("import_file").unwrap(); let mut csv_import_path = v.get::<String>("import_file").unwrap();
match import(&mut csv_import_path, &mut policy_data, match import(
&mut policy_numbers, &lang) { &mut csv_import_path,
&mut policy_data,
&mut policy_numbers,
&lang,
) {
Ok(count) => { Ok(count) => {
println!("Imported {:?} records", count); println!("Imported {:?} records", count);
} }
@@ -347,7 +357,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// test if policy_number is_valid // test if policy_number is_valid
// type conversion (viperus String -> u64) // type conversion (viperus String -> u64)
let test_policy_number = v.get::<String>("test_policy_number").unwrap().parse::<u64>().unwrap(); let test_policy_number = v
.get::<String>("test_policy_number")
.unwrap()
.parse::<u64>()
.unwrap();
trace!(target: "csv-test", test_policy_number = ?test_policy_number); trace!(target: "csv-test", test_policy_number = ?test_policy_number);
//match is_valid(&policy_number, &policy_data, &mut policy_numbers, &lang) { //match is_valid(&policy_number, &policy_data, &mut policy_numbers, &lang) {
// Ok(true) => { // Ok(true) => {
@@ -356,14 +370,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Some(&policy_code) => { Some(&policy_code) => {
let res = t!("policy.validation.success", lang); let res = t!("policy.validation.success", lang);
println!("{:?}", res); println!("{:?}", res);
println!("policy_number: {} ({:?})", println!("policy_number: {} ({:?})", test_policy_number, policy_code);
test_policy_number, policy_code);
} }
_ => { _ => {
let res = t!("policy.validation.failed", lang); let res = t!("policy.validation.failed", lang);
println!("{:?}", res); println!("{:?}", res);
//println!("Nuup! Number isn't valid!"); //println!("Nuup! Number isn't valid!");
}, }
} }
// export policy code elements to csv-file // export policy code elements to csv-file
@@ -389,21 +402,26 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
#[test] #[test]
fn test_policy_number() { fn test_policy_number() {
// Takes a reference and returns Option<&V> // Takes a reference and returns Option<&V>
let my_policy_numbers : [u64; 2] = [1511111111, 9999999993]; let my_policy_numbers: [u64; 2] = [1511111111, 9999999993];
assert_eq!(my_policy_numbers, [1511111111, 9999999993]); assert_eq!(my_policy_numbers, [1511111111, 9999999993]);
//let mut csv_import_path = v.get::<String>("import_file").unwrap(); //let mut csv_import_path = v.get::<String>("import_file").unwrap();
let mut csv_import_path = String::from("data/POLLFNR_TEST.txt"); let mut csv_import_path = String::from("data/POLLFNR_TEST.txt");
let mut policy_data = PolicyDataList::new("PolicyDataList"); let mut policy_data = PolicyDataList::new("PolicyDataList");
let mut policy_numbers : HashMap<u64, PolicyCode> = HashMap::new(); let mut policy_numbers: HashMap<u64, PolicyCode> = HashMap::new();
let lang = "en".to_string(); let lang = "en".to_string();
println!("import with Path: {:?} PolicyData: {:?} PolicyNumbers: {:?}, Lang: {:?}", println!(
csv_import_path, policy_data, policy_numbers, lang); "import with Path: {:?} PolicyData: {:?} PolicyNumbers: {:?}, Lang: {:?}",
let count = import(&mut csv_import_path, &mut policy_data, csv_import_path, policy_data, policy_numbers, lang
&mut policy_numbers, &lang); );
let count = import(
&mut csv_import_path,
&mut policy_data,
&mut policy_numbers,
&lang,
);
assert_eq!(count.unwrap(), 15498); assert_eq!(count.unwrap(), 15498);
} }

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
// parse CLI commandline arguments with clap // parse CLI commandline arguments with clap
@@ -26,24 +26,31 @@ pub fn parse_args(v: &mut Viperus) -> Result<(), Box<dyn std::error::Error>> {
v.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt")); v.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt"));
v.add_default("export_file", String::from("")); v.add_default("export_file", String::from(""));
v.add_default("test_policy_number", String::from("9999999992")); v.add_default("test_policy_number", String::from("9999999992"));
v.add_default("to_email_address_file", String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>")); v.add_default(
v.add_default("from_email_address_file", String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>")); "to_email_address_file",
String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>"),
);
v.add_default(
"from_email_address_file",
String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>"),
);
//v.add_default("username", String::from("nctalkbot")); //v.add_default("username", String::from("nctalkbot"));
//v.add_default("password", String::from("botpassword")); //v.add_default("password", String::from("botpassword"));
v.add_default("verbose", 0); v.add_default("verbose", 0);
// CLI arguments are defined inline // CLI arguments are defined inline
let matches = App::new("csv-test") let matches = App::new("csv-test")
.name(crate_name!()) .name(crate_name!())
.version(crate_version!()) .version(crate_version!())
.author(crate_authors!()) .author(crate_authors!())
.about(crate_description!()) .about(crate_description!())
.after_help(" .after_help(
"
Testprogramm: Allianz Online-Beratung Im/Export CSV-Daten Testprogramm: Allianz Online-Beratung Im/Export CSV-Daten
Direct-Call via IVR-System (Interactive Voice Response) Direct-Call via IVR-System (Interactive Voice Response)
SMR Deckungssummen-Prüfung: 089 92529 60211 SMR Deckungssummen-Prüfung: 089 92529 60211
SMR Unerledigt: 089 92529 60222") SMR Unerledigt: 089 92529 60222",
)
.template( .template(
"\ "\
{bin} v{version} {bin} v{version}

View File

@@ -1,7 +1,11 @@
use lettre::{ // SPDX-License-Identifier: (0BSD or MIT)
transport::smtp::authentication::Credentials, /*
Message, SmtpTransport, Transport, * advotracker - Hotline tackingtool for Advocats
};
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
*/
use lettre::{transport::smtp::authentication::Credentials, Message, SmtpTransport, Transport};
fn main() { fn main() {
let email = Message::builder() let email = Message::builder()
@@ -14,7 +18,10 @@ fn main() {
// Create credential for remote authentication (username, password) // Create credential for remote authentication (username, password)
//let creds = Credentials::new("ralf.zerres@networkx.de".to_string(), "dekifjgh".to_string()); //let creds = Credentials::new("ralf.zerres@networkx.de".to_string(), "dekifjgh".to_string());
let creds = Credentials::new("ralf.zerres.de@gmail.com".to_string(), "20jacara03".to_string()); let creds = Credentials::new(
"ralf.zerres.de@gmail.com".to_string(),
"20jacara03".to_string(),
);
// Open a remote connection to relay server // Open a remote connection to relay server
//let mailer = SmtpTransport::relay("nwxex.networkx.de") //let mailer = SmtpTransport::relay("nwxex.networkx.de")

View File

@@ -8,7 +8,7 @@ static ID_CHECK_POLICY_NUMBER: &'static str = "ID_CHECK_POLICY_NUMBER";
static ID_PROGRESS_BAR: &'static str = "ID_PROGRESS_BAR"; static ID_PROGRESS_BAR: &'static str = "ID_PROGRESS_BAR";
enum Action { enum Action {
ParsePolicyNumber ParsePolicyNumber,
} }
#[derive(Default, AsAny)] #[derive(Default, AsAny)]
@@ -16,15 +16,18 @@ struct MainViewState {
action: Option<Action>, action: Option<Action>,
progress_bar: Entity, progress_bar: Entity,
text_box: Entity, text_box: Entity,
progress_counter: f64 progress_counter: f64, //records: HashMap::<String, String>,
//records: HashMap::<String, String>,
//record_counter: u64 //record_counter: u64
} }
impl State for MainViewState { impl State for MainViewState {
fn init(&mut self, _: &mut Registry, ctx: &mut Context) { fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
self.text_box = ctx.entity_of_child(ID_CHECK_POLICY_NUMBER).expect("Cannot get TextBox!"); self.text_box = ctx
self.progress_bar = ctx.entity_of_child(ID_PROGRESS_BAR).expect("Cannot get progress bar !"); .entity_of_child(ID_CHECK_POLICY_NUMBER)
.expect("Cannot get TextBox!");
self.progress_bar = ctx
.entity_of_child(ID_PROGRESS_BAR)
.expect("Cannot get progress bar !");
} }
fn update(&mut self, _: &mut Registry, ctx: &mut Context) { fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
@@ -32,7 +35,10 @@ impl State for MainViewState {
if let Some(action) = &self.action { if let Some(action) = &self.action {
match action { match action {
Action::ParsePolicyNumber => { Action::ParsePolicyNumber => {
let value_to_parse = ctx.get_widget(self.text_box).get::<String16>("text").clone(); let value_to_parse = ctx
.get_widget(self.text_box)
.get::<String16>("text")
.clone();
self.parse_policy_number(value_to_parse, ctx); self.parse_policy_number(value_to_parse, ctx);
} }
} }
@@ -81,9 +87,7 @@ widget!(MainView<MainViewState>);
impl Template for MainView { impl Template for MainView {
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self { fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
self self.margin(32.0).child(
.margin(32.0)
.child(
Stack::new() Stack::new()
.orientation("vertical") .orientation("vertical")
.h_align("center") .h_align("center")
@@ -95,16 +99,14 @@ impl Template for MainView {
.water_mark("Mut value and type <Return>") .water_mark("Mut value and type <Return>")
.on_activate(move |states, _entity| { .on_activate(move |states, _entity| {
// you have to fire a new event to be able to get in the update() with access to Context // you have to fire a new event to be able to get in the update() with access to Context
states.get_mut::<MainViewState>(id).action(Action::ParsePolicyNumber); states
.get_mut::<MainViewState>(id)
.action(Action::ParsePolicyNumber);
}) })
.build(ctx) .build(ctx),
) )
.child( .child(ProgressBar::new().id(ID_PROGRESS_BAR).build(ctx))
ProgressBar::new() .build(ctx),
.id(ID_PROGRESS_BAR)
.build(ctx)
)
.build(ctx)
) )
} }
} }

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* OrbTK - The Orbital Widget Toolkit * OrbTK - The Orbital Widget Toolkit
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;

View File

@@ -1,16 +1,13 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* OrbTK - The Orbital Widget Toolkit * OrbTK - The Orbital Widget Toolkit
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
use crate::{ use crate::{receiver::receiver_view::ReceiverView, sender::sender_view::SenderView};
receiver::receiver_view::ReceiverView,
sender::sender_view::SenderView,
};
// constants // constants
pub static ID_SENDER_VIEW: &str = "sender_view"; pub static ID_SENDER_VIEW: &str = "sender_view";
@@ -23,20 +20,18 @@ widget!(MainView {
impl Template for MainView { impl Template for MainView {
fn template(self, _id: Entity, ctx: &mut BuildContext<'_>) -> Self { fn template(self, _id: Entity, ctx: &mut BuildContext<'_>) -> Self {
let receiver_view = ReceiverView::new() let receiver_view = ReceiverView::new().build(ctx);
.build(ctx);
let sender_view = SenderView::new() let sender_view = SenderView::new()
.target(receiver_view.0) // entity of the target .target(receiver_view.0) // entity of the target
.build(ctx); .build(ctx);
self.name("MainView") self.name("MainView").child(
.child(
Stack::new() Stack::new()
.orientation("vertical") .orientation("vertical")
.child(sender_view) .child(sender_view)
.child(receiver_view) .child(receiver_view)
.build(ctx) .build(ctx),
) )
// .child( // .child(
// TabWidget::new() // TabWidget::new()

View File

@@ -0,0 +1,15 @@
// SPDX-License-Identifier: (0BSD or MIT)
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
*/
// The starting point (Main View).
pub mod main_view;
/// Receiver widget
pub mod receiver;
/// Sender widget.
pub mod sender;

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: (0BSD or MIT)
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
*/
/// The reciever state
pub mod receiver_state;
/// The receiver view
pub mod receiver_view;

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* OrbTK - The Orbital Widget Toolkit * OrbTK - The Orbital Widget Toolkit
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
@@ -13,7 +13,7 @@ use crate::sender::sender_state::{SenderAction, SenderState};
/// state changes for the `SenderView` widget. /// state changes for the `SenderView` widget.
pub enum TestMessageAction { pub enum TestMessageAction {
// Toggle visibility of a message TextBox. // Toggle visibility of a message TextBox.
ToggleMessageBox ToggleMessageBox,
} }
/// Valid `structure members` of the `ReceiverState` used to react on /// Valid `structure members` of the `ReceiverState` used to react on
@@ -21,7 +21,7 @@ pub enum TestMessageAction {
#[derive(Default, AsAny)] #[derive(Default, AsAny)]
pub struct ReceiverState { pub struct ReceiverState {
message_box: Option<Entity>, message_box: Option<Entity>,
progress_bar: Entity progress_bar: Entity,
} }
/// Method definitions, we provide inside the `ReceiverState`. /// Method definitions, we provide inside the `ReceiverState`.
@@ -38,7 +38,8 @@ impl ReceiverState {
impl State for ReceiverState { impl State for ReceiverState {
// initialize the view entities // initialize the view entities
fn init(&mut self, _: &mut Registry, ctx: &mut Context) { fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
self.progress_bar = ctx.entity_of_child("progress_bar") self.progress_bar = ctx
.entity_of_child("progress_bar")
.expect("Cannot find ProgressBar!"); .expect("Cannot find ProgressBar!");
} }
@@ -47,7 +48,7 @@ impl State for ReceiverState {
&mut self, &mut self,
mut messages: MessageReader, mut messages: MessageReader,
_registry: &mut Registry, _registry: &mut Registry,
ctx: &mut Context ctx: &mut Context,
) { ) {
for message in messages.read::<SenderAction>() { for message in messages.read::<SenderAction>() {
match message { match message {

View File

@@ -1,37 +1,32 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* OrbTK - The Orbital Widget Toolkit * OrbTK - The Orbital Widget Toolkit
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
use crate::receiver::receiver_state::{TestMessageAction, ReceiverState}; use crate::receiver::receiver_state::{ReceiverState, TestMessageAction};
widget!(ReceiverView<ReceiverState>); widget!(ReceiverView<ReceiverState>);
impl Template for ReceiverView { impl Template for ReceiverView {
fn template(self, _id: Entity, bc: &mut BuildContext) -> Self { fn template(self, _id: Entity, bc: &mut BuildContext) -> Self {
self.name("ReceiverView") self.name("ReceiverView").child(
.child(
Stack::new() Stack::new()
.orientation("vertical") .orientation("vertical")
.spacing(16) .spacing(16)
.child( .child(ProgressBar::new().id("progress_bar").build(bc))
ProgressBar::new()
.id("progress_bar")
.build(bc)
)
.child( .child(
TextBox::new() TextBox::new()
.id("message_box") .id("message_box")
.h_align("center") .h_align("center")
.text("message received. Box toggled!") .text("message received. Box toggled!")
.visibility("hidden") .visibility("hidden")
.build(bc) .build(bc),
) )
.build(bc) .build(bc),
) )
} }
} }

View File

@@ -0,0 +1,12 @@
/*
* OrbTK - The Orbital Widget Toolkit
*
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
/// The sender state
pub mod sender_state;
/// The sender view
pub mod sender_view;

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* OrbTK - The Orbital Widget Toolkit * OrbTK - The Orbital Widget Toolkit
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
@@ -21,7 +21,7 @@ pub struct SenderState {
// actions // actions
actions: Vec<SenderAction>, actions: Vec<SenderAction>,
// entity that will receive the message // entity that will receive the message
target: Entity target: Entity,
} }
/// Method definitions, we provide inside the `SenderState`. /// Method definitions, we provide inside the `SenderState`.
@@ -38,8 +38,11 @@ impl State for SenderState {
// initialize the view entities // initialize the view entities
fn init(&mut self, _registry: &mut Registry, ctx: &mut Context) { fn init(&mut self, _registry: &mut Registry, ctx: &mut Context) {
// create the target entity, that receives the Sender messages // create the target entity, that receives the Sender messages
self.target = Entity::from(ctx.widget().try_clone::<u32>("target") self.target = Entity::from(
.expect("ERROR: SenderState::init(): target entity not found!")); ctx.widget()
.try_clone::<u32>("target")
.expect("ERROR: SenderState::init(): target entity not found!"),
);
} }
// update entities, before we render the view // update entities, before we render the view

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* OrbTK - The Orbital Widget Toolkit * OrbTK - The Orbital Widget Toolkit
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
@@ -16,8 +16,7 @@ widget!(SenderView<SenderState> {
impl Template for SenderView { impl Template for SenderView {
fn template(self, id: Entity, bc: &mut BuildContext) -> Self { fn template(self, id: Entity, bc: &mut BuildContext) -> Self {
self.name("SenderView") self.name("SenderView").child(
.child(
Button::new() Button::new()
.text("Click me to send a message!") .text("Click me to send a message!")
.v_align("center") .v_align("center")
@@ -28,7 +27,7 @@ impl Template for SenderView {
//ctx.send_message(TestMessageAction::ToggleMessageBox, id); //ctx.send_message(TestMessageAction::ToggleMessageBox, id);
false false
}) })
.build(bc) .build(bc),
) )
} }
} }

View File

@@ -13,8 +13,7 @@ widget!(SenderWidget<SenderState> {
impl Template for SenderWidget { impl Template for SenderWidget {
fn template(self, id: Entity, bc: &mut BuildContext) -> Self { fn template(self, id: Entity, bc: &mut BuildContext) -> Self {
self.name("SenderWidget") self.name("SenderWidget").child(
.child(
Button::new() Button::new()
.text("Click me to send a message!") .text("Click me to send a message!")
.v_align("center") .v_align("center")
@@ -23,7 +22,7 @@ impl Template for SenderWidget {
states.get_mut::<SenderState>(id).send_message(); states.get_mut::<SenderState>(id).send_message();
false false
}) })
.build(bc) .build(bc),
) )
} }
} }
@@ -31,13 +30,13 @@ impl Template for SenderWidget {
// States // States
enum Action { enum Action {
UpdateProgress(f64) UpdateProgress(f64),
} }
#[derive(Default, AsAny)] #[derive(Default, AsAny)]
struct SenderState { struct SenderState {
actions: Vec<Action>, actions: Vec<Action>,
target: Entity target: Entity,
} }
impl SenderState { impl SenderState {
@@ -48,8 +47,11 @@ impl SenderState {
impl State for SenderState { impl State for SenderState {
fn init(&mut self, _: &mut Registry, ctx: &mut Context) { fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
self.target = Entity::from(ctx.widget().try_clone::<u32>("target") self.target = Entity::from(
.expect("ERROR: SenderState::init(): target entity not found!")); ctx.widget()
.try_clone::<u32>("target")
.expect("ERROR: SenderState::init(): target entity not found!"),
);
} }
fn update(&mut self, _: &mut Registry, ctx: &mut Context) { fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
@@ -77,11 +79,7 @@ widget!(ReceiverWidget<ReceiverState>);
impl Template for ReceiverWidget { impl Template for ReceiverWidget {
fn template(self, _id: Entity, bc: &mut BuildContext) -> Self { fn template(self, _id: Entity, bc: &mut BuildContext) -> Self {
self.name("ReceiverWidget") self.name("ReceiverWidget")
.child( .child(ProgressBar::new().id("progress_bar").build(bc))
ProgressBar::new()
.id("progress_bar")
.build(bc)
)
} }
} }
@@ -89,15 +87,22 @@ impl Template for ReceiverWidget {
#[derive(Default, AsAny)] #[derive(Default, AsAny)]
struct ReceiverState { struct ReceiverState {
progress_bar: Entity progress_bar: Entity,
} }
impl State for ReceiverState { impl State for ReceiverState {
fn init(&mut self, _: &mut Registry, ctx: &mut Context) { fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
self.progress_bar = ctx.entity_of_child("progress_bar").expect("Cannot find ProgressBar!"); self.progress_bar = ctx
.entity_of_child("progress_bar")
.expect("Cannot find ProgressBar!");
} }
fn messages(&mut self, mut messages: MessageReader, _registry: &mut Registry, ctx: &mut Context) { fn messages(
&mut self,
mut messages: MessageReader,
_registry: &mut Registry,
ctx: &mut Context,
) {
for action in messages.read::<Action>() { for action in messages.read::<Action>() {
match action { match action {
Action::UpdateProgress(amount) => { Action::UpdateProgress(amount) => {
@@ -135,7 +140,7 @@ pub fn main() {
.orientation("vertical") .orientation("vertical")
.child(sender) .child(sender)
.child(receiver) .child(receiver)
.build(ctx) .build(ctx),
) )
.build(ctx) .build(ctx)
}) })

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;

Some files were not shown because too many files have changed in this diff Show More