Compare commits
284 Commits
no-locales
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b5e222318 | |||
| ba76d87785 | |||
| e68be43861 | |||
| 1343018e2d | |||
| cc4a7045ca | |||
| c8f6a6d272 | |||
| c1a4547261 | |||
| ff3362e92e | |||
| ceb1c429ff | |||
| 4ba5f1325d | |||
| 3ebf44e8fe | |||
| 2a001a67d8 | |||
| 9d11661299 | |||
| 6f8cd04e5b | |||
| ef0fce5021 | |||
| a0e9e14e3f | |||
| 90869c8305 | |||
| 05f6e13dae | |||
| d0035ecebb | |||
| 9b6b128e59 | |||
| 541e516099 | |||
| dc463df476 | |||
| 5a21958325 | |||
| e06545aa92 | |||
| 9837ae0d0d | |||
| b0b90c3d6b | |||
| 473c31d9ea | |||
| a5981b31a1 | |||
| f7a0a97f34 | |||
| 78be428e7d | |||
| 9ed395d04b | |||
| dd5d361116 | |||
| 4a316b8080 | |||
| 067257e0dd | |||
| 60a7fc2d84 | |||
| cff156c024 | |||
| 78851ebbcf | |||
| f6ac43816f | |||
| 2b4eb454cc | |||
| abe56741e8 | |||
| 0202d4a34b | |||
| 520e0cb712 | |||
| c555ce4d85 | |||
| a8f6ac6a37 | |||
| 8abdef6e44 | |||
| a5dae6e397 | |||
| e03c5ab667 | |||
| d8e94513c3 | |||
| 5a9965751a | |||
| 4c88167bef | |||
| 1ce1d029e5 | |||
| 2e927c8a6a | |||
| f3db69ce62 | |||
| 55040e37cf | |||
| ba3a6fb4d3 | |||
| 8184af8135 | |||
| 87cbf493a2 | |||
| 4381c3d299 | |||
| 791b451d39 | |||
| aeaafd8c57 | |||
| 1af299dc01 | |||
| bd6971d4d0 | |||
| 85fb4ceb16 | |||
| a451b58ab4 | |||
| b96c3c510f | |||
| 2c903c67dd | |||
| a40f6e94dd | |||
| 8af49deb34 | |||
| 202ba81b4f | |||
| 43db004179 | |||
| 3b65dafbec | |||
| 23732350ca | |||
| 3c40055e2e | |||
| 6a61d2f878 | |||
| 044ad84598 | |||
| b2a9d9aa52 | |||
| 157da4228a | |||
| 26cf43bfae | |||
| a2314d4909 | |||
| 0dab2dddb3 | |||
| bb40033554 | |||
| a4a09bc37c | |||
| 9fba66d8a6 | |||
| 7d6476205f | |||
| 41ebf4168a | |||
| c4caf12706 | |||
| 075505eec9 | |||
| 59e7e71143 | |||
| 7440f7a6dd | |||
| a401379f9e | |||
| be9b8b1a1c | |||
| 70bd6b8b8d | |||
| 1f3c6a7fff | |||
| ef26a3bf65 | |||
| fa4914839e | |||
| 571243731d | |||
| b38a677b7b | |||
| 26cea8e844 | |||
| 48545d2879 | |||
| b352f2a581 | |||
| 89a6842106 | |||
| 76e6e7503f | |||
| 520b959302 | |||
| 7d459516d9 | |||
| c511bdd62f | |||
| 40f715a79a | |||
| 6ea1f95ef0 | |||
| 8986812038 | |||
| e0eb0c5c90 | |||
| a1541ae307 | |||
| c66335951f | |||
| d0e661d5d0 | |||
| 2253c2892b | |||
| 8cc9ba5782 | |||
| ef8b884efa | |||
| 6b7ae9d17d | |||
| f0e9014fb7 | |||
| 0ba99b3fb2 | |||
| f0d5f82549 | |||
| d2a188eee6 | |||
| e297c82b85 | |||
| f87ab8ce08 | |||
| 0c16237c6c | |||
| 777fff3776 | |||
| c949b5fe32 | |||
| 0afe1f3bf8 | |||
| bf54cb2242 | |||
| 5b79229c00 | |||
| 16a538a805 | |||
| a887ffef1f | |||
| 65c2da7706 | |||
| 0467f601f0 | |||
| 8a50e1ea78 | |||
| c54cca5f22 | |||
| bf638ac196 | |||
| 06e68adce6 | |||
| 645ea50350 | |||
| 13d56e2e05 | |||
| ef63f62734 | |||
| 5aff69c526 | |||
| 70e2e7f1e5 | |||
| 3697bc567a | |||
| ece95344bf | |||
| 69405aaa76 | |||
| cd82f62a82 | |||
| eb7a3608d7 | |||
| b6b12c45bb | |||
| 9b9afc2b5a | |||
| 094fb6d0ea | |||
| f983eca9aa | |||
| bceec88741 | |||
| daaa544e93 | |||
| 33da48b1b1 | |||
| 046812e04f | |||
| bd70ad653b | |||
| ac855d0a54 | |||
| b099064776 | |||
| 65bec5a4a1 | |||
| 276c0fb5f0 | |||
| 0f97202fbb | |||
| e91b91a2db | |||
| 25de70e75c | |||
| 9fffb093c3 | |||
| 11d12718e8 | |||
| 6e4ba029b7 | |||
| fd61f90277 | |||
| ffa8c18efb | |||
| 3d913e7127 | |||
| 8ca257bf5c | |||
| 6907c0c393 | |||
| 9e1a1e7359 | |||
| 16f174d53a | |||
| 4406efc955 | |||
| 20ddd78a8d | |||
| 863826a294 | |||
| 53d8f80b75 | |||
| 555a02fcc3 | |||
| 4d2427a058 | |||
| 5eeb80cdd4 | |||
| aa26e6634d | |||
| 19ad9198d0 | |||
| e62fb8e990 | |||
| d3d3be1442 | |||
| b579d039f1 | |||
| c5334ac898 | |||
| 224606d72e | |||
| 4e0b8166f2 | |||
| 193f2de7ea | |||
| e2ced73db9 | |||
| 09ec027e79 | |||
| 656ffae9bf | |||
| 9753c37477 | |||
| f503fc9713 | |||
| 8564aaaf8d | |||
| 947e79eea4 | |||
| a9f7c62e3d | |||
| c0d8e7a898 | |||
| 7a82640fd6 | |||
| f9453ee18c | |||
| f9dd2e3797 | |||
| ea57346119 | |||
| e7ef33ee40 | |||
| 5a5bbb5d5e | |||
| e8c7d78de3 | |||
| bf0ee18f55 | |||
| b709c90682 | |||
| 32405504a7 | |||
| 891919b64d | |||
| 40896c6b8e | |||
| 9beeaa7190 | |||
| 7e604f050a | |||
| ebaf05132f | |||
| ce7f802d3a | |||
| d7da1335b1 | |||
| d6703e8df6 | |||
| 24b9b08566 | |||
| 274a96b908 | |||
| 65e0ce3319 | |||
| 77d41f733e | |||
| 18588ce75f | |||
| d5788b9848 | |||
| e853975c86 | |||
| bc161878b3 | |||
| d0c7a16ac7 | |||
| 5745a3bd6c | |||
| 7196013bb2 | |||
| 1aebd4338f | |||
| 6f668bf4c3 | |||
| 97622ba5f5 | |||
| 533ae6f8d2 | |||
| 23c1875272 | |||
| 02d388c14f | |||
| 016595d702 | |||
| 8506b0ce90 | |||
| 74fc662a67 | |||
| 4f3a63425a | |||
| 42dcd82df2 | |||
| 82c1aab492 | |||
| cf375770c1 | |||
| da24fea764 | |||
| 321b868bb8 | |||
| 5f4d01d919 | |||
| 8f7be15ef3 | |||
| cddb47b3ad | |||
| 56aa6ac72c | |||
| bde94bcce1 | |||
| 8a1f92e44d | |||
| 267680f547 | |||
| ea4bcaabd6 | |||
| 268207318d | |||
| 5dc3fa1509 | |||
| d57827ca4e | |||
| 97a5a966d3 | |||
| 5016cb6b47 | |||
| 84e7a86bb3 | |||
| b7e6d269dc | |||
| 0582c1be43 | |||
| 507f13ade3 | |||
| 2bc37f6a24 | |||
| 985cee4f0b | |||
| 267c4faa2c | |||
| 22ecaaa0fe | |||
| 9c2beabd33 | |||
| 53702555a3 | |||
| c3e939c6bb | |||
| dd8c840cf9 | |||
| 9e65ef198a | |||
| 6a7d9a39d1 | |||
| 3b889d24e6 | |||
| a6b6f84fec | |||
| de99076e53 | |||
| 8a8941f0cf | |||
| 29b3876264 | |||
| 62c786b671 | |||
| 717dc9ba03 | |||
| d4ae415ece | |||
| 9354ea29ab | |||
| 7600f1b8df | |||
| f3af573bd7 | |||
| e93c19aacc | |||
| 930d916e3f | |||
| 2159cc0c24 | |||
| 36e90081b5 | |||
| a59d364b62 |
17
.gitignore
vendored
@@ -1,10 +1,21 @@
|
||||
# This file should only ignore things that are generated during a build,
|
||||
# generated by common IDEs, and optional files controlled by the user that
|
||||
# affect the build (such as config.toml).
|
||||
|
||||
# Backup files created from Editors
|
||||
.#*
|
||||
.DS_Store
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
**/*~
|
||||
/target/
|
||||
|
||||
# user adaptions and configs values
|
||||
/config.toml
|
||||
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
|
||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||
Cargo.lock
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
***.rs.bk
|
||||
15
.gitmodules
vendored
@@ -1,6 +1,9 @@
|
||||
[submodule "database"]
|
||||
path = database
|
||||
url = ./database/
|
||||
[submodule "backend"]
|
||||
path = backend
|
||||
url = ./backend/
|
||||
[submodule "advotrackerdb"]
|
||||
path = advotrackerdb
|
||||
url = https://gitea.networkx.de:50443/rzerres/advotrackerdb
|
||||
[submodule "advotrackerd"]
|
||||
path = advotrackerd
|
||||
url = https://gitea.networkx.de:50443/rzerres/advotrackerd
|
||||
[submodule "advotracker_db"]
|
||||
path = advotracker_db
|
||||
url = https://gitea.networkx.de:50443/rzerres/advotracker_db
|
||||
|
||||
48
Cargo.toml
@@ -3,15 +3,44 @@ name = "advotracker"
|
||||
version = "0.1.0"
|
||||
authors = ["Ralf Zerres <ralf.zerres@networkx.de>"]
|
||||
description = "Supports lawyers to capture relevant data encountered during an online legal advice\n"
|
||||
repository = "https://github.com/rzerres/advotracker"
|
||||
homepage = "https://github.com/rzerres/advotracker"
|
||||
repository = "https://gitea.networkx.de:50443/rzerres/advotracker"
|
||||
homepage = "https://gitea.networkx.de:50443/rzerres/advotracker"
|
||||
documentation = "https://docs.rs/advotracker"
|
||||
readme = "README.md"
|
||||
license = "0BSD OR MIT"
|
||||
keywords = [
|
||||
"advotracker",
|
||||
"lawyer",
|
||||
]
|
||||
edition = "2018"
|
||||
publish = false
|
||||
#default-run = "advotracker_client"
|
||||
|
||||
[dependencies]
|
||||
advotracker_db = { version = "0.1.0-alpha1", path = "advotracker_db" }
|
||||
advotrackerd = { version = "0.1.0-alpha1", path = "advotrackerd", default-features = false }
|
||||
advotracker_client = { version = "0.1.8", path = "advotracker_client", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["sqlite"]
|
||||
|
||||
# enable optional db backends
|
||||
sqlite = []
|
||||
#sqlite = ["advotracker_db_sqlite"]
|
||||
#postgresql = ["advotracker_db_pstgresql"]
|
||||
|
||||
[profile.dev]
|
||||
#opt-level = 0
|
||||
opt-level = 1
|
||||
incremental = true
|
||||
debug = true
|
||||
lto = false
|
||||
codegen-units = 5
|
||||
panic = 'unwind'
|
||||
overflow-checks = true
|
||||
|
||||
[profile.release]
|
||||
incremental = true
|
||||
panic = "abort"
|
||||
lto = true
|
||||
codegen-units=1
|
||||
@@ -21,15 +50,6 @@ opt-level="s"
|
||||
# optimize to smallest size
|
||||
#opt-level = "z"
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 0
|
||||
debug = true
|
||||
lto = false
|
||||
codegen-units = 5
|
||||
panic = 'unwind'
|
||||
incremental = true
|
||||
overflow-checks = true
|
||||
|
||||
[profile.test]
|
||||
opt-level = 0
|
||||
debug = 2
|
||||
@@ -43,7 +63,7 @@ overflow-checks = true
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"backend",
|
||||
"frontend",
|
||||
"advotracker_qml",
|
||||
"advotrackerd",
|
||||
"advotracker_db",
|
||||
"advotracker_client",
|
||||
]
|
||||
|
||||
147
README.md
@@ -1,24 +1,145 @@
|
||||
<!-- AdvoTracker.markdown -->
|
||||
<!-- version: 1.1 -->
|
||||
<!-- AdvoTracker README.md -->
|
||||
<!-- version: 0.1.3 -->
|
||||
|
||||
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-generate-toc again -->
|
||||
<!-- markdown-toc end -->
|
||||
|
||||
# AdvoTracker - Hotline tool für Advokaten #
|
||||
## About
|
||||
|
||||
AdvoTracker unterstützt Anwälte bei der Erfassung von Mandatsdaten zu einer Online-Beratung.
|
||||
`advotracker` supports lawyers to capture relevant data encountered during an online
|
||||
legal advice.
|
||||
|
||||
Das Tool wurde als multi-Pattform Anwendung konzipiert.
|
||||
The application components are implemented using the programming language *Rust*.
|
||||
The graphical user interface (GUI) uses the class-lib *OrbTk*, which is natively
|
||||
encoded in *Rust* as well.
|
||||
|
||||
Als Programmiersprache wird *Rust* verwendet. Die Implementierung der
|
||||
GUI Elemente erfolgt mit der Klassenbibliothek *OrbTk*.
|
||||
`advotracker` can be deployed on every target operating system that is officialy
|
||||
supported by the `OrbTK` toolkit. Currently included are:
|
||||
|
||||
Als Dokumentationsquellen wird auf die offiziellen Projektseiten [Rust Book][^1] und [OrbTk][^2] verwiesen.
|
||||
* macOS
|
||||
* Linux
|
||||
* openBSD
|
||||
* Redox OS
|
||||
* Web-Browser
|
||||
* Windows
|
||||
|
||||
# Internationalisierung #
|
||||
Porting to and in activ development are:
|
||||
|
||||
In allen Dialogen und Meldungen erfolgt die Ausgabe entsprechend der Sprache, die als
|
||||
aktive Sprache in der Umgebungsvariable definiert ist (default: LANG = en_US.UTF8 ) ausgewählt.
|
||||
* Android
|
||||
* iOS
|
||||
* ubuntu Touch
|
||||
|
||||
Reference is made to the official project pages of [Rust Book][^1] and [OrbTk][^2]
|
||||
as documentation sources.
|
||||
|
||||
## Internationalization
|
||||
|
||||
Dialogs and messages generated inside the application will respect the system language
|
||||
of the active user. This is adaptable via the environment variable
|
||||
(default: LANG = en_US.UTF8 or LANG = C).
|
||||
|
||||
Within the source code you can find translated constants in the subdirectory 'locales'
|
||||
(<crate-root>/src/locales/advotracker.json).
|
||||
For every supported language-string, you will find a block starting with the
|
||||
generic message code, followed by the target language translation. Translation lines
|
||||
are identified by its ISO Code (e.g. de_DE.UTF8, es_ES.UTF8).
|
||||
|
||||
## Installation from source code
|
||||
|
||||
You can either download the `advotracker` source code as a Zip-File or using `git`
|
||||
from projects repositoy URL.
|
||||
|
||||
The source code is subdiveded in three crates:
|
||||
|
||||
* advotracker
|
||||
* advotrackerd
|
||||
* advotrackerdb
|
||||
|
||||
Currently the given WEB-URL certificate is signed by a Microsoft CA.
|
||||
Since this CA can't be verified from offical CA-lists you have to proceed as follows:
|
||||
|
||||
```sh
|
||||
$ cd <your_path>
|
||||
$ git -c http.https://gitea.networkx.de:50443.sslverify=false \
|
||||
clone --recurse-submodules --jobs=10 \
|
||||
https://gitea.networkx.de:50443/rzerres/advotracker
|
||||
```
|
||||
To compile the target binary code, you have to use rusts toolchain.
|
||||
If this isn't already installed on your development system, please go ahead
|
||||
and either use the official supported installation tool from the rust communtiy
|
||||
([rustup][^3]). As an alternitiv, you can download and install the compiler package
|
||||
using your systems package manager.
|
||||
|
||||
### native operating system binaries
|
||||
|
||||
A binary compatible with your target operating system will be compiled
|
||||
with the following command:
|
||||
|
||||
```sh
|
||||
$ cd <advotracker_root>
|
||||
$ cargo build --release
|
||||
```
|
||||
|
||||
The toolchain also allows to cross-compile for other operating systems. Please
|
||||
consult the rust documentation for further instructions.
|
||||
|
||||
### web-browser application
|
||||
|
||||
- **Prerequisits**
|
||||
|
||||
To run as a browser, electron or cordova app, you have to install cargo-node:
|
||||
|
||||
```sh
|
||||
cargo install -f cargo-node
|
||||
```
|
||||
|
||||
cargo-node will require a working version of `npm` (>=v6.9.0).
|
||||
You may download [Node.js][^4], which includes npm as well.
|
||||
|
||||
- **Start as browser app**
|
||||
|
||||
You can run `Advotracker` as a web-browser app with the following call.
|
||||
Once the app is running, you can connect to it opening the given URL
|
||||
in you Web-Browser.
|
||||
|
||||
```sh
|
||||
cargo node run --target browser --bin advotracker
|
||||
```
|
||||
|
||||
- **Start as electron app**
|
||||
|
||||
```sh
|
||||
cargo node run --target electron advotracker
|
||||
```
|
||||
|
||||
- **Start as android app**
|
||||
|
||||
```sh
|
||||
cargo node run --target android --bin advotracker
|
||||
```
|
||||
|
||||
## Build and run documentation
|
||||
|
||||
You can build and view the latest documentation by executing the following command:
|
||||
|
||||
```sh
|
||||
cargo doc --no-deps --open
|
||||
```
|
||||
This will render the web-pages, collecting the documentation paragraphs in the
|
||||
source-code. When finished, it will open a new tab in your web browser
|
||||
presenting the documentation.
|
||||
|
||||
## Installation
|
||||
|
||||
To install the compiled binary you can use rust package manager `cargo` as well.
|
||||
|
||||
```sh
|
||||
cd <advotracker_root>
|
||||
$ cargo install
|
||||
```
|
||||
|
||||
In addition, you will need to copy the resource folder into your target directory.
|
||||
This will provide the access to used fonts, images und stylesheets.
|
||||
|
||||
---
|
||||
|
||||
@@ -28,7 +149,7 @@ This work is licensed under a [Creative Common License 4.0][License-CC_BY]
|
||||
|
||||
![Creative Common Logo][Logo-CC_BY]
|
||||
|
||||
© 2020 Ralf Zerres, Networkx GmbH
|
||||
<EFBFBD> 2020-2021 Ralf Zerres, Networkx GmbH
|
||||
|
||||
---
|
||||
|
||||
@@ -36,3 +157,5 @@ Foodnotes
|
||||
|
||||
[^1]: Rust Book: https://doc.rust-lang.org/book/
|
||||
[^2]: OrbTK GUI: https://gitlab.redox-os.org/redox-os/orbtk
|
||||
[^3]: Rustup: https://rustup.rs/
|
||||
[^4]: Node.js: https://nodejs.org/dist/v10.16.3/
|
||||
|
||||
6
advotracker_client/.cargo/config
Normal 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"
|
||||
17
advotracker_client/.env
Normal file
@@ -0,0 +1,17 @@
|
||||
###
|
||||
# .env
|
||||
# will overwrite standard environment viariables
|
||||
###
|
||||
# set the language variable used in test-runs
|
||||
#test LANG=de-DE
|
||||
#test LANG=es-ES
|
||||
#test LANG=C
|
||||
# set the language variable (overwriting standard Enviroment)
|
||||
#TEST_LANG=de_DE
|
||||
#TEST_LANG=C
|
||||
#RUST_LOG=advotracker=trace
|
||||
#LANG=de_DE
|
||||
RUST_LOG=trace
|
||||
#RUST_LOG=none
|
||||
USERNAME=hiedemann
|
||||
DB_DRIVER=sqlite
|
||||
16
advotracker_client/.env-bak
Normal file
@@ -0,0 +1,16 @@
|
||||
###
|
||||
# .env
|
||||
# will overwrite standard environment viariables
|
||||
###
|
||||
# set the language variable used in test-runs
|
||||
#test LANG=es-ES
|
||||
#test LANG=it-IT
|
||||
#test LANG=C
|
||||
# set the language variable (overwriting standard Enviroment)
|
||||
#TEST_LANG=de_DE
|
||||
#TEST_LANG=C
|
||||
#RUST_LOG=advotracker=trace
|
||||
RUST_LOG=trace
|
||||
#RUST_LOG=none
|
||||
USERNAME=hiedemann
|
||||
DB_DRIVER=sqlite
|
||||
72
advotracker_client/Cargo.toml
Normal 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"
|
||||
8
advotracker_client/Node.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[[apps]]
|
||||
name = "advotracker"
|
||||
width = 580
|
||||
height = 280
|
||||
assets = "resources/advotracker"
|
||||
[[apps.fonts]]
|
||||
font_family = "MaterialIcons-Regular"
|
||||
src = "resources/fonts/MaterialIcons.ttf"
|
||||
1
advotracker_client/POLLFNR_WOECHENTLICH.txt
Symbolic link
@@ -0,0 +1 @@
|
||||
POLLFNR_WOECHENTLICH_test.txt
|
||||
1
advotracker_client/POLLFNR_WOECHENTLICH_full.txt
Symbolic link
@@ -0,0 +1 @@
|
||||
data/POLLFNR_WOECHENTLICH.txt
|
||||
1
advotracker_client/POLLFNR_WOECHENTLICH_test.txt
Symbolic link
@@ -0,0 +1 @@
|
||||
data/POLLFNR_TEST.txt
|
||||
1
advotracker_client/RA-Hiedemann_DirectCall.txt
Normal file
@@ -0,0 +1 @@
|
||||
Allianz DirectCall Protokoll!
|
||||
38
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.
|
||||
BIN
advotracker_client/SDL2.dll
Executable file
BIN
advotracker_client/advotracker.rcs
Normal file
61
advotracker_client/assets/advotracker/advotracker_de_DE.ron
Normal file
@@ -0,0 +1,61 @@
|
||||
// *
|
||||
// * advotracker - Hotline tackingtool for Advocats
|
||||
// *
|
||||
// * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
// * SPDX-License-Identifier: (0BSD or MIT)
|
||||
// */
|
||||
|
||||
// the language class
|
||||
Dictionary (
|
||||
// the map of active identifiers
|
||||
// like a struct, but keys are also values instead of just beenig identifiers
|
||||
words: {
|
||||
// policycheck_view
|
||||
"Check result": "Prüfungsergebnis",
|
||||
"Checklist elements: ": "Prüflistenelemente: ",
|
||||
"Clear": "Zurücksetzen",
|
||||
"Create ticket": "Ticket erstellen",
|
||||
"Importing data": "Importiere Datensätze",
|
||||
"Only numbers are valid": "Nur Nummern sind zulässig",
|
||||
"Error:": "Fehler:",
|
||||
"Quit": "Beenden",
|
||||
"Policy code": "Vers.-Schein/Schadennummer",
|
||||
"Policy holder": "Versicherungsnehmer",
|
||||
"Policy number is to long": "Die Nummer ist zu lang",
|
||||
"Policy number is to short": "Die Nummer ist zu kurz",
|
||||
"Policy number": "Versicherungsnummer",
|
||||
"Processing time": "Bearbeitungszeit",
|
||||
"Reason": "Grund",
|
||||
"The given policy number is invalid": "Die Versicherungsnummer ist ungültig",
|
||||
"The given policy number is valid": "Die Versicherungsnummer ist gültig",
|
||||
"Account": "Benutzer",
|
||||
"Toggle theme": "Thema wechseln",
|
||||
"Validation policy number": "Prüfung Versicherungsnummer",
|
||||
|
||||
// ticketdata_view
|
||||
"Callback number": "Rückrufnummer",
|
||||
"Callback date": "Erreichbarkeit",
|
||||
"Clear": "Zurücksetzen",
|
||||
"Deductible": "Selbstbehalt",
|
||||
"Harm type": "Rechtsproblem",
|
||||
"IVR comment": "Rechtsrat",
|
||||
"Policy holder": "Versicherungsnehmer",
|
||||
"Recipient (To)": "Empfänger (To)",
|
||||
"Copie (CC)": "Kopie (CC)",
|
||||
"Send": "Senden",
|
||||
|
||||
// localization view
|
||||
"English": "Englisch",
|
||||
"German": "Deutsch",
|
||||
"Language ID": "Sprache ID",
|
||||
"Localization dialog": "Lokalisierungs-Dialog",
|
||||
|
||||
// configuration view
|
||||
"Configuration settings": "Konfigurationseinstellungen",
|
||||
"Configuration file": "Konfigurationsdatei",
|
||||
"Default theme": "Standard-Thema",
|
||||
"Language Id": "Sprach-Id",
|
||||
"Load": "Laden",
|
||||
"Save": "Speichern",
|
||||
}
|
||||
)
|
||||
179
advotracker_client/assets/advotracker/default_dark.ron
Normal 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",
|
||||
},
|
||||
),
|
||||
}
|
||||
)
|
||||
10
advotracker_client/assets/advotracker/fluent_dark.ron
Normal file
@@ -0,0 +1,10 @@
|
||||
Theme (
|
||||
styles: {
|
||||
"container_form": (
|
||||
base: "container",
|
||||
properties: {
|
||||
"border": 1,
|
||||
},
|
||||
),
|
||||
}
|
||||
)
|
||||
179
advotracker_client/assets/advotracker/fluent_light.ron
Normal 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",
|
||||
},
|
||||
),
|
||||
}
|
||||
)
|
||||
BIN
advotracker_client/assets/advotracker/hiedemann_logo.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
BIN
advotracker_client/assets/fonts/CynthoPro-Regular.otf
Normal file
|
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 289 B |
|
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
|
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 158 B |
|
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 351 B |
|
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 130 B |
|
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 193 B |
|
Before Width: | Height: | Size: 452 B After Width: | Height: | Size: 452 B |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 223 B |
152
advotracker_client/assets/icons/advotracker/Hiedemann_Logo.svg
Normal 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 |
BIN
advotracker_client/assets/icons/advotracker/advotracker.ico
Normal file
|
After Width: | Height: | Size: 132 KiB |
BIN
advotracker_client/assets/icons/advotracker/hotline.ico
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
advotracker_client/assets/icons/advotracker/hotline.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
advotracker_client/assets/icons/advotracker/hotline_16.png
Normal file
|
After Width: | Height: | Size: 815 B |
BIN
advotracker_client/assets/icons/advotracker/hotline_32.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
advotracker_client/assets/icons/advotracker/hotline_48.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
advotracker_client/assets/icons/advotracker/hotline_64.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
advotracker_client/assets/icons/advotracker/icon.ico
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
advotracker_client/assets/icons/advotracker/test.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
152
advotracker_client/assets/images/Hiedemann_Logo.svg
Normal 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 |
143
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 |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 768 B After Width: | Height: | Size: 768 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 455 KiB After Width: | Height: | Size: 455 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
BIN
advotracker_client/assets/images/hiedemann_logo.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
BIN
advotracker_client/assets/images/networkx_logo.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 237 KiB After Width: | Height: | Size: 237 KiB |
BIN
advotracker_client/assets/images/orbtk_logo.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
advotracker_client/assets/images/rust_logo.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
43
advotracker_client/build.rs
Normal 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(())
|
||||
}
|
||||
23
advotracker_client/build.rs-windres
Normal 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(())
|
||||
}
|
||||
59
advotracker_client/build.rs-winres
Normal 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(())
|
||||
}
|
||||
5
advotracker_client/config
Normal 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"
|
||||
15498
advotracker_client/data/POLLFNR_TEST.txt
Normal file
2498330
advotracker_client/data/POLLFNR_WOECHENTLICH.txt
Normal file
49
advotracker_client/data/bench.txt
Normal file
@@ -0,0 +1,49 @@
|
||||
Target: debug
|
||||
[ralf@jacara-x1 frontend]$ time ../target/debug/examples/csv-import --importFile /home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt -v
|
||||
Jun 27 02:43:48.886 TRACE csv-import: "Umgebungsvariablen prüfen" state="gestartet"
|
||||
Jun 27 02:43:48.886 TRACE csv-import: environment="system" lang="de_DE.UTF-8"
|
||||
Jun 27 02:43:48.887 DEBUG csv-import: missing value for field test_lang
|
||||
Jun 27 02:43:48.887 TRACE csv-import: environment="envy" lang="de_DE.UTF-8"
|
||||
Jun 27 02:43:48.887 TRACE csv-import: "Umgebungsvariablen prüfen" state="beendet"
|
||||
Jun 27 02:43:48.887 TRACE csv-import: process="Programmargumente prüfen" state="gestartet"
|
||||
RUST_LOG=None
|
||||
Jun 27 02:43:48.887 TRACE csv_import::parse_args: verbose 1
|
||||
config_file: "csv_import.ron"
|
||||
import_file: "/home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt"
|
||||
verbosity level: 1
|
||||
Jun 27 02:43:48.887 TRACE csv-import: process="Programmargumente prüfen" state="beendet"
|
||||
Jun 27 02:43:48.887 TRACE csv-import: process="Programmlogik starten" state="gestartet"
|
||||
Jun 27 02:43:48.887 TRACE csv-import: extension=Some("txt") file=File { fd: 3, path: "/home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt", read: true, write: false }
|
||||
Jun 27 02:43:48.888 TRACE csv-import: header=StringRecord(["DION", "VERS", "POLLFNR"])
|
||||
Jun 27 02:43:57.513 TRACE csv-import: record_count=2498330
|
||||
Imported 2498330 records
|
||||
Jun 27 02:43:57.513 TRACE csv-import: process="Programmlogik beendet" state="beendet"
|
||||
|
||||
real 0m8,700s
|
||||
user 0m8,675s
|
||||
sys 0m0,017s
|
||||
|
||||
Target: release
|
||||
[ralf@jacara-x1 frontend]$ time ../target/release/examples/csv-import --importFile /home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt -v
|
||||
Jun 27 02:48:13.753 TRACE csv-import: "Umgebungsvariablen prüfen" state="gestartet"
|
||||
Jun 27 02:48:13.753 TRACE csv-import: environment="system" lang="de_DE.UTF-8"
|
||||
Jun 27 02:48:13.753 DEBUG csv-import: missing value for field test_lang
|
||||
Jun 27 02:48:13.753 TRACE csv-import: environment="envy" lang="de_DE.UTF-8"
|
||||
Jun 27 02:48:13.753 TRACE csv-import: "Umgebungsvariablen prüfen" state="beendet"
|
||||
Jun 27 02:48:13.753 TRACE csv-import: process="Programmargumente prüfen" state="gestartet"
|
||||
RUST_LOG=None
|
||||
Jun 27 02:48:13.753 TRACE csv_import::parse_args: verbose 1
|
||||
config_file: "csv_import.ron"
|
||||
import_file: "/home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt"
|
||||
verbosity level: 1
|
||||
Jun 27 02:48:13.753 TRACE csv-import: process="Programmargumente prüfen" state="beendet"
|
||||
Jun 27 02:48:13.753 TRACE csv-import: process="Programmlogik starten" state="gestartet"
|
||||
Jun 27 02:48:13.754 TRACE csv-import: extension=Some("txt") file=File { fd: 3, path: "/home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt", read: true, write: false }
|
||||
Jun 27 02:48:13.754 TRACE csv-import: header=StringRecord(["DION", "VERS", "POLLFNR"])
|
||||
Jun 27 02:48:14.098 TRACE csv-import: record_count=2498330
|
||||
Imported 2498330 records
|
||||
Jun 27 02:48:14.098 TRACE csv-import: process="Programmlogik beendet" state="beendet"
|
||||
|
||||
real 0m0,355s
|
||||
user 0m0,338s
|
||||
sys 0m0,017s
|
||||
7
advotracker_client/examples/.env
Normal file
@@ -0,0 +1,7 @@
|
||||
# set the language variable used in test-runs
|
||||
#test lang=it
|
||||
TEST_LANG=en
|
||||
#RUST_LOG=csv-import=trace
|
||||
LOG=debug
|
||||
USERNAME=ralf
|
||||
DB_DRIVER=sqlite
|
||||
@@ -11,6 +11,7 @@ enum Action {
|
||||
ValueChanged(Entity),
|
||||
IncrementCounter,
|
||||
RemoveItem,
|
||||
ToggleTheme(Entity),
|
||||
}
|
||||
|
||||
#[derive(AsAny)]
|
||||
@@ -31,64 +32,72 @@ impl MainViewState {
|
||||
}
|
||||
|
||||
impl State for MainViewState {
|
||||
fn update(&mut self, _: &mut Registry, ctx: &mut Context<'_>) {
|
||||
fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||
if let Some(action) = self.action {
|
||||
match action {
|
||||
Action::AddItem => {
|
||||
let len = ctx.widget().get::<List>("list").len();
|
||||
let len = main_view(ctx.widget()).list().len();
|
||||
|
||||
if len < 5 {
|
||||
ctx.widget()
|
||||
.get_mut::<List>("list")
|
||||
main_view(ctx.widget())
|
||||
.list_mut()
|
||||
.push(format!("Item {}", len + 1));
|
||||
ctx.child("items").set("count", len + 1);
|
||||
ctx.child("remove-item-button").set("enabled", true);
|
||||
ctx.child("items").clone_or_default::<usize>("Item");
|
||||
items_widget(ctx.child("items")).set_count(len + 1);
|
||||
button(ctx.child("remove-item-button")).set_enabled(true);
|
||||
button(ctx.child("remove-item-button")).set_visibility(Visibility::Visible);
|
||||
|
||||
if len == 4 {
|
||||
ctx.child("add-item-button").set("enabled", false);
|
||||
button(ctx.child("add-item-button")).set_enabled(false);
|
||||
button(ctx.child("add-item-button"))
|
||||
.set_visibility(Visibility::Collapsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
Action::RemoveItem => {
|
||||
let len = ctx.widget().get::<List>("list").len();
|
||||
let len = main_view(ctx.widget()).list().len();
|
||||
if len > 0 {
|
||||
ctx.widget().get_mut::<List>("list").remove(len - 1);
|
||||
ctx.child("items").set("count", len - 1);
|
||||
ctx.child("add-item-button").set("enabled", true);
|
||||
main_view(ctx.widget()).list_mut().remove(len - 1);
|
||||
items_widget(ctx.child("items")).set_count(len - 1);
|
||||
button(ctx.child("add-item-button")).set_enabled(true);
|
||||
button(ctx.child("add-item-button")).set_visibility(Visibility::Visible);
|
||||
|
||||
if len == 1 {
|
||||
ctx.child("remove-item-button").set("enabled", false);
|
||||
button(ctx.child("remove-item-button")).set_enabled(false);
|
||||
button(ctx.child("remove-item-button"))
|
||||
.set_visibility(Visibility::Collapsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
Action::IncrementCounter => {
|
||||
*ctx.widget().get_mut::<usize>("counter") += 1;
|
||||
*main_view(ctx.widget()).counter_mut() += 1;
|
||||
|
||||
let counter = *ctx.widget().get::<usize>("counter");
|
||||
let counter = *main_view(ctx.widget()).counter();
|
||||
|
||||
ctx.widget().set(
|
||||
"result",
|
||||
String16::from(format!("Button count: {}", counter)),
|
||||
);
|
||||
main_view(ctx.widget())
|
||||
.set_result(String16::from(format!("Button count: {}", counter)));
|
||||
}
|
||||
Action::ClearText => {
|
||||
ctx.widget().set("text_one", String16::from(""));
|
||||
ctx.widget().set("text_two", String16::from(""));
|
||||
main_view(ctx.widget()).set_text_one(String16::default());
|
||||
main_view(ctx.widget()).set_text_two(String16::default());
|
||||
}
|
||||
Action::EntryActivated(entity) => {
|
||||
let mut widget = ctx.get_widget(entity);
|
||||
let text = widget.get_mut::<String16>("text");
|
||||
let mut text_box = text_box(ctx.get_widget(entity));
|
||||
let text = text_box.text_mut();
|
||||
println!("submitting {}", text);
|
||||
text.clear();
|
||||
}
|
||||
Action::EntryChanged(entity) => {
|
||||
let widget = ctx.get_widget(entity);
|
||||
let text = widget.get::<String16>("text");
|
||||
println!("entry changed: {}", text);
|
||||
println!("entry changed: {}", text_box(ctx.get_widget(entity)).text());
|
||||
}
|
||||
Action::ValueChanged(entity) => {
|
||||
let val =
|
||||
((*ctx.get_widget(entity).get::<f64>("val")).floor() as i32).to_string();
|
||||
ctx.child("value_text").set("text", String16::from(val));
|
||||
Action::ValueChanged(_entity) => {
|
||||
//println!("Slider value changed");
|
||||
}
|
||||
Action::ToggleTheme(entity) => {
|
||||
let light = *ctx.get_widget(entity).get::<bool>("selected");
|
||||
|
||||
let theme = if light { light_theme() } else { dark_theme() };
|
||||
ctx.switch_theme(theme);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,24 +105,19 @@ impl State for MainViewState {
|
||||
}
|
||||
}
|
||||
|
||||
fn update_post_layout(&mut self, _: &mut Registry, ctx: &mut Context<'_>) {
|
||||
fn update_post_layout(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||
let mut selection_string = "Selected:".to_string();
|
||||
|
||||
for index in &ctx.widget().get::<SelectedIndices>("selected_indices").0 {
|
||||
for index in &main_view(ctx.widget()).selected_indices().0 {
|
||||
selection_string = format!("{} {}", selection_string, index);
|
||||
}
|
||||
|
||||
ctx.child("selection")
|
||||
.set("text", String16::from(selection_string));
|
||||
text_block(ctx.child("selection")).set_text(selection_string);
|
||||
}
|
||||
}
|
||||
|
||||
fn create_header(ctx: &mut BuildContext, text: &str) -> Entity {
|
||||
TextBlock::new()
|
||||
.text(text)
|
||||
.element("text-block")
|
||||
.class("h1")
|
||||
.build(ctx)
|
||||
TextBlock::new().text(text).style("header").build(ctx)
|
||||
}
|
||||
|
||||
type List = Vec<String>;
|
||||
@@ -136,6 +140,14 @@ widget!(
|
||||
|
||||
impl Template for MainView {
|
||||
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
||||
let slider = Slider::new()
|
||||
.min(0.0)
|
||||
.max(1.0)
|
||||
.on_changed(move |states, entity| {
|
||||
state(id, states).action(Action::ValueChanged(entity));
|
||||
})
|
||||
.build(ctx);
|
||||
|
||||
self.name("MainView")
|
||||
.result("Button count: 0")
|
||||
.counter(0)
|
||||
@@ -147,16 +159,16 @@ impl Template for MainView {
|
||||
])
|
||||
.list_count(3)
|
||||
.selection_list(vec![
|
||||
"Item 1".to_string(),
|
||||
"Item 2".to_string(),
|
||||
"Item 3".to_string(),
|
||||
"Item 4".to_string(),
|
||||
"Item 5".to_string(),
|
||||
"Item 6".to_string(),
|
||||
"Item 7".to_string(),
|
||||
"Item 8".to_string(),
|
||||
"Item 9".to_string(),
|
||||
"Item 10".to_string(),
|
||||
"Select Item 1".to_string(),
|
||||
"Select Item 2".to_string(),
|
||||
"Select Item 3".to_string(),
|
||||
"Select Item 4".to_string(),
|
||||
"Select Item 5".to_string(),
|
||||
"Select Item 6".to_string(),
|
||||
"Select Item 7".to_string(),
|
||||
"Select Item 8".to_string(),
|
||||
"Select Item 9".to_string(),
|
||||
"Select Item 10".to_string(),
|
||||
])
|
||||
.combo_box_list(vec![
|
||||
"CB 1".to_string(),
|
||||
@@ -174,25 +186,21 @@ impl Template for MainView {
|
||||
.combo_box_list_count(10)
|
||||
.child(
|
||||
Grid::new()
|
||||
.margin(8.0)
|
||||
.columns(
|
||||
Columns::new()
|
||||
.add(132.0)
|
||||
.add(16.0)
|
||||
.add(132.0)
|
||||
.add(16.0)
|
||||
.add(132.0),
|
||||
)
|
||||
.margin(8)
|
||||
.columns(Columns::new().add(132).add(16).add(132).add(16).add(132))
|
||||
.rows(Rows::new().add("*").add(32))
|
||||
.child(
|
||||
// Row 0
|
||||
Stack::new()
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::row(0))
|
||||
// Column 0
|
||||
.child(create_header(ctx, "Buttons"))
|
||||
.child(
|
||||
Button::new()
|
||||
.text("Button")
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.icon(material_font_icons::CHECK_FONT_ICON)
|
||||
.margin((0, 8, 0, 0))
|
||||
.icon(material_icons_font::MD_CHECK)
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::row(1))
|
||||
.on_click(move |states, _| {
|
||||
@@ -204,19 +212,19 @@ impl Template for MainView {
|
||||
.child(
|
||||
Button::new()
|
||||
.text("Primary")
|
||||
.element("button")
|
||||
.class("primary")
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.icon(material_font_icons::CHECK_FONT_ICON)
|
||||
.style("button_primary")
|
||||
.margin((0, 8, 0, 0))
|
||||
.icon(material_icons_font::MD_360)
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::row(2))
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
ToggleButton::new()
|
||||
.class("single_content")
|
||||
.style("button_single_content")
|
||||
.text("ToggleButton")
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.margin((0, 8, 2, 0))
|
||||
.icon(material_icons_font::MD_ALARM_ON)
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::row(3))
|
||||
.build(ctx),
|
||||
@@ -224,45 +232,38 @@ impl Template for MainView {
|
||||
.child(
|
||||
CheckBox::new()
|
||||
.text("CheckBox")
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.margin((0, 8, 0, 0))
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::row(4))
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
Switch::new()
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.margin((0, 8, 0, 0))
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::row(5))
|
||||
.build(ctx),
|
||||
)
|
||||
.child(slider)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.element("h1")
|
||||
.id("value_text")
|
||||
.text("0")
|
||||
.h_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
Slider::new()
|
||||
.on_changed(move |states, entity| {
|
||||
state(id, states).action(Action::ValueChanged(entity));
|
||||
})
|
||||
ProgressBar::new()
|
||||
.val(slider)
|
||||
.margin((0, 8, 0, 0))
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
Stack::new()
|
||||
// Column 2
|
||||
.attach(Grid::column(2))
|
||||
.attach(Grid::row(0))
|
||||
.child(create_header(ctx, "Text"))
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.class("body")
|
||||
.style("body")
|
||||
.text(("result", id))
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.margin((0, 8, 0, 0))
|
||||
.attach(Grid::column(2))
|
||||
.attach(Grid::row(1))
|
||||
.build(ctx),
|
||||
@@ -271,7 +272,7 @@ impl Template for MainView {
|
||||
TextBox::new()
|
||||
.water_mark("TextBox...")
|
||||
.text(("text_one", id))
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.margin((0, 8, 0, 0))
|
||||
.attach(Grid::column(2))
|
||||
.attach(Grid::row(2))
|
||||
.on_activate(move |states, entity| {
|
||||
@@ -286,7 +287,7 @@ impl Template for MainView {
|
||||
TextBox::new()
|
||||
.water_mark("TextBox...")
|
||||
.text(("text_two", id))
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.margin((0, 8, 0, 0))
|
||||
.attach(Grid::column(2))
|
||||
.attach(Grid::row(2))
|
||||
.on_activate(move |states, entity| {
|
||||
@@ -299,9 +300,10 @@ impl Template for MainView {
|
||||
)
|
||||
.child(
|
||||
Button::new()
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.class("single_content")
|
||||
.margin((0, 8, 0, 0))
|
||||
.style("button_single_content")
|
||||
.text("clear text")
|
||||
.icon(material_icons_font::MD_CLEAR)
|
||||
.on_click(move |states, _| {
|
||||
state(id, states).action(Action::ClearText);
|
||||
true
|
||||
@@ -310,8 +312,8 @@ impl Template for MainView {
|
||||
)
|
||||
.child(
|
||||
NumericBox::new()
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.max(123.0)
|
||||
.margin((0, 8, 0, 0))
|
||||
.max(123)
|
||||
.step(0.123)
|
||||
.val(0.123)
|
||||
.build(ctx),
|
||||
@@ -319,24 +321,25 @@ impl Template for MainView {
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
// Column 4
|
||||
Grid::new()
|
||||
.rows(
|
||||
Rows::new()
|
||||
.add("auto")
|
||||
.add(32.0)
|
||||
.add(16.0)
|
||||
.add(204.0)
|
||||
.add(32)
|
||||
.add(16)
|
||||
.add(204)
|
||||
.add("auto")
|
||||
.add(192.0)
|
||||
.add(192)
|
||||
.add("auto"),
|
||||
)
|
||||
.columns(Columns::new().add("*").add(4.0).add("*"))
|
||||
.columns(Columns::new().add("*").add(4).add("*"))
|
||||
.attach(Grid::column(4))
|
||||
.attach(Grid::row(0))
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.text("Items")
|
||||
.element("text-block")
|
||||
.class("h1")
|
||||
.style("header")
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::column_span(3))
|
||||
.attach(Grid::row(0))
|
||||
@@ -350,7 +353,8 @@ impl Template for MainView {
|
||||
.get::<Vec<String>>("combo_box_list")[index]
|
||||
.clone();
|
||||
TextBlock::new()
|
||||
.margin((0.0, 0.0, 0.0, 2.0))
|
||||
.style("small_text")
|
||||
.margin((0, 0, 0, 2))
|
||||
.v_align("center")
|
||||
.text(text)
|
||||
.build(bc)
|
||||
@@ -359,58 +363,53 @@ impl Template for MainView {
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::column_span(3))
|
||||
.attach(Grid::row(1))
|
||||
.margin((0.0, 8.0, 0.0, 0.0))
|
||||
.margin((0, 8, 0, 0))
|
||||
.count(("combo_box_list_count", id))
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
ItemsWidget::new()
|
||||
.element("items-widget")
|
||||
.id("items")
|
||||
.padding((4.0, 4.0, 4.0, 2.0))
|
||||
.padding((4, 4, 4, 2))
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::column_span(3))
|
||||
.attach(Grid::row(3))
|
||||
.margin((0.0, 0.0, 0.0, 8.0))
|
||||
.margin((0, 0, 0, 8))
|
||||
// bc = build-context
|
||||
.items_builder(move |bc, index| {
|
||||
let text = bc.get_widget(id).get::<Vec<String>>("list")
|
||||
[index]
|
||||
.clone();
|
||||
|
||||
Button::new()
|
||||
.margin((0.0, 0.0, 0.0, 2.0))
|
||||
.text(text)
|
||||
.build(bc)
|
||||
Button::new().margin((0, 0, 0, 2)).text(text).build(bc)
|
||||
})
|
||||
.count(("list_count", id))
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
Button::new()
|
||||
.element("button")
|
||||
.class("single_content")
|
||||
.style("button_single_content")
|
||||
.id("remove-item-button")
|
||||
.icon(material_font_icons::MINUS_FONT_ICON)
|
||||
.icon(material_icons_font::MD_REMOVE_CIRCLE)
|
||||
.on_click(move |states, _| {
|
||||
state(id, states).action(Action::RemoveItem);
|
||||
true
|
||||
})
|
||||
.min_width(0.0)
|
||||
.min_width(0)
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::row(4))
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
Button::new()
|
||||
.element("button")
|
||||
.class("single_content")
|
||||
.style("button_single_content")
|
||||
.id("add-item-button")
|
||||
.icon(material_font_icons::ADD_FONT_ICON)
|
||||
.icon(material_icons_font::MD_ADD_CIRCLE)
|
||||
.on_click(move |states, _| {
|
||||
state(id, states).action(Action::AddItem);
|
||||
true
|
||||
})
|
||||
.min_width(0.0)
|
||||
.min_width(0)
|
||||
.attach(Grid::column(2))
|
||||
.attach(Grid::row(4))
|
||||
.build(ctx),
|
||||
@@ -421,27 +420,28 @@ impl Template for MainView {
|
||||
.attach(Grid::column_span(3))
|
||||
.attach(Grid::row(5))
|
||||
.selected_indices(id)
|
||||
.margin((0.0, 16.0, 0.0, 8.0))
|
||||
.margin((0, 16, 0, 8))
|
||||
.items_builder(move |bc, index| {
|
||||
let text = bc
|
||||
.get_widget(id)
|
||||
.get::<Vec<String>>("selection_list")[index]
|
||||
.clone();
|
||||
TextBlock::new()
|
||||
.margin((0.0, 0.0, 0.0, 2.0))
|
||||
.margin((0, 0, 0, 2))
|
||||
.v_align("center")
|
||||
.text(text)
|
||||
.build(bc)
|
||||
})
|
||||
.on_selection_changed(|_, _, _| println!("Selection changed"))
|
||||
.count(("selection_list_count", id))
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
// todo: wrong text width????
|
||||
TextBlock::new()
|
||||
.element("text-block")
|
||||
.style("body")
|
||||
.id("selection")
|
||||
.max_width(120.0)
|
||||
.max_width(120)
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::column_span(3))
|
||||
.attach(Grid::row(6))
|
||||
@@ -450,6 +450,30 @@ impl Template for MainView {
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
// Row 1
|
||||
Stack::new()
|
||||
.orientation("horizontal")
|
||||
.attach(Grid::row(1))
|
||||
.attach(Grid::column(0))
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.style("body")
|
||||
.text("Toggle theme: ")
|
||||
.v_align("center")
|
||||
.margin((0, 0, 4, 0))
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
Switch::new()
|
||||
.on_changed(move |states, entity| {
|
||||
state(id, states).action(Action::ToggleTheme(entity));
|
||||
})
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
}
|
||||
@@ -463,8 +487,8 @@ fn main() {
|
||||
.window(|ctx| {
|
||||
Window::new()
|
||||
.title("OrbTk - widgets example")
|
||||
.position((100.0, 100.0))
|
||||
.size(468.0, 730.0)
|
||||
.position((100, 100))
|
||||
.size(468, 730)
|
||||
.resizeable(true)
|
||||
.child(MainView::new().build(ctx))
|
||||
.build(ctx)
|
||||
82
advotracker_client/examples/cheet_sheet.rs
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* OrbTk - The Orbital Widget Toolkit
|
||||
*
|
||||
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
* SPDX-License-Identifier: (MIT)
|
||||
*/
|
||||
|
||||
// use orbtk::prelude::*;
|
||||
|
||||
// /* * WidgetContainer = entity */
|
||||
// associated functions: get, get_mut, try_get, try_get_mut and clone
|
||||
// ctx.widget() returns a WidgetContainer object, that wraps
|
||||
// the current state of that widget (i.e properties)
|
||||
// let mut widget_container: WidgetContainer = ctx.widget();
|
||||
|
||||
// // property handling (componets)
|
||||
// // Gets a reference for the property
|
||||
// // .get<PropertyType>("property_name");
|
||||
// widget_container.get::<String16>("text");
|
||||
|
||||
// // Sets the value of a property
|
||||
// // .set<PropertyType>("property_name", property_value);
|
||||
// widget_container.set::<String16>("text", "my_text");
|
||||
|
||||
// /*
|
||||
// * Child WidgetContainer = child entity
|
||||
// */
|
||||
// // child of a state's widget, that is referenced by an entity id.
|
||||
// // e.g: .child(TextBox::new().id(child_entity_id).build(ctx)
|
||||
// let mut child: WidgetContainer = ctx.get_widget(child_entity_id);
|
||||
|
||||
// // child of a state's widget that is referenced by an string id
|
||||
// // e.g: .child(TextBox::new().id("text_box_id").build(ctx)
|
||||
// let child: WidgetContainer = ctx.child("text_box_id");
|
||||
|
||||
// // property handling (components)
|
||||
// // Gets an TextBoxCtx wrapper for the text box child.
|
||||
// let mut text_box: TextBoxCtx = text_box(ctx.child("text_box_id"));
|
||||
|
||||
// // or as an alternative:
|
||||
// let text_box: TextBoxCtx = TextBox::get(ctx.child("text_box_id"));
|
||||
|
||||
// // get child field attributes
|
||||
// let text_len = text_box.text().len();
|
||||
|
||||
// // set child field attributes
|
||||
// text_box.set_text("My new text");
|
||||
|
||||
// /*
|
||||
// * Registry handling
|
||||
// */
|
||||
// // register service
|
||||
// fn update(registry: &mut Registry, _: &mut Context) {
|
||||
// registry.register("my_db_serve", MyDBServie::new());
|
||||
// }
|
||||
// // access service
|
||||
// fn update(registry: &mut Registry, _: &mut Context) {
|
||||
// let mut my_db_service: MyDBSerivce = registry.get_mut("my_db_service");
|
||||
// }
|
||||
|
||||
// API Update: access properties of widgets in states
|
||||
|
||||
// Old style (associated functions)
|
||||
// let text = *button(&mut ctx.widget()).text();
|
||||
// let text = Button::get(&mut ctx.widget()).text();
|
||||
// let text = *button(&mut ctx.widget()).clone_text();
|
||||
// let text = Button::get(&mut ctx.widget()).clone_text();
|
||||
// button(&mut ctx.widget()).text_mut().push_str("test");
|
||||
// Button::get(&mut ctx.widget()).text_mut().push_str("test");
|
||||
// button(&mut ctx.widget()).set_text(String16::from("test"));
|
||||
// Button::get(&mut ctx.widget()).set_text(String16::from("test"));
|
||||
|
||||
// Current style (trait functions)
|
||||
// let text = Button::text_clone(&ctx.widget());
|
||||
// Button::text_mut(&mut ctx.widget()).push_str("test");
|
||||
// Button::text_set(&mut ctx.widget(), String16::from("test"));
|
||||
//
|
||||
// TextBehaviour::offset_set(&mut ctx.widget(self.text_block), offset);
|
||||
// or
|
||||
// ctx.get_widget(self.text_block).set("offset", offset);
|
||||
|
||||
fn main() {}
|
||||
847
advotracker_client/examples/combobox-test.rs
Normal file
@@ -0,0 +1,847 @@
|
||||
/*
|
||||
* advotracker - Hotline tackingtool for Advocats
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
* SPDX-License-Identifier: (0BSD or MIT)
|
||||
*/
|
||||
|
||||
// suppress creation of a new console window on window
|
||||
#![windows_subsystem = "windows"]
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use locales::t;
|
||||
use orbtk::{
|
||||
prelude::*,
|
||||
theme_default::{THEME_DEFAULT, THEME_DEFAULT_COLORS_DARK, THEME_DEFAULT_FONTS},
|
||||
theming::config::ThemeConfig,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use std::env;
|
||||
use std::time::SystemTime;
|
||||
use tracing::{info, trace, Level};
|
||||
|
||||
use advotracker::{
|
||||
data::{constants::*, structures::Email},
|
||||
widgets::global_state::GlobalState,
|
||||
widgets::main_view,
|
||||
//services::exports::send_ticketdata::sendticketdata,
|
||||
widgets::policycheck::*,
|
||||
widgets::policycheck_state::*,
|
||||
widgets::ticketdata::*,
|
||||
};
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use orbtk::theme_fluent::{THEME_FLUENT, THEME_FLUENT_COLORS_DARK, THEME_FLUENT_FONTS};
|
||||
|
||||
pub enum TicketdataAction {
|
||||
ClearForm(),
|
||||
SendForm(),
|
||||
UpdatePolicyCode(String),
|
||||
}
|
||||
|
||||
// German localization file.
|
||||
static ADVOTRACKER_DE_DE: &str = include_str!("../assets/advotracker/advotracker_de_DE.ron");
|
||||
|
||||
/// Get the active language environment.
|
||||
fn get_lang() -> String {
|
||||
// get system environment
|
||||
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"
|
||||
info!("GUI-Language: preset to {:?}", lang);
|
||||
|
||||
// return the active language
|
||||
lang
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(windows)] {
|
||||
/// Extend and register theme assets.
|
||||
fn theme() -> Theme {
|
||||
register_default_fonts(Theme::from_config(
|
||||
ThemeConfig::from(DEFAULT_DARK_EXT)
|
||||
.extend(ThemeConfig::from(THEME_DEFAULT))
|
||||
.extend(ThemeConfig::from(THEME_DEFAULT_COLORS_DARK))
|
||||
.extend(ThemeConfig::from(THEME_DEFAULT_FONTS)),
|
||||
))
|
||||
}
|
||||
fn theme_fluent() -> Theme {
|
||||
register_fluent_fonts(Theme::from_config(
|
||||
ThemeConfig::from(FLUENT_DARK_EXT)
|
||||
.extend(ThemeConfig::from(THEME_FLUENT))
|
||||
.extend(ThemeConfig::from(THEME_FLUENT_COLORS_DARK))
|
||||
.extend(ThemeConfig::from(THEME_FLUENT_FONTS)),
|
||||
))
|
||||
// register_fluent_fonts(Theme::from_config(
|
||||
// ThemeConfig::from(FLUENT_LIGHT_EXT)
|
||||
// .extend(ThemeConfig::from(THEME_FLUENT))
|
||||
// .extend(ThemeConfig::from(THEME_FLUENT_COLORS_DARK))
|
||||
// .extend(ThemeConfig::from(THEME_FLUENT_FONTS)),
|
||||
}
|
||||
} else {
|
||||
/// Extend and register theme assets.
|
||||
fn theme() -> Theme {
|
||||
register_default_fonts(Theme::from_config(
|
||||
ThemeConfig::from(DEFAULT_DARK_EXT)
|
||||
.extend(ThemeConfig::from(THEME_DEFAULT))
|
||||
.extend(ThemeConfig::from(THEME_DEFAULT_COLORS_DARK))
|
||||
.extend(ThemeConfig::from(THEME_DEFAULT_FONTS)),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Main
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// initialize the tracing subsystem
|
||||
// a drop in replacement for classical logging
|
||||
// reference: https://tokio.rs/blog/2019-08-tracing/
|
||||
let span = tracing::span!(Level::TRACE, "advotracker");
|
||||
let _enter = span.enter();
|
||||
let subscriber = fmt::Subscriber::builder()
|
||||
.with_env_filter(trace)
|
||||
//.with_max_level(tracing::Level::DEBUG)
|
||||
.finish();
|
||||
|
||||
tracing::subscriber::with_default(subscriber, || {
|
||||
// get system environment
|
||||
let lang = get_lang();
|
||||
|
||||
let mut state = t!("state.started", lang);
|
||||
let mut res = t!("parse.environment", lang);
|
||||
trace!(target: "advotracker", process = ?res, state = ?state);
|
||||
trace!(target: "advotracker", environment = "system", lang = ?lang);
|
||||
trace!(target: "advotracker", machine = ?&machine_kind);
|
||||
|
||||
// how to handle unimplemented lang resources??
|
||||
res = t!("parse.environment", lang);
|
||||
trace!(target: "advotracker", environment = "envy", lang = ?lang);
|
||||
state = t!("state.finished", lang);
|
||||
trace!(target: "advotracker", process = ?res, state = ?state);
|
||||
|
||||
// main tasks
|
||||
res = t!("main.started", lang);
|
||||
state = t!("state.started", lang);
|
||||
trace!(target: "advotracker", process = ?res, state = ?state);
|
||||
|
||||
// use this only if you want to run it as web application.
|
||||
orbtk::initialize();
|
||||
|
||||
// Preset localization and language from given environment.
|
||||
// if no dictionary is set for the chosen default language
|
||||
// the content of the text property will be drawn.
|
||||
//let language = lang.substring(0,5); // "de_DE.UTF-8" -> "de_DE"
|
||||
//info!("GUI-Language: preset to {:?}", language);
|
||||
let localization = RonLocalization::create()
|
||||
.language(&lang)
|
||||
.dictionary("de_DE", ADVOTRACKER_DE_DE)
|
||||
.build();
|
||||
|
||||
Application::from_name("nwx.advotracker")
|
||||
.localization(localization)
|
||||
.theme(theme())
|
||||
.window(|ctx| {
|
||||
Window::new()
|
||||
.title("AdvoTracker - DirectCall")
|
||||
.position((500.0, 100.0))
|
||||
.size(800.0, 600.0)
|
||||
//.min_width(460.0)
|
||||
//.min_height(380.0)
|
||||
.resizeable(true)
|
||||
.child(main_view::MainView::new().build(ctx))
|
||||
.build(ctx)
|
||||
})
|
||||
.run();
|
||||
|
||||
state = t!("state.finished", lang);
|
||||
res = t!("main.finished", lang);
|
||||
trace!(target: "advotracker", process = ?res, state = ?state);
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// View
|
||||
|
||||
widget!(MainView {
|
||||
policycheck_view: PolicyCheck
|
||||
});
|
||||
|
||||
impl Template for MainView {
|
||||
fn template(self, _id: Entity, ctx: &mut BuildContext<'_>) -> Self {
|
||||
let ticketdata_view = TicketdataView::new().build(ctx);
|
||||
|
||||
let policycheck_view = PolicycheckView::new().target(ticketdata_view.0).build(ctx);
|
||||
|
||||
self.name("MainView").child(
|
||||
TabWidget::new()
|
||||
.tab(ID_POLICY_CHECK_VIEW, policycheck_view)
|
||||
.tab(ID_TICKET_DATA_VIEW, ticketdata_view)
|
||||
.build(ctx),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Macro that initializes the widget structures/variables for the policy check view
|
||||
widget!(
|
||||
/// Form to enter data of a ticket record
|
||||
TicketdataView<TicketdataState> {
|
||||
// language used inside the widget
|
||||
lang: String,
|
||||
// title used in the header
|
||||
ticket_data_title: String,
|
||||
// entity id that will receive the messages
|
||||
target: u32
|
||||
}
|
||||
);
|
||||
|
||||
/// The template implementation of the ticket view
|
||||
/// All GUI elements are styled using the "style" attribute referencing to a ron based css
|
||||
impl Template for TicketdataView {
|
||||
fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self {
|
||||
let tenent_logo = Container::new()
|
||||
.margin((16, 16, 0, 0))
|
||||
.attach(Grid::column(0))
|
||||
.v_align("center")
|
||||
.child(
|
||||
ImageWidget::new()
|
||||
.image("assets/advotracker/hiedemann_logo.png")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx);
|
||||
|
||||
let ticket_data_bottom_bar = Container::new()
|
||||
.id(ID_TICKET_DATA_BOTTOM_BAR)
|
||||
.style(STYLE_BOTTOM_BAR)
|
||||
.attach(Grid::row(4))
|
||||
.attach(Grid::column(1))
|
||||
.attach(Grid::column_span(2))
|
||||
.v_align("end")
|
||||
.child(
|
||||
Container::new()
|
||||
.attach(Grid::column(1))
|
||||
.h_align("end")
|
||||
.v_align("end")
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.margin((0, 9, 48, 0))
|
||||
.text("©Networkx GmbH")
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx);
|
||||
|
||||
let ticket_data_button_menu = Button::new()
|
||||
.id(ID_TICKET_DATA_BUTTON_MENU)
|
||||
.attach(Grid::row(0))
|
||||
.attach(Grid::column(2))
|
||||
.h_align("end")
|
||||
.icon(material_icons_font::MD_MENU)
|
||||
//.style("button_single_content")
|
||||
.style(STYLE_BUTTON_MENU)
|
||||
.build(ctx);
|
||||
|
||||
let ticket_data_form = Container::new()
|
||||
.id(ID_TICKET_DATA_FORM)
|
||||
.name(ID_TICKET_DATA_FORM)
|
||||
.attach(Grid::row(2))
|
||||
.attach(Grid::column(1))
|
||||
.style("container_form")
|
||||
.child(
|
||||
Grid::new()
|
||||
.id(ID_TICKET_DATA_GRID)
|
||||
.name(ID_TICKET_DATA_GRID)
|
||||
.columns(
|
||||
Columns::create()
|
||||
.push("auto") // Label
|
||||
.push(16) // Delimiter
|
||||
.push("*") // Data
|
||||
.push(32), // Delimiter (2x margin)
|
||||
)
|
||||
.rows(
|
||||
Rows::create()
|
||||
.push("auto") // Row 0
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 2
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 4
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 6
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 8
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 10
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 12
|
||||
.push(14), // Seperator
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_TICKET_DATA_LABEL_POLICY_CODE)
|
||||
.attach(Grid::row(0))
|
||||
.attach(Grid::column(0))
|
||||
.text("Policy code")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.id(ID_TICKET_DATA_POLICY_CODE)
|
||||
.attach(Grid::row(0))
|
||||
.attach(Grid::column(2))
|
||||
.text("")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_TICKET_DATA_LABEL_POLICY_HOLDER)
|
||||
.attach(Grid::row(2))
|
||||
.attach(Grid::column(0))
|
||||
.text("Policy holder")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.id(ID_TICKET_DATA_POLICY_HOLDER)
|
||||
.attach(Grid::row(2))
|
||||
.attach(Grid::column(2))
|
||||
.text("")
|
||||
.water_mark("Name des Versicherungsnehmers")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_TICKET_DATA_LABEL_DEDUCTIBLE)
|
||||
.attach(Grid::row(4))
|
||||
.attach(Grid::column(0))
|
||||
.text("Deductible")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.id(ID_TICKET_DATA_DEDUCTIBLE)
|
||||
.attach(Grid::row(4))
|
||||
.attach(Grid::column(2))
|
||||
.text("")
|
||||
.water_mark("im Beratungsgespräch erfragen")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_TICKET_DATA_LABEL_CALLBACK_NUMBER)
|
||||
.attach(Grid::row(6))
|
||||
.attach(Grid::column(0))
|
||||
.text("Callback number")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.id(ID_TICKET_DATA_CALLBACK_NUMBER)
|
||||
.attach(Grid::row(6))
|
||||
.attach(Grid::column(2))
|
||||
.text("")
|
||||
.water_mark("wie zu erreichen")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_TICKET_DATA_LABEL_CALLBACK_DATE)
|
||||
.attach(Grid::row(8))
|
||||
.attach(Grid::column(0))
|
||||
.text("Callback date")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.id(ID_TICKET_DATA_CALLBACK_DATE)
|
||||
.attach(Grid::row(8))
|
||||
.attach(Grid::column(2))
|
||||
.text("")
|
||||
.water_mark("Rückruf gewünscht um")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_TICKET_DATA_LABEL_HARM_TYPE)
|
||||
.attach(Grid::row(10))
|
||||
.attach(Grid::column(0))
|
||||
.text("Harm type")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.id(ID_TICKET_DATA_HARM_TYPE)
|
||||
.name(ID_TICKET_DATA_HARM_TYPE)
|
||||
.attach(Grid::row(10))
|
||||
.attach(Grid::column(2))
|
||||
.text("")
|
||||
.water_mark("Schadenstyp")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_TICKET_DATA_LABEL_IVR_COMMENT)
|
||||
.attach(Grid::row(12))
|
||||
.attach(Grid::column(0))
|
||||
.text("IVR comment")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.id(ID_TICKET_DATA_IVR_COMMENT)
|
||||
.attach(Grid::row(12))
|
||||
.attach(Grid::column(2))
|
||||
.text("")
|
||||
.water_mark("Kommentar zur Haftung, bzw. zur Deckung")
|
||||
//.height(48.0)
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx);
|
||||
|
||||
let ticket_data_form_action = Container::new()
|
||||
.id(ID_TICKET_DATA_ACTION_GRID)
|
||||
.attach(Grid::row(3))
|
||||
.attach(Grid::column(1))
|
||||
//.style(STYLE_CONTAINER_ACTION)
|
||||
.padding(14)
|
||||
.h_align("center")
|
||||
.child(
|
||||
Stack::new()
|
||||
//.style(STYLE_STACK_ACTION)
|
||||
.orientation("horizontal")
|
||||
.spacing(50)
|
||||
.child(
|
||||
Button::new()
|
||||
.id(ID_TICKET_DATA_ACTION_BUTTON_CLEAR)
|
||||
.style(STYLE_BUTTON_ACTION)
|
||||
.text("Clear")
|
||||
.on_click(move |states, _| {
|
||||
states.send_message(TicketdataAction::ClearForm(), id);
|
||||
false
|
||||
})
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
Button::new()
|
||||
.id(ID_TICKET_DATA_ACTION_BUTTON_SEND)
|
||||
.style(STYLE_BUTTON_ACTION)
|
||||
.text("Send")
|
||||
//.visibility(Visibility::Collapsed)
|
||||
.on_click(move |states, _entity| {
|
||||
states.send_message(TicketdataAction::SendForm(), id);
|
||||
false
|
||||
})
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx);
|
||||
|
||||
// vector with valid mail recipients addresses (mail_to)
|
||||
let items_mail_to = vec![
|
||||
PROP_MAIL_TO_1,
|
||||
PROP_MAIL_TO_2,
|
||||
PROP_MAIL_TO_3,
|
||||
PROP_MAIL_TO_4,
|
||||
];
|
||||
let items_mail_to_count = items_mail_to.len();
|
||||
|
||||
// vector with valid carbon copy recipients addresses (mail_to)
|
||||
let items_mail_cc = vec![PROP_MAIL_CC_1, PROP_MAIL_CC_2];
|
||||
let items_mail_cc_count = items_mail_cc.len();
|
||||
|
||||
let ticket_data_form_mail = Container::new()
|
||||
.id(ID_TICKET_DATA_CONTAINER_MAIL)
|
||||
.name(ID_TICKET_DATA_CONTAINER_MAIL)
|
||||
.attach(Grid::row(1))
|
||||
.attach(Grid::column(1))
|
||||
.style(STYLE_CONTAINER_MAIL)
|
||||
.child(
|
||||
Grid::new()
|
||||
.columns(
|
||||
Columns::create()
|
||||
.push(16) // Delimiter
|
||||
.push("stretch") // Label
|
||||
.push(16) // Delimiter
|
||||
.push("auto") // MailAddress
|
||||
.push("32"), // Delimiter (2x margin)
|
||||
)
|
||||
.rows(
|
||||
Rows::create()
|
||||
.push("auto") // Row 0
|
||||
.push(2) // Seperator
|
||||
.push("auto") // Row 2
|
||||
.push(2), // Seperator
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_TICKET_DATA_MAIL_TO)
|
||||
.attach(Grid::row(0))
|
||||
.attach(Grid::column(1))
|
||||
.style(STYLE_MAIL_LABEL)
|
||||
.text("Recipient (To)")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
/// WIP: get selected item
|
||||
ComboBox::new()
|
||||
.id(ID_TICKET_DATA_MAIL_TO)
|
||||
.attach(Grid::row(0))
|
||||
.attach(Grid::column(3))
|
||||
.style(STYLE_MAIL_TO)
|
||||
.count(items_mail_to_count)
|
||||
.items_builder(move |ibc, index| {
|
||||
let text_mail_to =
|
||||
TicketdataView::items_mail_to_ref(&ibc.get_widget(id))[index]
|
||||
.clone();
|
||||
TextBox::new()
|
||||
.text(text_mail_to)
|
||||
.v_align("center")
|
||||
.build(ibc)
|
||||
})
|
||||
.selected_index(0)
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_TICKET_DATA_LABEL_MAIL_CC)
|
||||
.attach(Grid::row(2))
|
||||
.attach(Grid::column(1))
|
||||
.style(STYLE_MAIL_LABEL)
|
||||
.text("Copie (CC)")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
ComboBox::new()
|
||||
.id(ID_TICKET_DATA_MAIL_CC)
|
||||
.attach(Grid::row(2))
|
||||
.attach(Grid::column(3))
|
||||
.style(STYLE_MAIL_CC)
|
||||
.count(items_mail_cc_count)
|
||||
.items_builder(move |ibc, index| {
|
||||
let text_mail_cc =
|
||||
TicketdataView::items_mail_cc_ref(&ibc.get_widget(id))[index]
|
||||
.clone();
|
||||
TextBox::new()
|
||||
.text(text_mail_cc)
|
||||
.v_align("center")
|
||||
.build(ibc)
|
||||
})
|
||||
.selected_index(0)
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx);
|
||||
|
||||
let ticket_data_header_text = TextBlock::new()
|
||||
.id(ID_TICKET_DATA_HEADER)
|
||||
.attach(Grid::column(0))
|
||||
.style(STYLE_HEADER_TEXT)
|
||||
.text("Ticket Data")
|
||||
.build(ctx);
|
||||
|
||||
let ticket_data_header_bar = Container::new()
|
||||
.id(ID_TICKET_DATA_HEADER_BAR)
|
||||
.attach(Grid::row(0))
|
||||
.attach(Grid::column_span(3))
|
||||
.style(STYLE_HEADER_BAR)
|
||||
.child(tenent_logo)
|
||||
.child(ticket_data_header_text)
|
||||
.child(ticket_data_button_menu)
|
||||
.build(ctx);
|
||||
|
||||
// Widget: Ticket data view
|
||||
self.id(ID_TICKET_DATA_VIEW)
|
||||
.name(ID_TICKET_DATA_VIEW)
|
||||
.min_height(410.0)
|
||||
.child(
|
||||
Grid::new()
|
||||
.id(ID_TICKET_DATA_GRID)
|
||||
.columns(
|
||||
Columns::create()
|
||||
.push(50) // Left margin
|
||||
.push("*") // Content
|
||||
.push(50), // Right margin
|
||||
)
|
||||
.rows(
|
||||
Rows::create()
|
||||
.push("auto") // Header_Bar
|
||||
.push("auto") // Mail_Form
|
||||
.push("*") // Input_Form
|
||||
.push("auto") // Action
|
||||
.push("auto"), // Bottom_Bar
|
||||
)
|
||||
.child(ticket_data_header_bar) // row 0
|
||||
.child(ticket_data_form_mail) // row 1
|
||||
.child(ticket_data_form) // row 2
|
||||
.child(ticket_data_form_action) // row 3
|
||||
.child(ticket_data_bottom_bar) // row 4
|
||||
.build(ctx),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// State
|
||||
impl GlobalState for TicketdataState {}
|
||||
|
||||
/// Method definitions, that react on any given state change inside the `Ticketdata` widget.
|
||||
impl TicketdataState {
|
||||
/// Clear the text property of all children of the given form entity
|
||||
pub fn clear_form(entity: Entity, ctx: &mut Context<'_>) {
|
||||
if let Some(count) = ctx.get_widget(entity).children_count() {
|
||||
info!(
|
||||
"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
|
||||
if let form_entity = ctx.child(ID_TICKET_DATA_GRID).entity() {
|
||||
info!(
|
||||
"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
|
||||
if let Some(count) = ctx.get_widget(form_entity).children_count() {
|
||||
for c in 1..=count {
|
||||
info!("WIP clear entry of child {:?}", c);
|
||||
//info!("WIP clear entry of child {:?}: {:?}", c, ctx.get_child(form_entity).get::<String>("name"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_form(entity: Entity, ctx: &mut Context<'_>, lang: &str) {
|
||||
// type conversion (String -> u64)
|
||||
//let policy_code = ctx.child(ID_TICKET_DATA_POLICY_CODE).get::<String>("text").unwrap().parse::<u64>().unwrap();
|
||||
|
||||
// WIP: get selected items ComboBox'es
|
||||
//let mail_cc_index = *TicketdataView::selected_index_ref(&ctx.widget()) as usize;
|
||||
//let mail_cc_selected = TicketdataView::mail_cc_ref(&ctx.widget())[mail_cc_index].clone();
|
||||
|
||||
// create Email structures
|
||||
let email = Email {
|
||||
// WIP: mail_to -> selected index auslesen
|
||||
//mail_to: ctx.child(ID_TICKET_DATA_MAIL_TO).get::<String>("text").to_string(),
|
||||
// WIP: mail_cc -> selected index auslesen
|
||||
//mail_cc: ctx.child(ID_TICKET_DATA_MAIL_CC).get::<String>("text").to_string(),
|
||||
mail_to: PROP_MAIL_TO_1.to_string(),
|
||||
mail_cc: PROP_MAIL_CC_1.to_string(),
|
||||
mail_bcc: PROP_MAIL_BCC_1.to_string(),
|
||||
mail_from: PROP_MAIL_FROM.to_string(),
|
||||
mail_reply: PROP_MAIL_REPLY.to_string(),
|
||||
subject: PROP_MAIL_SUBJECT.to_string(),
|
||||
policy_code: ctx
|
||||
.child(ID_TICKET_DATA_POLICY_CODE)
|
||||
.get::<String>("text")
|
||||
.to_string(),
|
||||
policy_holder: ctx
|
||||
.child(ID_TICKET_DATA_POLICY_HOLDER)
|
||||
.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);
|
||||
// send email via service
|
||||
let _ = sendticketdata(&email, &lang);
|
||||
}
|
||||
}
|
||||
|
||||
/// Supported methods handled inside the `TicketState`
|
||||
impl State for TicketdataState {
|
||||
/// Initialize the state of widgets inside `TicketState`
|
||||
fn init(&mut self, _: &mut Registry, ctx: &mut Context<'_>) {
|
||||
let time_start = SystemTime::now();
|
||||
|
||||
trace!(target: "advotracker", ticketdata_state = "init", status = "started");
|
||||
|
||||
// Initialize required entities
|
||||
self.button_menu = ctx
|
||||
.entity_of_child(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")
|
||||
.expect("TicketState.init: Can't find resource entity 'target'."),
|
||||
);
|
||||
|
||||
// Get language from environment
|
||||
self.lang = TicketdataState::get_lang();
|
||||
|
||||
let time_end = SystemTime::now();
|
||||
let duration = time_end.duration_since(time_start);
|
||||
|
||||
trace!(target: "advotracker", ticketdata_state = "init", status = "finished", duration = ?duration);
|
||||
}
|
||||
|
||||
fn messages(
|
||||
&mut self,
|
||||
mut messages: MessageReader,
|
||||
_registry: &mut Registry,
|
||||
ctx: &mut Context<'_>,
|
||||
) {
|
||||
for message in messages.read::<TicketdataAction>() {
|
||||
match message {
|
||||
TicketdataAction::ClearForm() => {
|
||||
info!("message: {:?} recieved", message);
|
||||
TicketdataState::clear_form(ctx.entity(), ctx);
|
||||
}
|
||||
TicketdataAction::SendForm() => {
|
||||
info!("message: {:?} recieved", message);
|
||||
TicketdataState::send_form(ctx.entity(), ctx, &self.lang);
|
||||
}
|
||||
_ => {
|
||||
println!("messages: action not implemented!");
|
||||
}
|
||||
}
|
||||
}
|
||||
for message in messages.read::<PolicycheckAction>() {
|
||||
match message {
|
||||
PolicycheckAction::UpdatePolicyCode => {
|
||||
info!("Message received: 'PolicycheckAction::UpdatePolicyCode'");
|
||||
TextBlock::text_set(&mut ctx.child(ID_TICKET_DATA_POLICY_CODE), policy_code);
|
||||
}
|
||||
_ => {
|
||||
println!("messages: action not implemented!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, _: &mut Registry, ctx: &mut Context<'_>) {
|
||||
let actions: Vec<TicketdataAction> = self.actions.drain(..).collect();
|
||||
|
||||
for action in actions {
|
||||
match action {
|
||||
TicketdataAction::ClearForm() => {
|
||||
info!("update: send_message {:?}", action);
|
||||
ctx.send_message(TicketdataAction::ClearForm(), self.target);
|
||||
}
|
||||
TicketdataAction::SendForm() => {
|
||||
//ctx.send_message(TicketdataAction::SendForm(), self.ID_TICKETDATA_FORM);
|
||||
info!("update: send_message {:?}", action);
|
||||
}
|
||||
_ => {
|
||||
println!("TicketdataAction: action not implemented!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// send ticket data via eMail
|
||||
pub fn sendticketdata(email: &Email, lang: &str) -> Result<(), Box<dyn Error>> {
|
||||
let mut res = t!("sendticketdata.export.started", lang);
|
||||
let mut state = t!("state.started", lang);
|
||||
trace!(target: "sendticketdata", process = ?res, state = ?state);
|
||||
|
||||
let ascii_body = String::new()
|
||||
+ &"Vers.-Schein/Schadennummer".to_string()
|
||||
+ &(email.policy_code)
|
||||
+ &"\n"
|
||||
+ &"Versicherungsnehmer: ".to_string()
|
||||
+ &(email.policy_holder)
|
||||
+ &"\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);
|
||||
|
||||
let message = Message::builder()
|
||||
//.reply_to("Kanzlei Hiedemann <info@hiedemann.de>".parse().unwrap())
|
||||
.to("Kanzlei Hiedemann <info@hiedemann.de>".parse().unwrap())
|
||||
.cc(" <ralf.zerres@networkx.de>".parse().unwrap())
|
||||
.reply_to((email.mail_reply).parse().unwrap())
|
||||
//.to((email.mail_to).parse().unwrap())
|
||||
//.cc((email.mail_cc).parse().unwrap())
|
||||
//.bcc((email.mail_bcc).parse().unwrap())
|
||||
.from((email.mail_from).parse().unwrap())
|
||||
.subject(
|
||||
String::new()
|
||||
+ &email.subject.to_string()
|
||||
+ &" (".to_string()
|
||||
+ &email.policy_code.to_string()
|
||||
+ &")".to_string(),
|
||||
)
|
||||
.multipart(
|
||||
MultiPart::alternative() // This is composed of two parts.
|
||||
.singlepart(
|
||||
SinglePart::builder()
|
||||
.header(header::ContentType(
|
||||
"text/plain; charset=utf8".parse().unwrap(),
|
||||
))
|
||||
.body(String::from(ascii_body)),
|
||||
),
|
||||
)
|
||||
.expect("failed to build email");
|
||||
|
||||
info!("message: {:?}", message);
|
||||
|
||||
trace!(target: "sendticketdata", email = ?email);
|
||||
state = t!("state.finished", lang);
|
||||
res = t!("sendticketdata.export.finished", lang);
|
||||
trace!(target: "sendticketdata", process = ?res, state = ?state);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
7
advotracker_client/examples/csv-test/.env
Normal file
@@ -0,0 +1,7 @@
|
||||
# set the language variable used in test-runs
|
||||
#test lang=de
|
||||
TEST_LANG=en
|
||||
#RUST_LOG=csv-test=trace
|
||||
RUST_LOG=trace
|
||||
USERNAME=ralf
|
||||
DB_DRIVER=sqlite
|
||||
23
advotracker_client/examples/csv-test/data/POLLFNR_MINI.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
DION VERS POLLFNR
|
||||
1 AS 1
|
||||
1 AS 11
|
||||
1 AS 123456789
|
||||
9 AS 99
|
||||
9 AS 999
|
||||
1 AS 1511111111
|
||||
1 AS 1511111119
|
||||
1 AS 9000000001
|
||||
1 AS 9000000002
|
||||
1 AS 9999999991
|
||||
1 AS 9999999992
|
||||
1 AS 9999999999
|
||||
3 AS 1515735920
|
||||
3 AS 9999999991
|
||||
3 AS 9999999992
|
||||
3 AS 9999999999
|
||||
9 AS 9927764110
|
||||
9 AS 9927764251
|
||||
9 AS 9927764426
|
||||
9 AS 9999999991
|
||||
9 AS 9999999992
|
||||
9 AS 9999999999
|
||||
15498
advotracker_client/examples/csv-test/data/POLLFNR_TEST.txt
Normal file
@@ -0,0 +1 @@
|
||||
../../../data/POLLFNR_WOECHENTLICH.txt
|
||||
427
advotracker_client/examples/csv-test/main.rs
Normal file
@@ -0,0 +1,427 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* advotracker - Hotline tackingtool for Advocats
|
||||
*
|
||||
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
*/
|
||||
|
||||
use chrono::{DateTime, Local};
|
||||
use locales::t;
|
||||
//use serde::{Deserialize, Serialize};
|
||||
use serde::Deserialize;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
env,
|
||||
{error::Error, process},
|
||||
//path::{Path, PathBuf},
|
||||
};
|
||||
use tracing::{debug, trace, Level};
|
||||
|
||||
use advotracker::data::structures::{PolicyCode, PolicyData, PolicyDataList, PolicyList};
|
||||
|
||||
// include modules
|
||||
mod parse_args;
|
||||
|
||||
/// respect environment variables set in .env files
|
||||
/// located in the current call directory
|
||||
/// this is primarily used in testing scenarios (eg. debugging)
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Environment {
|
||||
test_lang: String,
|
||||
log: String,
|
||||
}
|
||||
|
||||
/// export as csv format
|
||||
/// https://docs.rs/csv/1.1.3/csv/cookbook/index.html
|
||||
/// https://blog.burntsushi.net/csv/
|
||||
fn export(p: &mut String, lang: &String) -> Result<u64, Box<dyn Error>> {
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
//use std::ffi::OsStr;
|
||||
use std::io::prelude::*;
|
||||
|
||||
let mut res = t!("csv.export.started", lang);
|
||||
let mut state = t!("state.started", lang);
|
||||
let dt_start: DateTime<Local> = Local::now();
|
||||
|
||||
trace!(target: "csv-test",
|
||||
process = ?res,
|
||||
state = ?state,
|
||||
date_start = ?dt_start.to_string());
|
||||
|
||||
// Note: slash syntax also works on Windows!
|
||||
let path = Path::new(p);
|
||||
|
||||
// open the file descriptor
|
||||
let mut file = File::create(path)?;
|
||||
trace!(target: "csv-export", extension = ?path.extension(), file = ?file);
|
||||
|
||||
// Build the CSV writer and push selected records.
|
||||
//for result in csv_reader.records() {
|
||||
let mut count = 0;
|
||||
file.write_all(b"Allianz DirectCall Protokoll!")?;
|
||||
count += 1;
|
||||
|
||||
let dt_end: DateTime<Local> = Local::now();
|
||||
let duration = dt_end.signed_duration_since(dt_start);
|
||||
println!("Duration: {:#?}", duration);
|
||||
|
||||
trace!(target: "csv-test", record_count = ?count, duration = ?duration);
|
||||
state = t!("state.finished", lang);
|
||||
res = t!("csv.import.finished", lang);
|
||||
trace!(target: "csv-test", process = ?res, state = ?state);
|
||||
|
||||
Ok(count)
|
||||
}
|
||||
|
||||
/// import from csv format
|
||||
/// https://docs.rs/csv/1.1.3/csv/cookbook/index.html
|
||||
/// https://blog.burntsushi.net/csv/
|
||||
fn import(
|
||||
p: &mut String,
|
||||
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::path::Path;
|
||||
|
||||
let mut res = t!("csv.import.started", lang);
|
||||
let mut state = t!("state.started", lang);
|
||||
let dt_start: DateTime<Local> = Local::now();
|
||||
|
||||
trace!(target: "csv-test",
|
||||
process = ?res,
|
||||
state = ?state,
|
||||
date_start = ?dt_start.to_string());
|
||||
|
||||
// Note: slash syntax also workd on Windows!
|
||||
let path = Path::new(p);
|
||||
|
||||
// must be a readable file
|
||||
trace!(target: "csv-test", path = ?path);
|
||||
assert_eq!(path.is_file(), true);
|
||||
|
||||
// only accept files with '.txt' extensions
|
||||
let extension = path.extension();
|
||||
assert_eq!(extension, Some(OsStr::new("txt")));
|
||||
|
||||
// open the file
|
||||
let file = File::open(path)?;
|
||||
|
||||
trace!(target: "csv-test",
|
||||
extension = ?extension,
|
||||
file = ?file,
|
||||
data_list = ?data_list.name);
|
||||
|
||||
// Build the CSV reader and iterate over each record.
|
||||
let mut csv_reader = csv::ReaderBuilder::new()
|
||||
.has_headers(true)
|
||||
.delimiter(b' ')
|
||||
.flexible(true)
|
||||
//.comment(Some(b'#'))
|
||||
//.from_reader(io::stdin());
|
||||
//.from_path(path);
|
||||
.from_reader(file);
|
||||
{
|
||||
// We nest this call in its own scope because of lifetimes.
|
||||
let headers = csv_reader.headers()?;
|
||||
trace!(target: "csv-test", header = ?headers);
|
||||
}
|
||||
|
||||
// Deserialize the input data and push result to target vector
|
||||
let mut count = 0;
|
||||
for result in csv_reader.deserialize() {
|
||||
// The iterator yields Result<StringRecord, Error>, so we check the
|
||||
// error here.
|
||||
let record: PolicyData = result?;
|
||||
//println!("{:?}", record);
|
||||
|
||||
// WIP: write to redis backend
|
||||
// append the policy_number to the HashMap
|
||||
policy_numbers.insert(record.policy_number, record.policy_code);
|
||||
|
||||
// push record as new vector elements
|
||||
data_list.push(record);
|
||||
|
||||
count += 1;
|
||||
}
|
||||
|
||||
let dt_end: DateTime<Local> = Local::now();
|
||||
let duration = dt_end.signed_duration_since(dt_start);
|
||||
|
||||
trace!(target: "csv-test", record_count = ?count, duration = ?duration);
|
||||
|
||||
state = t!("state.finished", lang);
|
||||
res = t!("csv.import.finished", lang);
|
||||
trace!(target: "csv-test",
|
||||
process = ?res,
|
||||
state = ?state,
|
||||
date_stop = ?dt_end.to_string());
|
||||
|
||||
Ok(count)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
/// validate a given policy number
|
||||
/// result will return true or false
|
||||
fn is_valid(
|
||||
policy_number: &u64,
|
||||
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 state = t!("state.started", lang);
|
||||
let dt_start: DateTime<Local> = Local::now();
|
||||
|
||||
trace!(target: "csv-test",
|
||||
process = ?res,
|
||||
state = ?state,
|
||||
policy_number = ?policy_number,
|
||||
policy_list = ?policy_list.name,
|
||||
elements = ?policy_list.policy_data.len(),
|
||||
date_start = ?dt_start.to_string());
|
||||
//println!("Policy_number list: {:?}", policy_list.policy_data);
|
||||
|
||||
// WIP: testcode to collect policy_number via iterator
|
||||
//println!("policy_number: {:?}", policy_list.policy_data[1].policy_number);
|
||||
//println!("Policy_number list: {:?}", policy_list.policy_data);
|
||||
// println!("policy_list: {:?} (with {:?} elements)",
|
||||
// policy_list.name, policy_list.policy_data.len());
|
||||
|
||||
// policy_list.into_iter()
|
||||
// .filter(|num| matches(w, w1))
|
||||
// .clone
|
||||
// .collect::<Vec<policy_number>>()
|
||||
// let my_num = policy_list.policy_data.iter()
|
||||
// .map(|policy_number| {
|
||||
// policy_number
|
||||
// })
|
||||
// .collect::<Vec<_>>();
|
||||
|
||||
//println!("My policy_numbers: {:?}", my_num);
|
||||
|
||||
// let mut my_policy_list = [
|
||||
// [ ("Jack", 20), ("Jane", 23), ("Jill", 18), ("John", 19), ],
|
||||
// [ ("Bill", 17), ("Brenda", 16), ("Brad", 18), ("Barbara", 17), ]
|
||||
// ];
|
||||
|
||||
// let teams_in_score_order = teams
|
||||
// .iter_mut()
|
||||
// .map(|team| {
|
||||
// team.sort_by(|&a, &b| a.1.cmp(&b.1).reverse());
|
||||
// team
|
||||
// })
|
||||
// .collect::<Vec<_>>();
|
||||
|
||||
//println!("Teams: {:?}", teams_in_score_order);
|
||||
|
||||
// if policy_list.policy_data.iter().any(|v| v == policy_number) {
|
||||
// println!("{:?} contains {}", policy_list.name, policy_number);
|
||||
// } else {
|
||||
// println!("{:?} doesn't contain {}", policy_list, policy_number);
|
||||
//}
|
||||
|
||||
// let test: Vec<_> = vec!["one", "two", "three"];
|
||||
// let index: usize = test.iter().enumerate().find(|&r| r.1.to_string() == "two".to_string()).unwrap().0;
|
||||
// println!("index: {:?} -> {:?}", index, test[index]);
|
||||
|
||||
//let index: usize = test.iter().enumerate().find(|&r| r.policy_number == "two".to_string()).unwrap().0;
|
||||
|
||||
let mut result = false;
|
||||
match policy_numbers.get(&policy_number) {
|
||||
Some(&policy_code) => {
|
||||
let res = t!("policy.validation.success", lang);
|
||||
println!("policy_number: {} ({:?})", policy_number, policy_code);
|
||||
result = true;
|
||||
trace!(target: "csv-test",
|
||||
policy_number = ?policy_number,
|
||||
validation = ?res,
|
||||
policy_code = ?policy_code);
|
||||
}
|
||||
_ => {
|
||||
let res = t!("policy.validation.failed", lang);
|
||||
//println!("Noop! Number isn't valid!");
|
||||
println!("{:?}", res);
|
||||
trace!(target: "csv-test",
|
||||
policy_number = ?policy_number,
|
||||
validation = ?res);
|
||||
}
|
||||
}
|
||||
|
||||
let dt_end: DateTime<Local> = Local::now();
|
||||
let duration = dt_end.signed_duration_since(dt_start);
|
||||
|
||||
res = t!("policy.validation.finished", lang);
|
||||
state = t!("state.finished", lang);
|
||||
trace!(target: "csv-test",
|
||||
process = ?res,
|
||||
state = ?state,
|
||||
date_stop = ?dt_end.to_string(),
|
||||
duration = ?duration);
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
use dotenv::dotenv;
|
||||
use parse_args::parse_args;
|
||||
//use std::process;
|
||||
//use std::sync::Arc;
|
||||
use tracing_subscriber::fmt;
|
||||
use viperus::Viperus;
|
||||
|
||||
//static DEFAULT_FILTER: &str = concat!(module_path!(), "=", "trace");
|
||||
|
||||
// initialize the tracing subsystem
|
||||
// a drop in replacement for classical logging
|
||||
// reference: https://tokio.rs/blog/2019-08-tracing/
|
||||
let span = tracing::span!(Level::TRACE, "csv-test");
|
||||
let _enter = span.enter();
|
||||
let subscriber = fmt::Subscriber::builder()
|
||||
.with_env_filter("trace")
|
||||
//.with_max_level(tracing::Level::DEBUG)
|
||||
.finish();
|
||||
|
||||
tracing::subscriber::with_default(subscriber, || {
|
||||
// get system environment
|
||||
let mut lang = env::var("LANG").unwrap_or("en".to_string());
|
||||
let mut res = t!("parse.environment", lang);
|
||||
let mut state = t!("state.started", lang);
|
||||
trace!(target: "csv-test", message = ?res, state = ?state);
|
||||
//debug!(message = ?res, state = ?state);
|
||||
trace!(target: "csv-test", environment = "system", lang = ?lang);
|
||||
|
||||
// testing environment: read from .env file
|
||||
dotenv().ok();
|
||||
match envy::from_env::<Environment>() {
|
||||
Ok(environment) => {
|
||||
if environment.test_lang != lang {
|
||||
lang = environment.test_lang;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
debug!(target: "csv-test", "{}", e);
|
||||
}
|
||||
}
|
||||
// how to handle unumplemented lang resources??
|
||||
res = t!("parse.environment", lang);
|
||||
trace!(target: "csv-test", environment = "envy", lang = ?lang);
|
||||
state = t!("state.finished", lang);
|
||||
trace!(target: "csv-test", message = ?res, state = ?state);
|
||||
|
||||
// initialize viperus structure
|
||||
let mut v = Viperus::new();
|
||||
|
||||
// parse commandline arguments
|
||||
res = t!("parse.arguments", lang);
|
||||
state = t!("state.started", lang);
|
||||
trace!(target: "csv-test", process = ?res, state = ?state);
|
||||
|
||||
let _ = parse_args(&mut v);
|
||||
state = t!("state.finished", lang);
|
||||
trace!(target: "csv-test", process = ?res, state = ?state);
|
||||
//trace!(target: "Viperus", "Config results: {:?}", v);
|
||||
|
||||
// main tasks
|
||||
res = t!("main.started", lang);
|
||||
state = t!("state.started", lang);
|
||||
trace!(target: "csv-test", process = ?res, state = ?state);
|
||||
|
||||
// create policy structures
|
||||
let policy_list = PolicyList::new("Allianz Versicherungsnummen-Liste");
|
||||
println!("Policy List {:?} ", policy_list.name);
|
||||
|
||||
let mut policy_data = PolicyDataList::new("Allianz-Import 20200628");
|
||||
println!("Policy Data List {:?} ", policy_data.name);
|
||||
|
||||
let mut policy_numbers: HashMap<u64, PolicyCode> = HashMap::new();
|
||||
|
||||
let mut csv_import_path = v.get::<String>("import_file").unwrap();
|
||||
match import(
|
||||
&mut csv_import_path,
|
||||
&mut policy_data,
|
||||
&mut policy_numbers,
|
||||
&lang,
|
||||
) {
|
||||
Ok(count) => {
|
||||
println!("Imported {:?} records", count);
|
||||
}
|
||||
Err(err) => {
|
||||
println!("error running Csv-Test: {}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// test if policy_number is_valid
|
||||
// type conversion (viperus String -> u64)
|
||||
let test_policy_number = v
|
||||
.get::<String>("test_policy_number")
|
||||
.unwrap()
|
||||
.parse::<u64>()
|
||||
.unwrap();
|
||||
trace!(target: "csv-test", test_policy_number = ?test_policy_number);
|
||||
//match is_valid(&policy_number, &policy_data, &mut policy_numbers, &lang) {
|
||||
// Ok(true) => {
|
||||
// use Hashmap method 'get' to check if we have the given key
|
||||
match policy_numbers.get(&test_policy_number) {
|
||||
Some(&policy_code) => {
|
||||
let res = t!("policy.validation.success", lang);
|
||||
println!("{:?}", res);
|
||||
println!("policy_number: {} ({:?})", test_policy_number, policy_code);
|
||||
}
|
||||
_ => {
|
||||
let res = t!("policy.validation.failed", lang);
|
||||
println!("{:?}", res);
|
||||
//println!("Nuup! Number isn't valid!");
|
||||
}
|
||||
}
|
||||
|
||||
// export policy code elements to csv-file
|
||||
let mut csv_export_path = v.get::<String>("export_file").unwrap();
|
||||
match export(&mut csv_export_path, &lang) {
|
||||
Ok(count) => {
|
||||
println!("Exported {:?} records", count);
|
||||
}
|
||||
Err(err) => {
|
||||
println!("error running CSV-Export: {}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
state = t!("state.finished", lang);
|
||||
res = t!("main.finished", lang);
|
||||
trace!(target: "csv-test", process = ?res, state = ?state);
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_policy_number() {
|
||||
// Takes a reference and returns Option<&V>
|
||||
let my_policy_numbers: [u64; 2] = [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 = String::from("data/POLLFNR_TEST.txt");
|
||||
|
||||
let mut policy_data = PolicyDataList::new("PolicyDataList");
|
||||
let mut policy_numbers: HashMap<u64, PolicyCode> = HashMap::new();
|
||||
let lang = "en".to_string();
|
||||
|
||||
println!(
|
||||
"import with Path: {:?} PolicyData: {:?} PolicyNumbers: {:?}, Lang: {:?}",
|
||||
csv_import_path, policy_data, policy_numbers, lang
|
||||
);
|
||||
let count = import(
|
||||
&mut csv_import_path,
|
||||
&mut policy_data,
|
||||
&mut policy_numbers,
|
||||
&lang,
|
||||
);
|
||||
|
||||
assert_eq!(count.unwrap(), 15498);
|
||||
}
|
||||
223
advotracker_client/examples/csv-test/parse_args.rs
Normal file
@@ -0,0 +1,223 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* advotracker - Hotline tackingtool for Advocats
|
||||
*
|
||||
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
*/
|
||||
|
||||
// parse CLI commandline arguments with clap
|
||||
use clap::{crate_authors, crate_description, crate_name, crate_version, App, Arg};
|
||||
|
||||
//use log::{debug, info, trace, warn};
|
||||
use std::env;
|
||||
use tracing::trace;
|
||||
use viperus::Viperus;
|
||||
|
||||
/// Parse the commandline arguments and preset default values
|
||||
/// Precedence: defaults -> config-file -> environment -> commandline
|
||||
pub fn parse_args(v: &mut Viperus) -> Result<(), Box<dyn std::error::Error>> {
|
||||
if cfg!(feature = "fmt-clap") {
|
||||
trace!(target: "Viperus", "Viperus feature 'fmt-clap' enabled.");
|
||||
println!("Using feature fmt-clap");
|
||||
}
|
||||
|
||||
// preset default key/value pairs (lowest priority)
|
||||
v.add_default("config_file", String::from("csv_import.ron"));
|
||||
v.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt"));
|
||||
v.add_default("export_file", String::from(""));
|
||||
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(
|
||||
"from_email_address_file",
|
||||
String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>"),
|
||||
);
|
||||
//v.add_default("username", String::from("nctalkbot"));
|
||||
//v.add_default("password", String::from("botpassword"));
|
||||
v.add_default("verbose", 0);
|
||||
|
||||
// CLI arguments are defined inline
|
||||
let matches = App::new("csv-test")
|
||||
.name(crate_name!())
|
||||
.version(crate_version!())
|
||||
.author(crate_authors!())
|
||||
.about(crate_description!())
|
||||
.after_help(
|
||||
"
|
||||
Testprogramm: Allianz Online-Beratung Im/Export CSV-Daten
|
||||
Direct-Call via IVR-System (Interactive Voice Response)
|
||||
SMR Deckungssummen-Prüfung: 089 92529 60211
|
||||
SMR Unerledigt: 089 92529 60222",
|
||||
)
|
||||
.template(
|
||||
"\
|
||||
{bin} v{version}
|
||||
{about}
|
||||
|
||||
{all-args}
|
||||
|
||||
(C) 2020 {author}
|
||||
{after-help}",
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("configFile")
|
||||
.short("c")
|
||||
.long("configFile")
|
||||
.value_name("FILE")
|
||||
.help("Select a config file")
|
||||
.default_value("csv_import.ron")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("importFile")
|
||||
.short("i")
|
||||
.long("importFile")
|
||||
.help("Select source file for the csv-import")
|
||||
.default_value("POLLFNR_WOECHENTLICH.txt")
|
||||
//.default_value("POLLFNR_MINI.txt")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("exportFile")
|
||||
.short("e")
|
||||
.long("exportFile")
|
||||
.help("Select target file for the csv-export")
|
||||
.default_value("RA-Hiedemann_DirectCall.txt")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("fromEmailAddress")
|
||||
.short("f")
|
||||
.long("fromEmailAddress")
|
||||
.help("Select the sender email-address (From:)")
|
||||
.default_value("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("toEmailAddress")
|
||||
.short("t")
|
||||
.long("toEmailAddress")
|
||||
.help("Select the target email-address (To:)")
|
||||
.default_value("Allianz RA-Hotline <smr-rahotline@allianz.de>")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("testPolicyNumber")
|
||||
.short("p")
|
||||
.long("testPolicyNumber")
|
||||
.help("Test validity of given policy number")
|
||||
//.default_value("")
|
||||
.takes_value(true),
|
||||
)
|
||||
// .arg(
|
||||
// Arg::with_name("username")
|
||||
// .short("u")
|
||||
// .long("username")
|
||||
// .help("Sets username")
|
||||
// .takes_value(true),
|
||||
// )
|
||||
// .arg(
|
||||
// Arg::with_name("password")
|
||||
// .short("P")
|
||||
// .long("password")
|
||||
// .help("Sets password")
|
||||
// .takes_value(true),
|
||||
// )
|
||||
.arg(
|
||||
Arg::with_name("verbose")
|
||||
.short("v")
|
||||
.long("verbose")
|
||||
.help("Sets verbosity level")
|
||||
.multiple(true),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
if matches.occurrences_of("verbose") > 0 {
|
||||
// clap is using i64, viperus i32
|
||||
let n = matches.occurrences_of("verbose") as i32;
|
||||
v.add("verbose", n);
|
||||
}
|
||||
|
||||
// preset the prefix for relevant environment variables ("ADVOTRACKER_")
|
||||
let mut env_prefix: String = crate_name!().to_uppercase();
|
||||
env_prefix.push_str("_");
|
||||
v.set_env_prefix(&env_prefix);
|
||||
|
||||
// respect dotenv environment (e.g for testing)
|
||||
// -> overwrites the preset default values
|
||||
println!(
|
||||
"RUST_LOG={}",
|
||||
dotenv::var("RUST_LOG").unwrap_or_else(|_| String::from("None"))
|
||||
);
|
||||
|
||||
// enable caching and automatic update of environment values
|
||||
v.cache(true);
|
||||
v.automatic_env(true);
|
||||
|
||||
// load user selected call arguments
|
||||
// -> overwrites values given via environment variables
|
||||
v.load_clap(matches)?;
|
||||
|
||||
// bond the clap names to camel_case rust variable names
|
||||
v.bond_clap("configFile", "config_file");
|
||||
v.bond_clap("importFile", "import_file");
|
||||
v.bond_clap("exportFile", "export_file");
|
||||
v.bond_clap("toEmailAddress", "to_email_address");
|
||||
v.bond_clap("fromEmailAddress", "from_email_address");
|
||||
v.bond_clap("testPolicyNumber", "test_policy_number");
|
||||
//v.bond_clap("username", "username");
|
||||
//v.bond_clap("password", "password");
|
||||
v.bond_clap("verbose", "verbose");
|
||||
|
||||
trace!("verbose {:?}", v.get::<i32>("verbose").unwrap());
|
||||
if v.get::<i32>("verbose").unwrap() > 0 {
|
||||
println!(
|
||||
"config_file: {:?}",
|
||||
v.get::<String>("config_file").unwrap_or_default()
|
||||
);
|
||||
println!(
|
||||
"import_file: {:?}",
|
||||
v.get::<String>("import_file").unwrap_or_default()
|
||||
);
|
||||
println!(
|
||||
"export_file: {:?}",
|
||||
v.get::<String>("export_file").unwrap_or_default()
|
||||
);
|
||||
println!(
|
||||
"to_email_address: {:?}",
|
||||
v.get::<String>("to_email_address").unwrap_or_default()
|
||||
);
|
||||
println!(
|
||||
"from_email_address: {:?}",
|
||||
v.get::<String>("from_email_address").unwrap_or_default()
|
||||
);
|
||||
println!(
|
||||
"test_policy_number: {:?}",
|
||||
v.get::<String>("test_policy_number").unwrap_or_default()
|
||||
);
|
||||
// println!(
|
||||
// "username: {:?}",
|
||||
// v.get::<String>("username").unwrap_or_default()
|
||||
// );
|
||||
// println!(
|
||||
// "password: {:?}",
|
||||
// v.get::<String>("password").unwrap_or_default()
|
||||
// ); // only for testing now
|
||||
|
||||
println!(
|
||||
"verbosity level: {:?}",
|
||||
v.get::<i32>("verbose").unwrap_or_default()
|
||||
);
|
||||
}
|
||||
|
||||
if v.get::<i32>("verbose").unwrap() > 1 {
|
||||
println!("\nEnvironment:");
|
||||
for (key, value) in env::vars() {
|
||||
println!("{}={}", key, value);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
47
advotracker_client/examples/email_test.rs
Normal file
@@ -0,0 +1,47 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* advotracker - Hotline tackingtool for Advocats
|
||||
|
||||
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
*/
|
||||
|
||||
use lettre::{transport::smtp::authentication::Credentials, Message, SmtpTransport, Transport};
|
||||
|
||||
fn main() {
|
||||
let email = Message::builder()
|
||||
.from("Info <info@networkx.de>".parse().unwrap())
|
||||
.reply_to("Support <support@networkx.de>".parse().unwrap())
|
||||
.to("Ralf Zerres <ralf.zerres@networkx.de>".parse().unwrap())
|
||||
.subject("Eine advotracker eMail")
|
||||
.body("Eine neue advotracker eMail!".to_string())
|
||||
.unwrap();
|
||||
|
||||
// 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.de@gmail.com".to_string(),
|
||||
"20jacara03".to_string(),
|
||||
);
|
||||
|
||||
// Open a remote connection to relay server
|
||||
//let mailer = SmtpTransport::relay("nwxex.networkx.de")
|
||||
let mailer = SmtpTransport::relay("smtp.gmail.com")
|
||||
.unwrap()
|
||||
.credentials(creds)
|
||||
.build();
|
||||
|
||||
// Open a remote connection to gmail using STARTTLS
|
||||
// let mailer = SmtpTransport::starttls_relay("nwxex.networkx.de")
|
||||
// .unwrap()
|
||||
// .credentials(creds)
|
||||
// .build();
|
||||
|
||||
// Open a local connection on port 25
|
||||
//let mailer = SmtpTransport::unencrypted_localhost();
|
||||
|
||||
// Send the email
|
||||
match mailer.send(&email) {
|
||||
Ok(_) => println!("Email sent successfully!"),
|
||||
Err(e) => panic!("Could not send email: {:?}", e),
|
||||
}
|
||||
}
|
||||
126
advotracker_client/examples/increment_progress_bar.rs
Normal file
@@ -0,0 +1,126 @@
|
||||
use std::collections::HashMap;
|
||||
//use std::sync::mpsc;
|
||||
|
||||
use orbtk::prelude::*;
|
||||
use orbtk::shell::WindowRequest;
|
||||
|
||||
static ID_CHECK_POLICY_NUMBER: &'static str = "ID_CHECK_POLICY_NUMBER";
|
||||
static ID_PROGRESS_BAR: &'static str = "ID_PROGRESS_BAR";
|
||||
|
||||
enum Action {
|
||||
ParsePolicyNumber,
|
||||
}
|
||||
|
||||
#[derive(Default, AsAny)]
|
||||
struct MainViewState {
|
||||
action: Option<Action>,
|
||||
progress_bar: Entity,
|
||||
text_box: Entity,
|
||||
progress_counter: f64, //records: HashMap::<String, String>,
|
||||
//record_counter: u64
|
||||
}
|
||||
|
||||
impl State for MainViewState {
|
||||
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.progress_bar = ctx
|
||||
.entity_of_child(ID_PROGRESS_BAR)
|
||||
.expect("Cannot get progress bar !");
|
||||
}
|
||||
|
||||
fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||
// if there is an action, process it
|
||||
if let Some(action) = &self.action {
|
||||
match action {
|
||||
Action::ParsePolicyNumber => {
|
||||
let value_to_parse = ctx
|
||||
.get_widget(self.text_box)
|
||||
.get::<String16>("text")
|
||||
.clone();
|
||||
self.parse_policy_number(value_to_parse, ctx);
|
||||
}
|
||||
}
|
||||
// Reset action
|
||||
self.action = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MainViewState {
|
||||
fn action(&mut self, action: Action) {
|
||||
self.action = Some(action);
|
||||
}
|
||||
|
||||
fn parse_policy_number(&mut self, _value: String16, ctx: &mut Context) {
|
||||
self.import_csv(ctx);
|
||||
}
|
||||
|
||||
fn import_csv(&mut self, ctx: &mut Context) {
|
||||
// code to import csv file into a hashmap
|
||||
// will read in number_of_records = 100%
|
||||
// progress_counter should be incremented, if
|
||||
// read_in_loop will reach next 10% -> self.progress_counter += 0.1
|
||||
// now fire an event to update the widget
|
||||
|
||||
// question: how to fire up the event inside import_csv function,
|
||||
// without the need to mute "ID_CHECK_POLICY_NUMBER" ?
|
||||
|
||||
// given code just increments, if you change "ID_CHECK_POLICY_NUMBER"
|
||||
self.progress_counter += 0.1;
|
||||
self.update_progress(ctx);
|
||||
}
|
||||
|
||||
fn update_progress(&self, ctx: &mut Context) {
|
||||
// create a mpsc::Sender<WindowRequest> object
|
||||
let sender = ctx.window_sender();
|
||||
let mut pgbar = ctx.get_widget(self.progress_bar);
|
||||
pgbar.set::<f64>("val", self.progress_counter);
|
||||
// redraw screen if sender has changed
|
||||
// only way to trigger a redraw: create an event
|
||||
sender.send(WindowRequest::Redraw).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
widget!(MainView<MainViewState>);
|
||||
|
||||
impl Template for MainView {
|
||||
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
||||
self.margin(32.0).child(
|
||||
Stack::new()
|
||||
.orientation("vertical")
|
||||
.h_align("center")
|
||||
.v_align("top")
|
||||
.spacing(8.0)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.id(ID_CHECK_POLICY_NUMBER)
|
||||
.water_mark("Mut value and type <Return>")
|
||||
.on_activate(move |states, _entity| {
|
||||
// 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);
|
||||
})
|
||||
.build(ctx),
|
||||
)
|
||||
.child(ProgressBar::new().id(ID_PROGRESS_BAR).build(ctx))
|
||||
.build(ctx),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
Application::new()
|
||||
.window(|ctx| {
|
||||
Window::new()
|
||||
.title("incroment_progress_bar skeleton")
|
||||
.position((100.0, 100.0))
|
||||
.size(420.0, 730.0)
|
||||
.resizeable(true)
|
||||
.child(MainView::new().build(ctx))
|
||||
.build(ctx)
|
||||
})
|
||||
.run();
|
||||
}
|
||||
23
advotracker_client/examples/messages_test/data/constants.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* OrbTK - The Orbital Widget Toolkit
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
* SPDX-License-Identifier: (0BSD or MIT)
|
||||
*/
|
||||
|
||||
// constants
|
||||
pub static ID_RECEIVER: &str = "Receiver_Widget";
|
||||
pub static ID_RECEIVER_CONTAINER: &str = "reciever_container";
|
||||
pub static ID_RECEIVER_PROGRESS_BAR: &str = "receiver_progress_bar";
|
||||
pub static ID_RECEIVER_TEXT_BLOCK: &str = "receiver_text_block";
|
||||
//pub static ID_RECEIVER_MESSAGE_BOX: &str = "receiver_message_box";
|
||||
pub static ID_RECEIVER_MESSAGE_BLOCK: &str = "receiver_message_block";
|
||||
//pub static ID_RECEIVER_MESSAGE: &str = "receiver_message";
|
||||
|
||||
pub static ID_SENDER: &str = "Sender_Widget";
|
||||
pub static ID_SENDER_CONTAINER: &str = "sender_container";
|
||||
pub static ID_SENDER_GRID: &str = "sender_grid";
|
||||
pub static ID_SENDER_BUTTON: &str = "sender_button";
|
||||
pub static ID_SENDER_TEXT_BOX: &str = "sender_text_box";
|
||||
|
||||
pub static COLOR_BOMBAY: &str = "#adb3B8";
|
||||
9
advotracker_client/examples/messages_test/data/mod.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* OrbTK - The Orbital Widget Toolkit
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
* SPDX-License-Identifier: (0BSD or MIT)
|
||||
*/
|
||||
|
||||
/// provides orbtk widgets constants
|
||||
pub mod constants;
|
||||
32
advotracker_client/examples/messages_test/main.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* OrbTK - The Orbital Widget Toolkit
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
*/
|
||||
|
||||
use orbtk::prelude::*;
|
||||
|
||||
mod main_view;
|
||||
mod receiver;
|
||||
mod sender;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// use this only if you want to run it as web application.
|
||||
orbtk::initialize();
|
||||
|
||||
Application::new()
|
||||
.window(|ctx| {
|
||||
Window::new()
|
||||
.name("Main")
|
||||
.title("OrbTK: example send/receive messages")
|
||||
.position((100.0, 100.0))
|
||||
.resizeable(true)
|
||||
.size(450.0, 500.0)
|
||||
.child(main_view::MainView::new().build(ctx))
|
||||
.build(ctx)
|
||||
})
|
||||
.run();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
43
advotracker_client/examples/messages_test/main_view.rs
Normal file
@@ -0,0 +1,43 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* OrbTK - The Orbital Widget Toolkit
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
*/
|
||||
|
||||
use orbtk::prelude::*;
|
||||
|
||||
use crate::{receiver::receiver_view::ReceiverView, sender::sender_view::SenderView};
|
||||
|
||||
// constants
|
||||
pub static ID_SENDER_VIEW: &str = "sender_view";
|
||||
pub static ID_RECEIVER_VIEW: &str = "receiver_view";
|
||||
|
||||
widget!(MainView {
|
||||
//sender_view: ,
|
||||
//receiver_view:
|
||||
});
|
||||
|
||||
impl Template for MainView {
|
||||
fn template(self, _id: Entity, ctx: &mut BuildContext<'_>) -> Self {
|
||||
let receiver_view = ReceiverView::new().build(ctx);
|
||||
|
||||
let sender_view = SenderView::new()
|
||||
.target(receiver_view.0) // entity of the target
|
||||
.build(ctx);
|
||||
|
||||
self.name("MainView").child(
|
||||
Stack::new()
|
||||
.orientation("vertical")
|
||||
.child(sender_view)
|
||||
.child(receiver_view)
|
||||
.build(ctx),
|
||||
)
|
||||
// .child(
|
||||
// TabWidget::new()
|
||||
// .tab(ID_SENDER_VIEW, SenderView::new().build(ctx))
|
||||
// .tab(ID_RECEIVER_VIEW, ReceiverView::new().build(ctx))
|
||||
// .build(ctx),
|
||||
// )
|
||||
}
|
||||
}
|
||||
15
advotracker_client/examples/messages_test/mod.rs
Normal 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;
|
||||
12
advotracker_client/examples/messages_test/receiver/mod.rs
Normal 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;
|
||||
@@ -0,0 +1,71 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* OrbTK - The Orbital Widget Toolkit
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
*/
|
||||
|
||||
use orbtk::prelude::*;
|
||||
|
||||
use crate::sender::sender_state::{SenderAction, SenderState};
|
||||
|
||||
/// Enumeration of valid `action variants` that need to be handled as
|
||||
/// state changes for the `SenderView` widget.
|
||||
pub enum TestMessageAction {
|
||||
// Toggle visibility of a message TextBox.
|
||||
ToggleMessageBox,
|
||||
}
|
||||
|
||||
/// Valid `structure members` of the `ReceiverState` used to react on
|
||||
/// state changes inside the `ReceiverView` widget.
|
||||
#[derive(Default, AsAny)]
|
||||
pub struct ReceiverState {
|
||||
message_box: Option<Entity>,
|
||||
progress_bar: Entity,
|
||||
}
|
||||
|
||||
/// Method definitions, we provide inside the `ReceiverState`.
|
||||
impl ReceiverState {
|
||||
fn toggle_message_box(&self, ctx: &mut Context) {
|
||||
if let Some(message_box) = self.message_box {
|
||||
ctx.get_widget(message_box)
|
||||
.set("visibility", Visibility::Visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait methods provided for the `SenderState`
|
||||
impl State for ReceiverState {
|
||||
// initialize the view entities
|
||||
fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||
self.progress_bar = ctx
|
||||
.entity_of_child("progress_bar")
|
||||
.expect("Cannot find ProgressBar!");
|
||||
}
|
||||
|
||||
// handle messages targeting the view
|
||||
fn messages(
|
||||
&mut self,
|
||||
mut messages: MessageReader,
|
||||
_registry: &mut Registry,
|
||||
ctx: &mut Context,
|
||||
) {
|
||||
for message in messages.read::<SenderAction>() {
|
||||
match message {
|
||||
SenderAction::UpdateProgress(amount) => {
|
||||
println!("Message received");
|
||||
let mut progress_bar = ctx.get_widget(self.progress_bar);
|
||||
let current_progress = progress_bar.clone::<f64>("val");
|
||||
progress_bar.set::<f64>("val", current_progress + amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
for action in messages.read::<TestMessageAction>() {
|
||||
match action {
|
||||
TestMessageAction::ToggleMessageBox => {
|
||||
self.toggle_message_box(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* OrbTK - The Orbital Widget Toolkit
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
*/
|
||||
|
||||
use orbtk::prelude::*;
|
||||
|
||||
use crate::receiver::receiver_state::{ReceiverState, TestMessageAction};
|
||||
|
||||
widget!(ReceiverView<ReceiverState>);
|
||||
|
||||
impl Template for ReceiverView {
|
||||
fn template(self, _id: Entity, bc: &mut BuildContext) -> Self {
|
||||
self.name("ReceiverView").child(
|
||||
Stack::new()
|
||||
.orientation("vertical")
|
||||
.spacing(16)
|
||||
.child(ProgressBar::new().id("progress_bar").build(bc))
|
||||
.child(
|
||||
TextBox::new()
|
||||
.id("message_box")
|
||||
.h_align("center")
|
||||
.text("message received. Box toggled!")
|
||||
.visibility("hidden")
|
||||
.build(bc),
|
||||
)
|
||||
.build(bc),
|
||||
)
|
||||
}
|
||||
}
|
||||
12
advotracker_client/examples/messages_test/sender/mod.rs
Normal 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;
|
||||
@@ -0,0 +1,61 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* OrbTK - The Orbital Widget Toolkit
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
*/
|
||||
|
||||
use orbtk::prelude::*;
|
||||
|
||||
/// Enumeration of valid `action variants` that need to be handled as
|
||||
/// state changes for the `SenderView` widget.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum SenderAction {
|
||||
UpdateProgress(f64),
|
||||
}
|
||||
|
||||
/// Valid `structure members` of the `SenderState` used to react on
|
||||
/// state changes inside the `SenderView` widget.
|
||||
#[derive(AsAny, Default)]
|
||||
pub struct SenderState {
|
||||
// actions
|
||||
actions: Vec<SenderAction>,
|
||||
// entity that will receive the message
|
||||
target: Entity,
|
||||
}
|
||||
|
||||
/// Method definitions, we provide inside the `SenderState`.
|
||||
impl SenderState {
|
||||
/// Sending message 'UpdateProgress'
|
||||
pub fn send_message(&mut self) {
|
||||
println!("Sender: push 'UpdateProgress' action");
|
||||
self.actions.push(SenderAction::UpdateProgress(0.1));
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait methods provided for the `SenderState`
|
||||
impl State for SenderState {
|
||||
// initialize the view entities
|
||||
fn init(&mut self, _registry: &mut Registry, ctx: &mut Context) {
|
||||
// create the target entity, that receives the Sender messages
|
||||
self.target = Entity::from(
|
||||
ctx.widget()
|
||||
.try_clone::<u32>("target")
|
||||
.expect("ERROR: SenderState::init(): target entity not found!"),
|
||||
);
|
||||
}
|
||||
|
||||
// update entities, before we render the view
|
||||
fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||
let actions: Vec<SenderAction> = self.actions.drain(..).collect();
|
||||
|
||||
for action in actions {
|
||||
match action {
|
||||
SenderAction::UpdateProgress(amount) => {
|
||||
ctx.send_message(SenderAction::UpdateProgress(amount), self.target);
|
||||
println!("Sender: send message 'SenderAction::UpdateProgress'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* OrbTK - The Orbital Widget Toolkit
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
*/
|
||||
|
||||
use orbtk::prelude::*;
|
||||
|
||||
use crate::sender::sender_state::{SenderAction, SenderState};
|
||||
|
||||
widget!(SenderView<SenderState> {
|
||||
// the Entity of the widget that will receive the messages
|
||||
target: u32
|
||||
});
|
||||
|
||||
impl Template for SenderView {
|
||||
fn template(self, id: Entity, bc: &mut BuildContext) -> Self {
|
||||
self.name("SenderView").child(
|
||||
Button::new()
|
||||
.text("Click me to send a message!")
|
||||
.v_align("center")
|
||||
.h_align("center")
|
||||
.on_click(move |states, _entity| {
|
||||
states.get_mut::<SenderState>(id).send_message();
|
||||
//states.send_message(SenderAction::UpdateProgress, id);
|
||||
//ctx.send_message(TestMessageAction::ToggleMessageBox, id);
|
||||
false
|
||||
})
|
||||
.build(bc),
|
||||
)
|
||||
}
|
||||
}
|
||||
148
advotracker_client/examples/my_progress_bar.rs
Normal file
@@ -0,0 +1,148 @@
|
||||
use orbtk::prelude::*;
|
||||
|
||||
//|---------------------------------------------------------------------------|
|
||||
//|------------------------------SENDER---------------------------------------|
|
||||
//|---------------------------------------------------------------------------|
|
||||
|
||||
// View
|
||||
|
||||
widget!(SenderWidget<SenderState> {
|
||||
// the Entity of the widget that will receive the messages
|
||||
target: u32
|
||||
});
|
||||
|
||||
impl Template for SenderWidget {
|
||||
fn template(self, id: Entity, bc: &mut BuildContext) -> Self {
|
||||
self.name("SenderWidget").child(
|
||||
Button::new()
|
||||
.text("Click me to send a message!")
|
||||
.v_align("center")
|
||||
.h_align("center")
|
||||
.on_click(move |states, _entity| {
|
||||
states.get_mut::<SenderState>(id).send_message();
|
||||
false
|
||||
})
|
||||
.build(bc),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// States
|
||||
|
||||
enum Action {
|
||||
UpdateProgress(f64),
|
||||
}
|
||||
|
||||
#[derive(Default, AsAny)]
|
||||
struct SenderState {
|
||||
actions: Vec<Action>,
|
||||
target: Entity,
|
||||
}
|
||||
|
||||
impl SenderState {
|
||||
fn send_message(&mut self) {
|
||||
self.actions.push(Action::UpdateProgress(0.1));
|
||||
}
|
||||
}
|
||||
|
||||
impl State for SenderState {
|
||||
fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||
self.target = Entity::from(
|
||||
ctx.widget()
|
||||
.try_clone::<u32>("target")
|
||||
.expect("ERROR: SenderState::init(): target entity not found!"),
|
||||
);
|
||||
}
|
||||
|
||||
fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||
let actions: Vec<Action> = self.actions.drain(..).collect();
|
||||
|
||||
for action in actions {
|
||||
match action {
|
||||
Action::UpdateProgress(amount) => {
|
||||
ctx.send_message(Action::UpdateProgress(amount), self.target);
|
||||
println!("Message sent!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//|---------------------------------------------------------------------------|
|
||||
//|------------------------------RECEIVER-------------------------------------|
|
||||
//|---------------------------------------------------------------------------|
|
||||
|
||||
// View
|
||||
|
||||
widget!(ReceiverWidget<ReceiverState>);
|
||||
|
||||
impl Template for ReceiverWidget {
|
||||
fn template(self, _id: Entity, bc: &mut BuildContext) -> Self {
|
||||
self.name("ReceiverWidget")
|
||||
.child(ProgressBar::new().id("progress_bar").build(bc))
|
||||
}
|
||||
}
|
||||
|
||||
// States
|
||||
|
||||
#[derive(Default, AsAny)]
|
||||
struct ReceiverState {
|
||||
progress_bar: Entity,
|
||||
}
|
||||
|
||||
impl State for ReceiverState {
|
||||
fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||
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,
|
||||
) {
|
||||
for action in messages.read::<Action>() {
|
||||
match action {
|
||||
Action::UpdateProgress(amount) => {
|
||||
println!("Message received");
|
||||
let mut progress_bar = ctx.get_widget(self.progress_bar);
|
||||
let current_progress = progress_bar.clone::<f64>("val");
|
||||
progress_bar.set::<f64>("val", current_progress + amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//|---------------------------------------------------------------------------|
|
||||
//|--------------------------------MAIN---------------------------------------|
|
||||
//|---------------------------------------------------------------------------|
|
||||
|
||||
pub fn main() {
|
||||
Application::new()
|
||||
.window(|ctx| {
|
||||
let receiver = ReceiverWidget::new().build(ctx);
|
||||
|
||||
let sender = SenderWidget::new()
|
||||
// the entity of the target (receiver)
|
||||
.target(receiver.0)
|
||||
.build(ctx);
|
||||
|
||||
Window::new()
|
||||
.title("Messages example")
|
||||
.position((100.0, 100.0))
|
||||
.resizeable(true)
|
||||
.size(450.0, 500.0)
|
||||
.child(
|
||||
Stack::new()
|
||||
.orientation("vertical")
|
||||
.child(sender)
|
||||
.child(receiver)
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx)
|
||||
})
|
||||
.run();
|
||||
}
|
||||