Compare commits
302 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6c4c32d01 | ||
|
|
e36d4a918f | ||
|
|
0355ca2747 | ||
|
|
c946905907 | ||
|
|
a8bd2ab77e | ||
|
|
149e373367 | ||
|
|
fa3c8b5f89 | ||
|
|
e0f6577afd | ||
|
|
43f0854de9 | ||
|
|
f38e460842 | ||
|
|
0de1ba9f51 | ||
|
|
15038850c2 | ||
|
|
efc9ad45e4 | ||
|
|
754a968706 | ||
|
|
c20a0ef928 | ||
|
|
eab98e3a48 | ||
|
|
2a8960bc2c | ||
|
|
fe68f59763 | ||
|
|
80e8dd6aef | ||
|
|
c82bd94bc3 | ||
|
|
28ca9503df | ||
|
|
73cc400ae8 | ||
|
|
8b7438ace2 | ||
|
|
210248e6ef | ||
|
|
f82948f4b0 | ||
|
|
da4e0dbf0f | ||
|
|
9dd3f4fecb | ||
|
|
abbe042c8a | ||
|
|
72a3b346bb | ||
|
|
d662e46146 | ||
|
|
bbc9ca8f08 | ||
|
|
f7271d1c7b | ||
|
|
afe1ae9b9c | ||
|
|
7f5b8ea0ad | ||
|
|
aa5000f556 | ||
|
|
8b6978b2a5 | ||
|
|
86d21a34ba | ||
|
|
4354a76df9 | ||
|
|
b616a14f88 | ||
|
|
7536e922e9 | ||
|
|
5bf0dd9684 | ||
|
|
cdf4ce2d6f | ||
|
|
37a8bcb525 | ||
|
|
2f8c0ca499 | ||
|
|
38612c1285 | ||
|
|
1d3a201077 | ||
|
|
a91a4f51ab | ||
|
|
52fbbae484 | ||
|
|
8f70fb4f79 | ||
|
|
c439d6814b | ||
|
|
f26f1469ca | ||
|
|
487e706f06 | ||
|
|
503c1af5f8 | ||
|
|
ca79525fdb | ||
|
|
7db5de082d | ||
|
|
ce6cc47afe | ||
|
|
a10a94f51c | ||
|
|
1833c16e39 | ||
|
|
d7207bfde3 | ||
|
|
5265e52b8b | ||
|
|
b6fdb709ba | ||
|
|
9aef3bab33 | ||
|
|
4b55197e18 | ||
|
|
11617d2f76 | ||
|
|
765e93cfd0 | ||
|
|
d31e661cd1 | ||
|
|
7f9b28c05f | ||
|
|
4a7ccd8d82 | ||
|
|
be954cc2c4 | ||
|
|
387e643ae9 | ||
|
|
6f71d47806 | ||
|
|
135c970ad9 | ||
|
|
fd5d1f584e | ||
|
|
2195c67f58 | ||
|
|
5c13624596 | ||
|
|
cfdba59584 | ||
|
|
4141832a4d | ||
|
|
5f183da6e3 | ||
|
|
30c54b1c6e | ||
|
|
c1da3d1c97 | ||
|
|
cbd03229dd | ||
|
|
2fc1b287dd | ||
|
|
7c8c6a116f | ||
|
|
ef93139a80 | ||
|
|
1b7844ec34 | ||
|
|
8f63e8870f | ||
|
|
286c75aa5b | ||
|
|
0a4d65dd99 | ||
|
|
83ccadb6a8 | ||
|
|
eae7eff9db | ||
|
|
2102e4be0d | ||
|
|
02eec351b9 | ||
|
|
ce4cb6512d | ||
|
|
3d24300963 | ||
|
|
9748974ce0 | ||
|
|
120b5285fb | ||
|
|
b022735506 | ||
|
|
33c1a6f4fc | ||
|
|
4b0dcb95bf | ||
|
|
fdb7f806fa | ||
|
|
a810bf3eb7 | ||
|
|
a99eef68f5 | ||
|
|
7ebdb884a1 | ||
|
|
c7f9ac926b | ||
|
|
9b98e0a2f5 | ||
|
|
3835387eea | ||
|
|
238b1b777f | ||
|
|
3af99e91e4 | ||
|
|
07ecca5af4 | ||
|
|
b245d0af7a | ||
|
|
585fb2810d | ||
|
|
0784532001 | ||
|
|
dcbdae0954 | ||
|
|
2bef74fe8a | ||
|
|
81d5dd1cae | ||
|
|
50767570f0 | ||
|
|
1d5b940349 | ||
|
|
3563d44d99 | ||
|
|
ffceda9159 | ||
|
|
a75a0fb8c5 | ||
|
|
5fa64c34ec | ||
|
|
376421667a | ||
|
|
8a73fd241e | ||
|
|
9760886eff | ||
|
|
34089599cd | ||
|
|
4a7a98034e | ||
|
|
79f78f48e2 | ||
|
|
fee81ba210 | ||
|
|
a078705ec6 | ||
|
|
de6a9b6779 | ||
|
|
3f13a5c9a4 | ||
|
|
fb7470a2a6 | ||
|
|
e2c6ae6472 | ||
|
|
ea25b71ca6 | ||
|
|
5ebe3f5092 | ||
|
|
8e4124f06a | ||
|
|
e47fd5f760 | ||
|
|
8767c71107 | ||
|
|
2156a6533b | ||
|
|
7eac690d44 | ||
|
|
31adc6cfd6 | ||
|
|
d582fd338d | ||
|
|
eed51e3ffa | ||
|
|
6a889bdaa1 | ||
|
|
5f27a45910 | ||
|
|
e1258e0ada | ||
|
|
925cced7d7 | ||
|
|
94083e746f | ||
|
|
a49d579bd3 | ||
|
|
6ed7fcec67 | ||
|
|
6d7db135e7 | ||
|
|
042400b83f | ||
|
|
df54439972 | ||
|
|
86252506f0 | ||
|
|
a9fea2462b | ||
|
|
58987b2ec6 | ||
|
|
aecd218d15 | ||
|
|
856843b52a | ||
|
|
fc740a89ab | ||
|
|
0643607ec3 | ||
|
|
5872bc8a2b | ||
|
|
d07da76383 | ||
|
|
c092de97f2 | ||
|
|
c84a8fb07d | ||
|
|
63b4566475 | ||
|
|
3699dc9f2e | ||
|
|
eee48ce74c | ||
|
|
9072f89a4e | ||
|
|
c9e461dcb6 | ||
|
|
55b548f31c | ||
|
|
dede10ea1a | ||
|
|
b739cdd52a | ||
|
|
94a27b964a | ||
|
|
c7df74dab7 | ||
|
|
bf9b04b126 | ||
|
|
d21c22b444 | ||
|
|
cee56a7d23 | ||
|
|
c3a34227b7 | ||
|
|
7a86856063 | ||
|
|
86f35992dc | ||
|
|
cb84652c8e | ||
|
|
dc3a99c9ca | ||
|
|
566beeaf4b | ||
|
|
9deca92e07 | ||
|
|
09ff85af44 | ||
|
|
a0b6c8a397 | ||
|
|
44dfb80633 | ||
|
|
7067195c2f | ||
|
|
19cf510e62 | ||
|
|
c14852cbd7 | ||
|
|
57d330244b | ||
|
|
dfd8ff9809 | ||
|
|
b4a65c52cc | ||
|
|
386c5e3d30 | ||
|
|
5069e6ecae | ||
|
|
7c38a836d3 | ||
|
|
0731972499 | ||
|
|
f9b9d43ac1 | ||
|
|
d1e431c5e8 | ||
|
|
4c0996888a | ||
|
|
a9d855ad00 | ||
|
|
636ca1c41d | ||
|
|
872b18d5af | ||
|
|
98abdaa5d5 | ||
|
|
b5fafb55c9 | ||
|
|
fbfc5310d5 | ||
|
|
478fddaf57 | ||
|
|
d175070f55 | ||
|
|
0af7a4320d | ||
|
|
48aab5c6e5 | ||
|
|
a20422da74 | ||
|
|
eb7fae92ef | ||
|
|
4b1a6eb49b | ||
|
|
df614cd0a0 | ||
|
|
0adafaaa91 | ||
|
|
467dd8b664 | ||
|
|
dba48334e6 | ||
|
|
98ab4ea2aa | ||
|
|
0629f06156 | ||
|
|
e05e6346ac | ||
|
|
d5469c8247 | ||
|
|
080ec28eb4 | ||
|
|
8f197bc6ac | ||
|
|
82bc71c81d | ||
|
|
5a4f27b375 | ||
|
|
b6d554eebd | ||
|
|
900f478abe | ||
|
|
742a4659f4 | ||
|
|
35b7a5f6bb | ||
|
|
21e8c7ca17 | ||
|
|
8ef1b41093 | ||
|
|
911ff4288d | ||
|
|
6dd759de33 | ||
|
|
e59e247048 | ||
|
|
8940d2b8d1 | ||
|
|
6940390a5e | ||
|
|
7ebf50dc6f | ||
|
|
2c515ceb74 | ||
|
|
39aa6e76b1 | ||
|
|
aa5962519a | ||
|
|
a3f5460d12 | ||
|
|
2e262d41d7 | ||
|
|
6de8547047 | ||
|
|
59954df199 | ||
|
|
8a66f7b6f7 | ||
|
|
a5e5bfad46 | ||
|
|
2058c78943 | ||
|
|
4d279a5f02 | ||
|
|
29f0c4667c | ||
|
|
f00b7b42c0 | ||
|
|
80a3da6efa | ||
|
|
2a1cd7dc01 | ||
|
|
9bc6e041ee | ||
|
|
3bab6ccedf | ||
|
|
eebbd2b93e | ||
|
|
a807dcd5df | ||
|
|
0009a886fe | ||
|
|
9c2bceaaed | ||
|
|
50f3e67e81 | ||
|
|
7e6fcff3ee | ||
|
|
f266480f7d | ||
|
|
96106cc818 | ||
|
|
ed9e061489 | ||
|
|
b56c0cd8a2 | ||
|
|
f36098d60f | ||
|
|
00439052e6 | ||
|
|
fae5956bfb | ||
|
|
8dfd7a300d | ||
|
|
7cf0f21ec0 | ||
|
|
098e78f4ef | ||
|
|
4a30d1fc38 | ||
|
|
148c1b9816 | ||
|
|
cc22693504 | ||
|
|
c4bdf5621c | ||
|
|
a8618b0471 | ||
|
|
b4a6569e63 | ||
|
|
e5a6a50e49 | ||
|
|
c7f272d86a | ||
|
|
023951fd84 | ||
|
|
ef2b0cfa4a | ||
|
|
fe08950b03 | ||
|
|
a5b500cd93 | ||
|
|
16fd1d1eee | ||
|
|
266b1f167d | ||
|
|
40a1edbbcb | ||
|
|
0999daf1f2 | ||
|
|
7462c64fe2 | ||
|
|
4920df95e3 | ||
|
|
6a453039ee | ||
|
|
5281244b33 | ||
|
|
525822f391 | ||
|
|
23e3d82441 | ||
|
|
5ca671e5f5 | ||
|
|
118ad125c4 | ||
|
|
c98ffcca5d | ||
|
|
e74075bb0e | ||
|
|
916c0e4406 | ||
|
|
b626fcba08 | ||
|
|
c765bbb1fd | ||
|
|
181866ba4a | ||
|
|
24ac001daa | ||
|
|
163fa733ae |
31
.github/workflows/build.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: GUI build
|
||||
name: continuous-integration/gh-actions/gui
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: update brew and install dependencies
|
||||
run: brew update && brew install boost hidapi zmq libpgm unbound libsodium miniupnpc ldns expat doxygen graphviz libunwind-headers protobuf qt5
|
||||
run: brew update && brew install boost hidapi zmq libpgm miniupnpc ldns expat libunwind-headers protobuf qt5 libgcrypt
|
||||
- name: build
|
||||
run: export PATH=$PATH:/usr/local/opt/qt/bin && ./build.sh
|
||||
- name: test qml
|
||||
@@ -22,13 +22,36 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: remove bundled boost
|
||||
run: sudo rm -rf /usr/local/share/boost
|
||||
- name: set apt conf
|
||||
run: |
|
||||
echo "Acquire::Retries \"3\";" | sudo tee -a /etc/apt/apt.conf.d/80-custom
|
||||
echo "Acquire::http::Timeout \"120\";" | sudo tee -a /etc/apt/apt.conf.d/80-custom
|
||||
echo "Acquire::ftp::Timeout \"120\";" | sudo tee -a /etc/apt/apt.conf.d/80-custom
|
||||
- name: update apt
|
||||
run: sudo apt update
|
||||
- name: install monero dependencies
|
||||
run: sudo apt -y install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev
|
||||
run: sudo apt -y install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev libprotobuf-dev protobuf-compiler
|
||||
- name: install monero gui dependencies
|
||||
run: sudo apt -y install qtbase5-dev qt5-default qtdeclarative5-dev qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qt-labs-settings qml-module-qt-labs-folderlistmodel qttools5-dev-tools qml-module-qtquick-templates2 libqt5svg5-dev xvfb
|
||||
run: sudo apt -y install qtbase5-dev qt5-default qtdeclarative5-dev qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qt-labs-settings qml-module-qt-labs-folderlistmodel qttools5-dev-tools qml-module-qtquick-templates2 libqt5svg5-dev libgcrypt20-dev xvfb
|
||||
- name: build
|
||||
run: ./build.sh
|
||||
- name: test qml
|
||||
run: xvfb-run -a build/release/bin/monero-wallet-gui --test-qml
|
||||
|
||||
build-windows:
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: numworks/setup-msys2@v1
|
||||
- name: update pacman
|
||||
run: msys2do pacman -Syu --noconfirm
|
||||
- name: install monero dependencies
|
||||
run: msys2do pacman -S --noconfirm mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb git mingw-w64-x86_64-qt5 mingw-w64-x86_64-libgcrypt
|
||||
- name: build
|
||||
run: msys2do ./build.sh release
|
||||
- name: test qml
|
||||
run: msys2do build/release/bin/monero-wallet-gui --test-qml
|
||||
|
||||
1
.gitignore
vendored
@@ -13,6 +13,7 @@ monero-wallet-gui_plugin_import.cpp
|
||||
monero-wallet-gui_qml_plugin_import.cpp
|
||||
*.qmlc
|
||||
*.jsc
|
||||
qml_qmlcache.qrc
|
||||
|
||||
### Vim ###
|
||||
# Swap
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(monero-gui)
|
||||
|
||||
message(STATUS "Initiating compile using CMake ${CMAKE_VERSION}")
|
||||
@@ -8,8 +8,7 @@ set(VERSION_MINOR "0")
|
||||
set(VERSION_REVISION "3")
|
||||
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}")
|
||||
|
||||
# libwallet requires a static build, so we only allow static compilation
|
||||
set(STATIC ON)
|
||||
option(STATIC "Link libraries statically, requires static Qt")
|
||||
|
||||
option(USE_DEVICE_TREZOR ON)
|
||||
option(ENABLE_PASS_STRENGTH_METER "Disable zxcvbn" OFF)
|
||||
@@ -75,7 +74,10 @@ if(GIT_FOUND)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(STATIC_OLD ${STATIC})
|
||||
set(STATIC ON CACHE BOOL "Link libraries statically" FORCE)
|
||||
add_subdirectory(monero)
|
||||
set(STATIC ${STATIC_OLD} CACHE BOOL "Link libraries statically" FORCE)
|
||||
set_property(TARGET wallet_merged PROPERTY FOLDER "monero")
|
||||
get_directory_property(ARCH_WIDTH DIRECTORY "monero" DEFINITION ARCH_WIDTH)
|
||||
|
||||
@@ -84,8 +86,9 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
endif()
|
||||
|
||||
if(STATIC)
|
||||
message(STATUS "Initiating static build")
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
message(STATUS "Initiating static build")
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_STATIC_RUNTIME ON)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
add_definitions(-DMONERO_GUI_STATIC)
|
||||
endif()
|
||||
@@ -176,7 +179,7 @@ find_package(Boost 1.62 REQUIRED COMPONENTS
|
||||
program_options
|
||||
locale)
|
||||
|
||||
if(LINUX)
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
message(STATUS "X11_FOUND = ${X11_FOUND}")
|
||||
message(STATUS "X11_INCLUDE_DIR = ${X11_INCLUDE_DIR}")
|
||||
@@ -231,6 +234,12 @@ set(QT5_LIBRARIES
|
||||
Qt5Svg
|
||||
)
|
||||
|
||||
# TODO: drop this once we switch to Qt 5.14+
|
||||
find_package(Qt5QmlModels QUIET)
|
||||
if(Qt5QmlModels_FOUND)
|
||||
list(APPEND QT5_LIBRARIES Qt5QmlModels)
|
||||
endif()
|
||||
|
||||
foreach(QT5_MODULE ${QT5_LIBRARIES})
|
||||
find_package(${QT5_MODULE} REQUIRED)
|
||||
endforeach()
|
||||
@@ -336,6 +345,8 @@ if(APPLE)
|
||||
endif()
|
||||
|
||||
# warnings
|
||||
add_c_flag_if_supported(-Werror C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-Werror CXX_SECURITY_FLAGS)
|
||||
add_c_flag_if_supported(-Wformat C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-Wformat CXX_SECURITY_FLAGS)
|
||||
add_c_flag_if_supported(-Wformat-security C_SECURITY_FLAGS)
|
||||
@@ -381,13 +392,33 @@ if (noexecheap_SUPPORTED)
|
||||
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecheap")
|
||||
endif()
|
||||
|
||||
# some windows linker bits
|
||||
if (WIN32)
|
||||
add_linker_flag_if_supported(-Wl,--dynamicbase LD_SECURITY_FLAGS)
|
||||
add_linker_flag_if_supported(-Wl,--nxcompat LD_SECURITY_FLAGS)
|
||||
add_linker_flag_if_supported(-Wl,--high-entropy-va LD_SECURITY_FLAGS)
|
||||
endif()
|
||||
|
||||
add_linker_flag_if_supported(-static-libgcc STATIC_FLAGS)
|
||||
add_linker_flag_if_supported(-static-libstdc++ STATIC_FLAGS)
|
||||
if(STATIC)
|
||||
if(MINGW)
|
||||
add_linker_flag_if_supported(-static STATIC_FLAGS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
|
||||
# is fixed in the code (Issue #847), force compiler to be conservative.
|
||||
add_c_flag_if_supported(-fno-strict-aliasing C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-fno-strict-aliasing CXX_SECURITY_FLAGS)
|
||||
|
||||
message(STATUS "Using C security hardening flags: ${C_SECURITY_FLAGS}")
|
||||
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
|
||||
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_SECURITY_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_SECURITY_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${C_SECURITY_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CXX_SECURITY_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${STATIC_FLAGS}")
|
||||
|
||||
if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED)
|
||||
if (APPLE)
|
||||
@@ -408,5 +439,5 @@ endif()
|
||||
add_subdirectory(src)
|
||||
|
||||
# Required to make wallet_merged build before the gui
|
||||
add_dependencies(monero-gui wallet_merged)
|
||||
add_dependencies(monero-wallet-gui wallet_merged)
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ Rectangle {
|
||||
signal addressBookClicked()
|
||||
signal miningClicked()
|
||||
signal signClicked()
|
||||
signal merchantClicked()
|
||||
signal accountClicked()
|
||||
|
||||
function selectItem(pos) {
|
||||
@@ -72,7 +71,6 @@ Rectangle {
|
||||
if(pos === "History") menuColumn.previousButton = historyButton
|
||||
else if(pos === "Transfer") menuColumn.previousButton = transferButton
|
||||
else if(pos === "Receive") menuColumn.previousButton = receiveButton
|
||||
else if(pos === "Merchant") menuColumn.previousButton = merchantButton
|
||||
else if(pos === "AddressBook") menuColumn.previousButton = addressBookButton
|
||||
else if(pos === "Mining") menuColumn.previousButton = miningButton
|
||||
else if(pos === "TxKey") menuColumn.previousButton = txkeyButton
|
||||
@@ -348,7 +346,7 @@ Rectangle {
|
||||
id:flicker
|
||||
contentHeight: menuColumn.height
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: networkStatus.top
|
||||
anchors.bottom: progressBar.visible ? progressBar.top : networkStatus.top
|
||||
width: parent.width
|
||||
boundsBehavior: isMac ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
|
||||
clip: true
|
||||
@@ -454,30 +452,6 @@ Rectangle {
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- Merchant tab ---------------
|
||||
|
||||
MoneroComponents.MenuButton {
|
||||
id: merchantButton
|
||||
visible: appWindow.walletMode >= 2
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Merchant") + translationManager.emptyString
|
||||
symbol: qsTr("U") + translationManager.emptyString
|
||||
under: receiveButton
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
parent.previousButton = merchantButton
|
||||
panel.merchantClicked()
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.MenuButtonDivider {
|
||||
visible: merchantButton.present && appWindow.walletMode >= 2
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- History tab ---------------
|
||||
|
||||
MoneroComponents.MenuButton {
|
||||
@@ -644,22 +618,11 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 0
|
||||
anchors.rightMargin: 0
|
||||
anchors.bottom: networkStatus.top;
|
||||
anchors.bottom: progressBar.visible ? progressBar.top : networkStatus.top
|
||||
height: 10
|
||||
color: "transparent"
|
||||
}
|
||||
|
||||
MoneroComponents.NetworkStatusItem {
|
||||
id: networkStatus
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 5
|
||||
anchors.rightMargin: 0
|
||||
anchors.bottom: (progressBar.visible)? progressBar.top : parent.bottom;
|
||||
connected: Wallet.ConnectionStatus_Disconnected
|
||||
height: 48
|
||||
}
|
||||
|
||||
MoneroComponents.ProgressBar {
|
||||
id: progressBar
|
||||
anchors.left: parent.left
|
||||
@@ -667,17 +630,29 @@ Rectangle {
|
||||
anchors.bottom: daemonProgressBar.top
|
||||
height: 48
|
||||
syncType: qsTr("Wallet") + translationManager.emptyString
|
||||
visible: networkStatus.connected
|
||||
visible: !appWindow.disconnected
|
||||
}
|
||||
|
||||
MoneroComponents.ProgressBar {
|
||||
id: daemonProgressBar
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottom: networkStatus.top
|
||||
syncType: qsTr("Daemon") + translationManager.emptyString
|
||||
visible: networkStatus.connected
|
||||
visible: !appWindow.disconnected
|
||||
height: 62
|
||||
}
|
||||
|
||||
MoneroComponents.NetworkStatusItem {
|
||||
id: networkStatus
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 5
|
||||
anchors.rightMargin: 0
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 5
|
||||
connected: Wallet.ConnectionStatus_Disconnected
|
||||
height: 48
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
6
Makefile
@@ -29,12 +29,14 @@ scanner:
|
||||
mkdir -p build && cd build && cmake -D ARCH="x86-64" -D DEV_MODE=$(or ${DEV_MODE},ON) -D WITH_SCANNER=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release .. && $(MAKE)
|
||||
|
||||
debug-static-win64:
|
||||
mkdir -p $(builddir)/debug && cd $(builddir)/debug && cmake -D STATIC=ON -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},ON) -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 -D MINGW=ON $(topdir) && $(MAKE)
|
||||
mkdir -p $(builddir)/debug && cd $(builddir)/debug && cmake -D STATIC=ON -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},ON) -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
|
||||
|
||||
debug-static-mac64:
|
||||
mkdir -p $(builddir)/debug
|
||||
cd $(builddir)/debug && cmake -D STATIC=ON -D DEV_MODE=$(or ${DEV_MODE},ON) -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="mac-x64" $(topdir) && $(MAKE)
|
||||
|
||||
release-static-win64:
|
||||
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=ON -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},OFF) -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 -D MINGW=ON $(topdir) && $(MAKE)
|
||||
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=ON -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},OFF) -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
|
||||
|
||||
release-win64:
|
||||
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=OFF -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},OFF) -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
|
||||
|
||||
49
README.md
@@ -5,11 +5,11 @@ Copyright (c) 2014-2019, The Monero Project
|
||||
## Development resources
|
||||
|
||||
- Web: [getmonero.org](https://getmonero.org)
|
||||
- Forum: [forum.getmonero.org](https://forum.getmonero.org)
|
||||
- Mail: [dev@getmonero.org](mailto:dev@getmonero.org)
|
||||
- Github: [https://github.com/monero-project/monero-gui](https://github.com/monero-project/monero-gui)
|
||||
- IRC: [#monero-dev on Freenode](irc://chat.freenode.net/#monero-dev)
|
||||
- Translation platform (Weblate): [translate.getmonero.org](https://translate.getmonero.org)
|
||||
- UI Design: [Monero-GUI on Figma](https://www.figma.com/file/DplJ2DDQfIKiuRvolHX2hN/Monero-GUI)
|
||||
|
||||
## Vulnerability response
|
||||
|
||||
@@ -58,16 +58,20 @@ See [LICENSE](LICENSE).
|
||||
|
||||
## Translations
|
||||
|
||||
Do you speak a second language and would like to help translate the Monero GUI? Check out Pootle, our localization platform, at [translate.getmonero.org](https://translate.getmonero.org/projects/monero-gui/). Choose the language and suggest a translation for a string or review an existing one. The Localization Workgroup made [a guide with step-by-step instructions](https://github.com/monero-ecosystem/monero-translations/blob/master/pootle.md) for Pootle.
|
||||
|
||||
Do you speak a second language and would like to help translate the Monero GUI? Check out Weblate, our localization platform, at [translate.getmonero.org](https://translate.getmonero.org/). Choose the language and suggest a translation for a string or review an existing one. The Localization Workgroup made [a guide with step-by-step instructions](https://github.com/monero-ecosystem/monero-translations/blob/master/weblate.md) for Weblate.
|
||||
|
||||
If you need help/support or any info you can contact the localization workgroup on the IRC channel #monero-translations (relayed on matrix/riot and MatterMost) or by email at translate[at]getmonero[dot]org. For more info about the Localization workgroup: [github.com/monero-ecosystem/monero-translations](https://github.com/monero-ecosystem/monero-translations)
|
||||
|
||||
Status of the translations:
|
||||
<a href="https://translate.getmonero.org/engage/monero/?utm_source=widget">
|
||||
<img src="https://translate.getmonero.org/widgets/monero/-/gui-wallet/horizontal-auto.svg" alt="Translation status" />
|
||||
</a>
|
||||
|
||||
## Installing the Monero GUI from a package
|
||||
|
||||
Packages are available for
|
||||
|
||||
* Arch Linux via AUR: [monero-wallet-qt](https://aur.archlinux.org/packages/monero-wallet-qt/)
|
||||
* Arch Linux: pacman -S monero-gui
|
||||
* Void Linux: xbps-install -S monero-core
|
||||
* GuixSD: guix package -i monero-core
|
||||
|
||||
@@ -85,15 +89,15 @@ Packaging for your favorite distribution would be a welcome contribution!
|
||||
|
||||
- For Debian distributions (Debian, Ubuntu, Mint, Tails...)
|
||||
|
||||
`sudo apt install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev`
|
||||
`sudo apt install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev libprotobuf-dev protobuf-compiler libgcrypt20-dev`
|
||||
|
||||
- For Gentoo
|
||||
|
||||
`sudo emerge app-arch/xz-utils app-doc/doxygen dev-cpp/gtest dev-libs/boost dev-libs/expat dev-libs/openssl dev-util/cmake media-gfx/graphviz net-dns/unbound net-libs/ldns net-libs/miniupnpc net-libs/zeromq sys-libs/libunwind dev-libs/libsodium dev-libs/hidapi`
|
||||
`sudo emerge app-arch/xz-utils app-doc/doxygen dev-cpp/gtest dev-libs/boost dev-libs/expat dev-libs/openssl dev-util/cmake media-gfx/graphviz net-dns/unbound net-libs/ldns net-libs/miniupnpc net-libs/zeromq sys-libs/libunwind dev-libs/libsodium dev-libs/hidapi dev-libs/libgcrypt`
|
||||
|
||||
- For Fedora
|
||||
|
||||
`sudo dnf install make automake cmake gcc-c++ boost-devel miniupnpc-devel graphviz doxygen unbound-devel libunwind-devel pkgconfig openssl-devel libcurl-devel hidapi-devel libusb-devel zeromq-devel`
|
||||
`sudo dnf install make automake cmake gcc-c++ boost-devel miniupnpc-devel graphviz doxygen unbound-devel libunwind-devel pkgconfig openssl-devel libcurl-devel hidapi-devel libusb-devel zeromq-devel libgcrypt-devel`
|
||||
|
||||
2. Install Qt:
|
||||
|
||||
@@ -145,26 +149,12 @@ The executable can be found in the build/release/bin folder.
|
||||
|
||||
3. Install [monero](https://github.com/monero-project/monero) dependencies:
|
||||
|
||||
`brew install boost`
|
||||
|
||||
`brew install openssl` - to install openssl headers
|
||||
|
||||
`brew install pkgconfig`
|
||||
|
||||
`brew install cmake`
|
||||
|
||||
`brew install zeromq`
|
||||
|
||||
*Note*: If cmake can not find zmq.hpp file on OS X, installing `zmq.hpp` from https://github.com/zeromq/cppzmq to `/usr/local/include` should fix that error.
|
||||
`brew install boost hidapi zmq libpgm miniupnpc ldns expat libunwind-headers protobuf libgcrypt`
|
||||
|
||||
4. Install Qt:
|
||||
|
||||
`brew install qt5` (or download QT 5.9.7+ from [qt.io](https://www.qt.io/download-open-source/))
|
||||
|
||||
If you have an older version of Qt installed via homebrew, you can force it to use 5.x like so:
|
||||
|
||||
`brew link --force --overwrite qt5`
|
||||
|
||||
5. Add the Qt bin directory to your path
|
||||
|
||||
- Example for Qt: `export PATH=$PATH:$HOME/Qt/5.9.7/clang_64/bin`
|
||||
@@ -184,19 +174,6 @@ The executable can be found in the build/release/bin folder.
|
||||
|
||||
The executable can be found in the `build/release/bin` folder.
|
||||
|
||||
**Note:** Workaround for "ERROR: Xcode not set up properly"
|
||||
|
||||
Edit `$HOME/Qt/5.9.7/clang_64/mkspecs/features/mac/default_pre.prf`
|
||||
|
||||
replace
|
||||
`isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))`
|
||||
|
||||
with
|
||||
`isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))`
|
||||
|
||||
More info: http://stackoverflow.com/a/35098040/1683164
|
||||
|
||||
|
||||
### On Windows:
|
||||
|
||||
The Monero GUI on Windows is 64 bits only; 32-bit Windows GUI builds are not officially supported anymore.
|
||||
@@ -208,7 +185,7 @@ The Monero GUI on Windows is 64 bits only; 32-bit Windows GUI builds are not off
|
||||
3. Install MSYS2 packages for Monero dependencies; the needed 64-bit packages have `x86_64` in their names
|
||||
|
||||
```
|
||||
pacman -S mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb
|
||||
pacman -S mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb mingw-w64-x86_64-libgcrypt
|
||||
```
|
||||
|
||||
Optional : To build the flag `WITH_SCANNER`
|
||||
|
||||
106
components/AdvancedOptionsItem.qml
Normal file
@@ -0,0 +1,106 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Layouts 1.1
|
||||
import FontAwesome 1.0
|
||||
|
||||
import "../components" as MoneroComponents
|
||||
|
||||
RowLayout {
|
||||
id: advancedOptionsItem
|
||||
|
||||
property alias title: title.text
|
||||
property alias button1: button1
|
||||
property alias button2: button2
|
||||
property alias button3: button3
|
||||
property alias helpTextLarge: helpTextLarge
|
||||
property alias helpTextSmall: helpTextSmall
|
||||
|
||||
RowLayout {
|
||||
id: titlecolumn
|
||||
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
||||
Layout.preferredWidth: 195
|
||||
Layout.maximumWidth: 195
|
||||
Layout.leftMargin: 10
|
||||
|
||||
MoneroComponents.Label {
|
||||
id: title
|
||||
fontSize: 14
|
||||
}
|
||||
|
||||
MoneroComponents.Label {
|
||||
id: iconLabel
|
||||
fontSize: 12
|
||||
text: FontAwesome.questionCircle
|
||||
fontFamily: FontAwesome.fontFamily
|
||||
opacity: 0.3
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: helpText.visible = !helpText.visible
|
||||
onEntered: parent.opacity = 0.4
|
||||
onExited: parent.opacity = 0.3
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: separator
|
||||
Layout.fillWidth: true
|
||||
height: 10
|
||||
color: "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: false
|
||||
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
||||
spacing: 4
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: false
|
||||
spacing: 12
|
||||
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
||||
|
||||
StandardButton {
|
||||
id: button1
|
||||
small: true
|
||||
visible: button1.text
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: button2
|
||||
small: true
|
||||
visible: button2.text
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: button3
|
||||
small: true
|
||||
visible: button3.text
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: helpText
|
||||
visible: false
|
||||
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
id: helpTextLarge
|
||||
visible: helpTextLarge.text
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 13
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
}
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
id: helpTextSmall
|
||||
visible: helpTextSmall.text
|
||||
Layout.leftMargin: 5
|
||||
textFormat: Text.RichText
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 12
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ Item {
|
||||
visible: checkBox.border
|
||||
anchors.fill: parent
|
||||
radius: 3
|
||||
color: "transparent"
|
||||
color: checkBox.enabled ? "transparent" : MoneroComponents.Style.inputBoxBackgroundDisabled
|
||||
border.color:
|
||||
if(checkBox.checked){
|
||||
return MoneroComponents.Style.inputBorderColorActive;
|
||||
@@ -108,7 +108,7 @@ Item {
|
||||
font.pixelSize: checkBox.fontSize
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.Wrap
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
104
components/DevicePassphraseDialog.qml
Normal file
@@ -0,0 +1,104 @@
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import QtQuick 2.9
|
||||
import "." as MoneroComponents
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property var onAcceptedCallback
|
||||
property var onWalletEntryCallback
|
||||
property var onRejectedCallback
|
||||
|
||||
function open(canEnterOnDevice_) {
|
||||
var canEnterOnDevice = canEnterOnDevice_ !== null ? canEnterOnDevice_ : canEnterOnDevice
|
||||
root.visible = true;
|
||||
|
||||
if (canEnterOnDevice) {
|
||||
entryChooserDialog.okText = qsTr("Hardware wallet")
|
||||
entryChooserDialog.cancelText = qsTr("Computer")
|
||||
entryChooserDialog.open()
|
||||
} else {
|
||||
openPassphraseDialog()
|
||||
}
|
||||
}
|
||||
|
||||
function openPassphraseDialog() {
|
||||
root.visible = true
|
||||
passphraseDialog.openPassphraseDialog()
|
||||
}
|
||||
|
||||
function close() {
|
||||
root.visible = false;
|
||||
if (entryChooserDialog.visible)
|
||||
entryChooserDialog.close()
|
||||
if (passphraseDialog.visible)
|
||||
passphraseDialog.close()
|
||||
}
|
||||
|
||||
StandardDialog {
|
||||
id: entryChooserDialog
|
||||
title: qsTr("Hardware wallet passphrase") + translationManager.emptyString
|
||||
text: qsTr("Please select where you want to enter passphrase.\nIt is recommended to enter passphrase on the hardware wallet for better security.") + translationManager.emptyString
|
||||
|
||||
onAccepted: {
|
||||
if (onWalletEntryCallback){
|
||||
onWalletEntryCallback()
|
||||
}
|
||||
}
|
||||
|
||||
onRejected: {
|
||||
openPassphraseDialog()
|
||||
}
|
||||
|
||||
onCloseCallback: {
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
|
||||
PasswordDialog {
|
||||
id: passphraseDialog
|
||||
anchors.fill: parent
|
||||
passphraseDialogMode: true
|
||||
|
||||
onAcceptedPassphrase: {
|
||||
if (onAcceptedCallback)
|
||||
onAcceptedCallback(passphraseDialog.password);
|
||||
}
|
||||
|
||||
onRejectedPassphrase: {
|
||||
if (onRejectedCallback)
|
||||
onRejectedCallback();
|
||||
}
|
||||
|
||||
onCloseCallback: {
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,7 @@ Item {
|
||||
property alias fontPixelSize: inlineText.font.pixelSize
|
||||
property alias fontFamily: inlineText.font.family
|
||||
property alias buttonColor: rect.color
|
||||
property alias buttonHeight: rect.height
|
||||
signal clicked()
|
||||
|
||||
function doClick() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2014-2019, The Monero Project
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -53,7 +53,7 @@ Drawer {
|
||||
y: titleBar.height
|
||||
|
||||
background: Rectangle {
|
||||
color: "#0d0d0d"
|
||||
color: MoneroComponents.Style.blackTheme ? "#0d0d0d" : "white"
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
@@ -79,9 +79,24 @@ Drawer {
|
||||
width: sideBar.width
|
||||
height: 32
|
||||
|
||||
Rectangle {
|
||||
id: flagRect
|
||||
height: 24
|
||||
width: 24
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: "transparent"
|
||||
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
source: flag
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 30
|
||||
font.bold: true
|
||||
font.pixelSize: 14
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
@@ -118,8 +133,10 @@ Drawer {
|
||||
// set wizard language settings
|
||||
wizard.language_locale = locale;
|
||||
wizard.language_wallet = wallet_language;
|
||||
wizard.language_language = display_name + " (" + locale_spl[1] + ") ";
|
||||
sideBar.close()
|
||||
wizard.language_language = display_name;
|
||||
|
||||
appWindow.showStatusMessage(qsTr("Language changed."), 3);
|
||||
appWindow.toggleLanguageView();
|
||||
}
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
@@ -134,15 +151,8 @@ Drawer {
|
||||
}
|
||||
}
|
||||
|
||||
ScrollIndicator.vertical: ScrollIndicator {
|
||||
// @TODO: QT 5.9 introduces `policy: ScrollBar.AlwaysOn`
|
||||
active: true
|
||||
contentItem.opacity: 0.7
|
||||
onActiveChanged: {
|
||||
if (!active) {
|
||||
active = true;
|
||||
}
|
||||
}
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
onActiveChanged: if (!active && !isMac) active = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import FontAwesome 1.0
|
||||
import QtQuick 2.9
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
@@ -36,6 +37,10 @@ Item {
|
||||
property alias input: input
|
||||
property alias text: input.text
|
||||
|
||||
property bool password: false
|
||||
property bool passwordHidden: true
|
||||
property var passwordLinked: null
|
||||
|
||||
property alias placeholderText: placeholderLabel.text
|
||||
property bool placeholderCenter: false
|
||||
property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name
|
||||
@@ -48,7 +53,6 @@ Item {
|
||||
property alias validator: input.validator
|
||||
property alias readOnly : input.readOnly
|
||||
property alias cursorPosition: input.cursorPosition
|
||||
property alias echoMode: input.echoMode
|
||||
property alias inlineButton: inlineButtonId
|
||||
property alias inlineButtonText: inlineButtonId.text
|
||||
property alias inlineIcon: inlineIcon.visible
|
||||
@@ -109,6 +113,31 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
function isPasswordHidden() {
|
||||
if (password) {
|
||||
return passwordHidden;
|
||||
}
|
||||
if (passwordLinked) {
|
||||
return passwordLinked.passwordHidden;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function reset() {
|
||||
text = "";
|
||||
if (!passwordLinked) {
|
||||
passwordHidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
function passwordToggle() {
|
||||
if (passwordLinked) {
|
||||
passwordLinked.passwordHidden = !passwordLinked.passwordHidden;
|
||||
} else {
|
||||
passwordHidden = !passwordHidden;
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
id: inputLabel
|
||||
anchors.top: parent.top
|
||||
@@ -210,6 +239,27 @@ Item {
|
||||
onTextChanged: item.textUpdated()
|
||||
topPadding: 10
|
||||
bottomPadding: 10
|
||||
echoMode: isPasswordHidden() ? TextInput.Password : TextInput.Normal
|
||||
|
||||
MoneroComponents.Label {
|
||||
visible: password || passwordLinked
|
||||
fontSize: 20
|
||||
text: isPasswordHidden() ? FontAwesome.eye : FontAwesome.eyeSlash
|
||||
opacity: eyeMouseArea.containsMouse ? 0.9 : 0.7
|
||||
fontFamily: FontAwesome.fontFamily
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 15
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.verticalCenterOffset: 1
|
||||
|
||||
MouseArea {
|
||||
id: eyeMouseArea
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
onClicked: passwordToggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.InlineButton {
|
||||
|
||||
@@ -87,6 +87,8 @@ ColumnLayout {
|
||||
|
||||
property alias inlineButton: inlineButtonId
|
||||
property bool inlineButtonVisible: false
|
||||
property alias inlineButton2: inlineButton2Id
|
||||
property bool inlineButton2Visible: false
|
||||
|
||||
signal labelButtonClicked();
|
||||
signal inputLabelLinkActivated();
|
||||
@@ -202,5 +204,12 @@ ColumnLayout {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 8
|
||||
}
|
||||
|
||||
MoneroComponents.InlineButton {
|
||||
id: inlineButton2Id
|
||||
visible: (inlineButton2Id.text || inlineButton2Id.icon) && inlineButton2Visible ? true : false
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: inlineButtonVisible ? 48 : 8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ Rectangle {
|
||||
height: present ? ((appWindow.height >= 800) ? 44 : 38 ) : 0
|
||||
|
||||
LinearGradient {
|
||||
visible: isOpenGL && button.checked || numSelectedChildren > 0
|
||||
visible: isOpenGL && (button.checked || buttonArea.containsMouse)
|
||||
height: parent.height
|
||||
width: 260
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -75,13 +75,15 @@ Rectangle {
|
||||
GradientStop { position: 0.0; color: MoneroComponents.Style.menuButtonGradientStart }
|
||||
GradientStop { position: 1.0; color: MoneroComponents.Style.menuButtonGradientStop }
|
||||
}
|
||||
opacity: button.checked ? 1 : 0.3
|
||||
}
|
||||
|
||||
// fallback hover effect when opengl is not available
|
||||
Rectangle {
|
||||
visible: !isOpenGL && button.checked
|
||||
visible: !isOpenGL && (button.checked || buttonArea.containsMouse)
|
||||
anchors.fill: parent
|
||||
color: MoneroComponents.Style.menuButtonFallbackBackgroundColor
|
||||
opacity: button.checked ? 1 : 0.3
|
||||
}
|
||||
|
||||
// button decorations that are subject to leftMargin offsets
|
||||
|
||||
@@ -39,23 +39,25 @@ Rectangle {
|
||||
property var connected: Wallet.ConnectionStatus_Disconnected
|
||||
|
||||
function getConnectionStatusString(status) {
|
||||
if (status == Wallet.ConnectionStatus_Connected) {
|
||||
if(!appWindow.daemonSynced)
|
||||
return qsTr("Synchronizing")
|
||||
if(persistentSettings.useRemoteNode)
|
||||
return qsTr("Remote node")
|
||||
return appWindow.isMining ? qsTr("Connected") + " + " + qsTr("Mining"): qsTr("Connected")
|
||||
switch (status) {
|
||||
case Wallet.ConnectionStatus_Connected:
|
||||
if (!appWindow.daemonSynced)
|
||||
return qsTr("Synchronizing");
|
||||
if (persistentSettings.useRemoteNode)
|
||||
return qsTr("Remote node");
|
||||
return appWindow.isMining ? qsTr("Connected") + " + " + qsTr("Mining"): qsTr("Connected");
|
||||
case Wallet.ConnectionStatus_WrongVersion:
|
||||
return qsTr("Wrong version");
|
||||
case Wallet.ConnectionStatus_Disconnected:
|
||||
if (appWindow.walletMode <= 1) {
|
||||
return qsTr("Searching node") + translationManager.emptyString;
|
||||
}
|
||||
return qsTr("Disconnected");
|
||||
case Wallet.ConnectionStatus_Connecting:
|
||||
return qsTr("Connecting");
|
||||
default:
|
||||
return qsTr("Invalid connection status");
|
||||
}
|
||||
if (status == Wallet.ConnectionStatus_WrongVersion)
|
||||
return qsTr("Wrong version")
|
||||
if (status == Wallet.ConnectionStatus_Disconnected){
|
||||
if(appWindow.walletMode <= 1){
|
||||
return qsTr("Searching node") + translationManager.emptyString;
|
||||
}
|
||||
return qsTr("Disconnected")
|
||||
}
|
||||
|
||||
return qsTr("Invalid connection status")
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
@@ -159,9 +161,9 @@ Rectangle {
|
||||
opacity: iconItem.opacity * (refreshMouseArea.visible ? 1 : 0.5)
|
||||
text: FontAwesome.random
|
||||
visible: (
|
||||
item.connected != Wallet.ConnectionStatus_Disconnected &&
|
||||
!appWindow.disconnected &&
|
||||
!persistentSettings.useRemoteNode &&
|
||||
persistentSettings.bootstrapNodeAddress == "auto"
|
||||
(persistentSettings.bootstrapNodeAddress == "auto" || persistentSettings.walletMode < 2)
|
||||
)
|
||||
|
||||
MouseArea {
|
||||
|
||||
@@ -43,7 +43,6 @@ Item {
|
||||
visible: false
|
||||
z: parent.z + 2
|
||||
|
||||
property bool isHidden: true
|
||||
property alias password: passwordInput1.text
|
||||
property string walletName
|
||||
property string errorText
|
||||
@@ -61,13 +60,10 @@ Item {
|
||||
signal closeCallback()
|
||||
|
||||
function _openInit(walletName, errorText) {
|
||||
isHidden = true
|
||||
capsLockTextLabel.visible = oshelper.isCapsLock();
|
||||
passwordInput1.echoMode = TextInput.Password
|
||||
passwordInput2.echoMode = TextInput.Password
|
||||
passwordInput1.text = ""
|
||||
passwordInput2.text = ""
|
||||
passwordInput1.forceActiveFocus();
|
||||
passwordInput1.reset();
|
||||
passwordInput2.reset();
|
||||
passwordInput1.input.forceActiveFocus();
|
||||
root.walletName = walletName ? walletName : ""
|
||||
errorTextLabel.text = errorText ? errorText : "";
|
||||
leftPanel.enabled = false
|
||||
@@ -116,10 +112,29 @@ Item {
|
||||
closeCallback();
|
||||
}
|
||||
|
||||
function toggleIsHidden() {
|
||||
passwordInput1.echoMode = isHidden ? TextInput.Normal : TextInput.Password;
|
||||
passwordInput2.echoMode = isHidden ? TextInput.Normal : TextInput.Password;
|
||||
isHidden = !isHidden;
|
||||
function onOk() {
|
||||
if (!passwordDialogMode && passwordInput1.text !== passwordInput2.text) {
|
||||
return;
|
||||
}
|
||||
root.close()
|
||||
if (passwordDialogMode) {
|
||||
root.accepted()
|
||||
} else if (newPasswordDialogMode) {
|
||||
root.acceptedNewPassword()
|
||||
} else if (passphraseDialogMode) {
|
||||
root.acceptedPassphrase()
|
||||
}
|
||||
}
|
||||
|
||||
function onCancel() {
|
||||
root.close()
|
||||
if (passwordDialogMode) {
|
||||
root.rejected()
|
||||
} else if (newPasswordDialogMode) {
|
||||
root.rejectedNewPassword()
|
||||
} else if (passphraseDialogMode) {
|
||||
root.rejectedPassphrase()
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
@@ -184,15 +199,11 @@ Item {
|
||||
text: qsTr("CAPSLOCKS IS ON.") + translationManager.emptyString;
|
||||
}
|
||||
|
||||
MoneroComponents.Input {
|
||||
MoneroComponents.LineEdit {
|
||||
id: passwordInput1
|
||||
password: true
|
||||
Layout.topMargin: 6
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: TextInput.AlignLeft
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
font.family: MoneroComponents.Style.fontLight.name
|
||||
font.pixelSize: 24
|
||||
echoMode: TextInput.Password
|
||||
KeyNavigation.tab: {
|
||||
if (passwordDialogMode) {
|
||||
return okButton
|
||||
@@ -200,78 +211,12 @@ Item {
|
||||
return passwordInput2
|
||||
}
|
||||
}
|
||||
implicitHeight: 50
|
||||
bottomPadding: 10
|
||||
leftPadding: 10
|
||||
topPadding: 10
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
selectionColor: MoneroComponents.Style.textSelectionColor
|
||||
selectedTextColor: MoneroComponents.Style.textSelectedColor
|
||||
onTextChanged: capsLockTextLabel.visible = oshelper.isCapsLock();
|
||||
|
||||
background: Rectangle {
|
||||
radius: 2
|
||||
color: MoneroComponents.Style.blackTheme ? "black" : "#A9FFFFFF"
|
||||
border.color: MoneroComponents.Style.inputBorderColorInActive
|
||||
border.width: 1
|
||||
|
||||
MoneroEffects.ColorTransition {
|
||||
targetObj: parent
|
||||
blackColor: "black"
|
||||
whiteColor: "#A9FFFFFF"
|
||||
}
|
||||
|
||||
MoneroComponents.Label {
|
||||
fontSize: 20
|
||||
text: isHidden ? FontAwesome.eye : FontAwesome.eyeSlash
|
||||
opacity: 0.7
|
||||
fontFamily: FontAwesome.fontFamily
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 15
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.verticalCenterOffset: 1
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
toggleIsHidden();
|
||||
}
|
||||
onEntered: {
|
||||
parent.opacity = 0.9
|
||||
parent.fontSize = 24
|
||||
}
|
||||
onExited: {
|
||||
parent.opacity = 0.7
|
||||
parent.fontSize = 20
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keys.enabled: root.visible
|
||||
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
||||
Keys.onReturnPressed: {
|
||||
root.close()
|
||||
if (passwordDialogMode) {
|
||||
root.accepted()
|
||||
} else if (newPasswordDialogMode) {
|
||||
root.acceptedNewPassword()
|
||||
} else if (passphraseDialogMode) {
|
||||
root.acceptedPassphrase()
|
||||
}
|
||||
}
|
||||
Keys.onEscapePressed: {
|
||||
root.close()
|
||||
if (passwordDialogMode) {
|
||||
root.rejected()
|
||||
} else if (newPasswordDialogMode) {
|
||||
root.rejectedNewPassword()
|
||||
} else if (passphraseDialogMode) {
|
||||
root.rejectedPassphrase()
|
||||
}
|
||||
}
|
||||
Keys.onEnterPressed: root.onOk()
|
||||
Keys.onReturnPressed: root.onOk()
|
||||
Keys.onEscapePressed: root.onCancel()
|
||||
}
|
||||
|
||||
// padding
|
||||
@@ -295,81 +240,19 @@ Item {
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
}
|
||||
|
||||
MoneroComponents.Input {
|
||||
MoneroComponents.LineEdit {
|
||||
id: passwordInput2
|
||||
passwordLinked: passwordInput1
|
||||
visible: !passwordDialogMode
|
||||
Layout.topMargin: 6
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: TextInput.AlignLeft
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
font.family: MoneroComponents.Style.fontLight.name
|
||||
font.pixelSize: 24
|
||||
echoMode: TextInput.Password
|
||||
KeyNavigation.tab: okButton
|
||||
implicitHeight: 50
|
||||
bottomPadding: 10
|
||||
leftPadding: 10
|
||||
topPadding: 10
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
selectionColor: MoneroComponents.Style.textSelectionColor
|
||||
selectedTextColor: MoneroComponents.Style.textSelectedColor
|
||||
onTextChanged: capsLockTextLabel.visible = oshelper.isCapsLock();
|
||||
|
||||
background: Rectangle {
|
||||
radius: 2
|
||||
border.color: MoneroComponents.Style.inputBorderColorInActive
|
||||
border.width: 1
|
||||
color: MoneroComponents.Style.blackTheme ? "black" : "#A9FFFFFF"
|
||||
|
||||
MoneroComponents.Label {
|
||||
fontSize: 20
|
||||
text: isHidden ? FontAwesome.eye : FontAwesome.eyeSlash
|
||||
opacity: 0.7
|
||||
fontFamily: FontAwesome.fontFamily
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 15
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.verticalCenterOffset: 1
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
toggleIsHidden()
|
||||
}
|
||||
onEntered: {
|
||||
parent.opacity = 0.9
|
||||
parent.fontSize = 24
|
||||
}
|
||||
onExited: {
|
||||
parent.opacity = 0.7
|
||||
parent.fontSize = 20
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keys.enabled: root.visible
|
||||
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
||||
Keys.onReturnPressed: {
|
||||
if (passwordInput1.text === passwordInput2.text) {
|
||||
root.close()
|
||||
if (newPasswordDialogMode) {
|
||||
root.acceptedNewPassword()
|
||||
} else if (passphraseDialogMode) {
|
||||
root.acceptedPassphrase()
|
||||
}
|
||||
}
|
||||
}
|
||||
Keys.onEscapePressed: {
|
||||
root.close()
|
||||
if (newPasswordDialogMode) {
|
||||
root.rejectedNewPassword()
|
||||
} else if (passphraseDialogMode) {
|
||||
root.rejectedPassphrase()
|
||||
}
|
||||
}
|
||||
Keys.onEnterPressed: root.onOk()
|
||||
Keys.onReturnPressed: root.onOk()
|
||||
Keys.onEscapePressed: root.onCancel()
|
||||
}
|
||||
|
||||
// padding
|
||||
@@ -394,16 +277,7 @@ Item {
|
||||
small: true
|
||||
text: qsTr("Cancel") + translationManager.emptyString
|
||||
KeyNavigation.tab: passwordInput1
|
||||
onClicked: {
|
||||
root.close()
|
||||
if (passwordDialogMode) {
|
||||
root.rejected()
|
||||
} else if (newPasswordDialogMode) {
|
||||
root.rejectedNewPassword()
|
||||
} else if (passphraseDialogMode) {
|
||||
root.rejectedPassphrase()
|
||||
}
|
||||
}
|
||||
onClicked: onCancel()
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
@@ -412,16 +286,7 @@ Item {
|
||||
text: qsTr("Ok") + translationManager.emptyString
|
||||
KeyNavigation.tab: cancelButton
|
||||
enabled: (passwordDialogMode == true) ? true : passwordInput1.text === passwordInput2.text
|
||||
onClicked: {
|
||||
root.close()
|
||||
if (passwordDialogMode) {
|
||||
root.accepted()
|
||||
} else if (newPasswordDialogMode) {
|
||||
root.acceptedNewPassword()
|
||||
} else if (passphraseDialogMode) {
|
||||
root.acceptedPassphrase()
|
||||
}
|
||||
}
|
||||
onClicked: onOk()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,21 +29,23 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Window 2.1
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import "../components" as MoneroComponents
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: MoneroComponents.Style.blackTheme ? "white" : "transparent"
|
||||
color: MoneroComponents.Style.blackTheme ? "black" : "white"
|
||||
visible: false
|
||||
radius: 10
|
||||
border.color: MoneroComponents.Style.blackTheme ? Qt.rgba(255, 255, 255, 0.25) : Qt.rgba(0, 0, 0, 0.25)
|
||||
border.width: 1
|
||||
z: 11
|
||||
property alias messageText: messageTitle.text
|
||||
property alias heightProgressText : heightProgress.text
|
||||
|
||||
width: 200
|
||||
height: 100
|
||||
opacity: 0.7
|
||||
width: 100
|
||||
height: 50
|
||||
|
||||
function show() {
|
||||
root.visible = true;
|
||||
@@ -56,44 +58,55 @@ Rectangle {
|
||||
ColumnLayout {
|
||||
id: rootLayout
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.centerIn: parent
|
||||
|
||||
anchors.leftMargin: 30
|
||||
anchors.rightMargin: 30
|
||||
|
||||
spacing: 12
|
||||
spacing: 21
|
||||
|
||||
BusyIndicator {
|
||||
running: parent.visible
|
||||
Item {
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||
Layout.preferredHeight: 80
|
||||
|
||||
Image {
|
||||
id: imgLogo
|
||||
width: 60
|
||||
height: 60
|
||||
anchors.centerIn: parent
|
||||
source: "qrc:///images/monero-vector.svg"
|
||||
mipmap: true
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
running: parent.visible
|
||||
anchors.centerIn: imgLogo
|
||||
style: BusyIndicatorStyle {
|
||||
indicator: Image {
|
||||
visible: control.running
|
||||
source: "qrc:///images/busy-indicator.png"
|
||||
RotationAnimator on rotation {
|
||||
running: control.running
|
||||
loops: Animation.Infinite
|
||||
duration: 1000
|
||||
from: 0
|
||||
to: 360
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
id: messageTitle
|
||||
text: "Please wait..."
|
||||
font {
|
||||
pixelSize: 22
|
||||
}
|
||||
text: qsTr("Please wait...") + translationManager.emptyString
|
||||
font.pixelSize: 24
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
themeTransition: false
|
||||
color: "black"
|
||||
}
|
||||
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
id: heightProgress
|
||||
font {
|
||||
pixelSize: 18
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
themeTransition: false
|
||||
color: "black"
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ Rectangle {
|
||||
function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){
|
||||
if(targetBlock > 0) {
|
||||
var remaining = (currentBlock < targetBlock) ? targetBlock - currentBlock : 0
|
||||
var progressLevel = (blocksToSync > 0 && blocksToSync != remaining) ? (100*(blocksToSync - remaining)/blocksToSync).toFixed(0) : (100*(currentBlock / targetBlock)).toFixed(0)
|
||||
var progressLevel = (blocksToSync > 0 ) ? (100*(blocksToSync - remaining)/blocksToSync).toFixed(0) : 100
|
||||
fillLevel = progressLevel
|
||||
if(typeof statusTxt != "undefined" && statusTxt != "") {
|
||||
progressText.text = statusTxt;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2014-2018, The Monero Project
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -53,6 +53,7 @@ Rectangle {
|
||||
script: {
|
||||
root.visible = true
|
||||
camera.captureMode = Camera.CaptureStillImage
|
||||
camera.cameraState = Camera.ActiveState
|
||||
camera.start()
|
||||
finder.enabled = true
|
||||
}
|
||||
@@ -65,6 +66,7 @@ Rectangle {
|
||||
camera.stop()
|
||||
root.visible = false
|
||||
finder.enabled = false
|
||||
camera.cameraState = Camera.UnloadedState
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,6 +76,7 @@ Rectangle {
|
||||
id: camera
|
||||
objectName: "qrCameraQML"
|
||||
captureMode: Camera.CaptureStillImage
|
||||
cameraState: Camera.UnloadedState
|
||||
|
||||
focus {
|
||||
focusMode: Camera.FocusContinuous
|
||||
|
||||
@@ -1,41 +1,71 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Layouts 1.1
|
||||
import FontAwesome 1.0
|
||||
|
||||
import "../components" as MoneroComponents
|
||||
|
||||
ColumnLayout {
|
||||
property alias buttonText: button.text
|
||||
property alias description: description.text
|
||||
property alias title: title.text
|
||||
id: settingsListItem
|
||||
property alias iconText: iconLabel.text
|
||||
property alias description: area.text
|
||||
property alias title: header.text
|
||||
property bool isLast: false
|
||||
signal clicked()
|
||||
|
||||
id: settingsListItem
|
||||
Layout.fillWidth: true
|
||||
spacing: 0
|
||||
|
||||
Rectangle {
|
||||
// divider
|
||||
Layout.preferredHeight: 1
|
||||
id: root
|
||||
Layout.fillWidth: true
|
||||
Layout.bottomMargin: 8
|
||||
color: MoneroComponents.Style.dividerColor
|
||||
opacity: MoneroComponents.Style.dividerOpacity
|
||||
}
|
||||
Layout.minimumHeight: 75
|
||||
Layout.preferredHeight: rect.height + 15
|
||||
color: "transparent"
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 0
|
||||
Rectangle {
|
||||
id: divider
|
||||
anchors.topMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: 1
|
||||
color: MoneroComponents.Style.dividerColor
|
||||
opacity: MoneroComponents.Style.dividerOpacity
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
spacing: 0
|
||||
Rectangle {
|
||||
id: rect
|
||||
width: parent.width
|
||||
height: header.height + area.contentHeight
|
||||
color: "transparent";
|
||||
anchors.left: parent.left
|
||||
anchors.bottomMargin: 4
|
||||
anchors.topMargin: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Rectangle {
|
||||
id: icon
|
||||
color: "transparent"
|
||||
height: 32
|
||||
width: 32
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
MoneroComponents.Label {
|
||||
id: iconLabel
|
||||
fontSize: 32
|
||||
fontFamily: FontAwesome.fontFamilySolid
|
||||
anchors.centerIn: parent
|
||||
fontColor: MoneroComponents.Style.defaultFontColor
|
||||
styleName: "Solid"
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
id: title
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 20
|
||||
Layout.topMargin: 8
|
||||
id: header
|
||||
anchors.left: icon.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.top: parent.top
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
opacity: MoneroComponents.Style.blackTheme ? 1.0 : 0.8
|
||||
font.bold: true
|
||||
@@ -43,23 +73,43 @@ ColumnLayout {
|
||||
font.pixelSize: 16
|
||||
}
|
||||
|
||||
MoneroComponents.TextPlainArea {
|
||||
id: description
|
||||
Text {
|
||||
id: area
|
||||
anchors.top: header.bottom
|
||||
anchors.topMargin: 4
|
||||
anchors.left: icon.right
|
||||
anchors.leftMargin: 16
|
||||
color: MoneroComponents.Style.dimmedFontColor
|
||||
colorBlackTheme: MoneroComponents.Style._b_dimmedFontColor
|
||||
colorWhiteTheme: MoneroComponents.Style._w_dimmedFontColor
|
||||
Layout.fillWidth: true
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 15
|
||||
horizontalAlignment: TextInput.AlignLeft
|
||||
wrapMode: Text.WordWrap;
|
||||
leftPadding: 0
|
||||
topPadding: 0
|
||||
width: parent.width - (icon.width + icon.anchors.leftMargin + anchors.leftMargin)
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
id: button
|
||||
small: true
|
||||
Rectangle {
|
||||
id: bottomDivider
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: 1
|
||||
color: MoneroComponents.Style.dividerColor
|
||||
opacity: MoneroComponents.Style.dividerOpacity
|
||||
visible: settingsListItem.isLast
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onEntered: root.color = MoneroComponents.Style.titleBarButtonHoverColor
|
||||
onExited: root.color = "transparent"
|
||||
onClicked: {
|
||||
settingsListItem.clicked()
|
||||
}
|
||||
width: 135
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
68
components/Slider.qml
Normal file
@@ -0,0 +1,68 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.0 as QtQuickControls
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import "../components" as MoneroComponents
|
||||
|
||||
ColumnLayout {
|
||||
property alias from: slider.from
|
||||
property alias stepSize: slider.stepSize
|
||||
property alias to: slider.to
|
||||
property alias value: slider.value
|
||||
|
||||
property alias text: label.text
|
||||
|
||||
signal moved()
|
||||
|
||||
spacing: 0
|
||||
|
||||
Text {
|
||||
id: label
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
font.pixelSize: 14
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
QtQuickControls.Slider {
|
||||
id: slider
|
||||
leftPadding: 0
|
||||
snapMode: QtQuickControls.Slider.SnapAlways
|
||||
|
||||
background: Rectangle {
|
||||
x: parent.leftPadding
|
||||
y: parent.topPadding + parent.availableHeight / 2 - height / 2
|
||||
implicitWidth: 200
|
||||
implicitHeight: 4
|
||||
width: parent.availableWidth
|
||||
height: implicitHeight
|
||||
radius: 2
|
||||
color: MoneroComponents.Style.progressBarBackgroundColor
|
||||
|
||||
Rectangle {
|
||||
width: parent.visualPosition * parent.width
|
||||
height: parent.height
|
||||
color: MoneroComponents.Style.green
|
||||
radius: 2
|
||||
}
|
||||
}
|
||||
|
||||
handle: Rectangle {
|
||||
x: parent.leftPadding + parent.visualPosition * (parent.availableWidth - width)
|
||||
y: parent.topPadding + parent.availableHeight / 2 - height / 2
|
||||
implicitWidth: 18
|
||||
implicitHeight: 18
|
||||
radius: 8
|
||||
color: parent.pressed ? "#f0f0f0" : "#f6f6f6"
|
||||
border.color: MoneroComponents.Style.grey
|
||||
}
|
||||
|
||||
onMoved: parent.moved()
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.NoButton
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,11 +33,17 @@ import "../components" as MoneroComponents
|
||||
|
||||
Item {
|
||||
id: button
|
||||
property bool primary: true
|
||||
property string rightIcon: ""
|
||||
property string rightIconInactive: ""
|
||||
property string textColor: button.enabled? MoneroComponents.Style.buttonTextColor: MoneroComponents.Style.buttonTextColorDisabled
|
||||
property color textColor: !button.enabled
|
||||
? MoneroComponents.Style.buttonTextColorDisabled
|
||||
: primary
|
||||
? MoneroComponents.Style.buttonTextColor
|
||||
: MoneroComponents.Style.buttonSecondaryTextColor;
|
||||
property bool small: false
|
||||
property alias text: label.text
|
||||
property alias fontBold: label.font.bold
|
||||
property int fontSize: {
|
||||
if(small) return 14;
|
||||
else return 16;
|
||||
@@ -70,7 +76,9 @@ Item {
|
||||
when: buttonArea.containsMouse || button.focus
|
||||
PropertyChanges {
|
||||
target: buttonRect
|
||||
color: MoneroComponents.Style.buttonBackgroundColorHover
|
||||
color: primary
|
||||
? MoneroComponents.Style.buttonBackgroundColorHover
|
||||
: MoneroComponents.Style.buttonSecondaryBackgroundColorHover
|
||||
}
|
||||
},
|
||||
State {
|
||||
@@ -78,7 +86,9 @@ Item {
|
||||
when: button.enabled
|
||||
PropertyChanges {
|
||||
target: buttonRect
|
||||
color: MoneroComponents.Style.buttonBackgroundColor
|
||||
color: primary
|
||||
? MoneroComponents.Style.buttonBackgroundColor
|
||||
: MoneroComponents.Style.buttonSecondaryBackgroundColor
|
||||
}
|
||||
},
|
||||
State {
|
||||
|
||||
@@ -90,6 +90,10 @@ Rectangle {
|
||||
|
||||
function close() {
|
||||
root.visible = false;
|
||||
// reset button text
|
||||
okButton.text = qsTr("OK")
|
||||
cancelButton.text = qsTr("Cancel")
|
||||
|
||||
closeCallback();
|
||||
}
|
||||
|
||||
|
||||
@@ -58,11 +58,6 @@ Item {
|
||||
|
||||
onExpandedChanged: if(expanded) appWindow.currentItem = dropdown
|
||||
|
||||
// Workaroud for suspected memory leak in 5.8 causing malloc crash on app exit
|
||||
function update() {
|
||||
firstColText.text = columnid.currentIndex < repeater.model.rowCount() ? qsTr(repeater.model.get(columnid.currentIndex).column1) + translationManager.emptyString : ""
|
||||
}
|
||||
|
||||
Item {
|
||||
id: head
|
||||
anchors.left: parent.left
|
||||
@@ -80,15 +75,17 @@ Item {
|
||||
}
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
id: firstColText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
anchors.right: dropIndicator.left
|
||||
anchors.rightMargin: 12
|
||||
elide: Text.ElideRight
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.bold: dropdown.headerFontBold
|
||||
font.pixelSize: dropdown.fontHeaderSize
|
||||
color: dropdown.textColor
|
||||
text: columnid.currentIndex < repeater.model.count ? qsTr(repeater.model.get(columnid.currentIndex).column1) + translationManager.emptyString : ""
|
||||
}
|
||||
|
||||
Item {
|
||||
@@ -96,7 +93,8 @@ Item {
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
width: 32
|
||||
anchors.rightMargin: 12
|
||||
width: dropdownIcon.width
|
||||
|
||||
Image {
|
||||
id: dropdownIcon
|
||||
@@ -137,20 +135,6 @@ Item {
|
||||
height: dropdown.expanded ? columnid.height : 0
|
||||
color: dropdown.pressedColor
|
||||
|
||||
Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
width: 3; height: 3
|
||||
color: dropdown.pressedColor
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
width: 3; height: 3
|
||||
color: dropdown.pressedColor
|
||||
}
|
||||
|
||||
Behavior on height {
|
||||
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
|
||||
}
|
||||
@@ -228,7 +212,6 @@ Item {
|
||||
popup.close()
|
||||
columnid.currentIndex = index
|
||||
changed();
|
||||
dropdown.update()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ QtObject {
|
||||
property string textSelectedColor: blackTheme ? _b_textSelectedColor : _w_textSelectedColor
|
||||
|
||||
property string inputBoxBackground: blackTheme ? _b_inputBoxBackground : _w_inputBoxBackground
|
||||
property string inputBoxBackgroundDisabled: blackTheme ? _b_inputBoxBackgroundDisabled : _w_inputBoxBackgroundDisabled
|
||||
property string inputBoxBackgroundError: blackTheme ? _b_inputBoxBackgroundError : _w_inputBoxBackgroundError
|
||||
property string inputBoxColor: blackTheme ? _b_inputBoxColor : _w_inputBoxColor
|
||||
property string legacy_placeholderFontColor: blackTheme ? _b_legacy_placeholderFontColor : _w_legacy_placeholderFontColor
|
||||
@@ -43,6 +44,9 @@ QtObject {
|
||||
property string buttonInlineBackgroundColor: blackTheme ? _b_buttonInlineBackgroundColor : _w_buttonInlineBackgroundColor
|
||||
property string buttonTextColor: blackTheme ? _b_buttonTextColor : _w_buttonTextColor
|
||||
property string buttonTextColorDisabled: blackTheme ? _b_buttonTextColorDisabled : _w_buttonTextColorDisabled
|
||||
property string buttonSecondaryBackgroundColor: "#d9d9d9"
|
||||
property string buttonSecondaryBackgroundColorHover: "#a6a6a6"
|
||||
property string buttonSecondaryTextColor: "#4d4d4d"
|
||||
property string dividerColor: blackTheme ? _b_dividerColor : _w_dividerColor
|
||||
property real dividerOpacity: blackTheme ? _b_dividerOpacity : _w_dividerOpacity
|
||||
|
||||
@@ -85,6 +89,7 @@ QtObject {
|
||||
property string _b_textSelectedColor: "white"
|
||||
|
||||
property string _b_inputBoxBackground: "black"
|
||||
property string _b_inputBoxBackgroundDisabled: Qt.rgba(255, 255, 255, 0.10)
|
||||
property string _b_inputBoxBackgroundError: "#FFDDDD"
|
||||
property string _b_inputBoxColor: "white"
|
||||
property string _b_legacy_placeholderFontColor: "#BABABA"
|
||||
@@ -123,7 +128,7 @@ QtObject {
|
||||
property string _b_menuButtonImageRightColor: "white"
|
||||
property string _b_menuButtonImageRightSource: "qrc:///images/right.svg"
|
||||
property string _b_menuButtonImageDotArrowSource: "qrc:///images/arrow-right-medium-white.png"
|
||||
property string _b_inlineButtonTextColor: "black"
|
||||
property string _b_inlineButtonTextColor: "white"
|
||||
property string _b_inlineButtonBorderColor: "black"
|
||||
property string _b_appWindowBackgroundColor: "white"
|
||||
property string _b_appWindowBorderColor: "#313131"
|
||||
@@ -141,6 +146,7 @@ QtObject {
|
||||
property string _w_textSelectedColor: "black"
|
||||
|
||||
property string _w_inputBoxBackground: "white"
|
||||
property string _w_inputBoxBackgroundDisabled: Qt.rgba(0, 0, 0, 0.20)
|
||||
property string _w_inputBoxBackgroundError: "#FFDDDD"
|
||||
property string _w_inputBoxColor: "black"
|
||||
property string _w_legacy_placeholderFontColor: "#BABABA"
|
||||
@@ -179,7 +185,7 @@ QtObject {
|
||||
property string _w_menuButtonImageRightColorActive: "#FA6800"
|
||||
property string _w_menuButtonImageRightColor: "#808080"
|
||||
property string _w_menuButtonImageDotArrowSource: "qrc:///images/arrow-right-medium-white.png"
|
||||
property string _w_inlineButtonTextColor: "white"
|
||||
property string _w_inlineButtonTextColor: "black"
|
||||
property string _w_inlineButtonBorderColor: "transparent"
|
||||
property string _w_appWindowBackgroundColor: "black"
|
||||
property string _w_appWindowBorderColor: "#dedede"
|
||||
|
||||
@@ -309,8 +309,8 @@ Rectangle {
|
||||
width: 16
|
||||
image: MoneroComponents.Style.titleBarCloseSource
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
fontAwesomeFallbackIcon: FontAwesome.timesRectangle
|
||||
fontAwesomeFallbackSize: 18
|
||||
fontAwesomeFallbackIcon: FontAwesome.times
|
||||
fontAwesomeFallbackSize: 21
|
||||
fontAwesomeFallbackOpacity: MoneroComponents.Style.blackTheme ? 0.8 : 0.6
|
||||
opacity: 0.75
|
||||
}
|
||||
|
||||
203
components/UpdateDialog.qml
Normal file
@@ -0,0 +1,203 @@
|
||||
// Copyright (c) 2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import moneroComponents.Downloader 1.0
|
||||
|
||||
import "../components" as MoneroComponents
|
||||
|
||||
Popup {
|
||||
id: updateDialog
|
||||
|
||||
property bool active: false
|
||||
property bool allowed: true
|
||||
property string error: ""
|
||||
property string filename: ""
|
||||
property string hash: ""
|
||||
property double progress: url && downloader.total > 0 ? downloader.loaded * 100 / downloader.total : 0
|
||||
property string url: ""
|
||||
property bool valid: false
|
||||
property string version: ""
|
||||
|
||||
background: Rectangle {
|
||||
border.color: MoneroComponents.Style.appWindowBorderColor
|
||||
border.width: 1
|
||||
color: MoneroComponents.Style.middlePanelBackgroundColor
|
||||
}
|
||||
closePolicy: Popup.NoAutoClose
|
||||
padding: 20
|
||||
visible: active && allowed
|
||||
|
||||
function show(version, url, hash) {
|
||||
updateDialog.error = "";
|
||||
updateDialog.hash = hash;
|
||||
updateDialog.url = url;
|
||||
updateDialog.valid = false;
|
||||
updateDialog.version = version;
|
||||
updateDialog.active = true;
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: mainLayout
|
||||
spacing: updateDialog.padding
|
||||
|
||||
Text {
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
font.bold: true
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 18
|
||||
text: qsTr("New Monero version v%1 is available.").arg(updateDialog.version)
|
||||
}
|
||||
|
||||
Text {
|
||||
id: errorText
|
||||
color: "red"
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 18
|
||||
text: updateDialog.error
|
||||
visible: text
|
||||
}
|
||||
|
||||
Text {
|
||||
id: statusText
|
||||
color: updateDialog.valid ? MoneroComponents.Style.green : MoneroComponents.Style.defaultFontColor
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 18
|
||||
visible: !errorText.visible
|
||||
|
||||
text: {
|
||||
if (!updateDialog.url) {
|
||||
return qsTr("Please visit getmonero.org for details") + translationManager.emptyString;
|
||||
}
|
||||
if (downloader.active) {
|
||||
return "%1 (%2%)"
|
||||
.arg(qsTr("Downloading"))
|
||||
.arg(updateDialog.progress.toFixed(1))
|
||||
+ translationManager.emptyString;
|
||||
}
|
||||
if (updateDialog.valid) {
|
||||
return qsTr("Update downloaded, signature verified") + translationManager.emptyString;
|
||||
}
|
||||
return qsTr("Do you want to download and verify new version?") + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: progressBar
|
||||
color: MoneroComponents.Style.lightGreyFontColor
|
||||
height: 3
|
||||
Layout.fillWidth: true
|
||||
visible: updateDialog.valid || downloader.active
|
||||
|
||||
Rectangle {
|
||||
color: MoneroComponents.Style.buttonBackgroundColor
|
||||
height: parent.height
|
||||
width: parent.width * updateDialog.progress / 100
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
spacing: parent.spacing
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
id: cancelButton
|
||||
fontBold: false
|
||||
primary: !updateDialog.url
|
||||
text: {
|
||||
if (!updateDialog.url) {
|
||||
return qsTr("Ok") + translationManager.emptyString;
|
||||
}
|
||||
if (updateDialog.valid || downloader.active || errorText.visible) {
|
||||
return qsTr("Cancel") + translationManager.emptyString;
|
||||
}
|
||||
return qsTr("Download later") + translationManager.emptyString;
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
downloader.cancel();
|
||||
updateDialog.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
id: downloadButton
|
||||
KeyNavigation.tab: cancelButton
|
||||
fontBold: false
|
||||
text: (updateDialog.error ? qsTr("Retry") : qsTr("Download")) + translationManager.emptyString
|
||||
visible: updateDialog.url && !updateDialog.valid && !downloader.active
|
||||
|
||||
onClicked: {
|
||||
updateDialog.error = "";
|
||||
updateDialog.filename = updateDialog.url.replace(/^.*\//, '');
|
||||
const downloadingStarted = downloader.get(updateDialog.url, updateDialog.hash, function(error) {
|
||||
if (error) {
|
||||
console.error("Download failed", error);
|
||||
updateDialog.error = qsTr("Download failed") + translationManager.emptyString;
|
||||
} else {
|
||||
updateDialog.valid = true;
|
||||
}
|
||||
});
|
||||
if (!downloadingStarted) {
|
||||
updateDialog.error = qsTr("Failed to start download") + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
id: saveButton
|
||||
KeyNavigation.tab: cancelButton
|
||||
fontBold: false
|
||||
onClicked: {
|
||||
const fullPath = oshelper.openSaveFileDialog(
|
||||
qsTr("Save as") + translationManager.emptyString,
|
||||
oshelper.downloadLocation(),
|
||||
updateDialog.filename);
|
||||
if (!fullPath) {
|
||||
return;
|
||||
}
|
||||
if (downloader.saveToFile(fullPath)) {
|
||||
cancelButton.clicked();
|
||||
oshelper.openContainingFolder(fullPath);
|
||||
} else {
|
||||
updateDialog.error = qsTr("Save operation failed") + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
text: qsTr("Save to file") + translationManager.emptyString
|
||||
visible: updateDialog.valid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Downloader {
|
||||
id: downloader
|
||||
}
|
||||
}
|
||||
@@ -149,6 +149,7 @@ Object {
|
||||
property string caretUp : "\uf0d8"
|
||||
property string cartArrowDown : "\uf218"
|
||||
property string cartPlus : "\uf217"
|
||||
property string cashRegister: "\uf788"
|
||||
property string cc : "\uf20a"
|
||||
property string ccAmex : "\uf1f3"
|
||||
property string ccDinersClub : "\uf24c"
|
||||
|
||||
@@ -17,7 +17,7 @@ if [ ! -d $MONERO_DIR/src ]; then
|
||||
fi
|
||||
git submodule update --remote
|
||||
git -C $MONERO_DIR fetch
|
||||
git -C $MONERO_DIR checkout v0.15.0.1
|
||||
git -C $MONERO_DIR checkout v0.16.0.0
|
||||
|
||||
# get monero core tag
|
||||
pushd $MONERO_DIR
|
||||
@@ -140,13 +140,40 @@ platform=$(get_platform)
|
||||
# default make executable
|
||||
make_exec="make"
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
ARCH="native"
|
||||
if [ "$platform" == "darwin" ]; then
|
||||
if [ "$STATIC" == true ]; then
|
||||
ARCH="x86-64"
|
||||
fi
|
||||
elif [ "$platform" == "linux64" ]; then
|
||||
if [ "$ANDROID" == true ]; then
|
||||
ARCH="armv7-a"
|
||||
elif [ "$STATIC" == true ]; then
|
||||
ARCH="x86-64"
|
||||
fi
|
||||
elif [ "$platform" == "linux32" ]; then
|
||||
if [ "$STATIC" == true ]; then
|
||||
ARCH="i686"
|
||||
fi
|
||||
elif [ "$platform" == "linuxarmv7" ]; then
|
||||
ARCH="armv7-a"
|
||||
elif [ "$platform" == "mingw32" ]; then
|
||||
ARCH="i686"
|
||||
elif [ "$platform" == "mingw64" ]; then
|
||||
ARCH="x86-64"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Building for ARCH=$ARCH"
|
||||
|
||||
## OS X
|
||||
if [ "$platform" == "darwin" ]; then
|
||||
echo "Configuring build for MacOS.."
|
||||
if [ "$STATIC" == true ]; then
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D BUILD_TAG="mac-x64" -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="$ARCH" -D BUILD_64=ON -D BUILD_TAG="mac-x64" -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
else
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D BUILD_TAG="mac-x64" -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D ARCH="$ARCH" -D BUILD_TAG="mac-x64" -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
fi
|
||||
|
||||
## LINUX 64
|
||||
@@ -154,38 +181,38 @@ elif [ "$platform" == "linux64" ]; then
|
||||
echo "Configuring build for Linux x64"
|
||||
if [ "$ANDROID" == true ]; then
|
||||
echo "Configuring build for Android on Linux host"
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="armv7-a" -D ANDROID=true -D BUILD_GUI_DEPS=ON -D USE_LTO=OFF -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="$ARCH" -D ANDROID=true -D BUILD_GUI_DEPS=ON -D USE_LTO=OFF -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
elif [ "$STATIC" == true ]; then
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D BUILD_TAG="linux-x64" -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="$ARCH" -D BUILD_64=ON -D BUILD_TAG="linux-x64" -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
else
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D BUILD_TAG="linux-x64" -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D ARCH="$ARCH" -D BUILD_TAG="linux-x64" -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
fi
|
||||
|
||||
## LINUX 32
|
||||
elif [ "$platform" == "linux32" ]; then
|
||||
echo "Configuring build for Linux i686"
|
||||
if [ "$STATIC" == true ]; then
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="$ARCH" -D BUILD_64=OFF -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
else
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D ARCH="$ARCH" -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
fi
|
||||
|
||||
## LINUX ARMv7
|
||||
elif [ "$platform" == "linuxarmv7" ]; then
|
||||
echo "Configuring build for Linux armv7"
|
||||
if [ "$STATIC" == true ]; then
|
||||
cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D BUILD_TESTS=OFF -D ARCH="$ARCH" -D STATIC=ON -D BUILD_64=OFF -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
else
|
||||
cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D -D BUILD_64=OFF -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D BUILD_TESTS=OFF -D ARCH="$ARCH" -D -D BUILD_64=OFF -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
fi
|
||||
|
||||
## LINUX other
|
||||
elif [ "$platform" == "linux" ]; then
|
||||
echo "Configuring build for Linux general"
|
||||
if [ "$STATIC" == true ]; then
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="$ARCH" -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
else
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D ARCH="$ARCH" -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
fi
|
||||
|
||||
## Windows 64
|
||||
@@ -194,21 +221,21 @@ elif [ "$platform" == "mingw64" ]; then
|
||||
# Do something under Windows NT platform
|
||||
echo "Configuring build for MINGW64.."
|
||||
BOOST_ROOT=/mingw64/boost
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D BOOST_ROOT="$BOOST_ROOT" -D ARCH="x86-64" -D BUILD_TAG="win-x64" -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" -G "MSYS Makefiles" -D CMAKE_TOOLCHAIN_FILE=../../cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D BOOST_ROOT="$BOOST_ROOT" -D ARCH="$ARCH" -D BUILD_TAG="win-x64" -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" -G "MSYS Makefiles" -D CMAKE_TOOLCHAIN_FILE=../../cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(cd $MINGW_PREFIX/.. && pwd -W) ../..
|
||||
|
||||
## Windows 32
|
||||
elif [ "$platform" == "mingw32" ]; then
|
||||
# Do something under Windows NT platform
|
||||
echo "Configuring build for MINGW32.."
|
||||
BOOST_ROOT=/mingw32/boost
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D Boost_DEBUG=ON -D BOOST_ROOT="$BOOST_ROOT" -D ARCH="i686" -D BUILD_64=OFF -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" -G "MSYS Makefiles" -D CMAKE_TOOLCHAIN_FILE=../../cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys32 ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D Boost_DEBUG=ON -D BOOST_ROOT="$BOOST_ROOT" -D ARCH="$ARCH" -D BUILD_64=OFF -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" -G "MSYS Makefiles" -D CMAKE_TOOLCHAIN_FILE=../../cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=$(cd $MINGW_PREFIX/.. && pwd -W) ../..
|
||||
make_exec="mingw32-make"
|
||||
else
|
||||
echo "Unknown platform, configuring general build"
|
||||
if [ "$STATIC" == true ]; then
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="$ARCH" -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
else
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D ARCH="$ARCH" -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
BIN
images/busy-indicator.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
images/busy-indicator@2x.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 214 B |
|
Before Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 323 B |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 493 B |
|
Before Width: | Height: | Size: 12 KiB |
2
images/monero-vector.svg
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg version="1.1" viewBox="0 0 6000 6000" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><metadata><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/></cc:Work></rdf:RDF></metadata><defs><clipPath id="a"><path d="m0 4500h4500v-4500h-4500z"/></clipPath></defs><g transform="matrix(1.3333 0 0 -1.3333 0 6e3)"><g clip-path="url(#a)"><g transform="translate(4128 2250.2)"><path d="m0 0c0-1037.2-840.79-1878.1-1878.1-1878.1-1037.2 0-1878 840.88-1878 1878.1 0 1037.3 840.8 1878.1 1878 1878.1 1037.3 0 1878.1-840.79 1878.1-1878.1" fill="#fff"/></g><g transform="translate(2250 4128.2)"><path d="m0 0c-1036.9 0-1879.1-842.06-1877.8-1878 0.262-207.26 33.308-406.63 95.342-593.12h561.88v1579.9l1220.6-1220.6 1220.6 1220.6v-1579.9h561.96c62.117 186.48 95.008 385.85 95.369 593.12 1.809 1037-840.89 1877.8-1877.9 1877.8z" fill="#f36e36"/></g><g transform="translate(1969.3 1735.8)"><path d="m0 0-532.67 532.7v-994.14h-407.26l-384.29-0.07c329.63-540.8 925.35-902.56 1604.9-902.56 679.54 0 1275.3 361.85 1605 902.65l-384.44-0.013h-407.27v994.14l-813.3-813.31-280.62 280.61z" fill="#575757"/></g></g></g></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 596 B |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 440 B |
|
Before Width: | Height: | Size: 575 B |
@@ -1,8 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="18" viewBox="0 0 10 18">
|
||||
<g fill="none" fill-rule="evenodd" opacity="1">
|
||||
<path fill="none" d="M-13-9h36v36h-36z" opacity="1"/>
|
||||
<g fill="#000" fill-rule="nonzero">
|
||||
<path d="M5 0C3.75 0 2.571.468 1.643 1.296A5.057 5.057 0 0 0 0 5.04c0 .396.321.72.714.72h.715a.72.72 0 0 0 .714-.72c0-.828.357-1.584.964-2.16A2.823 2.823 0 0 1 5 2.16c.107 0 .214 0 .321.036 1.322.144 2.358 1.224 2.5 2.52.143 1.188-.464 2.304-1.5 2.88-1.5.792-2.428 2.304-2.428 3.96v2.124c0 .396.321.72.714.72h.714a.72.72 0 0 0 .715-.72v-2.124c0-.828.5-1.62 1.285-2.052A4.98 4.98 0 0 0 9.93 4.5C9.714 2.16 7.857.288 5.57.036 5.393 0 5.18 0 5 0zM5.714 18H4.286a.358.358 0 0 1-.357-.36V16.2c0-.2.16-.36.357-.36h1.428c.198 0 .357.16.357.36v1.44c0 .2-.16.36-.357.36z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 848 B |
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2014-2019, The Monero Project
|
||||
Copyright (c) 2014-2020, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
; Monero Carbon Chamaeleon GUI Wallet Installer for Windows
|
||||
; Copyright (c) 2017-2019, The Monero Project
|
||||
; Monero Nitrogen Nebula GUI Wallet Installer for Windows
|
||||
; Copyright (c) 2017-2020, The Monero Project
|
||||
; See LICENSE
|
||||
#define GuiVersion GetFileVersion("bin\monero-wallet-gui.exe")
|
||||
|
||||
@@ -11,7 +11,7 @@ AppName=Monero GUI Wallet
|
||||
|
||||
AppVersion={#GuiVersion}
|
||||
VersionInfoVersion={#GuiVersion}
|
||||
DefaultDirName={pf}\Monero GUI Wallet
|
||||
DefaultDirName={commonpf}\Monero GUI Wallet
|
||||
DefaultGroupName=Monero GUI Wallet
|
||||
UninstallDisplayIcon={app}\monero-wallet-gui.exe
|
||||
PrivilegesRequired=admin
|
||||
@@ -62,7 +62,6 @@ Name: "en"; MessagesFile: "compiler:Default.isl"
|
||||
; .exe/.dll file possibly with version info).
|
||||
;
|
||||
; This is far more robust than relying on version info or on file dates (flag "comparetimestamp").
|
||||
; As of version 0.15.0.0, the Monero .exe files do not carry version info anyway in their .exe headers.
|
||||
; The only small drawback seems to be somewhat longer update times because each and every file is
|
||||
; copied again, even if already present with correct file date and identical content.
|
||||
;
|
||||
@@ -71,17 +70,18 @@ Name: "en"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
Source: {#file AddBackslash(SourcePath) + "ReadMe.htm"}; DestDir: "{app}"; DestName: "ReadMe.htm"; Flags: ignoreversion
|
||||
Source: "FinishImage.bmp"; Flags: dontcopy
|
||||
Source: "LICENSE"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
; Monero GUI wallet exe and guide
|
||||
Source: "bin\monero-wallet-gui.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\monero-gui-wallet-guide.pdf"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
; Monero CLI wallet
|
||||
Source: "bin\monero-wallet-cli.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\monero-gen-trusted-multisig.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-wallet-cli.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-gen-trusted-multisig.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
; Monero wallet RPC interface implementation
|
||||
Source: "bin\monero-wallet-rpc.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-wallet-rpc.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
; Monero daemon
|
||||
Source: "bin\monerod.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
@@ -90,16 +90,17 @@ Source: "bin\monerod.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "monero-daemon.bat"; DestDir: "{app}"; Flags: ignoreversion;
|
||||
|
||||
; Monero blockchain utilities
|
||||
Source: "bin\monero-blockchain-export.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\monero-blockchain-import.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\monero-blockchain-mark-spent-outputs.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\monero-blockchain-usage.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\monero-blockchain-import.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\monero-blockchain-ancestry.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\monero-blockchain-depth.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\monero-blockchain-prune-known-spent-data.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\monero-blockchain-prune.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\monero-blockchain-stats.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-blockchain-export.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-blockchain-import.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-blockchain-mark-spent-outputs.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-blockchain-usage.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-blockchain-import.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-blockchain-ancestry.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-blockchain-depth.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-blockchain-prune-known-spent-data.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-blockchain-prune.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-blockchain-stats.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "bin\extras\monero-gen-ssl-cert.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
; Qt Quick 2D Renderer fallback for systems / environments with "low-level graphics" i.e. without 3D support
|
||||
Source: "bin\start-low-graphics-mode.bat"; DestDir: "{app}"; Flags: ignoreversion
|
||||
@@ -166,6 +167,7 @@ Type: files; Name: "{app}\libssp-0.dll"
|
||||
Type: files; Name: "{app}\libhidapi-0.dll"
|
||||
Type: files; Name: "{app}\libeay32.dll"
|
||||
Type: files; Name: "{app}\ssleay32.dll"
|
||||
Type: files; Name: "{group}\Utilities\x (Check Blockchain Folder).lnk"
|
||||
|
||||
|
||||
[Tasks]
|
||||
@@ -201,7 +203,7 @@ begin
|
||||
// Additional wizard page for entering a special blockchain location
|
||||
blockChainDefaultDir := ExpandConstant('{commonappdata}\bitmonero');
|
||||
s := 'The default folder to store the Monero blockchain is ' + blockChainDefaultDir;
|
||||
s := s + '. As this will need more than 74 GB of free space, you may want to use a folder on a different drive.';
|
||||
s := s + '. As this will need more than 90 GB of free space, you may want to use a folder on a different drive.';
|
||||
s := s + ' If yes, specify that folder here.';
|
||||
|
||||
BlockChainDirPage := CreateInputDirPage(wpSelectDir,
|
||||
@@ -333,7 +335,7 @@ Name: "{group}\Utilities\Textual (CLI) Wallet"; Filename: "{app}\monero-wallet-c
|
||||
; Icons for troubleshooting problems / testing / debugging
|
||||
; To show that they are in some way different (not for everyday use), make them visually different
|
||||
; from the others by text, and make them sort at the end by the help of "x" in front
|
||||
Name: "{group}\Utilities\x (Check Blockchain Folder)"; Filename: "{win}\Explorer.exe"; Parameters: {code:BlockChainDir}
|
||||
Name: "{group}\Utilities\x (Check Default Blockchain Folder)"; Filename: "{win}\Explorer.exe"; Parameters: {code:BlockChainDir}
|
||||
Name: "{group}\Utilities\x (Check Daemon Log)"; Filename: "Notepad"; Parameters: {code:DaemonLog}
|
||||
Name: "{group}\Utilities\x (Check Default Wallet Folder)"; Filename: "{win}\Explorer.exe"; Parameters: """{userdocs}\Monero\wallets"""
|
||||
Name: "{group}\Utilities\x (Check GUI Wallet Log)"; Filename: "Notepad"; Parameters: """{userappdata}\monero-wallet-gui\monero-wallet-gui.log"""
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Monero GUI Wallet Windows Installer #
|
||||
|
||||
Copyright (c) 2017-2019, The Monero Project
|
||||
Copyright (c) 2017-2020, The Monero Project
|
||||
|
||||
## Introduction ##
|
||||
|
||||
This is a *Inno Setup* script `Monero.iss` plus some related files
|
||||
that allows you to build a standalone Windows installer (.exe) for
|
||||
the GUI wallet that comes with the Carbon Chamaeleon release of Monero.
|
||||
the GUI wallet that comes with the Nitrogen Nebula release of Monero.
|
||||
|
||||
This turns the GUI wallet into a more or less standard Windows program,
|
||||
by default installed into a subdirectory of `C:\Program Files`, a
|
||||
@@ -18,7 +18,7 @@ Monero.
|
||||
As the setup script in file [Monero.iss](Monero.iss) has to list many
|
||||
files and directories of the GUI wallet package to install by name,
|
||||
this version of the script only works with exactly the GUI wallet
|
||||
for Monero release *Carbon Chamaeleon* that you find on
|
||||
for Monero release *Nitrogen Nebula* that you find on
|
||||
[the official download page](https://getmonero.org/downloads/).
|
||||
|
||||
It should however be easy to modify the script for future
|
||||
@@ -32,15 +32,15 @@ See [LICENSE](LICENSE).
|
||||
|
||||
You can only build on Windows, and the result is always a
|
||||
Windows .exe file that can act as a standalone installer for the
|
||||
Carbon Chamaeleon GUI wallet.
|
||||
Nitrogen Nebula GUI wallet.
|
||||
|
||||
Note that the installer build process is now reproducible / deterministic. For details check the file [Deterministic.md](Deterministic.md).
|
||||
|
||||
The build steps in detail:
|
||||
|
||||
1. Install *Inno Setup*. You can get it from [here](http://www.jrsoftware.org/isdl.php)
|
||||
2. Get the Inno Setup script plus related files by cloning the whole [monero-gui GitHub repository](https://github.com/monero-project/monero-gui); you will only need the files in the installer directory `installers\windows` however. Depending on development state, additionally instead of simply using `master` you may have to checkout a specific branch, like `release-v0.15`.
|
||||
3. The setup script is written to take the GUI wallet files from a subdirectory named `bin`; so create `installers\windows\bin`, get the zip file of the GUI wallet from [here](https://getmonero.org/downloads/), unpack it somewhere, and copy all the files and subdirectories in the single subdirectory there (currently named `monero-gui-0.15.0.0`) to this `bin` subdirectory
|
||||
2. Get the Inno Setup script plus related files by cloning the whole [monero-gui GitHub repository](https://github.com/monero-project/monero-gui); you will only need the files in the installer directory `installers\windows` however. Depending on development state, additionally instead of simply using `master` you may have to checkout a specific branch, like `release-v0.16`.
|
||||
3. The setup script is written to take the GUI wallet files from a subdirectory named `bin`; so create `installers\windows\bin`, get the zip file of the GUI wallet from [here](https://getmonero.org/downloads/), unpack it somewhere, and copy all the files and subdirectories in the single subdirectory there (currently named `monero-gui-0.16.0.0`) to this `bin` subdirectory
|
||||
4. Start Inno Setup, load `Monero.iss` and compile it
|
||||
5. The result i.e. the finished installer will be the file `mysetup.exe` in the `installers\windows\Output` subdirectory
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Monero Carbon Chamaeleon GUI Wallet</title>
|
||||
<title>Monero Nitrogen Nebula GUI Wallet</title>
|
||||
</head>
|
||||
|
||||
<body style="font-family: Arial, Helvetica, sans-serif">
|
||||
<h1>Monero Carbon Chamaeleon GUI Wallet</h1>
|
||||
<h1>Monero Nitrogen Nebula GUI Wallet</h1>
|
||||
|
||||
<p>Copyright (c) 2014-2019, The Monero Project</p>
|
||||
<p>Copyright (c) 2014-2020, The Monero Project</p>
|
||||
|
||||
<h2>Preface</h2>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<h2>Content of the Package</h2>
|
||||
|
||||
<p>You just installed the <i>Monero GUI wallet</i> for Windows, release Carbon Chamaeleon, version {#GuiVersion}.
|
||||
<p>You just installed the <i>Monero GUI wallet</i> for Windows, release Nitrogen Nebula, version {#GuiVersion}.
|
||||
The wallet enables you to send and receive Moneroj in a secure and very private way.
|
||||
</p>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
provides the most security and privacy possible for you.</p>
|
||||
|
||||
<p>However if your Internet access makes it difficult to run a full node, or if you have simply no room to store
|
||||
the blockchain locally (somewhat over 74 GB in November 2019, and of course growing), you can compromise and try to connect
|
||||
the blockchain locally (about 90 GB in May 2020, and of course growing), you can compromise and try to connect
|
||||
to a remote node. One way of finding such a node is checking
|
||||
<a href="https://moneroworld.com/#nodes">this page</a>.
|
||||
</p>
|
||||
@@ -104,7 +104,7 @@
|
||||
|
||||
<p>The Monero software and especially the GUI wallet are "work in progress", and sometimes things go wrong.</p>
|
||||
|
||||
<p>Please note that despite any technical problems that you may encounter your moneroj are almost always safe: You may
|
||||
<p>Please note that despite any technical problems that you may encounter your Moneroj are almost always safe: You may
|
||||
not be able to move them or you even may not see how many you currently have, but you most probably won't loose any.
|
||||
But do remember that the seed needed to re-create the wallet <b>is</b> critical, however: <b>Never loose your
|
||||
seed!</b></p>
|
||||
|
||||
|
Before Width: | Height: | Size: 440 KiB After Width: | Height: | Size: 440 KiB |
@@ -133,3 +133,7 @@ function capitalize(s){
|
||||
if (typeof s !== 'string') return ''
|
||||
return s.charAt(0).toUpperCase() + s.slice(1)
|
||||
}
|
||||
|
||||
function removeTrailingZeros(value) {
|
||||
return (value + '').replace(/(\.\d*[1-9])0+$/, '$1');
|
||||
}
|
||||
|
||||
11
js/Wizard.js
@@ -58,11 +58,6 @@ function switchPage(next) {
|
||||
}
|
||||
|
||||
function createWalletPath(isIOS, folder_path,account_name){
|
||||
// Remove trailing slash - (default on windows and mac)
|
||||
if (folder_path.substring(folder_path.length -1) === "/"){
|
||||
folder_path = folder_path.substring(0,folder_path.length -1)
|
||||
}
|
||||
|
||||
// Store releative path on ios.
|
||||
if(isIOS)
|
||||
folder_path = "";
|
||||
@@ -102,10 +97,6 @@ function tr(text) {
|
||||
return qsTr(text) + translationManager.emptyString
|
||||
}
|
||||
|
||||
function lineBreaksToSpaces(text) {
|
||||
return text.trim().replace(/(\r\n|\n|\r)/gm, " ");
|
||||
}
|
||||
|
||||
function usefulName(path) {
|
||||
// arbitrary "short enough" limit
|
||||
if (path.length < 32)
|
||||
@@ -115,7 +106,7 @@ function usefulName(path) {
|
||||
|
||||
function checkSeed(seed) {
|
||||
console.log("Checking seed")
|
||||
var wordsArray = lineBreaksToSpaces(seed).split(" ");
|
||||
var wordsArray = seed.split(/\s+/);
|
||||
return wordsArray.length === 25 || wordsArray.length === 24
|
||||
}
|
||||
|
||||
|
||||
BIN
lang/flags/nb_NO.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
@@ -55,6 +55,7 @@ Lojban
|
||||
<language display_name="Suomi" locale="fi_FI" wallet_language="English" flag="/lang/flags/fi.png" qs="none"/>
|
||||
<language display_name="Pirate" locale="prt" wallet_language="English" flag="/lang/flags/pirate.png" qs="none"/>
|
||||
<language display_name="Български" locale="bg_BG" wallet_language="English" flag="/lang/flags/bg.png" qs="none"/>
|
||||
<language display_name="Norwegian" locale="nb_NO" wallet_language="English" flag="/lang/flags/nb_NO.png" qs="none"/>
|
||||
<!-- <language display_name="اُردُو" locale="ur_UR" wallet_language="English" flag="/lang/flags/pk.png" qs="none"/> -->
|
||||
<!-- <language display_name="فارسی" locale="fa_FA" wallet_language="English" flag="/lang/flags/ir.png" qs="none"/> -->
|
||||
<!-- <language display_name="Zulu" locale="zu_ZU" wallet_language="English" flag="/lang/flags/za.png" qs="none"/> -->
|
||||
|
||||
379
main.qml
@@ -45,16 +45,20 @@ import "pages/merchant" as MoneroMerchant
|
||||
import "wizard"
|
||||
import "js/Utils.js" as Utils
|
||||
import "js/Windows.js" as Windows
|
||||
import "version.js" as Version
|
||||
|
||||
ApplicationWindow {
|
||||
id: appWindow
|
||||
title: "Monero" + (walletName ? " - " + walletName : "")
|
||||
minimumWidth: 750
|
||||
minimumHeight: 450
|
||||
|
||||
property var currentItem
|
||||
property bool hideBalanceForced: false
|
||||
property bool ctrlPressed: false
|
||||
property alias persistentSettings : persistentSettings
|
||||
property var currentWallet;
|
||||
property bool disconnected: currentWallet ? currentWallet.disconnected : false
|
||||
property var transaction;
|
||||
property var transactionDescription;
|
||||
property var walletPassword
|
||||
@@ -62,13 +66,15 @@ ApplicationWindow {
|
||||
property bool daemonSynced: false
|
||||
property bool walletSynced: false
|
||||
property int maxWindowHeight: (isAndroid || isIOS)? screenHeight : (screenHeight < 900)? 720 : 800;
|
||||
property bool daemonRunning: false
|
||||
property bool daemonRunning: !persistentSettings.useRemoteNode && !disconnected
|
||||
property bool daemonStartStopInProgress: false
|
||||
property alias toolTip: toolTip
|
||||
property string walletName
|
||||
property bool viewOnly: false
|
||||
property bool foundNewBlock: false
|
||||
property bool qrScannerEnabled: (typeof builtWithScanner != "undefined") && builtWithScanner
|
||||
property int blocksToSync: 1
|
||||
property int firstBlockSeen
|
||||
property bool isMining: false
|
||||
property int walletMode: persistentSettings.walletMode
|
||||
property var cameraUi
|
||||
@@ -211,7 +217,7 @@ ApplicationWindow {
|
||||
appWindow.viewState = prevState;
|
||||
}
|
||||
};
|
||||
passwordDialog.open(usefulName(walletPath()));
|
||||
passwordDialog.open(usefulName(persistentSettings.wallet_path));
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
@@ -247,10 +253,9 @@ ApplicationWindow {
|
||||
|
||||
// enable timers
|
||||
userInActivityTimer.running = true;
|
||||
simpleModeConnectionTimer.running = true;
|
||||
|
||||
// wallet already opened with wizard, we just need to initialize it
|
||||
var wallet_path = walletPath();
|
||||
var wallet_path = persistentSettings.wallet_path;
|
||||
if(isIOS)
|
||||
wallet_path = moneroAccountsDir + wallet_path;
|
||||
// console.log("opening wallet at: ", wallet_path, "with password: ", appWindow.walletPassword);
|
||||
@@ -288,6 +293,7 @@ ApplicationWindow {
|
||||
currentWallet.connectionStatusChanged.disconnect(onWalletConnectionStatusChanged)
|
||||
currentWallet.deviceButtonRequest.disconnect(onDeviceButtonRequest);
|
||||
currentWallet.deviceButtonPressed.disconnect(onDeviceButtonPressed);
|
||||
currentWallet.walletPassphraseNeeded.disconnect(onWalletPassphraseNeededWallet);
|
||||
currentWallet.transactionCommitted.disconnect(onTransactionCommitted);
|
||||
middlePanel.paymentClicked.disconnect(handlePayment);
|
||||
middlePanel.sweepUnmixableClicked.disconnect(handleSweepUnmixable);
|
||||
@@ -355,6 +361,7 @@ ApplicationWindow {
|
||||
currentWallet.connectionStatusChanged.connect(onWalletConnectionStatusChanged)
|
||||
currentWallet.deviceButtonRequest.connect(onDeviceButtonRequest);
|
||||
currentWallet.deviceButtonPressed.connect(onDeviceButtonPressed);
|
||||
currentWallet.walletPassphraseNeeded.connect(onWalletPassphraseNeededWallet);
|
||||
currentWallet.transactionCommitted.connect(onTransactionCommitted);
|
||||
middlePanel.paymentClicked.connect(handlePayment);
|
||||
middlePanel.sweepUnmixableClicked.connect(handleSweepUnmixable);
|
||||
@@ -389,11 +396,6 @@ ApplicationWindow {
|
||||
return !persistentSettings.useRemoteNode || persistentSettings.is_trusted_daemon;
|
||||
}
|
||||
|
||||
function walletPath() {
|
||||
var wallet_path = persistentSettings.wallet_path
|
||||
return wallet_path;
|
||||
}
|
||||
|
||||
function usefulName(path) {
|
||||
// arbitrary "short enough" limit
|
||||
if (path.length < 32)
|
||||
@@ -471,20 +473,12 @@ ApplicationWindow {
|
||||
console.log("Wallet connection status changed " + status)
|
||||
middlePanel.updateStatus();
|
||||
leftPanel.networkStatus.connected = status
|
||||
|
||||
// update local daemon status.
|
||||
const isDisconnected = status === Wallet.ConnectionStatus_Disconnected;
|
||||
if (!persistentSettings.useRemoteNode) {
|
||||
daemonRunning = !isDisconnected;
|
||||
} else {
|
||||
daemonRunning = false;
|
||||
if (status == Wallet.ConnectionStatus_Disconnected) {
|
||||
firstBlockSeen = 0;
|
||||
}
|
||||
|
||||
// Update fee multiplier dropdown on transfer page
|
||||
middlePanel.transferView.updatePriorityDropdown();
|
||||
|
||||
// If wallet isnt connected, advanced wallet mode and no daemon is running - Ask
|
||||
if (appWindow.walletMode >= 2 && !persistentSettings.useRemoteNode && !walletInitialized && isDisconnected) {
|
||||
if (appWindow.walletMode >= 2 && !persistentSettings.useRemoteNode && !walletInitialized && disconnected) {
|
||||
daemonManager.runningAsync(persistentSettings.nettype, function(running) {
|
||||
if (!running) {
|
||||
daemonManagerDialog.open();
|
||||
@@ -563,21 +557,32 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
function onWalletPassphraseNeeded(){
|
||||
if(rootItem.state !== "normal") return;
|
||||
function onWalletPassphraseNeededManager(on_device){
|
||||
onWalletPassphraseNeeded(walletManager, on_device)
|
||||
}
|
||||
|
||||
function onWalletPassphraseNeededWallet(on_device){
|
||||
onWalletPassphraseNeeded(currentWallet, on_device)
|
||||
}
|
||||
|
||||
function onWalletPassphraseNeeded(handler, on_device){
|
||||
hideProcessingSplash();
|
||||
|
||||
console.log(">>> wallet passphrase needed: ")
|
||||
passwordDialog.onAcceptedPassphraseCallback = function() {
|
||||
walletManager.onPassphraseEntered(passwordDialog.password);
|
||||
this.onWalletOpening();
|
||||
devicePassphraseDialog.onAcceptedCallback = function(passphrase) {
|
||||
handler.onPassphraseEntered(passphrase, false, false);
|
||||
appWindow.onWalletOpening();
|
||||
}
|
||||
passwordDialog.onRejectedPassphraseCallback = function() {
|
||||
walletManager.onPassphraseEntered("", true);
|
||||
this.onWalletOpening();
|
||||
devicePassphraseDialog.onWalletEntryCallback = function() {
|
||||
handler.onPassphraseEntered("", true, false);
|
||||
appWindow.onWalletOpening();
|
||||
}
|
||||
passwordDialog.openPassphraseDialog()
|
||||
devicePassphraseDialog.onRejectedCallback = function() {
|
||||
handler.onPassphraseEntered("", false, true);
|
||||
appWindow.onWalletOpening();
|
||||
}
|
||||
|
||||
devicePassphraseDialog.open(on_device)
|
||||
}
|
||||
|
||||
function onWalletUpdate() {
|
||||
@@ -620,18 +625,22 @@ ApplicationWindow {
|
||||
currentDaemonAddress = localDaemonAddress
|
||||
currentWallet.initAsync(currentDaemonAddress, isTrustedDaemon());
|
||||
walletManager.setDaemonAddressAsync(currentDaemonAddress);
|
||||
firstBlockSeen = 0;
|
||||
}
|
||||
|
||||
function onHeightRefreshed(bcHeight, dCurrentBlock, dTargetBlock) {
|
||||
// Daemon fully synced
|
||||
// TODO: implement onDaemonSynced or similar in wallet API and don't start refresh thread before daemon is synced
|
||||
// targetBlock = currentBlock = 1 before network connection is established.
|
||||
if (firstBlockSeen == 0 && dTargetBlock != 1) {
|
||||
firstBlockSeen = dCurrentBlock;
|
||||
}
|
||||
daemonSynced = dCurrentBlock >= dTargetBlock && dTargetBlock != 1
|
||||
walletSynced = bcHeight >= dTargetBlock
|
||||
|
||||
// Update progress bars
|
||||
if(!daemonSynced) {
|
||||
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock, dTargetBlock-dCurrentBlock);
|
||||
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock, dTargetBlock-firstBlockSeen);
|
||||
leftPanel.progressBar.updateProgress(0,dTargetBlock, dTargetBlock, qsTr("Waiting for daemon to sync"));
|
||||
} else {
|
||||
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock, 0, qsTr("Daemon is synchronized (%1)").arg(dCurrentBlock.toFixed(0)));
|
||||
@@ -640,7 +649,7 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
// Update wallet sync progress
|
||||
leftPanel.isSyncing = (currentWallet.connected() !== Wallet.ConnectionStatus_Disconnected) && !daemonSynced
|
||||
leftPanel.isSyncing = !disconnected && !daemonSynced;
|
||||
// Update transfer page status
|
||||
middlePanel.updateStatus();
|
||||
|
||||
@@ -666,54 +675,55 @@ ApplicationWindow {
|
||||
console.log(">>> wallet refreshed")
|
||||
|
||||
// Daemon connected
|
||||
leftPanel.networkStatus.connected = currentWallet.connected()
|
||||
leftPanel.networkStatus.connected = currentWallet ? currentWallet.connected() : Wallet.ConnectionStatus_Disconnected
|
||||
|
||||
currentWallet.refreshHeightAsync();
|
||||
}
|
||||
|
||||
function startDaemon(flags){
|
||||
daemonStartStopInProgress = true;
|
||||
|
||||
// Pause refresh while starting daemon
|
||||
currentWallet.pauseRefresh();
|
||||
|
||||
// Pause simplemode connection timer
|
||||
simpleModeConnectionTimer.stop();
|
||||
|
||||
appWindow.showProcessingSplash(qsTr("Waiting for daemon to start..."))
|
||||
const noSync = appWindow.walletMode === 0;
|
||||
daemonManager.start(flags, persistentSettings.nettype, persistentSettings.blockchainDataDir, persistentSettings.bootstrapNodeAddress, noSync);
|
||||
const bootstrapNodeAddress = persistentSettings.walletMode < 2 ? "auto" : persistentSettings.bootstrapNodeAddress
|
||||
daemonManager.start(flags, persistentSettings.nettype, persistentSettings.blockchainDataDir, bootstrapNodeAddress, noSync);
|
||||
}
|
||||
|
||||
function stopDaemon(){
|
||||
function stopDaemon(callback){
|
||||
daemonStartStopInProgress = true;
|
||||
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop..."))
|
||||
daemonManager.stop(persistentSettings.nettype);
|
||||
daemonManager.stopAsync(persistentSettings.nettype, function(result) {
|
||||
daemonStartStopInProgress = false;
|
||||
hideProcessingSplash();
|
||||
callback(result);
|
||||
});
|
||||
}
|
||||
|
||||
function onDaemonStarted(){
|
||||
console.log("daemon started");
|
||||
daemonRunning = true;
|
||||
daemonStartStopInProgress = false;
|
||||
hideProcessingSplash();
|
||||
currentWallet.connected(true);
|
||||
// resume refresh
|
||||
currentWallet.startRefresh();
|
||||
// resume simplemode connection timer
|
||||
appWindow.disconnectedEpoch = Utils.epoch();
|
||||
simpleModeConnectionTimer.start();
|
||||
}
|
||||
function onDaemonStopped(){
|
||||
console.log("daemon stopped");
|
||||
hideProcessingSplash();
|
||||
daemonRunning = false;
|
||||
currentWallet.connected(true);
|
||||
}
|
||||
|
||||
function onDaemonStartFailure(){
|
||||
function onDaemonStartFailure(error) {
|
||||
console.log("daemon start failed");
|
||||
daemonStartStopInProgress = false;
|
||||
hideProcessingSplash();
|
||||
// resume refresh
|
||||
currentWallet.startRefresh();
|
||||
daemonRunning = false;
|
||||
informationPopup.title = qsTr("Daemon failed to start") + translationManager.emptyString;
|
||||
informationPopup.text = qsTr("Please check your wallet and daemon log for errors. You can also try to start %1 manually.").arg((isWindows)? "monerod.exe" : "monerod")
|
||||
informationPopup.text = error + ".\n\n" + qsTr("Please check your wallet and daemon log for errors. You can also try to start %1 manually.").arg((isWindows)? "monerod.exe" : "monerod")
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open();
|
||||
@@ -984,7 +994,11 @@ ApplicationWindow {
|
||||
informationPopup.open()
|
||||
currentWallet.refresh()
|
||||
currentWallet.disposeTransaction(transaction)
|
||||
currentWallet.store();
|
||||
currentWallet.storeAsync(function(success) {
|
||||
if (!success) {
|
||||
appWindow.showStatusMessage(qsTr("Failed to store the wallet"), 3);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// called on "getProof"
|
||||
@@ -1084,7 +1098,6 @@ ApplicationWindow {
|
||||
console.log("Displaying processing splash")
|
||||
if (typeof message != 'undefined') {
|
||||
splash.messageText = message
|
||||
splash.heightProgressText = ""
|
||||
}
|
||||
|
||||
leftPanel.enabled = false;
|
||||
@@ -1111,14 +1124,15 @@ ApplicationWindow {
|
||||
wizard.restart();
|
||||
wizard.wizardState = "wizardHome";
|
||||
rootItem.state = "wizard"
|
||||
// reset balance
|
||||
// reset balance, clear spendable funds message
|
||||
clearMoneroCardLabelText();
|
||||
leftPanel.minutesToUnlock = "";
|
||||
// reset fields
|
||||
middlePanel.addressBookView.clearFields();
|
||||
middlePanel.transferView.clearFields();
|
||||
middlePanel.receiveView.clearFields();
|
||||
// disable timers
|
||||
userInActivityTimer.running = false;
|
||||
simpleModeConnectionTimer.running = false;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1143,9 +1157,9 @@ ApplicationWindow {
|
||||
triggeredOnStart: false
|
||||
}
|
||||
|
||||
function fiatApiParseTicker(resp, currency){
|
||||
function fiatApiParseTicker(url, resp, currency){
|
||||
// parse & validate incoming JSON
|
||||
if(resp._url.startsWith("https://api.kraken.com/0/")){
|
||||
if(url.startsWith("https://api.kraken.com/0/")){
|
||||
if(resp.hasOwnProperty("error") && resp.error.length > 0 || !resp.hasOwnProperty("result")){
|
||||
appWindow.fiatApiError("Kraken API has error(s)");
|
||||
return;
|
||||
@@ -1154,14 +1168,14 @@ ApplicationWindow {
|
||||
var key = currency === "xmreur" ? "XXMRZEUR" : "XXMRZUSD";
|
||||
var ticker = resp.result[key]["o"];
|
||||
return ticker;
|
||||
} else if(resp._url.startsWith("https://api.coingecko.com/api/v3/")){
|
||||
} else if(url.startsWith("https://api.coingecko.com/api/v3/")){
|
||||
var key = currency === "xmreur" ? "eur" : "usd";
|
||||
if(!resp.hasOwnProperty("monero") || !resp["monero"].hasOwnProperty(key)){
|
||||
appWindow.fiatApiError("Coingecko API has error(s)");
|
||||
return;
|
||||
}
|
||||
return resp["monero"][key];
|
||||
} else if(resp._url.startsWith("https://min-api.cryptocompare.com/data/")){
|
||||
} else if(url.startsWith("https://min-api.cryptocompare.com/data/")){
|
||||
var key = currency === "xmreur" ? "EUR" : "USD";
|
||||
if(!resp.hasOwnProperty(key)){
|
||||
appWindow.fiatApiError("cryptocompare API has error(s)");
|
||||
@@ -1171,13 +1185,7 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
function fiatApiGetCurrency(resp){
|
||||
// map response to `appWindow.fiatPriceAPIs` object
|
||||
if (!resp.hasOwnProperty('_url')){
|
||||
appWindow.fiatApiError("invalid JSON");
|
||||
return;
|
||||
}
|
||||
|
||||
function fiatApiGetCurrency(url) {
|
||||
var apis = appWindow.fiatPriceAPIs;
|
||||
for (var api in apis){
|
||||
if (!apis.hasOwnProperty(api))
|
||||
@@ -1187,23 +1195,34 @@ ApplicationWindow {
|
||||
if(!apis[api].hasOwnProperty(cur))
|
||||
continue;
|
||||
|
||||
var url = apis[api][cur];
|
||||
if(url === resp._url){
|
||||
if (apis[api][cur] === url) {
|
||||
return cur;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fiatApiJsonReceived(resp){
|
||||
function fiatApiJsonReceived(url, resp, error) {
|
||||
if (error) {
|
||||
appWindow.fiatApiError(error);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
resp = JSON.parse(resp);
|
||||
} catch (e) {
|
||||
appWindow.fiatApiError("bad JSON: " + e);
|
||||
return;
|
||||
}
|
||||
|
||||
// handle incoming JSON, set ticker
|
||||
var currency = appWindow.fiatApiGetCurrency(resp);
|
||||
var currency = appWindow.fiatApiGetCurrency(url);
|
||||
if(typeof currency == "undefined"){
|
||||
appWindow.fiatApiError("could not get currency");
|
||||
return;
|
||||
}
|
||||
|
||||
var ticker = appWindow.fiatApiParseTicker(resp, currency);
|
||||
var ticker = appWindow.fiatApiParseTicker(url, resp, currency);
|
||||
if(ticker <= 0){
|
||||
appWindow.fiatApiError("could not get ticker");
|
||||
return;
|
||||
@@ -1235,7 +1254,7 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
var url = provider[userCurrency];
|
||||
Prices.getJSON(url);
|
||||
Network.getJSON(url, fiatApiJsonReceived);
|
||||
}
|
||||
|
||||
function fiatApiCurrencySymbol() {
|
||||
@@ -1291,9 +1310,8 @@ ApplicationWindow {
|
||||
walletManager.deviceButtonRequest.connect(onDeviceButtonRequest);
|
||||
walletManager.deviceButtonPressed.connect(onDeviceButtonPressed);
|
||||
walletManager.checkUpdatesComplete.connect(onWalletCheckUpdatesComplete);
|
||||
walletManager.walletPassphraseNeeded.connect(onWalletPassphraseNeeded);
|
||||
walletManager.walletPassphraseNeeded.connect(onWalletPassphraseNeededManager);
|
||||
IPC.uriHandler.connect(onUriHandler);
|
||||
Prices.priceJsonReceived.connect(appWindow.fiatApiJsonReceived);
|
||||
|
||||
if(typeof daemonManager != "undefined") {
|
||||
daemonManager.daemonStarted.connect(onDaemonStarted);
|
||||
@@ -1325,8 +1343,6 @@ ApplicationWindow {
|
||||
openWallet("wizard");
|
||||
}
|
||||
|
||||
checkUpdates();
|
||||
|
||||
if(persistentSettings.fiatPriceEnabled){
|
||||
appWindow.fiatApiRefresh();
|
||||
appWindow.fiatTimerStart();
|
||||
@@ -1371,10 +1387,14 @@ ApplicationWindow {
|
||||
property int segregationHeight: 0
|
||||
property int kdfRounds: 1
|
||||
property bool hideBalance: false
|
||||
property bool askPasswordBeforeSending: true
|
||||
property bool lockOnUserInActivity: true
|
||||
property int walletMode: 2
|
||||
property int lockOnUserInActivityInterval: 10 // minutes
|
||||
property bool blackTheme: true
|
||||
property bool checkForUpdates: true
|
||||
property bool autosave: true
|
||||
property int autosaveMinutes: 10
|
||||
|
||||
property bool fiatPriceEnabled: false
|
||||
property bool fiatPriceToggle: false
|
||||
@@ -1406,21 +1426,28 @@ ApplicationWindow {
|
||||
z: parent.z + 1
|
||||
id: transactionConfirmationPopup
|
||||
onAccepted: {
|
||||
var handleAccepted = function() {
|
||||
// Save transaction to file if view only wallet
|
||||
if (viewOnly) {
|
||||
saveTxDialog.open();
|
||||
} else {
|
||||
handleTransactionConfirmed()
|
||||
}
|
||||
}
|
||||
close();
|
||||
passwordDialog.onAcceptedCallback = function() {
|
||||
if(walletPassword === passwordDialog.password){
|
||||
// Save transaction to file if view only wallet
|
||||
if(viewOnly) {
|
||||
saveTxDialog.open();
|
||||
} else {
|
||||
handleTransactionConfirmed()
|
||||
}
|
||||
handleAccepted()
|
||||
} else {
|
||||
passwordDialog.showError(qsTr("Wrong password") + translationManager.emptyString);
|
||||
}
|
||||
}
|
||||
passwordDialog.onRejectedCallback = null;
|
||||
passwordDialog.open()
|
||||
if(!persistentSettings.askPasswordBeforeSending) {
|
||||
handleAccepted()
|
||||
} else {
|
||||
passwordDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1440,6 +1467,14 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.UpdateDialog {
|
||||
id: updateDialog
|
||||
|
||||
allowed: !passwordDialog.visible && !inputDialog.visible && !splash.visible
|
||||
x: (parent.width - width) / 2
|
||||
y: (parent.height - height) / 2
|
||||
}
|
||||
|
||||
// Choose blockchain folder
|
||||
FileDialog {
|
||||
id: blockchainFileDialog
|
||||
@@ -1469,7 +1504,6 @@ ApplicationWindow {
|
||||
confirmationDialog.text += qsTr("Note: lmdb folder not found. A new folder will be created.") + "\n\n"
|
||||
|
||||
confirmationDialog.icon = StandardIcon.Question
|
||||
confirmationDialog.cancelText = qsTr("Cancel")
|
||||
|
||||
// Continue
|
||||
confirmationDialog.onAcceptedCallback = function() {
|
||||
@@ -1493,8 +1527,6 @@ ApplicationWindow {
|
||||
anchors.fill: parent
|
||||
property var onAcceptedCallback
|
||||
property var onRejectedCallback
|
||||
property var onAcceptedPassphraseCallback
|
||||
property var onRejectedPassphraseCallback
|
||||
onAccepted: {
|
||||
if (onAcceptedCallback)
|
||||
onAcceptedCallback();
|
||||
@@ -1518,14 +1550,13 @@ ApplicationWindow {
|
||||
informationPopup.open();
|
||||
}
|
||||
onRejectedNewPassword: {}
|
||||
onAcceptedPassphrase: {
|
||||
if (onAcceptedPassphraseCallback)
|
||||
onAcceptedPassphraseCallback();
|
||||
}
|
||||
onRejectedPassphrase: {
|
||||
if (onRejectedPassphraseCallback)
|
||||
onRejectedPassphraseCallback();
|
||||
}
|
||||
}
|
||||
|
||||
DevicePassphraseDialog {
|
||||
id: devicePassphraseDialog
|
||||
visible: false
|
||||
z: parent.z + 1
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
InputDialog {
|
||||
@@ -1556,8 +1587,8 @@ ApplicationWindow {
|
||||
|
||||
ProcessingSplash {
|
||||
id: splash
|
||||
width: appWindow.width / 1.5
|
||||
height: appWindow.height / 2
|
||||
width: appWindow.width / 2
|
||||
height: appWindow.height / 2.66
|
||||
x: (appWindow.width - width) / 2
|
||||
y: (appWindow.height - height) / 2
|
||||
messageText: qsTr("Please wait...") + translationManager.emptyString
|
||||
@@ -1615,12 +1646,6 @@ ApplicationWindow {
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onMerchantClicked: {
|
||||
middlePanel.state = "Merchant";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onTxkeyClicked: {
|
||||
middlePanel.state = "TxKey";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
@@ -1679,6 +1704,15 @@ ApplicationWindow {
|
||||
anchors.right: parent.right
|
||||
state: "Transfer"
|
||||
}
|
||||
|
||||
WizardController {
|
||||
id: wizard
|
||||
anchors.fill: parent
|
||||
onUseMoneroClicked: {
|
||||
rootItem.state = "normal";
|
||||
appWindow.openWallet("wizard");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FastBlur {
|
||||
@@ -1686,23 +1720,9 @@ ApplicationWindow {
|
||||
anchors.fill: blurredArea
|
||||
source: blurredArea
|
||||
radius: 64
|
||||
visible: passwordDialog.visible || inputDialog.visible || splash.visible
|
||||
visible: passwordDialog.visible || inputDialog.visible || splash.visible || updateDialog.visible || devicePassphraseDialog.visible
|
||||
}
|
||||
|
||||
WizardController {
|
||||
id: wizard
|
||||
anchors.fill: parent
|
||||
onUseMoneroClicked: {
|
||||
rootItem.state = "normal";
|
||||
appWindow.openWallet("wizard");
|
||||
}
|
||||
}
|
||||
|
||||
WizardLang {
|
||||
id: languageView
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
property int minWidth: 326
|
||||
property int minHeight: 400
|
||||
@@ -1801,16 +1821,10 @@ ApplicationWindow {
|
||||
color: "#FFFFFF"
|
||||
}
|
||||
}
|
||||
|
||||
Notifier {
|
||||
visible:false
|
||||
id: notifier
|
||||
}
|
||||
}
|
||||
|
||||
function toggleLanguageView(){
|
||||
middlePanel.visible = !middlePanel.visible;
|
||||
languageView.visible = !languageView.visible
|
||||
languageSidebar.isOpened ? languageSidebar.close() : languageSidebar.open();
|
||||
resetLanguageFields()
|
||||
// update after changing language from settings page
|
||||
if (persistentSettings.language != wizard.language_language) {
|
||||
@@ -1819,6 +1833,24 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: autosaveTimer
|
||||
interval: persistentSettings.autosaveMinutes * 60 * 1000
|
||||
repeat: true
|
||||
running: persistentSettings.autosave
|
||||
onTriggered: {
|
||||
if (currentWallet) {
|
||||
currentWallet.storeAsync(function(success) {
|
||||
if (success) {
|
||||
appWindow.showStatusMessage(qsTr("Autosaved the wallet"), 3);
|
||||
} else {
|
||||
appWindow.showStatusMessage(qsTr("Failed to autosave the wallet"), 3);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Make the callback dynamic
|
||||
Timer {
|
||||
id: statusMessageTimer
|
||||
@@ -1858,17 +1890,13 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
function checkSimpleModeConnection(){
|
||||
// auto-connection mechanism for simple mode
|
||||
if(appWindow.walletMode >= 2) return;
|
||||
|
||||
const disconnectedTimeoutSec = 30;
|
||||
const firstCheckDelaySec = 2;
|
||||
|
||||
const connected = leftPanel.networkStatus.connected !== Wallet.ConnectionStatus_Disconnected;
|
||||
const firstRun = appWindow.disconnectedEpoch == 0;
|
||||
if (firstRun) {
|
||||
appWindow.disconnectedEpoch = Utils.epoch() + firstCheckDelaySec - disconnectedTimeoutSec;
|
||||
} else if (connected) {
|
||||
} else if (!disconnected) {
|
||||
appWindow.disconnectedEpoch = Utils.epoch();
|
||||
}
|
||||
|
||||
@@ -1878,15 +1906,20 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
if (appWindow.daemonRunning) {
|
||||
appWindow.stopDaemon();
|
||||
appWindow.stopDaemon(function() {
|
||||
appWindow.startDaemon("")
|
||||
});
|
||||
} else {
|
||||
appWindow.startDaemon("");
|
||||
}
|
||||
appWindow.startDaemon("");
|
||||
}
|
||||
|
||||
Timer {
|
||||
// Simple mode connection check timer
|
||||
id: simpleModeConnectionTimer
|
||||
interval: 2000; running: false; repeat: true
|
||||
interval: 2000
|
||||
running: appWindow.walletMode < 2 && currentWallet != undefined && !daemonStartStopInProgress
|
||||
repeat: true
|
||||
onTriggered: appWindow.checkSimpleModeConnection()
|
||||
}
|
||||
|
||||
@@ -1935,8 +1968,7 @@ ApplicationWindow {
|
||||
onClose();
|
||||
}
|
||||
confirmationDialog.onRejectedCallback = function() {
|
||||
daemonManager.stop(persistentSettings.nettype);
|
||||
onClose();
|
||||
stopDaemon(onClose);
|
||||
};
|
||||
confirmationDialog.open();
|
||||
}
|
||||
@@ -1961,15 +1993,26 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
// If daemon is running - prompt user before exiting
|
||||
if(typeof daemonManager != "undefined" && daemonRunning) {
|
||||
if (appWindow.walletMode == 0) {
|
||||
stopDaemon();
|
||||
closeAccepted();
|
||||
} else {
|
||||
showDaemonIsRunningDialog(closeAccepted);
|
||||
}
|
||||
} else {
|
||||
if(daemonManager == undefined || persistentSettings.useRemoteNode) {
|
||||
closeAccepted();
|
||||
} else if (appWindow.walletMode == 0) {
|
||||
stopDaemon(closeAccepted);
|
||||
} else {
|
||||
showProcessingSplash(qsTr("Checking local node status..."));
|
||||
const handler = function(running) {
|
||||
hideProcessingSplash();
|
||||
if (running) {
|
||||
showDaemonIsRunningDialog(closeAccepted);
|
||||
} else {
|
||||
closeAccepted();
|
||||
}
|
||||
};
|
||||
|
||||
if (currentWallet) {
|
||||
handler(!currentWallet.disconnected);
|
||||
} else {
|
||||
daemonManager.runningAsync(persistentSettings.nettype, handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1981,34 +2024,42 @@ ApplicationWindow {
|
||||
closeWallet(Qt.quit);
|
||||
}
|
||||
|
||||
function onWalletCheckUpdatesComplete(update) {
|
||||
if (update === "")
|
||||
return
|
||||
print("Update found: " + update)
|
||||
var parts = update.split("|")
|
||||
if (parts.length == 4) {
|
||||
var version = parts[0]
|
||||
var hash = parts[1]
|
||||
var user_url = parts[2]
|
||||
var msg = ""
|
||||
if (isMac || isWindows || isLinux) {
|
||||
msg = qsTr("New version of Monero v%1 is available.<br><br>Download:<br>%2<br><br>SHA256 Hash:<br>%3").arg(version).arg(user_url).arg(hash) + translationManager.emptyString
|
||||
} else {
|
||||
msg = qsTr("New version of Monero v%1 is available. Check out getmonero.org").arg(version) + translationManager.emptyString
|
||||
}
|
||||
notifier.show(msg)
|
||||
} else {
|
||||
print("Failed to parse update spec")
|
||||
function onWalletCheckUpdatesComplete(version, downloadUrl, hash, firstSigner, secondSigner) {
|
||||
const alreadyAsked = updateDialog.url == downloadUrl && updateDialog.hash == hash;
|
||||
if (!alreadyAsked)
|
||||
{
|
||||
updateDialog.show(version, isMac || isWindows || isLinux ? downloadUrl : "", hash);
|
||||
}
|
||||
}
|
||||
|
||||
function getBuildTag() {
|
||||
if (isMac) {
|
||||
return "mac-x64";
|
||||
}
|
||||
if (isWindows) {
|
||||
return oshelper.installed ? "install-win-x64" : "win-x64";
|
||||
}
|
||||
if (isLinux) {
|
||||
return "linux-x64";
|
||||
}
|
||||
return "source";
|
||||
}
|
||||
|
||||
function checkUpdates() {
|
||||
walletManager.checkUpdatesAsync("monero-gui", "gui")
|
||||
const version = Version.GUI_VERSION.match(/\d+\.\d+\.\d+\.\d+/);
|
||||
if (version) {
|
||||
walletManager.checkUpdatesAsync("monero-gui", "gui", getBuildTag(), version[0]);
|
||||
} else {
|
||||
console.error("failed to parse version number", Version.GUI_VERSION);
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: updatesTimer
|
||||
interval: 3600*1000; running: true; repeat: true
|
||||
interval: 3600 * 1000
|
||||
repeat: true
|
||||
running: !disableCheckUpdatesFlag && persistentSettings.checkForUpdates
|
||||
triggeredOnStart: true
|
||||
onTriggered: checkUpdates()
|
||||
}
|
||||
|
||||
@@ -2087,7 +2138,6 @@ ApplicationWindow {
|
||||
function applyWalletMode(mode){
|
||||
if (mode < 2) {
|
||||
persistentSettings.useRemoteNode = false;
|
||||
persistentSettings.bootstrapNodeAddress = "auto";
|
||||
|
||||
if (middlePanel.settingsView.settingsStateViewState === "Node" || middlePanel.settingsView.settingsStateViewState === "Log") {
|
||||
middlePanel.settingsView.settingsStateViewState = "Wallet"
|
||||
@@ -2109,6 +2159,11 @@ ApplicationWindow {
|
||||
blackColor: "black"
|
||||
whiteColor: "white"
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
}
|
||||
}
|
||||
|
||||
// borders on white theme + linux
|
||||
@@ -2176,8 +2231,8 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
// @TODO: QML type 'Drawer' has issues with buildbot; debug after Qt 5.9 migration
|
||||
// MoneroComponents.LanguageSidebar {
|
||||
// id: languageSidebar
|
||||
// }
|
||||
MoneroComponents.LanguageSidebar {
|
||||
id: languageSidebar
|
||||
dragMargin: 0
|
||||
}
|
||||
}
|
||||
|
||||
2
monero
@@ -43,7 +43,9 @@ INCLUDEPATH += $$WALLET_ROOT/include \
|
||||
$$PWD/src/libwalletqt \
|
||||
$$PWD/src/QR-Code-generator \
|
||||
$$PWD/src \
|
||||
$$WALLET_ROOT/src
|
||||
$$WALLET_ROOT/src \
|
||||
$$WALLET_ROOT/external/easylogging++ \
|
||||
$$WALLET_ROOT/contrib/epee/include
|
||||
|
||||
HEADERS += \
|
||||
src/main/filter.h \
|
||||
@@ -51,6 +53,7 @@ HEADERS += \
|
||||
src/main/oscursor.h \
|
||||
src/libwalletqt/WalletManager.h \
|
||||
src/libwalletqt/Wallet.h \
|
||||
src/libwalletqt/PassphraseHelper.h \
|
||||
src/libwalletqt/PendingTransaction.h \
|
||||
src/libwalletqt/TransactionHistory.h \
|
||||
src/libwalletqt/TransactionInfo.h \
|
||||
@@ -74,11 +77,12 @@ HEADERS += \
|
||||
src/libwalletqt/UnsignedTransaction.h \
|
||||
src/main/Logger.h \
|
||||
src/main/MainApp.h \
|
||||
src/qt/downloader.h \
|
||||
src/qt/FutureScheduler.h \
|
||||
src/qt/ipc.h \
|
||||
src/qt/KeysFiles.h \
|
||||
src/qt/network.h \
|
||||
src/qt/utils.h \
|
||||
src/qt/prices.h \
|
||||
src/qt/macoshelper.h \
|
||||
src/qt/MoneroSettings.h \
|
||||
src/qt/TailsOS.h
|
||||
@@ -88,12 +92,15 @@ SOURCES += src/main/main.cpp \
|
||||
src/main/clipboardAdapter.cpp \
|
||||
src/main/oscursor.cpp \
|
||||
src/libwalletqt/WalletManager.cpp \
|
||||
src/libwalletqt/WalletListenerImpl.cpp \
|
||||
src/libwalletqt/Wallet.cpp \
|
||||
src/libwalletqt/PassphraseHelper.cpp \
|
||||
src/libwalletqt/PendingTransaction.cpp \
|
||||
src/libwalletqt/TransactionHistory.cpp \
|
||||
src/libwalletqt/TransactionInfo.cpp \
|
||||
src/libwalletqt/QRCodeImageProvider.cpp \
|
||||
src/main/oshelper.cpp \
|
||||
src/openpgp/openpgp.cpp \
|
||||
src/TranslationManager.cpp \
|
||||
src/model/TransactionHistoryModel.cpp \
|
||||
src/model/TransactionHistorySortFilterModel.cpp \
|
||||
@@ -110,11 +117,13 @@ SOURCES += src/main/main.cpp \
|
||||
src/libwalletqt/UnsignedTransaction.cpp \
|
||||
src/main/Logger.cpp \
|
||||
src/main/MainApp.cpp \
|
||||
src/qt/downloader.cpp \
|
||||
src/qt/FutureScheduler.cpp \
|
||||
src/qt/ipc.cpp \
|
||||
src/qt/KeysFiles.cpp \
|
||||
src/qt/network.cpp \
|
||||
src/qt/updater.cpp \
|
||||
src/qt/utils.cpp \
|
||||
src/qt/prices.cpp \
|
||||
src/qt/MoneroSettings.cpp \
|
||||
src/qt/TailsOS.cpp
|
||||
|
||||
@@ -155,6 +164,8 @@ ios:arm64 {
|
||||
}
|
||||
|
||||
LIBS_COMMON = \
|
||||
-lgcrypt \
|
||||
-lgpg-error \
|
||||
-lwallet_merged \
|
||||
-llmdb \
|
||||
-lepee \
|
||||
@@ -176,8 +187,10 @@ android {
|
||||
|
||||
|
||||
|
||||
QMAKE_CXXFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Wformat -Wformat-security
|
||||
QMAKE_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Wformat -Wformat-security
|
||||
QMAKE_CXXFLAGS += -Werror -Wformat -Wformat-security
|
||||
QMAKE_CFLAGS += -Werror -Wformat -Wformat-security
|
||||
QMAKE_CXXFLAGS_RELEASE += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2
|
||||
QMAKE_CFLAGS_RELEASE += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2
|
||||
|
||||
ios {
|
||||
message("Host is IOS")
|
||||
@@ -221,6 +234,14 @@ CONFIG(WITH_SCANNER) {
|
||||
LIBS += -lzbarjni -liconv
|
||||
} else {
|
||||
LIBS += -lzbar
|
||||
macx {
|
||||
ZBAR_DIR = $$system(brew --prefix zbar, lines, EXIT_CODE)
|
||||
equals(EXIT_CODE, 0) {
|
||||
INCLUDEPATH += $$ZBAR_DIR/include
|
||||
} else {
|
||||
INCLUDEPATH += /usr/local/include
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
message("Skipping camera scanner because of Incompatible Qt Version !")
|
||||
@@ -299,7 +320,8 @@ win32 {
|
||||
-lssl \
|
||||
-lsodium \
|
||||
-lcrypto \
|
||||
-lws2_32
|
||||
-lws2_32 \
|
||||
-lole32
|
||||
|
||||
!contains(QMAKE_TARGET.arch, x86_64) {
|
||||
message("Target is 32bit")
|
||||
@@ -371,18 +393,42 @@ macx {
|
||||
# LIBS+= -Wl,-Bstatic
|
||||
# }
|
||||
|
||||
OPENSSL_LIBRARY_DIRS = $$system(brew --prefix openssl, lines, EXIT_CODE)
|
||||
OPENSSL_DIR = $$system(brew --prefix openssl, lines, EXIT_CODE)
|
||||
!equals(EXIT_CODE, 0) {
|
||||
OPENSSL_DIR = /usr/local/ssl
|
||||
}
|
||||
OPENSSL_LIBRARY_DIR = $$OPENSSL_DIR/lib
|
||||
INCLUDEPATH += $$OPENSSL_DIR/include
|
||||
|
||||
BOOST_DIR = $$system(brew --prefix boost, lines, EXIT_CODE)
|
||||
equals(EXIT_CODE, 0) {
|
||||
OPENSSL_LIBRARY_DIRS = $$OPENSSL_LIBRARY_DIRS/lib
|
||||
INCLUDEPATH += $$BOOST_DIR/include
|
||||
} else {
|
||||
OPENSSL_LIBRARY_DIRS = /usr/local/ssl/lib
|
||||
INCLUDEPATH += /usr/local/include
|
||||
}
|
||||
|
||||
GCRYPT_DIR = $$system(brew --prefix libgcrypt, lines, EXIT_CODE)
|
||||
equals(EXIT_CODE, 0) {
|
||||
INCLUDEPATH += $$GCRYPT_DIR/include
|
||||
} else {
|
||||
INCLUDEPATH += /usr/local/include
|
||||
}
|
||||
|
||||
GPGP_ERROR_DIR = $$system(brew --prefix libgpg-error, lines, EXIT_CODE)
|
||||
equals(EXIT_CODE, 0) {
|
||||
INCLUDEPATH += $$GPGP_ERROR_DIR/include
|
||||
} else {
|
||||
INCLUDEPATH += /usr/local/include
|
||||
}
|
||||
|
||||
QT += macextras
|
||||
OBJECTIVE_SOURCES += src/qt/macoshelper.mm
|
||||
LIBS+= -Wl,-dead_strip
|
||||
LIBS+= -Wl,-dead_strip_dylibs
|
||||
LIBS+= -Wl,-bind_at_load
|
||||
LIBS+= \
|
||||
-L/usr/local/lib \
|
||||
-L$$OPENSSL_LIBRARY_DIRS \
|
||||
-L$$OPENSSL_LIBRARY_DIR \
|
||||
-L/usr/local/opt/boost/lib \
|
||||
-lboost_serialization \
|
||||
-lboost_thread-mt \
|
||||
@@ -514,6 +560,7 @@ DISTFILES += \
|
||||
|
||||
VERSION = $$cat('version.js', lines)
|
||||
VERSION = $$find(VERSION, 'GUI_VERSION')
|
||||
VERSION_LONG = $$replace(VERSION, '.*\"v(.*)\"', '\1')
|
||||
VERSION = $$replace(VERSION, '.*(\d+\.\d+\.\d+\.\d+).*', '\1')
|
||||
|
||||
# windows application icon
|
||||
@@ -521,4 +568,7 @@ RC_ICONS = images/appicon.ico
|
||||
|
||||
# mac Info.plist & application icon
|
||||
QMAKE_INFO_PLIST = $$PWD/share/Info.plist
|
||||
macx {
|
||||
QMAKE_POST_LINK += sed -i "''" -e "s/@VERSION@/$$VERSION/g" -e "s/@VERSION_LONG@/$$VERSION_LONG/g" "$$sprintf("%1/%2/%3.app", $$OUT_PWD, $$DESTDIR, $$TARGET)/Contents/Info.plist";
|
||||
}
|
||||
ICON = $$PWD/images/appicon.icns
|
||||
|
||||
@@ -55,6 +55,7 @@ Rectangle {
|
||||
inputDialog.labelText = qsTr("Set the label of the selected account:") + translationManager.emptyString;
|
||||
inputDialog.onAcceptedCallback = function() {
|
||||
appWindow.currentWallet.setSubaddressLabel(_index, 0, inputDialog.inputText)
|
||||
appWindow.currentWallet.subaddressAccount.refresh()
|
||||
}
|
||||
inputDialog.onRejectedCallback = null;
|
||||
inputDialog.open(appWindow.currentWallet.getSubaddressLabel(_index, 0))
|
||||
|
||||
@@ -79,13 +79,6 @@ Rectangle {
|
||||
topPadding: 0
|
||||
text: qsTr("Save your most used addresses here") + translationManager.emptyString
|
||||
width: parent.width
|
||||
|
||||
// @TODO: Legacy. Remove after Qt 5.8.
|
||||
// https://stackoverflow.com/questions/41990013
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
@@ -99,13 +92,6 @@ Rectangle {
|
||||
topPadding: 0
|
||||
text: qsTr("This makes it easier to send or receive Monero and reduces errors when typing in addresses manually.") + translationManager.emptyString
|
||||
width: parent.width
|
||||
|
||||
// @TODO: Legacy. Remove after Qt 5.8.
|
||||
// https://stackoverflow.com/questions/41990013
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
@@ -306,8 +292,8 @@ Rectangle {
|
||||
MoneroComponents.LineEditMulti {
|
||||
id: addressLine
|
||||
Layout.topMargin: 20
|
||||
labelText: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
|
||||
Address") + translationManager.emptyString
|
||||
labelText: "<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style> %1"
|
||||
.arg(qsTr("Address")) + translationManager.emptyString
|
||||
placeholderText: {
|
||||
if(persistentSettings.nettype == NetworkType.MAINNET){
|
||||
return "4.. / 8.. / OpenAlias";
|
||||
@@ -325,8 +311,6 @@ Rectangle {
|
||||
if (!parsed.error) {
|
||||
addressLine.text = parsed.address;
|
||||
descriptionLine.text = parsed.tx_description;
|
||||
} else {
|
||||
addressLine.text = clipboardText;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,8 +368,8 @@ Rectangle {
|
||||
MoneroComponents.LineEditMulti {
|
||||
id: descriptionLine
|
||||
Layout.topMargin: 20
|
||||
labelText: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
|
||||
Description") + translationManager.emptyString
|
||||
labelText: "<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style> %1"
|
||||
.arg(qsTr("Description")) + translationManager.emptyString
|
||||
placeholderText: qsTr("Add a name...") + translationManager.emptyString
|
||||
}
|
||||
RowLayout {
|
||||
|
||||
@@ -156,7 +156,7 @@ Rectangle {
|
||||
input.bottomPadding: 6
|
||||
fontSize: 16
|
||||
labelFontSize: 14
|
||||
placeholderText: qsTr("Search...") + translationManager.emptyString
|
||||
placeholderText: qsTr("Search by Transaction ID, Address, Description, Amount or Blockheight") + translationManager.emptyString
|
||||
placeholderFontSize: 16
|
||||
inputHeight: 34
|
||||
onTextUpdated: {
|
||||
@@ -633,7 +633,17 @@ Rectangle {
|
||||
MoneroComponents.TextPlain {
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 15
|
||||
text: isout ? qsTr("Sent") : qsTr("Received") + translationManager.emptyString
|
||||
text: {
|
||||
if (!isout) {
|
||||
return qsTr("Received") + translationManager.emptyString;
|
||||
}
|
||||
const addressBookName = currentWallet ? currentWallet.addressBook.getDescription(address) : null;
|
||||
if (!addressBookName)
|
||||
{
|
||||
return qsTr("Sent") + translationManager.emptyString;
|
||||
}
|
||||
return addressBookName;
|
||||
}
|
||||
color: MoneroComponents.Style.historyHeaderTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
themeTransitionBlackColor: MoneroComponents.Style._b_historyHeaderTextColor
|
||||
@@ -1382,7 +1392,7 @@ Rectangle {
|
||||
if(root.sortSearchString.length >= 1){
|
||||
if(item.amount && item.amount.toString().startsWith(root.sortSearchString)){
|
||||
txs.push(item);
|
||||
} else if(item.address !== "" && item.address.startsWith(root.sortSearchString)){
|
||||
} else if(item.address !== "" && item.address.toLowerCase().startsWith(root.sortSearchString.toLowerCase())){
|
||||
txs.push(item);
|
||||
} else if(item.blockheight.toString().startsWith(root.sortSearchString)) {
|
||||
txs.push(item);
|
||||
|
||||
@@ -131,7 +131,7 @@ Rectangle {
|
||||
Layout.fillWidth: true
|
||||
fontSize: 22
|
||||
Layout.topMargin: 10
|
||||
text: qsTr("Keys") + translationManager.emptyString
|
||||
text: qsTr("Primary address & Keys") + translationManager.emptyString
|
||||
}
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
@@ -140,8 +140,18 @@ Rectangle {
|
||||
opacity: MoneroComponents.Style.dividerOpacity
|
||||
Layout.bottomMargin: 10
|
||||
}
|
||||
MoneroComponents.LineEditMulti {
|
||||
Layout.fillWidth: true
|
||||
id: primaryAddress
|
||||
readOnly: true
|
||||
copyButton: true
|
||||
wrapMode: Text.Wrap
|
||||
labelText: qsTr("Primary address") + translationManager.emptyString
|
||||
fontSize: 16
|
||||
}
|
||||
MoneroComponents.LineEdit {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 25
|
||||
id: secretViewKey
|
||||
readOnly: true
|
||||
copyButton: true
|
||||
@@ -261,6 +271,7 @@ Rectangle {
|
||||
function onPageCompleted() {
|
||||
console.log("keys page loaded");
|
||||
|
||||
primaryAddress.text = currentWallet.address(0, 0)
|
||||
walletCreationHeight.text = currentWallet.walletCreationHeight
|
||||
secretViewKey.text = currentWallet.secretViewKey
|
||||
publicViewKey.text = currentWallet.publicViewKey
|
||||
@@ -281,7 +292,7 @@ Rectangle {
|
||||
secretSpendKey.text = qsTr("(View Only Wallet - No secret spend key available)") + translationManager.emptyString
|
||||
}
|
||||
// hardware device wallet
|
||||
if(currentWallet.seed === "") {
|
||||
if(appWindow.currentWallet.isHwBacked() === true) {
|
||||
showFullQr.visible = false
|
||||
viewOnlyQRCode.visible = true
|
||||
showViewOnlyQr.visible = false
|
||||
|
||||
@@ -290,34 +290,39 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: parent.spacing
|
||||
MoneroComponents.StandardButton {
|
||||
Layout.preferredWidth: 220
|
||||
small: true
|
||||
text: FontAwesome.save + " %1".arg(qsTr("Save as image")) + translationManager.emptyString
|
||||
label.font.family: FontAwesome.fontFamily
|
||||
fontSize: 13
|
||||
onClicked: qrFileDialog.open()
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
rightIcon: "qrc:///images/download-white.png"
|
||||
onClicked: qrFileDialog.open()
|
||||
MoneroComponents.StandardButton {
|
||||
Layout.preferredWidth: 220
|
||||
small: true
|
||||
text: FontAwesome.clipboard + " %1".arg(qsTr("Copy to clipboard")) + translationManager.emptyString
|
||||
label.font.family: FontAwesome.fontFamily
|
||||
fontSize: 13
|
||||
onClicked: {
|
||||
clipboard.setText(TxUtils.makeQRCodeString(appWindow.current_address));
|
||||
appWindow.showStatusMessage(qsTr("Copied to clipboard") + translationManager.emptyString, 3);
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
rightIcon: "qrc:///images/external-link-white.png"
|
||||
onClicked: {
|
||||
clipboard.setText(TxUtils.makeQRCodeString(appWindow.current_address));
|
||||
appWindow.showStatusMessage(qsTr("Copied to clipboard") + translationManager.emptyString, 3);
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
text: FontAwesome.eye
|
||||
label.font.family: FontAwesome.fontFamily
|
||||
fontSize: 24
|
||||
width: 36
|
||||
visible: appWindow.currentWallet ? appWindow.currentWallet.isHwBacked() : false
|
||||
onClicked: {
|
||||
appWindow.currentWallet.deviceShowAddressAsync(
|
||||
appWindow.currentWallet.currentSubaddressAccount,
|
||||
appWindow.current_subaddress_table_index,
|
||||
'');
|
||||
}
|
||||
MoneroComponents.StandardButton {
|
||||
Layout.preferredWidth: 220
|
||||
small: true
|
||||
text: FontAwesome.eye + " %1".arg(qsTr("Show on device")) + translationManager.emptyString
|
||||
label.font.family: FontAwesome.fontFamily
|
||||
fontSize: 13
|
||||
visible: appWindow.currentWallet ? appWindow.currentWallet.isHwBacked() : false
|
||||
onClicked: {
|
||||
appWindow.currentWallet.deviceShowAddressAsync(
|
||||
appWindow.currentWallet.currentSubaddressAccount,
|
||||
appWindow.current_subaddress_table_index,
|
||||
'');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,6 @@ Rectangle {
|
||||
readOnly: false
|
||||
onTextChanged: signSignatureLine.text = ''
|
||||
wrapMode: Text.WrapAnywhere
|
||||
pasteButton: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,7 +301,6 @@ Rectangle {
|
||||
readOnly: false
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text: ''
|
||||
pasteButton: true
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
@@ -344,7 +342,6 @@ Rectangle {
|
||||
placeholderText: qsTr("Enter the Monero Address (example: 44AFFq5kSiGBoZ...)") + translationManager.emptyString
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text: ''
|
||||
pasteButton: true
|
||||
}
|
||||
|
||||
MoneroComponents.LineEditMulti {
|
||||
@@ -354,7 +351,6 @@ Rectangle {
|
||||
placeholderFontSize: 16
|
||||
placeholderText: qsTr("Enter the signature to verify") + translationManager.emptyString
|
||||
Layout.fillWidth: true
|
||||
pasteButton: true
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text: ''
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Dialogs 1.2
|
||||
import moneroComponents.Clipboard 1.0
|
||||
@@ -38,6 +39,7 @@ import "../components"
|
||||
import "../components" as MoneroComponents
|
||||
import "." 1.0
|
||||
import "../js/TxUtils.js" as TxUtils
|
||||
import "../js/Utils.js" as Utils
|
||||
|
||||
|
||||
Rectangle {
|
||||
@@ -51,8 +53,34 @@ Rectangle {
|
||||
property alias transferHeight2: advancedLayout.height
|
||||
property int mixin: 10 // (ring size 11)
|
||||
property string warningContent: ""
|
||||
property string sendButtonWarning: ""
|
||||
property string startLinkText: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><font size='2'> (</font><a href='#'>Start daemon</a><font size='2'>)</font>") + translationManager.emptyString
|
||||
property string sendButtonWarning: {
|
||||
// Currently opened wallet is not view-only
|
||||
if (appWindow.viewOnly) {
|
||||
return qsTr("Wallet is view-only and sends are only possible by using offline transaction signing. " +
|
||||
"Unless key images are imported, the balance reflects only incoming but not outgoing transactions.") + translationManager.emptyString;
|
||||
}
|
||||
|
||||
// There are sufficient unlocked funds available
|
||||
if (walletManager.amountFromString(amountLine.text) > appWindow.getUnlockedBalance()) {
|
||||
return qsTr("Amount is more than unlocked balance.") + translationManager.emptyString;
|
||||
}
|
||||
|
||||
if (addressLine.text)
|
||||
{
|
||||
// Address is valid
|
||||
if (!TxUtils.checkAddress(addressLine.text, appWindow.persistentSettings.nettype)) {
|
||||
return qsTr("Address is invalid.") + translationManager.emptyString;
|
||||
}
|
||||
|
||||
// Amount is nonzero
|
||||
if (!amountLine.text || parseFloat(amountLine.text) <= 0) {
|
||||
return qsTr("Enter an amount.") + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
property string startLinkText: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><a href='#'>(%1)</a>".arg(qsTr("Start daemon")) + translationManager.emptyString
|
||||
property bool warningLongPidDescription: descriptionLine.text.match(/^[0-9a-f]{64}$/i)
|
||||
|
||||
Clipboard { id: clipboard }
|
||||
@@ -88,10 +116,8 @@ Rectangle {
|
||||
addressLine.text = ""
|
||||
setPaymentId("");
|
||||
amountLine.text = ""
|
||||
root.sendButtonWarning = ""
|
||||
setDescription("");
|
||||
priorityDropdown.currentIndex = 0
|
||||
updatePriorityDropdown()
|
||||
}
|
||||
|
||||
// Information dialog
|
||||
@@ -137,96 +163,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: appWindow.walletMode < 2 ? 1 : 2
|
||||
Layout.fillWidth: true
|
||||
columnSpacing: 32
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 200
|
||||
|
||||
// Amount input
|
||||
LineEdit {
|
||||
id: amountLine
|
||||
Layout.fillWidth: true
|
||||
inlineIcon: true
|
||||
labelText: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
|
||||
Amount <font size='2'> ( </font> <a href='#'>Change account</a><font size='2'> )</font>")
|
||||
+ translationManager.emptyString
|
||||
copyButton: !isNaN(amountLine.text) && persistentSettings.fiatPriceEnabled
|
||||
copyButtonText: fiatApiCurrencySymbol() + " ~" + fiatApiConvertToFiat(amountLine.text)
|
||||
copyButtonEnabled: false
|
||||
|
||||
onLabelLinkActivated: {
|
||||
middlePanel.accountView.selectAndSend = true;
|
||||
appWindow.showPageRequest("Account")
|
||||
}
|
||||
placeholderText: "0.00"
|
||||
width: 100
|
||||
fontBold: true
|
||||
inlineButtonText: qsTr("All") + translationManager.emptyString
|
||||
inlineButton.onClicked: amountLine.text = "(all)"
|
||||
onTextChanged: {
|
||||
const match = amountLine.text.match(/^0+(\d.*)/);
|
||||
if (match) {
|
||||
const cursorPosition = amountLine.cursorPosition;
|
||||
amountLine.text = match[1];
|
||||
amountLine.cursorPosition = Math.max(cursorPosition, 1) - 1;
|
||||
} else if(amountLine.text.indexOf('.') === 0){
|
||||
amountLine.text = '0' + amountLine.text;
|
||||
if (amountLine.text.length > 2) {
|
||||
amountLine.cursorPosition = 1;
|
||||
}
|
||||
}
|
||||
amountLine.error = walletManager.amountFromString(amountLine.text) > appWindow.getUnlockedBalance()
|
||||
}
|
||||
|
||||
validator: RegExpValidator {
|
||||
regExp: /^(\d{1,8})?([\.]\d{1,12})?$/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
visible: appWindow.walletMode >= 2
|
||||
Layout.fillWidth: true
|
||||
Label {
|
||||
id: transactionPriority
|
||||
Layout.topMargin: 12
|
||||
text: qsTr("Transaction priority") + translationManager.emptyString
|
||||
fontBold: false
|
||||
fontSize: 16
|
||||
}
|
||||
// Note: workaround for translations in listElements
|
||||
// ListElement: cannot use script for property value, so
|
||||
// code like this wont work:
|
||||
// ListElement { column1: qsTr("LOW") + translationManager.emptyString ; column2: ""; priority: PendingTransaction.Priority_Low }
|
||||
// For translations to work, the strings need to be listed in
|
||||
// the file components/StandardDropdown.qml too.
|
||||
|
||||
// Priorites after v5
|
||||
ListModel {
|
||||
id: priorityModelV5
|
||||
|
||||
ListElement { column1: qsTr("Automatic") ; column2: ""; priority: 0}
|
||||
ListElement { column1: qsTr("Slow (x0.2 fee)") ; column2: ""; priority: 1}
|
||||
ListElement { column1: qsTr("Normal (x1 fee)") ; column2: ""; priority: 2 }
|
||||
ListElement { column1: qsTr("Fast (x5 fee)") ; column2: ""; priority: 3 }
|
||||
ListElement { column1: qsTr("Fastest (x200 fee)") ; column2: ""; priority: 4 }
|
||||
}
|
||||
|
||||
StandardDropdown {
|
||||
Layout.fillWidth: true
|
||||
id: priorityDropdown
|
||||
Layout.topMargin: 5
|
||||
currentIndex: 0
|
||||
}
|
||||
}
|
||||
// Make sure dropdown is on top
|
||||
z: parent.z + 1
|
||||
}
|
||||
|
||||
// recipient address input
|
||||
RowLayout {
|
||||
id: addressLineRow
|
||||
@@ -235,10 +171,9 @@ Rectangle {
|
||||
LineEditMulti {
|
||||
id: addressLine
|
||||
spacing: 0
|
||||
inputPaddingRight: inlineButtonVisible && inlineButton2Visible ? 100 : 60
|
||||
fontBold: true
|
||||
labelText: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
|
||||
Address <font size='2'> ( </font> <a href='#'>Address book</a><font size='2'> )</font>")
|
||||
+ translationManager.emptyString
|
||||
labelText: qsTr("Address") + translationManager.emptyString
|
||||
labelButtonText: qsTr("Resolve") + translationManager.emptyString
|
||||
placeholderText: {
|
||||
if(persistentSettings.nettype == NetworkType.MAINNET){
|
||||
@@ -251,11 +186,6 @@ Rectangle {
|
||||
}
|
||||
wrapMode: Text.WrapAnywhere
|
||||
addressValidation: true
|
||||
onInputLabelLinkActivated: {
|
||||
middlePanel.addressBookView.selectAndSend = true;
|
||||
appWindow.showPageRequest("AddressBook");
|
||||
}
|
||||
pasteButton: true
|
||||
onTextChanged: {
|
||||
const parsed = walletManager.parse_uri_to_object(text);
|
||||
if (!parsed.error) {
|
||||
@@ -265,16 +195,27 @@ Rectangle {
|
||||
setDescription(parsed.tx_description);
|
||||
}
|
||||
}
|
||||
inlineButton.text: FontAwesome.qrcode
|
||||
inlineButton.text: FontAwesome.addressBook
|
||||
inlineButton.buttonHeight: 30
|
||||
inlineButton.fontPixelSize: 22
|
||||
inlineButton.fontFamily: FontAwesome.fontFamily
|
||||
inlineButton.textColor: MoneroComponents.Style.defaultFontColor
|
||||
inlineButton.buttonColor: MoneroComponents.Style.orange
|
||||
inlineButton.onClicked: {
|
||||
cameraUi.state = "Capture"
|
||||
cameraUi.qrcode_decoded.connect(updateFromQrCode)
|
||||
middlePanel.addressBookView.selectAndSend = true;
|
||||
appWindow.showPageRequest("AddressBook");
|
||||
}
|
||||
inlineButtonVisible : appWindow.qrScannerEnabled && !addressLine.text
|
||||
inlineButtonVisible: true
|
||||
|
||||
inlineButton2.text: FontAwesome.qrcode
|
||||
inlineButton2.buttonHeight: 30
|
||||
inlineButton2.fontPixelSize: 22
|
||||
inlineButton2.fontFamily: FontAwesome.fontFamily
|
||||
inlineButton2.textColor: MoneroComponents.Style.defaultFontColor
|
||||
inlineButton2.onClicked: {
|
||||
cameraUi.state = "Capture"
|
||||
cameraUi.qrcode_decoded.connect(updateFromQrCode)
|
||||
}
|
||||
inlineButton2Visible: appWindow.qrScannerEnabled
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,6 +265,142 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: appWindow.walletMode < 2 ? 1 : 2
|
||||
Layout.fillWidth: true
|
||||
columnSpacing: 32
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 200
|
||||
|
||||
// Amount input
|
||||
LineEdit {
|
||||
id: amountLine
|
||||
Layout.fillWidth: true
|
||||
inlineIcon: true
|
||||
labelText: "<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
|
||||
%1 <a href='#'>(%2)</a>".arg(qsTr("Amount")).arg(qsTr("Change account"))
|
||||
+ translationManager.emptyString
|
||||
copyButton: !isNaN(amountLine.text) && persistentSettings.fiatPriceEnabled
|
||||
copyButtonText: "~%1 %2".arg(fiatApiConvertToFiat(amountLine.text)).arg(fiatApiCurrencySymbol())
|
||||
copyButtonEnabled: false
|
||||
|
||||
onLabelLinkActivated: {
|
||||
middlePanel.accountView.selectAndSend = true;
|
||||
appWindow.showPageRequest("Account")
|
||||
}
|
||||
placeholderText: "0.00"
|
||||
width: 100
|
||||
fontBold: true
|
||||
inlineButtonText: qsTr("All") + translationManager.emptyString
|
||||
inlineButton.onClicked: amountLine.text = "(all)"
|
||||
onTextChanged: {
|
||||
const match = amountLine.text.match(/^0+(\d.*)/);
|
||||
if (match) {
|
||||
const cursorPosition = amountLine.cursorPosition;
|
||||
amountLine.text = match[1];
|
||||
amountLine.cursorPosition = Math.max(cursorPosition, 1) - 1;
|
||||
} else if(amountLine.text.indexOf('.') === 0){
|
||||
amountLine.text = '0' + amountLine.text;
|
||||
if (amountLine.text.length > 2) {
|
||||
amountLine.cursorPosition = 1;
|
||||
}
|
||||
}
|
||||
amountLine.error = walletManager.amountFromString(amountLine.text) > appWindow.getUnlockedBalance()
|
||||
}
|
||||
|
||||
validator: RegExpValidator {
|
||||
regExp: /^(\d{1,8})?([\.]\d{1,12})?$/
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
id: feeLabel
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Layout.topMargin: 12
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 14
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
property bool estimating: false
|
||||
property var estimatedFee: null
|
||||
property string estimatedFeeFiat: {
|
||||
if (!persistentSettings.fiatPriceEnabled || estimatedFee == null) {
|
||||
return "";
|
||||
}
|
||||
const fiatFee = fiatApiConvertToFiat(estimatedFee);
|
||||
return " (%1 %3)".arg(fiatFee < 0.01 ? "<0.01" : "~" + fiatFee).arg(fiatApiCurrencySymbol());
|
||||
}
|
||||
property var fee: {
|
||||
estimatedFee = null;
|
||||
estimating = sendButton.enabled;
|
||||
if (!sendButton.enabled || !currentWallet) {
|
||||
return;
|
||||
}
|
||||
currentWallet.estimateTransactionFeeAsync(
|
||||
addressLine.text,
|
||||
walletManager.amountFromString(amountLine.text),
|
||||
priorityModelV5.get(priorityDropdown.currentIndex).priority,
|
||||
function (amount) {
|
||||
estimatedFee = Utils.removeTrailingZeros(amount);
|
||||
estimating = false;
|
||||
});
|
||||
}
|
||||
text: {
|
||||
if (!sendButton.enabled || estimatedFee == null) {
|
||||
return ""
|
||||
}
|
||||
return "%1: ~%2 XMR".arg(qsTr("Fee")).arg(estimatedFee) +
|
||||
estimatedFeeFiat +
|
||||
translationManager.emptyString;
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
anchors.right: parent.right
|
||||
running: feeLabel.estimating
|
||||
height: parent.height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
visible: appWindow.walletMode >= 2
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Label {
|
||||
id: transactionPriority
|
||||
Layout.topMargin: 0
|
||||
text: qsTr("Transaction priority") + translationManager.emptyString
|
||||
fontBold: false
|
||||
fontSize: 16
|
||||
}
|
||||
// Note: workaround for translations in listElements
|
||||
// ListElement: cannot use script for property value, so
|
||||
// code like this wont work:
|
||||
// ListElement { column1: qsTr("LOW") + translationManager.emptyString ; column2: ""; priority: PendingTransaction.Priority_Low }
|
||||
// For translations to work, the strings need to be listed in
|
||||
// the file components/StandardDropdown.qml too.
|
||||
|
||||
// Priorites after v5
|
||||
ListModel {
|
||||
id: priorityModelV5
|
||||
|
||||
ListElement { column1: qsTr("Automatic") ; column2: ""; priority: 0}
|
||||
ListElement { column1: qsTr("Slow (x0.2 fee)") ; column2: ""; priority: 1}
|
||||
ListElement { column1: qsTr("Normal (x1 fee)") ; column2: ""; priority: 2 }
|
||||
ListElement { column1: qsTr("Fast (x5 fee)") ; column2: ""; priority: 3 }
|
||||
ListElement { column1: qsTr("Fastest (x200 fee)") ; column2: ""; priority: 4 }
|
||||
}
|
||||
|
||||
StandardDropdown {
|
||||
Layout.preferredWidth: 200
|
||||
id: priorityDropdown
|
||||
Layout.topMargin: 5
|
||||
currentIndex: 0
|
||||
dataModel: priorityModelV5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.WarningBox {
|
||||
text: qsTr("Description field contents match long payment ID format. \
|
||||
Please don't paste long payment ID into description field, your funds might be lost.") + translationManager.emptyString;
|
||||
@@ -414,9 +491,7 @@ Rectangle {
|
||||
rightIconInactive: "qrc:///images/rightArrowInactive.png"
|
||||
Layout.topMargin: 4
|
||||
text: qsTr("Send") + translationManager.emptyString
|
||||
enabled: {
|
||||
updateSendButton()
|
||||
}
|
||||
enabled: !sendButtonWarningBox.visible && !warningContent && addressLine.text && !paymentIdWarningBox.visible
|
||||
onClicked: {
|
||||
console.log("Transfer: paymentClicked")
|
||||
var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority
|
||||
@@ -439,10 +514,9 @@ Rectangle {
|
||||
id: advancedLayout
|
||||
anchors.top: pageRoot.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 20
|
||||
anchors.topMargin: 32
|
||||
spacing: 26
|
||||
spacing: 10
|
||||
enabled: !viewOnly || pageRoot.enabled
|
||||
|
||||
RowLayout {
|
||||
@@ -457,85 +531,88 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
AdvancedOptionsItem {
|
||||
visible: persistentSettings.transferShowAdvanced && appWindow.walletMode >= 2
|
||||
columns: 6
|
||||
|
||||
StandardButton {
|
||||
id: sweepUnmixableButton
|
||||
text: qsTr("Sweep Unmixable") + translationManager.emptyString
|
||||
enabled : pageRoot.enabled
|
||||
small: true
|
||||
onClicked: {
|
||||
console.log("Transfer: sweepUnmixableClicked")
|
||||
root.sweepUnmixableClicked()
|
||||
}
|
||||
title: qsTr("Key images") + translationManager.emptyString
|
||||
button1.text: qsTr("Export") + translationManager.emptyString
|
||||
button1.enabled: !appWindow.viewOnly
|
||||
button1.onClicked: {
|
||||
console.log("Transfer: export key images clicked")
|
||||
exportKeyImagesDialog.open();
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: saveTxButton
|
||||
text: qsTr("Create tx file") + translationManager.emptyString
|
||||
visible: appWindow.viewOnly
|
||||
enabled: pageRoot.checkInformation(amountLine.text, addressLine.text, appWindow.persistentSettings.nettype)
|
||||
small: true
|
||||
onClicked: {
|
||||
console.log("Transfer: saveTx Clicked")
|
||||
var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority
|
||||
console.log("priority: " + priority)
|
||||
console.log("amount: " + amountLine.text)
|
||||
addressLine.text = addressLine.text.trim()
|
||||
setPaymentId(paymentIdLine.text.trim());
|
||||
root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, root.mixin, priority, descriptionLine.text)
|
||||
|
||||
}
|
||||
button2.text: qsTr("Import") + translationManager.emptyString
|
||||
button2.enabled: appWindow.viewOnly && appWindow.isTrustedDaemon()
|
||||
button2.onClicked: {
|
||||
console.log("Transfer: import key images clicked")
|
||||
importKeyImagesDialog.open();
|
||||
}
|
||||
helpTextLarge.text: qsTr("Required for view-only wallets to display the real balance") + translationManager.emptyString
|
||||
helpTextSmall.text: {
|
||||
var errorMessage = "";
|
||||
if (appWindow.viewOnly && !appWindow.isTrustedDaemon()){
|
||||
errorMessage = "<p class='orange'>" + qsTr("* To import, you must connect to a local node or a trusted remote node") + "</p>";
|
||||
}
|
||||
return "<style type='text/css'>p{line-height:20px; margin-top:0px; margin-bottom:0px; color:#ffffff;} p.orange{color:#ff9323;}</style>" +
|
||||
"<p>" + qsTr("1. Using cold wallet, export the key images into a file") + "</p>" +
|
||||
"<p>" + qsTr("2. Using view-only wallet, import the key images file") + "</p>" +
|
||||
errorMessage + translationManager.emptyString
|
||||
}
|
||||
helpTextSmall.themeTransition: false
|
||||
}
|
||||
|
||||
AdvancedOptionsItem {
|
||||
visible: persistentSettings.transferShowAdvanced && appWindow.walletMode >= 2
|
||||
title: qsTr("Offline transaction signing") + translationManager.emptyString
|
||||
button1.text: qsTr("Create") + translationManager.emptyString
|
||||
button1.enabled: appWindow.viewOnly && pageRoot.checkInformation(amountLine.text, addressLine.text, appWindow.persistentSettings.nettype)
|
||||
button1.onClicked: {
|
||||
console.log("Transfer: saveTx Clicked")
|
||||
var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority
|
||||
console.log("priority: " + priority)
|
||||
console.log("amount: " + amountLine.text)
|
||||
addressLine.text = addressLine.text.trim()
|
||||
setPaymentId(paymentIdLine.text.trim());
|
||||
root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, root.mixin, priority, descriptionLine.text)
|
||||
}
|
||||
button2.text: qsTr("Sign (offline)") + translationManager.emptyString
|
||||
button2.enabled: !appWindow.viewOnly
|
||||
button2.onClicked: {
|
||||
console.log("Transfer: sign tx clicked")
|
||||
signTxDialog.open();
|
||||
}
|
||||
button3.text: qsTr("Submit") + translationManager.emptyString
|
||||
button3.enabled: appWindow.viewOnly
|
||||
button3.onClicked: {
|
||||
console.log("Transfer: submit tx clicked")
|
||||
submitTxDialog.open();
|
||||
}
|
||||
helpTextLarge.text: qsTr("Spend XMR from a cold (offline) wallet") + translationManager.emptyString
|
||||
helpTextSmall.text: {
|
||||
var errorMessage = "";
|
||||
if (appWindow.viewOnly && !pageRoot.checkInformation(amountLine.text, addressLine.text, appWindow.persistentSettings.nettype)){
|
||||
errorMessage = "<p class='orange'>" + qsTr("* To create a transaction file, please enter address and amount above") + "</p>";
|
||||
}
|
||||
return "<style type='text/css'>p{line-height:20px; margin-top:0px; margin-bottom:0px; color:#ffffff;} p.orange{color:#ff9323;}</style>" +
|
||||
"<p>" + qsTr("1. Using view-only wallet, export the outputs into a file") + "</p>" +
|
||||
"<p>" + qsTr("2. Using cold wallet, import the outputs file and export the key images") + "</p>" +
|
||||
"<p>" + qsTr("3. Using view-only wallet, import the key images file and create a transaction file") + "</p>" +
|
||||
errorMessage +
|
||||
"<p>" + qsTr("4. Using cold wallet, sign your transaction file") + "</p>" +
|
||||
"<p>" + qsTr("5. Using view-only wallet, submit your signed transaction") + "</p>" + translationManager.emptyString
|
||||
}
|
||||
helpTextSmall.themeTransition: false
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: signTxButton
|
||||
text: qsTr("Sign tx file") + translationManager.emptyString
|
||||
small: true
|
||||
visible: !appWindow.viewOnly
|
||||
onClicked: {
|
||||
console.log("Transfer: sign tx clicked")
|
||||
signTxDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: submitTxButton
|
||||
text: qsTr("Submit tx file") + translationManager.emptyString
|
||||
small: true
|
||||
visible: appWindow.viewOnly
|
||||
enabled: pageRoot.enabled
|
||||
onClicked: {
|
||||
console.log("Transfer: submit tx clicked")
|
||||
submitTxDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: exportKeyImagesButton
|
||||
text: qsTr("Export key images") + translationManager.emptyString
|
||||
small: true
|
||||
visible: !appWindow.viewOnly
|
||||
enabled: pageRoot.enabled
|
||||
onClicked: {
|
||||
console.log("Transfer: export key images clicked")
|
||||
exportKeyImagesDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: importKeyImagesButton
|
||||
text: qsTr("Import key images") + translationManager.emptyString
|
||||
small: true
|
||||
visible: appWindow.viewOnly && !persistentSettings.useRemoteNode
|
||||
enabled: pageRoot.enabled
|
||||
onClicked: {
|
||||
console.log("Transfer: import key images clicked")
|
||||
importKeyImagesDialog.open();
|
||||
}
|
||||
AdvancedOptionsItem {
|
||||
visible: persistentSettings.transferShowAdvanced && appWindow.walletMode >= 2
|
||||
title: qsTr("Unmixable outputs") + translationManager.emptyString
|
||||
button1.text: qsTr("Sweep") + translationManager.emptyString
|
||||
button1.enabled : pageRoot.enabled
|
||||
button1.onClicked: {
|
||||
console.log("Transfer: sweepUnmixableClicked")
|
||||
root.sweepUnmixableClicked()
|
||||
}
|
||||
helpTextLarge.text: qsTr("Create a transaction that spends old unmovable outputs") + translationManager.emptyString
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,12 +745,6 @@ Rectangle {
|
||||
function onPageCompleted() {
|
||||
console.log("transfer page loaded")
|
||||
updateStatus();
|
||||
updatePriorityDropdown()
|
||||
}
|
||||
|
||||
function updatePriorityDropdown() {
|
||||
priorityDropdown.dataModel = priorityModelV5;
|
||||
priorityDropdown.update()
|
||||
}
|
||||
|
||||
//TODO: Add daemon sync status
|
||||
@@ -695,6 +766,9 @@ Rectangle {
|
||||
//pageRoot.enabled = false;
|
||||
|
||||
switch (currentWallet.connected()) {
|
||||
case Wallet.ConnectionStatus_Connecting:
|
||||
root.warningContent = qsTr("Wallet is connecting to daemon.")
|
||||
break
|
||||
case Wallet.ConnectionStatus_Disconnected:
|
||||
root.warningContent = messageNotConnected;
|
||||
break
|
||||
@@ -730,49 +804,4 @@ Rectangle {
|
||||
if(typeof amount !== 'undefined')
|
||||
amountLine.text = amount;
|
||||
}
|
||||
|
||||
function updateSendButton(){
|
||||
// reset message
|
||||
root.sendButtonWarning = "";
|
||||
|
||||
// Currently opened wallet is not view-only
|
||||
if(appWindow.viewOnly){
|
||||
root.sendButtonWarning = qsTr("Wallet is view-only and sends are not possible. Unless key images are imported, " +
|
||||
"the balance reflects only incoming but not outgoing transactions.") + translationManager.emptyString;
|
||||
return false;
|
||||
}
|
||||
|
||||
// There are sufficient unlocked funds available
|
||||
if(walletManager.amountFromString(amountLine.text) > appWindow.getUnlockedBalance()){
|
||||
root.sendButtonWarning = qsTr("Amount is more than unlocked balance.") + translationManager.emptyString;
|
||||
return false;
|
||||
}
|
||||
|
||||
// There is no warning box displayed
|
||||
if(root.warningContent !== ""){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (addressLine.text == "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Address is valid
|
||||
if(!TxUtils.checkAddress(addressLine.text, appWindow.persistentSettings.nettype)){
|
||||
root.sendButtonWarning = qsTr("Address is invalid.") + translationManager.emptyString;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Amount is nonzero
|
||||
if (!amountLine.text || parseFloat(amountLine.text) <= 0) {
|
||||
root.sendButtonWarning = qsTr("Enter an amount.") + translationManager.emptyString;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (paymentIdWarningBox.visible) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ Item {
|
||||
anchors.margins: 0
|
||||
|
||||
property int minWidth: 900
|
||||
property int minHeight: 600
|
||||
property int qrCodeSize: 220
|
||||
property bool enableTracking: false
|
||||
property string trackingError: "" // setting this will show a message @ tracking table
|
||||
@@ -33,6 +34,9 @@ Item {
|
||||
property var hiddenAmounts: []
|
||||
|
||||
function onPageCompleted() {
|
||||
if (appWindow.currentWallet) {
|
||||
appWindow.current_address = appWindow.currentWallet.address(appWindow.currentWallet.currentSubaddressAccount, 0)
|
||||
}
|
||||
// prepare tracking
|
||||
trackingCheckbox.checked = root.enableTracking
|
||||
root.update();
|
||||
@@ -67,7 +71,7 @@ Item {
|
||||
|
||||
ColumnLayout {
|
||||
id: mainLayout
|
||||
visible: parent.width >= root.minWidth
|
||||
visible: parent.width >= root.minWidth && appWindow.height >= root.minHeight
|
||||
spacing: 0
|
||||
|
||||
// emulates max-width + center for container
|
||||
@@ -151,14 +155,10 @@ Item {
|
||||
model: trackingModel
|
||||
message: {
|
||||
if(!root.enableTracking){
|
||||
return qsTr(
|
||||
"<style>p{font-size:14px;}</style>" +
|
||||
"<p>This page will automatically scan the blockchain and the tx pool " +
|
||||
"for incoming transactions using the QR code.</p>" +
|
||||
"<p>It's up to you whether to accept unconfirmed transactions or not. It is likely they'll be " +
|
||||
"confirmed in short order, but there is still a possibility they might not, so for larger " +
|
||||
"values you may want to wait for one or more confirmation(s).</p>"
|
||||
) + translationManager.emptyString;
|
||||
return "<style>p{font-size:14px;}</style> <p>%1</p> <p>%2</p>"
|
||||
.arg(qsTr("This page will automatically scan the blockchain and the tx pool for incoming transactions using the QR code."))
|
||||
.arg(qsTr("It's up to you whether to accept unconfirmed transactions or not. It is likely they'll be confirmed in short order, but there is still a possibility they might not, so for larger values you may want to wait for one or more confirmation(s)"))
|
||||
+ translationManager.emptyString;
|
||||
} else if(root.trackingError !== ""){
|
||||
return root.trackingError;
|
||||
} else if(trackingModel.count < 1){
|
||||
@@ -265,7 +265,10 @@ Item {
|
||||
font.pixelSize: 12
|
||||
font.bold: false
|
||||
color: "white"
|
||||
text: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 12px;}</style>Currently selected address: ") + addressLabel + qsTr(" <a href='#'>(Change)</a>") + translationManager.emptyString
|
||||
text: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 12px;}</style>%1: %2 <a href='#'>(%3)</a>"
|
||||
.arg(qsTr("Currently selected address"))
|
||||
.arg(addressLabel)
|
||||
.arg(qsTr("Change")) + translationManager.emptyString
|
||||
textFormat: Text.RichText
|
||||
themeTransition: false
|
||||
|
||||
@@ -545,7 +548,7 @@ Item {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: appWindow.showPageRequest("Receive")
|
||||
onClicked: appWindow.showPageRequest("Settings")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -554,7 +557,7 @@ Item {
|
||||
|
||||
Rectangle {
|
||||
// Shows when the window is too small
|
||||
visible: parent.width < root.minWidth
|
||||
visible: parent.width < root.minWidth || appWindow.height < root.minHeight
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 100;
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -571,6 +574,13 @@ Item {
|
||||
text: qsTr("The merchant page requires a larger window") + translationManager.emptyString
|
||||
themeTransition: false
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: appWindow.showPageRequest("Settings")
|
||||
}
|
||||
}
|
||||
|
||||
function update() {
|
||||
@@ -582,7 +592,7 @@ Item {
|
||||
return
|
||||
}
|
||||
|
||||
if (appWindow.currentWallet.connected() == Wallet.ConnectionStatus_Disconnected) {
|
||||
if (appWindow.disconnected) {
|
||||
root.trackingError = qsTr("WARNING: no connection to daemon");
|
||||
trackingModel.clear();
|
||||
return
|
||||
@@ -590,9 +600,7 @@ Item {
|
||||
|
||||
var model = appWindow.currentWallet.historyModel
|
||||
var count = model.rowCount()
|
||||
var totalAmount = 0
|
||||
var nTransactions = 0
|
||||
var blockchainHeight = null
|
||||
var txs = []
|
||||
|
||||
// Currently selected subaddress as per Receive page
|
||||
@@ -608,8 +616,6 @@ Item {
|
||||
var subaddrIndex = model.data(idx, TransactionHistoryModel.TransactionSubaddrIndexRole);
|
||||
|
||||
if (!isout && subaddrAccount == appWindow.currentWallet.currentSubaddressAccount && subaddrIndex == current_subaddress_table_index) {
|
||||
var amount = model.data(idx, TransactionHistoryModel.TransactionAtomicAmountRole);
|
||||
totalAmount = walletManager.addi(totalAmount, amount)
|
||||
nTransactions += 1
|
||||
|
||||
var txid = model.data(idx, TransactionHistoryModel.TransactionHashRole);
|
||||
@@ -617,21 +623,17 @@ Item {
|
||||
|
||||
var in_txpool = false;
|
||||
var confirmations = 0;
|
||||
var displayAmount = 0;
|
||||
var displayAmount = model.data(idx, TransactionHistoryModel.TransactionDisplayAmountRole);
|
||||
|
||||
if (blockHeight == 0) {
|
||||
if (blockHeight === undefined) {
|
||||
in_txpool = true;
|
||||
} else {
|
||||
if (blockchainHeight == null)
|
||||
blockchainHeight = walletManager.blockchainHeight()
|
||||
confirmations = blockchainHeight - blockHeight - 1
|
||||
displayAmount = model.data(idx, TransactionHistoryModel.TransactionDisplayAmountRole);
|
||||
confirmations = model.data(idx, TransactionHistoryModel.TransactionConfirmationsRole);
|
||||
}
|
||||
|
||||
txs.push({
|
||||
"amount": displayAmount,
|
||||
"confirmations": confirmations,
|
||||
"blockheight": blockHeight,
|
||||
"in_txpool": in_txpool,
|
||||
"txid": txid,
|
||||
"time_epoch": timeEpoch,
|
||||
@@ -651,9 +653,7 @@ Item {
|
||||
txs.forEach(function(tx){
|
||||
trackingModel.append({
|
||||
"amount": tx.amount,
|
||||
"blockheight": tx.blockheight,
|
||||
"confirmations": tx.confirmations,
|
||||
"blockheight": tx.blockHeight,
|
||||
"in_txpool": tx.in_txpool,
|
||||
"txid": tx.txid,
|
||||
"time_epoch": tx.time_epoch,
|
||||
|
||||
@@ -125,7 +125,7 @@ ListView {
|
||||
font.pixelSize: 14
|
||||
font.bold: true
|
||||
color: hide_amount ? "#707070" : "#009F1E"
|
||||
text: hide_amount ? '-' : '+' + amount
|
||||
text: hide_amount ? '-' : '+' + amount + (in_txpool ? ' (%1)'.arg(qsTr('unconfirmed')) : '')
|
||||
selectionColor: MoneroComponents.Style.textSelectionColor
|
||||
selectByMouse: true
|
||||
readOnly: true
|
||||
|
||||
@@ -131,10 +131,11 @@ Rectangle {
|
||||
}
|
||||
|
||||
MoneroComponents.TextBlock {
|
||||
id: walletLocation
|
||||
Layout.fillWidth: true
|
||||
color: MoneroComponents.Style.dimmedFontColor
|
||||
font.pixelSize: 14
|
||||
property string walletPath: (isIOS ? moneroAccountsDir : "") + appWindow.walletPath()
|
||||
property string walletPath: (isIOS ? moneroAccountsDir : "") + persistentSettings.wallet_path
|
||||
text: "\
|
||||
<style type='text/css'>\
|
||||
a {cursor:pointer;text-decoration: none; color: #FF6C3C}\
|
||||
@@ -182,7 +183,7 @@ Rectangle {
|
||||
color: MoneroComponents.Style.dimmedFontColor
|
||||
font.pixelSize: 14
|
||||
property var style: "<style type='text/css'>a {cursor:pointer;text-decoration: none; color: #FF6C3C}</style>"
|
||||
text: (currentWallet ? currentWallet.walletCreationHeight : "") + style + qsTr(" <a href='#'> (Click to change)</a>") + translationManager.emptyString
|
||||
text: (currentWallet ? currentWallet.walletCreationHeight : "") + style + " <a href='#'> (%1)</a>".arg(qsTr("Change")) + translationManager.emptyString
|
||||
onLinkActivated: {
|
||||
inputDialog.labelText = qsTr("Set a new restore height.\nYou can enter a block height or a date (YYYY-MM-DD):") + translationManager.emptyString;
|
||||
inputDialog.onAcceptedCallback = function() {
|
||||
@@ -212,7 +213,6 @@ Rectangle {
|
||||
+ "The old wallet cache file will be renamed and can be restored later.\n"
|
||||
);
|
||||
confirmationDialog.icon = StandardIcon.Question
|
||||
confirmationDialog.cancelText = qsTr("Cancel")
|
||||
confirmationDialog.onAcceptedCallback = function() {
|
||||
appWindow.closeWallet(function() {
|
||||
walletManager.clearWalletCache(persistentSettings.wallet_path);
|
||||
@@ -230,7 +230,7 @@ Rectangle {
|
||||
appWindow.showStatusMessage(qsTr("Invalid restore height specified. Must be a number or a date formatted YYYY-MM-DD"),3);
|
||||
}
|
||||
inputDialog.onRejectedCallback = null;
|
||||
inputDialog.open(currentWallet ? currentWallet.walletCreationHeight : "0")
|
||||
inputDialog.open(currentWallet ? currentWallet.walletCreationHeight.toFixed(0) : "0")
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -389,12 +389,7 @@ Rectangle {
|
||||
var data = "";
|
||||
data += "GUI version: " + Version.GUI_VERSION + " (Qt " + qtRuntimeVersion + ")";
|
||||
data += "\nEmbedded Monero version: " + Version.GUI_MONERO_VERSION;
|
||||
data += "\nWallet path: ";
|
||||
|
||||
var wallet_path = walletPath();
|
||||
if(isIOS)
|
||||
wallet_path = moneroAccountsDir + wallet_path;
|
||||
data += wallet_path;
|
||||
data += "\nWallet path: " + walletLocation.walletPath;
|
||||
|
||||
data += "\nWallet creation height: ";
|
||||
if(currentWallet)
|
||||
|
||||
@@ -58,6 +58,14 @@ Rectangle {
|
||||
text: qsTr("Custom decorations") + translationManager.emptyString
|
||||
}
|
||||
|
||||
MoneroComponents.CheckBox {
|
||||
id: checkForUpdatesCheckBox
|
||||
enabled: !disableCheckUpdatesFlag
|
||||
checked: persistentSettings.checkForUpdates && !disableCheckUpdatesFlag
|
||||
onClicked: persistentSettings.checkForUpdates = !persistentSettings.checkForUpdates
|
||||
text: qsTr("Check for updates periodically") + translationManager.emptyString
|
||||
}
|
||||
|
||||
MoneroComponents.CheckBox {
|
||||
id: hideBalanceCheckBox
|
||||
checked: persistentSettings.hideBalance
|
||||
@@ -78,6 +86,32 @@ Rectangle {
|
||||
persistentSettings.blackTheme = MoneroComponents.Style.blackTheme;
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.CheckBox {
|
||||
id: askPasswordBeforeSendingCheckbox
|
||||
checked: persistentSettings.askPasswordBeforeSending
|
||||
onClicked: persistentSettings.askPasswordBeforeSending = !persistentSettings.askPasswordBeforeSending
|
||||
text: qsTr("Ask for password before sending a transaction") + translationManager.emptyString
|
||||
}
|
||||
|
||||
MoneroComponents.CheckBox {
|
||||
checked: persistentSettings.autosave
|
||||
onClicked: persistentSettings.autosave = !persistentSettings.autosave
|
||||
text: qsTr("Autosave") + translationManager.emptyString
|
||||
}
|
||||
|
||||
MoneroComponents.Slider {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: 35
|
||||
Layout.topMargin: 6
|
||||
visible: persistentSettings.autosave
|
||||
from: 1
|
||||
stepSize: 1
|
||||
to: 60
|
||||
value: persistentSettings.autosaveMinutes
|
||||
text: "%1 %2 %3".arg(qsTr("Every")).arg(value).arg(qsTr("minute(s)")) + translationManager.emptyString
|
||||
onMoved: persistentSettings.autosaveMinutes = value
|
||||
}
|
||||
|
||||
MoneroComponents.CheckBox {
|
||||
id: userInActivityCheckbox
|
||||
@@ -86,70 +120,20 @@ Rectangle {
|
||||
text: qsTr("Lock wallet on inactivity") + translationManager.emptyString
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
MoneroComponents.Slider {
|
||||
visible: userInActivityCheckbox.checked
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 6
|
||||
Layout.leftMargin: 42
|
||||
spacing: 0
|
||||
|
||||
Text {
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
font.pixelSize: 14
|
||||
Layout.fillWidth: true
|
||||
text: {
|
||||
var val = userInactivitySlider.value;
|
||||
var minutes = val > 1 ? qsTr("minutes") : qsTr("minute");
|
||||
|
||||
qsTr("After ") + val + " " + minutes + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: userInactivitySlider
|
||||
from: 1
|
||||
value: persistentSettings.lockOnUserInActivityInterval
|
||||
to: 60
|
||||
leftPadding: 0
|
||||
stepSize: 1
|
||||
snapMode: Slider.SnapAlways
|
||||
|
||||
background: Rectangle {
|
||||
x: parent.leftPadding
|
||||
y: parent.topPadding + parent.availableHeight / 2 - height / 2
|
||||
implicitWidth: 200
|
||||
implicitHeight: 4
|
||||
width: parent.availableWidth
|
||||
height: implicitHeight
|
||||
radius: 2
|
||||
color: MoneroComponents.Style.progressBarBackgroundColor
|
||||
|
||||
Rectangle {
|
||||
width: parent.visualPosition * parent.width
|
||||
height: parent.height
|
||||
color: MoneroComponents.Style.green
|
||||
radius: 2
|
||||
}
|
||||
}
|
||||
|
||||
handle: Rectangle {
|
||||
x: parent.leftPadding + parent.visualPosition * (parent.availableWidth - width)
|
||||
y: parent.topPadding + parent.availableHeight / 2 - height / 2
|
||||
implicitWidth: 18
|
||||
implicitHeight: 18
|
||||
radius: 8
|
||||
color: parent.pressed ? "#f0f0f0" : "#f6f6f6"
|
||||
border.color: MoneroComponents.Style.grey
|
||||
}
|
||||
|
||||
onMoved: persistentSettings.lockOnUserInActivityInterval = userInactivitySlider.value;
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.NoButton
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
Layout.leftMargin: 35
|
||||
from: 1
|
||||
stepSize: 1
|
||||
to: 60
|
||||
value: persistentSettings.lockOnUserInActivityInterval
|
||||
text: {
|
||||
var minutes = value > 1 ? qsTr("minutes") : qsTr("minute");
|
||||
return qsTr("After ") + value + " " + minutes + translationManager.emptyString;
|
||||
}
|
||||
onMoved: persistentSettings.lockOnUserInActivityInterval = value
|
||||
}
|
||||
|
||||
//! Manage pricing
|
||||
@@ -212,6 +196,7 @@ Rectangle {
|
||||
MoneroComponents.StandardDropdown {
|
||||
id: fiatPriceCurrencyDropdown
|
||||
Layout.fillWidth: true
|
||||
currentIndex: persistentSettings.fiatPriceCurrency === "xmrusd" ? 0 : 1
|
||||
dataModel: fiatPriceCurrencyModel
|
||||
onChanged: {
|
||||
var obj = dataModel.get(currentIndex);
|
||||
@@ -297,10 +282,6 @@ Rectangle {
|
||||
i += 1;
|
||||
}
|
||||
|
||||
fiatPriceProviderDropDown.update();
|
||||
fiatPriceCurrencyDropdown.currentIndex = persistentSettings.fiatPriceCurrency === "xmrusd" ? 0 : 1;
|
||||
fiatPriceCurrencyDropdown.update();
|
||||
|
||||
console.log('SettingsLayout loaded');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ Rectangle {
|
||||
textFormat: TextEdit.RichText
|
||||
selectByMouse: true
|
||||
selectByKeyboard: true
|
||||
font.family: MoneroComponents.Style.defaultFontColor
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 14
|
||||
wrapMode: TextEdit.Wrap
|
||||
readOnly: true
|
||||
@@ -231,9 +231,6 @@ Rectangle {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
logLevelDropdown.currentIndex = appWindow.persistentSettings.logLevel;
|
||||
logLevelDropdown.update();
|
||||
|
||||
if(typeof daemonManager != "undefined")
|
||||
daemonManager.daemonConsoleUpdated.connect(onDaemonConsoleUpdated)
|
||||
}
|
||||
|
||||
@@ -130,13 +130,6 @@ Rectangle{
|
||||
topPadding: 0
|
||||
text: qsTr("The blockchain is downloaded to your computer. Provides higher security and requires more local storage.") + translationManager.emptyString
|
||||
width: parent.width - (localNodeIcon.width + localNodeIcon.anchors.leftMargin + anchors.leftMargin)
|
||||
|
||||
// @TODO: Legacy. Remove after Qt 5.8.
|
||||
// https://stackoverflow.com/questions/41990013
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,13 +222,6 @@ Rectangle{
|
||||
topPadding: 0
|
||||
text: qsTr("Uses a third-party server to connect to the Monero network. Less secure, but easier on your computer.") + translationManager.emptyString
|
||||
width: parent.width - (remoteNodeIcon.width + remoteNodeIcon.anchors.leftMargin + anchors.leftMargin)
|
||||
|
||||
// @TODO: Legacy. Remove after Qt 5.8.
|
||||
// https://stackoverflow.com/questions/41990013
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -279,8 +265,8 @@ Rectangle{
|
||||
Layout.minimumWidth: 100
|
||||
placeholderFontSize: 15
|
||||
|
||||
daemonAddrLabelText: qsTr("Address")
|
||||
daemonPortLabelText: qsTr("Port")
|
||||
daemonAddrLabelText: qsTr("Address") + translationManager.emptyString
|
||||
daemonPortLabelText: qsTr("Port") + translationManager.emptyString
|
||||
|
||||
property var rna: persistentSettings.remoteNodeAddress
|
||||
daemonAddrText: rna.search(":") != -1 ? rna.split(":")[0].trim() : ""
|
||||
@@ -318,7 +304,7 @@ Rectangle{
|
||||
labelText: qsTr("Daemon password") + translationManager.emptyString
|
||||
text: persistentSettings.daemonPassword
|
||||
placeholderText: qsTr("Password") + translationManager.emptyString
|
||||
echoMode: TextInput.Password
|
||||
password: true
|
||||
placeholderFontSize: 15
|
||||
labelFontSize: 14
|
||||
fontSize: 15
|
||||
@@ -381,15 +367,13 @@ Rectangle{
|
||||
fontSize: 15
|
||||
labelFontSize: 14
|
||||
property string style: "<style type='text/css'>a {cursor:pointer;text-decoration: none; color: #FF6C3C}</style>"
|
||||
labelText: qsTr("Blockchain location") + style + qsTr(" <a href='#'> (change)</a>") + translationManager.emptyString
|
||||
labelText: qsTr("Blockchain location") + style + " <a href='#'> (%1)</a>".arg(qsTr("Change")) + translationManager.emptyString
|
||||
labelButtonText: qsTr("Reset") + translationManager.emptyString
|
||||
labelButtonVisible: text
|
||||
placeholderText: qsTr("(default)") + translationManager.emptyString
|
||||
placeholderFontSize: 15
|
||||
readOnly: true
|
||||
text: {
|
||||
if(persistentSettings.blockchainDataDir.length > 0){
|
||||
return persistentSettings.blockchainDataDir;
|
||||
} else { return "" }
|
||||
}
|
||||
text: persistentSettings.blockchainDataDir
|
||||
addressValidation: false
|
||||
onInputLabelLinkActivated: {
|
||||
//mouse.accepted = false
|
||||
@@ -399,6 +383,7 @@ Rectangle{
|
||||
blockchainFileDialog.open();
|
||||
blockchainFolder.focus = true;
|
||||
}
|
||||
onLabelButtonClicked: persistentSettings.blockchainDataDir = ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,7 +398,12 @@ Rectangle{
|
||||
placeholderFontSize: 15
|
||||
text: persistentSettings.daemonFlags
|
||||
addressValidation: false
|
||||
onEditingFinished: persistentSettings.daemonFlags = daemonFlags.text;
|
||||
error: text.match(/(^|\s)--(data-dir|bootstrap-daemon-address)/)
|
||||
onEditingFinished: {
|
||||
if (!daemonFlags.error) {
|
||||
persistentSettings.daemonFlags = daemonFlags.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
@@ -427,8 +417,8 @@ Rectangle{
|
||||
Layout.minimumWidth: 100
|
||||
Layout.bottomMargin: 20
|
||||
|
||||
daemonAddrLabelText: qsTr("Bootstrap Address")
|
||||
daemonPortLabelText: qsTr("Bootstrap Port")
|
||||
daemonAddrLabelText: qsTr("Bootstrap Address") + translationManager.emptyString
|
||||
daemonPortLabelText: qsTr("Bootstrap Port") + translationManager.emptyString
|
||||
daemonAddrText: persistentSettings.bootstrapNodeAddress.split(":")[0].trim()
|
||||
daemonPortText: {
|
||||
var node_split = persistentSettings.bootstrapNodeAddress.split(":");
|
||||
|
||||
@@ -30,6 +30,7 @@ import QtQuick 2.9
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Dialogs 1.2
|
||||
import FontAwesome 1.0
|
||||
|
||||
import "../../js/Utils.js" as Utils
|
||||
import "../../components" as MoneroComponents
|
||||
@@ -47,10 +48,10 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 20
|
||||
anchors.topMargin: 0
|
||||
spacing: 8
|
||||
spacing: 0
|
||||
|
||||
MoneroComponents.SettingsListItem {
|
||||
buttonText: qsTr("Close wallet") + translationManager.emptyString
|
||||
iconText: FontAwesome.signOutAlt
|
||||
description: qsTr("Logs out of this wallet.") + translationManager.emptyString
|
||||
title: qsTr("Close this wallet") + translationManager.emptyString
|
||||
|
||||
@@ -58,7 +59,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MoneroComponents.SettingsListItem {
|
||||
buttonText: qsTr("Create wallet") + translationManager.emptyString
|
||||
iconText: FontAwesome.eye
|
||||
description: qsTr("Creates a new wallet that can only view and initiate transactions, but requires a spendable wallet to sign transactions before sending.") + translationManager.emptyString
|
||||
title: qsTr("Create a view-only wallet") + translationManager.emptyString
|
||||
visible: !appWindow.viewOnly
|
||||
@@ -80,7 +81,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MoneroComponents.SettingsListItem {
|
||||
buttonText: qsTr("Show seed") + translationManager.emptyString
|
||||
iconText: FontAwesome.key
|
||||
description: qsTr("Store this information safely to recover your wallet in the future.") + translationManager.emptyString
|
||||
title: qsTr("Show seed & keys") + translationManager.emptyString
|
||||
|
||||
@@ -90,7 +91,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MoneroComponents.SettingsListItem {
|
||||
buttonText: qsTr("Rescan") + translationManager.emptyString
|
||||
iconText: FontAwesome.repeat
|
||||
description: qsTr("Use this feature if you think the shown balance is not accurate.") + translationManager.emptyString
|
||||
title: qsTr("Rescan wallet balance") + translationManager.emptyString
|
||||
visible: appWindow.walletMode >= 2
|
||||
@@ -114,7 +115,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MoneroComponents.SettingsListItem {
|
||||
buttonText: qsTr("Change password") + translationManager.emptyString
|
||||
iconText: FontAwesome.ellipsisH
|
||||
description: qsTr("Change the password of your wallet.") + translationManager.emptyString
|
||||
title: qsTr("Change wallet password") + translationManager.emptyString
|
||||
|
||||
@@ -135,6 +136,19 @@ Rectangle {
|
||||
passwordDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.SettingsListItem {
|
||||
iconText: FontAwesome.cashRegister
|
||||
isLast: true
|
||||
description: qsTr("Receive Monero for your business, easily.") + translationManager.emptyString
|
||||
title: qsTr("Enter merchant mode") + translationManager.emptyString
|
||||
|
||||
onClicked: {
|
||||
middlePanel.state = "Merchant";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
||||
27
qml.qrc
@@ -3,16 +3,16 @@
|
||||
<file>main.qml</file>
|
||||
<file>LeftPanel.qml</file>
|
||||
<file>MiddlePanel.qml</file>
|
||||
<file>images/download-white.png</file>
|
||||
<file>images/download-white@2x.png</file>
|
||||
<file>images/external-link-white.png</file>
|
||||
<file>images/external-link-white@2x.png</file>
|
||||
<file>components/Label.qml</file>
|
||||
<file>components/SettingsListItem.qml</file>
|
||||
<file>components/Slider.qml</file>
|
||||
<file>components/UpdateDialog.qml</file>
|
||||
<file>images/whatIsIcon.png</file>
|
||||
<file>images/whatIsIcon@2x.png</file>
|
||||
<file>images/lockIcon.png</file>
|
||||
<file>components/MenuButton.qml</file>
|
||||
<file>monero/utils/gpg_keys/binaryfate.asc</file>
|
||||
<file>monero/utils/gpg_keys/fluffypony.asc</file>
|
||||
<file>monero/utils/gpg_keys/luigi1111.asc</file>
|
||||
<file>pages/Account.qml</file>
|
||||
<file>pages/Transfer.qml</file>
|
||||
<file>pages/History.qml</file>
|
||||
@@ -27,7 +27,7 @@
|
||||
<file>components/TipItem.qml</file>
|
||||
<file>images/tip.png</file>
|
||||
<file>components/MenuButtonDivider.qml</file>
|
||||
<file>images/moneroIcon.png</file>
|
||||
<file>images/monero-vector.svg</file>
|
||||
<file>components/StandardDropdown.qml</file>
|
||||
<file>images/whiteDropIndicator.png</file>
|
||||
<file>images/whiteDropIndicator@2x.png</file>
|
||||
@@ -38,7 +38,6 @@
|
||||
<file>images/prevMonth.png</file>
|
||||
<file>images/prevMonth@2x.png</file>
|
||||
<file>components/TitleBar.qml</file>
|
||||
<file>images/moneroLogo2.png</file>
|
||||
<file>images/resize.png</file>
|
||||
<file>images/resize@2x.png</file>
|
||||
<file>images/resizeHovered.png</file>
|
||||
@@ -89,6 +88,7 @@
|
||||
<file>lang/flags/gb.png</file>
|
||||
<file>lang/flags/us.png</file>
|
||||
<file>lang/flags/pirate.png</file>
|
||||
<file>lang/flags/nb_NO.png</file>
|
||||
<file>pages/Receive.qml</file>
|
||||
<file>pages/TxKey.qml</file>
|
||||
<file>pages/SharedRingDB.qml</file>
|
||||
@@ -99,11 +99,11 @@
|
||||
<file>components/ProcessingSplash.qml</file>
|
||||
<file>components/ProgressBar.qml</file>
|
||||
<file>components/StandardDialog.qml</file>
|
||||
<file>components/DevicePassphraseDialog.qml</file>
|
||||
<file>pages/Sign.qml</file>
|
||||
<file>components/DaemonManagerDialog.qml</file>
|
||||
<file>version.js</file>
|
||||
<file>components/QRCodeScanner.qml</file>
|
||||
<file>components/Notifier.qml</file>
|
||||
<file>components/TextBlock.qml</file>
|
||||
<file>components/RemoteNodeEdit.qml</file>
|
||||
<file>pages/Keys.qml</file>
|
||||
@@ -113,8 +113,6 @@
|
||||
<file>images/card-background-white.png</file>
|
||||
<file>images/card-background-white@2x.png</file>
|
||||
<file>images/moneroLogo_white.png</file>
|
||||
<file>images/question.png</file>
|
||||
<file>images/question@2x.png</file>
|
||||
<file>images/titlebarLogo.png</file>
|
||||
<file>images/titlebarLogo@2x.png</file>
|
||||
<file>pages/merchant/MerchantTitlebar.qml</file>
|
||||
@@ -191,7 +189,6 @@
|
||||
<file>wizard/WizardHeader.qml</file>
|
||||
<file>wizard/WizardHome.qml</file>
|
||||
<file>wizard/WizardLanguage.qml</file>
|
||||
<file>wizard/WizardLang.qml</file>
|
||||
<file>wizard/WizardNav.qml</file>
|
||||
<file>wizard/WizardWalletInput.qml</file>
|
||||
<file>wizard/WizardRestoreWallet1.qml</file>
|
||||
@@ -207,7 +204,6 @@
|
||||
<file>js/Wizard.js</file>
|
||||
<file>components/LanguageSidebar.qml</file>
|
||||
<file>images/world-flags-globe.png</file>
|
||||
<file>images/langFlagGrey.png</file>
|
||||
<file>images/restore-wallet-from-hardware@2x.png</file>
|
||||
<file>images/restore-wallet-from-hardware.png</file>
|
||||
<file>images/open-wallet-from-file@2x.png</file>
|
||||
@@ -222,12 +218,9 @@
|
||||
<file>images/local-node@2x.png</file>
|
||||
<file>images/local-node-full.png</file>
|
||||
<file>images/local-node-full@2x.png</file>
|
||||
<file>wizard/WizardNavProgressDot.qml</file>
|
||||
<file>wizard/WizardOpenWallet1.qml</file>
|
||||
<file>images/arrow-right-in-circle.png</file>
|
||||
<file>images/arrow-right-in-circle@2x.png</file>
|
||||
<file>images/themes/white/leftPanelBg.jpg</file>
|
||||
<file>images/themes/white/middlePanelBg.jpg</file>
|
||||
<file>images/right.svg</file>
|
||||
<file>images/middlePanelShadow.png</file>
|
||||
<file>images/themes/white/titlebarLogo@2x.png</file>
|
||||
@@ -238,7 +231,6 @@
|
||||
<file>images/themes/white/close.svg</file>
|
||||
<file>images/themes/white/fullscreen.svg</file>
|
||||
<file>images/themes/white/minimize.svg</file>
|
||||
<file>images/themes/white/question.svg</file>
|
||||
<file>components/effects/ColorTransition.qml</file>
|
||||
<file>components/effects/GradientBackground.qml</file>
|
||||
<file>images/check-white.svg</file>
|
||||
@@ -246,5 +238,8 @@
|
||||
<file>images/edit.svg</file>
|
||||
<file>images/arrow-right-in-circle-outline-medium-white.svg</file>
|
||||
<file>images/tails-grey.png</file>
|
||||
<file>components/AdvancedOptionsItem.qml</file>
|
||||
<file>images/busy-indicator.png</file>
|
||||
<file>images/busy-indicator@2x.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -23,9 +23,18 @@
|
||||
<key>CFBundleName</key>
|
||||
<string>Monero GUI</string>
|
||||
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2014-2020 The Monero Project</string>
|
||||
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.monero-project.monero-wallet-gui</string>
|
||||
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@VERSION_LONG@</string>
|
||||
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@VERSION@</string>
|
||||
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ add_subdirectory(QR-Code-scanner)
|
||||
add_subdirectory(daemon)
|
||||
add_subdirectory(libwalletqt)
|
||||
add_subdirectory(model)
|
||||
add_subdirectory(openpgp)
|
||||
add_subdirectory(zxcvbn-c)
|
||||
|
||||
qt5_add_resources(RESOURCES ../qml.qrc)
|
||||
@@ -14,7 +15,9 @@ file(GLOB SOURCE_FILES
|
||||
"main/*.h"
|
||||
"main/*.cpp"
|
||||
"libwalletqt/WalletManager.cpp"
|
||||
"libwalletqt/WalletListenerImpl.cpp"
|
||||
"libwalletqt/Wallet.cpp"
|
||||
"libwalletqt/PassphraseHelper.cpp"
|
||||
"libwalletqt/PendingTransaction.cpp"
|
||||
"libwalletqt/TransactionHistory.cpp"
|
||||
"libwalletqt/TransactionInfo.cpp"
|
||||
@@ -28,6 +31,7 @@ file(GLOB SOURCE_FILES
|
||||
"libwalletqt/UnsignedTransaction.cpp"
|
||||
"libwalletqt/WalletManager.h"
|
||||
"libwalletqt/Wallet.h"
|
||||
"libwalletqt/PassphraseHelper.h"
|
||||
"libwalletqt/PendingTransaction.h"
|
||||
"libwalletqt/TransactionHistory.h"
|
||||
"libwalletqt/TransactionInfo.h"
|
||||
@@ -76,27 +80,29 @@ if(MINGW)
|
||||
list(APPEND RESOURCES ${ICON_RES})
|
||||
endif()
|
||||
|
||||
add_executable(monero-gui ${EXECUTABLE_FLAG} main/main.cpp
|
||||
add_executable(monero-wallet-gui ${EXECUTABLE_FLAG} main/main.cpp
|
||||
${SOURCE_FILES}
|
||||
${PASS_STRENGTH_FILES}
|
||||
${QR_CODE_FILES}
|
||||
${RESOURCES}
|
||||
)
|
||||
set_property(TARGET monero-gui PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
set_property(TARGET monero-wallet-gui PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
|
||||
# OpenGL
|
||||
target_include_directories(monero-gui PUBLIC ${OPENGL_INCLUDE_DIR})
|
||||
target_include_directories(monero-wallet-gui PUBLIC ${OPENGL_INCLUDE_DIR})
|
||||
message(STATUS "OpenGL: include dir at ${OPENGL_INCLUDE_DIR}")
|
||||
message(STATUS "OpenGL: libraries at ${OPENGL_LIBRARIES}")
|
||||
|
||||
target_include_directories(monero-gui PUBLIC ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
||||
target_include_directories(monero-wallet-gui PUBLIC ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
||||
|
||||
file(GLOB_RECURSE SRC_SOURCES *.cpp)
|
||||
file(GLOB_RECURSE SRC_HEADERS *.h)
|
||||
|
||||
target_include_directories(monero-gui PUBLIC
|
||||
target_include_directories(monero-wallet-gui PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/monero/include
|
||||
${CMAKE_SOURCE_DIR}/monero/src
|
||||
${CMAKE_SOURCE_DIR}/monero/external/easylogging++
|
||||
${CMAKE_SOURCE_DIR}/monero/contrib/epee/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/daemon
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libwalletqt
|
||||
@@ -112,24 +118,23 @@ target_include_directories(monero-gui PUBLIC
|
||||
${ZBAR_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_compile_definitions(monero-gui
|
||||
target_compile_definitions(monero-wallet-gui
|
||||
PUBLIC
|
||||
${Qt5Widgets_DEFINITIONS}
|
||||
${Qt5Qml_DEFINITIONS}
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
|
||||
if(X11_FOUND)
|
||||
target_link_libraries(monero-gui ${X11_LIBRARIES} pthread dl Xt xcb X11)
|
||||
target_link_libraries(monero-wallet-gui ${X11_LIBRARIES} pthread dl Xt xcb X11)
|
||||
endif()
|
||||
|
||||
if(DEVICE_TREZOR_READY)
|
||||
target_link_libraries(monero-gui ${TREZOR_DEP_LIBS})
|
||||
target_link_libraries(monero-wallet-gui ${TREZOR_DEP_LIBS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(monero-gui
|
||||
target_link_libraries(monero-wallet-gui
|
||||
${CMAKE_BINARY_DIR}/lib/libwallet_merged.a
|
||||
${LMDB_LIBRARY}
|
||||
${CMAKE_BINARY_DIR}/monero/contrib/epee/src/libepee.a
|
||||
@@ -147,10 +152,11 @@ target_link_libraries(monero-gui
|
||||
${QT5_LIBRARIES}
|
||||
${EXTRA_LIBRARIES}
|
||||
${ICU_LIBRARIES}
|
||||
openpgp
|
||||
)
|
||||
|
||||
if(WITH_SCANNER)
|
||||
target_link_libraries(monero-gui
|
||||
target_link_libraries(monero-wallet-gui
|
||||
${ZBAR_LIBRARIES}
|
||||
jpeg
|
||||
v4l2
|
||||
@@ -159,6 +165,6 @@ if(WITH_SCANNER)
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS monero-gui
|
||||
install(TARGETS monero-wallet-gui
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
@@ -80,7 +80,11 @@ bool QrScanThread::zimageFromQImage(const QImage &qimg, zbar::Image &dst)
|
||||
unsigned int bpl( qimg.bytesPerLine() ), width( bpl / 4), height( qimg.height());
|
||||
dst.set_size(width, height);
|
||||
dst.set_format("BGR4");
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
unsigned long datalen = qimg.sizeInBytes();
|
||||
#else
|
||||
unsigned long datalen = qimg.byteCount();
|
||||
#endif
|
||||
dst.set_data(qimg.bits(), datalen);
|
||||
if((width * 4 != bpl) || (width * height * 4 > datalen)){
|
||||
emit notifyError(QString("QImage to Zbar::Image failed !"));
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "DaemonManager.h"
|
||||
#include <QElapsedTimer>
|
||||
#include <QFile>
|
||||
#include <QMutexLocker>
|
||||
#include <QThread>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
@@ -36,7 +38,6 @@
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QApplication>
|
||||
#include <QProcess>
|
||||
#include <QTime>
|
||||
#include <QStorageInfo>
|
||||
#include <QVariantMap>
|
||||
#include <QVariant>
|
||||
@@ -49,13 +50,15 @@ namespace {
|
||||
DaemonManager * DaemonManager::m_instance = nullptr;
|
||||
QStringList DaemonManager::m_clArgs;
|
||||
|
||||
DaemonManager *DaemonManager::instance(const QStringList *args)
|
||||
DaemonManager *DaemonManager::instance(const QStringList *args/* = nullptr*/)
|
||||
{
|
||||
if (!m_instance) {
|
||||
m_instance = new DaemonManager;
|
||||
// store command line arguments for later use
|
||||
m_clArgs = *args;
|
||||
m_clArgs.removeFirst();
|
||||
if (args != nullptr)
|
||||
{
|
||||
m_clArgs = *args;
|
||||
}
|
||||
}
|
||||
|
||||
return m_instance;
|
||||
@@ -63,6 +66,12 @@ DaemonManager *DaemonManager::instance(const QStringList *args)
|
||||
|
||||
bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const QString &dataDir, const QString &bootstrapNodeAddress, bool noSync /* = false*/)
|
||||
{
|
||||
if (!QFileInfo(m_monerod).isFile())
|
||||
{
|
||||
emit daemonStartFailure("\"" + QDir::toNativeSeparators(m_monerod) + "\" " + tr("executable is missing"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// prepare command line arguments and pass to monerod
|
||||
QStringList arguments;
|
||||
|
||||
@@ -115,22 +124,23 @@ bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const
|
||||
qDebug() << "starting monerod " + m_monerod;
|
||||
qDebug() << "With command line arguments " << arguments;
|
||||
|
||||
m_daemon = new QProcess();
|
||||
initialized = true;
|
||||
QMutexLocker locker(&m_daemonMutex);
|
||||
|
||||
m_daemon.reset(new QProcess());
|
||||
|
||||
// Connect output slots
|
||||
connect (m_daemon, SIGNAL(readyReadStandardOutput()), this, SLOT(printOutput()));
|
||||
connect (m_daemon, SIGNAL(readyReadStandardError()), this, SLOT(printError()));
|
||||
connect(m_daemon.get(), SIGNAL(readyReadStandardOutput()), this, SLOT(printOutput()));
|
||||
connect(m_daemon.get(), SIGNAL(readyReadStandardError()), this, SLOT(printError()));
|
||||
|
||||
// Start monerod
|
||||
bool started = m_daemon->startDetached(m_monerod, arguments);
|
||||
|
||||
// add state changed listener
|
||||
connect(m_daemon,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(stateChanged(QProcess::ProcessState)));
|
||||
connect(m_daemon.get(), SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(stateChanged(QProcess::ProcessState)));
|
||||
|
||||
if (!started) {
|
||||
qDebug() << "Daemon start error: " + m_daemon->errorString();
|
||||
emit daemonStartFailure();
|
||||
emit daemonStartFailure(m_daemon->errorString());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -140,35 +150,33 @@ bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const
|
||||
emit daemonStarted();
|
||||
m_noSync = noSync;
|
||||
} else {
|
||||
emit daemonStartFailure();
|
||||
emit daemonStartFailure(tr("Timed out, local node is not responding after %1 seconds").arg(DAEMON_START_TIMEOUT_SECONDS));
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DaemonManager::stop(NetworkType::Type nettype)
|
||||
void DaemonManager::stopAsync(NetworkType::Type nettype, const QJSValue& callback)
|
||||
{
|
||||
QString message;
|
||||
sendCommand({"exit"}, nettype, message);
|
||||
qDebug() << message;
|
||||
const auto feature = m_scheduler.run([this, nettype] {
|
||||
QString message;
|
||||
sendCommand({"exit"}, nettype, message);
|
||||
|
||||
// Start stop watcher - Will kill if not shutting down
|
||||
m_scheduler.run([this, nettype] {
|
||||
if (stopWatcher(nettype))
|
||||
{
|
||||
emit daemonStopped();
|
||||
}
|
||||
});
|
||||
return QJSValueList({stopWatcher(nettype)});
|
||||
}, callback);
|
||||
|
||||
return true;
|
||||
if (!feature.first)
|
||||
{
|
||||
QJSValue(callback).call(QJSValueList({false}));
|
||||
}
|
||||
}
|
||||
|
||||
bool DaemonManager::startWatcher(NetworkType::Type nettype) const
|
||||
{
|
||||
// Check if daemon is started every 2 seconds
|
||||
QTime timer;
|
||||
timer.restart();
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
while(true && !m_app_exit && timer.elapsed() / 1000 < DAEMON_START_TIMEOUT_SECONDS ) {
|
||||
QThread::sleep(2);
|
||||
if(!running(nettype)) {
|
||||
@@ -194,9 +202,9 @@ bool DaemonManager::stopWatcher(NetworkType::Type nettype) const
|
||||
if(counter >= 5) {
|
||||
qDebug() << "Killing it! ";
|
||||
#ifdef Q_OS_WIN
|
||||
QProcess::execute("taskkill /F /IM monerod.exe");
|
||||
QProcess::execute("taskkill", {"/F", "/IM", "monerod.exe"});
|
||||
#else
|
||||
QProcess::execute("pkill monerod");
|
||||
QProcess::execute("pkill", {"monerod"});
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -217,7 +225,10 @@ void DaemonManager::stateChanged(QProcess::ProcessState state)
|
||||
|
||||
void DaemonManager::printOutput()
|
||||
{
|
||||
QByteArray byteArray = m_daemon->readAllStandardOutput();
|
||||
QByteArray byteArray = [this]() {
|
||||
QMutexLocker locker(&m_daemonMutex);
|
||||
return m_daemon->readAllStandardOutput();
|
||||
}();
|
||||
QStringList strLines = QString(byteArray).split("\n");
|
||||
|
||||
foreach (QString line, strLines) {
|
||||
@@ -228,7 +239,10 @@ void DaemonManager::printOutput()
|
||||
|
||||
void DaemonManager::printError()
|
||||
{
|
||||
QByteArray byteArray = m_daemon->readAllStandardError();
|
||||
QByteArray byteArray = [this]() {
|
||||
QMutexLocker locker(&m_daemonMutex);
|
||||
return m_daemon->readAllStandardError();
|
||||
}();
|
||||
QStringList strLines = QString(byteArray).split("\n");
|
||||
|
||||
foreach (QString line, strLines) {
|
||||
@@ -345,7 +359,6 @@ DaemonManager::DaemonManager(QObject *parent)
|
||||
|
||||
if (m_monerod.length() == 0) {
|
||||
qCritical() << "no daemon binary defined for current platform";
|
||||
m_has_daemon = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
#ifndef DAEMONMANAGER_H
|
||||
#define DAEMONMANAGER_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
#include <QProcess>
|
||||
@@ -42,10 +45,10 @@ class DaemonManager : public QObject
|
||||
|
||||
public:
|
||||
|
||||
static DaemonManager * instance(const QStringList *args);
|
||||
static DaemonManager * instance(const QStringList *args = nullptr);
|
||||
|
||||
Q_INVOKABLE bool start(const QString &flags, NetworkType::Type nettype, const QString &dataDir = "", const QString &bootstrapNodeAddress = "", bool noSync = false);
|
||||
Q_INVOKABLE bool stop(NetworkType::Type nettype);
|
||||
Q_INVOKABLE void stopAsync(NetworkType::Type nettype, const QJSValue& callback);
|
||||
|
||||
Q_INVOKABLE bool noSync() const noexcept;
|
||||
// return true if daemon process is started
|
||||
@@ -64,7 +67,7 @@ private:
|
||||
signals:
|
||||
void daemonStarted() const;
|
||||
void daemonStopped() const;
|
||||
void daemonStartFailure() const;
|
||||
void daemonStartFailure(const QString &error) const;
|
||||
void daemonConsoleUpdated(QString message) const;
|
||||
|
||||
public slots:
|
||||
@@ -78,10 +81,9 @@ private:
|
||||
|
||||
static DaemonManager * m_instance;
|
||||
static QStringList m_clArgs;
|
||||
QProcess *m_daemon;
|
||||
bool initialized = false;
|
||||
std::unique_ptr<QProcess> m_daemon;
|
||||
QMutex m_daemonMutex;
|
||||
QString m_monerod;
|
||||
bool m_has_daemon = true;
|
||||
bool m_app_exit = false;
|
||||
bool m_noSync = false;
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
AddressBook::AddressBook(Monero::AddressBook *abImpl,QObject *parent)
|
||||
: QObject(parent), m_addressBookImpl(abImpl)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
getAll();
|
||||
}
|
||||
|
||||
@@ -46,58 +45,97 @@ int AddressBook::errorCode() const
|
||||
return m_addressBookImpl->errorCode();
|
||||
}
|
||||
|
||||
QList<Monero::AddressBookRow*> AddressBook::getAll(bool update) const
|
||||
void AddressBook::getAll()
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
|
||||
emit refreshStarted();
|
||||
|
||||
if(update)
|
||||
m_rows.clear();
|
||||
{
|
||||
QWriteLocker locker(&m_lock);
|
||||
|
||||
if (m_rows.empty()){
|
||||
m_addresses.clear();
|
||||
m_rows.clear();
|
||||
for (auto &abr: m_addressBookImpl->getAll()) {
|
||||
m_addresses.insert(QString::fromStdString(abr->getAddress()), m_rows.size());
|
||||
m_rows.append(abr);
|
||||
}
|
||||
}
|
||||
|
||||
emit refreshFinished();
|
||||
return m_rows;
|
||||
|
||||
}
|
||||
|
||||
Monero::AddressBookRow * AddressBook::getRow(int index) const
|
||||
bool AddressBook::getRow(int index, std::function<void (Monero::AddressBookRow &)> callback) const
|
||||
{
|
||||
return m_rows.at(index);
|
||||
QReadLocker locker(&m_lock);
|
||||
|
||||
if (index < 0 || index >= m_rows.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
callback(*m_rows.value(index));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AddressBook::addRow(const QString &address, const QString &payment_id, const QString &description) const
|
||||
bool AddressBook::addRow(const QString &address, const QString &payment_id, const QString &description)
|
||||
{
|
||||
// virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0;
|
||||
bool r = m_addressBookImpl->addRow(address.toStdString(), payment_id.toStdString(), description.toStdString());
|
||||
bool result;
|
||||
|
||||
if(r)
|
||||
getAll(true);
|
||||
{
|
||||
QWriteLocker locker(&m_lock);
|
||||
|
||||
return r;
|
||||
result = m_addressBookImpl->addRow(address.toStdString(), payment_id.toStdString(), description.toStdString());
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
getAll();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AddressBook::deleteRow(int rowId) const
|
||||
bool AddressBook::deleteRow(int rowId)
|
||||
{
|
||||
bool r = m_addressBookImpl->deleteRow(rowId);
|
||||
bool result;
|
||||
|
||||
{
|
||||
QWriteLocker locker(&m_lock);
|
||||
|
||||
result = m_addressBookImpl->deleteRow(rowId);
|
||||
}
|
||||
|
||||
// Fetch new data from wallet2.
|
||||
getAll(true);
|
||||
if (result)
|
||||
{
|
||||
getAll();
|
||||
}
|
||||
|
||||
return r;
|
||||
return result;
|
||||
}
|
||||
|
||||
quint64 AddressBook::count() const
|
||||
{
|
||||
QReadLocker locker(&m_lock);
|
||||
|
||||
return m_rows.size();
|
||||
}
|
||||
|
||||
int AddressBook::lookupPaymentID(const QString &payment_id) const
|
||||
{
|
||||
QReadLocker locker(&m_lock);
|
||||
|
||||
return m_addressBookImpl->lookupPaymentID(payment_id.toStdString());
|
||||
}
|
||||
|
||||
QString AddressBook::getDescription(const QString &address) const
|
||||
{
|
||||
QReadLocker locker(&m_lock);
|
||||
|
||||
const QMap<QString, size_t>::const_iterator it = m_addresses.find(address);
|
||||
if (it == m_addresses.end())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
return QString::fromStdString(m_rows.value(*it)->getDescription());
|
||||
}
|
||||
|
||||
@@ -30,12 +30,14 @@
|
||||
#define ADDRESSBOOK_H
|
||||
|
||||
#include <wallet/api/wallet2_api.h>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QReadWriteLock>
|
||||
#include <QList>
|
||||
#include <QDateTime>
|
||||
|
||||
namespace Monero {
|
||||
class AddressBook;
|
||||
struct AddressBook;
|
||||
}
|
||||
class AddressBookRow;
|
||||
|
||||
@@ -43,14 +45,14 @@ class AddressBook : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_INVOKABLE QList<Monero::AddressBookRow*> getAll(bool update = false) const;
|
||||
Q_INVOKABLE Monero::AddressBookRow * getRow(int index) const;
|
||||
Q_INVOKABLE bool addRow(const QString &address, const QString &payment_id, const QString &description) const;
|
||||
Q_INVOKABLE bool deleteRow(int rowId) const;
|
||||
Q_INVOKABLE bool getRow(int index, std::function<void (Monero::AddressBookRow &)> callback) const;
|
||||
Q_INVOKABLE bool addRow(const QString &address, const QString &payment_id, const QString &description);
|
||||
Q_INVOKABLE bool deleteRow(int rowId);
|
||||
quint64 count() const;
|
||||
Q_INVOKABLE QString errorString() const;
|
||||
Q_INVOKABLE int errorCode() const;
|
||||
Q_INVOKABLE int lookupPaymentID(const QString &payment_id) const;
|
||||
Q_INVOKABLE QString getDescription(const QString &address) const;
|
||||
|
||||
enum ErrorCode {
|
||||
Status_Ok,
|
||||
@@ -61,6 +63,8 @@ public:
|
||||
|
||||
Q_ENUM(ErrorCode);
|
||||
|
||||
private:
|
||||
void getAll();
|
||||
|
||||
signals:
|
||||
void refreshStarted() const;
|
||||
@@ -73,7 +77,9 @@ private:
|
||||
explicit AddressBook(Monero::AddressBook * abImpl, QObject *parent);
|
||||
friend class Wallet;
|
||||
Monero::AddressBook * m_addressBookImpl;
|
||||
mutable QList<Monero::AddressBookRow*> m_rows;
|
||||
mutable QReadWriteLock m_lock;
|
||||
QList<Monero::AddressBookRow*> m_rows;
|
||||
QMap<QString, size_t> m_addresses;
|
||||
};
|
||||
|
||||
#endif // ADDRESSBOOK_H
|
||||
|
||||
70
src/libwalletqt/PassphraseHelper.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "PassphraseHelper.h"
|
||||
#include <QMutexLocker>
|
||||
#include <QDebug>
|
||||
|
||||
Monero::optional<std::string> PassphraseHelper::onDevicePassphraseRequest(bool & on_device)
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
QMutexLocker locker(&m_mutex_pass);
|
||||
m_passphrase_on_device = true;
|
||||
m_passphrase_abort = false;
|
||||
|
||||
if (m_prompter != nullptr){
|
||||
m_prompter->onWalletPassphraseNeeded(on_device);
|
||||
}
|
||||
|
||||
m_cond_pass.wait(&m_mutex_pass);
|
||||
|
||||
if (m_passphrase_abort)
|
||||
{
|
||||
throw std::runtime_error("Passphrase entry abort");
|
||||
}
|
||||
|
||||
on_device = m_passphrase_on_device;
|
||||
if (!on_device) {
|
||||
auto tmpPass = m_passphrase.toStdString();
|
||||
m_passphrase = QString();
|
||||
return Monero::optional<std::string>(tmpPass);
|
||||
} else {
|
||||
return Monero::optional<std::string>();
|
||||
}
|
||||
}
|
||||
|
||||
void PassphraseHelper::onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort)
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
QMutexLocker locker(&m_mutex_pass);
|
||||
m_passphrase = passphrase;
|
||||
m_passphrase_abort = entry_abort;
|
||||
m_passphrase_on_device = enter_on_device;
|
||||
|
||||
m_cond_pass.wakeAll();
|
||||
}
|
||||
74
src/libwalletqt/PassphraseHelper.h
Normal file
@@ -0,0 +1,74 @@
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef MONERO_GUI_PASSPHRASEHELPER_H
|
||||
#define MONERO_GUI_PASSPHRASEHELPER_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <wallet/api/wallet2_api.h>
|
||||
#include <QMutex>
|
||||
#include <QPointer>
|
||||
#include <QWaitCondition>
|
||||
#include <QMutex>
|
||||
|
||||
/**
|
||||
* Implements component responsible for showing entry prompt to the user,
|
||||
* typically Wallet / Wallet manager.
|
||||
*/
|
||||
class PassprasePrompter {
|
||||
public:
|
||||
virtual void onWalletPassphraseNeeded(bool onDevice) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Implements receiver of the passphrase responsible for passing it back to the wallet,
|
||||
* typically wallet listener.
|
||||
*/
|
||||
class PassphraseReceiver {
|
||||
public:
|
||||
virtual void onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort) = 0;
|
||||
};
|
||||
|
||||
class PassphraseHelper {
|
||||
public:
|
||||
PassphraseHelper(PassprasePrompter * prompter=nullptr): m_prompter(prompter) {};
|
||||
PassphraseHelper(const PassphraseHelper & h): PassphraseHelper(h.m_prompter) {};
|
||||
Monero::optional<std::string> onDevicePassphraseRequest(bool & on_device);
|
||||
void onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort);
|
||||
|
||||
private:
|
||||
PassprasePrompter * m_prompter;
|
||||
QWaitCondition m_cond_pass;
|
||||
QMutex m_mutex_pass;
|
||||
QString m_passphrase;
|
||||
bool m_passphrase_abort;
|
||||
bool m_passphrase_on_device;
|
||||
|
||||
};
|
||||
|
||||
#endif //MONERO_GUI_PASSPHRASEHELPER_H
|
||||
@@ -32,14 +32,11 @@
|
||||
Subaddress::Subaddress(Monero::Subaddress *subaddressImpl, QObject *parent)
|
||||
: QObject(parent), m_subaddressImpl(subaddressImpl)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
getAll();
|
||||
}
|
||||
|
||||
void Subaddress::getAll() const
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
|
||||
emit refreshStarted();
|
||||
|
||||
{
|
||||
|
||||
@@ -32,14 +32,11 @@
|
||||
SubaddressAccount::SubaddressAccount(Monero::SubaddressAccount *subaddressAccountImpl, QObject *parent)
|
||||
: QObject(parent), m_subaddressAccountImpl(subaddressAccountImpl)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
getAll();
|
||||
}
|
||||
|
||||
void SubaddressAccount::getAll() const
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
|
||||
emit refreshStarted();
|
||||
|
||||
{
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <QDebug>
|
||||
#include <QReadLocker>
|
||||
#include <QWriteLocker>
|
||||
#include <QtGlobal>
|
||||
|
||||
|
||||
bool TransactionHistory::transaction(int index, std::function<void (TransactionInfo &)> callback)
|
||||
@@ -58,7 +59,11 @@ bool TransactionHistory::transaction(int index, std::function<void (TransactionI
|
||||
|
||||
void TransactionHistory::refresh(quint32 accountIndex)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
QDateTime firstDateTime = QDate(2014, 4, 18).startOfDay();
|
||||
#else
|
||||
QDateTime firstDateTime = QDateTime(QDate(2014, 4, 18)); // the genesis block
|
||||
#endif
|
||||
QDateTime lastDateTime = QDateTime::currentDateTime().addDays(1); // tomorrow (guard against jitter and timezones)
|
||||
|
||||
emit refreshStarted();
|
||||
@@ -143,7 +148,11 @@ bool TransactionHistory::TransactionHistory::locked() const
|
||||
TransactionHistory::TransactionHistory(Monero::TransactionHistory *pimpl, QObject *parent)
|
||||
: QObject(parent), m_pimpl(pimpl), m_minutesToUnlock(0), m_locked(false)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
m_firstDateTime = QDate(2014, 4, 18).startOfDay();
|
||||
#else
|
||||
m_firstDateTime = QDateTime(QDate(2014, 4, 18)); // the genesis block
|
||||
#endif
|
||||
m_lastDateTime = QDateTime::currentDateTime().addDays(1); // tomorrow (guard against jitter and timezones)
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <QDateTime>
|
||||
|
||||
namespace Monero {
|
||||
class TransactionHistory;
|
||||
struct TransactionHistory;
|
||||
}
|
||||
|
||||
class TransactionInfo;
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
|
||||
namespace {
|
||||
@@ -59,66 +58,6 @@ namespace {
|
||||
static constexpr char ATTRIBUTE_SUBADDRESS_ACCOUNT[] ="gui.subaddress_account";
|
||||
}
|
||||
|
||||
class WalletListenerImpl : public Monero::WalletListener
|
||||
{
|
||||
public:
|
||||
WalletListenerImpl(Wallet * w)
|
||||
: m_wallet(w)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual void moneySpent(const std::string &txId, uint64_t amount)
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->moneySpent(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
|
||||
virtual void moneyReceived(const std::string &txId, uint64_t amount)
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->moneyReceived(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount)
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->unconfirmedMoneyReceived(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
virtual void newBlock(uint64_t height)
|
||||
{
|
||||
// qDebug() << __FUNCTION__;
|
||||
emit m_wallet->newBlock(height, m_wallet->daemonBlockChainTargetHeight());
|
||||
}
|
||||
|
||||
virtual void updated()
|
||||
{
|
||||
emit m_wallet->updated();
|
||||
}
|
||||
|
||||
// called when wallet refreshed by background thread or explicitly
|
||||
virtual void refreshed()
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->refreshed();
|
||||
}
|
||||
|
||||
virtual void onDeviceButtonRequest(uint64_t code) override
|
||||
{
|
||||
emit m_wallet->deviceButtonRequest(code);
|
||||
}
|
||||
|
||||
virtual void onDeviceButtonPressed() override
|
||||
{
|
||||
emit m_wallet->deviceButtonPressed();
|
||||
}
|
||||
|
||||
private:
|
||||
Wallet * m_wallet;
|
||||
};
|
||||
|
||||
Wallet::Wallet(QObject * parent)
|
||||
: Wallet(nullptr, parent)
|
||||
{
|
||||
@@ -153,12 +92,14 @@ NetworkType::Type Wallet::nettype() const
|
||||
void Wallet::updateConnectionStatusAsync()
|
||||
{
|
||||
m_scheduler.run([this] {
|
||||
if (m_connectionStatus == Wallet::ConnectionStatus_Disconnected)
|
||||
{
|
||||
setConnectionStatus(ConnectionStatus_Connecting);
|
||||
}
|
||||
ConnectionStatus newStatus = static_cast<ConnectionStatus>(m_walletImpl->connected());
|
||||
if (newStatus != m_connectionStatus || !m_initialized) {
|
||||
m_initialized = true;
|
||||
m_connectionStatus = newStatus;
|
||||
qDebug() << "NEW STATUS " << newStatus;
|
||||
emit connectionStatusChanged(newStatus);
|
||||
setConnectionStatus(newStatus);
|
||||
}
|
||||
// Release lock
|
||||
m_connectionStatusRunning = false;
|
||||
@@ -178,6 +119,31 @@ Wallet::ConnectionStatus Wallet::connected(bool forceCheck)
|
||||
return m_connectionStatus;
|
||||
}
|
||||
|
||||
bool Wallet::disconnected() const
|
||||
{
|
||||
return m_disconnected;
|
||||
}
|
||||
|
||||
void Wallet::setConnectionStatus(ConnectionStatus value)
|
||||
{
|
||||
if (m_connectionStatus == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_connectionStatus = value;
|
||||
emit connectionStatusChanged(m_connectionStatus);
|
||||
|
||||
bool disconnected = m_connectionStatus == Wallet::ConnectionStatus_Connecting ||
|
||||
m_connectionStatus == Wallet::ConnectionStatus_Disconnected;
|
||||
|
||||
if (m_disconnected != disconnected)
|
||||
{
|
||||
m_disconnected = disconnected;
|
||||
emit disconnectedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool Wallet::synchronized() const
|
||||
{
|
||||
return m_walletImpl->synchronized();
|
||||
@@ -200,12 +166,22 @@ QString Wallet::address(quint32 accountIndex, quint32 addressIndex) const
|
||||
|
||||
QString Wallet::path() const
|
||||
{
|
||||
return QString::fromStdString(m_walletImpl->path());
|
||||
return QDir::toNativeSeparators(QString::fromStdString(m_walletImpl->path()));
|
||||
}
|
||||
|
||||
bool Wallet::store(const QString &path)
|
||||
void Wallet::storeAsync(const QJSValue &callback, const QString &path /* = "" */)
|
||||
{
|
||||
return m_walletImpl->store(path.toStdString());
|
||||
const auto future = m_scheduler.run(
|
||||
[this, path] {
|
||||
QMutexLocker locker(&m_storeMutex);
|
||||
|
||||
return QJSValueList({m_walletImpl->store(path.toStdString())});
|
||||
},
|
||||
callback);
|
||||
if (!future.first)
|
||||
{
|
||||
QJSValue(callback).call(QJSValueList({false}));
|
||||
}
|
||||
}
|
||||
|
||||
bool Wallet::init(const QString &daemonAddress, bool trustedDaemon, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight)
|
||||
@@ -237,13 +213,7 @@ void Wallet::setDaemonLogin(const QString &daemonUsername, const QString &daemon
|
||||
void Wallet::initAsync(const QString &daemonAddress, bool trustedDaemon, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight)
|
||||
{
|
||||
qDebug() << "initAsync: " + daemonAddress;
|
||||
// Change status to disconnected if connected
|
||||
if(m_connectionStatus != Wallet::ConnectionStatus_Disconnected) {
|
||||
m_connectionStatus = Wallet::ConnectionStatus_Disconnected;
|
||||
emit connectionStatusChanged(m_connectionStatus);
|
||||
}
|
||||
|
||||
m_scheduler.run([this, daemonAddress, trustedDaemon, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight] {
|
||||
const auto future = m_scheduler.run([this, daemonAddress, trustedDaemon, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight] {
|
||||
bool success = init(daemonAddress, trustedDaemon, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight);
|
||||
if (success)
|
||||
{
|
||||
@@ -253,6 +223,10 @@ void Wallet::initAsync(const QString &daemonAddress, bool trustedDaemon, quint64
|
||||
m_walletImpl->startRefresh();
|
||||
}
|
||||
});
|
||||
if (future.first)
|
||||
{
|
||||
setConnectionStatus(Wallet::ConnectionStatus_Connecting);
|
||||
}
|
||||
}
|
||||
|
||||
bool Wallet::isHwBacked() const
|
||||
@@ -265,6 +239,11 @@ bool Wallet::isLedger() const
|
||||
return m_walletImpl->getDeviceType() == Monero::Wallet::Device_Ledger;
|
||||
}
|
||||
|
||||
bool Wallet::isTrezor() const
|
||||
{
|
||||
return m_walletImpl->getDeviceType() == Monero::Wallet::Device_Trezor;
|
||||
}
|
||||
|
||||
//! create a view only wallet
|
||||
bool Wallet::createViewOnly(const QString &path, const QString &password) const
|
||||
{
|
||||
@@ -575,6 +554,19 @@ void Wallet::disposeTransaction(UnsignedTransaction *t)
|
||||
delete t;
|
||||
}
|
||||
|
||||
void Wallet::estimateTransactionFeeAsync(const QString &destination,
|
||||
quint64 amount,
|
||||
PendingTransaction::Priority priority,
|
||||
const QJSValue &callback)
|
||||
{
|
||||
m_scheduler.run([this, destination, amount, priority] {
|
||||
const uint64_t fee = m_walletImpl->estimateTransactionFee(
|
||||
{std::make_pair(destination.toStdString(), amount)},
|
||||
static_cast<Monero::PendingTransaction::Priority>(priority));
|
||||
return QJSValueList({QString::fromStdString(Monero::Wallet::displayAmount(fee))});
|
||||
}, callback);
|
||||
}
|
||||
|
||||
TransactionHistory *Wallet::history() const
|
||||
{
|
||||
return m_history;
|
||||
@@ -767,7 +759,7 @@ QString Wallet::signMessage(const QString &message, bool filename) const
|
||||
file.close();
|
||||
return "";
|
||||
}
|
||||
std::string signature = m_walletImpl->signMessage(std::string((const char*)data, size));
|
||||
std::string signature = m_walletImpl->signMessage(std::string(reinterpret_cast<const char*>(data), size));
|
||||
file.unmap(data);
|
||||
file.close();
|
||||
return QString::fromStdString(signature);
|
||||
@@ -803,7 +795,7 @@ bool Wallet::verifySignedMessage(const QString &message, const QString &address,
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
bool ret = m_walletImpl->verifySignedMessage(std::string((const char*)data, size), address.toStdString(), signature.toStdString());
|
||||
bool ret = m_walletImpl->verifySignedMessage(std::string(reinterpret_cast<const char*>(data), size), address.toStdString(), signature.toStdString());
|
||||
file.unmap(data);
|
||||
file.close();
|
||||
return ret;
|
||||
@@ -974,6 +966,19 @@ void Wallet::keyReuseMitigation2(bool mitigation)
|
||||
m_walletImpl->keyReuseMitigation2(mitigation);
|
||||
}
|
||||
|
||||
void Wallet::onWalletPassphraseNeeded(bool on_device)
|
||||
{
|
||||
emit this->walletPassphraseNeeded(on_device);
|
||||
}
|
||||
|
||||
void Wallet::onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort)
|
||||
{
|
||||
if (m_walletListener != nullptr)
|
||||
{
|
||||
m_walletListener->onPassphraseEntered(passphrase, enter_on_device, entry_abort);
|
||||
}
|
||||
}
|
||||
|
||||
Wallet::Wallet(Monero::Wallet *w, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_walletImpl(w)
|
||||
@@ -985,7 +990,9 @@ Wallet::Wallet(Monero::Wallet *w, QObject *parent)
|
||||
, m_daemonBlockChainHeightTtl(DAEMON_BLOCKCHAIN_HEIGHT_CACHE_TTL_SECONDS)
|
||||
, m_daemonBlockChainTargetHeight(0)
|
||||
, m_daemonBlockChainTargetHeightTtl(DAEMON_BLOCKCHAIN_TARGET_HEIGHT_CACHE_TTL_SECONDS)
|
||||
, m_connectionStatus(Wallet::ConnectionStatus_Disconnected)
|
||||
, m_connectionStatusTtl(WALLET_CONNECTION_STATUS_CACHE_TTL_SECONDS)
|
||||
, m_disconnected(true)
|
||||
, m_currentSubaddressAccount(0)
|
||||
, m_subaddress(nullptr)
|
||||
, m_subaddressModel(nullptr)
|
||||
@@ -999,12 +1006,11 @@ Wallet::Wallet(Monero::Wallet *w, QObject *parent)
|
||||
m_subaddressAccount = new SubaddressAccount(m_walletImpl->subaddressAccount(), this);
|
||||
m_walletListener = new WalletListenerImpl(this);
|
||||
m_walletImpl->setListener(m_walletListener);
|
||||
m_connectionStatus = Wallet::ConnectionStatus_Disconnected;
|
||||
m_currentSubaddressAccount = getCacheAttribute(ATTRIBUTE_SUBADDRESS_ACCOUNT).toUInt();
|
||||
// start cache timers
|
||||
m_connectionStatusTime.restart();
|
||||
m_daemonBlockChainHeightTime.restart();
|
||||
m_daemonBlockChainTargetHeightTime.restart();
|
||||
m_connectionStatusTime.start();
|
||||
m_daemonBlockChainHeightTime.start();
|
||||
m_daemonBlockChainTargetHeightTime.start();
|
||||
m_initialized = false;
|
||||
m_connectionStatusRunning = false;
|
||||
m_daemonUsername = "";
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#ifndef WALLET_H
|
||||
#define WALLET_H
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include <QObject>
|
||||
#include <QTime>
|
||||
#include <QMutex>
|
||||
#include <QList>
|
||||
#include <QJSValue>
|
||||
@@ -41,9 +41,11 @@
|
||||
#include "PendingTransaction.h" // we need to have an access to the PendingTransaction::Priority enum here;
|
||||
#include "UnsignedTransaction.h"
|
||||
#include "NetworkType.h"
|
||||
#include "PassphraseHelper.h"
|
||||
#include "WalletListenerImpl.h"
|
||||
|
||||
namespace Monero {
|
||||
class Wallet; // forward declaration
|
||||
struct Wallet; // forward declaration
|
||||
}
|
||||
|
||||
|
||||
@@ -57,9 +59,10 @@ class SubaddressModel;
|
||||
class SubaddressAccount;
|
||||
class SubaddressAccountModel;
|
||||
|
||||
class Wallet : public QObject
|
||||
class Wallet : public QObject, public PassprasePrompter
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool disconnected READ disconnected NOTIFY disconnectedChanged)
|
||||
Q_PROPERTY(QString seed READ getSeed)
|
||||
Q_PROPERTY(QString seedLanguage READ getSeedLanguage)
|
||||
Q_PROPERTY(Status status READ status)
|
||||
@@ -73,7 +76,7 @@ class Wallet : public QObject
|
||||
Q_PROPERTY(TransactionHistorySortFilterModel * historyModel READ historyModel NOTIFY historyModelChanged)
|
||||
Q_PROPERTY(QString path READ path)
|
||||
Q_PROPERTY(AddressBookModel * addressBookModel READ addressBookModel)
|
||||
Q_PROPERTY(AddressBook * addressBook READ addressBook)
|
||||
Q_PROPERTY(AddressBook * addressBook READ addressBook NOTIFY addressBookChanged)
|
||||
Q_PROPERTY(SubaddressModel * subaddressModel READ subaddressModel)
|
||||
Q_PROPERTY(Subaddress * subaddress READ subaddress)
|
||||
Q_PROPERTY(SubaddressAccountModel * subaddressAccountModel READ subaddressAccountModel)
|
||||
@@ -100,7 +103,8 @@ public:
|
||||
enum ConnectionStatus {
|
||||
ConnectionStatus_Connected = Monero::Wallet::ConnectionStatus_Connected,
|
||||
ConnectionStatus_Disconnected = Monero::Wallet::ConnectionStatus_Disconnected,
|
||||
ConnectionStatus_WrongVersion = Monero::Wallet::ConnectionStatus_WrongVersion
|
||||
ConnectionStatus_WrongVersion = Monero::Wallet::ConnectionStatus_WrongVersion,
|
||||
ConnectionStatus_Connecting
|
||||
};
|
||||
|
||||
Q_ENUM(ConnectionStatus)
|
||||
@@ -142,7 +146,7 @@ public:
|
||||
|
||||
//! saves wallet to the file by given path
|
||||
//! empty path stores in current location
|
||||
Q_INVOKABLE bool store(const QString &path = "");
|
||||
Q_INVOKABLE void storeAsync(const QJSValue &callback, const QString &path = "");
|
||||
|
||||
//! initializes wallet asynchronously
|
||||
Q_INVOKABLE void initAsync(const QString &daemonAddress, bool trustedDaemon = false, quint64 upperTransactionLimit = 0, bool isRecovering = false, bool isRecoveringFromDevice = false, quint64 restoreHeight = 0);
|
||||
@@ -183,6 +187,7 @@ public:
|
||||
//! hw-device backed wallets
|
||||
Q_INVOKABLE bool isHwBacked() const;
|
||||
Q_INVOKABLE bool isLedger() const;
|
||||
Q_INVOKABLE bool isTrezor() const;
|
||||
|
||||
//! returns if view only wallet
|
||||
Q_INVOKABLE bool viewOnly() const;
|
||||
@@ -248,6 +253,11 @@ public:
|
||||
//! deletes unsigned transaction and frees memory
|
||||
Q_INVOKABLE void disposeTransaction(UnsignedTransaction * t);
|
||||
|
||||
Q_INVOKABLE void estimateTransactionFeeAsync(const QString &destination,
|
||||
quint64 amount,
|
||||
PendingTransaction::Priority priority,
|
||||
const QJSValue &callback);
|
||||
|
||||
//! returns transaction history
|
||||
TransactionHistory * history() const;
|
||||
|
||||
@@ -341,6 +351,10 @@ public:
|
||||
Q_INVOKABLE void segregationHeight(quint64 height);
|
||||
Q_INVOKABLE void keyReuseMitigation2(bool mitigation);
|
||||
|
||||
// Passphrase entry for hardware wallets
|
||||
Q_INVOKABLE void onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort=false);
|
||||
virtual void onWalletPassphraseNeeded(bool on_device) override;
|
||||
|
||||
// TODO: setListenter() when it implemented in API
|
||||
signals:
|
||||
// emitted on every event happened with wallet
|
||||
@@ -355,10 +369,12 @@ signals:
|
||||
void moneyReceived(const QString &txId, quint64 amount);
|
||||
void unconfirmedMoneyReceived(const QString &txId, quint64 amount);
|
||||
void newBlock(quint64 height, quint64 targetHeight);
|
||||
void addressBookChanged() const;
|
||||
void historyModelChanged() const;
|
||||
void walletCreationHeightChanged();
|
||||
void deviceButtonRequest(quint64 buttonCode);
|
||||
void deviceButtonPressed();
|
||||
void walletPassphraseNeeded(bool onDevice);
|
||||
void transactionCommitted(bool status, PendingTransaction *t, const QStringList& txid);
|
||||
void heightRefreshed(quint64 walletHeight, quint64 daemonHeight, quint64 targetHeight) const;
|
||||
void deviceShowAddressShowed();
|
||||
@@ -368,6 +384,7 @@ signals:
|
||||
|
||||
void connectionStatusChanged(int status) const;
|
||||
void currentSubaddressAccountChanged() const;
|
||||
void disconnectedChanged() const;
|
||||
|
||||
private:
|
||||
Wallet(QObject * parent = nullptr);
|
||||
@@ -387,6 +404,9 @@ private:
|
||||
//! initializes wallet
|
||||
bool init(const QString &daemonAddress, bool trustedDaemon, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight);
|
||||
|
||||
bool disconnected() const;
|
||||
void setConnectionStatus(ConnectionStatus value);
|
||||
|
||||
private:
|
||||
friend class WalletManager;
|
||||
friend class WalletListenerImpl;
|
||||
@@ -400,15 +420,16 @@ private:
|
||||
QString m_paymentId;
|
||||
AddressBook * m_addressBook;
|
||||
mutable AddressBookModel * m_addressBookModel;
|
||||
mutable QTime m_daemonBlockChainHeightTime;
|
||||
mutable QElapsedTimer m_daemonBlockChainHeightTime;
|
||||
mutable quint64 m_daemonBlockChainHeight;
|
||||
int m_daemonBlockChainHeightTtl;
|
||||
mutable QTime m_daemonBlockChainTargetHeightTime;
|
||||
mutable QElapsedTimer m_daemonBlockChainTargetHeightTime;
|
||||
mutable quint64 m_daemonBlockChainTargetHeight;
|
||||
int m_daemonBlockChainTargetHeightTtl;
|
||||
mutable ConnectionStatus m_connectionStatus;
|
||||
int m_connectionStatusTtl;
|
||||
mutable QTime m_connectionStatusTime;
|
||||
mutable QElapsedTimer m_connectionStatusTime;
|
||||
bool m_disconnected;
|
||||
mutable bool m_initialized;
|
||||
uint32_t m_currentSubaddressAccount;
|
||||
Subaddress * m_subaddress;
|
||||
@@ -419,8 +440,9 @@ private:
|
||||
bool m_connectionStatusRunning;
|
||||
QString m_daemonUsername;
|
||||
QString m_daemonPassword;
|
||||
Monero::WalletListener *m_walletListener;
|
||||
WalletListenerImpl *m_walletListener;
|
||||
FutureScheduler m_scheduler;
|
||||
QMutex m_storeMutex;
|
||||
};
|
||||
|
||||
|
||||
|
||||
97
src/libwalletqt/WalletListenerImpl.cpp
Normal file
@@ -0,0 +1,97 @@
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "WalletListenerImpl.h"
|
||||
#include "Wallet.h"
|
||||
|
||||
WalletListenerImpl::WalletListenerImpl(Wallet * w)
|
||||
: m_wallet(w)
|
||||
, m_phelper(w)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void WalletListenerImpl::moneySpent(const std::string &txId, uint64_t amount)
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->moneySpent(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
void WalletListenerImpl::moneyReceived(const std::string &txId, uint64_t amount)
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->moneyReceived(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
void WalletListenerImpl::unconfirmedMoneyReceived(const std::string &txId, uint64_t amount)
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->unconfirmedMoneyReceived(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
void WalletListenerImpl::newBlock(uint64_t height)
|
||||
{
|
||||
// qDebug() << __FUNCTION__;
|
||||
emit m_wallet->newBlock(height, m_wallet->daemonBlockChainTargetHeight());
|
||||
}
|
||||
|
||||
void WalletListenerImpl::updated()
|
||||
{
|
||||
emit m_wallet->updated();
|
||||
}
|
||||
|
||||
// called when wallet refreshed by background thread or explicitly
|
||||
void WalletListenerImpl::refreshed()
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->refreshed();
|
||||
}
|
||||
|
||||
void WalletListenerImpl::onDeviceButtonRequest(uint64_t code)
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->deviceButtonRequest(code);
|
||||
}
|
||||
|
||||
void WalletListenerImpl::onDeviceButtonPressed()
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->deviceButtonPressed();
|
||||
}
|
||||
|
||||
void WalletListenerImpl::onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort)
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
m_phelper.onPassphraseEntered(passphrase, enter_on_device, entry_abort);
|
||||
}
|
||||
|
||||
Monero::optional<std::string> WalletListenerImpl::onDevicePassphraseRequest(bool & on_device)
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
return m_phelper.onDevicePassphraseRequest(on_device);
|
||||
}
|
||||
68
src/libwalletqt/WalletListenerImpl.h
Normal file
@@ -0,0 +1,68 @@
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef MONERO_GUI_WALLETLISTENERIMPL_H
|
||||
#define MONERO_GUI_WALLETLISTENERIMPL_H
|
||||
|
||||
#include "wallet/api/wallet2_api.h"
|
||||
#include "PassphraseHelper.h"
|
||||
|
||||
class Wallet;
|
||||
|
||||
class WalletListenerImpl : public Monero::WalletListener, public PassphraseReceiver
|
||||
{
|
||||
public:
|
||||
WalletListenerImpl(Wallet * w);
|
||||
|
||||
virtual void moneySpent(const std::string &txId, uint64_t amount) override;
|
||||
|
||||
virtual void moneyReceived(const std::string &txId, uint64_t amount) override;
|
||||
|
||||
virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) override;
|
||||
|
||||
virtual void newBlock(uint64_t height) override;
|
||||
|
||||
virtual void updated() override;
|
||||
|
||||
// called when wallet refreshed by background thread or explicitly
|
||||
virtual void refreshed() override;
|
||||
|
||||
virtual void onDeviceButtonRequest(uint64_t code) override;
|
||||
|
||||
virtual void onDeviceButtonPressed() override;
|
||||
|
||||
virtual void onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort) override;
|
||||
|
||||
virtual Monero::optional<std::string> onDevicePassphraseRequest(bool & on_device) override;
|
||||
|
||||
private:
|
||||
Wallet * m_wallet;
|
||||
PassphraseHelper m_phelper;
|
||||
};
|
||||
|
||||
#endif //MONERO_GUI_WALLETLISTENERIMPL_H
|
||||
@@ -41,10 +41,13 @@
|
||||
#include <QMutexLocker>
|
||||
#include <QString>
|
||||
|
||||
class WalletPassphraseListenerImpl : public Monero::WalletListener
|
||||
#include "qt/updater.h"
|
||||
#include "qt/ScopeGuard.h"
|
||||
|
||||
class WalletPassphraseListenerImpl : public Monero::WalletListener, public PassphraseReceiver
|
||||
{
|
||||
public:
|
||||
WalletPassphraseListenerImpl(WalletManager * mgr): m_mgr(mgr), m_wallet(nullptr) {}
|
||||
WalletPassphraseListenerImpl(WalletManager * mgr): m_mgr(mgr), m_phelper(mgr) {}
|
||||
|
||||
virtual void moneySpent(const std::string &txId, uint64_t amount) override { (void)txId; (void)amount; };
|
||||
virtual void moneyReceived(const std::string &txId, uint64_t amount) override { (void)txId; (void)amount; };
|
||||
@@ -53,43 +56,33 @@ public:
|
||||
virtual void updated() override {};
|
||||
virtual void refreshed() override {};
|
||||
|
||||
virtual Monero::optional<std::string> onDevicePassphraseRequest(bool on_device) override
|
||||
virtual void onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort) override
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
if (on_device) return Monero::optional<std::string>();
|
||||
m_phelper.onPassphraseEntered(passphrase, enter_on_device, entry_abort);
|
||||
}
|
||||
|
||||
m_mgr->onWalletPassphraseNeeded(m_wallet);
|
||||
|
||||
if (m_mgr->m_passphrase_abort)
|
||||
{
|
||||
throw std::runtime_error("Passphrase entry abort");
|
||||
}
|
||||
|
||||
auto tmpPass = m_mgr->m_passphrase.toStdString();
|
||||
m_mgr->m_passphrase = QString();
|
||||
|
||||
return Monero::optional<std::string>(tmpPass);
|
||||
virtual Monero::optional<std::string> onDevicePassphraseRequest(bool & on_device) override
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
return m_phelper.onDevicePassphraseRequest(on_device);
|
||||
}
|
||||
|
||||
virtual void onDeviceButtonRequest(uint64_t code) override
|
||||
{
|
||||
emit m_mgr->deviceButtonRequest(code);
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_mgr->deviceButtonRequest(code);
|
||||
}
|
||||
|
||||
virtual void onDeviceButtonPressed() override
|
||||
{
|
||||
emit m_mgr->deviceButtonPressed();
|
||||
}
|
||||
|
||||
virtual void onSetWallet(Monero::Wallet * wallet) override
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
m_wallet = wallet;
|
||||
emit m_mgr->deviceButtonPressed();
|
||||
}
|
||||
|
||||
private:
|
||||
WalletManager * m_mgr;
|
||||
Monero::Wallet * m_wallet;
|
||||
PassphraseHelper m_phelper;
|
||||
};
|
||||
|
||||
WalletManager * WalletManager::m_instance = nullptr;
|
||||
@@ -121,6 +114,13 @@ Wallet *WalletManager::openWallet(const QString &path, const QString &password,
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
WalletPassphraseListenerImpl tmpListener(this);
|
||||
m_mutex_passphraseReceiver.lock();
|
||||
m_passphraseReceiver = &tmpListener;
|
||||
m_mutex_passphraseReceiver.unlock();
|
||||
const auto cleanup = sg::make_scope_guard([this]() noexcept {
|
||||
QMutexLocker passphrase_locker(&m_mutex_passphraseReceiver);
|
||||
this->m_passphraseReceiver = nullptr;
|
||||
});
|
||||
|
||||
if (m_currentWallet) {
|
||||
qDebug() << "Closing open m_currentWallet" << m_currentWallet;
|
||||
@@ -151,14 +151,14 @@ void WalletManager::openWalletAsync(const QString &path, const QString &password
|
||||
}
|
||||
|
||||
|
||||
Wallet *WalletManager::recoveryWallet(const QString &path, const QString &memo, NetworkType::Type nettype, quint64 restoreHeight, quint64 kdfRounds)
|
||||
Wallet *WalletManager::recoveryWallet(const QString &path, const QString &seed, const QString &seed_offset, NetworkType::Type nettype, quint64 restoreHeight, quint64 kdfRounds)
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
if (m_currentWallet) {
|
||||
qDebug() << "Closing open m_currentWallet" << m_currentWallet;
|
||||
delete m_currentWallet;
|
||||
}
|
||||
Monero::Wallet * w = m_pimpl->recoveryWallet(path.toStdString(), "", memo.toStdString(), static_cast<Monero::NetworkType>(nettype), restoreHeight, kdfRounds);
|
||||
Monero::Wallet * w = m_pimpl->recoveryWallet(path.toStdString(), "", seed.toStdString(), static_cast<Monero::NetworkType>(nettype), restoreHeight, kdfRounds, seed_offset.toStdString());
|
||||
m_currentWallet = new Wallet(w);
|
||||
return m_currentWallet;
|
||||
}
|
||||
@@ -184,6 +184,13 @@ Wallet *WalletManager::createWalletFromDevice(const QString &path, const QString
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
WalletPassphraseListenerImpl tmpListener(this);
|
||||
m_mutex_passphraseReceiver.lock();
|
||||
m_passphraseReceiver = &tmpListener;
|
||||
m_mutex_passphraseReceiver.unlock();
|
||||
const auto cleanup = sg::make_scope_guard([this]() noexcept {
|
||||
QMutexLocker passphrase_locker(&m_mutex_passphraseReceiver);
|
||||
this->m_passphraseReceiver = nullptr;
|
||||
});
|
||||
|
||||
if (m_currentWallet) {
|
||||
qDebug() << "Closing open m_currentWallet" << m_currentWallet;
|
||||
@@ -461,15 +468,43 @@ bool WalletManager::saveQrCode(const QString &code, const QString &path) const
|
||||
return QRCodeImageProvider::genQrImage(code, &size).scaled(size.expandedTo(QSize(240, 240)), Qt::KeepAspectRatio).save(path, "PNG", 100);
|
||||
}
|
||||
|
||||
void WalletManager::checkUpdatesAsync(const QString &software, const QString &subdir)
|
||||
void WalletManager::checkUpdatesAsync(
|
||||
const QString &software,
|
||||
const QString &subdir,
|
||||
const QString &buildTag,
|
||||
const QString &version)
|
||||
{
|
||||
m_scheduler.run([this, software, subdir] {
|
||||
emit checkUpdatesComplete(checkUpdates(software, subdir));
|
||||
m_scheduler.run([this, software, subdir, buildTag, version] {
|
||||
const auto updateInfo = Monero::WalletManager::checkUpdates(
|
||||
software.toStdString(),
|
||||
subdir.toStdString(),
|
||||
buildTag.toStdString().c_str(),
|
||||
version.toStdString().c_str());
|
||||
if (!std::get<0>(updateInfo))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const QString version = QString::fromStdString(std::get<1>(updateInfo));
|
||||
const QByteArray hashFromDns = QByteArray::fromHex(QString::fromStdString(std::get<2>(updateInfo)).toUtf8());
|
||||
const QString downloadUrl = QString::fromStdString(std::get<4>(updateInfo));
|
||||
|
||||
try
|
||||
{
|
||||
const QString binaryFilename = QUrl(downloadUrl).fileName();
|
||||
QPair<QString, QString> signers;
|
||||
const QString signedHash = Updater().fetchSignedHash(binaryFilename, hashFromDns, signers).toHex();
|
||||
|
||||
qInfo() << "Update found" << version << downloadUrl << "hash" << signedHash << "signed by" << signers;
|
||||
emit checkUpdatesComplete(version, downloadUrl, signedHash, signers.first, signers.second);
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
qCritical() << "Failed to fetch and verify signed hash:" << e.what();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
QString WalletManager::checkUpdates(const QString &software, const QString &subdir) const
|
||||
{
|
||||
qDebug() << "Checking for updates";
|
||||
@@ -499,6 +534,7 @@ bool WalletManager::clearWalletCache(const QString &wallet_path) const
|
||||
|
||||
WalletManager::WalletManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_passphraseReceiver(nullptr)
|
||||
, m_scheduler(this)
|
||||
{
|
||||
m_pimpl = Monero::WalletManagerFactory::getWalletManager();
|
||||
@@ -509,22 +545,16 @@ WalletManager::~WalletManager()
|
||||
m_scheduler.shutdownWaitForFinished();
|
||||
}
|
||||
|
||||
void WalletManager::onWalletPassphraseNeeded(Monero::Wallet *)
|
||||
void WalletManager::onWalletPassphraseNeeded(bool on_device)
|
||||
{
|
||||
m_mutex_pass.lock();
|
||||
m_passphrase_abort = false;
|
||||
emit this->walletPassphraseNeeded();
|
||||
|
||||
m_cond_pass.wait(&m_mutex_pass);
|
||||
m_mutex_pass.unlock();
|
||||
emit this->walletPassphraseNeeded(on_device);
|
||||
}
|
||||
|
||||
void WalletManager::onPassphraseEntered(const QString &passphrase, bool entry_abort)
|
||||
void WalletManager::onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort)
|
||||
{
|
||||
m_mutex_pass.lock();
|
||||
m_passphrase = passphrase;
|
||||
m_passphrase_abort = entry_abort;
|
||||
|
||||
m_cond_pass.wakeAll();
|
||||
m_mutex_pass.unlock();
|
||||
QMutexLocker locker(&m_mutex_passphraseReceiver);
|
||||
if (m_passphraseReceiver != nullptr)
|
||||
{
|
||||
m_passphraseReceiver->onPassphraseEntered(passphrase, enter_on_device, entry_abort);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,16 +36,16 @@
|
||||
#include <QMutex>
|
||||
#include <QPointer>
|
||||
#include <QWaitCondition>
|
||||
#include <QMutex>
|
||||
#include "qt/FutureScheduler.h"
|
||||
#include "NetworkType.h"
|
||||
#include "PassphraseHelper.h"
|
||||
|
||||
class Wallet;
|
||||
namespace Monero {
|
||||
class WalletManager;
|
||||
struct WalletManager;
|
||||
}
|
||||
|
||||
class WalletManager : public QObject
|
||||
class WalletManager : public QObject, public PassprasePrompter
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool connected READ connected)
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
Q_INVOKABLE void openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
|
||||
|
||||
// wizard: recoveryWallet path; hint: internally it recorvers wallet and set password = ""
|
||||
Q_INVOKABLE Wallet * recoveryWallet(const QString &path, const QString &memo,
|
||||
Q_INVOKABLE Wallet * recoveryWallet(const QString &path, const QString &seed, const QString &seed_offset,
|
||||
NetworkType::Type nettype = NetworkType::MAINNET, quint64 restoreHeight = 0, quint64 kdfRounds = 1);
|
||||
|
||||
Q_INVOKABLE Wallet * createWalletFromKeys(const QString &path,
|
||||
@@ -176,23 +176,32 @@ public:
|
||||
Q_INVOKABLE bool parse_uri(const QString &uri, QString &address, QString &payment_id, uint64_t &amount, QString &tx_description, QString &recipient_name, QVector<QString> &unknown_parameters, QString &error) const;
|
||||
Q_INVOKABLE QVariantMap parse_uri_to_object(const QString &uri) const;
|
||||
Q_INVOKABLE bool saveQrCode(const QString &, const QString &) const;
|
||||
Q_INVOKABLE void checkUpdatesAsync(const QString &software, const QString &subdir);
|
||||
Q_INVOKABLE void checkUpdatesAsync(
|
||||
const QString &software,
|
||||
const QString &subdir,
|
||||
const QString &buildTag,
|
||||
const QString &version);
|
||||
Q_INVOKABLE QString checkUpdates(const QString &software, const QString &subdir) const;
|
||||
|
||||
// clear/rename wallet cache
|
||||
Q_INVOKABLE bool clearWalletCache(const QString &fileName) const;
|
||||
|
||||
Q_INVOKABLE void onWalletPassphraseNeeded(Monero::Wallet * wallet);
|
||||
Q_INVOKABLE void onPassphraseEntered(const QString &passphrase, bool entry_abort=false);
|
||||
Q_INVOKABLE void onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort=false);
|
||||
virtual void onWalletPassphraseNeeded(bool on_device) override;
|
||||
|
||||
signals:
|
||||
|
||||
void walletOpened(Wallet * wallet);
|
||||
void walletCreated(Wallet * wallet);
|
||||
void walletPassphraseNeeded();
|
||||
void walletPassphraseNeeded(bool onDevice);
|
||||
void deviceButtonRequest(quint64 buttonCode);
|
||||
void deviceButtonPressed();
|
||||
void checkUpdatesComplete(const QString &result) const;
|
||||
void checkUpdatesComplete(
|
||||
const QString &version,
|
||||
const QString &downloadUrl,
|
||||
const QString &hash,
|
||||
const QString &firstSigner,
|
||||
const QString &secondSigner) const;
|
||||
void miningStatus(bool isMining) const;
|
||||
|
||||
public slots:
|
||||
@@ -208,12 +217,8 @@ private:
|
||||
Monero::WalletManager * m_pimpl;
|
||||
mutable QMutex m_mutex;
|
||||
QPointer<Wallet> m_currentWallet;
|
||||
|
||||
QWaitCondition m_cond_pass;
|
||||
QMutex m_mutex_pass;
|
||||
QString m_passphrase;
|
||||
bool m_passphrase_abort;
|
||||
|
||||
PassphraseReceiver * m_passphraseReceiver;
|
||||
QMutex m_mutex_passphraseReceiver;
|
||||
FutureScheduler m_scheduler;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QtQml>
|
||||
#include <QStandardPaths>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QIcon>
|
||||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
@@ -62,18 +61,24 @@
|
||||
#include "wallet/api/wallet2_api.h"
|
||||
#include "Logger.h"
|
||||
#include "MainApp.h"
|
||||
#include "qt/downloader.h"
|
||||
#include "qt/ipc.h"
|
||||
#include "qt/network.h"
|
||||
#include "qt/updater.h"
|
||||
#include "qt/utils.h"
|
||||
#include "qt/TailsOS.h"
|
||||
#include "qt/KeysFiles.h"
|
||||
#include "qt/MoneroSettings.h"
|
||||
#include "qt/prices.h"
|
||||
|
||||
// IOS exclusions
|
||||
#ifndef Q_OS_IOS
|
||||
#include "daemon/DaemonManager.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <QOpenGLContext>
|
||||
#endif
|
||||
|
||||
#ifdef WITH_SCANNER
|
||||
#include "QR-Code-scanner/QrCodeScanner.h"
|
||||
#endif
|
||||
@@ -164,10 +169,10 @@ int main(int argc, char *argv[])
|
||||
isOpenGL = false;
|
||||
|
||||
// disable "QApplication: invalid style override passed" warning
|
||||
if (isDesktop) putenv((char*)"QT_STYLE_OVERRIDE=fusion");
|
||||
if (isDesktop) qputenv("QT_STYLE_OVERRIDE", "fusion");
|
||||
#ifdef Q_OS_LINUX
|
||||
// force platform xcb
|
||||
if (isDesktop) putenv((char*)"QT_QPA_PLATFORM=xcb");
|
||||
if (isDesktop) qputenv("QT_QPA_PLATFORM", "xcb");
|
||||
#endif
|
||||
|
||||
// enable High DPI scaling
|
||||
@@ -178,6 +183,17 @@ int main(int argc, char *argv[])
|
||||
|
||||
MainApp app(argc, argv);
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
if (isOpenGL)
|
||||
{
|
||||
QOpenGLContext ctx;
|
||||
isOpenGL = ctx.create() && ctx.format().version() >= qMakePair(2, 1);
|
||||
if (!isOpenGL) {
|
||||
qputenv("QMLSCENE_DEVICE", "softwarecontext");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
app.setApplicationName("monero-core");
|
||||
app.setOrganizationDomain("getmonero.org");
|
||||
app.setOrganizationName("monero-project");
|
||||
@@ -209,6 +225,7 @@ int main(int argc, char *argv[])
|
||||
qCritical() << "Error: accounts root directory could not be set";
|
||||
return 1;
|
||||
}
|
||||
moneroAccountsDir = QDir::toNativeSeparators(moneroAccountsDir);
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
if (isDesktop) app.setWindowIcon(QIcon(":/images/appicon.ico"));
|
||||
@@ -222,6 +239,16 @@ int main(int argc, char *argv[])
|
||||
QCoreApplication::translate("main", "Log to specified file"),
|
||||
QCoreApplication::translate("main", "file"));
|
||||
|
||||
QCommandLineOption verifyUpdateOption("verify-update", "\
|
||||
Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by two maintainers.\n\
|
||||
* Requires 'hashes.txt' - signed 'shasum' output \
|
||||
(i.e. 'gpg -o hashes.txt --clear-sign <shasum_output>') generated by a maintainer.\n\
|
||||
* Requires 'hashes.txt.sig' - detached signature of 'hashes.txt' \
|
||||
(i.e. 'gpg -b hashes.txt') generated by another maintainer.", "update-binary");
|
||||
parser.addOption(verifyUpdateOption);
|
||||
|
||||
QCommandLineOption disableCheckUpdatesOption("disable-check-updates", "Disable automatic check for updates.");
|
||||
parser.addOption(disableCheckUpdatesOption);
|
||||
QCommandLineOption testQmlOption("test-qml");
|
||||
testQmlOption.setFlags(QCommandLineOption::HiddenFromHelp);
|
||||
parser.addOption(logPathOption);
|
||||
@@ -232,7 +259,7 @@ int main(int argc, char *argv[])
|
||||
Monero::Utils::onStartup();
|
||||
|
||||
// Log settings
|
||||
const QString logPath = getLogPath(parser.value(logPathOption));
|
||||
const QString logPath = QDir::toNativeSeparators(getLogPath(parser.value(logPathOption)));
|
||||
Monero::Wallet::init(argv[0], "monero-wallet-gui", logPath.toStdString().c_str(), true);
|
||||
qInstallMessageHandler(messageHandler);
|
||||
|
||||
@@ -245,6 +272,32 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
qWarning().noquote() << "app startd" << "(log: " + logPath + ")";
|
||||
|
||||
if (parser.isSet(verifyUpdateOption))
|
||||
{
|
||||
const QString updateBinaryFullPath = parser.value(verifyUpdateOption);
|
||||
const QFileInfo updateBinaryInfo(updateBinaryFullPath);
|
||||
const QString updateBinaryDir = QDir::toNativeSeparators(updateBinaryInfo.absolutePath()) + QDir::separator();
|
||||
const QString hashesTxt = updateBinaryDir + "hashes.txt";
|
||||
const QString hashesTxtSig = hashesTxt + ".sig";
|
||||
try
|
||||
{
|
||||
const QByteArray updateBinaryContents = fileGetContents(updateBinaryFullPath);
|
||||
const QPair<QString, QString> signers = Updater().verifySignaturesAndHashSum(
|
||||
fileGetContents(hashesTxt),
|
||||
fileGetContents(hashesTxtSig),
|
||||
updateBinaryInfo.fileName(),
|
||||
updateBinaryContents.data(),
|
||||
updateBinaryContents.size());
|
||||
qCritical() << "successfully verified, signed by" << signers.first << "and" << signers.second;
|
||||
return 0;
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
qCritical() << e.what();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Desktop entry
|
||||
#ifdef Q_OS_LINUX
|
||||
registerXdgMime(app);
|
||||
@@ -269,7 +322,7 @@ int main(int argc, char *argv[])
|
||||
// screen settings
|
||||
// Mobile is designed on 128dpi
|
||||
qreal ref_dpi = 128;
|
||||
QRect geo = QApplication::desktop()->availableGeometry();
|
||||
QRect geo = QGuiApplication::primaryScreen()->availableGeometry();
|
||||
QRect rect = QGuiApplication::primaryScreen()->geometry();
|
||||
qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
|
||||
qreal physicalDpi = QGuiApplication::primaryScreen()->physicalDotsPerInch();
|
||||
@@ -296,6 +349,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// registering types for QML
|
||||
qmlRegisterType<clipboardAdapter>("moneroComponents.Clipboard", 1, 0, "Clipboard");
|
||||
qmlRegisterType<Downloader>("moneroComponents.Downloader", 1, 0, "Downloader");
|
||||
|
||||
// Temporary Qt.labs.settings replacement
|
||||
qmlRegisterType<MoneroSettings>("moneroComponents.Settings", 1, 0, "MoneroSettings");
|
||||
@@ -393,8 +447,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Exclude daemon manager from IOS
|
||||
#ifndef Q_OS_IOS
|
||||
const QStringList arguments = (QStringList) QCoreApplication::arguments().at(0);
|
||||
DaemonManager * daemonManager = DaemonManager::instance(&arguments);
|
||||
DaemonManager * daemonManager = DaemonManager::instance();
|
||||
engine.rootContext()->setContextProperty("daemonManager", daemonManager);
|
||||
#endif
|
||||
|
||||
@@ -431,6 +484,7 @@ int main(int argc, char *argv[])
|
||||
engine.rootContext()->setContextProperty("homePath", QDir::homePath());
|
||||
engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath());
|
||||
engine.rootContext()->setContextProperty("idealThreadCount", QThread::idealThreadCount());
|
||||
engine.rootContext()->setContextProperty("disableCheckUpdatesFlag", parser.isSet(disableCheckUpdatesOption));
|
||||
|
||||
bool builtWithScanner = false;
|
||||
#ifdef WITH_SCANNER
|
||||
@@ -438,9 +492,8 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
engine.rootContext()->setContextProperty("builtWithScanner", builtWithScanner);
|
||||
|
||||
QNetworkAccessManager *manager = new QNetworkAccessManager();
|
||||
Prices prices(manager);
|
||||
engine.rootContext()->setContextProperty("Prices", &prices);
|
||||
Network network;
|
||||
engine.rootContext()->setContextProperty("Network", &network);
|
||||
|
||||
// Load main window (context properties needs to be defined obove this line)
|
||||
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "oshelper.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QFileDialog>
|
||||
#include <QStandardPaths>
|
||||
#include <QTemporaryFile>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
@@ -82,6 +85,11 @@ OSHelper::OSHelper(QObject *parent) : QObject(parent)
|
||||
|
||||
}
|
||||
|
||||
QString OSHelper::downloadLocation() const
|
||||
{
|
||||
return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
||||
}
|
||||
|
||||
bool OSHelper::openContainingFolder(const QString &filePath) const
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
@@ -105,6 +113,12 @@ bool OSHelper::openContainingFolder(const QString &filePath) const
|
||||
return QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
||||
QString OSHelper::openSaveFileDialog(const QString &title, const QString &folder, const QString &filename) const
|
||||
{
|
||||
const QString hint = (folder.isEmpty() ? "" : folder + QDir::separator()) + filename;
|
||||
return QFileDialog::getSaveFileName(nullptr, title, hint);
|
||||
}
|
||||
|
||||
QString OSHelper::temporaryFilename() const
|
||||
{
|
||||
QString tempFileName;
|
||||
@@ -151,3 +165,47 @@ QString OSHelper::temporaryPath() const
|
||||
{
|
||||
return QDir::tempPath();
|
||||
}
|
||||
|
||||
bool OSHelper::installed() const
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
static constexpr const wchar_t installKey[] =
|
||||
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Monero GUI Wallet_is1";
|
||||
static constexpr const wchar_t installValue[] = L"InstallLocation";
|
||||
|
||||
DWORD size;
|
||||
LSTATUS status =
|
||||
::RegGetValueW(HKEY_LOCAL_MACHINE, installKey, installValue, RRF_RT_REG_SZ, nullptr, nullptr, &size);
|
||||
if (status == ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (status != ERROR_SUCCESS)
|
||||
{
|
||||
qCritical() << "RegGetValueW failed (get size)" << status;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring installLocation;
|
||||
installLocation.resize(size / sizeof(std::wstring::value_type));
|
||||
size = installLocation.size() * sizeof(std::wstring::value_type);
|
||||
status = ::RegGetValueW(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
installKey,
|
||||
installValue,
|
||||
RRF_RT_REG_SZ,
|
||||
nullptr,
|
||||
&installLocation[0],
|
||||
&size);
|
||||
if (status != ERROR_SUCCESS)
|
||||
{
|
||||
qCritical() << "RegGetValueW Failed (read)" << status;
|
||||
return false;
|
||||
}
|
||||
|
||||
const QDir installDir(QString(reinterpret_cast<const QChar *>(&installLocation[0])));
|
||||
return installDir == QDir(QCoreApplication::applicationDirPath());
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -36,15 +36,22 @@
|
||||
class OSHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool installed READ installed CONSTANT);
|
||||
|
||||
public:
|
||||
explicit OSHelper(QObject *parent = 0);
|
||||
|
||||
Q_INVOKABLE QString downloadLocation() const;
|
||||
Q_INVOKABLE bool openContainingFolder(const QString &filePath) const;
|
||||
Q_INVOKABLE QString openSaveFileDialog(const QString &title, const QString &folder, const QString &filename) const;
|
||||
Q_INVOKABLE QString temporaryFilename() const;
|
||||
Q_INVOKABLE QString temporaryPath() const;
|
||||
Q_INVOKABLE bool removeTemporaryWallet(const QString &walletName) const;
|
||||
Q_INVOKABLE bool isCapsLock() const;
|
||||
|
||||
private:
|
||||
bool installed() const;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -35,18 +35,15 @@
|
||||
AddressBookModel::AddressBookModel(QObject *parent, AddressBook *addressBook)
|
||||
: QAbstractListModel(parent) , m_addressBook(addressBook)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
connect(m_addressBook,SIGNAL(refreshStarted()),this,SLOT(startReset()));
|
||||
connect(m_addressBook,SIGNAL(refreshFinished()),this,SLOT(endReset()));
|
||||
|
||||
}
|
||||
|
||||
void AddressBookModel::startReset(){
|
||||
qDebug(__FUNCTION__);
|
||||
beginResetModel();
|
||||
}
|
||||
void AddressBookModel::endReset(){
|
||||
qDebug(__FUNCTION__);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
@@ -57,30 +54,29 @@ int AddressBookModel::rowCount(const QModelIndex &) const
|
||||
|
||||
QVariant AddressBookModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
QVariant result;
|
||||
|
||||
if (index.row() < 0 || (unsigned)index.row() >= m_addressBook->count()) {
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Monero::AddressBookRow * ar = m_addressBook->getRow(index.row());
|
||||
|
||||
QVariant result = "";
|
||||
switch (role) {
|
||||
case AddressBookAddressRole:
|
||||
result = QString::fromStdString(ar->getAddress());
|
||||
break;
|
||||
case AddressBookDescriptionRole:
|
||||
result = QString::fromStdString(ar->getDescription());
|
||||
break;
|
||||
case AddressBookPaymentIdRole:
|
||||
result = QString::fromStdString(ar->getPaymentId());
|
||||
break;
|
||||
case AddressBookRowIdRole:
|
||||
// Qt doesnt support size_t overload type casting
|
||||
result.setValue(ar->getRowId());
|
||||
break;
|
||||
bool found = m_addressBook->getRow(index.row(), [&result, &role](const Monero::AddressBookRow &row) {
|
||||
switch (role) {
|
||||
case AddressBookAddressRole:
|
||||
result = QString::fromStdString(row.getAddress());
|
||||
break;
|
||||
case AddressBookDescriptionRole:
|
||||
result = QString::fromStdString(row.getDescription());
|
||||
break;
|
||||
case AddressBookPaymentIdRole:
|
||||
result = QString::fromStdString(row.getPaymentId());
|
||||
break;
|
||||
case AddressBookRowIdRole:
|
||||
// Qt doesnt support size_t overload type casting
|
||||
result.setValue(row.getRowId());
|
||||
break;
|
||||
default:
|
||||
qCritical() << "Unimplemented role " << role;
|
||||
}
|
||||
});
|
||||
if (!found) {
|
||||
qCritical("%s: internal error: invalid index %d", __FUNCTION__, index.row());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -35,17 +35,14 @@
|
||||
SubaddressAccountModel::SubaddressAccountModel(QObject *parent, SubaddressAccount *subaddressAccount)
|
||||
: QAbstractListModel(parent), m_subaddressAccount(subaddressAccount)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
connect(m_subaddressAccount,SIGNAL(refreshStarted()),this,SLOT(startReset()));
|
||||
connect(m_subaddressAccount,SIGNAL(refreshFinished()),this,SLOT(endReset()));
|
||||
}
|
||||
|
||||
void SubaddressAccountModel::startReset(){
|
||||
qDebug("SubaddressAccountModel::startReset");
|
||||
beginResetModel();
|
||||
}
|
||||
void SubaddressAccountModel::endReset(){
|
||||
qDebug("SubaddressAccountModel::endReset");
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
@@ -56,7 +53,7 @@ int SubaddressAccountModel::rowCount(const QModelIndex &) const
|
||||
|
||||
QVariant SubaddressAccountModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid() || index.row() < 0 || (unsigned)index.row() >= m_subaddressAccount->count())
|
||||
if (!index.isValid() || index.row() < 0 || static_cast<quint64>(index.row()) >= m_subaddressAccount->count())
|
||||
return {};
|
||||
|
||||
QVariant result;
|
||||
|
||||
@@ -35,18 +35,15 @@
|
||||
SubaddressModel::SubaddressModel(QObject *parent, Subaddress *subaddress)
|
||||
: QAbstractListModel(parent), m_subaddress(subaddress)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
connect(m_subaddress,SIGNAL(refreshStarted()),this,SLOT(startReset()));
|
||||
connect(m_subaddress,SIGNAL(refreshFinished()),this,SLOT(endReset()));
|
||||
|
||||
}
|
||||
|
||||
void SubaddressModel::startReset(){
|
||||
qDebug(__FUNCTION__);
|
||||
beginResetModel();
|
||||
}
|
||||
void SubaddressModel::endReset(){
|
||||
qDebug(__FUNCTION__);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
@@ -57,7 +54,7 @@ int SubaddressModel::rowCount(const QModelIndex &) const
|
||||
|
||||
QVariant SubaddressModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid() || index.row() < 0 || (unsigned)index.row() >= m_subaddress->count())
|
||||
if (!index.isValid() || index.row() < 0 || static_cast<quint64>(index.row()) >= m_subaddress->count())
|
||||
return {};
|
||||
|
||||
QVariant result;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "TransactionHistoryModel.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtGlobal>
|
||||
|
||||
namespace {
|
||||
/**
|
||||
@@ -204,9 +205,14 @@ bool TransactionHistorySortFilterModel::filterAcceptsRow(int source_row, const Q
|
||||
break;
|
||||
case TransactionHistoryModel::TransactionTimeStampRole:
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
QDateTime from = dateFromFilter().startOfDay();
|
||||
QDateTime to = dateToFilter().endOfDay();
|
||||
#else
|
||||
QDateTime from = QDateTime(dateFromFilter());
|
||||
QDateTime to = QDateTime(dateToFilter());
|
||||
to = to.addDays(1); // including upperbound
|
||||
#endif
|
||||
QDateTime timestamp = data.toDateTime();
|
||||
bool matchFrom = from.isNull() || timestamp.isNull() || timestamp >= from;
|
||||
bool matchTo = to.isNull() || timestamp.isNull() || timestamp <= to;
|
||||
|
||||
18
src/openpgp/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
file(GLOB_RECURSE SOURCES *.cpp)
|
||||
file(GLOB_RECURSE HEADERS *.h)
|
||||
|
||||
find_library(GCRYPT_LIBRARY gcrypt)
|
||||
find_library(GPG_ERROR_LIBRARY gpg-error)
|
||||
|
||||
add_library(openpgp
|
||||
${SOURCES}
|
||||
${HEADERS})
|
||||
|
||||
target_include_directories(openpgp
|
||||
PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/monero/contrib/epee/include)
|
||||
|
||||
target_link_libraries(openpgp
|
||||
PUBLIC
|
||||
${GCRYPT_LIBRARY}
|
||||
${GPG_ERROR_LIBRARY})
|
||||
107
src/openpgp/hash.h
Normal file
@@ -0,0 +1,107 @@
|
||||
// Copyright (c) 2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <gcrypt.h>
|
||||
#include <span.h>
|
||||
|
||||
namespace openpgp
|
||||
{
|
||||
|
||||
class hash
|
||||
{
|
||||
public:
|
||||
enum algorithm : uint8_t
|
||||
{
|
||||
sha256 = 8,
|
||||
};
|
||||
|
||||
hash(const hash &) = delete;
|
||||
hash &operator=(const hash &) = delete;
|
||||
|
||||
hash(uint8_t algorithm)
|
||||
: algorithm(algorithm)
|
||||
, consumed(0)
|
||||
{
|
||||
if (gcry_md_open(&md, algorithm, 0) != GPG_ERR_NO_ERROR)
|
||||
{
|
||||
throw std::runtime_error("failed to create message digest object");
|
||||
}
|
||||
}
|
||||
|
||||
~hash()
|
||||
{
|
||||
gcry_md_close(md);
|
||||
}
|
||||
|
||||
hash &operator<<(uint8_t byte)
|
||||
{
|
||||
gcry_md_putc(md, byte);
|
||||
++consumed;
|
||||
return *this;
|
||||
}
|
||||
|
||||
hash &operator<<(const epee::span<const uint8_t> &bytes)
|
||||
{
|
||||
gcry_md_write(md, &bytes[0], bytes.size());
|
||||
consumed += bytes.size();
|
||||
return *this;
|
||||
}
|
||||
|
||||
hash &operator<<(const std::vector<uint8_t> &bytes)
|
||||
{
|
||||
return *this << epee::to_span(bytes);
|
||||
}
|
||||
|
||||
std::vector<uint8_t> finish() const
|
||||
{
|
||||
std::vector<uint8_t> result(gcry_md_get_algo_dlen(algorithm));
|
||||
const void *digest = gcry_md_read(md, algorithm);
|
||||
if (digest == nullptr)
|
||||
{
|
||||
throw std::runtime_error("failed to read the digest");
|
||||
}
|
||||
memcpy(&result[0], digest, result.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t consumed_bytes() const
|
||||
{
|
||||
return consumed;
|
||||
}
|
||||
|
||||
private:
|
||||
const uint8_t algorithm;
|
||||
gcry_md_hd_t md;
|
||||
size_t consumed;
|
||||
};
|
||||
|
||||
}
|
||||