Merge pull request #106 from MyHush/denio
Some improvements and updates
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -40,3 +40,4 @@ silentdragonlite.pro.user.4.10-pre1
|
|||||||
silentdragonlite
|
silentdragonlite
|
||||||
silentdragonlite_plugin_import.cpp
|
silentdragonlite_plugin_import.cpp
|
||||||
silentdragonlite_resource.rc
|
silentdragonlite_resource.rc
|
||||||
|
SilentDragonLite
|
||||||
82
lib/Cargo.lock
generated
82
lib/Cargo.lock
generated
@@ -149,18 +149,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "bellman"
|
name = "bellman"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc#caaee693c47c2ee9ecd1e1546b8fe3c714f342bc"
|
source = "git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"blake2s_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"blake2s_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff 0.4.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"ff 0.4.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"group 0.1.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"group 0.1.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pairing 0.14.2 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"pairing 0.14.2 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -424,17 +424,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ff"
|
name = "ff"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc#caaee693c47c2ee9ecd1e1546b8fe3c714f342bc"
|
source = "git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff_derive 0.3.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"ff_derive 0.3.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ff_derive"
|
name = "ff_derive"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc#caaee693c47c2ee9ecd1e1546b8fe3c714f342bc"
|
source = "git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -575,9 +575,9 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "group"
|
name = "group"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc#caaee693c47c2ee9ecd1e1546b8fe3c714f342bc"
|
source = "git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ff 0.4.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"ff 0.4.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@@ -996,11 +996,11 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "pairing"
|
name = "pairing"
|
||||||
version = "0.14.2"
|
version = "0.14.2"
|
||||||
source = "git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc#caaee693c47c2ee9ecd1e1546b8fe3c714f342bc"
|
source = "git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff 0.4.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"ff 0.4.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"group 0.1.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"group 0.1.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1177,7 +1177,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=44f64181143be9b3747b54580943017b85d93cd7)",
|
"silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=7efa024660cbe08e7eadf2524134e153c89c51ad)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1640,21 +1640,21 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "silentdragonlitelib"
|
name = "silentdragonlitelib"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/MyHush/silentdragonlite-cli?rev=44f64181143be9b3747b54580943017b85d93cd7#44f64181143be9b3747b54580943017b85d93cd7"
|
source = "git+https://github.com/MyHush/silentdragonlite-cli?rev=7efa024660cbe08e7eadf2524134e153c89c51ad#7efa024660cbe08e7eadf2524134e153c89c51ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bellman 0.1.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"bellman 0.1.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff 0.4.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"ff 0.4.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"json 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"json 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pairing 0.14.2 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"pairing 0.14.2 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"prost 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"prost 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"prost-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"prost-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"protobuf 2.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"protobuf 2.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -1672,9 +1672,9 @@ dependencies = [
|
|||||||
"tonic-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tonic-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"webpki-roots 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"webpki-roots 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"zcash_client_backend 0.0.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"zcash_client_backend 0.0.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"zcash_primitives 0.0.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"zcash_primitives 0.0.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"zcash_proofs 0.0.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"zcash_proofs 0.0.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2383,34 +2383,34 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "zcash_client_backend"
|
name = "zcash_client_backend"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
source = "git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc#caaee693c47c2ee9ecd1e1546b8fe3c714f342bc"
|
source = "git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bech32 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bech32 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bs58 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bs58 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff 0.4.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"ff 0.4.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pairing 0.14.2 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"pairing 0.14.2 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"protobuf 2.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"protobuf 2.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"protobuf-codegen-pure 2.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"protobuf-codegen-pure 2.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"zcash_primitives 0.0.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"zcash_primitives 0.0.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zcash_primitives"
|
name = "zcash_primitives"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
source = "git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc#caaee693c47c2ee9ecd1e1546b8fe3c714f342bc"
|
source = "git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"blake2s_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"blake2s_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crypto_api_chachapoly 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crypto_api_chachapoly 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff 0.4.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"ff 0.4.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"fpe 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fpe 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pairing 0.14.2 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"pairing 0.14.2 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -2422,15 +2422,15 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "zcash_proofs"
|
name = "zcash_proofs"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
source = "git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc#caaee693c47c2ee9ecd1e1546b8fe3c714f342bc"
|
source = "git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bellman 0.1.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"bellman 0.1.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff 0.4.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"ff 0.4.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"pairing 0.14.2 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"pairing 0.14.2 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
"rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"zcash_primitives 0.0.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"zcash_primitives 0.0.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
@@ -2455,7 +2455,7 @@ dependencies = [
|
|||||||
"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
|
"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
|
||||||
"checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
|
"checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
|
||||||
"checksum bech32 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cdcf67bb7ba7797a081cd19009948ab533af7c355d5caf1d08c777582d351e9c"
|
"checksum bech32 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cdcf67bb7ba7797a081cd19009948ab533af7c355d5caf1d08c777582d351e9c"
|
||||||
"checksum bellman 0.1.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)" = "<none>"
|
"checksum bellman 0.1.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)" = "<none>"
|
||||||
"checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f"
|
"checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f"
|
||||||
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||||
"checksum blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a"
|
"checksum blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a"
|
||||||
@@ -2491,8 +2491,8 @@ dependencies = [
|
|||||||
"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
|
"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
|
||||||
"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
|
"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
|
||||||
"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
|
"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
|
||||||
"checksum ff 0.4.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)" = "<none>"
|
"checksum ff 0.4.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)" = "<none>"
|
||||||
"checksum ff_derive 0.3.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)" = "<none>"
|
"checksum ff_derive 0.3.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)" = "<none>"
|
||||||
"checksum filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d"
|
"checksum filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d"
|
||||||
"checksum fixedbitset 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
"checksum fixedbitset 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
||||||
"checksum flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f"
|
"checksum flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f"
|
||||||
@@ -2510,7 +2510,7 @@ dependencies = [
|
|||||||
"checksum futures-util 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2c3f8c59707f898b8b6f0b54c2aef5408ae90a560b7bf0fbf1b95b3c652b0171"
|
"checksum futures-util 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2c3f8c59707f898b8b6f0b54c2aef5408ae90a560b7bf0fbf1b95b3c652b0171"
|
||||||
"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
|
"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
|
||||||
"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
|
"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
|
||||||
"checksum group 0.1.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)" = "<none>"
|
"checksum group 0.1.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)" = "<none>"
|
||||||
"checksum h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1"
|
"checksum h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1"
|
||||||
"checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da"
|
"checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da"
|
||||||
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
|
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
|
||||||
@@ -2557,7 +2557,7 @@ dependencies = [
|
|||||||
"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
|
"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
|
||||||
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
||||||
"checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518"
|
"checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518"
|
||||||
"checksum pairing 0.14.2 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)" = "<none>"
|
"checksum pairing 0.14.2 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)" = "<none>"
|
||||||
"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
|
"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
|
||||||
"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
|
"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
|
||||||
"checksum pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9"
|
"checksum pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9"
|
||||||
@@ -2630,7 +2630,7 @@ dependencies = [
|
|||||||
"checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35"
|
"checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35"
|
||||||
"checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0"
|
"checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0"
|
||||||
"checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41"
|
"checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41"
|
||||||
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=44f64181143be9b3747b54580943017b85d93cd7)" = "<none>"
|
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=7efa024660cbe08e7eadf2524134e153c89c51ad)" = "<none>"
|
||||||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||||
"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6"
|
"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6"
|
||||||
"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"
|
"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"
|
||||||
@@ -2706,6 +2706,6 @@ dependencies = [
|
|||||||
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||||
"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c"
|
"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c"
|
||||||
"checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d"
|
"checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d"
|
||||||
"checksum zcash_client_backend 0.0.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)" = "<none>"
|
"checksum zcash_client_backend 0.0.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)" = "<none>"
|
||||||
"checksum zcash_primitives 0.0.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)" = "<none>"
|
"checksum zcash_primitives 0.0.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)" = "<none>"
|
||||||
"checksum zcash_proofs 0.0.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)" = "<none>"
|
"checksum zcash_proofs 0.0.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)" = "<none>"
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ crate-type = ["staticlib"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.58"
|
libc = "0.2.58"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
silentdragonlitelib = { git = "https://github.com/MyHush/silentdragonlite-cli", rev = "44f64181143be9b3747b54580943017b85d93cd7" }
|
silentdragonlitelib = { git = "https://github.com/MyHush/silentdragonlite-cli", rev = "7efa024660cbe08e7eadf2524134e153c89c51ad" }
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -132,7 +132,7 @@ TRANSLATIONS = res/silentdragonlite_es.ts \
|
|||||||
res/silentdragonlite_tr.ts
|
res/silentdragonlite_tr.ts
|
||||||
|
|
||||||
include(singleapplication/singleapplication.pri)
|
include(singleapplication/singleapplication.pri)
|
||||||
DEFINES += QAPPLICATION_CLASS=QApplication
|
DEFINES += QAPPLICATION_CLASS=QApplication _FORTIFY_SOURCE=2
|
||||||
|
|
||||||
QMAKE_INFO_PLIST = res/Info.plist
|
QMAKE_INFO_PLIST = res/Info.plist
|
||||||
|
|
||||||
|
|||||||
58
src/DataStore.h
Normal file
58
src/DataStore.h
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
#ifndef DATASTORE_H
|
||||||
|
#define DATASTORE_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class DataStore
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
static bool instanced;
|
||||||
|
static DataStore<T>* instance;
|
||||||
|
std::map<QString, T> data;
|
||||||
|
DataStore()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
static DataStore<T>* getInstance()
|
||||||
|
{
|
||||||
|
if(!DataStore<T>::instanced)
|
||||||
|
{
|
||||||
|
DataStore<T>::instanced = true;
|
||||||
|
DataStore<T>::instance = new DataStore<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return DataStore<T>::instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
void setData(QString key, T value);
|
||||||
|
QString getData(QString key);
|
||||||
|
|
||||||
|
~DataStore()
|
||||||
|
{
|
||||||
|
DataStore<T>::instanced = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void DataStore<T>::clear()
|
||||||
|
{
|
||||||
|
this->data.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void DataStore<T>::setData(QString key, T value)
|
||||||
|
{
|
||||||
|
this->data[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
QString DataStore<T>::getData(QString key)
|
||||||
|
{
|
||||||
|
return this->data[key];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -6,85 +6,99 @@
|
|||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
|
|
||||||
|
|
||||||
AddressBookModel::AddressBookModel(QTableView *parent)
|
AddressBookModel::AddressBookModel(QTableView *parent) : QAbstractTableModel(parent)
|
||||||
: QAbstractTableModel(parent) {
|
{
|
||||||
headers << tr("Label") << tr("Address");
|
headers << tr("Label") << tr("Address");
|
||||||
|
|
||||||
this->parent = parent;
|
this->parent = parent;
|
||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
AddressBookModel::~AddressBookModel() {
|
AddressBookModel::~AddressBookModel()
|
||||||
|
{
|
||||||
saveData();
|
saveData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBookModel::saveData() {
|
void AddressBookModel::saveData()
|
||||||
|
{
|
||||||
// Save column positions
|
// Save column positions
|
||||||
QSettings().setValue("addresstablegeometry", parent->horizontalHeader()->saveState());
|
QSettings().setValue(
|
||||||
|
"addresstablegeometry",
|
||||||
|
parent->horizontalHeader()->saveState()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AddressBookModel::loadData() {
|
void AddressBookModel::loadData()
|
||||||
|
{
|
||||||
labels = AddressBook::getInstance()->getAllAddressLabels();
|
labels = AddressBook::getInstance()->getAllAddressLabels();
|
||||||
|
parent->horizontalHeader()->restoreState(
|
||||||
parent->horizontalHeader()->restoreState(QSettings().value("addresstablegeometry").toByteArray());
|
QSettings().value(
|
||||||
|
"addresstablegeometry"
|
||||||
|
).toByteArray()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBookModel::addNewLabel(QString label, QString addr) {
|
void AddressBookModel::addNewLabel(QString label, QString addr)
|
||||||
|
{
|
||||||
//labels.push_back(QPair<QString, QString>(label, addr));
|
//labels.push_back(QPair<QString, QString>(label, addr));
|
||||||
AddressBook::getInstance()->addAddressLabel(label, addr);
|
AddressBook::getInstance()->addAddressLabel(label, addr);
|
||||||
|
|
||||||
labels.clear();
|
labels.clear();
|
||||||
labels = AddressBook::getInstance()->getAllAddressLabels();
|
labels = AddressBook::getInstance()->getAllAddressLabels();
|
||||||
|
|
||||||
dataChanged(index(0, 0), index(labels.size()-1, columnCount(index(0,0))-1));
|
dataChanged(index(0, 0), index(labels.size()-1, columnCount(index(0,0))-1));
|
||||||
layoutChanged();
|
layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBookModel::removeItemAt(int row) {
|
void AddressBookModel::removeItemAt(int row)
|
||||||
|
{
|
||||||
if (row >= labels.size())
|
if (row >= labels.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AddressBook::getInstance()->removeAddressLabel(labels[row].first, labels[row].second);
|
AddressBook::getInstance()->removeAddressLabel(labels[row].first, labels[row].second);
|
||||||
|
|
||||||
labels.clear();
|
labels.clear();
|
||||||
labels = AddressBook::getInstance()->getAllAddressLabels();
|
labels = AddressBook::getInstance()->getAllAddressLabels();
|
||||||
|
|
||||||
dataChanged(index(0, 0), index(labels.size()-1, columnCount(index(0,0))-1));
|
dataChanged(index(0, 0), index(labels.size()-1, columnCount(index(0,0))-1));
|
||||||
layoutChanged();
|
layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPair<QString, QString> AddressBookModel::itemAt(int row) {
|
QPair<QString, QString> AddressBookModel::itemAt(int row)
|
||||||
if (row >= labels.size()) return QPair<QString, QString>();
|
{
|
||||||
|
if (row >= labels.size())
|
||||||
|
return QPair<QString, QString>();
|
||||||
|
|
||||||
return labels.at(row);
|
return labels.at(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int AddressBookModel::rowCount(const QModelIndex&) const {
|
int AddressBookModel::rowCount(const QModelIndex&) const
|
||||||
|
{
|
||||||
return labels.size();
|
return labels.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AddressBookModel::columnCount(const QModelIndex&) const {
|
int AddressBookModel::columnCount(const QModelIndex&) const
|
||||||
|
{
|
||||||
return headers.size();
|
return headers.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVariant AddressBookModel::data(const QModelIndex &index, int role) const {
|
QVariant AddressBookModel::data(const QModelIndex &index, int role) const
|
||||||
if (role == Qt::DisplayRole) {
|
{
|
||||||
switch(index.column()) {
|
if (role == Qt::DisplayRole)
|
||||||
|
{
|
||||||
|
switch(index.column())
|
||||||
|
{
|
||||||
case 0: return labels.at(index.row()).first;
|
case 0: return labels.at(index.row()).first;
|
||||||
case 1: return labels.at(index.row()).second;
|
case 1: return labels.at(index.row()).second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVariant AddressBookModel::headerData(int section, Qt::Orientation orientation, int role) const {
|
QVariant AddressBookModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
|
{
|
||||||
|
if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
|
||||||
return headers.at(section);
|
return headers.at(section);
|
||||||
}
|
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@@ -93,28 +107,27 @@ QVariant AddressBookModel::headerData(int section, Qt::Orientation orientation,
|
|||||||
//===============
|
//===============
|
||||||
// AddressBook
|
// AddressBook
|
||||||
//===============
|
//===============
|
||||||
void AddressBook::open(MainWindow* parent, QLineEdit* target) {
|
void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
||||||
|
{
|
||||||
QDialog d(parent);
|
QDialog d(parent);
|
||||||
Ui_addressBook ab;
|
Ui_addressBook ab;
|
||||||
ab.setupUi(&d);
|
ab.setupUi(&d);
|
||||||
Settings::saveRestore(&d);
|
Settings::saveRestore(&d);
|
||||||
|
|
||||||
QRegExpValidator v(QRegExp(Settings::labelRegExp), ab.label);
|
QRegExpValidator v(QRegExp(Settings::labelRegExp), ab.label);
|
||||||
ab.label->setValidator(&v);
|
ab.label->setValidator(&v);
|
||||||
|
|
||||||
AddressBookModel model(ab.addresses);
|
AddressBookModel model(ab.addresses);
|
||||||
ab.addresses->setModel(&model);
|
ab.addresses->setModel(&model);
|
||||||
|
|
||||||
// If there is no target, the we'll call the button "Ok", else "Pick"
|
// If there is no target, the we'll call the button "Ok", else "Pick"
|
||||||
if (target != nullptr) {
|
if (target != nullptr)
|
||||||
ab.buttonBox->button(QDialogButtonBox::Ok)->setText(QObject::tr("Pick"));
|
ab.buttonBox->button(QDialogButtonBox::Ok)->setText(QObject::tr("Pick"));
|
||||||
}
|
|
||||||
|
|
||||||
// Connect the dialog's closing to updating the label address completor
|
// Connect the dialog's closing to updating the label address completor
|
||||||
QObject::connect(&d, &QDialog::finished, [=] (auto) { parent->updateLabels(); });
|
QObject::connect(&d, &QDialog::finished, [=] (auto) { parent->updateLabels(); });
|
||||||
|
|
||||||
// If there is a target then make it the addr for the "Add to" button
|
// If there is a target then make it the addr for the "Add to" button
|
||||||
if (target != nullptr && Settings::isValidAddress(target->text())) {
|
if (target != nullptr && Settings::isValidAddress(target->text()))
|
||||||
|
{
|
||||||
ab.addr->setText(target->text());
|
ab.addr->setText(target->text());
|
||||||
ab.label->setFocus();
|
ab.label->setFocus();
|
||||||
}
|
}
|
||||||
@@ -124,26 +137,37 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) {
|
|||||||
auto addr = ab.addr->text().trimmed();
|
auto addr = ab.addr->text().trimmed();
|
||||||
QString newLabel = ab.label->text();
|
QString newLabel = ab.label->text();
|
||||||
|
|
||||||
if (addr.isEmpty() || newLabel.isEmpty()) {
|
if (addr.isEmpty() || newLabel.isEmpty())
|
||||||
QMessageBox::critical(parent, QObject::tr("Address or Label Error"),
|
{
|
||||||
QObject::tr("Address or Label cannot be empty"), QMessageBox::Ok);
|
QMessageBox::critical(
|
||||||
|
parent,
|
||||||
|
QObject::tr("Address or Label Error"),
|
||||||
|
QObject::tr("Address or Label cannot be empty"),
|
||||||
|
QMessageBox::Ok
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Test if address is valid.
|
// Test if address is valid.
|
||||||
if (!Settings::isValidAddress(addr)) {
|
if (!Settings::isValidAddress(addr))
|
||||||
QMessageBox::critical(parent, QObject::tr("Address Format Error"),
|
{
|
||||||
QObject::tr("%1 doesn't seem to be a valid hush address.")
|
QMessageBox::critical(
|
||||||
.arg(addr),
|
parent,
|
||||||
QMessageBox::Ok);
|
QObject::tr("Address Format Error"),
|
||||||
|
QObject::tr("%1 doesn't seem to be a valid hush address.").arg(addr),
|
||||||
|
QMessageBox::Ok
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't allow duplicate address labels.
|
// Don't allow duplicate address labels.
|
||||||
if (!getInstance()->getAddressForLabel(newLabel).isEmpty()) {
|
if (!getInstance()->getAddressForLabel(newLabel).isEmpty())
|
||||||
QMessageBox::critical(parent, QObject::tr("Label Error"),
|
{
|
||||||
QObject::tr("The label '%1' already exists. Please remove the existing label.")
|
QMessageBox::critical(
|
||||||
.arg(newLabel),
|
parent,
|
||||||
QMessageBox::Ok);
|
QObject::tr("Label Error"),
|
||||||
|
QObject::tr("The label '%1' already exists. Please remove the existing label.").arg(newLabel),
|
||||||
|
QMessageBox::Ok
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,21 +177,30 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) {
|
|||||||
// Import Button
|
// Import Button
|
||||||
QObject::connect(ab.btnImport, &QPushButton::clicked, [&] () {
|
QObject::connect(ab.btnImport, &QPushButton::clicked, [&] () {
|
||||||
// Get the import file name.
|
// Get the import file name.
|
||||||
auto fileName = QFileDialog::getOpenFileUrl(&d, QObject::tr("Import Address Book"), QUrl(),
|
auto fileName = QFileDialog::getOpenFileUrl(
|
||||||
"CSV file (*.csv)");
|
&d, QObject::tr("Import Address Book"),
|
||||||
|
QUrl(),
|
||||||
|
"CSV file (*.csv)"
|
||||||
|
);
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QFile file(fileName.toLocalFile());
|
QFile file(fileName.toLocalFile());
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly))
|
||||||
QMessageBox::information(&d, QObject::tr("Unable to open file"), file.errorString());
|
{
|
||||||
|
QMessageBox::information(
|
||||||
|
&d,
|
||||||
|
QObject::tr("Unable to open file"),
|
||||||
|
file.errorString()
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream in(&file);
|
QTextStream in(&file);
|
||||||
QString line;
|
QString line;
|
||||||
int numImported = 0;
|
int numImported = 0;
|
||||||
while (in.readLineInto(&line)) {
|
while (in.readLineInto(&line))
|
||||||
|
{
|
||||||
QStringList items = line.split(",");
|
QStringList items = line.split(",");
|
||||||
if (items.size() != 2)
|
if (items.size() != 2)
|
||||||
continue;
|
continue;
|
||||||
@@ -180,8 +213,11 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) {
|
|||||||
numImported++;
|
numImported++;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMessageBox::information(&d, QObject::tr("Address Book Import Done"),
|
QMessageBox::information(
|
||||||
QObject::tr("Imported %1 new Address book entries").arg(numImported));
|
&d,
|
||||||
|
QObject::tr("Address Book Import Done"),
|
||||||
|
QObject::tr("Imported %1 new Address book entries").arg(numImported)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
auto fnSetTargetLabelAddr = [=] (QLineEdit* target, QString label, QString addr) {
|
auto fnSetTargetLabelAddr = [=] (QLineEdit* target, QString label, QString addr) {
|
||||||
@@ -194,7 +230,8 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) {
|
|||||||
if (!target)
|
if (!target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (index.row() < 0) return;
|
if (index.row() < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
QString lbl = model.itemAt(index.row()).first;
|
QString lbl = model.itemAt(index.row()).first;
|
||||||
QString addr = model.itemAt(index.row()).second;
|
QString addr = model.itemAt(index.row()).second;
|
||||||
@@ -206,20 +243,19 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) {
|
|||||||
ab.addresses->setContextMenuPolicy(Qt::CustomContextMenu);
|
ab.addresses->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
QObject::connect(ab.addresses, &QTableView::customContextMenuRequested, [&] (QPoint pos) {
|
QObject::connect(ab.addresses, &QTableView::customContextMenuRequested, [&] (QPoint pos) {
|
||||||
QModelIndex index = ab.addresses->indexAt(pos);
|
QModelIndex index = ab.addresses->indexAt(pos);
|
||||||
|
if (index.row() < 0)
|
||||||
if (index.row() < 0) return;
|
return;
|
||||||
|
|
||||||
QString lbl = model.itemAt(index.row()).first;
|
QString lbl = model.itemAt(index.row()).first;
|
||||||
QString addr = model.itemAt(index.row()).second;
|
QString addr = model.itemAt(index.row()).second;
|
||||||
|
|
||||||
QMenu menu(parent);
|
QMenu menu(parent);
|
||||||
|
|
||||||
if (target != nullptr) {
|
if (target != nullptr)
|
||||||
menu.addAction("Pick", [&] () {
|
menu.addAction("Pick", [&] () {
|
||||||
d.accept();
|
d.accept();
|
||||||
fnSetTargetLabelAddr(target, lbl, addr);
|
fnSetTargetLabelAddr(target, lbl, addr);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
menu.addAction(QObject::tr("Copy address"), [&] () {
|
menu.addAction(QObject::tr("Copy address"), [&] () {
|
||||||
QGuiApplication::clipboard()->setText(addr);
|
QGuiApplication::clipboard()->setText(addr);
|
||||||
@@ -248,27 +284,30 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) {
|
|||||||
//=============
|
//=============
|
||||||
// AddressBook singleton class
|
// AddressBook singleton class
|
||||||
//=============
|
//=============
|
||||||
AddressBook* AddressBook::getInstance() {
|
AddressBook* AddressBook::getInstance()
|
||||||
|
{
|
||||||
if (!instance)
|
if (!instance)
|
||||||
instance = new AddressBook();
|
instance = new AddressBook();
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddressBook::AddressBook() {
|
AddressBook::AddressBook()
|
||||||
|
{
|
||||||
readFromStorage();
|
readFromStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBook::readFromStorage() {
|
void AddressBook::readFromStorage()
|
||||||
|
{
|
||||||
QFile file(AddressBook::writeableFile());
|
QFile file(AddressBook::writeableFile());
|
||||||
|
|
||||||
if (file.exists()) {
|
if (file.exists())
|
||||||
|
{
|
||||||
allLabels.clear();
|
allLabels.clear();
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
QDataStream in(&file); // read the data serialized from the file
|
QDataStream in(&file); // read the data serialized from the file
|
||||||
QString version;
|
QString version;
|
||||||
in >> version >> allLabels;
|
in >> version >> allLabels;
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +321,8 @@ void AddressBook::readFromStorage() {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBook::writeToStorage() {
|
void AddressBook::writeToStorage()
|
||||||
|
{
|
||||||
QFile file(AddressBook::writeableFile());
|
QFile file(AddressBook::writeableFile());
|
||||||
file.open(QIODevice::ReadWrite | QIODevice::Truncate);
|
file.open(QIODevice::ReadWrite | QIODevice::Truncate);
|
||||||
QDataStream out(&file); // we will serialize the data into the file
|
QDataStream out(&file); // we will serialize the data into the file
|
||||||
@@ -290,42 +330,44 @@ void AddressBook::writeToStorage() {
|
|||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AddressBook::writeableFile() {
|
QString AddressBook::writeableFile()
|
||||||
|
{
|
||||||
auto filename = QStringLiteral("addresslabels.dat");
|
auto filename = QStringLiteral("addresslabels.dat");
|
||||||
|
|
||||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||||
if (!dir.exists())
|
if (!dir.exists())
|
||||||
QDir().mkpath(dir.absolutePath());
|
QDir().mkpath(dir.absolutePath());
|
||||||
|
|
||||||
if (Settings::getInstance()->isTestnet()) {
|
if (Settings::getInstance()->isTestnet())
|
||||||
return dir.filePath("testnet-" % filename);
|
return dir.filePath("testnet-" % filename);
|
||||||
} else {
|
|
||||||
|
else
|
||||||
return dir.filePath(filename);
|
return dir.filePath(filename);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add a new address/label to the database
|
// Add a new address/label to the database
|
||||||
void AddressBook::addAddressLabel(QString label, QString address) {
|
void AddressBook::addAddressLabel(QString label, QString address)
|
||||||
|
{
|
||||||
Q_ASSERT(Settings::isValidAddress(address));
|
Q_ASSERT(Settings::isValidAddress(address));
|
||||||
|
|
||||||
// First, remove any existing label
|
// First, remove any existing label
|
||||||
// Iterate over the list and remove the label/address
|
// Iterate over the list and remove the label/address
|
||||||
for (int i=0; i < allLabels.size(); i++) {
|
for (int i=0; i < allLabels.size(); i++)
|
||||||
if (allLabels[i].first == label) {
|
if (allLabels[i].first == label)
|
||||||
removeAddressLabel(allLabels[i].first, allLabels[i].second);
|
removeAddressLabel(allLabels[i].first, allLabels[i].second);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allLabels.push_back(QPair<QString, QString>(label, address));
|
allLabels.push_back(QPair<QString, QString>(label, address));
|
||||||
writeToStorage();
|
writeToStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a new address/label from the database
|
// Remove a new address/label from the database
|
||||||
void AddressBook::removeAddressLabel(QString label, QString address) {
|
void AddressBook::removeAddressLabel(QString label, QString address)
|
||||||
|
{
|
||||||
// Iterate over the list and remove the label/address
|
// Iterate over the list and remove the label/address
|
||||||
for (int i=0; i < allLabels.size(); i++) {
|
for (int i=0; i < allLabels.size(); i++)
|
||||||
if (allLabels[i].first == label && allLabels[i].second == address) {
|
{
|
||||||
|
if (allLabels[i].first == label && allLabels[i].second == address)
|
||||||
|
{
|
||||||
allLabels.removeAt(i);
|
allLabels.removeAt(i);
|
||||||
writeToStorage();
|
writeToStorage();
|
||||||
return;
|
return;
|
||||||
@@ -333,10 +375,13 @@ void AddressBook::removeAddressLabel(QString label, QString address) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBook::updateLabel(QString oldlabel, QString address, QString newlabel) {
|
void AddressBook::updateLabel(QString oldlabel, QString address, QString newlabel)
|
||||||
|
{
|
||||||
// Iterate over the list and update the label/address
|
// Iterate over the list and update the label/address
|
||||||
for (int i = 0; i < allLabels.size(); i++) {
|
for (int i = 0; i < allLabels.size(); i++)
|
||||||
if (allLabels[i].first == oldlabel && allLabels[i].second == address) {
|
{
|
||||||
|
if (allLabels[i].first == oldlabel && allLabels[i].second == address)
|
||||||
|
{
|
||||||
allLabels[i].first = newlabel;
|
allLabels[i].first = newlabel;
|
||||||
writeToStorage();
|
writeToStorage();
|
||||||
return;
|
return;
|
||||||
@@ -345,42 +390,46 @@ void AddressBook::updateLabel(QString oldlabel, QString address, QString newlabe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read all addresses
|
// Read all addresses
|
||||||
const QList<QPair<QString, QString>>& AddressBook::getAllAddressLabels() {
|
const QList<QPair<QString, QString>>& AddressBook::getAllAddressLabels()
|
||||||
if (allLabels.isEmpty()) {
|
{
|
||||||
|
if (allLabels.isEmpty())
|
||||||
readFromStorage();
|
readFromStorage();
|
||||||
}
|
|
||||||
return allLabels;
|
return allLabels;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the label for an address
|
// Get the label for an address
|
||||||
QString AddressBook::getLabelForAddress(QString addr) {
|
QString AddressBook::getLabelForAddress(QString addr)
|
||||||
for (auto i : allLabels) {
|
{
|
||||||
|
for (auto i : allLabels)
|
||||||
if (i.second == addr)
|
if (i.second == addr)
|
||||||
return i.first;
|
return i.first;
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the address for a label
|
// Get the address for a label
|
||||||
QString AddressBook::getAddressForLabel(QString label) {
|
QString AddressBook::getAddressForLabel(QString label)
|
||||||
for (auto i: allLabels) {
|
{
|
||||||
|
for (auto i: allLabels)
|
||||||
if (i.first == label)
|
if (i.first == label)
|
||||||
return i.second;
|
return i.second;
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AddressBook::addLabelToAddress(QString addr) {
|
QString AddressBook::addLabelToAddress(QString addr)
|
||||||
|
{
|
||||||
QString label = AddressBook::getInstance()->getLabelForAddress(addr);
|
QString label = AddressBook::getInstance()->getLabelForAddress(addr);
|
||||||
if (!label.isEmpty())
|
if (!label.isEmpty())
|
||||||
return label + "/" + addr;
|
return label + "/" + addr;
|
||||||
|
|
||||||
else
|
else
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AddressBook::addressFromAddressLabel(const QString& lblAddr) {
|
QString AddressBook::addressFromAddressLabel(const QString& lblAddr)
|
||||||
|
{
|
||||||
return lblAddr.trimmed().split("/").last();
|
return lblAddr.trimmed().split("/").last();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,29 +2,31 @@
|
|||||||
#include "addressbook.h"
|
#include "addressbook.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
AddressCombo::AddressCombo(QWidget* parent) :
|
AddressCombo::AddressCombo(QWidget* parent): QComboBox(parent)
|
||||||
QComboBox(parent) {
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
QString AddressCombo::itemText(int i) {
|
QString AddressCombo::itemText(int i)
|
||||||
|
{
|
||||||
QString txt = QComboBox::itemText(i);
|
QString txt = QComboBox::itemText(i);
|
||||||
return AddressBook::addressFromAddressLabel(txt.split("(")[0].trimmed());
|
return AddressBook::addressFromAddressLabel(txt.split("(")[0].trimmed());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AddressCombo::currentText() {
|
QString AddressCombo::currentText()
|
||||||
|
{
|
||||||
QString txt = QComboBox::currentText();
|
QString txt = QComboBox::currentText();
|
||||||
return AddressBook::addressFromAddressLabel(txt.split("(")[0].trimmed());
|
return AddressBook::addressFromAddressLabel(txt.split("(")[0].trimmed());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressCombo::setCurrentText(const QString& text) {
|
void AddressCombo::setCurrentText(const QString& text)
|
||||||
for (int i=0; i < count(); i++) {
|
{
|
||||||
if (itemText(i) == text) {
|
for (int i=0; i < count(); i++)
|
||||||
|
if (itemText(i) == text)
|
||||||
QComboBox::setCurrentIndex(i);
|
QComboBox::setCurrentIndex(i);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressCombo::addItem(const QString& text, CAmount bal) {
|
void AddressCombo::addItem(const QString& text, CAmount bal)
|
||||||
|
{
|
||||||
QString txt = AddressBook::addLabelToAddress(text);
|
QString txt = AddressBook::addLabelToAddress(text);
|
||||||
if (bal.toqint64() > 0)
|
if (bal.toqint64() > 0)
|
||||||
txt = txt % "(" % bal.toDecimalhushString() % ")";
|
txt = txt % "(" % bal.toDecimalhushString() % ")";
|
||||||
@@ -32,7 +34,8 @@ void AddressCombo::addItem(const QString& text, CAmount bal) {
|
|||||||
QComboBox::addItem(txt);
|
QComboBox::addItem(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressCombo::insertItem(int index, const QString& text, CAmount bal) {
|
void AddressCombo::insertItem(int index, const QString& text, CAmount bal)
|
||||||
|
{
|
||||||
QString txt = AddressBook::addLabelToAddress(text) %
|
QString txt = AddressBook::addLabelToAddress(text) %
|
||||||
"(" % bal.toDecimalhushString() % ")";
|
"(" % bal.toDecimalhushString() % ")";
|
||||||
QComboBox::insertItem(index, txt);
|
QComboBox::insertItem(index, txt);
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "camount.h"
|
#include "camount.h"
|
||||||
|
|
||||||
BalancesTableModel::BalancesTableModel(QObject *parent)
|
BalancesTableModel::BalancesTableModel(QObject *parent): QAbstractTableModel(parent)
|
||||||
: QAbstractTableModel(parent) {
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
void BalancesTableModel::setNewData(const QList<QString> zaddrs, const QList<QString> taddrs,
|
void BalancesTableModel::setNewData(const QList<QString> zaddrs, const QList<QString> taddrs,
|
||||||
const QMap<QString, CAmount> balances, const QList<UnspentOutput> outputs)
|
const QMap<QString, CAmount> balances, const QList<UnspentOutput> outputs)
|
||||||
@@ -29,21 +28,19 @@ void BalancesTableModel::setNewData(const QList<QString> zaddrs, const QList<QSt
|
|||||||
modeldata = new QList<std::tuple<QString, CAmount>>();
|
modeldata = new QList<std::tuple<QString, CAmount>>();
|
||||||
std::for_each(balances.keyBegin(), balances.keyEnd(), [=, &anyz, &anyt] (auto keyIt) {
|
std::for_each(balances.keyBegin(), balances.keyEnd(), [=, &anyz, &anyt] (auto keyIt) {
|
||||||
modeldata->push_back(std::make_tuple(keyIt, balances.value(keyIt)));
|
modeldata->push_back(std::make_tuple(keyIt, balances.value(keyIt)));
|
||||||
if (Settings::isZAddress(keyIt)) {
|
if (Settings::isZAddress(keyIt))
|
||||||
anyz = true;
|
anyz = true;
|
||||||
} else if (Settings::isTAddress(keyIt)) {
|
|
||||||
|
else if (Settings::isTAddress(keyIt))
|
||||||
anyt = true;
|
anyt = true;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add all addresses that have no balances, if there are no existing addresses
|
// Add all addresses that have no balances, if there are no existing addresses
|
||||||
if (!anyz && zaddrs.length() > 0) {
|
if (!anyz && zaddrs.length() > 0)
|
||||||
modeldata->push_back(std::make_tuple(zaddrs[0], CAmount::fromqint64(0)));
|
modeldata->push_back(std::make_tuple(zaddrs[0], CAmount::fromqint64(0)));
|
||||||
}
|
|
||||||
|
|
||||||
if (!anyt && taddrs.length() > 0) {
|
if (!anyt && taddrs.length() > 0)
|
||||||
modeldata->push_back(std::make_tuple(taddrs[0], CAmount::fromqint64(0)));
|
modeldata->push_back(std::make_tuple(taddrs[0], CAmount::fromqint64(0)));
|
||||||
}
|
|
||||||
|
|
||||||
// And then update the data
|
// And then update the data
|
||||||
dataChanged(index(0, 0), index(modeldata->size()-1, columnCount(index(0,0))-1));
|
dataChanged(index(0, 0), index(modeldata->size()-1, columnCount(index(0,0))-1));
|
||||||
@@ -53,19 +50,17 @@ void BalancesTableModel::setNewData(const QList<QString> zaddrs, const QList<QSt
|
|||||||
layoutChanged();
|
layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
BalancesTableModel::~BalancesTableModel() {
|
BalancesTableModel::~BalancesTableModel()
|
||||||
|
{
|
||||||
delete modeldata;
|
delete modeldata;
|
||||||
delete unspentOutputs;
|
delete unspentOutputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BalancesTableModel::rowCount(const QModelIndex&) const
|
int BalancesTableModel::rowCount(const QModelIndex&) const
|
||||||
{
|
{
|
||||||
if (modeldata == nullptr) {
|
if (modeldata == nullptr)
|
||||||
if (loading)
|
return (loading) ? 1: 0;
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return modeldata->size();
|
return modeldata->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,25 +71,31 @@ int BalancesTableModel::columnCount(const QModelIndex&) const
|
|||||||
|
|
||||||
QVariant BalancesTableModel::data(const QModelIndex &index, int role) const
|
QVariant BalancesTableModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (loading) {
|
if (loading)
|
||||||
if (role == Qt::DisplayRole)
|
return (role == Qt::DisplayRole) ? "Loading..." : QVariant();
|
||||||
|
/*if (role == Qt::DisplayRole)
|
||||||
return "Loading...";
|
return "Loading...";
|
||||||
else
|
else
|
||||||
return QVariant();
|
return QVariant();*/
|
||||||
}
|
|
||||||
|
|
||||||
if (role == Qt::TextAlignmentRole && index.column() == 1) return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
if (role == Qt::TextAlignmentRole && index.column() == 1)
|
||||||
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
|
||||||
if (role == Qt::ForegroundRole) {
|
if (role == Qt::ForegroundRole) {
|
||||||
// If any of the UTXOs for this address has zero confirmations, paint it in red
|
// If any of the UTXOs for this address has zero confirmations, paint it in red
|
||||||
const auto& addr = std::get<0>(modeldata->at(index.row()));
|
const auto& addr = std::get<0>(modeldata->at(index.row()));
|
||||||
for (auto unconfirmedOutput : *unspentOutputs) {
|
for (auto unconfirmedOutput : *unspentOutputs)
|
||||||
if (unconfirmedOutput.address == addr &&
|
{
|
||||||
(!unconfirmedOutput.spendable || unconfirmedOutput.pending)) {
|
if (
|
||||||
|
unconfirmedOutput.address == addr &&
|
||||||
|
(!unconfirmedOutput.spendable || unconfirmedOutput.pending)
|
||||||
|
)
|
||||||
|
{
|
||||||
QBrush b;
|
QBrush b;
|
||||||
b.setColor(Qt::red);
|
b.setColor(Qt::red);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Else, just return the default brush
|
// Else, just return the default brush
|
||||||
@@ -103,17 +104,21 @@ QVariant BalancesTableModel::data(const QModelIndex &index, int role) const
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == Qt::DisplayRole) {
|
if (role == Qt::DisplayRole)
|
||||||
switch (index.column()) {
|
{
|
||||||
case 0: return AddressBook::addLabelToAddress(std::get<0>(modeldata->at(index.row())));
|
switch (index.column())
|
||||||
case 1: return std::get<1>(modeldata->at(index.row())).toDecimalhushString();
|
{
|
||||||
|
case 0: return AddressBook::addLabelToAddress(std::get<0>(modeldata->at(index.row())));
|
||||||
|
case 1: return std::get<1>(modeldata->at(index.row())).toDecimalhushString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(role == Qt::ToolTipRole) {
|
if(role == Qt::ToolTipRole)
|
||||||
switch (index.column()) {
|
{
|
||||||
case 0: return AddressBook::addLabelToAddress(std::get<0>(modeldata->at(index.row())));
|
switch (index.column())
|
||||||
case 1: return std::get<1>(modeldata->at(index.row())).toDecimalhushString();
|
{
|
||||||
|
case 0: return AddressBook::addLabelToAddress(std::get<0>(modeldata->at(index.row())));
|
||||||
|
case 1: return std::get<1>(modeldata->at(index.row())).toDecimalhushString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,11 +128,13 @@ QVariant BalancesTableModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
QVariant BalancesTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant BalancesTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
if (role == Qt::TextAlignmentRole && section == 1) {
|
if (role == Qt::TextAlignmentRole && section == 1)
|
||||||
|
{
|
||||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == Qt::FontRole) {
|
if (role == Qt::FontRole)
|
||||||
|
{
|
||||||
QFont f;
|
QFont f;
|
||||||
f.setBold(true);
|
f.setBold(true);
|
||||||
return f;
|
return f;
|
||||||
@@ -136,13 +143,16 @@ QVariant BalancesTableModel::headerData(int section, Qt::Orientation orientation
|
|||||||
if (role != Qt::DisplayRole)
|
if (role != Qt::DisplayRole)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if (orientation == Qt::Horizontal) {
|
if (orientation == Qt::Horizontal)
|
||||||
switch (section) {
|
{
|
||||||
case 0: return tr("Address");
|
switch (section)
|
||||||
case 1: return tr("Amount");
|
{
|
||||||
default: return QVariant();
|
case 0: return tr("Address");
|
||||||
|
case 1: return tr("Amount");
|
||||||
|
default: return QVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
160
src/camount.cpp
160
src/camount.cpp
@@ -1,204 +1,230 @@
|
|||||||
#include "camount.h"
|
#include "camount.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
|
|
||||||
const int NUMPLACES = 8;
|
const int NUMPLACES = 8;
|
||||||
const qint64 COIN = 100000000;
|
const qint64 COIN = 100000000;
|
||||||
|
|
||||||
double CAmount::toDecimalDouble() const {
|
double CAmount::toDecimalDouble() const
|
||||||
|
{
|
||||||
return static_cast<double>(this->amount) / COIN;
|
return static_cast<double>(this->amount) / COIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalString() const {
|
QString CAmount::toDecimalString() const
|
||||||
if (amount < 0) {
|
{
|
||||||
|
if (amount < 0)
|
||||||
|
{
|
||||||
CAmount negative(-1 * this->amount);
|
CAmount negative(-1 * this->amount);
|
||||||
return "-" + negative.toDecimalString();
|
return "-" + negative.toDecimalString();
|
||||||
}
|
}
|
||||||
|
|
||||||
int wholePart = amount / COIN;
|
int wholePart = amount / COIN;
|
||||||
int decimalPart = amount % COIN;
|
int decimalPart = amount % COIN;
|
||||||
|
|
||||||
QString r = QString::number(wholePart);
|
QString r = QString::number(wholePart);
|
||||||
if (decimalPart > 0) {
|
if (decimalPart > 0)
|
||||||
|
{
|
||||||
QString decimalPartStr = QString::number(decimalPart);
|
QString decimalPartStr = QString::number(decimalPart);
|
||||||
r = r + "." + decimalPartStr.rightJustified(NUMPLACES, '0');
|
r = r + "." + decimalPartStr.rightJustified(NUMPLACES, '0');
|
||||||
|
|
||||||
// Trim tailing 0s
|
// Trim tailing 0s
|
||||||
while (r.right(1) == "0") {
|
while (r.right(1) == "0")
|
||||||
r = r.left(r.length() - 1);
|
r = r.left(r.length() - 1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalUSDString() const {
|
double CAmount::getDblAmount() const
|
||||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
{
|
||||||
|
return static_cast<double>(this->amount) / COIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CAmount::toDecimalUSDString() const
|
||||||
|
{
|
||||||
double price = Settings::getInstance()->getZECPrice();
|
double price = Settings::getInstance()->getZECPrice();
|
||||||
|
return "$ " + QLocale(QLocale::English).toString(this->getDblAmount() * price, 'f', 2);
|
||||||
return "$ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalEURString() const {
|
QString CAmount::toDecimalEURString() const
|
||||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
{
|
||||||
double price = Settings::getInstance()->getEURPrice();
|
double price = Settings::getInstance()->getEURPrice();
|
||||||
|
return QLocale(QLocale::German).toString(this->getDblAmount() * price, 'f', 2) + " €";
|
||||||
return QLocale(QLocale::German).toString(dblAmount*price, 'f', 2) + " €";
|
|
||||||
}
|
}
|
||||||
QString CAmount::toDecimalBTCString() const {
|
|
||||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
QString CAmount::toDecimalBTCString() const
|
||||||
|
{
|
||||||
double price = Settings::getInstance()->getBTCPrice();
|
double price = Settings::getInstance()->getBTCPrice();
|
||||||
|
return "BTC " + QLocale(QLocale::English).toString(this->getDblAmount() * price, 'f', 9);
|
||||||
return "BTC " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 9);
|
|
||||||
}
|
}
|
||||||
QString CAmount::toDecimalCNYString() const {
|
|
||||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
QString CAmount::toDecimalCNYString() const
|
||||||
|
{
|
||||||
double price = Settings::getInstance()->getCNYPrice();
|
double price = Settings::getInstance()->getCNYPrice();
|
||||||
|
return "¥ /元 " + QLocale(QLocale::English).toString(this->getDblAmount() * price, 'f', 2);
|
||||||
return "¥ /元 " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
|
||||||
}
|
}
|
||||||
QString CAmount::toDecimalRUBString() const {
|
QString CAmount::toDecimalRUBString() const
|
||||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
{
|
||||||
double price = Settings::getInstance()->getRUBPrice();
|
double price = Settings::getInstance()->getRUBPrice();
|
||||||
|
return "₽ " + QLocale(QLocale::English).toString(this->getDblAmount() * price, 'f', 2);
|
||||||
return "₽ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
|
||||||
}
|
}
|
||||||
QString CAmount::toDecimalCADString() const {
|
|
||||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
QString CAmount::toDecimalCADString() const
|
||||||
|
{
|
||||||
double price = Settings::getInstance()->getCADPrice();
|
double price = Settings::getInstance()->getCADPrice();
|
||||||
|
return "$ " + QLocale(QLocale::English).toString(this->getDblAmount() * price, 'f', 2);
|
||||||
return "$ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
|
||||||
}
|
}
|
||||||
QString CAmount::toDecimalSGDString() const {
|
|
||||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
QString CAmount::toDecimalSGDString() const
|
||||||
|
{
|
||||||
double price = Settings::getInstance()->getSGDPrice();
|
double price = Settings::getInstance()->getSGDPrice();
|
||||||
|
return "$ " + QLocale(QLocale::English).toString(this->getDblAmount() * price, 'f', 2);
|
||||||
return "$ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
|
||||||
}
|
}
|
||||||
QString CAmount::toDecimalCHFString() const {
|
|
||||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
QString CAmount::toDecimalCHFString() const
|
||||||
|
{
|
||||||
double price = Settings::getInstance()->getCHFPrice();
|
double price = Settings::getInstance()->getCHFPrice();
|
||||||
|
return "CHF " + QLocale(QLocale::German).toString(this->getDblAmount() * price, 'f', 2);
|
||||||
return "CHF " + QLocale(QLocale::German).toString(dblAmount*price, 'f', 2);
|
|
||||||
}
|
}
|
||||||
QString CAmount::toDecimalINRString() const {
|
|
||||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
QString CAmount::toDecimalINRString() const
|
||||||
|
{
|
||||||
double price = Settings::getInstance()->getINRPrice();
|
double price = Settings::getInstance()->getINRPrice();
|
||||||
|
return "₹ " + QLocale(QLocale::English).toString(this->getDblAmount() * price, 'f', 2);
|
||||||
return "₹ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
|
||||||
}
|
}
|
||||||
QString CAmount::toDecimalGBPString() const {
|
QString CAmount::toDecimalGBPString() const
|
||||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
{
|
||||||
double price = Settings::getInstance()->getGBPPrice();
|
double price = Settings::getInstance()->getGBPPrice();
|
||||||
|
return "£ " + QLocale(QLocale::English).toString(this->getDblAmount() * price, 'f', 2);
|
||||||
return "£ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
|
||||||
}
|
}
|
||||||
QString CAmount::toDecimalAUDString() const {
|
QString CAmount::toDecimalAUDString() const
|
||||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
{
|
||||||
double price = Settings::getInstance()->getAUDPrice();
|
double price = Settings::getInstance()->getAUDPrice();
|
||||||
|
return " $" + QLocale(QLocale::English).toString(this->getDblAmount() * price, 'f', 2);
|
||||||
return " $" + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalhushString() const {
|
QString CAmount::toDecimalhushString() const
|
||||||
|
{
|
||||||
return this->toDecimalString() % " " % Settings::getTokenName();
|
return this->toDecimalString() % " " % Settings::getTokenName();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalhushUSDString() const {
|
QString CAmount::toDecimalhushUSDString() const
|
||||||
|
{
|
||||||
auto usdString = this->toDecimalUSDString();
|
auto usdString = this->toDecimalUSDString();
|
||||||
if (!usdString.isEmpty())
|
if (!usdString.isEmpty())
|
||||||
return this->toDecimalhushString() % " (" % usdString % ")";
|
return this->toDecimalhushString() % " (" % usdString % ")";
|
||||||
|
|
||||||
else
|
else
|
||||||
return this->toDecimalhushString();
|
return this->toDecimalhushString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString CAmount::toDecimalhushEURString() const {
|
QString CAmount::toDecimalhushEURString() const
|
||||||
|
{
|
||||||
auto eurString = this->toDecimalEURString();
|
auto eurString = this->toDecimalEURString();
|
||||||
if (!eurString.isEmpty())
|
if (!eurString.isEmpty())
|
||||||
return this->toDecimalhushString() % " (" % eurString % ")";
|
return this->toDecimalhushString() % " (" % eurString % ")";
|
||||||
|
|
||||||
else
|
else
|
||||||
return this->toDecimalhushString();
|
return this->toDecimalhushString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalhushBTCString() const {
|
QString CAmount::toDecimalhushBTCString() const
|
||||||
|
{
|
||||||
auto btcString = this->toDecimalBTCString();
|
auto btcString = this->toDecimalBTCString();
|
||||||
if (!btcString.isEmpty())
|
if (!btcString.isEmpty())
|
||||||
return this->toDecimalhushString() % " (" % btcString % ")";
|
return this->toDecimalhushString() % " (" % btcString % ")";
|
||||||
|
|
||||||
else
|
else
|
||||||
return this->toDecimalhushString();
|
return this->toDecimalhushString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalhushCNYString() const {
|
QString CAmount::toDecimalhushCNYString() const
|
||||||
|
{
|
||||||
auto cnyString = this->toDecimalCNYString();
|
auto cnyString = this->toDecimalCNYString();
|
||||||
if (!cnyString.isEmpty())
|
if (!cnyString.isEmpty())
|
||||||
return this->toDecimalhushString() % " (" % cnyString % ")";
|
return this->toDecimalhushString() % " (" % cnyString % ")";
|
||||||
|
|
||||||
else
|
else
|
||||||
return this->toDecimalhushString();
|
return this->toDecimalhushString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalhushRUBString() const {
|
QString CAmount::toDecimalhushRUBString() const
|
||||||
|
{
|
||||||
auto rubString = this->toDecimalRUBString();
|
auto rubString = this->toDecimalRUBString();
|
||||||
if (!rubString.isEmpty())
|
if (!rubString.isEmpty())
|
||||||
return this->toDecimalhushString() % " (" % rubString % ")";
|
return this->toDecimalhushString() % " (" % rubString % ")";
|
||||||
|
|
||||||
else
|
else
|
||||||
return this->toDecimalhushString();
|
return this->toDecimalhushString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalhushCADString() const {
|
QString CAmount::toDecimalhushCADString() const
|
||||||
|
{
|
||||||
auto cadString = this->toDecimalCADString();
|
auto cadString = this->toDecimalCADString();
|
||||||
if (!cadString.isEmpty())
|
if (!cadString.isEmpty())
|
||||||
return this->toDecimalhushString() % " (" % cadString % ")";
|
return this->toDecimalhushString() % " (" % cadString % ")";
|
||||||
|
|
||||||
else
|
else
|
||||||
return this->toDecimalhushString();
|
return this->toDecimalhushString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalhushSGDString() const {
|
QString CAmount::toDecimalhushSGDString() const
|
||||||
|
{
|
||||||
auto sgdString = this->toDecimalSGDString();
|
auto sgdString = this->toDecimalSGDString();
|
||||||
if (!sgdString.isEmpty())
|
if (!sgdString.isEmpty())
|
||||||
return this->toDecimalhushString() % " (" % sgdString % ")";
|
return this->toDecimalhushString() % " (" % sgdString % ")";
|
||||||
|
|
||||||
else
|
else
|
||||||
return this->toDecimalhushString();
|
return this->toDecimalhushString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalhushCHFString() const {
|
QString CAmount::toDecimalhushCHFString() const
|
||||||
|
{
|
||||||
auto chfString = this->toDecimalCHFString();
|
auto chfString = this->toDecimalCHFString();
|
||||||
if (!chfString.isEmpty())
|
if (!chfString.isEmpty())
|
||||||
return this->toDecimalhushString() % " (" % chfString % ")";
|
return this->toDecimalhushString() % " (" % chfString % ")";
|
||||||
|
|
||||||
else
|
else
|
||||||
return this->toDecimalhushString();
|
return this->toDecimalhushString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalhushINRString() const {
|
QString CAmount::toDecimalhushINRString() const
|
||||||
|
{
|
||||||
auto inrString = this->toDecimalINRString();
|
auto inrString = this->toDecimalINRString();
|
||||||
if (!inrString.isEmpty())
|
if (!inrString.isEmpty())
|
||||||
return this->toDecimalhushString() % " (" % inrString % ")";
|
return this->toDecimalhushString() % " (" % inrString % ")";
|
||||||
|
|
||||||
else
|
else
|
||||||
return this->toDecimalhushString();
|
return this->toDecimalhushString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalhushGBPString() const {
|
QString CAmount::toDecimalhushGBPString() const
|
||||||
|
{
|
||||||
auto gbpString = this->toDecimalGBPString();
|
auto gbpString = this->toDecimalGBPString();
|
||||||
if (!gbpString.isEmpty())
|
if (!gbpString.isEmpty())
|
||||||
return this->toDecimalhushString() % " (" % gbpString % ")";
|
return this->toDecimalhushString() % " (" % gbpString % ")";
|
||||||
|
|
||||||
else
|
else
|
||||||
return this->toDecimalhushString();
|
return this->toDecimalhushString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAmount::toDecimalhushAUDString() const {
|
QString CAmount::toDecimalhushAUDString() const
|
||||||
|
{
|
||||||
auto audString = this->toDecimalAUDString();
|
auto audString = this->toDecimalAUDString();
|
||||||
if (!audString.isEmpty())
|
if (!audString.isEmpty())
|
||||||
return this->toDecimalhushString() % " (" % audString % ")";
|
return this->toDecimalhushString() % " (" % audString % ")";
|
||||||
|
|
||||||
else
|
else
|
||||||
return this->toDecimalhushString();
|
return this->toDecimalhushString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CAmount CAmount::fromDecimalString(QString decimalString) {
|
CAmount CAmount::fromDecimalString(QString decimalString)
|
||||||
|
{
|
||||||
auto amtParts = decimalString.split(".");
|
auto amtParts = decimalString.split(".");
|
||||||
qint64 r = amtParts[0].toULongLong() * COIN;
|
qint64 r = amtParts[0].toULongLong() * COIN;
|
||||||
if (amtParts.length() == 2) {
|
if (amtParts.length() == 2)
|
||||||
|
{
|
||||||
auto trailingZeros = QString("0").repeated(NUMPLACES - amtParts[1].length());
|
auto trailingZeros = QString("0").repeated(NUMPLACES - amtParts[1].length());
|
||||||
r += QString(amtParts[1] + trailingZeros).toULongLong();
|
r += QString(amtParts[1] + trailingZeros).toULongLong();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public:
|
|||||||
|
|
||||||
double toDecimalDouble() const;
|
double toDecimalDouble() const;
|
||||||
QString toDecimalString() const;
|
QString toDecimalString() const;
|
||||||
|
double getDblAmount() const;
|
||||||
QString toDecimalUSDString() const;
|
QString toDecimalUSDString() const;
|
||||||
QString toDecimalEURString() const;
|
QString toDecimalEURString() const;
|
||||||
QString toDecimalBTCString() const;
|
QString toDecimalBTCString() const;
|
||||||
|
|||||||
@@ -5,42 +5,47 @@
|
|||||||
#include "firsttimewizard.h"
|
#include "firsttimewizard.h"
|
||||||
#include "ui_createhushconfdialog.h"
|
#include "ui_createhushconfdialog.h"
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
|
|
||||||
|
|
||||||
#include "../lib/silentdragonlitelib.h"
|
#include "../lib/silentdragonlitelib.h"
|
||||||
|
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
ConnectionLoader::ConnectionLoader(MainWindow* main, Controller* rpc) {
|
ConnectionLoader::ConnectionLoader(MainWindow* main, Controller* rpc)
|
||||||
|
{
|
||||||
this->main = main;
|
this->main = main;
|
||||||
this->rpc = rpc;
|
this->rpc = rpc;
|
||||||
|
|
||||||
d = new QDialog(main);
|
d = new QDialog(main);
|
||||||
connD = new Ui_ConnectionDialog();
|
connD = new Ui_ConnectionDialog();
|
||||||
connD->setupUi(d);
|
connD->setupUi(d);
|
||||||
QPixmap logo(":/img/res/logobig.gif");
|
QPixmap logo(":/img/res/logobig.gif");
|
||||||
connD->topIcon->setBasePixmap(logo.scaled(256, 256, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
connD->topIcon->setBasePixmap(
|
||||||
|
logo.scaled(
|
||||||
|
256,
|
||||||
|
256,
|
||||||
|
Qt::KeepAspectRatio,
|
||||||
|
Qt::SmoothTransformation
|
||||||
|
)
|
||||||
|
);
|
||||||
isSyncing = new QAtomicInteger<bool>();
|
isSyncing = new QAtomicInteger<bool>();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionLoader::~ConnectionLoader() {
|
ConnectionLoader::~ConnectionLoader()
|
||||||
|
{
|
||||||
delete isSyncing;
|
delete isSyncing;
|
||||||
delete connD;
|
delete connD;
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionLoader::loadConnection() {
|
void ConnectionLoader::loadConnection()
|
||||||
|
{
|
||||||
QTimer::singleShot(1, [=]() { this->doAutoConnect(); });
|
QTimer::singleShot(1, [=]() { this->doAutoConnect(); });
|
||||||
if (!Settings::getInstance()->isHeadless())
|
if (!Settings::getInstance()->isHeadless())
|
||||||
d->exec();
|
d->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionLoader::doAutoConnect() {
|
void ConnectionLoader::doAutoConnect()
|
||||||
|
{
|
||||||
qDebug() << "Doing autoconnect";
|
qDebug() << "Doing autoconnect";
|
||||||
|
|
||||||
auto config = std::shared_ptr<ConnectionConfig>(new ConnectionConfig());
|
auto config = std::shared_ptr<ConnectionConfig>(new ConnectionConfig());
|
||||||
config->dangerous = true;
|
config->dangerous = true;
|
||||||
config->server = Settings::getInstance()->getSettings().server;
|
config->server = Settings::getInstance()->getSettings().server;
|
||||||
@@ -49,16 +54,24 @@ void ConnectionLoader::doAutoConnect() {
|
|||||||
main->logger->write(QObject::tr("Attempting to initialize library with ") + config->server);
|
main->logger->write(QObject::tr("Attempting to initialize library with ") + config->server);
|
||||||
|
|
||||||
// Check to see if there's an existing wallet
|
// Check to see if there's an existing wallet
|
||||||
if (litelib_wallet_exists(Settings::getDefaultChainName().toStdString().c_str())) {
|
if (litelib_wallet_exists(Settings::getDefaultChainName().toStdString().c_str()))
|
||||||
|
{
|
||||||
main->logger->write(QObject::tr("Using existing wallet."));
|
main->logger->write(QObject::tr("Using existing wallet."));
|
||||||
char* resp = litelib_initialize_existing(config->dangerous, config->server.toStdString().c_str());
|
char* resp = litelib_initialize_existing(
|
||||||
|
config->dangerous,
|
||||||
|
config->server.toStdString().c_str()
|
||||||
|
);
|
||||||
QString response = litelib_process_response(resp);
|
QString response = litelib_process_response(resp);
|
||||||
|
|
||||||
if (response.toUpper().trimmed() != "OK") {
|
if (response.toUpper().trimmed() != "OK")
|
||||||
|
{
|
||||||
showError(response);
|
showError(response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
main->logger->write(QObject::tr("Create/restore wallet."));
|
main->logger->write(QObject::tr("Create/restore wallet."));
|
||||||
createOrRestore(config->dangerous, config->server);
|
createOrRestore(config->dangerous, config->server);
|
||||||
d->show();
|
d->show();
|
||||||
@@ -72,7 +85,6 @@ void ConnectionLoader::doAutoConnect() {
|
|||||||
// If success, set the connection
|
// If success, set the connection
|
||||||
main->logger->write("Connection is online.");
|
main->logger->write("Connection is online.");
|
||||||
connection->setInfo(reply);
|
connection->setInfo(reply);
|
||||||
|
|
||||||
isSyncing = new QAtomicInteger<bool>();
|
isSyncing = new QAtomicInteger<bool>();
|
||||||
isSyncing->store(true);
|
isSyncing->store(true);
|
||||||
|
|
||||||
@@ -80,10 +92,8 @@ void ConnectionLoader::doAutoConnect() {
|
|||||||
syncTimer = new QTimer(main);
|
syncTimer = new QTimer(main);
|
||||||
connection->doRPCWithDefaultErrorHandling("sync", "", [=](auto) {
|
connection->doRPCWithDefaultErrorHandling("sync", "", [=](auto) {
|
||||||
isSyncing->store(false);
|
isSyncing->store(false);
|
||||||
|
|
||||||
// Cancel the timer
|
// Cancel the timer
|
||||||
syncTimer->deleteLater();
|
syncTimer->deleteLater();
|
||||||
|
|
||||||
// When sync is done, set the connection
|
// When sync is done, set the connection
|
||||||
this->doRPCSetConnection(connection);
|
this->doRPCSetConnection(connection);
|
||||||
});
|
});
|
||||||
@@ -94,10 +104,13 @@ void ConnectionLoader::doAutoConnect() {
|
|||||||
if (isSyncing != nullptr && isSyncing->load()) {
|
if (isSyncing != nullptr && isSyncing->load()) {
|
||||||
// Get the sync status
|
// Get the sync status
|
||||||
connection->doRPC("syncstatus", "", [=](json reply) {
|
connection->doRPC("syncstatus", "", [=](json reply) {
|
||||||
if (isSyncing != nullptr && reply.find("synced_blocks") != reply.end()) {
|
if (isSyncing != nullptr && reply.find("synced_blocks") != reply.end())
|
||||||
|
{
|
||||||
qint64 synced = reply["synced_blocks"].get<json::number_unsigned_t>();
|
qint64 synced = reply["synced_blocks"].get<json::number_unsigned_t>();
|
||||||
qint64 total = reply["total_blocks"].get<json::number_unsigned_t>();
|
qint64 total = reply["total_blocks"].get<json::number_unsigned_t>();
|
||||||
me->showInformation("Synced " + QString::number(synced) + " / " + QString::number(total));
|
me->showInformation(
|
||||||
|
"Synced " + QString::number(synced) + " / " + QString::number(total)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[=](QString err) {
|
[=](QString err) {
|
||||||
@@ -114,104 +127,110 @@ void ConnectionLoader::doAutoConnect() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionLoader::createOrRestore(bool dangerous, QString server) {
|
void ConnectionLoader::createOrRestore(bool dangerous, QString server)
|
||||||
|
{
|
||||||
// Close the startup dialog, since we'll be showing the wizard
|
// Close the startup dialog, since we'll be showing the wizard
|
||||||
d->hide();
|
d->hide();
|
||||||
|
|
||||||
// Create a wizard
|
// Create a wizard
|
||||||
FirstTimeWizard wizard(dangerous, server);
|
FirstTimeWizard wizard(dangerous, server);
|
||||||
|
|
||||||
wizard.exec();
|
wizard.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionLoader::doRPCSetConnection(Connection* conn) {
|
void ConnectionLoader::doRPCSetConnection(Connection* conn)
|
||||||
|
{
|
||||||
qDebug() << "Connectionloader finished, setting connection";
|
qDebug() << "Connectionloader finished, setting connection";
|
||||||
rpc->setConnection(conn);
|
rpc->setConnection(conn);
|
||||||
|
|
||||||
d->accept();
|
d->accept();
|
||||||
|
|
||||||
QTimer::singleShot(1, [=]() { delete this; });
|
QTimer::singleShot(1, [=]() { delete this; });
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection* ConnectionLoader::makeConnection(std::shared_ptr<ConnectionConfig> config) {
|
Connection* ConnectionLoader::makeConnection(std::shared_ptr<ConnectionConfig> config)
|
||||||
|
{
|
||||||
return new Connection(main, config);
|
return new Connection(main, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the UI with the status
|
// Update the UI with the status
|
||||||
void ConnectionLoader::showInformation(QString info, QString detail) {
|
void ConnectionLoader::showInformation(QString info, QString detail)
|
||||||
|
{
|
||||||
connD->status->setText(info);
|
connD->status->setText(info);
|
||||||
connD->statusDetail->setText(detail);
|
connD->statusDetail->setText(detail);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show error will close the loading dialog and show an error.
|
* Show error will close the loading dialog and show an error.
|
||||||
*/
|
*/
|
||||||
void ConnectionLoader::showError(QString explanation) {
|
void ConnectionLoader::showError(QString explanation)
|
||||||
|
{
|
||||||
rpc->noConnection();
|
rpc->noConnection();
|
||||||
|
QMessageBox::critical(
|
||||||
QMessageBox::critical(main, QObject::tr("Connection Error"), explanation, QMessageBox::Ok);
|
main,
|
||||||
|
QObject::tr("Connection Error"),
|
||||||
|
explanation,
|
||||||
|
QMessageBox::Ok
|
||||||
|
);
|
||||||
d->close();
|
d->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString litelib_process_response(char* resp) {
|
QString litelib_process_response(char* resp)
|
||||||
|
{
|
||||||
char* resp_copy = new char[strlen(resp) + 1];
|
char* resp_copy = new char[strlen(resp) + 1];
|
||||||
strcpy(resp_copy, resp);
|
//a safer version of strcpy
|
||||||
|
strncpy(resp_copy, resp, strlen(resp)+1);
|
||||||
litelib_rust_free_string(resp);
|
litelib_rust_free_string(resp);
|
||||||
|
|
||||||
QString reply = QString::fromStdString(resp_copy);
|
QString reply = QString::fromStdString(resp_copy);
|
||||||
memset(resp_copy, '-', strlen(resp_copy));
|
memset(resp_copy, '-', strlen(resp_copy));
|
||||||
delete[] resp_copy;
|
delete[] resp_copy;
|
||||||
|
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************
|
/***********************************************************************************
|
||||||
* Connection, Executor and Callback Class
|
* Connection, Executor and Callback Class
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
void Executor::run() {
|
void Executor::run()
|
||||||
|
{
|
||||||
char* resp = litelib_execute(this->cmd.toStdString().c_str(), this->args.toStdString().c_str());
|
char* resp = litelib_execute(this->cmd.toStdString().c_str(), this->args.toStdString().c_str());
|
||||||
|
|
||||||
QString reply = litelib_process_response(resp);
|
QString reply = litelib_process_response(resp);
|
||||||
|
|
||||||
//qDebug() << "RPC Reply=" << reply;
|
//qDebug() << "RPC Reply=" << reply;
|
||||||
auto parsed = json::parse(reply.toStdString().c_str(), nullptr, false);
|
auto parsed = json::parse(
|
||||||
if (parsed.is_discarded() || parsed.is_null()) {
|
reply.toStdString().c_str(),
|
||||||
|
nullptr,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
if (parsed.is_discarded() || parsed.is_null())
|
||||||
emit handleError(reply);
|
emit handleError(reply);
|
||||||
} else {
|
|
||||||
|
else
|
||||||
emit responseReady(parsed);
|
emit responseReady(parsed);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Callback::processRPCCallback(json resp) {
|
void Callback::processRPCCallback(json resp)
|
||||||
|
{
|
||||||
this->cb(resp);
|
this->cb(resp);
|
||||||
|
|
||||||
// Destroy self
|
// Destroy self
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Callback::processError(QString resp) {
|
void Callback::processError(QString resp)
|
||||||
|
{
|
||||||
this->errCb(resp);
|
this->errCb(resp);
|
||||||
|
|
||||||
// Destroy self
|
// Destroy self
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection::Connection(MainWindow* m, std::shared_ptr<ConnectionConfig> conf) {
|
Connection::Connection(MainWindow* m, std::shared_ptr<ConnectionConfig> conf)
|
||||||
|
{
|
||||||
this->config = conf;
|
this->config = conf;
|
||||||
this->main = m;
|
this->main = m;
|
||||||
|
|
||||||
// Register the JSON type as a type that can be passed between signals and slots.
|
// Register the JSON type as a type that can be passed between signals and slots.
|
||||||
qRegisterMetaType<json>("json");
|
qRegisterMetaType<json>("json");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::doRPC(const QString cmd, const QString args, const std::function<void(json)>& cb,
|
void Connection::doRPC(const QString cmd, const QString args, const std::function<void(json)>& cb, const std::function<void(QString)>& errCb)
|
||||||
const std::function<void(QString)>& errCb) {
|
{
|
||||||
if (shutdownInProgress) {
|
if (shutdownInProgress)
|
||||||
// Ignoring RPC because shutdown in progress
|
// Ignoring RPC because shutdown in progress
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
//qDebug() << "Doing RPC: " << cmd;
|
//qDebug() << "Doing RPC: " << cmd;
|
||||||
|
|
||||||
@@ -223,24 +242,27 @@ void Connection::doRPC(const QString cmd, const QString args, const std::functio
|
|||||||
|
|
||||||
QObject::connect(runner, &Executor::responseReady, c, &Callback::processRPCCallback);
|
QObject::connect(runner, &Executor::responseReady, c, &Callback::processRPCCallback);
|
||||||
QObject::connect(runner, &Executor::handleError, c, &Callback::processError);
|
QObject::connect(runner, &Executor::handleError, c, &Callback::processError);
|
||||||
|
|
||||||
QThreadPool::globalInstance()->start(runner);
|
QThreadPool::globalInstance()->start(runner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::doRPCWithDefaultErrorHandling(const QString cmd, const QString args, const std::function<void(json)>& cb) {
|
void Connection::doRPCWithDefaultErrorHandling(const QString cmd, const QString args, const std::function<void(json)>& cb)
|
||||||
|
{
|
||||||
doRPC(cmd, args, cb, [=] (QString err) {
|
doRPC(cmd, args, cb, [=] (QString err) {
|
||||||
this->showTxError(err);
|
this->showTxError(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::doRPCIgnoreError(const QString cmd, const QString args, const std::function<void(json)>& cb) {
|
void Connection::doRPCIgnoreError(const QString cmd, const QString args, const std::function<void(json)>& cb)
|
||||||
|
{
|
||||||
doRPC(cmd, args, cb, [=] (auto) {
|
doRPC(cmd, args, cb, [=] (auto) {
|
||||||
// Ignored error handling
|
// Ignored error handling
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::showTxError(const QString& error) {
|
void Connection::showTxError(const QString& error)
|
||||||
if (error.isNull()) return;
|
{
|
||||||
|
if (error.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
// Prevent multiple dialog boxes from showing, because they're all called async
|
// Prevent multiple dialog boxes from showing, because they're all called async
|
||||||
static bool shown = false;
|
static bool shown = false;
|
||||||
@@ -248,14 +270,19 @@ void Connection::showTxError(const QString& error) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
shown = true;
|
shown = true;
|
||||||
QMessageBox::critical(main, QObject::tr("Transaction Error"), QObject::tr("There was an error sending the transaction. The error was:") + "\n\n"
|
QMessageBox::critical(
|
||||||
+ error, QMessageBox::StandardButton::Ok);
|
main,
|
||||||
|
QObject::tr("Transaction Error"),
|
||||||
|
QObject::tr("There was an error sending the transaction. The error was:") + "\n\n" + error,
|
||||||
|
QMessageBox::StandardButton::Ok
|
||||||
|
);
|
||||||
shown = false;
|
shown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent all future calls from going through
|
* Prevent all future calls from going through
|
||||||
*/
|
*/
|
||||||
void Connection::shutdown() {
|
void Connection::shutdown()
|
||||||
|
{
|
||||||
shutdownInProgress = true;
|
shutdownInProgress = true;
|
||||||
}
|
}
|
||||||
|
|||||||
1646
src/controller.cpp
1646
src/controller.cpp
File diff suppressed because it is too large
Load Diff
@@ -463,6 +463,7 @@ void MainWindow::setupSettingsModal() {
|
|||||||
|
|
||||||
// List of default servers
|
// List of default servers
|
||||||
settings.cmbServer->addItem("https://lite.myhush.org");
|
settings.cmbServer->addItem("https://lite.myhush.org");
|
||||||
|
settings.cmbServer->addItem("rnhk4pwlsbaqzx7wcqfy47lijf2opklstaukq35reiz5rn76crfqpjqd.onion:9067");
|
||||||
|
|
||||||
|
|
||||||
// Load current values into the dialog
|
// Load current values into the dialog
|
||||||
|
|||||||
Reference in New Issue
Block a user