24
.travis.yml
24
.travis.yml
@@ -1,27 +1,43 @@
|
||||
language: rust
|
||||
matrix:
|
||||
include:
|
||||
# works on Precise and Trusty
|
||||
- os: linux
|
||||
- dist: xenial
|
||||
compiler: clang
|
||||
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7']
|
||||
packages: ['clang-3.7', 'g++-8']
|
||||
packages: ['clang-3.7', 'g++-5']
|
||||
|
||||
|
||||
|
||||
|
||||
before_script:
|
||||
- export PATH="$PATH:$HOME/.cargo/bin"
|
||||
|
||||
|
||||
before_install:
|
||||
|
||||
- gem install bundler
|
||||
- curl -sSL https://sh.rustup.rs | sh -s -- -y --default-toolchain=nightly --profile=minimal
|
||||
- export PATH="$PATH:$HOME/.cargo/bin"
|
||||
- sudo add-apt-repository ppa:beineri/opt-qt591-xenial -y
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install qt59base qt59websockets libgl1-mesa-dev
|
||||
- source /opt/qt59/bin/qt59-env.sh
|
||||
|
||||
|
||||
script:
|
||||
|
||||
- qmake -v
|
||||
- clang++ -v
|
||||
- g++-8 -v
|
||||
- g++-5 -v
|
||||
- qmake silentdragon-lite.pro CONFIG+=release -spec linux-clang
|
||||
- make CC=clang CXX=clang++ -j2
|
||||
- make distclean
|
||||
- qmake silentdragon-lite.pro CONFIG+=release -spec linux-g++
|
||||
- res/libsodium/buildlibsodium.sh
|
||||
- make CC=gcc-8 CXX=g++-8 -j2
|
||||
- make CC=gcc-5 CXX=g++-5 -j2
|
||||
|
||||
|
||||
59
DEVELOPING.md
Normal file
59
DEVELOPING.md
Normal file
@@ -0,0 +1,59 @@
|
||||
|
||||
## Crosscompile for Windows (only tested for Ubuntu 18.04)
|
||||
|
||||
```
|
||||
# build dependencies
|
||||
sudo apt install clang g++ build-essential make mingw-w64 git pkg-config libc6-dev m4 g++-multilib autoconf libtool-bin ncurses-dev unzip python python-zmq zlib1g-dev wget curl bsdmainutils automake libgl1-mesa-dev libglu1-mesa-dev libfontconfig1-dev autopoint libssl-dev
|
||||
|
||||
# MXE dependencies
|
||||
sudo apt install bash bison bzip2 flex gettext git gperf intltool libc6-dev-i386 libgdk-pixbuf2.0-dev libltdl-dev libtool-bin libxml-parser-perl make openssl p7zip-full patch perl pkg-config python ruby sed unzip wget xz-utils
|
||||
|
||||
```
|
||||
# Compile OpenSSL
|
||||
|
||||
```
|
||||
# Download openssl 1.0.2
|
||||
https://www.openssl.org/source/
|
||||
cd openssl
|
||||
./Configure linux-x86_64
|
||||
make
|
||||
```
|
||||
## Static build of Qt5
|
||||
|
||||
# Download Qt5 sources
|
||||
```
|
||||
mkdir -p ~/Qt/5.11.2 && cd ~/Qt/5.11.2
|
||||
|
||||
wget https://download.qt.io/archive/qt/5.11/5.11.2/single/qt-everywhere-src-5.11.2.tar.xz
|
||||
tar xvf qt-everywhere-src-5.11.2.tar.xz && cd qt-everywhere-src-5.11.2
|
||||
|
||||
```
|
||||
# Configure and build Qt5 statically.
|
||||
```
|
||||
OPENSSL_LIBS='-L/PATH/TO/openssl-1.0.2q -lssl -lcrypto' ./configure -static -prefix ~/Qt/5.11.2/static -skip qtlocation -skip qtmacextras -skip qtpurchasing -skip qtscript -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtdatavis3d -skip qtdoc -skip qtcharts -skip qtdeclarative -skip qt3d -skip qtwebengine -skip qtandroidextras -skip qtwebview -skip qtgamepad -skip qtquickcontrols -skip qtquickcontrols2 -skip qtremoteobjects -skip qtwebview -skip qtwebchannel -skip qtwebglplugin -nomake examples -nomake tests -qt-zlib -qt-libpng -qt-xcb -qt-xkbcommon -feature-fontconfig -no-feature-getentropy -release -openssl-linked -opensource
|
||||
|
||||
make -j$(nproc)
|
||||
make -j$(nproc) install
|
||||
|
||||
```
|
||||
# Build MXE (Cross-compiled Qt5 for Windows in Linux)
|
||||
```
|
||||
mkdir ~/github && cd ~/github
|
||||
git clone https://github.com/mxe/mxe.git
|
||||
cd mxe
|
||||
|
||||
make -j$(nproc) MXE_TARGETS=x86_64-w64-mingw32.static qtbase qtwebsockets
|
||||
|
||||
```
|
||||
# Build SilentDragonLite .exe
|
||||
```
|
||||
cd SilentDragonLite
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.38.0 -y
|
||||
echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
|
||||
~/.cargo/bin/rustup target add x86_64-pc-windows-gnu
|
||||
echo "[target.x86_64-pc-windows-gnu]" >> ~/.cargo/config
|
||||
echo "linker = 'x86_64-w64-mingw32.static-gcc'" >> ~/.cargo/config
|
||||
|
||||
./win-static-build.sh
|
||||
|
||||
```
|
||||
33
README.md
33
README.md
@@ -1,19 +1,36 @@
|
||||
SilenDragonLite is z-Addr first, Sapling compatible wallet lightwallet for Hush.
|
||||
# SilentDragonLite
|
||||
|
||||
SilentDragonLite is a lightwallet for HUSH ($HUSH) runs on Linux and Windows which does not require you to download the full blockchain. This is experimental software under active development!
|
||||
|
||||
[](https://postimg.cc/fSVf880D)
|
||||
|
||||
[](https://postimg.cc/mcZMdm0J)
|
||||
|
||||
[](https://postimg.cc/KkThwDSd)
|
||||
|
||||
## PRIVACY NOTICE
|
||||
|
||||
SilentDragonLite contacts a few different external websites to get various bits of data. * coingecko.com for price data API * explorer.myhush.org for explorer links * dexstats.info for address utilities, hush-lightwallet.de to get Data.
|
||||
|
||||
This means your IP address is known to these servers. Enable Tor setting in SilentDragon to prevent this, or better yet, use TAILS: https://tails.boum.org/
|
||||
|
||||
## Installation
|
||||
|
||||
Go to the releases page and grab the latest installers or binary. https://github.com/MyHush/SilentDragonLite/releases
|
||||
|
||||
## Compiling from source
|
||||
* silentdragon is written in C++ 14, and can be compiled with g++/clang++/visual c++.
|
||||
* SilentDragonLite is written in C++ 14, and can be compiled with g++/clang++/visual c++.
|
||||
* It also depends on Qt5, which you can get from [here](https://www.qt.io/download).
|
||||
* You'll need Rust v1.37 +
|
||||
|
||||
### Building on Linux
|
||||
## Building on Linux
|
||||
|
||||
```
|
||||
git clone https://github.com/DenioD/SilenDragonLite.git
|
||||
git clone https://github.com/MyHush/SilenDragonLite.git
|
||||
cd silentdragonlite
|
||||
/path/to/qt5/bin/qmake silentdragon-lite.pro CONFIG+=debug
|
||||
make -j$(nproc)
|
||||
./build.sh
|
||||
./Silentdragonlite
|
||||
|
||||
./silentdragonlite
|
||||
```
|
||||
|
||||
_PS: SilentDragonLite is NOT an official wallet, and is not affiliated with the Electric Coin Company in any way._
|
||||
|
||||
|
||||
BIN
Silentdragonlite
BIN
Silentdragonlite
Binary file not shown.
@@ -14,6 +14,10 @@
|
||||
</qresource>
|
||||
<qresource prefix="/translations">
|
||||
<file>res/zec_qt_wallet_de.qm</file>
|
||||
<file>res/zec_qt_wallet_es.qm</file>
|
||||
<file>res/zec_qt_wallet_fr.qm</file>
|
||||
<file>res/zec_qt_wallet_pt.qm</file>
|
||||
<file>res/zec_qt_wallet_it.qm</file>
|
||||
</qresource>
|
||||
<qresource prefix="/css">
|
||||
<file>res/css/blue.css</file>
|
||||
|
||||
38
build.sh
Executable file
38
build.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2019 The Hush Developers
|
||||
|
||||
UNAME=$(uname)
|
||||
|
||||
if [ "$UNAME" == "Linux" ] ; then
|
||||
JOBS=$(nproc)
|
||||
elif [ "$UNAME" == "FreeBSD" ] ; then
|
||||
JOBS=$(nproc)
|
||||
elif [ "$UNAME" == "Darwin" ] ; then
|
||||
JOBS=$(sysctl -n hw.ncpu)
|
||||
else
|
||||
JOBS=1
|
||||
fi
|
||||
|
||||
VERSION=$(cat src/version.h |cut -d\" -f2)
|
||||
echo "Compiling SilentDragonLite $VERSION with $JOBS threads..."
|
||||
CONF=silentdragon-lite.pro
|
||||
|
||||
set -e
|
||||
qbuild () {
|
||||
qmake $CONF CONFIG+=debug
|
||||
#lupdate $CONF
|
||||
#lrelease $CONF
|
||||
make -j$JOBS
|
||||
}
|
||||
|
||||
if [ "$1" == "clean" ]; then
|
||||
make clean
|
||||
elif [ "$1" == "linguist" ]; then
|
||||
lupdate $CONF
|
||||
lrelease $CONF
|
||||
elif [ "$1" == "cleanbuild" ]; then
|
||||
make clean
|
||||
qbuild
|
||||
else
|
||||
qbuild
|
||||
fi
|
||||
@@ -1,62 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
LABEL Description="Ubuntu 16.04 for static Qt 5.11.2"
|
||||
|
||||
# Dependencies of the Qt offline installer
|
||||
RUN apt-get -y update && apt-get install -y \
|
||||
curl libdbus-1-3 libexpat1 \
|
||||
libgl1-mesa-dev libglu1-mesa-dev libfontconfig1-dev libssl-dev \
|
||||
libfreetype6 libgl1-mesa-glx libglib2.0-0 \
|
||||
libx11-6 libx11-xcb1 \
|
||||
g++ build-essential cmake wget git clang++-6.0 \
|
||||
software-properties-common \
|
||||
autoconf automake autopoint bison flex gperf libtool libtool-bin intltool lzip python ruby unzip p7zip-full libgdk-pixbuf2.0-dev libltdl-dev
|
||||
|
||||
# Hack to make clang work with Qt
|
||||
RUN ln -s /usr/bin/clang++-6.0 /usr/bin/clang++ && \
|
||||
ln -s /usr/bin/clang-6.0 /usr/bin/clang
|
||||
|
||||
# Get OpenSSL
|
||||
RUN cd /opt && wget https://www.openssl.org/source/openssl-1.0.2r.tar.gz && \
|
||||
tar xvf openssl-1.0.2r.tar.gz && \
|
||||
cd openssl-1.0.2r && ./Configure linux-x86_64 && make -j$(nproc) && \
|
||||
cd /opt && rm openssl-1.0.2r.tar.gz
|
||||
|
||||
# Get Qt5.11.2
|
||||
RUN cd /opt && \
|
||||
wget https://download.qt.io/archive/qt/5.11/5.11.2/single/qt-everywhere-src-5.11.2.tar.xz && \
|
||||
tar xvf qt-everywhere-src-5.11.2.tar.xz && \
|
||||
cd qt-everywhere-src-5.11.2 && \
|
||||
OPENSSL_LIBS='-L/opt/openssl-1.0.2r -lssl -lcrypto' ./configure -static -prefix /opt/Qt/5.11.2/static -skip qtlocation -skip qtmacextras -skip qtpurchasing -skip qtscript -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtdatavis3d -skip qtdoc -skip qtcharts -skip qtdeclarative -skip qt3d -skip qtwebengine -skip qtandroidextras -skip qtwebview -skip qtgamepad -skip qtquickcontrols -skip qtquickcontrols2 -skip qtremoteobjects -skip qtwebview -skip qtwebchannel -skip qtwebglplugin -nomake examples -nomake tests -qt-zlib -qt-libpng -qt-xcb -qt-xkbcommon -feature-fontconfig -no-feature-getentropy -release -openssl-linked -platform linux-clang -opensource -confirm-license
|
||||
|
||||
# Run the make multiple times, because for some reason (multithreading, probably) it fails
|
||||
# the first time.
|
||||
RUN cd /opt/qt-everywhere-src-5.11.2 && ( make -j$(nproc) || make -j4 || make )
|
||||
|
||||
RUN mkdir -p /opt/Qt/5.11.2 && cd /opt/qt-everywhere-src-5.11.2 && make -j4 install
|
||||
|
||||
RUN cd /opt && rm qt-everywhere-src-5.11.2.tar.xz && rm -rf qt-everywhere-src-5.11.2
|
||||
|
||||
# Get and build MXE
|
||||
RUN cd /opt && \
|
||||
git clone https://github.com/mxe/mxe.git && \
|
||||
cd /opt/mxe && \
|
||||
make -j$(nproc) MXE_TARGETS=x86_64-w64-mingw32.static qtbase qtwebsockets
|
||||
|
||||
# Add rust
|
||||
RUN apt install -y gcc-aarch64-linux-gnu
|
||||
|
||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.38.0 -y
|
||||
RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
|
||||
RUN ~/.cargo/bin/rustup target add x86_64-pc-windows-gnu
|
||||
RUN ~/.cargo/bin/rustup target add aarch64-unknown-linux-gnu
|
||||
|
||||
# Append the linker to the cargo config for Windows cross compile
|
||||
RUN echo "[target.x86_64-pc-windows-gnu]" >> ~/.cargo/config && \
|
||||
echo "linker = 'x86_64-w64-mingw32.static-gcc'" >> ~/.cargo/config
|
||||
|
||||
RUN echo "[target.aarch64-unknown-linux-gnu]" >> ~/.cargo/config && \
|
||||
echo "linker = '/usr/bin/aarch64-linux-gnu-gcc'" >> ~/.cargo/config
|
||||
|
||||
ENV CC_x86_64_pc_windows_gnu="x86_64-w64-mingw32.static-gcc"
|
||||
ENV CC_aarch64_unknown_linux_gnu="aarch64-linux-gnu-gcc"
|
||||
ENV PATH="/opt/mxe/usr/bin:${PATH}"
|
||||
@@ -7,7 +7,6 @@ use std::ffi::{CStr, CString};
|
||||
use std::sync::{Mutex, Arc};
|
||||
use std::cell::RefCell;
|
||||
|
||||
|
||||
use silentdragonlitelib::{commands, lightclient::{LightClient, LightClientConfig}};
|
||||
|
||||
// We'll use a MUTEX to store a global lightclient instance,
|
||||
|
||||
39
linux-static-build.sh
Executable file
39
linux-static-build.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2019 The Hush Developers
|
||||
|
||||
UNAME=$(uname)
|
||||
|
||||
if [ "$UNAME" == "Linux" ] ; then
|
||||
JOBS=$(nproc)
|
||||
elif [ "$UNAME" == "FreeBSD" ] ; then
|
||||
JOBS=$(nproc)
|
||||
elif [ "$UNAME" == "Darwin" ] ; then
|
||||
JOBS=$(sysctl -n hw.ncpu)
|
||||
else
|
||||
JOBS=1
|
||||
fi
|
||||
|
||||
|
||||
VERSION=$(cat src/version.h |cut -d\" -f2)
|
||||
echo "Compiling SilentDragonLite $VERSION with $JOBS threads..."
|
||||
CONF=silentdragon-lite.pro
|
||||
|
||||
set -e
|
||||
qbuild () {
|
||||
/home/$USER/Qt/5.11.2/static/bin/qmake $CONF CONFIG+=debug
|
||||
#lupdate $CONF
|
||||
#lrelease $CONF
|
||||
make -j$JOBS
|
||||
}
|
||||
|
||||
if [ "$1" == "clean" ]; then
|
||||
make clean
|
||||
elif [ "$1" == "linguist" ]; then
|
||||
lupdate $CONF
|
||||
lrelease $CONF
|
||||
elif [ "$1" == "cleanbuild" ]; then
|
||||
make clean
|
||||
qbuild
|
||||
else
|
||||
qbuild
|
||||
fi
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 30 KiB |
BIN
res/icon.ico
BIN
res/icon.ico
Binary file not shown.
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 401 KiB |
BIN
res/logobig.gif
BIN
res/logobig.gif
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 18 KiB |
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ PRECOMPILED_HEADER = src/precompiled.h
|
||||
QT += widgets
|
||||
QT += websockets
|
||||
|
||||
TARGET = Silentdragonlite
|
||||
TARGET = SilentDragonLite
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
@@ -124,7 +124,6 @@ TRANSLATIONS = res/zec_qt_wallet_es.ts \
|
||||
res/zec_qt_wallet_zh.ts \
|
||||
res/zec_qt_wallet_tr.ts
|
||||
|
||||
|
||||
include(singleapplication/singleapplication.pri)
|
||||
DEFINES += QAPPLICATION_CLASS=QApplication
|
||||
|
||||
|
||||
26
src/about.ui
26
src/about.ui
@@ -41,7 +41,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>463</width>
|
||||
<height>517</height>
|
||||
<height>551</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
@@ -51,17 +51,19 @@
|
||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.1pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Copyright (c) 2018-2019 Aditya Kulkarni. (MIT License)</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Special thanks to:</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">JSON for Modern C++ : </span><a href="https://nlohmann.github.io/json/"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">https://nlohmann.github.io/json/</span></a></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">QR Code generator library Nayuki : </span><a href="https://www.nayuki.io/page/qr-code-generator-library"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">https://www.nayuki.io/page/qr-code-ge…</span></a></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Made with QT : </span><a href="https://www.qt.io/"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">https://www.qt.io/</span></a></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">LICENSE:</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</span></p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'Ubuntu'; font-size:11pt;" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</li>
|
||||
<li style=" font-family:'Ubuntu'; font-size:11pt;" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The Software is provided &quot;as is&quot;, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.</li></ul></body></html></string>
|
||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Copyright (c) 2019-2020 DenioD (MIT License)</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Copyright (c) 2018-2019 Aditya Kulkarni (MIT License)</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Special thanks to:</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Aditya Kulkarni for the awesome open source code</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">JSON for Modern C++ : </span><a href="https://nlohmann.github.io/json/"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;">https://nlohmann.github.io/json/</span></a></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">QR Code generator library Nayuki : </span><a href="https://www.nayuki.io/page/qr-code-generator-library"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;">https://www.nayuki.io/page/qr-code-ge…</span></a></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Made with QT : </span><a href="https://www.qt.io/"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;">https://www.qt.io/</span></a></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">LICENSE:</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</span></p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'Ubuntu';" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</li>
|
||||
<li style=" font-family:'Ubuntu';" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The Software is provided &quot;as is&quot;, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.</li></ul></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
||||
145
src/camount.cpp
145
src/camount.cpp
@@ -37,7 +37,68 @@ QString CAmount::toDecimalUSDString() const {
|
||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
||||
double price = Settings::getInstance()->getZECPrice();
|
||||
|
||||
return "$" + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
||||
return "$ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
||||
}
|
||||
|
||||
QString CAmount::toDecimalEURString() const {
|
||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
||||
double price = Settings::getInstance()->getEURPrice();
|
||||
|
||||
return QLocale(QLocale::English).toString(dblAmount*price, 'f', 2) + " €";
|
||||
}
|
||||
QString CAmount::toDecimalBTCString() const {
|
||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
||||
double price = Settings::getInstance()->getBTCPrice();
|
||||
|
||||
return "BTC " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 9);
|
||||
}
|
||||
QString CAmount::toDecimalCNYString() const {
|
||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
||||
double price = Settings::getInstance()->getCNYPrice();
|
||||
|
||||
return "¥ /元 " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
||||
}
|
||||
QString CAmount::toDecimalRUBString() const {
|
||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
||||
double price = Settings::getInstance()->getRUBPrice();
|
||||
|
||||
return "₽ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
||||
}
|
||||
QString CAmount::toDecimalCADString() const {
|
||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
||||
double price = Settings::getInstance()->getCADPrice();
|
||||
|
||||
return "$ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
||||
}
|
||||
QString CAmount::toDecimalSGDString() const {
|
||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
||||
double price = Settings::getInstance()->getSGDPrice();
|
||||
|
||||
return "$ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
||||
}
|
||||
QString CAmount::toDecimalCHFString() const {
|
||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
||||
double price = Settings::getInstance()->getCHFPrice();
|
||||
|
||||
return "CHF " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
||||
}
|
||||
QString CAmount::toDecimalINRString() const {
|
||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
||||
double price = Settings::getInstance()->getINRPrice();
|
||||
|
||||
return "₹ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
||||
}
|
||||
QString CAmount::toDecimalGBPString() const {
|
||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
||||
double price = Settings::getInstance()->getGBPPrice();
|
||||
|
||||
return "£ " + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
||||
}
|
||||
QString CAmount::toDecimalAUDString() const {
|
||||
double dblAmount = static_cast<double>(this->amount) / COIN;
|
||||
double price = Settings::getInstance()->getAUDPrice();
|
||||
|
||||
return " $" + QLocale(QLocale::English).toString(dblAmount*price, 'f', 2);
|
||||
}
|
||||
|
||||
QString CAmount::toDecimalhushString() const {
|
||||
@@ -52,6 +113,88 @@ QString CAmount::toDecimalhushUSDString() const {
|
||||
return this->toDecimalhushString();
|
||||
}
|
||||
|
||||
|
||||
QString CAmount::toDecimalhushEURString() const {
|
||||
auto eurString = this->toDecimalEURString();
|
||||
if (!eurString.isEmpty())
|
||||
return this->toDecimalhushString() % " (" % eurString % ")";
|
||||
else
|
||||
return this->toDecimalhushString();
|
||||
}
|
||||
|
||||
QString CAmount::toDecimalhushBTCString() const {
|
||||
auto btcString = this->toDecimalBTCString();
|
||||
if (!btcString.isEmpty())
|
||||
return this->toDecimalhushString() % " (" % btcString % ")";
|
||||
else
|
||||
return this->toDecimalhushString();
|
||||
}
|
||||
|
||||
QString CAmount::toDecimalhushCNYString() const {
|
||||
auto cnyString = this->toDecimalCNYString();
|
||||
if (!cnyString.isEmpty())
|
||||
return this->toDecimalhushString() % " (" % cnyString % ")";
|
||||
else
|
||||
return this->toDecimalhushString();
|
||||
}
|
||||
|
||||
QString CAmount::toDecimalhushRUBString() const {
|
||||
auto rubString = this->toDecimalRUBString();
|
||||
if (!rubString.isEmpty())
|
||||
return this->toDecimalhushString() % " (" % rubString % ")";
|
||||
else
|
||||
return this->toDecimalhushString();
|
||||
}
|
||||
|
||||
QString CAmount::toDecimalhushCADString() const {
|
||||
auto cadString = this->toDecimalCADString();
|
||||
if (!cadString.isEmpty())
|
||||
return this->toDecimalhushString() % " (" % cadString % ")";
|
||||
else
|
||||
return this->toDecimalhushString();
|
||||
}
|
||||
|
||||
QString CAmount::toDecimalhushSGDString() const {
|
||||
auto sgdString = this->toDecimalSGDString();
|
||||
if (!sgdString.isEmpty())
|
||||
return this->toDecimalhushString() % " (" % sgdString % ")";
|
||||
else
|
||||
return this->toDecimalhushString();
|
||||
}
|
||||
|
||||
QString CAmount::toDecimalhushCHFString() const {
|
||||
auto chfString = this->toDecimalCHFString();
|
||||
if (!chfString.isEmpty())
|
||||
return this->toDecimalhushString() % " (" % chfString % ")";
|
||||
else
|
||||
return this->toDecimalhushString();
|
||||
}
|
||||
|
||||
QString CAmount::toDecimalhushINRString() const {
|
||||
auto inrString = this->toDecimalINRString();
|
||||
if (!inrString.isEmpty())
|
||||
return this->toDecimalhushString() % " (" % inrString % ")";
|
||||
else
|
||||
return this->toDecimalhushString();
|
||||
}
|
||||
|
||||
QString CAmount::toDecimalhushGBPString() const {
|
||||
auto gbpString = this->toDecimalGBPString();
|
||||
if (!gbpString.isEmpty())
|
||||
return this->toDecimalhushString() % " (" % gbpString % ")";
|
||||
else
|
||||
return this->toDecimalhushString();
|
||||
}
|
||||
|
||||
QString CAmount::toDecimalhushAUDString() const {
|
||||
auto audString = this->toDecimalAUDString();
|
||||
if (!audString.isEmpty())
|
||||
return this->toDecimalhushString() % " (" % audString % ")";
|
||||
else
|
||||
return this->toDecimalhushString();
|
||||
}
|
||||
|
||||
|
||||
CAmount CAmount::fromDecimalString(QString decimalString) {
|
||||
auto amtParts = decimalString.split(".");
|
||||
qint64 r = amtParts[0].toULongLong() * COIN;
|
||||
|
||||
@@ -27,8 +27,29 @@ public:
|
||||
double toDecimalDouble() const;
|
||||
QString toDecimalString() const;
|
||||
QString toDecimalUSDString() const;
|
||||
QString toDecimalEURString() const;
|
||||
QString toDecimalBTCString() const;
|
||||
QString toDecimalCNYString() const;
|
||||
QString toDecimalRUBString() const;
|
||||
QString toDecimalCADString() const;
|
||||
QString toDecimalSGDString() const;
|
||||
QString toDecimalCHFString() const;
|
||||
QString toDecimalINRString() const;
|
||||
QString toDecimalGBPString() const;
|
||||
QString toDecimalAUDString() const;
|
||||
QString toDecimalhushString() const;
|
||||
QString toDecimalhushUSDString() const;
|
||||
QString toDecimalhushEURString() const;
|
||||
QString toDecimalhushBTCString() const;
|
||||
QString toDecimalhushCNYString() const;
|
||||
QString toDecimalhushRUBString() const;
|
||||
QString toDecimalhushCADString() const;
|
||||
QString toDecimalhushSGDString() const;
|
||||
QString toDecimalhushCHFString() const;
|
||||
QString toDecimalhushINRString() const;
|
||||
QString toDecimalhushGBPString() const;
|
||||
QString toDecimalhushAUDString() const;
|
||||
|
||||
qint64 toqint64() const { return amount; };
|
||||
|
||||
CAmount operator+ (const CAmount& other) const {
|
||||
|
||||
@@ -48,8 +48,6 @@ void ConnectionLoader::doAutoConnect() {
|
||||
// Initialize the library
|
||||
main->logger->write(QObject::tr("Attempting to initialize library with ") + config->server);
|
||||
|
||||
|
||||
|
||||
// Check to see if there's an existing wallet
|
||||
if (litelib_wallet_exists(Settings::getChainName().toStdString().c_str())) {
|
||||
main->logger->write(QObject::tr("Using existing wallet."));
|
||||
|
||||
@@ -28,10 +28,11 @@ Controller::Controller(MainWindow* main) {
|
||||
// Set up timer to refresh Price
|
||||
priceTimer = new QTimer(main);
|
||||
QObject::connect(priceTimer, &QTimer::timeout, [=]() {
|
||||
if (Settings::getInstance()->getAllowFetchPrices())
|
||||
refreshZECPrice();
|
||||
if (Settings::getInstance()->getAllowFetchPrices())
|
||||
refreshZECPrice();
|
||||
|
||||
});
|
||||
priceTimer->start(Settings::priceRefreshSpeed); // Every hour
|
||||
priceTimer->start(Settings::priceRefreshSpeed); // Every 5 Min
|
||||
|
||||
// Set up a timer to refresh the UI every few seconds
|
||||
timer = new QTimer(main);
|
||||
@@ -58,7 +59,6 @@ Controller::~Controller() {
|
||||
delete zrpc;
|
||||
}
|
||||
|
||||
|
||||
// Called when a connection to hushd is available.
|
||||
void Controller::setConnection(Connection* c) {
|
||||
if (c == nullptr) return;
|
||||
@@ -80,7 +80,6 @@ void Controller::setConnection(Connection* c) {
|
||||
refresh(true);
|
||||
}
|
||||
|
||||
|
||||
// Build the RPC JSON Parameters for this tx
|
||||
void Controller::fillTxJsonParams(json& allRecepients, Tx tx) {
|
||||
Q_ASSERT(allRecepients.is_array());
|
||||
@@ -100,7 +99,6 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Controller::noConnection() {
|
||||
QIcon i = QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical);
|
||||
main->statusIcon->setPixmap(i.pixmap(16, 16));
|
||||
@@ -166,20 +164,45 @@ void Controller::getInfoThenRefresh(bool force) {
|
||||
auto tooltip = Settings::getInstance()->getSettings().server + "\n" + QString::fromStdString(reply.dump());
|
||||
QIcon i(":/icons/res/connected.gif");
|
||||
main->statusLabel->setText(chainName + "(" + QString::number(curBlock) + ")");
|
||||
main->statusLabel->setText(" HUSH/USD=$" + QString::number( (double) Settings::getInstance()->getZECPrice() ));
|
||||
|
||||
// use currency ComboBox as input
|
||||
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
main->statusLabel->setText(" HUSH/USD=$ " + QString::number( (double) Settings::getInstance()->getZECPrice() ,'f',2));
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
main->statusLabel->setText(" HUSH/EUR=€ " + QString::number( (double) Settings::getInstance()->getEURPrice() ,'f',2));
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
main->statusLabel->setText(" HUSH/BTC=BTC " + QString::number((double) Settings::getInstance()->getBTCPrice() ,'f',8));
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
main->statusLabel->setText(" HUSH/CNY=¥ /元 " + QString::number( (double) Settings::getInstance()->getCNYPrice() ,'f',2));
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
main->statusLabel->setText(" HUSH/RUB=₽ " + QString::number((double) Settings::getInstance()->getRUBPrice() ,'f',2));
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
main->statusLabel->setText(" HUSH/CAD=$ " + QString::number( (double) Settings::getInstance()->getCADPrice() ,'f',2));
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
main->statusLabel->setText(" HUSH/SGD=$ " + QString::number((double) Settings::getInstance()->getSGDPrice() ,'f',2));
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
main->statusLabel->setText(" HUSH/CHF=CHF " + QString::number((double) Settings::getInstance()->getCHFPrice() ,'f',2));
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
main->statusLabel->setText(" HUSH/INR=₹ " + QString::number( (double) Settings::getInstance()->getINRPrice() ,'f',2));
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
main->statusLabel->setText(" HUSH/GBP=£ " + QString::number((double) Settings::getInstance()->getGBPPrice() ,'f',2));
|
||||
}else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
main->statusLabel->setText(" HUSH/AUD=$ " + QString::number((double) Settings::getInstance()->getAUDPrice() ,'f',2));
|
||||
|
||||
} else {
|
||||
main->statusLabel->setText(" error Input" + QString::number(Settings::getInstance()->getEURPrice() ));
|
||||
}
|
||||
main->statusLabel->setToolTip(tooltip);
|
||||
main->statusIcon->setPixmap(i.pixmap(16, 16));
|
||||
main->statusIcon->setToolTip(tooltip);
|
||||
|
||||
|
||||
//int version = reply["version"].get<json::string_t>();
|
||||
int version = 1;
|
||||
Settings::getInstance()->sethushdVersion(version);
|
||||
ui->Version->setText(QString::fromStdString(reply["version"].get<json::string_t>()));
|
||||
ui->Vendor->setText(QString::fromStdString(reply["vendor"].get<json::string_t>()));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// See if recurring payments needs anything
|
||||
Recurring::getInstance()->processPending(main);
|
||||
|
||||
@@ -297,14 +320,98 @@ void Controller::updateUIBalances() {
|
||||
ui->balTransparent->setText(balT.toDecimalhushString());
|
||||
ui->balTotal ->setText(balTotal.toDecimalhushString());
|
||||
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalUSDString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalUSDString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalUSDString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalUSDString());
|
||||
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalEURString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalEURString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalEURString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalEURString());
|
||||
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalBTCString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalBTCString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalBTCString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalBTCString());
|
||||
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalCNYString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalCNYString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalCNYString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalCNYString());
|
||||
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalRUBString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalRUBString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalRUBString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalRUBString());
|
||||
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalCADString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalCADString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalCADString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalCADString());
|
||||
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalSGDString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalSGDString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalSGDString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalSGDString());
|
||||
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalCHFString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalCHFString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalCHFString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalCHFString());
|
||||
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalINRString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalINRString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalINRString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalINRString());
|
||||
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalGBPString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalGBPString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalGBPString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalGBPString());
|
||||
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
ui->balSheilded ->setToolTip(balZ.toDecimalAUDString());
|
||||
ui->balVerified ->setToolTip(balVerified.toDecimalAUDString());
|
||||
ui->balTransparent->setToolTip(balT.toDecimalAUDString());
|
||||
ui->balTotal ->setToolTip(balTotal.toDecimalAUDString());
|
||||
}
|
||||
// Send tab
|
||||
ui->txtAvailablehush->setText(balAvailable.toDecimalhushString());
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalUSDString());
|
||||
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalUSDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalEURString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalBTCString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalCNYString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalRUBString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalCADString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalSGDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalCHFString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalINRString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalGBPString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
ui->txtAvailableUSD->setText(balAvailable.toDecimalAUDString());
|
||||
}
|
||||
}
|
||||
|
||||
void Controller::refreshBalances() {
|
||||
@@ -409,7 +516,7 @@ void Controller::refreshTransactions() {
|
||||
}
|
||||
|
||||
txdata.push_back(TransactionItem{
|
||||
"Sent", datetime, address, txid,confirmations, items
|
||||
"send", datetime, address, txid,confirmations, items
|
||||
});
|
||||
} else {
|
||||
// Incoming Transaction
|
||||
@@ -621,7 +728,7 @@ void Controller::refreshZECPrice() {
|
||||
return noConnection();
|
||||
|
||||
// TODO: use/render all this data
|
||||
QUrl cmcURL("https://api.coingecko.com/api/v3/simple/price?ids=hush&vs_currencies=btc%2Cusd%2Ceur&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true");
|
||||
QUrl cmcURL("https://api.coingecko.com/api/v3/simple/price?ids=hush&vs_currencies=btc%2Cusd%2Ceur%2Ceth%2Cgbp%2Ccny%2Cjpy%2Crub%2Ccad%2Csgd%2Cchf%2Cinr%2Caud%2Cinr&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true");
|
||||
|
||||
QNetworkRequest req;
|
||||
req.setUrl(cmcURL);
|
||||
@@ -642,6 +749,17 @@ void Controller::refreshZECPrice() {
|
||||
qDebug() << reply->errorString();
|
||||
}
|
||||
Settings::getInstance()->setZECPrice(0);
|
||||
Settings::getInstance()->setEURPrice(0);
|
||||
Settings::getInstance()->setBTCPrice(0);
|
||||
Settings::getInstance()->setCNYPrice(0);
|
||||
Settings::getInstance()->setRUBPrice(0);
|
||||
Settings::getInstance()->setCADPrice(0);
|
||||
Settings::getInstance()->setSGDPrice(0);
|
||||
Settings::getInstance()->setCHFPrice(0);
|
||||
Settings::getInstance()->setGBPPrice(0);
|
||||
Settings::getInstance()->setAUDPrice(0);
|
||||
Settings::getInstance()->setINRPrice(0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -651,6 +769,16 @@ void Controller::refreshZECPrice() {
|
||||
auto parsed = json::parse(all, nullptr, false);
|
||||
if (parsed.is_discarded()) {
|
||||
Settings::getInstance()->setZECPrice(0);
|
||||
Settings::getInstance()->setEURPrice(0);
|
||||
Settings::getInstance()->setBTCPrice(0);
|
||||
Settings::getInstance()->setCNYPrice(0);
|
||||
Settings::getInstance()->setRUBPrice(0);
|
||||
Settings::getInstance()->setCADPrice(0);
|
||||
Settings::getInstance()->setSGDPrice(0);
|
||||
Settings::getInstance()->setCHFPrice(0);
|
||||
Settings::getInstance()->setGBPPrice(0);
|
||||
Settings::getInstance()->setAUDPrice(0);
|
||||
Settings::getInstance()->setINRPrice(0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -659,21 +787,91 @@ void Controller::refreshZECPrice() {
|
||||
const json& item = parsed.get<json::object_t>();
|
||||
const json& hush = item["hush"].get<json::object_t>();
|
||||
|
||||
if (hush["usd"] >= 0) {
|
||||
if (hush["usd"] >= 0) {
|
||||
qDebug() << "Found hush key in price json";
|
||||
// TODO: support BTC/EUR prices as well
|
||||
//QString price = QString::fromStdString(hush["usd"].get<json::string_t>());
|
||||
|
||||
qDebug() << "HUSH = $" << QString::number((double)hush["usd"]);
|
||||
Settings::getInstance()->setZECPrice( hush["usd"] );
|
||||
return;
|
||||
}
|
||||
if (hush["eur"] >= 0)
|
||||
{
|
||||
|
||||
qDebug() << "HUSH = €" << QString::number((double)hush["eur"]);
|
||||
Settings::getInstance()->setEURPrice(hush["eur"]);
|
||||
}
|
||||
if (hush["btc"] >= 0)
|
||||
{
|
||||
|
||||
qDebug() << "HUSH = BTC" << QString::number((double)hush["btc"]);
|
||||
Settings::getInstance()->setBTCPrice( hush["btc"]);
|
||||
}
|
||||
if (hush["cny"] >= 0)
|
||||
|
||||
{
|
||||
qDebug() << "HUSH = CNY" << QString::number((double)hush["cny"]);
|
||||
Settings::getInstance()->setCNYPrice( hush["cny"]);
|
||||
}
|
||||
if (hush["rub"] >= 0)
|
||||
{
|
||||
qDebug() << "HUSH = RUB" << QString::number((double)hush["rub"]);
|
||||
Settings::getInstance()->setRUBPrice( hush["rub"]);
|
||||
}
|
||||
if (hush["cad"] >= 0)
|
||||
|
||||
{
|
||||
qDebug() << "HUSH = CAD" << QString::number((double)hush["cad"]);
|
||||
Settings::getInstance()->setCADPrice( hush["cad"]);
|
||||
}
|
||||
if (hush["sgd"] >= 0)
|
||||
{
|
||||
|
||||
qDebug() << "HUSH = SGD" << QString::number((double)hush["sgd"]);
|
||||
Settings::getInstance()->setSGDPrice( hush["sgd"]);
|
||||
}
|
||||
if (hush["chf"] >= 0)
|
||||
{
|
||||
|
||||
qDebug() << "HUSH = CHF" << QString::number((double)hush["chf"]);
|
||||
Settings::getInstance()->setCADPrice( hush["chf"]);
|
||||
}
|
||||
if (hush["inr"] >= 0)
|
||||
{
|
||||
|
||||
qDebug() << "HUSH = INR" << QString::number((double)hush["inr"]);
|
||||
Settings::getInstance()->setINRPrice( hush["inr"]);
|
||||
}
|
||||
if (hush["gbp"] >= 0)
|
||||
{
|
||||
|
||||
qDebug() << "HUSH = GBP" << QString::number((double)hush["gbp"]);
|
||||
Settings::getInstance()->setGBPPrice( hush["gbp"]);
|
||||
}
|
||||
if (hush["aud"] >= 0)
|
||||
{
|
||||
|
||||
qDebug() << "HUSH = AUD" << QString::number((double)hush["aud"]);
|
||||
Settings::getInstance()->setAUDPrice( hush["aud"]);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
} catch (const std::exception& e) {
|
||||
// If anything at all goes wrong, just set the price to 0 and move on.
|
||||
qDebug() << QString("Caught something nasty: ") << e.what();
|
||||
}
|
||||
|
||||
// If nothing, then set the price to 0;
|
||||
Settings::getInstance()->setZECPrice(0);
|
||||
Settings::getInstance()->setZECPrice(0);
|
||||
Settings::getInstance()->setEURPrice(0);
|
||||
Settings::getInstance()->setBTCPrice(0);
|
||||
Settings::getInstance()->setCNYPrice(0);
|
||||
Settings::getInstance()->setRUBPrice(0);
|
||||
Settings::getInstance()->setCADPrice(0);
|
||||
Settings::getInstance()->setSGDPrice(0);
|
||||
Settings::getInstance()->setCHFPrice(0);
|
||||
Settings::getInstance()->setGBPPrice(0);
|
||||
Settings::getInstance()->setAUDPrice(0);
|
||||
Settings::getInstance()->setINRPrice(0);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,17 @@ public:
|
||||
|
||||
void checkForUpdate(bool silent = true);
|
||||
void refreshZECPrice();
|
||||
void refreshEURPrice();
|
||||
void refreshBTCPrice();
|
||||
void refreshCNYPrice();
|
||||
void refreshRUBPrice();
|
||||
void refreshCADPrice();
|
||||
void refreshSGDPrice();
|
||||
void refreshCHFPrice();
|
||||
void refreshINRPrice();
|
||||
void refreshGBPPrice();
|
||||
void refreshAUDPrice();
|
||||
|
||||
|
||||
void executeStandardUITransaction(Tx tx);
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Allow connections to the internet to check for updates, get hush/USD prices etc...</string>
|
||||
<string>Allow connections to the internet to check for updates, get hush prices etc...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
}
|
||||
|
||||
QCoreApplication::setOrganizationName("Hush");
|
||||
QCoreApplication::setApplicationName("Silentdragonlite");
|
||||
QCoreApplication::setApplicationName("SilentDragonLite");
|
||||
|
||||
QString locale = QLocale::system().name();
|
||||
locale.truncate(locale.lastIndexOf('_')); // Get the language code
|
||||
|
||||
@@ -36,6 +36,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
this->slot_change_theme(theme_name);
|
||||
|
||||
|
||||
ui->setupUi(this);
|
||||
logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log"));
|
||||
|
||||
@@ -393,6 +394,21 @@ void MainWindow::setupSettingsModal() {
|
||||
Ui_Settings settings;
|
||||
settings.setupUi(&settingsDialog);
|
||||
Settings::saveRestore(&settingsDialog);
|
||||
|
||||
// Include currencies
|
||||
|
||||
QString currency_name;
|
||||
try
|
||||
{
|
||||
currency_name = Settings::getInstance()->get_currency_name();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
currency_name = "USD";
|
||||
}
|
||||
|
||||
this->slot_change_currency(currency_name);
|
||||
|
||||
|
||||
// Setup theme combo
|
||||
int theme_index = settings.comboBoxTheme->findText(Settings::getInstance()->get_theme_name(), Qt::MatchExactly);
|
||||
@@ -404,6 +420,18 @@ void MainWindow::setupSettingsModal() {
|
||||
QMessageBox::information(this, tr("Restart"), tr("Please restart Silentdragonlite to have the theme apply"), QMessageBox::Ok);
|
||||
});
|
||||
|
||||
// Get Currency Data
|
||||
|
||||
int currency_index = settings.comboBoxCurrency->findText(Settings::getInstance()->get_currency_name(), Qt::MatchExactly);
|
||||
settings.comboBoxCurrency->setCurrentIndex(currency_index);
|
||||
|
||||
QObject::connect(settings.comboBoxCurrency, &QComboBox::currentTextChanged, [=] (QString currency_name) {
|
||||
this->slot_change_currency(currency_name);
|
||||
|
||||
// Tell the user to restart
|
||||
QMessageBox::information(this, tr("Currency Change"), tr("Please restart SilentDragonLite to have new currencies apply"), QMessageBox::Ok);
|
||||
});
|
||||
|
||||
// Check for updates
|
||||
settings.chkCheckUpdates->setChecked(Settings::getInstance()->getCheckForUpdates());
|
||||
|
||||
@@ -1093,7 +1121,30 @@ void MainWindow::setupReceiveTab() {
|
||||
}
|
||||
|
||||
ui->rcvLabel->setText(label);
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushUSDString());
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushUSDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushEURString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushBTCString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushCNYString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushRUBString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushCADString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushSGDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushCHFString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushINRString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushGBPString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
ui->rcvBal->setText(rpc->getModel()->getAllBalances().value(addr).toDecimalhushAUDString());
|
||||
}
|
||||
|
||||
ui->txtReceive->setPlainText(addr);
|
||||
ui->qrcodeDisplay->setQrcodeString(addr);
|
||||
if (rpc->getModel()->getUsedAddresses().value(addr, false)) {
|
||||
@@ -1235,9 +1286,32 @@ void MainWindow::updateLabels() {
|
||||
updateLabelsAutoComplete();
|
||||
}
|
||||
|
||||
void MainWindow::slot_change_currency(const QString& currency_name)
|
||||
|
||||
{
|
||||
|
||||
Settings::getInstance()->set_currency_name(currency_name);
|
||||
|
||||
// Include currency
|
||||
|
||||
QString saved_currency_name;
|
||||
try
|
||||
{
|
||||
saved_currency_name = Settings::getInstance()->get_currency_name();
|
||||
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
saved_currency_name = "USD";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slot_change_theme(const QString& theme_name)
|
||||
|
||||
{
|
||||
Settings::getInstance()->set_theme_name(theme_name);
|
||||
|
||||
|
||||
// Include css
|
||||
QString saved_theme_name;
|
||||
|
||||
@@ -78,7 +78,8 @@ public:
|
||||
|
||||
public slots:
|
||||
void slot_change_theme(const QString& themeName);
|
||||
|
||||
void slot_change_currency(const QString& currencyName);
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@@ -79,9 +79,16 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -93,7 +100,7 @@
|
||||
<widget class="QLabel" name="balVerified">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -1159,7 +1166,7 @@
|
||||
</action>
|
||||
<action name="actionDonate">
|
||||
<property name="text">
|
||||
<string>&Send Duke Feedback</string>
|
||||
<string>&Send DenioD Feedback</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDiscord">
|
||||
|
||||
@@ -83,7 +83,29 @@ QJsonObject RecurringPaymentInfo::toJson() {
|
||||
|
||||
QString RecurringPaymentInfo::getAmountPretty() const {
|
||||
CAmount amount = CAmount::fromDouble(amt);
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
return currency == "USD" ? amount.toDecimalUSDString() : amount.toDecimalhushString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
return currency == "EUR" ? amount.toDecimalEURString() : amount.toDecimalhushString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
return currency == "BTC" ? amount.toDecimalBTCString() : amount.toDecimalhushString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
return currency == "CNY" ? amount.toDecimalCNYString() : amount.toDecimalhushString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
return currency == "RUB" ? amount.toDecimalRUBString() : amount.toDecimalhushString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
return currency == "CAD" ? amount.toDecimalCADString() : amount.toDecimalhushString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
return currency == "SGD" ? amount.toDecimalSGDString() : amount.toDecimalhushString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
return currency == "CHF" ? amount.toDecimalCHFString() : amount.toDecimalhushString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
return currency == "INR" ? amount.toDecimalINRString() : amount.toDecimalhushString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
return currency == "GBP" ? amount.toDecimalGBPString() : amount.toDecimalhushString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
return currency == "AUD" ? amount.toDecimalAUDString() : amount.toDecimalhushString();
|
||||
}
|
||||
}
|
||||
|
||||
QString RecurringPaymentInfo::getScheduleDescription() const {
|
||||
@@ -136,8 +158,31 @@ RecurringPaymentInfo* Recurring::getNewRecurringFromTx(QWidget* parent, MainWind
|
||||
if (tx.toAddrs.length() > 0) {
|
||||
ui.lblTo->setText(tx.toAddrs[0].addr);
|
||||
|
||||
// Default is USD
|
||||
// Change it with currency in Settings
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalUSDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalEURString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalBTCString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalCNYString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalRUBString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalCADString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalSGDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalCHFString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalINRString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalGBPString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalAUDString());
|
||||
|
||||
}
|
||||
|
||||
ui.txtMemo->setPlainText(tx.toAddrs[0].memo);
|
||||
ui.txtMemo->setEnabled(false);
|
||||
@@ -147,10 +192,36 @@ RecurringPaymentInfo* Recurring::getNewRecurringFromTx(QWidget* parent, MainWind
|
||||
QObject::connect(ui.cmbCurrency, &QComboBox::currentTextChanged, [&](QString c) {
|
||||
if (tx.toAddrs.length() < 1)
|
||||
return;
|
||||
|
||||
if (c == "USD") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalUSDString());
|
||||
|
||||
} else if (c == "EUR") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalEURString());
|
||||
} else if
|
||||
(c == "BTC") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalBTCString());
|
||||
} else if (c == "CNY") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalCNYString());
|
||||
} else if
|
||||
(c == "RUB") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalRUBString());
|
||||
} else if (c == "CAD") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalCADString());
|
||||
} else if
|
||||
(c == "SGD") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalSGDString());
|
||||
} else if (c == "CHF") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalCHFString());
|
||||
} else if
|
||||
(c == "INR") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalINRString());
|
||||
} else if (c == "GBP") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalGBPString());
|
||||
} else if
|
||||
(c == "AUD") {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalAUDString());
|
||||
}
|
||||
|
||||
else {
|
||||
ui.lblAmt->setText(tx.toAddrs[0].amount.toDecimalString());
|
||||
}
|
||||
@@ -472,6 +543,8 @@ void Recurring::executeRecurringPayment(MainWindow* main, RecurringPaymentInfo r
|
||||
PaymentStatus::ERROR);
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Translate it into hush
|
||||
|
||||
@@ -74,7 +74,13 @@ void RequestDialog::showPaymentConfirmation(MainWindow* main, QString paymentURI
|
||||
req.txtMemo->setPlainText(payInfo.memo);
|
||||
req.txtAmount->setText(payInfo.amt);
|
||||
CAmount amount = CAmount::fromDecimalString(req.txtAmount->text());
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalUSDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalEURString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalBTCString());
|
||||
}
|
||||
|
||||
req.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Pay"));
|
||||
|
||||
@@ -114,11 +120,54 @@ void RequestDialog::showRequesthush(MainWindow* main) {
|
||||
req.txtAmount->setValidator(main->getAmountValidator());
|
||||
QObject::connect(req.txtAmount, &QLineEdit::textChanged, [=] (auto text) {
|
||||
CAmount amount = CAmount::fromDecimalString(text);
|
||||
req.txtAmountUSD->setText(amount.toDecimalUSDString());
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalUSDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalEURString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalBTCString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCNYString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalRUBString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCADString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalSGDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCHFString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalINRString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalGBPString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalBTCString());
|
||||
}
|
||||
});
|
||||
CAmount amount = CAmount::fromDecimalString(req.txtAmount->text());
|
||||
req.txtAmountUSD->setText(amount.toDecimalUSDString());
|
||||
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalUSDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalEURString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalBTCString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCNYString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalRUBString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCADString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalSGDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCHFString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalINRString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalGBPString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalBTCString());
|
||||
}
|
||||
req.txtMemo->setAcceptButton(req.buttonBox->button(QDialogButtonBox::Ok));
|
||||
req.txtMemo->setLenDisplayLabel(req.lblMemoLen);
|
||||
req.txtMemo->setMaxLen(400);
|
||||
|
||||
188
src/sendtab.cpp
188
src/sendtab.cpp
@@ -58,7 +58,30 @@ void MainWindow::setupSendTab() {
|
||||
ui->minerFeeAmt->setReadOnly(true);
|
||||
QObject::connect(ui->minerFeeAmt, &QLineEdit::textChanged, [=](auto txt) {
|
||||
CAmount fee = CAmount::fromDecimalString(txt);
|
||||
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
ui->lblMinerFeeUSD->setText(fee.toDecimalUSDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
ui->lblMinerFeeUSD->setText(fee.toDecimalEURString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
ui->lblMinerFeeUSD->setText(fee.toDecimalBTCString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
ui->lblMinerFeeUSD->setText(fee.toDecimalCNYString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
ui->lblMinerFeeUSD->setText(fee.toDecimalRUBString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
ui->lblMinerFeeUSD->setText(fee.toDecimalCADString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
ui->lblMinerFeeUSD->setText(fee.toDecimalSGDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
ui->lblMinerFeeUSD->setText(fee.toDecimalCHFString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
ui->lblMinerFeeUSD->setText(fee.toDecimalINRString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
ui->lblMinerFeeUSD->setText(fee.toDecimalGBPString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
ui->lblMinerFeeUSD->setText(fee.toDecimalAUDString());
|
||||
}
|
||||
});
|
||||
ui->minerFeeAmt->setText(Settings::getMinerFee().toDecimalString());
|
||||
|
||||
@@ -66,9 +89,42 @@ void MainWindow::setupSendTab() {
|
||||
QObject::connect(ui->tabWidget, &QTabWidget::currentChanged, [=] (int pos) {
|
||||
if (pos == 1) {
|
||||
QString txt = ui->minerFeeAmt->text();
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalUSDString();
|
||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||
}
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalEURString();
|
||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalEURString();
|
||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalCNYString();
|
||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalRUBString();
|
||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalCADString();
|
||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalSGDString();
|
||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalCHFString();
|
||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalINRString();
|
||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalGBPString();
|
||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalAUDString();
|
||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//Fees validator
|
||||
@@ -275,7 +331,30 @@ void MainWindow::addressChanged(int itemNumber, const QString& text) {
|
||||
void MainWindow::amountChanged(int item, const QString& text) {
|
||||
auto usd = ui->sendToWidgets->findChild<QLabel*>(QString("AmtUSD") % QString::number(item));
|
||||
CAmount amt = CAmount::fromDecimalString(text);
|
||||
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
usd->setText(amt.toDecimalUSDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
usd->setText(amt.toDecimalEURString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
usd->setText(amt.toDecimalBTCString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
usd->setText(amt.toDecimalCNYString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
usd->setText(amt.toDecimalRUBString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
usd->setText(amt.toDecimalCADString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
usd->setText(amt.toDecimalSGDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
usd->setText(amt.toDecimalCHFString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
usd->setText(amt.toDecimalINRString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
usd->setText(amt.toDecimalGBPString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
usd->setText(amt.toDecimalAUDString());
|
||||
}
|
||||
|
||||
// If there is a recurring payment, update the info there as well
|
||||
if (sendTxRecurringInfo != nullptr) {
|
||||
@@ -535,12 +614,93 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
||||
totalSpending = totalSpending + toAddr.amount;
|
||||
|
||||
// Amount (USD)
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
auto AmtUSD = new QLabel(confirm.sendToAddrs);
|
||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||
AmtUSD->setText(toAddr.amount.toDecimalUSDString());
|
||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
|
||||
// Amount (EUR)
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
auto AmtUSD = new QLabel(confirm.sendToAddrs);
|
||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||
AmtUSD->setText(toAddr.amount.toDecimalEURString());
|
||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
|
||||
// Amount (BTC)
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
auto AmtUSD = new QLabel(confirm.sendToAddrs);
|
||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||
AmtUSD->setText(toAddr.amount.toDecimalBTCString());
|
||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
|
||||
// Amount (CNY)
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
auto AmtUSD = new QLabel(confirm.sendToAddrs);
|
||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||
AmtUSD->setText(toAddr.amount.toDecimalCNYString());
|
||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
|
||||
// Amount (RUB)
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
auto AmtUSD = new QLabel(confirm.sendToAddrs);
|
||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||
AmtUSD->setText(toAddr.amount.toDecimalRUBString());
|
||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
|
||||
// Amount (CAD)
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
auto AmtUSD = new QLabel(confirm.sendToAddrs);
|
||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||
AmtUSD->setText(toAddr.amount.toDecimalCADString());
|
||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
|
||||
// Amount (SGD)
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
auto AmtUSD = new QLabel(confirm.sendToAddrs);
|
||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||
AmtUSD->setText(toAddr.amount.toDecimalSGDString());
|
||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
|
||||
// Amount (CHF)
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
auto AmtUSD = new QLabel(confirm.sendToAddrs);
|
||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||
AmtUSD->setText(toAddr.amount.toDecimalCHFString());
|
||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
|
||||
// Amount (INR)
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
auto AmtUSD = new QLabel(confirm.sendToAddrs);
|
||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||
AmtUSD->setText(toAddr.amount.toDecimalINRString());
|
||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
|
||||
// Amount (GBP)
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
auto AmtUSD = new QLabel(confirm.sendToAddrs);
|
||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||
AmtUSD->setText(toAddr.amount.toDecimalGBPString());
|
||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
|
||||
// Amount (AUD)
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
auto AmtUSD = new QLabel(confirm.sendToAddrs);
|
||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||
AmtUSD->setText(toAddr.amount.toDecimalAUDString());
|
||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||
}
|
||||
// Memo
|
||||
if (Settings::isZAddress(toAddr.addr) && !toAddr.memo.isEmpty()) {
|
||||
row++;
|
||||
@@ -588,7 +748,29 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
||||
minerFeeUSD->setObjectName(QStringLiteral("minerFeeUSD"));
|
||||
minerFeeUSD->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
confirm.gridLayout->addWidget(minerFeeUSD, row, 2, 1, 1);
|
||||
minerFeeUSD->setText(tx.fee.toDecimalUSDString());
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
minerFeeUSD->setText(tx.fee.toDecimalUSDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
minerFeeUSD->setText(tx.fee.toDecimalEURString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
minerFeeUSD->setText(tx.fee.toDecimalBTCString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
minerFeeUSD->setText(tx.fee.toDecimalCNYString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
minerFeeUSD->setText(tx.fee.toDecimalRUBString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
minerFeeUSD->setText(tx.fee.toDecimalCADString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
minerFeeUSD->setText(tx.fee.toDecimalSGDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
minerFeeUSD->setText(tx.fee.toDecimalCHFString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
minerFeeUSD->setText(tx.fee.toDecimalINRString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
minerFeeUSD->setText(tx.fee.toDecimalGBPString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
minerFeeUSD->setText(tx.fee.toDecimalAUDString());
|
||||
}
|
||||
}
|
||||
|
||||
// Recurring payment info, show only if there is exactly one destination address
|
||||
|
||||
@@ -105,6 +105,36 @@ bool Settings::isSaplingActive() {
|
||||
double Settings::getZECPrice() {
|
||||
return ZECPrice;
|
||||
}
|
||||
double Settings::getEURPrice() {
|
||||
return EURPrice;
|
||||
}
|
||||
double Settings::getBTCPrice() {
|
||||
return BTCPrice;
|
||||
}
|
||||
double Settings::getCNYPrice() {
|
||||
return CNYPrice;
|
||||
}
|
||||
double Settings::getRUBPrice() {
|
||||
return RUBPrice;
|
||||
}
|
||||
double Settings::getCADPrice() {
|
||||
return CADPrice;
|
||||
}
|
||||
double Settings::getSGDPrice() {
|
||||
return SGDPrice;
|
||||
}
|
||||
double Settings::getCHFPrice() {
|
||||
return CHFPrice;
|
||||
}
|
||||
double Settings::getINRPrice() {
|
||||
return INRPrice;
|
||||
}
|
||||
double Settings::getGBPPrice() {
|
||||
return GBPPrice;
|
||||
}
|
||||
double Settings::getAUDPrice() {
|
||||
return AUDPrice;
|
||||
}
|
||||
|
||||
bool Settings::getCheckForUpdates() {
|
||||
return QSettings().value("options/allowcheckupdates", true).toBool();
|
||||
@@ -122,6 +152,19 @@ void Settings::setAllowFetchPrices(bool allow) {
|
||||
QSettings().setValue("options/allowfetchprices", allow);
|
||||
}
|
||||
|
||||
QString Settings::get_currency_name() {
|
||||
// Load from the QT Settings.
|
||||
return QSettings().value("options/currency_name", false).toString();
|
||||
}
|
||||
|
||||
void Settings::set_currency_name(QString currency_name) {
|
||||
QSettings().setValue("options/currency_name", currency_name);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
QString Settings::get_theme_name() {
|
||||
// Load from the QT Settings.
|
||||
return QSettings().value("options/theme_name", false).toString();
|
||||
@@ -193,7 +236,7 @@ QString Settings::getDonationAddr() {
|
||||
if (Settings::getInstance()->isTestnet())
|
||||
return "ztestsaplingXXX";
|
||||
else
|
||||
return "zs1aq4xnrkjlnxx0zesqye7jz3dfrf3rjh7q5z6u8l6mwyqqaam3gx3j2fkqakp33v93yavq46j83q";
|
||||
return "zs1kwp3h4rwz76zfqzmwqqextq696kndtjskg4fzc80l9ygfal4hchcsst83ua8tjwzzy9nja7v5rr";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -63,10 +63,34 @@ public:
|
||||
QString get_theme_name();
|
||||
void set_theme_name(QString theme_name);
|
||||
|
||||
QString get_currency_name();
|
||||
void set_currency_name(QString currency_name);
|
||||
|
||||
|
||||
bool isSaplingActive();
|
||||
|
||||
void setZECPrice(double p) { ZECPrice = p; }
|
||||
void setEURPrice(double p) { EURPrice = p; }
|
||||
void setBTCPrice(double p) { BTCPrice = p; }
|
||||
void setCNYPrice(double p) { CNYPrice = p; }
|
||||
void setRUBPrice(double p) { RUBPrice = p; }
|
||||
void setCADPrice(double p) { CADPrice = p; }
|
||||
void setSGDPrice(double p) { SGDPrice = p; }
|
||||
void setCHFPrice(double p) { CHFPrice = p; }
|
||||
void setINRPrice(double p) { INRPrice = p; }
|
||||
void setGBPPrice(double p) { GBPPrice = p; }
|
||||
void setAUDPrice(double p) { AUDPrice = p; }
|
||||
double getZECPrice();
|
||||
double getEURPrice();
|
||||
double getBTCPrice();
|
||||
double getCNYPrice();
|
||||
double getRUBPrice();
|
||||
double getCADPrice();
|
||||
double getSGDPrice();
|
||||
double getCHFPrice();
|
||||
double getINRPrice();
|
||||
double getGBPPrice();
|
||||
double getAUDPrice();
|
||||
|
||||
// Static stuff
|
||||
static const QString txidStatusMessage;
|
||||
@@ -99,9 +123,9 @@ public:
|
||||
|
||||
static const QString labelRegExp;
|
||||
|
||||
static const int updateSpeed = 20 * 1000; // 10 sec
|
||||
static const int quickUpdateSpeed = 5 * 1000; // 3 sec
|
||||
static const int priceRefreshSpeed = 60 * 60 * 1000; // 15 mins
|
||||
static const int updateSpeed = 20 * 1000; // 20 sec
|
||||
static const int quickUpdateSpeed = 5 * 1000; // 5 sec
|
||||
static const int priceRefreshSpeed = 5 * 60 * 1000; // 5 mins
|
||||
|
||||
private:
|
||||
// This class can only be accessed through Settings::getInstance()
|
||||
@@ -119,6 +143,16 @@ private:
|
||||
bool _headless = false;
|
||||
|
||||
double ZECPrice = 0.0;
|
||||
double BTCPrice = 0.0;
|
||||
double EURPrice = 0.0;
|
||||
double CNYPrice = 0.0;
|
||||
double RUBPrice = 0.0;
|
||||
double CADPrice = 0.0;
|
||||
double SGDPrice = 0.0;
|
||||
double CHFPrice = 0.0;
|
||||
double INRPrice = 0.0;
|
||||
double GBPPrice = 0.0;
|
||||
double AUDPrice = 0.0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
300
src/settings.ui
300
src/settings.ui
@@ -26,7 +26,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@@ -85,108 +85,218 @@
|
||||
<attribute name="title">
|
||||
<string>Options</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="comboBoxTheme">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>default</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>blue</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>light</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>dark</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBoxTheme">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>110</y>
|
||||
<width>80</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>default</string>
|
||||
</property>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkFetchPrices">
|
||||
<property name="text">
|
||||
<string>Fetch hush / USD prices</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>blue</string>
|
||||
</property>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkCheckUpdates">
|
||||
<property name="text">
|
||||
<string>Check github for updates at startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>light</string>
|
||||
</property>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Connect to github on startup to check for updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>dark</string>
|
||||
</property>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Theme</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="chkFetchPrices">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>61</y>
|
||||
<width>184</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fetch hush prices</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="chkCheckUpdates">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>267</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Check github for updates at startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>38</y>
|
||||
<width>340</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connect to github on startup to check for updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>113</y>
|
||||
<width>47</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Theme</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<width>500</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>90</y>
|
||||
<width>297</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connect to the internet to fetch hush prices</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>150</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Currency</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBoxCurrency">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>150</y>
|
||||
<width>80</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>AUD</string>
|
||||
</property>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>BTC</string>
|
||||
</property>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CAD</string>
|
||||
</property>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Connect to the internet to fetch hush prices</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CHF</string>
|
||||
</property>
|
||||
</item>
|
||||
</layout>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CNY</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>EUR</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>GBP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>INR</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>USD</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
|
||||
@@ -155,7 +155,14 @@ QVariant TxTableModel::data(const QModelIndex &index, int role) const {
|
||||
for (int i=0; i < dat.items.length(); i++) {
|
||||
total = total + dat.items[i].amount;
|
||||
}
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
return total.toDecimalUSDString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
return total.toDecimalEURString();
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
return total.toDecimalBTCString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define APP_VERSION "1.0"
|
||||
#define APP_VERSION "1.1.0"
|
||||
|
||||
@@ -112,7 +112,7 @@ void WormholeClient::connect() {
|
||||
QObject::connect(m_webSocket, &QWebSocket::connected, this, &WormholeClient::onConnected);
|
||||
QObject::connect(m_webSocket, &QWebSocket::disconnected, this, &WormholeClient::closed);
|
||||
|
||||
m_webSocket->open(QUrl("wss://wormhole.silentdragonlite.com:443"));
|
||||
m_webSocket->open(QUrl("wss://wormhole.myhush.org:443"));
|
||||
//m_webSocket->open(QUrl("ws://127.0.0.1:7070"));
|
||||
}
|
||||
|
||||
|
||||
34
win-static-build.sh
Executable file
34
win-static-build.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2019 The Hush Developers
|
||||
|
||||
|
||||
|
||||
VERSION=$(cat src/version.h |cut -d\" -f2)
|
||||
echo "Compiling SilentDragonLite $VERSION .exe with $JOBS threads..."
|
||||
CONF=silentdragon-lite.pro
|
||||
|
||||
set -e
|
||||
echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
|
||||
CC_x86_64_pc_windows_gnu="x86_64-w64-mingw32.static-gcc"
|
||||
PATH="/home/$USER/github/mxe/usr/bin:${PATH}"
|
||||
mkdir release
|
||||
cp src/precompiled.h release/
|
||||
qbuild () {
|
||||
/home/$USER/github/mxe/usr/bin/x86_64-w64-mingw32.static-qmake-qt5 $CONF CONFIG+=release
|
||||
|
||||
#lupdate $CONF
|
||||
#lrelease $CONF
|
||||
make -j$JOBS
|
||||
}
|
||||
|
||||
if [ "$1" == "clean" ]; then
|
||||
make clean
|
||||
elif [ "$1" == "linguist" ]; then
|
||||
lupdate $CONF
|
||||
lrelease $CONF
|
||||
elif [ "$1" == "cleanbuild" ]; then
|
||||
make clean
|
||||
qbuild
|
||||
else
|
||||
qbuild
|
||||
fi
|
||||
Reference in New Issue
Block a user