Compare commits
221 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c092de97f2 | ||
|
|
c84a8fb07d | ||
|
|
63b4566475 | ||
|
|
3699dc9f2e | ||
|
|
eee48ce74c | ||
|
|
9072f89a4e | ||
|
|
c9e461dcb6 | ||
|
|
55b548f31c | ||
|
|
b739cdd52a | ||
|
|
94a27b964a | ||
|
|
c7df74dab7 | ||
|
|
bf9b04b126 | ||
|
|
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 | ||
|
|
fbfc5310d5 | ||
|
|
478fddaf57 | ||
|
|
d175070f55 | ||
|
|
0af7a4320d | ||
|
|
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 | ||
|
|
43f378b7d2 | ||
|
|
b73551d6ab | ||
|
|
632d82ac95 | ||
|
|
3fb775de28 | ||
|
|
82affff63f | ||
|
|
6d0593a26b | ||
|
|
13ea4035b5 | ||
|
|
1c97e9796d | ||
|
|
4eca4194b7 | ||
|
|
5c801ec2ad | ||
|
|
7f324fb3e6 | ||
|
|
710159a236 | ||
|
|
7afbcc9855 | ||
|
|
8d0647d677 | ||
|
|
9a5296f00e | ||
|
|
6f53cc4dda | ||
|
|
86f573f02c | ||
|
|
181866ba4a | ||
|
|
ded0a4da48 | ||
|
|
3f4f6f01dc | ||
|
|
6a5de80bd9 | ||
|
|
1fef418adb | ||
|
|
c6c094bbd5 | ||
|
|
10dea6073b | ||
|
|
beeddea678 | ||
|
|
66f6b95b5c | ||
|
|
3c6a1e45d7 | ||
|
|
3528bcd6b5 | ||
|
|
f8262b0d27 | ||
|
|
c5785ed195 | ||
|
|
500c7ec82e | ||
|
|
3e07ecabf9 | ||
|
|
98279f54fb | ||
|
|
a6818cd274 | ||
|
|
4c7d402eaf | ||
|
|
3984f8d1e8 | ||
|
|
f2424ddeaa | ||
|
|
b963028f10 | ||
|
|
4aac66a024 | ||
|
|
598de0f03f | ||
|
|
bd3b26c33d | ||
|
|
66f5b7310f | ||
|
|
5ff030783a | ||
|
|
7c11ac4d98 | ||
|
|
05a0d21f4c | ||
|
|
d0c2740a51 | ||
|
|
118752e775 | ||
|
|
1ed02f7d7a | ||
|
|
4042186fac | ||
|
|
abd98b95f6 | ||
|
|
d6ccae342d | ||
|
|
78f8cb2595 | ||
|
|
aa96e2ff3e | ||
|
|
ec83dea3c3 | ||
|
|
3ea329e45f | ||
|
|
a83adb70ad | ||
|
|
94561ed2a6 | ||
|
|
8c511722e0 | ||
|
|
131769f175 | ||
|
|
4a86a1cf76 | ||
|
|
e0ab9aa898 | ||
|
|
cc86795fa3 | ||
|
|
50cb72656a | ||
|
|
c9900c05b2 | ||
|
|
4e1f7349c4 | ||
|
|
5dccde25f4 | ||
|
|
24ac001daa | ||
|
|
163fa733ae | ||
|
|
a113670905 | ||
|
|
1661c82449 | ||
|
|
088d32e712 | ||
|
|
ba24fd79bb | ||
|
|
46227bdad0 | ||
|
|
872b49f29a | ||
|
|
38d412a3fa | ||
|
|
2833fdb907 | ||
|
|
b940ad72be | ||
|
|
17ea26e02a | ||
|
|
1cee81b996 | ||
|
|
97a9ac9bf8 | ||
|
|
2d23917afb | ||
|
|
52182ef9b1 | ||
|
|
91aff7c0e4 | ||
|
|
1723d04902 | ||
|
|
c83c74d3c2 | ||
|
|
d06ae80e0a | ||
|
|
8dd2a20ff8 | ||
|
|
e04db9299d |
22
.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
|
||||
- name: build
|
||||
run: export PATH=$PATH:/usr/local/opt/qt/bin && ./build.sh
|
||||
- name: test qml
|
||||
@@ -22,6 +22,8 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: remove bundled boost
|
||||
run: sudo rm -rf /usr/local/share/boost
|
||||
- name: update apt
|
||||
run: sudo apt update
|
||||
- name: install monero dependencies
|
||||
@@ -32,3 +34,19 @@ jobs:
|
||||
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
|
||||
- name: build
|
||||
run: msys2do ./build.sh release
|
||||
- name: test qml
|
||||
run: msys2do build/release/bin/monero-wallet-gui --test-qml
|
||||
|
||||
1
.gitignore
vendored
@@ -28,6 +28,7 @@ Session.vim
|
||||
# Temporary
|
||||
.netrwhist
|
||||
*~
|
||||
*.autosave
|
||||
# Auto-generated tag files
|
||||
tags
|
||||
# Persistent undo
|
||||
|
||||
424
CMakeLists.txt
Normal file
@@ -0,0 +1,424 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(monero-gui)
|
||||
|
||||
message(STATUS "Initiating compile using CMake ${CMAKE_VERSION}")
|
||||
|
||||
set(VERSION_MAJOR "14")
|
||||
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(USE_DEVICE_TREZOR ON)
|
||||
option(ENABLE_PASS_STRENGTH_METER "Disable zxcvbn" OFF)
|
||||
option(WITH_SCANNER "Enable webcam QR scanner" OFF)
|
||||
option(DEV_MODE "Checkout latest monero master on build" OFF)
|
||||
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake")
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
if(DEBUG)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
endif()
|
||||
|
||||
set(BUILD_GUI_DEPS ON)
|
||||
set(ARCH "x86-64")
|
||||
set(BUILD_64 ON)
|
||||
set(INSTALL_VENDORED_LIBUNBOUND=ON)
|
||||
|
||||
function (add_c_flag_if_supported flag var)
|
||||
string(REPLACE "-" "_" supported ${flag}_c)
|
||||
check_c_compiler_flag(${flag} ${supported})
|
||||
if(${${supported}})
|
||||
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function (add_cxx_flag_if_supported flag var)
|
||||
string(REPLACE "-" "_" supported ${flag}_cxx)
|
||||
check_cxx_compiler_flag(${flag} ${supported})
|
||||
if(${${supported}})
|
||||
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function (add_linker_flag_if_supported flag var)
|
||||
string(REPLACE "-" "_" supported ${flag}_ld)
|
||||
string(REPLACE "," "_" supported ${flag}_ld)
|
||||
check_linker_flag(${flag} ${supported})
|
||||
if(${${supported}})
|
||||
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
if(NOT DEV_MODE)
|
||||
find_package(Git)
|
||||
function (check_submodule relative_path)
|
||||
execute_process(COMMAND git rev-parse "HEAD" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${relative_path} OUTPUT_VARIABLE localHead)
|
||||
execute_process(COMMAND git rev-parse "HEAD:${relative_path}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE checkedHead)
|
||||
string(COMPARE EQUAL "${localHead}" "${checkedHead}" upToDate)
|
||||
if (upToDate)
|
||||
message(STATUS "Submodule '${relative_path}' is up-to-date")
|
||||
else()
|
||||
message(FATAL_ERROR "Submodule '${relative_path}' is not using the checked head. Please update all submodules with\ngit submodule update --init --force\nor run cmake with -DMANUAL_SUBMODULES=1,\n or if you want to build from latest master run cmake with -DEV_MODE,\n or run make devmode")
|
||||
endif()
|
||||
endfunction ()
|
||||
message(STATUS "Checking submodules")
|
||||
check_submodule(monero)
|
||||
else()
|
||||
execute_process(COMMAND cd monero && git checkout origin/master)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(monero)
|
||||
set_property(TARGET wallet_merged PROPERTY FOLDER "monero")
|
||||
get_directory_property(ARCH_WIDTH DIRECTORY "monero" DEFINITION ARCH_WIDTH)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_definitions(-DQT_NO_DEBUG)
|
||||
endif()
|
||||
|
||||
if(STATIC)
|
||||
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()
|
||||
|
||||
# Include password strength library
|
||||
if(ENABLE_PASS_STRENGTH_METER)
|
||||
message(STATUS "Buildin with pass strength meter support.")
|
||||
else()
|
||||
add_definitions(-DDISABLE_PASS_STRENGTH_METER)
|
||||
endif()
|
||||
|
||||
include(CheckTrezor) # Trezor support check
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# force version update
|
||||
function (monero_gui_add_library_with_deps)
|
||||
cmake_parse_arguments(MONERO_ADD_LIBRARY "" "NAME" "DEPENDS;SOURCES" ${ARGN})
|
||||
source_group("${MONERO_ADD_LIBRARY_NAME}" FILES ${MONERO_ADD_LIBRARY_SOURCES})
|
||||
|
||||
# Define a ("virtual") object library and an actual library that links those
|
||||
# objects together. The virtual libraries can be arbitrarily combined to link
|
||||
# any subset of objects into one library archive. This is used for releasing
|
||||
# libwallet, which combines multiple components.
|
||||
set(objlib obj_${MONERO_ADD_LIBRARY_NAME})
|
||||
add_library(${objlib} OBJECT ${MONERO_ADD_LIBRARY_SOURCES})
|
||||
add_library("${MONERO_ADD_LIBRARY_NAME}" $<TARGET_OBJECTS:${objlib}>)
|
||||
if (MONERO_ADD_LIBRARY_DEPENDS)
|
||||
add_dependencies(${objlib} ${MONERO_ADD_LIBRARY_DEPENDS})
|
||||
endif()
|
||||
set_property(TARGET "${MONERO_ADD_LIBRARY_NAME}" PROPERTY FOLDER "libs")
|
||||
target_compile_definitions(${objlib}
|
||||
PRIVATE $<TARGET_PROPERTY:${MONERO_ADD_LIBRARY_NAME},INTERFACE_COMPILE_DEFINITIONS>)
|
||||
endfunction ()
|
||||
|
||||
function (monero_gui_add_library name)
|
||||
monero_gui_add_library_with_deps(NAME "${name}" SOURCES ${ARGN})
|
||||
endfunction()
|
||||
|
||||
include_directories(${EASYLOGGING_INCLUDE})
|
||||
link_directories(${EASYLOGGING_LIBRARY_DIRS})
|
||||
|
||||
|
||||
include(VersionGui)
|
||||
monero_gui_add_library(gui_version SOURCES version.js DEPENDS genversiongui)
|
||||
|
||||
message(STATUS "${CMAKE_MODULE_PATH}")
|
||||
|
||||
# OpenSSL
|
||||
find_package(OpenSSL REQUIRED)
|
||||
message(STATUS "OpenSSL: Version ${OPENSSL_VERSION}")
|
||||
message(STATUS "OpenSSL: include dir at ${OPENSSL_INCLUDE_DIR}")
|
||||
message(STATUS "OpenSSL: libraries at ${OPENSSL_LIBRARIES} ${OPENSSL_SSL_LIBRARIES}")
|
||||
|
||||
# Zbar (for QR scanner)
|
||||
if(WITH_SCANNER)
|
||||
add_definitions(-DWITH_SCANNER)
|
||||
find_package(ZBar0)
|
||||
message(STATUS "libzbar: include dir at ${ZBAR_INCLUDE_DIR}")
|
||||
message(STATUS "libzbar: libraries at ${ZBAR_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
# Sodium
|
||||
find_library(SODIUM_LIBRARY sodium)
|
||||
message(STATUS "libsodium: libraries at ${SODIUM_LIBRARY}")
|
||||
|
||||
# LibUSB
|
||||
find_package(LibUSB)
|
||||
message(STATUS "libusb: include dir at ${LibUSB_INCLUDE_DIRS}")
|
||||
message(STATUS "libusb: libraries at ${LibUSB_LIBRARIES}")
|
||||
|
||||
# HIDApi
|
||||
find_package(HIDAPI REQUIRED)
|
||||
message(STATUS "libhidapi: include dir at ${HIDAPI_INCLUDE_DIRS}")
|
||||
message(STATUS "libhidapi: libraries at ${HIDAPI_LIBRARIES}")
|
||||
|
||||
# Boost
|
||||
if(DEBUG)
|
||||
set(Boost_DEBUG ON)
|
||||
endif()
|
||||
find_package(Boost 1.62 REQUIRED COMPONENTS
|
||||
system
|
||||
filesystem
|
||||
thread
|
||||
date_time
|
||||
chrono
|
||||
regex
|
||||
serialization
|
||||
program_options
|
||||
locale)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
message(STATUS "X11_FOUND = ${X11_FOUND}")
|
||||
message(STATUS "X11_INCLUDE_DIR = ${X11_INCLUDE_DIR}")
|
||||
message(STATUS "X11_LIBRARIES = ${X11_LIBRARIES}")
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
link_directories(${X11_LIBRARIES})
|
||||
if(STATIC)
|
||||
find_library(XCB_LIBRARY xcb)
|
||||
message(STATUS "Found xcb library: ${XCB_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
string(REGEX MATCH "^[^/]:/[^/]*" msys2_install_path "${CMAKE_C_COMPILER}")
|
||||
message(STATUS "MSYS location: ${msys2_install_path}")
|
||||
set(CMAKE_INCLUDE_PATH "${msys2_install_path}/mingw${ARCH_WIDTH}/include")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/Qt/labs/folderlistmodel")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/Qt/labs/settings")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtGraphicalEffects")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtGraphicalEffects/private")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtMultimedia")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick.2")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Controls")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Controls.2")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Dialogs")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Dialogs/Private")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Layouts")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/PrivateWidgets")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Templates.2")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/Window.2")
|
||||
link_directories("${msys2_install_path}/mingw${ARCH_WIDTH}/qml/QtQuick/XmlListModel")
|
||||
# This is necessary because otherwise CMake will make Boost libraries -lfoo
|
||||
# rather than a full path. Unfortunately, this makes the shared libraries get
|
||||
# linked due to a bug in CMake which misses putting -static flags around the
|
||||
# -lfoo arguments.
|
||||
set(DEFLIB ${msys2_install_path}/mingw${ARCH_WIDTH}/lib)
|
||||
list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_DIRECTORIES ${DEFLIB})
|
||||
list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES ${DEFLIB})
|
||||
endif()
|
||||
|
||||
set(QT5_LIBRARIES
|
||||
Qt5Core
|
||||
Qt5Quick
|
||||
Qt5QuickControls2
|
||||
Qt5Widgets
|
||||
Qt5Gui
|
||||
Qt5Network
|
||||
Qt5Qml
|
||||
Qt5Multimedia
|
||||
Qt5Xml
|
||||
Qt5XmlPatterns
|
||||
Qt5Svg
|
||||
)
|
||||
|
||||
foreach(QT5_MODULE ${QT5_LIBRARIES})
|
||||
find_package(${QT5_MODULE} REQUIRED)
|
||||
endforeach()
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(PKGCONFIG_FOUND)
|
||||
pkg_check_modules(QT5_PKG_CONFIG ${QT5_LIBRARIES})
|
||||
|
||||
if(QT5_PKG_CONFIG_FOUND)
|
||||
set(QT5_PKG_CONFIG "QT5_PKG_CONFIG")
|
||||
if(STATIC)
|
||||
set(QT5_PKG_CONFIG "${QT5_PKG_CONFIG}_STATIC")
|
||||
endif()
|
||||
|
||||
set(QT5_LIBRARIES ${${QT5_PKG_CONFIG}_LIBRARIES} ${${QT5_PKG_CONFIG}_LDFLAGS_OTHER})
|
||||
include_directories(${${QT5_PKG_CONFIG}_INCLUDE_DIRS})
|
||||
link_directories(${${QT5_PKG_CONFIG}_LIBRARY_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND QT5_LIBRARIES
|
||||
${Qt5Gui_PLUGINS}
|
||||
${Qt5Svg_PLUGINS}
|
||||
${Qt5Qml_PLUGINS}
|
||||
${Qt5Network_PLUGINS}
|
||||
)
|
||||
|
||||
if(STATIC)
|
||||
set(QT5_LIBRARIES
|
||||
qtquickcontrols2plugin # has to be the first one, depends on Qt5QuickControls2
|
||||
${QT5_LIBRARIES}
|
||||
declarative_multimedia
|
||||
dialogplugin
|
||||
dialogsprivateplugin
|
||||
qmlfolderlistmodelplugin
|
||||
qmlsettingsplugin
|
||||
qmlxmllistmodelplugin
|
||||
qquicklayoutsplugin
|
||||
Qt5EventDispatcherSupport
|
||||
Qt5FontDatabaseSupport
|
||||
Qt5MultimediaQuick_p
|
||||
Qt5PacketProtocol
|
||||
Qt5ThemeSupport
|
||||
qtgraphicaleffectsplugin
|
||||
qtgraphicaleffectsprivate
|
||||
qtquick2plugin
|
||||
qtquickcontrolsplugin
|
||||
qtquicktemplates2plugin
|
||||
widgetsplugin
|
||||
windowplugin
|
||||
)
|
||||
|
||||
if(MINGW)
|
||||
list(APPEND QT5_LIBRARIES qtfreetype)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
list(APPEND QT5_LIBRARIES D3D11 Dwrite D2d1)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Using Boost include dir at ${Boost_INCLUDE_DIRS}")
|
||||
message(STATUS "Using Boost libraries at ${Boost_LIBRARIES}")
|
||||
|
||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||
if(MINGW)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj")
|
||||
set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi;crypt32;bcrypt)
|
||||
if(DEPENDS)
|
||||
set(ICU_LIBRARIES icuio icui18n icuuc icudata icutu iconv)
|
||||
else()
|
||||
set(ICU_LIBRARIES icuio icuin icuuc icudt icutu iconv)
|
||||
endif()
|
||||
elseif(APPLE OR OPENBSD OR ANDROID)
|
||||
set(EXTRA_LIBRARIES "")
|
||||
elseif(FREEBSD)
|
||||
set(EXTRA_LIBRARIES execinfo)
|
||||
elseif(DRAGONFLY)
|
||||
find_library(COMPAT compat)
|
||||
set(EXTRA_LIBRARIES execinfo ${COMPAT})
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
|
||||
set(EXTRA_LIBRARIES socket nsl resolv)
|
||||
elseif(NOT MSVC AND NOT DEPENDS)
|
||||
find_library(RT rt)
|
||||
set(EXTRA_LIBRARIES ${RT})
|
||||
endif()
|
||||
|
||||
list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
|
||||
|
||||
if(APPLE)
|
||||
include_directories(SYSTEM /usr/include/malloc)
|
||||
if(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (APPLE AND NOT IOS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default -std=c++11")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0")
|
||||
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)
|
||||
add_cxx_flag_if_supported(-Wformat-security CXX_SECURITY_FLAGS)
|
||||
|
||||
# -fstack-protector
|
||||
if (NOT OPENBSD AND NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1)))
|
||||
add_c_flag_if_supported(-fstack-protector C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-fstack-protector CXX_SECURITY_FLAGS)
|
||||
add_c_flag_if_supported(-fstack-protector-strong C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-fstack-protector-strong CXX_SECURITY_FLAGS)
|
||||
endif()
|
||||
|
||||
# New in GCC 8.2
|
||||
if (NOT OPENBSD AND NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1)))
|
||||
add_c_flag_if_supported(-fcf-protection=full C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-fcf-protection=full CXX_SECURITY_FLAGS)
|
||||
endif()
|
||||
if (NOT WIN32 AND NOT OPENBSD)
|
||||
add_c_flag_if_supported(-fstack-clash-protection C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-fstack-clash-protection CXX_SECURITY_FLAGS)
|
||||
endif()
|
||||
|
||||
# Removed in GCC 9.1 (or before ?), but still accepted, so spams the output
|
||||
if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1))
|
||||
add_c_flag_if_supported(-mmitigate-rop C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-mmitigate-rop CXX_SECURITY_FLAGS)
|
||||
endif()
|
||||
|
||||
# linker
|
||||
if (NOT (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU"))
|
||||
# Windows binaries die on startup with PIE when compiled with GCC
|
||||
add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS)
|
||||
endif()
|
||||
add_linker_flag_if_supported(-Wl,-z,relro LD_SECURITY_FLAGS)
|
||||
add_linker_flag_if_supported(-Wl,-z,now LD_SECURITY_FLAGS)
|
||||
add_linker_flag_if_supported(-Wl,-z,noexecstack noexecstack_SUPPORTED)
|
||||
if (noexecstack_SUPPORTED)
|
||||
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecstack")
|
||||
endif()
|
||||
add_linker_flag_if_supported(-Wl,-z,noexecheap noexecheap_SUPPORTED)
|
||||
if (noexecheap_SUPPORTED)
|
||||
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecheap")
|
||||
endif()
|
||||
|
||||
if(STATIC)
|
||||
if(MINGW)
|
||||
add_linker_flag_if_supported(-static STATIC_FLAGS)
|
||||
else()
|
||||
add_linker_flag_if_supported(-static-libgcc STATIC_FLAGS)
|
||||
add_linker_flag_if_supported(-static-libstdc++ STATIC_FLAGS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
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} ${STATIC_FLAGS}")
|
||||
|
||||
if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED)
|
||||
if (APPLE)
|
||||
if(DEPENDS)
|
||||
list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework IOKit")
|
||||
else()
|
||||
find_library(COREFOUNDATION CoreFoundation)
|
||||
find_library(IOKIT IOKit)
|
||||
list(APPEND EXTRA_LIBRARIES ${IOKIT})
|
||||
list(APPEND EXTRA_LIBRARIES ${COREFOUNDATION})
|
||||
endif()
|
||||
endif()
|
||||
if (WIN32)
|
||||
list(APPEND EXTRA_LIBRARIES setupapi Version)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
# Required to make wallet_merged build before the gui
|
||||
add_dependencies(monero-gui wallet_merged)
|
||||
|
||||
@@ -348,8 +348,9 @@ 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
|
||||
|
||||
Column {
|
||||
@@ -364,7 +365,7 @@ Rectangle {
|
||||
MoneroComponents.MenuButtonDivider {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- Account tab ---------------
|
||||
@@ -374,7 +375,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Account") + translationManager.emptyString
|
||||
symbol: qsTr("T") + translationManager.emptyString
|
||||
dotColor: "#44AAFF"
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
parent.previousButton = accountButton
|
||||
@@ -386,7 +386,7 @@ Rectangle {
|
||||
visible: accountButton.present
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- Transfer tab ---------------
|
||||
@@ -396,7 +396,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Send") + translationManager.emptyString
|
||||
symbol: qsTr("S") + translationManager.emptyString
|
||||
dotColor: "#FF6C3C"
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
parent.previousButton = transferButton
|
||||
@@ -408,7 +407,7 @@ Rectangle {
|
||||
visible: transferButton.present
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- AddressBook tab ---------------
|
||||
@@ -419,7 +418,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Address book") + translationManager.emptyString
|
||||
symbol: qsTr("B") + translationManager.emptyString
|
||||
dotColor: "#FF4F41"
|
||||
under: transferButton
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
@@ -432,7 +430,7 @@ Rectangle {
|
||||
visible: addressBookButton.present
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- Receive tab ---------------
|
||||
@@ -442,7 +440,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Receive") + translationManager.emptyString
|
||||
symbol: qsTr("R") + translationManager.emptyString
|
||||
dotColor: "#AAFFBB"
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
parent.previousButton = receiveButton
|
||||
@@ -454,7 +451,7 @@ Rectangle {
|
||||
visible: receiveButton.present
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- Merchant tab ---------------
|
||||
@@ -466,7 +463,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Merchant") + translationManager.emptyString
|
||||
symbol: qsTr("U") + translationManager.emptyString
|
||||
dotColor: "#FF4F41"
|
||||
under: receiveButton
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
@@ -479,7 +475,7 @@ Rectangle {
|
||||
visible: merchantButton.present && appWindow.walletMode >= 2
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- History tab ---------------
|
||||
@@ -490,7 +486,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Transactions") + translationManager.emptyString
|
||||
symbol: qsTr("H") + translationManager.emptyString
|
||||
dotColor: "#6B0072"
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
parent.previousButton = historyButton
|
||||
@@ -502,7 +497,7 @@ Rectangle {
|
||||
visible: historyButton.present
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- Advanced tab ---------------
|
||||
@@ -513,7 +508,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Advanced") + translationManager.emptyString
|
||||
symbol: qsTr("D") + translationManager.emptyString
|
||||
dotColor: "#FFD781"
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
parent.previousButton = advancedButton
|
||||
@@ -524,7 +518,7 @@ Rectangle {
|
||||
visible: advancedButton.present && appWindow.walletMode >= 2
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- Mining tab ---------------
|
||||
@@ -535,7 +529,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Mining") + translationManager.emptyString
|
||||
symbol: qsTr("M") + translationManager.emptyString
|
||||
dotColor: "#FFD781"
|
||||
under: advancedButton
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
@@ -548,7 +541,7 @@ Rectangle {
|
||||
visible: miningButton.present && appWindow.walletMode >= 2
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- TxKey tab ---------------
|
||||
@@ -559,7 +552,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Prove/check") + translationManager.emptyString
|
||||
symbol: qsTr("K") + translationManager.emptyString
|
||||
dotColor: "#FFD781"
|
||||
under: advancedButton
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
@@ -572,7 +564,7 @@ Rectangle {
|
||||
visible: txkeyButton.present && appWindow.walletMode >= 2
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- Shared RingDB tab ---------------
|
||||
@@ -583,7 +575,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Shared RingDB") + translationManager.emptyString
|
||||
symbol: qsTr("G") + translationManager.emptyString
|
||||
dotColor: "#FFD781"
|
||||
under: advancedButton
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
@@ -596,7 +587,7 @@ Rectangle {
|
||||
visible: sharedringdbButton.present && appWindow.walletMode >= 2
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- Sign/verify tab ---------------
|
||||
@@ -607,7 +598,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Sign/verify") + translationManager.emptyString
|
||||
symbol: qsTr("I") + translationManager.emptyString
|
||||
dotColor: "#FFD781"
|
||||
under: advancedButton
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
@@ -620,7 +610,7 @@ Rectangle {
|
||||
visible: signButton.present && appWindow.walletMode >= 2
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
// ------------- Settings tab ---------------
|
||||
@@ -630,7 +620,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Settings") + translationManager.emptyString
|
||||
symbol: qsTr("E") + translationManager.emptyString
|
||||
dotColor: "#36B25C"
|
||||
onClicked: {
|
||||
parent.previousButton.checked = false
|
||||
parent.previousButton = settingsButton
|
||||
@@ -642,7 +631,7 @@ Rectangle {
|
||||
visible: settingsButton.present
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.leftMargin: 20
|
||||
}
|
||||
|
||||
} // Column
|
||||
@@ -655,22 +644,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
|
||||
@@ -678,17 +656,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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
40
Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
ANDROID_STANDALONE_TOOLCHAIN_PATH ?= /usr/local/toolchain
|
||||
|
||||
dotgit=$(shell ls -d .git/config)
|
||||
ifneq ($(dotgit), .git/config)
|
||||
USE_SINGLE_BUILDDIR=1
|
||||
endif
|
||||
|
||||
subbuilddir:=$(shell echo `uname | sed -e 's|[:/\\ \(\)]|_|g'`/`git branch | grep '\* ' | cut -f2- -d' '| sed -e 's|[:/\\ \(\)]|_|g'`)
|
||||
ifeq ($(USE_SINGLE_BUILDDIR),)
|
||||
builddir := build/"$(subbuilddir)"
|
||||
topdir := ../../../..
|
||||
deldirs := $(builddir)
|
||||
else
|
||||
builddir := build
|
||||
topdir := ../..
|
||||
deldirs := $(builddir)/debug $(builddir)/release $(builddir)/fuzz
|
||||
endif
|
||||
|
||||
|
||||
default:
|
||||
mkdir -p build && cd build && cmake -D ARCH="x86-64" -D DEV_MODE=$(or ${DEV_MODE},OFF) -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release .. && $(MAKE)
|
||||
debug:
|
||||
mkdir -p build && cd build && cmake -D DEV_MODE=$(or ${DEV_MODE},ON) .. && $(MAKE) VERBOSE=1
|
||||
devmode:
|
||||
mkdir -p build && cd build && cmake -D ARCH="x86-64" -D DEV_MODE=$(or ${DEV_MODE},ON) -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release .. && $(MAKE)
|
||||
clean:
|
||||
mkdir -p build && cd build && rm -rf *
|
||||
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=$(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=$(cd $MINGW_PREFIX/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
|
||||
|
||||
@@ -186,6 +186,7 @@ Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
clip: true
|
||||
boundsBehavior: isMac ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
parent: root
|
||||
@@ -195,6 +196,7 @@ Rectangle {
|
||||
anchors.topMargin: persistentSettings.customDecorations ? 60 : 10
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: persistentSettings.customDecorations ? 15 : 10
|
||||
onActiveChanged: if (!active && !isMac) active = true
|
||||
}
|
||||
|
||||
onFlickingChanged: {
|
||||
|
||||
38
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,8 +58,7 @@ 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)
|
||||
|
||||
@@ -67,7 +66,7 @@ If you need help/support or any info you can contact the localization workgroup
|
||||
|
||||
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,7 +84,7 @@ 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`
|
||||
|
||||
- For Gentoo
|
||||
|
||||
@@ -145,26 +144,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`
|
||||
|
||||
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 +169,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.
|
||||
|
||||
50
cmake/32-bit-toolchain.cmake
Normal file
@@ -0,0 +1,50 @@
|
||||
# Copyright (c) 2014-2019, 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.
|
||||
|
||||
if (NOT CMAKE_HOST_WIN32)
|
||||
set (CMAKE_SYSTEM_NAME Windows)
|
||||
endif()
|
||||
|
||||
set (GCC_PREFIX i686-w64-mingw32)
|
||||
set (CMAKE_C_COMPILER ${GCC_PREFIX}-gcc)
|
||||
set (CMAKE_CXX_COMPILER ${GCC_PREFIX}-g++)
|
||||
set (CMAKE_AR ar CACHE FILEPATH "" FORCE)
|
||||
set (CMAKE_NM nm CACHE FILEPATH "" FORCE)
|
||||
set (CMAKE_LINKER ld CACHE FILEPATH "" FORCE)
|
||||
#set (CMAKE_RANLIB ${GCC_PREFIX}-gcc-ranlib CACHE FILEPATH "" FORCE)
|
||||
set (CMAKE_RC_COMPILER windres)
|
||||
|
||||
set (CMAKE_FIND_ROOT_PATH "${MSYS2_FOLDER}/mingw32")
|
||||
|
||||
# Ensure cmake doesn't find things in the wrong places
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Find programs on host
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target
|
||||
|
||||
set (MINGW_FLAG "-m32")
|
||||
set (USE_LTO_DEFAULT false)
|
||||
50
cmake/64-bit-toolchain.cmake
Normal file
@@ -0,0 +1,50 @@
|
||||
# Copyright (c) 2014-2019, 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.
|
||||
|
||||
if (NOT CMAKE_HOST_WIN32)
|
||||
set (CMAKE_SYSTEM_NAME Windows)
|
||||
endif()
|
||||
|
||||
set (GCC_PREFIX x86_64-w64-mingw32)
|
||||
set (CMAKE_C_COMPILER ${GCC_PREFIX}-gcc)
|
||||
set (CMAKE_CXX_COMPILER ${GCC_PREFIX}-g++)
|
||||
set (CMAKE_AR ar CACHE FILEPATH "" FORCE)
|
||||
set (CMAKE_NM nm CACHE FILEPATH "" FORCE)
|
||||
set (CMAKE_LINKER ld CACHE FILEPATH "" FORCE)
|
||||
#set (CMAKE_RANLIB ${GCC_PREFIX}-gcc-ranlib CACHE FILEPATH "" FORCE)
|
||||
set (CMAKE_RC_COMPILER windres)
|
||||
|
||||
set (CMAKE_FIND_ROOT_PATH "${MSYS2_FOLDER}/mingw64")
|
||||
|
||||
# Ensure cmake doesn't find things in the wrong places
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Find programs on host
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target
|
||||
|
||||
set (MINGW_FLAG "-m64")
|
||||
set (USE_LTO_DEFAULT false)
|
||||
14
cmake/CheckLinkerFlag.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifdef __CLASSIC_C__
|
||||
int main()
|
||||
{
|
||||
int ac;
|
||||
char* av[];
|
||||
#else
|
||||
int main(int ac, char* av[])
|
||||
{
|
||||
#endif
|
||||
if (ac > 1000) {
|
||||
return *av[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
47
cmake/CheckLinkerFlag.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
include(CheckCCompilerFlag)
|
||||
|
||||
macro(CHECK_LINKER_FLAG flag VARIABLE)
|
||||
if(NOT DEFINED "${VARIABLE}")
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Looking for ${flag} linker flag")
|
||||
endif()
|
||||
|
||||
set(_cle_source ${CMAKE_SOURCE_DIR}/cmake/CheckLinkerFlag.c)
|
||||
|
||||
set(saved_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
set(CMAKE_C_FLAGS "${flag}")
|
||||
try_compile(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${_cle_source}
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${flag}
|
||||
CMAKE_FLAGS
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
unset(_cle_source)
|
||||
set(CMAKE_C_FLAGS ${saved_CMAKE_C_FLAGS})
|
||||
unset(saved_CMAKE_C_FLAGS)
|
||||
|
||||
if ("${OUTPUT}" MATCHES "warning.*ignored")
|
||||
set(${VARIABLE} 0)
|
||||
endif()
|
||||
|
||||
if(${VARIABLE})
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Looking for ${flag} linker flag - found")
|
||||
endif()
|
||||
set(${VARIABLE} 1 CACHE INTERNAL "Have linker flag ${flag}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the ${flag} linker flag is supported "
|
||||
"passed with the following output:\n"
|
||||
"${OUTPUT}\n\n")
|
||||
else()
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Looking for ${flag} linker flag - not found")
|
||||
endif()
|
||||
set(${VARIABLE} "" CACHE INTERNAL "Have linker flag ${flag}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if the ${flag} linker flag is supported "
|
||||
"failed with the following output:\n"
|
||||
"${OUTPUT}\n\n")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
181
cmake/CheckTrezor.cmake
Normal file
@@ -0,0 +1,181 @@
|
||||
OPTION(USE_DEVICE_TREZOR "Trezor support compilation" ON)
|
||||
OPTION(USE_DEVICE_TREZOR_LIBUSB "Trezor LibUSB compilation" ON)
|
||||
OPTION(USE_DEVICE_TREZOR_UDP_RELEASE "Trezor UdpTransport in release mode" OFF)
|
||||
OPTION(USE_DEVICE_TREZOR_DEBUG "Trezor Debugging enabled" OFF)
|
||||
OPTION(TREZOR_DEBUG "Main trezor debugging switch" OFF)
|
||||
|
||||
# Helper function to fix cmake < 3.6.0 FindProtobuf variables
|
||||
function(_trezor_protobuf_fix_vars)
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.6.0")
|
||||
foreach(UPPER
|
||||
PROTOBUF_SRC_ROOT_FOLDER
|
||||
PROTOBUF_IMPORT_DIRS
|
||||
PROTOBUF_DEBUG
|
||||
PROTOBUF_LIBRARY
|
||||
PROTOBUF_PROTOC_LIBRARY
|
||||
PROTOBUF_INCLUDE_DIR
|
||||
PROTOBUF_PROTOC_EXECUTABLE
|
||||
PROTOBUF_LIBRARY_DEBUG
|
||||
PROTOBUF_PROTOC_LIBRARY_DEBUG
|
||||
PROTOBUF_LITE_LIBRARY
|
||||
PROTOBUF_LITE_LIBRARY_DEBUG
|
||||
)
|
||||
if (DEFINED ${UPPER})
|
||||
string(REPLACE "PROTOBUF_" "Protobuf_" Camel ${UPPER})
|
||||
if (NOT DEFINED ${Camel})
|
||||
set(${Camel} ${${UPPER}} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Use Trezor master switch
|
||||
if (USE_DEVICE_TREZOR)
|
||||
# Protobuf is required to build protobuf messages for Trezor
|
||||
include(FindProtobuf OPTIONAL)
|
||||
find_package(Protobuf)
|
||||
_trezor_protobuf_fix_vars()
|
||||
|
||||
# Protobuf handling the cache variables set in docker.
|
||||
if(NOT Protobuf_FOUND AND NOT Protobuf_LIBRARY AND NOT Protobuf_PROTOC_EXECUTABLE AND NOT Protobuf_INCLUDE_DIR)
|
||||
message(STATUS "Could not find Protobuf")
|
||||
elseif(NOT Protobuf_LIBRARY OR NOT EXISTS "${Protobuf_LIBRARY}")
|
||||
message(STATUS "Protobuf library not found: ${Protobuf_LIBRARY}")
|
||||
unset(Protobuf_FOUND)
|
||||
elseif(NOT Protobuf_PROTOC_EXECUTABLE OR NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
message(STATUS "Protobuf executable not found: ${Protobuf_PROTOC_EXECUTABLE}")
|
||||
unset(Protobuf_FOUND)
|
||||
elseif(NOT Protobuf_INCLUDE_DIR OR NOT EXISTS "${Protobuf_INCLUDE_DIR}")
|
||||
message(STATUS "Protobuf include dir not found: ${Protobuf_INCLUDE_DIR}")
|
||||
unset(Protobuf_FOUND)
|
||||
else()
|
||||
message(STATUS "Protobuf lib: ${Protobuf_LIBRARY}, inc: ${Protobuf_INCLUDE_DIR}, protoc: ${Protobuf_PROTOC_EXECUTABLE}")
|
||||
set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIR})
|
||||
set(Protobuf_FOUND 1) # override found if all rquired info was provided by variables
|
||||
endif()
|
||||
|
||||
if(TREZOR_DEBUG)
|
||||
set(USE_DEVICE_TREZOR_DEBUG 1)
|
||||
endif()
|
||||
|
||||
# Compile debugging support (for tests)
|
||||
if (USE_DEVICE_TREZOR_DEBUG)
|
||||
add_definitions(-DWITH_TREZOR_DEBUGGING=1)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Trezor support disabled by USE_DEVICE_TREZOR")
|
||||
endif()
|
||||
|
||||
if(Protobuf_FOUND AND USE_DEVICE_TREZOR)
|
||||
if (NOT "$ENV{TREZOR_PYTHON}" STREQUAL "")
|
||||
set(TREZOR_PYTHON "$ENV{TREZOR_PYTHON}" CACHE INTERNAL "Copied from environment variable TREZOR_PYTHON")
|
||||
else()
|
||||
find_package(Python QUIET COMPONENTS Interpreter) # cmake 3.12+
|
||||
if(Python_Interpreter_FOUND)
|
||||
set(TREZOR_PYTHON "${Python_EXECUTABLE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TREZOR_PYTHON)
|
||||
find_package(PythonInterp)
|
||||
if(PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE)
|
||||
set(TREZOR_PYTHON "${PYTHON_EXECUTABLE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TREZOR_PYTHON)
|
||||
message(STATUS "Trezor: Python not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Protobuf compilation test
|
||||
if(Protobuf_FOUND AND USE_DEVICE_TREZOR AND TREZOR_PYTHON)
|
||||
execute_process(COMMAND ${Protobuf_PROTOC_EXECUTABLE} -I "${CMAKE_SOURCE_DIR}/cmake" -I "${Protobuf_INCLUDE_DIR}" "${CMAKE_SOURCE_DIR}/cmake/test-protobuf.proto" --cpp_out ${CMAKE_BINARY_DIR} RESULT_VARIABLE RET OUTPUT_VARIABLE OUT ERROR_VARIABLE ERR)
|
||||
if(RET)
|
||||
message(STATUS "Protobuf test generation failed: ${OUT} ${ERR}")
|
||||
endif()
|
||||
|
||||
try_compile(Protobuf_COMPILE_TEST_PASSED
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
SOURCES
|
||||
"${CMAKE_BINARY_DIR}/test-protobuf.pb.cc"
|
||||
"${CMAKE_SOURCE_DIR}/cmake/test-protobuf.cpp"
|
||||
CMAKE_FLAGS
|
||||
"-DINCLUDE_DIRECTORIES=${Protobuf_INCLUDE_DIR};${CMAKE_BINARY_DIR}"
|
||||
"-DCMAKE_CXX_STANDARD=11"
|
||||
LINK_LIBRARIES ${Protobuf_LIBRARY}
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
)
|
||||
if(NOT Protobuf_COMPILE_TEST_PASSED)
|
||||
message(STATUS "Protobuf Compilation test failed: ${OUTPUT}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Try to build protobuf messages
|
||||
if(Protobuf_FOUND AND USE_DEVICE_TREZOR AND TREZOR_PYTHON AND Protobuf_COMPILE_TEST_PASSED)
|
||||
set(ENV{PROTOBUF_INCLUDE_DIRS} "${Protobuf_INCLUDE_DIR}")
|
||||
set(ENV{PROTOBUF_PROTOC_EXECUTABLE} "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
set(TREZOR_PROTOBUF_PARAMS "")
|
||||
if (USE_DEVICE_TREZOR_DEBUG)
|
||||
set(TREZOR_PROTOBUF_PARAMS "--debug")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${TREZOR_PYTHON} tools/build_protob.py ${TREZOR_PROTOBUF_PARAMS} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/monero/src/device_trezor/trezor RESULT_VARIABLE RET OUTPUT_VARIABLE OUT ERROR_VARIABLE ERR)
|
||||
if(RET)
|
||||
message(WARNING "Trezor protobuf messages could not be regenerated (err=${RET}, python ${PYTHON})."
|
||||
"OUT: ${OUT}, ERR: ${ERR}."
|
||||
"Please read src/device_trezor/trezor/tools/README.md")
|
||||
else()
|
||||
message(STATUS "Trezor protobuf messages regenerated out: \"${OUT}.\"")
|
||||
set(DEVICE_TREZOR_READY 1)
|
||||
add_definitions(-DDEVICE_TREZOR_READY=1)
|
||||
add_definitions(-DPROTOBUF_INLINE_NOT_IN_HEADERS=0)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_definitions(-DTREZOR_DEBUG=1)
|
||||
endif()
|
||||
|
||||
if(USE_DEVICE_TREZOR_UDP_RELEASE)
|
||||
add_definitions(-DUSE_DEVICE_TREZOR_UDP_RELEASE=1)
|
||||
endif()
|
||||
|
||||
if (Protobuf_INCLUDE_DIR)
|
||||
include_directories(${Protobuf_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# LibUSB support, check for particular version
|
||||
# Include support only if compilation test passes
|
||||
if (USE_DEVICE_TREZOR_LIBUSB)
|
||||
find_package(LibUSB)
|
||||
endif()
|
||||
|
||||
if (LibUSB_COMPILE_TEST_PASSED)
|
||||
add_definitions(-DHAVE_TREZOR_LIBUSB=1)
|
||||
if(LibUSB_INCLUDE_DIRS)
|
||||
include_directories(${LibUSB_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(TREZOR_LIBUSB_LIBRARIES "")
|
||||
if(LibUSB_COMPILE_TEST_PASSED)
|
||||
list(APPEND TREZOR_LIBUSB_LIBRARIES ${LibUSB_LIBRARIES})
|
||||
message(STATUS "Trezor compatible LibUSB found at: ${LibUSB_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
if (BUILD_GUI_DEPS)
|
||||
set(TREZOR_DEP_LIBS "")
|
||||
set(TREZOR_DEP_LINKER "")
|
||||
|
||||
if (Protobuf_LIBRARY)
|
||||
list(APPEND TREZOR_DEP_LIBS ${Protobuf_LIBRARY})
|
||||
string(APPEND TREZOR_DEP_LINKER " -lprotobuf")
|
||||
endif()
|
||||
|
||||
if (TREZOR_LIBUSB_LIBRARIES)
|
||||
list(APPEND TREZOR_DEP_LIBS ${TREZOR_LIBUSB_LIBRARIES})
|
||||
string(APPEND TREZOR_DEP_LINKER " -lusb-1.0")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
1803
cmake/Doxyfile.in
Normal file
14
cmake/Doxygen.extra.css.in
Normal file
@@ -0,0 +1,14 @@
|
||||
/* increase vertical space */
|
||||
#titlearea, #nav-path {
|
||||
display: none;
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
|
||||
/* uncomment these lines for some extra vertical space */
|
||||
|
||||
/*
|
||||
.tablist li {
|
||||
line-height: 26px;
|
||||
}
|
||||
*/
|
||||
98
cmake/FindBacktrace.cmake
Normal file
@@ -0,0 +1,98 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindBacktrace
|
||||
# -------------
|
||||
#
|
||||
# Find provider for backtrace(3).
|
||||
#
|
||||
# Checks if OS supports backtrace(3) via either libc or custom library.
|
||||
# This module defines the following variables:
|
||||
#
|
||||
# ``Backtrace_HEADER``
|
||||
# The header file needed for backtrace(3). Cached.
|
||||
# Could be forcibly set by user.
|
||||
# ``Backtrace_INCLUDE_DIRS``
|
||||
# The include directories needed to use backtrace(3) header.
|
||||
# ``Backtrace_LIBRARIES``
|
||||
# The libraries (linker flags) needed to use backtrace(3), if any.
|
||||
# ``Backtrace_FOUND``
|
||||
# Is set if and only if backtrace(3) support detected.
|
||||
#
|
||||
# The following cache variables are also available to set or use:
|
||||
#
|
||||
# ``Backtrace_LIBRARY``
|
||||
# The external library providing backtrace, if any.
|
||||
# ``Backtrace_INCLUDE_DIR``
|
||||
# The directory holding the backtrace(3) header.
|
||||
#
|
||||
# Typical usage is to generate of header file using configure_file() with the
|
||||
# contents like the following::
|
||||
#
|
||||
# #cmakedefine01 Backtrace_FOUND
|
||||
# #if Backtrace_FOUND
|
||||
# # include <${Backtrace_HEADER}>
|
||||
# #endif
|
||||
#
|
||||
# And then reference that generated header file in actual source.
|
||||
|
||||
include(CMakePushCheckState)
|
||||
include(CheckSymbolExists)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
# List of variables to be provided to find_package_handle_standard_args()
|
||||
set(_Backtrace_STD_ARGS Backtrace_INCLUDE_DIR)
|
||||
|
||||
if(Backtrace_HEADER)
|
||||
set(_Backtrace_HEADER_TRY "${Backtrace_HEADER}")
|
||||
else(Backtrace_HEADER)
|
||||
set(_Backtrace_HEADER_TRY "execinfo.h")
|
||||
endif(Backtrace_HEADER)
|
||||
|
||||
find_path(Backtrace_INCLUDE_DIR "${_Backtrace_HEADER_TRY}")
|
||||
set(Backtrace_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR})
|
||||
|
||||
if (NOT DEFINED Backtrace_LIBRARY)
|
||||
# First, check if we already have backtrace(), e.g., in libc
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS})
|
||||
set(CMAKE_REQUIRED_QUIET ${Backtrace_FIND_QUIETLY})
|
||||
check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND)
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
|
||||
if(_Backtrace_SYM_FOUND)
|
||||
# Avoid repeating the message() call below each time CMake is run.
|
||||
if(NOT Backtrace_FIND_QUIETLY AND NOT DEFINED Backtrace_LIBRARY)
|
||||
message(STATUS "backtrace facility detected in default set of libraries")
|
||||
endif()
|
||||
set(Backtrace_LIBRARY "" CACHE FILEPATH "Library providing backtrace(3), empty for default set of libraries")
|
||||
else()
|
||||
# Check for external library, for non-glibc systems
|
||||
if(Backtrace_INCLUDE_DIR)
|
||||
# OpenBSD has libbacktrace renamed to libexecinfo
|
||||
find_library(Backtrace_LIBRARY "execinfo")
|
||||
elseif() # respect user wishes
|
||||
set(_Backtrace_HEADER_TRY "backtrace.h")
|
||||
find_path(Backtrace_INCLUDE_DIR ${_Backtrace_HEADER_TRY})
|
||||
find_library(Backtrace_LIBRARY "backtrace")
|
||||
endif()
|
||||
|
||||
# Prepend list with library path as it's more common practice
|
||||
set(_Backtrace_STD_ARGS Backtrace_LIBRARY ${_Backtrace_STD_ARGS})
|
||||
endif()
|
||||
|
||||
message(STATUS "Backtrace_LIBRARY: ${Backtrace_LIBRARY}")
|
||||
if(Backtrace_LIBRARY STREQUAL "NOTFOUND")
|
||||
set(Backtrace_LIBRARY "")
|
||||
endif()
|
||||
if(Backtrace_LIBRARY STREQUAL "Backtrace_LIBRARY-NOTFOUND")
|
||||
set(Backtrace_LIBRARY "")
|
||||
endif()
|
||||
|
||||
set(Backtrace_LIBRARIES ${Backtrace_LIBRARY})
|
||||
set(Backtrace_HEADER "${_Backtrace_HEADER_TRY}" CACHE STRING "Header providing backtrace(3) facility")
|
||||
|
||||
find_package_handle_standard_args(Backtrace FOUND_VAR Backtrace_FOUND REQUIRED_VARS ${_Backtrace_STD_ARGS})
|
||||
mark_as_advanced(Backtrace_HEADER Backtrace_INCLUDE_DIR Backtrace_LIBRARY)
|
||||
25
cmake/FindBerkeleyDB.cmake
Normal file
@@ -0,0 +1,25 @@
|
||||
# - Try to find Berkeley DB
|
||||
# Once done this will define
|
||||
#
|
||||
# BERKELEY_DB_FOUND - system has Berkeley DB
|
||||
# BERKELEY_DB_INCLUDE_DIR - the Berkeley DB include directory
|
||||
# BERKELEY_DB_LIBRARIES - Link these to use Berkeley DB
|
||||
# BERKELEY_DB_DEFINITIONS - Compiler switches required for using Berkeley DB
|
||||
|
||||
# Copyright (c) 2006, Alexander Dymo, <adymo@kdevelop.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
find_path(BERKELEY_DB_INCLUDE_DIR db_cxx.h
|
||||
/usr/include/db4
|
||||
/usr/local/include/db4
|
||||
)
|
||||
|
||||
find_library(BERKELEY_DB_LIBRARIES NAMES db_cxx )
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Berkeley "Could not find Berkeley DB >= 4.1" BERKELEY_DB_INCLUDE_DIR BERKELEY_DB_LIBRARIES)
|
||||
# show the BERKELEY_DB_INCLUDE_DIR and BERKELEY_DB_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(BERKELEY_DB_INCLUDE_DIR BERKELEY_DB_LIBRARIES )
|
||||
|
||||
60
cmake/FindHIDAPI.cmake
Normal file
@@ -0,0 +1,60 @@
|
||||
# - try to find HIDAPI library
|
||||
# from http://www.signal11.us/oss/hidapi/
|
||||
#
|
||||
# Cache Variables: (probably not for direct use in your scripts)
|
||||
# HIDAPI_INCLUDE_DIR
|
||||
# HIDAPI_LIBRARY
|
||||
#
|
||||
# Non-cache variables you might use in your CMakeLists.txt:
|
||||
# HIDAPI_FOUND
|
||||
# HIDAPI_INCLUDE_DIRS
|
||||
# HIDAPI_LIBRARIES
|
||||
#
|
||||
# Requires these CMake modules:
|
||||
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
find_library(HIDAPI_LIBRARY
|
||||
NAMES hidapi hidapi-libusb)
|
||||
|
||||
find_path(HIDAPI_INCLUDE_DIR
|
||||
NAMES hidapi.h
|
||||
PATH_SUFFIXES
|
||||
hidapi)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(HIDAPI
|
||||
DEFAULT_MSG
|
||||
HIDAPI_LIBRARY
|
||||
HIDAPI_INCLUDE_DIR)
|
||||
|
||||
if(HIDAPI_FOUND)
|
||||
set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARY}")
|
||||
if((STATIC AND UNIX AND NOT APPLE) OR (DEPENDS AND CMAKE_SYSTEM_NAME STREQUAL "Linux"))
|
||||
find_library(LIBUSB-1.0_LIBRARY usb-1.0)
|
||||
find_library(LIBUDEV_LIBRARY udev)
|
||||
if(LIBUSB-1.0_LIBRARY)
|
||||
set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARIES};${LIBUSB-1.0_LIBRARY}")
|
||||
if(LIBUDEV_LIBRARY)
|
||||
set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARIES};${LIBUDEV_LIBRARY}")
|
||||
else()
|
||||
message(WARNING "libudev library not found, binaries may fail to link.")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "libusb-1.0 library not found, binaries may fail to link.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(HIDAPI_INCLUDE_DIRS "${HIDAPI_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBRARY)
|
||||
149
cmake/FindLibUSB.cmake
Normal file
@@ -0,0 +1,149 @@
|
||||
# - Find libusb for portable USB support
|
||||
# This module will find libusb as published by
|
||||
# http://libusb.sf.net and
|
||||
# http://libusb-win32.sf.net
|
||||
#
|
||||
# It will use PkgConfig if present and supported, else search
|
||||
# it on its own. If the LibUSB_ROOT_DIR environment variable
|
||||
# is defined, it will be used as base path.
|
||||
# The following standard variables get defined:
|
||||
# LibUSB_FOUND: true if LibUSB was found
|
||||
# LibUSB_HEADER_FILE: the location of the C header file
|
||||
# LibUSB_INCLUDE_DIRS: the directory that contains the include file
|
||||
# LibUSB_LIBRARIES: the library
|
||||
# source: https://github.com/IntelRealSense/librealsense
|
||||
|
||||
include ( CheckLibraryExists )
|
||||
include ( CheckIncludeFile )
|
||||
|
||||
find_package ( PkgConfig )
|
||||
if ( PKG_CONFIG_FOUND )
|
||||
pkg_check_modules ( PKGCONFIG_LIBUSB libusb-1.0 )
|
||||
if ( NOT PKGCONFIG_LIBUSB_FOUND )
|
||||
pkg_check_modules ( PKGCONFIG_LIBUSB libusb )
|
||||
endif ( NOT PKGCONFIG_LIBUSB_FOUND )
|
||||
endif ( PKG_CONFIG_FOUND )
|
||||
|
||||
if ( PKGCONFIG_LIBUSB_FOUND )
|
||||
set ( LibUSB_INCLUDE_DIRS ${PKGCONFIG_LIBUSB_INCLUDE_DIRS} )
|
||||
foreach ( i ${PKGCONFIG_LIBUSB_LIBRARIES} )
|
||||
string ( REGEX MATCH "[^-]*" ibase "${i}" )
|
||||
find_library ( ${ibase}_LIBRARY
|
||||
NAMES ${i}
|
||||
PATHS ${PKGCONFIG_LIBUSB_LIBRARY_DIRS}
|
||||
)
|
||||
if ( ${ibase}_LIBRARY )
|
||||
list ( APPEND LibUSB_LIBRARIES ${${ibase}_LIBRARY} )
|
||||
endif ( ${ibase}_LIBRARY )
|
||||
mark_as_advanced ( ${ibase}_LIBRARY )
|
||||
endforeach ( i )
|
||||
|
||||
else ( PKGCONFIG_LIBUSB_FOUND )
|
||||
find_file ( LibUSB_HEADER_FILE
|
||||
NAMES
|
||||
libusb.h usb.h
|
||||
PATHS
|
||||
$ENV{ProgramFiles}/LibUSB-Win32
|
||||
$ENV{LibUSB_ROOT_DIR}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
libusb-1.0
|
||||
include/libusb-1.0
|
||||
)
|
||||
mark_as_advanced ( LibUSB_HEADER_FILE )
|
||||
get_filename_component ( LibUSB_INCLUDE_DIRS "${LibUSB_HEADER_FILE}" PATH )
|
||||
|
||||
if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" )
|
||||
# LibUSB-Win32 binary distribution contains several libs.
|
||||
# Use the lib that got compiled with the same compiler.
|
||||
if ( MSVC )
|
||||
if ( WIN32 )
|
||||
set ( LibUSB_LIBRARY_PATH_SUFFIX lib/msvc )
|
||||
else ( WIN32 )
|
||||
set ( LibUSB_LIBRARY_PATH_SUFFIX lib/msvc_x64 )
|
||||
endif ( WIN32 )
|
||||
elseif ( BORLAND )
|
||||
set ( LibUSB_LIBRARY_PATH_SUFFIX lib/bcc )
|
||||
elseif ( CMAKE_COMPILER_IS_GNUCC )
|
||||
set ( LibUSB_LIBRARY_PATH_SUFFIX lib/gcc )
|
||||
endif ( MSVC )
|
||||
endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" )
|
||||
|
||||
find_library ( usb_LIBRARY
|
||||
NAMES
|
||||
usb-1.0 libusb usb
|
||||
PATHS
|
||||
$ENV{ProgramFiles}/LibUSB-Win32
|
||||
$ENV{LibUSB_ROOT_DIR}
|
||||
PATH_SUFFIXES
|
||||
${LibUSB_LIBRARY_PATH_SUFFIX}
|
||||
)
|
||||
mark_as_advanced ( usb_LIBRARY )
|
||||
if ( usb_LIBRARY )
|
||||
set ( LibUSB_LIBRARIES ${usb_LIBRARY} )
|
||||
endif ( usb_LIBRARY )
|
||||
|
||||
endif ( PKGCONFIG_LIBUSB_FOUND )
|
||||
|
||||
if ( LibUSB_INCLUDE_DIRS AND LibUSB_LIBRARIES )
|
||||
set ( LibUSB_FOUND true )
|
||||
endif ( LibUSB_INCLUDE_DIRS AND LibUSB_LIBRARIES )
|
||||
|
||||
if ( LibUSB_FOUND )
|
||||
set ( CMAKE_REQUIRED_INCLUDES "${LibUSB_INCLUDE_DIRS}" )
|
||||
check_include_file ( "${LibUSB_HEADER_FILE}" LibUSB_FOUND )
|
||||
endif ( LibUSB_FOUND )
|
||||
|
||||
if ( LibUSB_FOUND )
|
||||
check_library_exists ( "${LibUSB_LIBRARIES}" usb_open "" LibUSB_FOUND )
|
||||
check_library_exists ( "${LibUSB_LIBRARIES}" libusb_get_device_list "" LibUSB_VERSION_1.0 )
|
||||
check_library_exists ( "${LibUSB_LIBRARIES}" libusb_get_port_numbers "" LibUSB_VERSION_1.0.16 )
|
||||
|
||||
if((STATIC AND UNIX AND NOT APPLE) OR (DEPENDS AND CMAKE_SYSTEM_NAME STREQUAL "Linux"))
|
||||
find_library(LIBUDEV_LIBRARY udev)
|
||||
if(LIBUDEV_LIBRARY)
|
||||
set(LibUSB_LIBRARIES "${LibUSB_LIBRARIES};${LIBUDEV_LIBRARY}")
|
||||
else()
|
||||
message(WARNING "libudev library not found, binaries may fail to link.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Library 1.0.16+ compilation test.
|
||||
# The check_library_exists does not work well on Apple with shared libs.
|
||||
if (APPLE OR LibUSB_VERSION_1.0.16 OR STATIC)
|
||||
if (APPLE)
|
||||
if(DEPENDS)
|
||||
list(APPEND TEST_COMPILE_EXTRA_LIBRARIES "-framework Foundation -framework IOKit")
|
||||
else()
|
||||
find_library(COREFOUNDATION CoreFoundation)
|
||||
find_library(IOKIT IOKit)
|
||||
list(APPEND TEST_COMPILE_EXTRA_LIBRARIES ${IOKIT})
|
||||
list(APPEND TEST_COMPILE_EXTRA_LIBRARIES ${COREFOUNDATION})
|
||||
endif()
|
||||
endif()
|
||||
if (WIN32)
|
||||
list(APPEND TEST_COMPILE_EXTRA_LIBRARIES setupapi)
|
||||
endif()
|
||||
list(APPEND TEST_COMPILE_EXTRA_LIBRARIES ${LibUSB_LIBRARIES})
|
||||
|
||||
try_compile(LibUSB_COMPILE_TEST_PASSED
|
||||
${CMAKE_BINARY_DIR}
|
||||
"${CMAKE_SOURCE_DIR}/cmake/test-libusb-version.c"
|
||||
CMAKE_FLAGS
|
||||
"-DINCLUDE_DIRECTORIES=${LibUSB_INCLUDE_DIRS}"
|
||||
"-DLINK_DIRECTORIES=${LibUSB_LIBRARIES}"
|
||||
LINK_LIBRARIES ${TEST_COMPILE_EXTRA_LIBRARIES}
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
unset(TEST_COMPILE_EXTRA_LIBRARIES)
|
||||
message(STATUS "LibUSB Compilation test: ${LibUSB_COMPILE_TEST_PASSED}")
|
||||
endif()
|
||||
endif ( LibUSB_FOUND )
|
||||
|
||||
if ( NOT LibUSB_FOUND )
|
||||
if ( NOT LibUSB_FIND_QUIETLY )
|
||||
message ( STATUS "LibUSB not found, try setting LibUSB_ROOT_DIR environment variable." )
|
||||
endif ( NOT LibUSB_FIND_QUIETLY )
|
||||
if ( LibUSB_FIND_REQUIRED )
|
||||
message ( FATAL_ERROR "" )
|
||||
endif ( LibUSB_FIND_REQUIRED )
|
||||
endif ( NOT LibUSB_FOUND )
|
||||
41
cmake/FindLibunwind.cmake
Normal file
@@ -0,0 +1,41 @@
|
||||
# - Try to find libunwind
|
||||
# Once done this will define
|
||||
#
|
||||
# LIBUNWIND_FOUND - system has libunwind
|
||||
# LIBUNWIND_INCLUDE_DIR - the libunwind include directory
|
||||
# LIBUNWIND_LIBRARIES - Link these to use libunwind
|
||||
# LIBUNWIND_DEFINITIONS - Compiler switches required for using libunwind
|
||||
|
||||
# Copyright (c) 2006, Alexander Dymo, <adymo@kdevelop.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
find_path(LIBUNWIND_INCLUDE_DIR libunwind.h
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(LIBUNWIND_LIBRARIES NAMES unwind )
|
||||
if(NOT LIBUNWIND_LIBRARIES STREQUAL "LIBUNWIND_LIBRARIES-NOTFOUND")
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
set(LIBUNWIND_LIBRARIES "gcc_eh;${LIBUNWIND_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# some versions of libunwind need liblzma, and we don't use pkg-config
|
||||
# so we just look whether liblzma is installed, and add it if it is.
|
||||
# It might not be actually needed, but doesn't hurt if it is not.
|
||||
# We don't need any headers, just the lib, as it's privately needed.
|
||||
message(STATUS "looking for liblzma")
|
||||
find_library(LIBLZMA_LIBRARIES lzma )
|
||||
if(NOT LIBLZMA_LIBRARIES STREQUAL "LIBLZMA_LIBRARIES-NOTFOUND")
|
||||
message(STATUS "liblzma found")
|
||||
set(LIBUNWIND_LIBRARIES "${LIBUNWIND_LIBRARIES};${LIBLZMA_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libunwind "Could not find libunwind" LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARIES)
|
||||
# show the LIBUNWIND_INCLUDE_DIR and LIBUNWIND_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARIES )
|
||||
|
||||
59
cmake/FindMiniupnpc.cmake
Normal file
@@ -0,0 +1,59 @@
|
||||
# --------------------------------- FindMiniupnpc Start ---------------------------------
|
||||
# Locate miniupnp library
|
||||
# This module defines
|
||||
# MINIUPNP_FOUND, if false, do not try to link to miniupnp
|
||||
# MINIUPNP_LIBRARY, the miniupnp variant
|
||||
# MINIUPNP_INCLUDE_DIR, where to find miniupnpc.h and family)
|
||||
# MINIUPNPC_VERSION_1_7_OR_HIGHER, set if we detect the version of miniupnpc is 1.7 or higher
|
||||
#
|
||||
# Note that the expected include convention is
|
||||
# #include "miniupnpc.h"
|
||||
# and not
|
||||
# #include <miniupnpc/miniupnpc.h>
|
||||
# This is because, the miniupnpc location is not standardized and may exist
|
||||
# in locations other than miniupnpc/
|
||||
|
||||
if (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
|
||||
# Already in cache, be silent
|
||||
set(MINIUPNP_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_path(MINIUPNP_INCLUDE_DIR miniupnpc.h
|
||||
HINTS $ENV{MINIUPNP_INCLUDE_DIR}
|
||||
PATH_SUFFIXES miniupnpc
|
||||
)
|
||||
|
||||
find_library(MINIUPNP_LIBRARY miniupnpc
|
||||
HINTS $ENV{MINIUPNP_LIBRARY}
|
||||
)
|
||||
|
||||
find_library(MINIUPNP_STATIC_LIBRARY libminiupnpc.a
|
||||
HINTS $ENV{MINIUPNP_STATIC_LIBRARY}
|
||||
)
|
||||
|
||||
set(MINIUPNP_INCLUDE_DIRS ${MINIUPNP_INCLUDE_DIR})
|
||||
set(MINIUPNP_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||
set(MINIUPNP_STATIC_LIBRARIES ${MINIUPNP_STATIC_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
MiniUPnPc DEFAULT_MSG
|
||||
MINIUPNP_INCLUDE_DIR
|
||||
MINIUPNP_LIBRARY
|
||||
)
|
||||
|
||||
IF(MINIUPNPC_FOUND)
|
||||
file(STRINGS "${MINIUPNP_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_API_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+[0-9]+")
|
||||
if(MINIUPNPC_API_VERSION_STR MATCHES "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+([0-9]+)")
|
||||
set(MINIUPNPC_API_VERSION "${CMAKE_MATCH_1}")
|
||||
if (${MINIUPNPC_API_VERSION} GREATER "10" OR ${MINIUPNPC_API_VERSION} EQUAL "10")
|
||||
message(STATUS "Found miniupnpc API version " ${MINIUPNPC_API_VERSION})
|
||||
set(MINIUPNP_FOUND true)
|
||||
set(MINIUPNPC_VERSION_1_7_OR_HIGHER true)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ENDIF()
|
||||
|
||||
mark_as_advanced(MINIUPNP_INCLUDE_DIR MINIUPNP_LIBRARY MINIUPNP_STATIC_LIBRARY)
|
||||
# --------------------------------- FindMiniupnpc End ---------------------------------
|
||||
91
cmake/FindReadline.cmake
Normal file
@@ -0,0 +1,91 @@
|
||||
# - Try to find readline include dirs and libraries
|
||||
#
|
||||
# Usage of this module as follows:
|
||||
#
|
||||
# find_package(Readline)
|
||||
#
|
||||
# Variables used by this module, they can change the default behaviour and need
|
||||
# to be set before calling find_package:
|
||||
#
|
||||
# Readline_ROOT_DIR Set this variable to the root installation of
|
||||
# readline if the module has problems finding the
|
||||
# proper installation path.
|
||||
#
|
||||
# Variables defined by this module:
|
||||
#
|
||||
# READLINE_FOUND System has readline, include and lib dirs found
|
||||
# GNU_READLINE_FOUND Version of readline found is GNU readline, not libedit!
|
||||
# LIBEDIT_FOUND Version of readline found is libedit, not GNU readline!
|
||||
# Readline_INCLUDE_DIR The readline include directories.
|
||||
# Readline_LIBRARY The readline library.
|
||||
# GNU_READLINE_LIBRARY The GNU readline library or empty string.
|
||||
# LIBEDIT_LIBRARY The libedit library or empty string.
|
||||
|
||||
find_path(Readline_ROOT_DIR
|
||||
NAMES include/readline/readline.h
|
||||
PATHS /usr/local/opt/readline/ /opt/local/ /usr/local/ /usr/
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_path(Readline_INCLUDE_DIR
|
||||
NAMES readline/readline.h
|
||||
PATHS ${Readline_ROOT_DIR}/include
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(Readline_LIBRARY
|
||||
NAMES readline
|
||||
PATHS ${Readline_ROOT_DIR}/lib
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(Termcap_LIBRARY
|
||||
NAMES tinfo termcap ncursesw ncurses cursesw curses
|
||||
)
|
||||
|
||||
if(Readline_INCLUDE_DIR AND Readline_LIBRARY)
|
||||
set(READLINE_FOUND TRUE)
|
||||
else(Readline_INCLUDE_DIR AND Readline_LIBRARY)
|
||||
FIND_LIBRARY(Readline_LIBRARY NAMES readline PATHS Readline_ROOT_DIR)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG Readline_INCLUDE_DIR Readline_LIBRARY )
|
||||
MARK_AS_ADVANCED(Readline_INCLUDE_DIR Readline_LIBRARY)
|
||||
endif(Readline_INCLUDE_DIR AND Readline_LIBRARY)
|
||||
|
||||
mark_as_advanced(
|
||||
Readline_ROOT_DIR
|
||||
Readline_INCLUDE_DIR
|
||||
Readline_LIBRARY
|
||||
)
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${Readline_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${Readline_LIBRARY})
|
||||
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(rl_copy_text HAVE_COPY_TEXT)
|
||||
check_function_exists(rl_filename_completion_function HAVE_COMPLETION_FUNCTION)
|
||||
|
||||
if(NOT HAVE_COMPLETION_FUNCTION)
|
||||
if (Readline_LIBRARY)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${Readline_LIBRARY} ${Termcap_LIBRARY})
|
||||
endif(Readline_LIBRARY)
|
||||
check_function_exists(rl_copy_text HAVE_COPY_TEXT_TC)
|
||||
check_function_exists(rl_filename_completion_function HAVE_COMPLETION_FUNCTION_TC)
|
||||
set(HAVE_COMPLETION_FUNCTION ${HAVE_COMPLETION_FUNCTION_TC})
|
||||
set(HAVE_COPY_TEXT ${HAVE_COPY_TEXT_TC})
|
||||
if(HAVE_COMPLETION_FUNCTION)
|
||||
set(Readline_LIBRARY ${Readline_LIBRARY} ${Termcap_LIBRARY})
|
||||
endif(HAVE_COMPLETION_FUNCTION)
|
||||
endif(NOT HAVE_COMPLETION_FUNCTION)
|
||||
|
||||
set(LIBEDIT_LIBRARY "")
|
||||
set(GNU_READLINE_LIBRARY "")
|
||||
|
||||
if(HAVE_COMPLETION_FUNCTION AND HAVE_COPY_TEXT)
|
||||
set(GNU_READLINE_FOUND TRUE)
|
||||
set(GNU_READLINE_LIBRARY ${Readline_LIBRARY})
|
||||
elseif(READLINE_FOUND AND NOT HAVE_COPY_TEXT)
|
||||
set(LIBEDIT_FOUND TRUE)
|
||||
set(LIBEDIT_LIBRARY ${Readline_LIBRARY})
|
||||
endif(HAVE_COMPLETION_FUNCTION AND HAVE_COPY_TEXT)
|
||||
|
||||
40
cmake/FindUnbound.cmake
Normal file
@@ -0,0 +1,40 @@
|
||||
# Copyright (c) 2014-2019, 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.
|
||||
|
||||
MESSAGE(STATUS "Looking for libunbound")
|
||||
|
||||
FIND_PATH(UNBOUND_INCLUDE_DIR
|
||||
NAMES unbound.h
|
||||
PATH_SUFFIXES include/ include/unbound/
|
||||
PATHS "${PROJECT_SOURCE_DIR}"
|
||||
${UNBOUND_ROOT}
|
||||
$ENV{UNBOUND_ROOT}
|
||||
/usr/local/
|
||||
/usr/
|
||||
)
|
||||
|
||||
find_library(UNBOUND_LIBRARIES unbound)
|
||||
22
cmake/FindZBar0.cmake
Normal file
@@ -0,0 +1,22 @@
|
||||
# from http://code.google.com/p/low-cost-vision-2012/source/browse/CMakeModules/FindZBar0.cmake?name=2-helium-1&r=d61f248bd5565b3c086bf4769a04bfd98f7079df
|
||||
# - Try to find ZBar
|
||||
# This will define
|
||||
#
|
||||
# ZBAR_FOUND -
|
||||
# ZBAR_LIBRARY_DIR -
|
||||
# ZBAR_INCLUDE_DIR -
|
||||
# ZBAR_LIBRARIES -
|
||||
#
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_ZBAR QUIET zbar)
|
||||
set(ZBAR_DEFINITIONS ${PC_ZBAR_CFLAGS_OTHER})
|
||||
find_library(ZBAR_LIBRARIES NAMES zbar
|
||||
HINTS ${PC_ZBAR_LIBDIR} ${PC_ZBAR_LIBRARY_DIRS} )
|
||||
find_path(ZBAR_INCLUDE_DIR Decoder.h
|
||||
HINTS ${PC_ZBAR_INCLUDEDIR} ${PC_ZBAR_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES zbar )
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ZBAR DEFAULT_MSG ZBAR_LIBRARIES ZBAR_INCLUDE_DIR)
|
||||
message(STATUS "Found zbar libraries ${ZBAR_LIBRARIES}")
|
||||
|
||||
68
cmake/GenVersion.cmake
Normal file
@@ -0,0 +1,68 @@
|
||||
# Copyright (c) 2014-2019, 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.
|
||||
#
|
||||
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
# Check what commit we're on
|
||||
execute_process(COMMAND "${GIT}" rev-parse --short=9 HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(RET)
|
||||
# Something went wrong, set the version tag to -unknown
|
||||
|
||||
message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.")
|
||||
set(VERSIONTAG "unknown")
|
||||
set(VERSION_IS_RELEASE "false")
|
||||
configure_file("monero/src/version.cpp.in" "${TO}")
|
||||
else()
|
||||
string(SUBSTRING ${COMMIT} 0 9 COMMIT)
|
||||
message(STATUS "You are currently on commit ${COMMIT}")
|
||||
|
||||
# Get all the tags
|
||||
execute_process(COMMAND "${GIT}" rev-list --tags --max-count=1 --abbrev-commit RESULT_VARIABLE RET OUTPUT_VARIABLE TAGGEDCOMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(NOT TAGGEDCOMMIT)
|
||||
message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.")
|
||||
set(VERSIONTAG "${COMMIT}")
|
||||
set(VERSION_IS_RELEASE "false")
|
||||
else()
|
||||
message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
|
||||
|
||||
# Check if we're building that tagged commit or a different one
|
||||
if(COMMIT STREQUAL TAGGEDCOMMIT)
|
||||
message(STATUS "You are building a tagged release")
|
||||
set(VERSIONTAG "release")
|
||||
set(VERSION_IS_RELEASE "true")
|
||||
else()
|
||||
message(STATUS "You are ahead of or behind a tagged release")
|
||||
set(VERSIONTAG "${COMMIT}")
|
||||
set(VERSION_IS_RELEASE "false")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
configure_file("monero/src/version.cpp.in" "${TO}")
|
||||
endif()
|
||||
64
cmake/GenVersionGui.cmake
Normal file
@@ -0,0 +1,64 @@
|
||||
# Copyright (c) 2014-2019, 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.
|
||||
#
|
||||
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
# Check what commit we're on
|
||||
execute_process(COMMAND "${GIT}" rev-parse --short=9 HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(RET)
|
||||
# Something went wrong, set the version tag to -unknown
|
||||
|
||||
message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.")
|
||||
set(VERSIONTAG "unknown")
|
||||
configure_file("src/version.js.in" "${TO}")
|
||||
else()
|
||||
string(SUBSTRING ${COMMIT} 0 9 COMMIT)
|
||||
message(STATUS "You are currently on commit ${COMMIT}")
|
||||
|
||||
# Get all the tags
|
||||
execute_process(COMMAND "${GIT}" rev-list --tags --max-count=1 --abbrev-commit RESULT_VARIABLE RET OUTPUT_VARIABLE TAGGEDCOMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(NOT TAGGEDCOMMIT)
|
||||
message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.")
|
||||
set(VERSIONTAG "${COMMIT}")
|
||||
else()
|
||||
message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
|
||||
|
||||
# Check if we're building that tagged commit or a different one
|
||||
if(COMMIT STREQUAL TAGGEDCOMMIT)
|
||||
message(STATUS "You are building a tagged release")
|
||||
set(VERSIONTAG "release")
|
||||
else()
|
||||
message(STATUS "You are ahead of or behind a tagged release")
|
||||
set(VERSIONTAG "${COMMIT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
configure_file("src/version.js.in" "${TO}")
|
||||
endif()
|
||||
81
cmake/Version.cmake
Normal file
@@ -0,0 +1,81 @@
|
||||
# Copyright (c) 2014-2017, 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.
|
||||
|
||||
function (write_static_version_header hash)
|
||||
set(VERSIONTAG "${hash}")
|
||||
configure_file("${CMAKE_SOURCE_DIR}/monero/src/version.cpp.in" "${CMAKE_BINARY_DIR}/version.cpp")
|
||||
endfunction ()
|
||||
|
||||
find_package(Git QUIET)
|
||||
if ("$Format:$" STREQUAL "")
|
||||
# We're in a tarball; use hard-coded variables.
|
||||
write_static_version_header("release")
|
||||
elseif (GIT_FOUND OR Git_FOUND)
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_BINARY_DIR}/version.cpp"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
"-D" "GIT=${GIT_EXECUTABLE}"
|
||||
"-D" "TO=${CMAKE_BINARY_DIR}/version.cpp"
|
||||
"-P" "cmake/GenVersion.cmake"
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||
|
||||
#message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
||||
# COMMAND "${CMAKE_COMMAND}"
|
||||
# "-D" "GIT=${GIT_EXECUTABLE}"
|
||||
# "-D" "TO=${CMAKE_BINARY_DIR}/monero/version.cpp"
|
||||
# "-P" "cmake/GenVersion.cmake"
|
||||
# BYPRODUCTS "${CMAKE_BINARY_DIR}/monero/version.cpp"
|
||||
# WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||
else()
|
||||
message(STATUS "WARNING: Git was not found!")
|
||||
write_static_version_header("unknown")
|
||||
endif ()
|
||||
add_custom_target(genversion ALL
|
||||
DEPENDS "${CMAKE_BINARY_DIR}/version.cpp")
|
||||
|
||||
|
||||
#find_package(Git QUIET)
|
||||
#if ("$Format:$" STREQUAL "")
|
||||
# # We're in a tarball; use hard-coded variables.
|
||||
# write_static_version_header("release")
|
||||
#elseif (GIT_FOUND OR Git_FOUND)
|
||||
# message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
||||
# add_custom_command(
|
||||
# OUTPUT "${CMAKE_BINARY_DIR}/version.cpp"
|
||||
# COMMAND "${CMAKE_COMMAND}"
|
||||
# "-D" "GIT=${GIT_EXECUTABLE}"
|
||||
# "-D" "TO=${CMAKE_BINARY_DIR}/version.cpp"
|
||||
# "-P" "cmake/GenVersion.cmake"
|
||||
# WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||
#else()
|
||||
# message(STATUS "WARNING: Git was not found!")
|
||||
# write_static_version_header("unknown")
|
||||
#endif ()
|
||||
#add_custom_target(genversion ALL
|
||||
# DEPENDS "${CMAKE_BINARY_DIR}/version.cpp")
|
||||
|
||||
52
cmake/VersionGui.cmake
Normal file
@@ -0,0 +1,52 @@
|
||||
# Copyright (c) 2014-2019, 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.
|
||||
|
||||
function (write_static_version_header hash)
|
||||
set(VERSIONTAG "${hash}")
|
||||
configure_file("${CMAKE_SOURCE_DIR}/version.js.in" "${CMAKE_SOURCE_DIR}/version.js")
|
||||
endfunction ()
|
||||
|
||||
find_package(Git QUIET)
|
||||
if ("$Format:$" STREQUAL "")
|
||||
# We're in a tarball; use hard-coded variables.
|
||||
write_static_version_header("release")
|
||||
elseif (GIT_FOUND OR Git_FOUND)
|
||||
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_SOURCE_DIR}/version.js"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
"-D" "GIT=${GIT_EXECUTABLE}"
|
||||
"-D" "TO=${CMAKE_SOURCE_DIR}/version.js"
|
||||
"-P" "cmake/GenVersionGui.cmake"
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||
else()
|
||||
message(STATUS "WARNING: Git was not found!")
|
||||
write_static_version_header("unknown")
|
||||
endif ()
|
||||
add_custom_target(genversiongui ALL
|
||||
DEPENDS "${CMAKE_SOURCE_DIR}/version.js")
|
||||
52
cmake/test-libusb-version.c
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2014-2019, 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 <libusb.h>
|
||||
|
||||
#define UNUSED(expr) (void)(expr)
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
libusb_device **devs;
|
||||
libusb_context *ctx = NULL;
|
||||
|
||||
int r = libusb_init(&ctx); UNUSED(r);
|
||||
ssize_t cnt = libusb_get_device_list(ctx, &devs); UNUSED(cnt);
|
||||
|
||||
struct libusb_device_descriptor desc;
|
||||
r = libusb_get_device_descriptor(devs[0], &desc); UNUSED(r);
|
||||
uint8_t bus_id = libusb_get_bus_number(devs[0]); UNUSED(bus_id);
|
||||
uint8_t addr = libusb_get_device_address(devs[0]); UNUSED(addr);
|
||||
|
||||
uint8_t tmp_path[16];
|
||||
r = libusb_get_port_numbers(devs[0], tmp_path, sizeof(tmp_path));
|
||||
UNUSED(r);
|
||||
UNUSED(tmp_path);
|
||||
|
||||
libusb_free_device_list(devs, 1);
|
||||
libusb_exit(ctx);
|
||||
}
|
||||
43
cmake/test-protobuf.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2014-2019, 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 <string>
|
||||
#include <iostream>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/unknown_field_set.h>
|
||||
#include "test-protobuf.pb.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
google::protobuf::UnknownFieldSet ufs;
|
||||
ufs.ClearAndFreeMemory();
|
||||
|
||||
Success sc;
|
||||
sc.set_message("test");
|
||||
sc.SerializeToOstream(&std::cerr);
|
||||
return 0;
|
||||
}
|
||||
7
cmake/test-protobuf.proto
Normal file
@@ -0,0 +1,7 @@
|
||||
syntax = "proto2";
|
||||
|
||||
import "google/protobuf/descriptor.proto";
|
||||
|
||||
message Success {
|
||||
optional string message = 1;
|
||||
}
|
||||
34
cmake/test-static-assert.c
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2014-2019, 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 <assert.h>
|
||||
|
||||
static_assert(1, "FAIL");
|
||||
int main(int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
34
cmake/test-static-assert.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2014-2019, 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 <assert.h>
|
||||
|
||||
static_assert(1, "FAIL");
|
||||
int main(int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
47
components/CMakeLists.txt
Normal file
@@ -0,0 +1,47 @@
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
###
|
||||
|
||||
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.h.cmake
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/defines.h)
|
||||
|
||||
file(GLOB_RECURSE UI_FILES *.ui)
|
||||
file(GLOB_RECURSE CODE_FILES *.cpp)
|
||||
|
||||
qt5_wrap_ui(UI_HEADERS ${UI_FILES})
|
||||
#qt5_add_resources(RESOURCE_FILES ../resources/resources.qrc)
|
||||
|
||||
# Windows application icon
|
||||
if (WIN32)
|
||||
set(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj)
|
||||
if (MSVC)
|
||||
add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
|
||||
COMMAND rc.exe /fo ${WINDOWS_RES_FILE} resources.rc
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/win
|
||||
)
|
||||
else()
|
||||
add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
|
||||
COMMAND windres.exe resources.rc ${WINDOWS_RES_FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/win
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_executable(${CMAKE_PROJECT_NAME} WIN32
|
||||
${UI_HEADERS}
|
||||
${CODE_FILES}
|
||||
${RESOURCE_FILES}
|
||||
${WINDOWS_RES_FILE}
|
||||
)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||
Qt5::Widgets
|
||||
)
|
||||
|
||||
if (UNIX)
|
||||
install(TARGETS ${CMAKE_PROJECT_NAME}
|
||||
RUNTIME DESTINATION bin)
|
||||
elseif (WIN32)
|
||||
install(TARGETS ${CMAKE_PROJECT_NAME}
|
||||
DESTINATION .)
|
||||
endif()
|
||||
@@ -108,7 +108,7 @@ Item {
|
||||
font.pixelSize: checkBox.fontSize
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.Wrap
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,220 +0,0 @@
|
||||
// Copyright (c) 2014-2018, 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.0
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Window 2.2
|
||||
|
||||
import "." as MoneroComponents
|
||||
import "effects/" as MoneroEffects
|
||||
import "../js/Windows.js" as Windows
|
||||
import "../js/Utils.js" as Utils
|
||||
|
||||
Window {
|
||||
id: root
|
||||
modality: Qt.ApplicationModal
|
||||
color: "black"
|
||||
flags: Windows.flags
|
||||
property alias text: dialogContent.text
|
||||
property alias content: root.text
|
||||
property alias textArea: dialogContent
|
||||
property var icon
|
||||
|
||||
// same signals as Dialog has
|
||||
signal accepted()
|
||||
signal rejected()
|
||||
|
||||
onClosing: {
|
||||
inactiveOverlay.visible = false;
|
||||
}
|
||||
|
||||
function open() {
|
||||
inactiveOverlay.visible = true;
|
||||
show();
|
||||
}
|
||||
|
||||
// TODO: implement without hardcoding sizes
|
||||
width: 480
|
||||
height: 280
|
||||
|
||||
// background
|
||||
MoneroEffects.GradientBackground {
|
||||
anchors.fill: parent
|
||||
fallBackColor: MoneroComponents.Style.middlePanelBackgroundColor
|
||||
initialStartColor: MoneroComponents.Style.middlePanelBackgroundGradientStart
|
||||
initialStopColor: MoneroComponents.Style.middlePanelBackgroundGradientStop
|
||||
blackColorStart: MoneroComponents.Style._b_middlePanelBackgroundGradientStart
|
||||
blackColorStop: MoneroComponents.Style._b_middlePanelBackgroundGradientStop
|
||||
whiteColorStart: MoneroComponents.Style._w_middlePanelBackgroundGradientStart
|
||||
whiteColorStop: MoneroComponents.Style._w_middlePanelBackgroundGradientStop
|
||||
start: Qt.point(0, 0)
|
||||
end: Qt.point(height, width)
|
||||
}
|
||||
|
||||
// Make window draggable
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
property point lastMousePos: Qt.point(0, 0)
|
||||
onPressed: { lastMousePos = Qt.point(mouseX, mouseY); }
|
||||
onMouseXChanged: root.x += (mouseX - lastMousePos.x)
|
||||
onMouseYChanged: root.y += (mouseY - lastMousePos.y)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: mainLayout
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 20
|
||||
anchors.margins: 35
|
||||
spacing: 20
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
border.color: MoneroComponents.Style.inputBorderColorActive
|
||||
border.width: 1
|
||||
radius: 4
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flickable
|
||||
anchors.fill: parent
|
||||
|
||||
TextArea.flickable: TextArea {
|
||||
id : dialogContent
|
||||
textFormat: TextEdit.RichText
|
||||
selectByMouse: true
|
||||
selectByKeyboard: true
|
||||
font.family: MoneroComponents.Style.defaultFontColor
|
||||
font.pixelSize: 14
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
selectionColor: MoneroComponents.Style.textSelectionColor
|
||||
wrapMode: TextEdit.Wrap
|
||||
readOnly: true
|
||||
function logCommand(msg){
|
||||
msg = log_color(msg, MoneroComponents.Style.blackTheme ? "lime" : "#009100");
|
||||
textArea.append(msg);
|
||||
}
|
||||
function logMessage(msg){
|
||||
msg = msg.trim();
|
||||
var color = MoneroComponents.Style.defaultFontColor;
|
||||
if(msg.toLowerCase().indexOf('error') >= 0){
|
||||
color = MoneroComponents.Style.errorColor;
|
||||
} else if (msg.toLowerCase().indexOf('warning') >= 0){
|
||||
color = MoneroComponents.Style.warningColor;
|
||||
}
|
||||
|
||||
// format multi-lines
|
||||
if(msg.split("\n").length >= 2){
|
||||
msg = msg.split("\n").join('<br>');
|
||||
}
|
||||
|
||||
log(msg, color);
|
||||
}
|
||||
function log_color(msg, color){
|
||||
return "<span style='color: " + color + ";' >" + msg + "</span>";
|
||||
}
|
||||
function log(msg, color){
|
||||
var timestamp = Utils.formatDate(new Date(), {
|
||||
weekday: undefined,
|
||||
month: "numeric",
|
||||
timeZoneName: undefined
|
||||
});
|
||||
|
||||
var _timestamp = log_color("[" + timestamp + "]", "#FFFFFF");
|
||||
var _msg = log_color(msg, color);
|
||||
textArea.append(_timestamp + " " + _msg);
|
||||
|
||||
// scroll to bottom
|
||||
//if(flickable.contentHeight > content.height){
|
||||
// flickable.contentY = flickable.contentHeight + 20;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
MoneroComponents.LineEdit {
|
||||
id: sendCommandText
|
||||
Layout.fillWidth: true
|
||||
placeholderText: qsTr("command + enter (e.g help)") + translationManager.emptyString
|
||||
onAccepted: {
|
||||
if(text.length > 0) {
|
||||
textArea.logCommand(">>> " + text)
|
||||
daemonManager.sendCommandAsync(text.split(" "), currentWallet.nettype, function(result) {
|
||||
if (!result) {
|
||||
appWindow.showStatusMessage(qsTr("Failed to send command"), 3);
|
||||
}
|
||||
});
|
||||
}
|
||||
text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// window borders
|
||||
Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
width:1
|
||||
color: "#2F2F2F"
|
||||
z: 2
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
width:1
|
||||
color: "#2F2F2F"
|
||||
z: 2
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
height:1
|
||||
color: "#2F2F2F"
|
||||
z: 2
|
||||
}
|
||||
}
|
||||
@@ -251,6 +251,7 @@ Item {
|
||||
QtQuickControls2.Popup {
|
||||
id: popup
|
||||
padding: 0
|
||||
closePolicy: QtQuickControls2.Popup.CloseOnEscape | QtQuickControls2.Popup.CloseOnPressOutsideParent
|
||||
|
||||
Rectangle {
|
||||
id: calendarRect
|
||||
|
||||
@@ -125,6 +125,8 @@ Item {
|
||||
source: rect
|
||||
}
|
||||
|
||||
Keys.enabled: inlineButton.visible
|
||||
Keys.onSpacePressed: doClick()
|
||||
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
||||
Keys.onReturnPressed: doClick()
|
||||
}
|
||||
|
||||
@@ -45,18 +45,16 @@ Item {
|
||||
signal accepted()
|
||||
signal rejected()
|
||||
|
||||
function open() {
|
||||
inactiveOverlay.visible = true
|
||||
function open(prepopulate) {
|
||||
leftPanel.enabled = false
|
||||
middlePanel.enabled = false
|
||||
titleBar.state = "essentials"
|
||||
root.visible = true;
|
||||
input.focus = true;
|
||||
input.text = "";
|
||||
input.text = prepopulate ? prepopulate : "";
|
||||
}
|
||||
|
||||
function close() {
|
||||
inactiveOverlay.visible = false
|
||||
leftPanel.enabled = true
|
||||
middlePanel.enabled = true
|
||||
titleBar.state = "default"
|
||||
@@ -110,6 +108,8 @@ Item {
|
||||
color: MoneroComponents.Style.blackTheme ? "black" : "#A9FFFFFF"
|
||||
}
|
||||
|
||||
Keys.enabled: root.visible
|
||||
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
||||
Keys.onReturnPressed: {
|
||||
root.close()
|
||||
root.accepted()
|
||||
|
||||
@@ -36,7 +36,6 @@ Rectangle {
|
||||
id: button
|
||||
property alias text: label.text
|
||||
property bool checked: false
|
||||
property alias dotColor: dot.color
|
||||
property alias symbol: symbolText.text
|
||||
property int numSelectedChildren: 0
|
||||
property var under: null
|
||||
@@ -88,27 +87,10 @@ Rectangle {
|
||||
// button decorations that are subject to leftMargin offsets
|
||||
Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: parent.getOffset() + 20
|
||||
anchors.leftMargin: 20
|
||||
height: parent.height
|
||||
width: button.checked ? 20: 10
|
||||
color: "transparent"
|
||||
|
||||
// dot if unchecked
|
||||
Rectangle {
|
||||
id: dot
|
||||
anchors.centerIn: parent
|
||||
width: button.checked ? 20 : 8
|
||||
height: button.checked ? 20 : 8
|
||||
radius: button.checked ? 20 : 4
|
||||
color: button.dotColor
|
||||
// arrow if checked
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
anchors.left: parent.left
|
||||
source: MoneroComponents.Style.menuButtonImageDotArrowSource
|
||||
visible: button.checked
|
||||
}
|
||||
}
|
||||
width: 2
|
||||
color: button.checked ? MoneroComponents.Style.buttonBackgroundColor : "transparent"
|
||||
|
||||
// button text
|
||||
MoneroComponents.TextPlain {
|
||||
@@ -118,7 +100,7 @@ Rectangle {
|
||||
themeTransitionWhiteColor: MoneroComponents.Style._w_menuButtonTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.right
|
||||
anchors.leftMargin: 8
|
||||
anchors.leftMargin: button.getOffset() + 8
|
||||
font.bold: true
|
||||
font.pixelSize: 14
|
||||
}
|
||||
@@ -144,7 +126,7 @@ Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pixelSize: 12
|
||||
font.bold: true
|
||||
color: button.checked || buttonArea.containsMouse ? MoneroComponents.Style.menuButtonTextColor : dot.color
|
||||
color: MoneroComponents.Style.menuButtonTextColor
|
||||
visible: appWindow.ctrlPressed
|
||||
themeTransition: false
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -68,7 +68,6 @@ Item {
|
||||
passwordInput1.text = ""
|
||||
passwordInput2.text = ""
|
||||
passwordInput1.forceActiveFocus();
|
||||
inactiveOverlay.visible = true // draw appwindow inactive
|
||||
root.walletName = walletName ? walletName : ""
|
||||
errorTextLabel.text = errorText ? errorText : "";
|
||||
leftPanel.enabled = false
|
||||
@@ -106,7 +105,6 @@ Item {
|
||||
}
|
||||
|
||||
function close() {
|
||||
inactiveOverlay.visible = false
|
||||
leftPanel.enabled = true
|
||||
middlePanel.enabled = true
|
||||
wizard.enabled = true
|
||||
@@ -125,7 +123,6 @@ Item {
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
z: inactiveOverlay.z + 1
|
||||
id: mainLayout
|
||||
spacing: 10
|
||||
anchors { fill: parent; margins: 35 }
|
||||
@@ -254,7 +251,11 @@ Item {
|
||||
}
|
||||
|
||||
Keys.enabled: root.visible
|
||||
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
||||
Keys.onReturnPressed: {
|
||||
if (!passwordDialogMode && passwordInput1.text !== passwordInput2.text) {
|
||||
return;
|
||||
}
|
||||
root.close()
|
||||
if (passwordDialogMode) {
|
||||
root.accepted()
|
||||
@@ -352,6 +353,8 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Keys.enabled: root.visible
|
||||
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
||||
Keys.onReturnPressed: {
|
||||
if (passwordInput1.text === passwordInput2.text) {
|
||||
root.close()
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
// Copyright (c) 2014-2018, 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: scrollItem
|
||||
property var flickable
|
||||
property alias scrollColor: scroll.color
|
||||
property alias scrollWidth: scroll.width
|
||||
property alias scrollRadius: scroll.radius
|
||||
width: 15
|
||||
z: 1
|
||||
|
||||
function flickableContentYChanged() {
|
||||
if(flickable === undefined)
|
||||
return
|
||||
|
||||
var t = flickable.height - scroll.height
|
||||
scroll.y = (flickable.contentY / (flickable.contentHeight - flickable.height)) * t
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: scrollArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: scroll
|
||||
|
||||
width: 4
|
||||
radius: width / 2
|
||||
height: {
|
||||
var t = (flickable.height * flickable.height) / flickable.contentHeight
|
||||
return t < 50 ? 50 : t
|
||||
}
|
||||
y: 0; x: 0
|
||||
color: MoneroComponents.Style.orange
|
||||
opacity: flickable.moving || handleArea.pressed || scrollArea.containsMouse ? 0.8 : 0
|
||||
visible: flickable.contentHeight > flickable.height
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 200; easing.type: Easing.InQuad }
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: handleArea
|
||||
anchors.fill: parent
|
||||
drag.target: scroll
|
||||
drag.axis: Drag.YAxis
|
||||
drag.minimumY: 0
|
||||
drag.maximumY: flickable.height - height
|
||||
propagateComposedEvents: true
|
||||
|
||||
onPositionChanged: {
|
||||
if(!pressed) return
|
||||
var dy = scroll.y / (flickable.height - scroll.height)
|
||||
flickable.contentY = (flickable.contentHeight - flickable.height) * dy
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,6 +146,8 @@ Item {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
Keys.enabled: button.visible
|
||||
Keys.onSpacePressed: doClick()
|
||||
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
||||
Keys.onReturnPressed: doClick()
|
||||
}
|
||||
|
||||
@@ -124,7 +124,10 @@ Rectangle {
|
||||
Flickable {
|
||||
id: flickable
|
||||
anchors.fill: parent
|
||||
ScrollBar.vertical: ScrollBar { }
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
onActiveChanged: if (!active && !isMac) active = true
|
||||
}
|
||||
boundsBehavior: isMac ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
|
||||
|
||||
TextArea.flickable: TextArea {
|
||||
id: dialogContent
|
||||
|
||||
@@ -126,6 +126,7 @@ Item {
|
||||
Popup {
|
||||
id: popup
|
||||
padding: 0
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||
|
||||
Rectangle {
|
||||
id: droplist
|
||||
@@ -136,20 +137,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 }
|
||||
}
|
||||
|
||||
@@ -123,7 +123,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"
|
||||
@@ -179,7 +179,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"
|
||||
|
||||
1
fonts/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
qt5_add_resources(RESOURCE_FILES *.otf)
|
||||
@@ -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.15.0.5
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
1
images/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
qt5_add_resources(RESOURCE_FILES *.png)
|
||||
|
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: 28 KiB |
|
Before Width: | Height: | Size: 12 KiB |
@@ -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
|
||||
@@ -166,6 +166,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]
|
||||
@@ -333,7 +334,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
js/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
qt5_add_resources(RESOURCE_FILES *.js)
|
||||
@@ -19,10 +19,8 @@ function setCustomWindowDecorations(custom) {
|
||||
|
||||
if (custom) {
|
||||
appWindow.flags = flagsCustomDecorations;
|
||||
daemonConsolePopup.flags = flagsCustomDecorations;
|
||||
} else {
|
||||
appWindow.flags = flags;
|
||||
daemonConsolePopup.flags = flags;
|
||||
}
|
||||
|
||||
// Reset window
|
||||
|
||||
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"/> -->
|
||||
|
||||
395
main.qml
@@ -31,6 +31,7 @@ import QtQuick.Window 2.0
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
import moneroComponents.Wallet 1.0
|
||||
import moneroComponents.PendingTransaction 1.0
|
||||
@@ -48,21 +49,23 @@ import "js/Windows.js" as Windows
|
||||
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
|
||||
property bool isNewWallet: false
|
||||
property int restoreHeight:0
|
||||
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 alias toolTip: toolTip
|
||||
property string walletName
|
||||
property bool viewOnly: false
|
||||
@@ -201,8 +204,20 @@ ApplicationWindow {
|
||||
leftPanel.selectItem(page);
|
||||
}
|
||||
|
||||
function openWallet(prevState) {
|
||||
passwordDialog.onAcceptedCallback = function() {
|
||||
walletPassword = passwordDialog.password;
|
||||
initialize();
|
||||
}
|
||||
passwordDialog.onRejectedCallback = function() {
|
||||
if (prevState) {
|
||||
appWindow.viewState = prevState;
|
||||
}
|
||||
};
|
||||
passwordDialog.open(usefulName(walletPath()));
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
appWindow.viewState = "normal";
|
||||
console.log("initializing..")
|
||||
|
||||
// Use stored log level
|
||||
@@ -238,30 +253,18 @@ ApplicationWindow {
|
||||
simpleModeConnectionTimer.running = true;
|
||||
|
||||
// wallet already opened with wizard, we just need to initialize it
|
||||
if (typeof wizard.m_wallet !== 'undefined') {
|
||||
console.log("using wizard wallet")
|
||||
//Set restoreHeight
|
||||
if(persistentSettings.restore_height > 0){
|
||||
// We store restore height in own variable for performance reasons.
|
||||
restoreHeight = persistentSettings.restore_height
|
||||
}
|
||||
var wallet_path = walletPath();
|
||||
if(isIOS)
|
||||
wallet_path = moneroAccountsDir + wallet_path;
|
||||
// console.log("opening wallet at: ", wallet_path, "with password: ", appWindow.walletPassword);
|
||||
console.log("opening wallet at: ", wallet_path, ", network type: ", persistentSettings.nettype == NetworkType.MAINNET ? "mainnet" : persistentSettings.nettype == NetworkType.TESTNET ? "testnet" : "stagenet");
|
||||
|
||||
connectWallet(wizard.m_wallet)
|
||||
|
||||
isNewWallet = true
|
||||
// We don't need the wizard wallet any more - delete to avoid conflict with daemon adress change
|
||||
delete wizard.m_wallet
|
||||
} else {
|
||||
var wallet_path = walletPath();
|
||||
if(isIOS)
|
||||
wallet_path = moneroAccountsDir + wallet_path;
|
||||
// console.log("opening wallet at: ", wallet_path, "with password: ", appWindow.walletPassword);
|
||||
console.log("opening wallet at: ", wallet_path, ", network type: ", persistentSettings.nettype == NetworkType.MAINNET ? "mainnet" : persistentSettings.nettype == NetworkType.TESTNET ? "testnet" : "stagenet");
|
||||
|
||||
this.onWalletOpening();
|
||||
walletManager.openWalletAsync(wallet_path, walletPassword,
|
||||
persistentSettings.nettype, persistentSettings.kdfRounds);
|
||||
}
|
||||
this.onWalletOpening();
|
||||
walletManager.openWalletAsync(
|
||||
wallet_path,
|
||||
walletPassword,
|
||||
persistentSettings.nettype,
|
||||
persistentSettings.kdfRounds);
|
||||
|
||||
// Hide titlebar based on persistentSettings.customDecorations
|
||||
titleBar.visible = persistentSettings.customDecorations;
|
||||
@@ -401,6 +404,13 @@ ApplicationWindow {
|
||||
return path.replace(/.*[\/\\]/, '').replace(/\.keys$/, '')
|
||||
}
|
||||
|
||||
function getUnlockedBalance() {
|
||||
if(!currentWallet){
|
||||
return 0
|
||||
}
|
||||
return currentWallet.unlockedBalance()
|
||||
}
|
||||
|
||||
function updateBalance() {
|
||||
if (!currentWallet)
|
||||
return;
|
||||
@@ -408,8 +418,8 @@ ApplicationWindow {
|
||||
var balance = "?.??";
|
||||
var balanceU = "?.??";
|
||||
if(!hideBalanceForced && !persistentSettings.hideBalance){
|
||||
balance = walletManager.displayAmount(currentWallet.balance(currentWallet.currentSubaddressAccount));
|
||||
balanceU = walletManager.displayAmount(currentWallet.unlockedBalance(currentWallet.currentSubaddressAccount));
|
||||
balance = walletManager.displayAmount(currentWallet.balance());
|
||||
balanceU = walletManager.displayAmount(currentWallet.unlockedBalance());
|
||||
}
|
||||
|
||||
if (persistentSettings.fiatPriceEnabled) {
|
||||
@@ -465,19 +475,11 @@ ApplicationWindow {
|
||||
middlePanel.updateStatus();
|
||||
leftPanel.networkStatus.connected = status
|
||||
|
||||
// update local daemon status.
|
||||
const isDisconnected = status === Wallet.ConnectionStatus_Disconnected;
|
||||
if (walletManager.isDaemonLocal(currentDaemonAddress)) {
|
||||
daemonRunning = !isDisconnected;
|
||||
} else {
|
||||
daemonRunning = false;
|
||||
}
|
||||
|
||||
// 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 && walletManager.isDaemonLocal(currentDaemonAddress) && !walletInitialized && isDisconnected) {
|
||||
if (appWindow.walletMode >= 2 && !persistentSettings.useRemoteNode && !walletInitialized && disconnected) {
|
||||
daemonManager.runningAsync(persistentSettings.nettype, function(running) {
|
||||
if (!running) {
|
||||
daemonManagerDialog.open();
|
||||
@@ -517,16 +519,6 @@ ApplicationWindow {
|
||||
walletName = usefulName(wallet.path)
|
||||
console.log(">>> wallet opened: " + wallet)
|
||||
if (wallet.status !== Wallet.Status_Ok) {
|
||||
passwordDialog.onAcceptedCallback = function() {
|
||||
walletPassword = passwordDialog.password;
|
||||
appWindow.initialize();
|
||||
}
|
||||
passwordDialog.onRejectedCallback = function() {
|
||||
walletPassword = "";
|
||||
//appWindow.enableUI(false)
|
||||
wizard.wizardState = "wizardHome";
|
||||
rootItem.state = "wizard";
|
||||
}
|
||||
// try to resolve common wallet cache errors automatically
|
||||
switch (wallet.errorString) {
|
||||
case "basic_string::_M_replace_aux":
|
||||
@@ -567,18 +559,16 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
function onWalletPassphraseNeeded(){
|
||||
if(rootItem.state !== "normal") return;
|
||||
|
||||
hideProcessingSplash();
|
||||
|
||||
console.log(">>> wallet passphrase needed: ")
|
||||
passwordDialog.onAcceptedPassphraseCallback = function() {
|
||||
walletManager.onPassphraseEntered(passwordDialog.password);
|
||||
this.onWalletOpening();
|
||||
appWindow.onWalletOpening();
|
||||
}
|
||||
passwordDialog.onRejectedPassphraseCallback = function() {
|
||||
walletManager.onPassphraseEntered("", true);
|
||||
this.onWalletOpening();
|
||||
appWindow.onWalletOpening();
|
||||
}
|
||||
passwordDialog.openPassphraseDialog()
|
||||
}
|
||||
@@ -643,23 +633,12 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
// Update wallet sync progress
|
||||
leftPanel.isSyncing = (currentWallet.connected() !== Wallet.ConnectionStatus_Disconnected) && !daemonSynced
|
||||
leftPanel.isSyncing = !disconnected && !daemonSynced;
|
||||
// Update transfer page status
|
||||
middlePanel.updateStatus();
|
||||
|
||||
// Refresh is succesfull if blockchain height > 1
|
||||
if (bcHeight > 1){
|
||||
// Save new wallet after first refresh
|
||||
// Wallet is nomrmally saved to disk on app exit. This prevents rescan from block 0 after app crash
|
||||
if(isNewWallet){
|
||||
console.log("Saving wallet after first refresh");
|
||||
currentWallet.store()
|
||||
isNewWallet = false
|
||||
|
||||
// Update History
|
||||
currentWallet.history.refresh(currentWallet.currentSubaddressAccount);
|
||||
}
|
||||
|
||||
// recovering from seed is finished after first refresh
|
||||
if(persistentSettings.is_recovering) {
|
||||
persistentSettings.is_recovering = false
|
||||
@@ -680,7 +659,7 @@ ApplicationWindow {
|
||||
console.log(">>> wallet refreshed")
|
||||
|
||||
// Daemon connected
|
||||
leftPanel.networkStatus.connected = currentWallet.connected()
|
||||
leftPanel.networkStatus.connected = currentWallet ? currentWallet.connected() : Wallet.ConnectionStatus_Disconnected
|
||||
|
||||
currentWallet.refreshHeightAsync();
|
||||
}
|
||||
@@ -694,17 +673,20 @@ ApplicationWindow {
|
||||
|
||||
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){
|
||||
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop..."))
|
||||
daemonManager.stop(persistentSettings.nettype);
|
||||
daemonManager.stopAsync(persistentSettings.nettype, function(result) {
|
||||
hideProcessingSplash();
|
||||
callback(result);
|
||||
});
|
||||
}
|
||||
|
||||
function onDaemonStarted(){
|
||||
console.log("daemon started");
|
||||
daemonRunning = true;
|
||||
hideProcessingSplash();
|
||||
currentWallet.connected(true);
|
||||
// resume refresh
|
||||
@@ -714,20 +696,16 @@ ApplicationWindow {
|
||||
simpleModeConnectionTimer.start();
|
||||
}
|
||||
function onDaemonStopped(){
|
||||
console.log("daemon stopped");
|
||||
hideProcessingSplash();
|
||||
daemonRunning = false;
|
||||
currentWallet.connected(true);
|
||||
}
|
||||
|
||||
function onDaemonStartFailure(){
|
||||
function onDaemonStartFailure(error) {
|
||||
console.log("daemon start failed");
|
||||
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();
|
||||
@@ -858,24 +836,24 @@ ApplicationWindow {
|
||||
if (amount !== "(all)") {
|
||||
var amountxmr = walletManager.amountFromString(amount);
|
||||
console.log("integer amount: ", amountxmr);
|
||||
console.log("integer unlocked",currentWallet.unlockedBalance)
|
||||
console.log("integer unlocked", currentWallet.unlockedBalance())
|
||||
if (amountxmr <= 0) {
|
||||
hideProcessingSplash()
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||
informationPopup.text = qsTr("Amount is wrong: expected number from %1 to %2")
|
||||
.arg(walletManager.displayAmount(0))
|
||||
.arg(walletManager.maximumAllowedAmountAsSting())
|
||||
.arg(walletManager.displayAmount(currentWallet.unlockedBalance()))
|
||||
+ translationManager.emptyString
|
||||
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open()
|
||||
return;
|
||||
} else if (amountxmr > currentWallet.unlockedBalance) {
|
||||
} else if (amountxmr > currentWallet.unlockedBalance()) {
|
||||
hideProcessingSplash()
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||
informationPopup.text = qsTr("Insufficient funds. Unlocked balance: %1")
|
||||
.arg(walletManager.displayAmount(currentWallet.unlockedBalance))
|
||||
.arg(walletManager.displayAmount(currentWallet.unlockedBalance()))
|
||||
+ translationManager.emptyString
|
||||
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
@@ -1104,7 +1082,6 @@ ApplicationWindow {
|
||||
leftPanel.enabled = false;
|
||||
middlePanel.enabled = false;
|
||||
titleBar.enabled = false;
|
||||
inactiveOverlay.visible = true;
|
||||
splash.show();
|
||||
}
|
||||
|
||||
@@ -1116,7 +1093,6 @@ ApplicationWindow {
|
||||
leftPanel.enabled = true
|
||||
middlePanel.enabled = true
|
||||
titleBar.enabled = true
|
||||
inactiveOverlay.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1129,6 +1105,9 @@ ApplicationWindow {
|
||||
rootItem.state = "wizard"
|
||||
// reset balance
|
||||
clearMoneroCardLabelText();
|
||||
middlePanel.addressBookView.clearFields();
|
||||
middlePanel.transferView.clearFields();
|
||||
middlePanel.receiveView.clearFields();
|
||||
// disable timers
|
||||
userInActivityTimer.running = false;
|
||||
simpleModeConnectionTimer.running = false;
|
||||
@@ -1330,18 +1309,12 @@ ApplicationWindow {
|
||||
} else console.log("qrScannerEnabled disabled");
|
||||
|
||||
if(!walletsFound()) {
|
||||
wizard.wizardState = "wizardLanguage";
|
||||
rootItem.state = "wizard"
|
||||
} else {
|
||||
wizard.wizardState = "wizardHome";
|
||||
rootItem.state = "normal"
|
||||
passwordDialog.onAcceptedCallback = function() {
|
||||
walletPassword = passwordDialog.password;
|
||||
initialize(persistentSettings);
|
||||
}
|
||||
passwordDialog.onRejectedCallback = function() {
|
||||
wizard.wizardState = "wizardHome";
|
||||
rootItem.state = "wizard"
|
||||
}
|
||||
passwordDialog.open(usefulName(walletPath()))
|
||||
openWallet("wizard");
|
||||
}
|
||||
|
||||
checkUpdates();
|
||||
@@ -1364,12 +1337,9 @@ ApplicationWindow {
|
||||
property string locale
|
||||
property string account_name
|
||||
property string wallet_path
|
||||
property bool auto_donations_enabled : false
|
||||
property int auto_donations_amount : 50
|
||||
property bool allow_background_mining : false
|
||||
property bool miningIgnoreBattery : true
|
||||
property var nettype: NetworkType.MAINNET
|
||||
property string payment_id
|
||||
property int restore_height : 0
|
||||
property bool is_trusted_daemon : false
|
||||
property bool is_recovering : false
|
||||
@@ -1607,107 +1577,120 @@ ApplicationWindow {
|
||||
}
|
||||
]
|
||||
|
||||
LeftPanel {
|
||||
id: leftPanel
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
visible: rootItem.state == "normal" && middlePanel.state != "Merchant"
|
||||
currentAccountIndex: currentWallet ? currentWallet.currentSubaddressAccount : 0
|
||||
currentAccountLabel: {
|
||||
if (currentWallet) {
|
||||
return currentWallet.getSubaddressLabel(currentWallet.currentSubaddressAccount, 0);
|
||||
}
|
||||
return qsTr("Primary account") + translationManager.emptyString;
|
||||
}
|
||||
|
||||
onTransferClicked: {
|
||||
middlePanel.state = "Transfer";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onReceiveClicked: {
|
||||
middlePanel.state = "Receive";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onMerchantClicked: {
|
||||
middlePanel.state = "Merchant";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onTxkeyClicked: {
|
||||
middlePanel.state = "TxKey";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onSharedringdbClicked: {
|
||||
middlePanel.state = "SharedRingDB";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onHistoryClicked: {
|
||||
middlePanel.state = "History";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onAddressBookClicked: {
|
||||
middlePanel.state = "AddressBook";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onMiningClicked: {
|
||||
middlePanel.state = "Mining";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onSignClicked: {
|
||||
middlePanel.state = "Sign";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onSettingsClicked: {
|
||||
middlePanel.state = "Settings";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onAccountClicked: {
|
||||
middlePanel.state = "Account";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MiddlePanel {
|
||||
id: middlePanel
|
||||
accountView.currentAccountIndex: currentWallet ? currentWallet.currentSubaddressAccount : 0
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: leftPanel.visible ? leftPanel.right : parent.left
|
||||
anchors.right: parent.right
|
||||
state: "Transfer"
|
||||
}
|
||||
|
||||
WizardController {
|
||||
id: wizard
|
||||
Item {
|
||||
id: blurredArea
|
||||
anchors.fill: parent
|
||||
onUseMoneroClicked: {
|
||||
rootItem.state = "normal";
|
||||
appWindow.initialize();
|
||||
|
||||
LeftPanel {
|
||||
id: leftPanel
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
visible: rootItem.state == "normal" && middlePanel.state != "Merchant"
|
||||
currentAccountIndex: currentWallet ? currentWallet.currentSubaddressAccount : 0
|
||||
currentAccountLabel: {
|
||||
if (currentWallet) {
|
||||
return currentWallet.getSubaddressLabel(currentWallet.currentSubaddressAccount, 0);
|
||||
}
|
||||
return qsTr("Primary account") + translationManager.emptyString;
|
||||
}
|
||||
|
||||
onTransferClicked: {
|
||||
middlePanel.state = "Transfer";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onReceiveClicked: {
|
||||
middlePanel.state = "Receive";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onMerchantClicked: {
|
||||
middlePanel.state = "Merchant";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onTxkeyClicked: {
|
||||
middlePanel.state = "TxKey";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onSharedringdbClicked: {
|
||||
middlePanel.state = "SharedRingDB";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onHistoryClicked: {
|
||||
middlePanel.state = "History";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onAddressBookClicked: {
|
||||
middlePanel.state = "AddressBook";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onMiningClicked: {
|
||||
middlePanel.state = "Mining";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onSignClicked: {
|
||||
middlePanel.state = "Sign";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onSettingsClicked: {
|
||||
middlePanel.state = "Settings";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
|
||||
onAccountClicked: {
|
||||
middlePanel.state = "Account";
|
||||
middlePanel.flickable.contentY = 0;
|
||||
updateBalance();
|
||||
}
|
||||
}
|
||||
|
||||
MiddlePanel {
|
||||
id: middlePanel
|
||||
accountView.currentAccountIndex: currentWallet ? currentWallet.currentSubaddressAccount : 0
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: leftPanel.visible ? leftPanel.right : parent.left
|
||||
anchors.right: parent.right
|
||||
state: "Transfer"
|
||||
}
|
||||
|
||||
WizardController {
|
||||
id: wizard
|
||||
anchors.fill: parent
|
||||
onUseMoneroClicked: {
|
||||
rootItem.state = "normal";
|
||||
appWindow.openWallet("wizard");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FastBlur {
|
||||
id: blur
|
||||
anchors.fill: blurredArea
|
||||
source: blurredArea
|
||||
radius: 64
|
||||
visible: passwordDialog.visible || inputDialog.visible || splash.visible
|
||||
}
|
||||
|
||||
|
||||
WizardLang {
|
||||
id: languageView
|
||||
visible: false
|
||||
@@ -1874,11 +1857,10 @@ ApplicationWindow {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -1945,8 +1927,7 @@ ApplicationWindow {
|
||||
onClose();
|
||||
}
|
||||
confirmationDialog.onRejectedCallback = function() {
|
||||
daemonManager.stop(persistentSettings.nettype);
|
||||
onClose();
|
||||
stopDaemon(onClose);
|
||||
};
|
||||
confirmationDialog.open();
|
||||
}
|
||||
@@ -1973,8 +1954,7 @@ ApplicationWindow {
|
||||
// If daemon is running - prompt user before exiting
|
||||
if(typeof daemonManager != "undefined" && daemonRunning) {
|
||||
if (appWindow.walletMode == 0) {
|
||||
stopDaemon();
|
||||
closeAccepted();
|
||||
stopDaemon(closeAccepted);
|
||||
} else {
|
||||
showDaemonIsRunningDialog(closeAccepted);
|
||||
}
|
||||
@@ -2000,11 +1980,11 @@ ApplicationWindow {
|
||||
var version = parts[0]
|
||||
var hash = parts[1]
|
||||
var user_url = parts[2]
|
||||
var msg = ""
|
||||
var msg = qsTr("New version of Monero v%1 is available.").arg(version)
|
||||
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
|
||||
msg += "<br><br>%1:<br>%2<br><br>%3:<br>%4".arg(qsTr("Download")).arg(user_url).arg(qsTr("SHA256 Hash")).arg(hash) + translationManager.emptyString
|
||||
} else {
|
||||
msg = qsTr("New version of Monero v%1 is available. Check out getmonero.org").arg(version) + translationManager.emptyString
|
||||
msg += " " + qsTr("Check out getmonero.org") + translationManager.emptyString
|
||||
}
|
||||
notifier.show(msg)
|
||||
} else {
|
||||
@@ -2055,6 +2035,7 @@ ApplicationWindow {
|
||||
if(rootItem.state !== "normal") return;
|
||||
if(!persistentSettings.lockOnUserInActivity) return;
|
||||
if(passwordDialog.visible) return;
|
||||
var inputDialogVisible = inputDialog && inputDialog.visible
|
||||
|
||||
// prompt password after X seconds of inactivity
|
||||
var epoch = Math.floor((new Date).getTime() / 1000);
|
||||
@@ -2067,9 +2048,11 @@ ApplicationWindow {
|
||||
} else {
|
||||
passwordDialog.showError(qsTr("Wrong password"));
|
||||
}
|
||||
if (inputDialogVisible) inputDialog.open(inputDialog.inputText)
|
||||
}
|
||||
|
||||
passwordDialog.onRejectedCallback = function() { appWindow.showWizard(); }
|
||||
if (inputDialogVisible) inputDialog.close()
|
||||
passwordDialog.open();
|
||||
}
|
||||
|
||||
@@ -2094,7 +2077,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"
|
||||
@@ -2103,24 +2085,13 @@ ApplicationWindow {
|
||||
console.log("walletMode: " + (mode === 0 ? "simple": mode === 1 ? "simple (bootstrap)" : "Advanced"));
|
||||
}
|
||||
|
||||
// Daemon console
|
||||
DaemonConsole {
|
||||
id: daemonConsolePopup
|
||||
height:500
|
||||
width:800
|
||||
title: qsTr("Daemon log") + translationManager.emptyString
|
||||
onAccepted: {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: inactiveOverlay
|
||||
visible: false
|
||||
visible: blur.visible
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: titleBar.height
|
||||
color: MoneroComponents.Style.blackTheme ? "black" : "white"
|
||||
opacity: MoneroComponents.Style.blackTheme ? 0.8 : 0.9
|
||||
opacity: isOpenGL ? 0.3 : inputDialog.visible || splash.visible ? 0.7 : 1.0
|
||||
|
||||
MoneroEffects.ColorTransition {
|
||||
targetObj: parent
|
||||
|
||||
@@ -43,12 +43,14 @@ 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 += \
|
||||
filter.h \
|
||||
clipboardAdapter.h \
|
||||
oscursor.h \
|
||||
src/main/filter.h \
|
||||
src/main/clipboardAdapter.h \
|
||||
src/main/oscursor.h \
|
||||
src/libwalletqt/WalletManager.h \
|
||||
src/libwalletqt/Wallet.h \
|
||||
src/libwalletqt/PendingTransaction.h \
|
||||
@@ -57,8 +59,8 @@ HEADERS += \
|
||||
src/libwalletqt/QRCodeImageProvider.h \
|
||||
src/libwalletqt/Transfer.h \
|
||||
src/NetworkType.h \
|
||||
oshelper.h \
|
||||
TranslationManager.h \
|
||||
src/main/oshelper.h \
|
||||
src/TranslationManager.h \
|
||||
src/model/TransactionHistoryModel.h \
|
||||
src/model/TransactionHistorySortFilterModel.h \
|
||||
src/QR-Code-generator/BitBuffer.hpp \
|
||||
@@ -72,8 +74,8 @@ HEADERS += \
|
||||
src/libwalletqt/SubaddressAccount.h \
|
||||
src/zxcvbn-c/zxcvbn.h \
|
||||
src/libwalletqt/UnsignedTransaction.h \
|
||||
Logger.h \
|
||||
MainApp.h \
|
||||
src/main/Logger.h \
|
||||
src/main/MainApp.h \
|
||||
src/qt/FutureScheduler.h \
|
||||
src/qt/ipc.h \
|
||||
src/qt/KeysFiles.h \
|
||||
@@ -83,18 +85,18 @@ HEADERS += \
|
||||
src/qt/MoneroSettings.h \
|
||||
src/qt/TailsOS.h
|
||||
|
||||
SOURCES += main.cpp \
|
||||
filter.cpp \
|
||||
clipboardAdapter.cpp \
|
||||
oscursor.cpp \
|
||||
SOURCES += src/main/main.cpp \
|
||||
src/main/filter.cpp \
|
||||
src/main/clipboardAdapter.cpp \
|
||||
src/main/oscursor.cpp \
|
||||
src/libwalletqt/WalletManager.cpp \
|
||||
src/libwalletqt/Wallet.cpp \
|
||||
src/libwalletqt/PendingTransaction.cpp \
|
||||
src/libwalletqt/TransactionHistory.cpp \
|
||||
src/libwalletqt/TransactionInfo.cpp \
|
||||
src/libwalletqt/QRCodeImageProvider.cpp \
|
||||
oshelper.cpp \
|
||||
TranslationManager.cpp \
|
||||
src/main/oshelper.cpp \
|
||||
src/TranslationManager.cpp \
|
||||
src/model/TransactionHistoryModel.cpp \
|
||||
src/model/TransactionHistorySortFilterModel.cpp \
|
||||
src/QR-Code-generator/BitBuffer.cpp \
|
||||
@@ -108,8 +110,8 @@ SOURCES += main.cpp \
|
||||
src/libwalletqt/SubaddressAccount.cpp \
|
||||
src/zxcvbn-c/zxcvbn.c \
|
||||
src/libwalletqt/UnsignedTransaction.cpp \
|
||||
Logger.cpp \
|
||||
MainApp.cpp \
|
||||
src/main/Logger.cpp \
|
||||
src/main/MainApp.cpp \
|
||||
src/qt/FutureScheduler.cpp \
|
||||
src/qt/ipc.cpp \
|
||||
src/qt/KeysFiles.cpp \
|
||||
@@ -176,8 +178,8 @@ 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 += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Werror -Wformat -Wformat-security
|
||||
QMAKE_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Werror -Wformat -Wformat-security
|
||||
|
||||
ios {
|
||||
message("Host is IOS")
|
||||
@@ -299,7 +301,8 @@ win32 {
|
||||
-lssl \
|
||||
-lsodium \
|
||||
-lcrypto \
|
||||
-lws2_32
|
||||
-lws2_32 \
|
||||
-lole32
|
||||
|
||||
!contains(QMAKE_TARGET.arch, x86_64) {
|
||||
message("Target is 32bit")
|
||||
@@ -371,18 +374,28 @@ 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
|
||||
}
|
||||
|
||||
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 +527,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 +535,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
|
||||
|
||||
@@ -53,12 +53,12 @@ Rectangle {
|
||||
|
||||
function renameSubaddressAccountLabel(_index){
|
||||
inputDialog.labelText = qsTr("Set the label of the selected account:") + translationManager.emptyString;
|
||||
inputDialog.inputText = appWindow.currentWallet.getSubaddressLabel(_index, 0);
|
||||
inputDialog.onAcceptedCallback = function() {
|
||||
appWindow.currentWallet.subaddressAccount.setLabel(_index, inputDialog.inputText)
|
||||
appWindow.currentWallet.setSubaddressLabel(_index, 0, inputDialog.inputText)
|
||||
appWindow.currentWallet.subaddressAccount.refresh()
|
||||
}
|
||||
inputDialog.onRejectedCallback = null;
|
||||
inputDialog.open()
|
||||
inputDialog.open(appWindow.currentWallet.getSubaddressLabel(_index, 0))
|
||||
}
|
||||
|
||||
Clipboard { id: clipboard }
|
||||
@@ -354,7 +354,6 @@ Rectangle {
|
||||
text: qsTr("Create new account") + translationManager.emptyString;
|
||||
onClicked: {
|
||||
inputDialog.labelText = qsTr("Set the label of the new account:") + translationManager.emptyString
|
||||
inputDialog.inputText = qsTr("(Untitled)") + translationManager.emptyString
|
||||
inputDialog.onAcceptedCallback = function() {
|
||||
appWindow.currentWallet.subaddressAccount.addRow(inputDialog.inputText)
|
||||
appWindow.currentWallet.switchSubaddressAccount(appWindow.currentWallet.numSubaddressAccounts() - 1)
|
||||
|
||||
@@ -306,8 +306,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";
|
||||
@@ -384,8 +384,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 {
|
||||
|
||||
1
pages/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
qt5_add_resources(RESOURCE_FILES *.qrc)
|
||||
@@ -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: {
|
||||
@@ -477,7 +477,6 @@ Rectangle {
|
||||
return;
|
||||
|
||||
inputDialog.labelText = qsTr("Jump to page (1-%1)").arg(pages) + translationManager.emptyString;
|
||||
inputDialog.inputText = "1";
|
||||
inputDialog.onAcceptedCallback = function() {
|
||||
var pageNumber = parseInt(inputDialog.inputText);
|
||||
if (!isNaN(pageNumber) && pageNumber >= 1 && pageNumber <= pages) {
|
||||
@@ -634,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
|
||||
@@ -1195,7 +1204,7 @@ Rectangle {
|
||||
if(res[i].state === 'copyable' && res[i].parent.hasOwnProperty('text')) toClipboard(res[i].parent.text);
|
||||
if(res[i].state === 'copyable_address') root.toClipboard(address);
|
||||
if(res[i].state === 'copyable_txkey') root.getTxKey(hash, res[i]);
|
||||
if(res[i].state === 'set_tx_note') root.editDescription(hash);
|
||||
if(res[i].state === 'set_tx_note') root.editDescription(hash, tx_note);
|
||||
if(res[i].state === 'details') root.showTxDetails(hash, paymentId, destinations, subaddrAccount, subaddrIndex, dateTime, displayAmount, isout);
|
||||
if(res[i].state === 'proof') root.showTxProof(hash, paymentId, destinations, subaddrAccount, subaddrIndex);
|
||||
doCollapse = false;
|
||||
@@ -1315,7 +1324,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
visible: !isIOS && root.txCount > 0
|
||||
visible: !isIOS
|
||||
small: true
|
||||
text: qsTr("Export all history") + translationManager.emptyString
|
||||
onClicked: {
|
||||
@@ -1383,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);
|
||||
@@ -1533,7 +1542,7 @@ Rectangle {
|
||||
root.updateFilter();
|
||||
}
|
||||
|
||||
function editDescription(_hash){
|
||||
function editDescription(_hash, _tx_note){
|
||||
inputDialog.labelText = qsTr("Set description:") + translationManager.emptyString;
|
||||
inputDialog.onAcceptedCallback = function() {
|
||||
appWindow.currentWallet.setUserNote(_hash, inputDialog.inputText);
|
||||
@@ -1541,7 +1550,7 @@ Rectangle {
|
||||
root.update();
|
||||
}
|
||||
inputDialog.onRejectedCallback = null;
|
||||
inputDialog.open();
|
||||
inputDialog.open(_tx_note);
|
||||
}
|
||||
|
||||
function paginationPrevClicked(){
|
||||
@@ -1599,7 +1608,7 @@ Rectangle {
|
||||
|
||||
currentWallet.getTxKeyAsync(hash, function(hash, tx_key) {
|
||||
informationPopup.title = qsTr("Transaction details") + translationManager.emptyString;
|
||||
informationPopup.content = buildTxDetailsString(hash, paymentId, tx_key, tx_note, destinations, rings, address, address_label, integratedAddress, dateTime, amount);
|
||||
informationPopup.content = buildTxDetailsString(hash, hasPaymentId ? paymentId : null, tx_key, tx_note, destinations, rings, address, address_label, integratedAddress, dateTime, amount);
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open();
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -57,13 +57,13 @@ Rectangle {
|
||||
MoneroComponents.WarningBox {
|
||||
Layout.bottomMargin: 8
|
||||
text: qsTr("Mining is only available on local daemons.") + translationManager.emptyString
|
||||
visible: !walletManager.isDaemonLocal(appWindow.currentDaemonAddress)
|
||||
visible: persistentSettings.useRemoteNode
|
||||
}
|
||||
|
||||
MoneroComponents.WarningBox {
|
||||
Layout.bottomMargin: 8
|
||||
text: qsTr("Your daemon must be synchronized before you can start mining") + translationManager.emptyString
|
||||
visible: walletManager.isDaemonLocal(appWindow.currentDaemonAddress) && !appWindow.daemonSynced
|
||||
visible: !persistentSettings.useRemoteNode && !appWindow.daemonSynced
|
||||
}
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
@@ -199,7 +199,7 @@ Rectangle {
|
||||
} else {
|
||||
errorPopup.title = qsTr("Error starting mining") + translationManager.emptyString;
|
||||
errorPopup.text = qsTr("Couldn't start mining.<br>") + translationManager.emptyString
|
||||
if (!walletManager.isDaemonLocal(appWindow.currentDaemonAddress))
|
||||
if (persistentSettings.useRemoteNode)
|
||||
errorPopup.text += qsTr("Mining is only available on local daemons. Run a local daemon to be able to mine.<br>") + translationManager.emptyString
|
||||
errorPopup.icon = StandardIcon.Critical
|
||||
errorPopup.open()
|
||||
@@ -259,7 +259,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
function onMiningStatus(isMining) {
|
||||
var daemonReady = walletManager.isDaemonLocal(appWindow.currentDaemonAddress) && appWindow.daemonSynced
|
||||
var daemonReady = !persistentSettings.useRemoteNode && appWindow.daemonSynced
|
||||
appWindow.isMining = isMining;
|
||||
updateStatusText()
|
||||
startSoloMinerButton.enabled = !appWindow.isMining && daemonReady
|
||||
@@ -284,7 +284,7 @@ Rectangle {
|
||||
function onPageCompleted() {
|
||||
console.log("Mining page loaded");
|
||||
update()
|
||||
timer.running = walletManager.isDaemonLocal(appWindow.currentDaemonAddress)
|
||||
timer.running = !persistentSettings.useRemoteNode
|
||||
}
|
||||
|
||||
function onPageClosed() {
|
||||
|
||||
@@ -53,12 +53,11 @@ Rectangle {
|
||||
|
||||
function renameSubaddressLabel(_index){
|
||||
inputDialog.labelText = qsTr("Set the label of the selected address:") + translationManager.emptyString;
|
||||
inputDialog.inputText = appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, _index);
|
||||
inputDialog.onAcceptedCallback = function() {
|
||||
appWindow.currentWallet.subaddress.setLabel(appWindow.currentWallet.currentSubaddressAccount, _index, inputDialog.inputText);
|
||||
}
|
||||
inputDialog.onRejectedCallback = null;
|
||||
inputDialog.open()
|
||||
inputDialog.open(appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, _index))
|
||||
}
|
||||
|
||||
Clipboard { id: clipboard }
|
||||
@@ -74,10 +73,6 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
|
||||
spacing: 20
|
||||
property int labelWidth: 120
|
||||
property int editWidth: 400
|
||||
property int lineEditFontSize: 12
|
||||
property int qrCodeSize: 220
|
||||
|
||||
ColumnLayout {
|
||||
id: addressRow
|
||||
@@ -254,7 +249,6 @@ Rectangle {
|
||||
text: qsTr("Create new address") + translationManager.emptyString;
|
||||
onClicked: {
|
||||
inputDialog.labelText = qsTr("Set the label of the new address:") + translationManager.emptyString
|
||||
inputDialog.inputText = qsTr("(Untitled)") + translationManager.emptyString
|
||||
inputDialog.onAcceptedCallback = function() {
|
||||
appWindow.currentWallet.subaddress.addRow(appWindow.currentWallet.currentSubaddressAccount, inputDialog.inputText)
|
||||
current_subaddress_table_index = appWindow.currentWallet.numSubaddresses(appWindow.currentWallet.currentSubaddressAccount) - 1
|
||||
@@ -296,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: ''
|
||||
}
|
||||
|
||||
@@ -51,11 +51,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 bool showAdvanced: false
|
||||
// @TODO: remove after pid removal hardfork
|
||||
property bool warningLongPidTransfer: false
|
||||
property string sendButtonWarning: {
|
||||
// Currently opened wallet is not view-only
|
||||
if (appWindow.viewOnly) {
|
||||
return 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;
|
||||
}
|
||||
|
||||
// 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 }
|
||||
@@ -87,22 +110,10 @@ Rectangle {
|
||||
paymentIdCheckbox.checked = paymentIdLine.text != "";
|
||||
}
|
||||
|
||||
function isLongPidService(text) {
|
||||
// @TODO: remove after pid removal hardfork
|
||||
return text.length == 95 &&
|
||||
[ "44tLjmXrQNrWJ5NBsEj2R77ZBEgDa3fEe9GLpSf2FRmhexPvfYDUAB7EXX1Hdb3aMQ9FLqdJ56yaAhiXoRsceGJCRS3Jxkn", // Binance
|
||||
"4AQ3ZREb53FMYKBmpPn7BD7hphPk6G1ceinQX6gefAvhFJsNbeFsGwebZWCNxoJAbZhD9cjetBAqmLhfXmcNLBpPMsBL6yM", // KuCoin
|
||||
"47YzEcMrU2S42UitURo7ukUDaSaL485Z1QbmFgq1vSs5g3JesL4rChwWf2uWk1va99JAaRxt65jhX9uAqQnjeFM44ckgZtp", // AnycoinDirect
|
||||
"4BCeEPhodgPMbPWFN1dPwhWXdRX8q4mhhdZdA1dtSMLTLCEYvAj9QXjXAfF7CugEbmfBhgkqHbdgK9b2wKA6nqRZQCgvCDm", // Bitfinex
|
||||
"463tWEBn5XZJSxLU6uLQnQ2iY9xuNcDbjLSjkn3XAXHCbLrTTErJrBWYgHJQyrCwkNgYvyV3z8zctJLPCZy24jvb3NiTcTJ" // Bittrex
|
||||
].indexOf(text) > -1
|
||||
}
|
||||
|
||||
function clearFields() {
|
||||
addressLine.text = ""
|
||||
setPaymentId("");
|
||||
amountLine.text = ""
|
||||
root.sendButtonWarning = ""
|
||||
setDescription("");
|
||||
priorityDropdown.currentIndex = 0
|
||||
updatePriorityDropdown()
|
||||
@@ -165,8 +176,8 @@ Rectangle {
|
||||
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>")
|
||||
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: fiatApiCurrencySymbol() + " ~" + fiatApiConvertToFiat(amountLine.text)
|
||||
@@ -193,6 +204,7 @@ Rectangle {
|
||||
amountLine.cursorPosition = 1;
|
||||
}
|
||||
}
|
||||
amountLine.error = walletManager.amountFromString(amountLine.text) > appWindow.getUnlockedBalance()
|
||||
}
|
||||
|
||||
validator: RegExpValidator {
|
||||
@@ -250,7 +262,7 @@ Rectangle {
|
||||
spacing: 0
|
||||
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>")
|
||||
%1 <a href='#'>(%2)</a>").arg(qsTr("Address")).arg(qsTr("Address book"))
|
||||
+ translationManager.emptyString
|
||||
labelButtonText: qsTr("Resolve") + translationManager.emptyString
|
||||
placeholderText: {
|
||||
@@ -268,7 +280,6 @@ Rectangle {
|
||||
middlePanel.addressBookView.selectAndSend = true;
|
||||
appWindow.showPageRequest("AddressBook");
|
||||
}
|
||||
pasteButton: true
|
||||
onTextChanged: {
|
||||
const parsed = walletManager.parse_uri_to_object(text);
|
||||
if (!parsed.error) {
|
||||
@@ -277,7 +288,6 @@ Rectangle {
|
||||
amountLine.text = parsed.amount;
|
||||
setDescription(parsed.tx_description);
|
||||
}
|
||||
warningLongPidTransfer = isLongPidService(text);
|
||||
}
|
||||
inlineButton.text: FontAwesome.qrcode
|
||||
inlineButton.fontPixelSize: 22
|
||||
@@ -375,7 +385,6 @@ Rectangle {
|
||||
|
||||
ColumnLayout {
|
||||
visible: paymentIdCheckbox.checked
|
||||
// @TODO: remove after pid removal hardfork
|
||||
CheckBox {
|
||||
id: paymentIdCheckbox
|
||||
border: false
|
||||
@@ -403,17 +412,17 @@ Rectangle {
|
||||
wrapMode: Text.WrapAnywhere
|
||||
addressValidation: false
|
||||
visible: paymentIdCheckbox.checked
|
||||
error: paymentIdCheckbox.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.WarningBox {
|
||||
// @TODO: remove after pid removal hardfork
|
||||
id: paymentIdWarningBox
|
||||
text: qsTr("Long payment IDs are obsolete. \
|
||||
Long payment IDs were not encrypted on the blockchain and would harm your privacy. \
|
||||
If the party you're sending to still requires a long payment ID, please notify them.") + translationManager.emptyString;
|
||||
visible: warningLongPidTransfer || paymentIdCheckbox.checked
|
||||
visible: paymentIdCheckbox.checked || warningLongPidDescription
|
||||
}
|
||||
|
||||
MoneroComponents.WarningBox {
|
||||
@@ -429,9 +438,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
|
||||
@@ -444,22 +451,8 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
function checkInformation(amount, address, payment_id, nettype) {
|
||||
address = address.trim()
|
||||
payment_id = payment_id.trim()
|
||||
|
||||
var amount_ok = amount.length > 0
|
||||
var address_ok = walletManager.addressValid(address, nettype)
|
||||
var payment_id_ok = payment_id.length == 0 || (payment_id.length == 64 && walletManager.paymentIdValid(payment_id))
|
||||
var ipid = walletManager.paymentIdFromAddress(address, nettype)
|
||||
if (ipid.length > 0 && payment_id.length > 0)
|
||||
payment_id_ok = false
|
||||
|
||||
addressLine.error = !address_ok
|
||||
amountLine.error = !amount_ok
|
||||
paymentIdLine.error = !payment_id_ok
|
||||
|
||||
return amount_ok && address_ok && payment_id_ok
|
||||
function checkInformation(amount, address, nettype) {
|
||||
return amount.length > 0 && walletManager.amountFromString(amountLine.text) <= appWindow.getUnlockedBalance() && TxUtils.checkAddress(address, nettype)
|
||||
}
|
||||
|
||||
} // pageRoot
|
||||
@@ -505,7 +498,7 @@ Rectangle {
|
||||
id: saveTxButton
|
||||
text: qsTr("Create tx file") + translationManager.emptyString
|
||||
visible: appWindow.viewOnly
|
||||
enabled: pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.nettype)
|
||||
enabled: pageRoot.checkInformation(amountLine.text, addressLine.text, appWindow.persistentSettings.nettype)
|
||||
small: true
|
||||
onClicked: {
|
||||
console.log("Transfer: saveTx Clicked")
|
||||
@@ -558,8 +551,7 @@ Rectangle {
|
||||
id: importKeyImagesButton
|
||||
text: qsTr("Import key images") + translationManager.emptyString
|
||||
small: true
|
||||
visible: appWindow.viewOnly && walletManager.isDaemonLocal(appWindow.currentDaemonAddress)
|
||||
enabled: pageRoot.enabled
|
||||
enabled: appWindow.viewOnly && appWindow.isTrustedDaemon()
|
||||
onClicked: {
|
||||
console.log("Transfer: import key images clicked")
|
||||
importKeyImagesDialog.open();
|
||||
@@ -710,7 +702,7 @@ Rectangle {
|
||||
|
||||
function updateStatus() {
|
||||
var messageNotConnected = qsTr("Wallet is not connected to daemon.");
|
||||
if(appWindow.walletMode >= 2) messageNotConnected += root.startLinkText;
|
||||
if(appWindow.walletMode >= 2 && !persistentSettings.useRemoteNode) messageNotConnected += root.startLinkText;
|
||||
pageRoot.enabled = true;
|
||||
if(typeof currentWallet === "undefined") {
|
||||
root.warningContent = messageNotConnected;
|
||||
@@ -724,6 +716,7 @@ Rectangle {
|
||||
//pageRoot.enabled = false;
|
||||
|
||||
switch (currentWallet.connected()) {
|
||||
case Wallet.ConnectionStatus_Connecting:
|
||||
case Wallet.ConnectionStatus_Disconnected:
|
||||
root.warningContent = messageNotConnected;
|
||||
break
|
||||
@@ -759,40 +752,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(parseFloat(amountLine.text) > parseFloat(middlePanel.unlockedBalanceText)){
|
||||
root.sendButtonWarning = qsTr("Amount is more than unlocked balance.") + translationManager.emptyString;
|
||||
return false;
|
||||
}
|
||||
|
||||
// There is no warning box displayed
|
||||
if(root.warningContent !== ""){
|
||||
return false;
|
||||
}
|
||||
|
||||
// The transactional information is correct
|
||||
if(!pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.nettype)){
|
||||
if(amountLine.text && addressLine.text)
|
||||
root.sendButtonWarning = qsTr("Transaction information is incorrect.") + translationManager.emptyString;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (paymentIdWarningBox.visible) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,14 +151,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 +261,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
|
||||
|
||||
@@ -582,7 +581,7 @@ Item {
|
||||
return
|
||||
}
|
||||
|
||||
if (appWindow.currentWallet.connected() == Wallet.ConnectionStatus_Disconnected) {
|
||||
if (appWindow.disconnected) {
|
||||
root.trackingError = qsTr("WARNING: no connection to daemon");
|
||||
trackingModel.clear();
|
||||
return
|
||||
|
||||
@@ -83,18 +83,23 @@ ColumnLayout {
|
||||
State {
|
||||
name: "Wallet"
|
||||
PropertyChanges { target: settingsStateView; currentView: settingsStateView.settingsWalletView }
|
||||
PropertyChanges { target: settingsPage; settingsHeight: settingsStateView.settingsWalletView.settingsHeight + 140 }
|
||||
}, State {
|
||||
name: "UI"
|
||||
PropertyChanges { target: settingsStateView; currentView: settingsStateView.settingsLayoutView }
|
||||
PropertyChanges { target: settingsPage; settingsHeight: settingsStateView.settingsLayoutView.layoutHeight + 140 }
|
||||
}, State {
|
||||
name: "Node"
|
||||
PropertyChanges { target: settingsStateView; currentView: settingsStateView.settingsNodeView }
|
||||
PropertyChanges { target: settingsPage; settingsHeight: settingsStateView.settingsNodeView.nodeHeight + 140 }
|
||||
}, State {
|
||||
name: "Log"
|
||||
PropertyChanges { target: settingsStateView; currentView: settingsStateView.settingsLogView }
|
||||
PropertyChanges { target: settingsPage; settingsHeight: settingsStateView.settingsLogView.logHeight + 140 }
|
||||
}, State {
|
||||
name: "Info"
|
||||
PropertyChanges { target: settingsStateView; currentView: settingsStateView.settingsInfoView }
|
||||
PropertyChanges { target: settingsPage; settingsHeight: settingsStateView.settingsInfoView.infoHeight + 140 }
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ import "../../components" as MoneroComponents
|
||||
|
||||
Rectangle {
|
||||
color: "transparent"
|
||||
height: 1400
|
||||
Layout.fillWidth: true
|
||||
property alias infoHeight: infoLayout.height
|
||||
property string walletModeString: {
|
||||
if(appWindow.walletMode === 0){
|
||||
return qsTr("Simple mode") + translationManager.emptyString;
|
||||
@@ -132,14 +132,21 @@ Rectangle {
|
||||
|
||||
MoneroComponents.TextBlock {
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumWidth: 360
|
||||
color: MoneroComponents.Style.dimmedFontColor
|
||||
font.pixelSize: 14
|
||||
text: {
|
||||
var wallet_path = walletPath();
|
||||
if(isIOS)
|
||||
wallet_path = moneroAccountsDir + wallet_path;
|
||||
return wallet_path;
|
||||
property string walletPath: (isIOS ? moneroAccountsDir : "") + appWindow.walletPath()
|
||||
text: "\
|
||||
<style type='text/css'>\
|
||||
a {cursor:pointer;text-decoration: none; color: #FF6C3C}\
|
||||
</style>\
|
||||
<a href='#'>%1</a>".arg(walletPath)
|
||||
textFormat: Text.RichText
|
||||
onLinkActivated: oshelper.openContainingFolder(walletPath)
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.NoButton
|
||||
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,10 +182,9 @@ 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.inputText = currentWallet ? currentWallet.walletCreationHeight : "0";
|
||||
inputDialog.onAcceptedCallback = function() {
|
||||
var _restoreHeight;
|
||||
if (inputDialog.inputText) {
|
||||
@@ -224,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()
|
||||
inputDialog.open(currentWallet ? currentWallet.walletCreationHeight : "0")
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -262,7 +268,19 @@ Rectangle {
|
||||
Layout.fillWidth: true
|
||||
color: MoneroComponents.Style.dimmedFontColor
|
||||
font.pixelSize: 14
|
||||
text: walletLogPath
|
||||
text: "\
|
||||
<style type='text/css'>\
|
||||
a {cursor:pointer;text-decoration: none; color: #FF6C3C}\
|
||||
</style>\
|
||||
<a href='#'>%1</a>".arg(walletLogPath)
|
||||
textFormat: Text.RichText
|
||||
onLinkActivated: oshelper.openContainingFolder(walletLogPath)
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.NoButton
|
||||
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
||||
@@ -37,8 +37,8 @@ import "../../components" as MoneroComponents
|
||||
|
||||
Rectangle {
|
||||
color: "transparent"
|
||||
height: 1400
|
||||
Layout.fillWidth: true
|
||||
property alias layoutHeight: settingsUI.height
|
||||
|
||||
ColumnLayout {
|
||||
id: settingsUI
|
||||
|
||||
@@ -37,8 +37,8 @@ import "../../components" as MoneroComponents
|
||||
Rectangle {
|
||||
property alias consoleArea: consoleArea
|
||||
color: "transparent"
|
||||
height: 1400
|
||||
Layout.fillWidth: true
|
||||
property alias logHeight: settingsLog.height
|
||||
|
||||
ColumnLayout {
|
||||
id: settingsLog
|
||||
@@ -150,6 +150,7 @@ Rectangle {
|
||||
Flickable {
|
||||
id: flickable
|
||||
anchors.fill: parent
|
||||
boundsBehavior: isMac ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
|
||||
|
||||
TextArea.flickable: TextArea {
|
||||
id : consoleArea
|
||||
@@ -203,7 +204,9 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
onActiveChanged: if (!active && !isMac) active = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ import "../../components/effects" as MoneroEffects
|
||||
|
||||
Rectangle{
|
||||
color: "transparent"
|
||||
height: 1400
|
||||
Layout.fillWidth: true
|
||||
property alias nodeHeight: root.height
|
||||
|
||||
/* main layout */
|
||||
ColumnLayout {
|
||||
@@ -50,10 +50,6 @@ Rectangle{
|
||||
anchors.right: parent.right
|
||||
|
||||
spacing: 0
|
||||
property int labelWidth: 120
|
||||
property int editWidth: 400
|
||||
property int lineEditFontSize: 14
|
||||
property int buttonWidth: 110
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
@@ -385,7 +381,7 @@ 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
|
||||
placeholderText: qsTr("(default)") + translationManager.emptyString
|
||||
placeholderFontSize: 15
|
||||
readOnly: true
|
||||
|
||||
@@ -36,8 +36,8 @@ import "../../components" as MoneroComponents
|
||||
|
||||
Rectangle {
|
||||
color: "transparent"
|
||||
height: 1400
|
||||
Layout.fillWidth: true
|
||||
property alias settingsHeight: settingsWallet.height
|
||||
|
||||
ColumnLayout {
|
||||
id: settingsWallet
|
||||
@@ -54,12 +54,7 @@ Rectangle {
|
||||
description: qsTr("Logs out of this wallet.") + translationManager.emptyString
|
||||
title: qsTr("Close this wallet") + translationManager.emptyString
|
||||
|
||||
onClicked: {
|
||||
middlePanel.addressBookView.clearFields();
|
||||
middlePanel.transferView.clearFields();
|
||||
middlePanel.receiveView.clearFields();
|
||||
appWindow.showWizard();
|
||||
}
|
||||
onClicked: appWindow.showWizard()
|
||||
}
|
||||
|
||||
MoneroComponents.SettingsListItem {
|
||||
|
||||
9
qml.qrc
@@ -3,10 +3,6 @@
|
||||
<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>images/whatIsIcon.png</file>
|
||||
@@ -26,7 +22,6 @@
|
||||
<file>components/LineEdit.qml</file>
|
||||
<file>components/TipItem.qml</file>
|
||||
<file>images/tip.png</file>
|
||||
<file>components/Scroll.qml</file>
|
||||
<file>components/MenuButtonDivider.qml</file>
|
||||
<file>images/moneroIcon.png</file>
|
||||
<file>components/StandardDropdown.qml</file>
|
||||
@@ -90,6 +85,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>
|
||||
@@ -103,7 +99,6 @@
|
||||
<file>pages/Sign.qml</file>
|
||||
<file>components/DaemonManagerDialog.qml</file>
|
||||
<file>version.js</file>
|
||||
<file>components/DaemonConsole.qml</file>
|
||||
<file>components/QRCodeScanner.qml</file>
|
||||
<file>components/Notifier.qml</file>
|
||||
<file>components/TextBlock.qml</file>
|
||||
@@ -228,8 +223,6 @@
|
||||
<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>
|
||||
|
||||
@@ -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/>
|
||||
|
||||
|
||||
166
src/CMakeLists.txt
Normal file
@@ -0,0 +1,166 @@
|
||||
add_subdirectory(QR-Code-generator)
|
||||
add_subdirectory(QR-Code-scanner)
|
||||
add_subdirectory(daemon)
|
||||
add_subdirectory(libwalletqt)
|
||||
add_subdirectory(model)
|
||||
add_subdirectory(zxcvbn-c)
|
||||
|
||||
qt5_add_resources(RESOURCES ../qml.qrc)
|
||||
|
||||
# Compile source files (.h/.cpp)
|
||||
file(GLOB SOURCE_FILES
|
||||
"*.h"
|
||||
"*.cpp"
|
||||
"main/*.h"
|
||||
"main/*.cpp"
|
||||
"libwalletqt/WalletManager.cpp"
|
||||
"libwalletqt/Wallet.cpp"
|
||||
"libwalletqt/PendingTransaction.cpp"
|
||||
"libwalletqt/TransactionHistory.cpp"
|
||||
"libwalletqt/TransactionInfo.cpp"
|
||||
"libwalletqt/QRCodeImageProvider.cpp" QR
|
||||
"QR-Code-generator/BitBuffer.cpp"
|
||||
"QR-Code-generator/QrCode.cpp"
|
||||
"QR-Code-generator/QrSegment.cpp"
|
||||
"libwalletqt/AddressBook.cpp"
|
||||
"libwalletqt/Subaddress.cpp"
|
||||
"libwalletqt/SubaddressAccount.cpp"
|
||||
"libwalletqt/UnsignedTransaction.cpp"
|
||||
"libwalletqt/WalletManager.h"
|
||||
"libwalletqt/Wallet.h"
|
||||
"libwalletqt/PendingTransaction.h"
|
||||
"libwalletqt/TransactionHistory.h"
|
||||
"libwalletqt/TransactionInfo.h"
|
||||
"libwalletqt/QRCodeImageProvider.h"
|
||||
"QR-Code-generator/BitBuffer.h"
|
||||
"QR-Code-generator/QrCode.h"
|
||||
"QR-Code-generator/QrSegment.h"
|
||||
"libwalletqt/Transfer.h"
|
||||
"libwalletqt/AddressBook.h"
|
||||
"libwalletqt/Subaddress.h"
|
||||
"libwalletqt/SubaddressAccount.h"
|
||||
"libwalletqt/UnsignedTransaction.h"
|
||||
"daemon/*.h"
|
||||
"daemon/*.cpp"
|
||||
"model/*.h"
|
||||
"model/*.cpp"
|
||||
"qt/*.h"
|
||||
"qt/*.cpp"
|
||||
)
|
||||
|
||||
if(ENABLE_PASS_STRENGTH_METER)
|
||||
file(GLOB PASS_STRENGTH_FILES
|
||||
"zxcvbn-c/zxcvbn.h"
|
||||
"zxcvbn-c/zxcvbn.c"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_SCANNER)
|
||||
file(GLOB QR_CODE_FILES
|
||||
"QR-Code-generator/*.h"
|
||||
"QR-Code-generator/*.cpp"
|
||||
"QR-Code-scanner/*.h"
|
||||
"QR-Code-scanner/*.cpp"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(EXECUTABLE_FLAG)
|
||||
if(MINGW)
|
||||
set(EXECUTABLE_FLAG WIN32)
|
||||
|
||||
set(ICON ${PROJECT_SOURCE_DIR}/images/appicon.ico)
|
||||
set(ICON_RC ${CMAKE_CURRENT_BINARY_DIR}/icon.rc)
|
||||
set(ICON_RES ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
|
||||
file(WRITE ${ICON_RC} "IDI_ICON1 ICON DISCARDABLE \"${ICON}\"")
|
||||
add_custom_command(OUTPUT ${ICON_RES} COMMAND windres ${ICON_RC} ${ICON_RES} MAIN_DEPENDENCY ${ICON_RC})
|
||||
list(APPEND RESOURCES ${ICON_RES})
|
||||
endif()
|
||||
|
||||
add_executable(monero-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")
|
||||
|
||||
# OpenGL
|
||||
target_include_directories(monero-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})
|
||||
|
||||
file(GLOB_RECURSE SRC_SOURCES *.cpp)
|
||||
file(GLOB_RECURSE SRC_HEADERS *.h)
|
||||
|
||||
target_include_directories(monero-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
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/model
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/QR-Code-generator
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/QR-Code-scanner
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zxcvbn-c
|
||||
${LibUSB_INCLUDE_DIRS}
|
||||
${HIDAPI_INCLUDE_DIRS}
|
||||
${X11_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${OPENSSL_INCLUDE_DIR}
|
||||
${ZBAR_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_compile_definitions(monero-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)
|
||||
endif()
|
||||
|
||||
if(DEVICE_TREZOR_READY)
|
||||
target_link_libraries(monero-gui ${TREZOR_DEP_LIBS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(monero-gui
|
||||
${CMAKE_BINARY_DIR}/lib/libwallet_merged.a
|
||||
${LMDB_LIBRARY}
|
||||
${CMAKE_BINARY_DIR}/monero/contrib/epee/src/libepee.a
|
||||
${CMAKE_BINARY_DIR}/monero/external/unbound/libunbound.a
|
||||
${SODIUM_LIBRARY}
|
||||
${CMAKE_BINARY_DIR}/monero/external/easylogging++/libeasylogging.a
|
||||
${CMAKE_BINARY_DIR}/monero/src/blockchain_db/libblockchain_db.a
|
||||
${CMAKE_BINARY_DIR}/monero/external/randomx/librandomx.a
|
||||
${CMAKE_BINARY_DIR}/monero/src/hardforks/libhardforks.a
|
||||
${Boost_LIBRARIES}
|
||||
${OPENSSL_LIBRARIES}
|
||||
${CMAKE_DL_LIBS}
|
||||
${LibUSB_LIBRARIES}
|
||||
${HIDAPI_LIBRARIES}
|
||||
${QT5_LIBRARIES}
|
||||
${EXTRA_LIBRARIES}
|
||||
${ICU_LIBRARIES}
|
||||
)
|
||||
|
||||
if(WITH_SCANNER)
|
||||
target_link_libraries(monero-gui
|
||||
${ZBAR_LIBRARIES}
|
||||
jpeg
|
||||
v4l2
|
||||
v4lconvert
|
||||
rt
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS monero-gui
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
4
src/QR-Code-generator/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
file(GLOB_RECURSE SRC_SOURCES *.cpp)
|
||||
file(GLOB_RECURSE SRC_HEADERS *.h)
|
||||
|
||||
|
||||
4
src/QR-Code-scanner/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
file(GLOB_RECURSE SRC_SOURCES *.cpp)
|
||||
file(GLOB_RECURSE SRC_HEADERS *.h)
|
||||
|
||||
|
||||
4
src/daemon/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
file(GLOB_RECURSE SRC_SOURCES *.cpp)
|
||||
file(GLOB_RECURSE SRC_HEADERS *.h)
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "DaemonManager.h"
|
||||
#include <QElapsedTimer>
|
||||
#include <QFile>
|
||||
#include <QThread>
|
||||
#include <QFileInfo>
|
||||
@@ -36,7 +37,6 @@
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QApplication>
|
||||
#include <QProcess>
|
||||
#include <QTime>
|
||||
#include <QStorageInfo>
|
||||
#include <QVariantMap>
|
||||
#include <QVariant>
|
||||
@@ -49,13 +49,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 +65,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;
|
||||
|
||||
@@ -130,7 +138,7 @@ bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const
|
||||
|
||||
if (!started) {
|
||||
qDebug() << "Daemon start error: " + m_daemon->errorString();
|
||||
emit daemonStartFailure();
|
||||
emit daemonStartFailure(m_daemon->errorString());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -140,35 +148,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)) {
|
||||
|
||||
@@ -42,10 +42,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 +64,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:
|
||||
|
||||
@@ -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
|
||||
|
||||
4
src/libwalletqt/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
file(GLOB_RECURSE SRC_SOURCES *.cpp)
|
||||
file(GLOB_RECURSE SRC_HEADERS *.h)
|
||||
|
||||
|
||||
@@ -32,53 +32,59 @@
|
||||
Subaddress::Subaddress(Monero::Subaddress *subaddressImpl, QObject *parent)
|
||||
: QObject(parent), m_subaddressImpl(subaddressImpl)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
getAll();
|
||||
}
|
||||
|
||||
QList<Monero::SubaddressRow*> Subaddress::getAll(bool update) const
|
||||
void Subaddress::getAll() const
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
|
||||
emit refreshStarted();
|
||||
|
||||
if(update)
|
||||
m_rows.clear();
|
||||
{
|
||||
QWriteLocker locker(&m_lock);
|
||||
|
||||
if (m_rows.empty()){
|
||||
m_rows.clear();
|
||||
for (auto &row: m_subaddressImpl->getAll()) {
|
||||
m_rows.append(row);
|
||||
}
|
||||
}
|
||||
|
||||
emit refreshFinished();
|
||||
return m_rows;
|
||||
}
|
||||
|
||||
Monero::SubaddressRow * Subaddress::getRow(int index) const
|
||||
bool Subaddress::getRow(int index, std::function<void (Monero::SubaddressRow &row)> 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;
|
||||
}
|
||||
|
||||
void Subaddress::addRow(quint32 accountIndex, const QString &label) const
|
||||
{
|
||||
m_subaddressImpl->addRow(accountIndex, label.toStdString());
|
||||
getAll(true);
|
||||
getAll();
|
||||
}
|
||||
|
||||
void Subaddress::setLabel(quint32 accountIndex, quint32 addressIndex, const QString &label) const
|
||||
{
|
||||
m_subaddressImpl->setLabel(accountIndex, addressIndex, label.toStdString());
|
||||
getAll(true);
|
||||
getAll();
|
||||
}
|
||||
|
||||
void Subaddress::refresh(quint32 accountIndex) const
|
||||
{
|
||||
m_subaddressImpl->refresh(accountIndex);
|
||||
getAll(true);
|
||||
getAll();
|
||||
}
|
||||
|
||||
quint64 Subaddress::count() const
|
||||
{
|
||||
QReadLocker locker(&m_lock);
|
||||
|
||||
return m_rows.size();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,10 @@
|
||||
#ifndef SUBADDRESS_H
|
||||
#define SUBADDRESS_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <wallet/api/wallet2_api.h>
|
||||
#include <QReadWriteLock>
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QDateTime>
|
||||
@@ -38,8 +41,8 @@ class Subaddress : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_INVOKABLE QList<Monero::SubaddressRow*> getAll(bool update = false) const;
|
||||
Q_INVOKABLE Monero::SubaddressRow * getRow(int index) const;
|
||||
Q_INVOKABLE void getAll() const;
|
||||
Q_INVOKABLE bool getRow(int index, std::function<void (Monero::SubaddressRow &row)> callback) const;
|
||||
Q_INVOKABLE void addRow(quint32 accountIndex, const QString &label) const;
|
||||
Q_INVOKABLE void setLabel(quint32 accountIndex, quint32 addressIndex, const QString &label) const;
|
||||
Q_INVOKABLE void refresh(quint32 accountIndex) const;
|
||||
@@ -54,6 +57,7 @@ public slots:
|
||||
private:
|
||||
explicit Subaddress(Monero::Subaddress * subaddressImpl, QObject *parent);
|
||||
friend class Wallet;
|
||||
mutable QReadWriteLock m_lock;
|
||||
Monero::Subaddress * m_subaddressImpl;
|
||||
mutable QList<Monero::SubaddressRow*> m_rows;
|
||||
};
|
||||
|
||||
@@ -32,53 +32,58 @@
|
||||
SubaddressAccount::SubaddressAccount(Monero::SubaddressAccount *subaddressAccountImpl, QObject *parent)
|
||||
: QObject(parent), m_subaddressAccountImpl(subaddressAccountImpl)
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
getAll();
|
||||
}
|
||||
|
||||
QList<Monero::SubaddressAccountRow*> SubaddressAccount::getAll(bool update) const
|
||||
void SubaddressAccount::getAll() const
|
||||
{
|
||||
qDebug(__FUNCTION__);
|
||||
|
||||
emit refreshStarted();
|
||||
|
||||
if(update)
|
||||
{
|
||||
QWriteLocker locker(&m_lock);
|
||||
m_rows.clear();
|
||||
|
||||
if (m_rows.empty()){
|
||||
for (auto &row: m_subaddressAccountImpl->getAll()) {
|
||||
m_rows.append(row);
|
||||
}
|
||||
}
|
||||
|
||||
emit refreshFinished();
|
||||
return m_rows;
|
||||
}
|
||||
|
||||
Monero::SubaddressAccountRow * SubaddressAccount::getRow(int index) const
|
||||
bool SubaddressAccount::getRow(int index, std::function<void (Monero::SubaddressAccountRow &)> 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;
|
||||
}
|
||||
|
||||
void SubaddressAccount::addRow(const QString &label) const
|
||||
{
|
||||
m_subaddressAccountImpl->addRow(label.toStdString());
|
||||
getAll(true);
|
||||
getAll();
|
||||
}
|
||||
|
||||
void SubaddressAccount::setLabel(quint32 accountIndex, const QString &label) const
|
||||
{
|
||||
m_subaddressAccountImpl->setLabel(accountIndex, label.toStdString());
|
||||
getAll(true);
|
||||
getAll();
|
||||
}
|
||||
|
||||
void SubaddressAccount::refresh() const
|
||||
{
|
||||
m_subaddressAccountImpl->refresh();
|
||||
getAll(true);
|
||||
getAll();
|
||||
}
|
||||
|
||||
quint64 SubaddressAccount::count() const
|
||||
{
|
||||
QReadLocker locker(&m_lock);
|
||||
|
||||
return m_rows.size();
|
||||
}
|
||||
|
||||
@@ -29,8 +29,11 @@
|
||||
#ifndef SUBADDRESSACCOUNT_H
|
||||
#define SUBADDRESSACCOUNT_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <wallet/api/wallet2_api.h>
|
||||
#include <QObject>
|
||||
#include <QReadWriteLock>
|
||||
#include <QList>
|
||||
#include <QDateTime>
|
||||
|
||||
@@ -38,8 +41,8 @@ class SubaddressAccount : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_INVOKABLE QList<Monero::SubaddressAccountRow*> getAll(bool update = false) const;
|
||||
Q_INVOKABLE Monero::SubaddressAccountRow * getRow(int index) const;
|
||||
Q_INVOKABLE void getAll() const;
|
||||
Q_INVOKABLE bool getRow(int index, std::function<void (Monero::SubaddressAccountRow &)> callback) const;
|
||||
Q_INVOKABLE void addRow(const QString &label) const;
|
||||
Q_INVOKABLE void setLabel(quint32 accountIndex, const QString &label) const;
|
||||
Q_INVOKABLE void refresh() const;
|
||||
@@ -54,6 +57,7 @@ public slots:
|
||||
private:
|
||||
explicit SubaddressAccount(Monero::SubaddressAccount * subaddressAccountImpl, QObject *parent);
|
||||
friend class Wallet;
|
||||
mutable QReadWriteLock m_lock;
|
||||
Monero::SubaddressAccount * m_subaddressAccountImpl;
|
||||
mutable QList<Monero::SubaddressAccountRow*> m_rows;
|
||||
};
|
||||
|
||||
@@ -36,16 +36,18 @@
|
||||
#include <QWriteLocker>
|
||||
|
||||
|
||||
TransactionInfo *TransactionHistory::transaction(int index)
|
||||
bool TransactionHistory::transaction(int index, std::function<void (TransactionInfo &)> callback)
|
||||
{
|
||||
QReadLocker locker(&m_tinfoLock);
|
||||
QReadLocker locker(&m_lock);
|
||||
|
||||
if (index < 0 || index >= m_tinfo.size()) {
|
||||
qCritical("%s: no transaction info for index %d", __FUNCTION__, index);
|
||||
qCritical("%s: there's %d transactions in backend", __FUNCTION__, m_pimpl->count());
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
return m_tinfo.at(index);
|
||||
|
||||
callback(*m_tinfo.value(index));
|
||||
return true;
|
||||
}
|
||||
|
||||
//// XXX: not sure if this method really needed;
|
||||
@@ -54,7 +56,7 @@ TransactionInfo *TransactionHistory::transaction(int index)
|
||||
// return nullptr;
|
||||
//}
|
||||
|
||||
QList<TransactionInfo *> TransactionHistory::getAll(quint32 accountIndex) const
|
||||
void TransactionHistory::refresh(quint32 accountIndex)
|
||||
{
|
||||
QDateTime firstDateTime = QDateTime(QDate(2014, 4, 18)); // the genesis block
|
||||
QDateTime lastDateTime = QDateTime::currentDateTime().addDays(1); // tomorrow (guard against jitter and timezones)
|
||||
@@ -62,23 +64,24 @@ QList<TransactionInfo *> TransactionHistory::getAll(quint32 accountIndex) const
|
||||
emit refreshStarted();
|
||||
|
||||
{
|
||||
QWriteLocker locker(&m_tinfoLock);
|
||||
QWriteLocker locker(&m_lock);
|
||||
|
||||
// XXX this invalidates previously saved history that might be used by model
|
||||
qDeleteAll(m_tinfo);
|
||||
m_tinfo.clear();
|
||||
|
||||
quint64 lastTxHeight = 0;
|
||||
m_locked = false;
|
||||
m_minutesToUnlock = 0;
|
||||
TransactionHistory * parent = const_cast<TransactionHistory*>(this);
|
||||
|
||||
m_pimpl->refresh();
|
||||
for (const auto i : m_pimpl->getAll()) {
|
||||
TransactionInfo * ti = new TransactionInfo(i, parent);
|
||||
if (ti->subaddrAccount() != accountIndex) {
|
||||
delete ti;
|
||||
if (i->subaddrAccount() != accountIndex) {
|
||||
continue;
|
||||
}
|
||||
m_tinfo.append(ti);
|
||||
|
||||
m_tinfo.append(new TransactionInfo(i, this));
|
||||
|
||||
const TransactionInfo *ti = m_tinfo.back();
|
||||
// looking for transactions timestamp scope
|
||||
if (ti->timestamp() >= lastDateTime) {
|
||||
lastDateTime = ti->timestamp();
|
||||
@@ -94,7 +97,6 @@ QList<TransactionInfo *> TransactionHistory::getAll(quint32 accountIndex) const
|
||||
m_minutesToUnlock = (requiredConfirmations - ti->confirmations()) * 2;
|
||||
m_locked = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,21 +110,11 @@ QList<TransactionInfo *> TransactionHistory::getAll(quint32 accountIndex) const
|
||||
m_lastDateTime = lastDateTime;
|
||||
emit lastDateTimeChanged();
|
||||
}
|
||||
|
||||
return m_tinfo;
|
||||
}
|
||||
|
||||
void TransactionHistory::refresh(quint32 accountIndex)
|
||||
{
|
||||
// rebuilding transaction list in wallet_api;
|
||||
m_pimpl->refresh();
|
||||
// copying list here and keep track on every item to avoid memleaks
|
||||
getAll(accountIndex);
|
||||
}
|
||||
|
||||
quint64 TransactionHistory::count() const
|
||||
{
|
||||
QReadLocker locker(&m_tinfoLock);
|
||||
QReadLocker locker(&m_lock);
|
||||
|
||||
return m_tinfo.count();
|
||||
}
|
||||
@@ -157,11 +149,6 @@ TransactionHistory::TransactionHistory(Monero::TransactionHistory *pimpl, QObjec
|
||||
|
||||
QString TransactionHistory::writeCSV(quint32 accountIndex, QString out)
|
||||
{
|
||||
QList<TransactionInfo *> history = this->getAll(accountIndex);
|
||||
if(history.count() < 1){
|
||||
return QString("");
|
||||
}
|
||||
|
||||
// construct filename
|
||||
qint64 now = QDateTime::currentDateTime().currentMSecsSinceEpoch();
|
||||
QString fn = QString(QString("%1/monero-txs_%2.csv").arg(out, QString::number(now / 1000)));
|
||||
@@ -176,15 +163,21 @@ QString TransactionHistory::writeCSV(quint32 accountIndex, QString out)
|
||||
QTextStream output(&data);
|
||||
output << "blockHeight,epoch,date,direction,amount,atomicAmount,fee,txid,label,subaddrAccount,paymentId\n";
|
||||
|
||||
foreach(const TransactionInfo *info, history)
|
||||
{
|
||||
QReadLocker locker(&m_lock);
|
||||
for (const auto &tx : m_pimpl->getAll()) {
|
||||
if (tx->subaddrAccount() != accountIndex) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TransactionInfo info(tx, this);
|
||||
|
||||
// collect column data
|
||||
double amount = info->amount();
|
||||
quint64 atomicAmount = info->atomicAmount();
|
||||
quint32 subaddrAccount = info->subaddrAccount();
|
||||
QString fee = info->fee();
|
||||
double amount = info.amount();
|
||||
quint64 atomicAmount = info.atomicAmount();
|
||||
quint32 subaddrAccount = info.subaddrAccount();
|
||||
QString fee = info.fee();
|
||||
QString direction = QString("");
|
||||
TransactionInfo::Direction _direction = info->direction();
|
||||
TransactionInfo::Direction _direction = info.direction();
|
||||
if(_direction == TransactionInfo::Direction_In)
|
||||
{
|
||||
direction = QString("in");
|
||||
@@ -195,14 +188,14 @@ QString TransactionHistory::writeCSV(quint32 accountIndex, QString out)
|
||||
else {
|
||||
continue; // skip TransactionInfo::Direction_Both
|
||||
}
|
||||
QString label = info->label();
|
||||
QString label = info.label();
|
||||
label.remove(QChar('"')); // reserved
|
||||
quint64 blockHeight = info->blockHeight();
|
||||
QDateTime timeStamp = info->timestamp();
|
||||
QString date = info->date() + " " + info->time();
|
||||
quint64 blockHeight = info.blockHeight();
|
||||
QDateTime timeStamp = info.timestamp();
|
||||
QString date = info.date() + " " + info.time();
|
||||
uint epoch = timeStamp.toTime_t();
|
||||
QString displayAmount = info->displayAmount();
|
||||
QString paymentId = info->paymentId();
|
||||
QString displayAmount = info.displayAmount();
|
||||
QString paymentId = info.paymentId();
|
||||
if(paymentId == "0000000000000000"){
|
||||
paymentId = "";
|
||||
}
|
||||
@@ -211,7 +204,7 @@ QString TransactionHistory::writeCSV(quint32 accountIndex, QString out)
|
||||
QString line = QString("%1,%2,%3,%4,%5,%6,%7,%8,\"%9\",%10,%11\n")
|
||||
.arg(QString::number(blockHeight), QString::number(epoch), date)
|
||||
.arg(direction, QString::number(amount), QString::number(atomicAmount))
|
||||
.arg(info->fee(), info->hash(), label, QString::number(subaddrAccount))
|
||||
.arg(info.fee(), info.hash(), label, QString::number(subaddrAccount))
|
||||
.arg(paymentId);
|
||||
output << line;
|
||||
}
|
||||
|
||||
@@ -29,13 +29,15 @@
|
||||
#ifndef TRANSACTIONHISTORY_H
|
||||
#define TRANSACTIONHISTORY_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QReadWriteLock>
|
||||
#include <QDateTime>
|
||||
|
||||
namespace Monero {
|
||||
class TransactionHistory;
|
||||
struct TransactionHistory;
|
||||
}
|
||||
|
||||
class TransactionInfo;
|
||||
@@ -50,9 +52,8 @@ class TransactionHistory : public QObject
|
||||
Q_PROPERTY(bool locked READ locked)
|
||||
|
||||
public:
|
||||
Q_INVOKABLE TransactionInfo *transaction(int index);
|
||||
Q_INVOKABLE bool transaction(int index, std::function<void (TransactionInfo &)> callback);
|
||||
// Q_INVOKABLE TransactionInfo * transaction(const QString &id);
|
||||
Q_INVOKABLE QList<TransactionInfo*> getAll(quint32 accountIndex) const;
|
||||
Q_INVOKABLE void refresh(quint32 accountIndex);
|
||||
Q_INVOKABLE QString writeCSV(quint32 accountIndex, QString out);
|
||||
quint64 count() const;
|
||||
@@ -75,9 +76,9 @@ private:
|
||||
|
||||
private:
|
||||
friend class Wallet;
|
||||
mutable QReadWriteLock m_lock;
|
||||
Monero::TransactionHistory * m_pimpl;
|
||||
mutable QList<TransactionInfo*> m_tinfo;
|
||||
mutable QReadWriteLock m_tinfoLock;
|
||||
mutable QDateTime m_firstDateTime;
|
||||
mutable QDateTime m_lastDateTime;
|
||||
mutable int m_minutesToUnlock;
|
||||
|
||||
@@ -34,85 +34,81 @@
|
||||
|
||||
TransactionInfo::Direction TransactionInfo::direction() const
|
||||
{
|
||||
return static_cast<Direction>(m_pimpl->direction());
|
||||
return m_direction;
|
||||
}
|
||||
|
||||
bool TransactionInfo::isPending() const
|
||||
{
|
||||
return m_pimpl->isPending();
|
||||
return m_pending;
|
||||
}
|
||||
|
||||
bool TransactionInfo::isFailed() const
|
||||
{
|
||||
return m_pimpl->isFailed();
|
||||
return m_failed;
|
||||
}
|
||||
|
||||
|
||||
double TransactionInfo::amount() const
|
||||
{
|
||||
// there's no unsigned uint64 for JS, so better use double
|
||||
return WalletManager::instance()->displayAmount(m_pimpl->amount()).toDouble();
|
||||
return displayAmount().toDouble();
|
||||
}
|
||||
|
||||
quint64 TransactionInfo::atomicAmount() const
|
||||
{
|
||||
return m_pimpl->amount();
|
||||
return m_amount;
|
||||
}
|
||||
|
||||
QString TransactionInfo::displayAmount() const
|
||||
{
|
||||
return WalletManager::instance()->displayAmount(m_pimpl->amount());
|
||||
return WalletManager::instance()->displayAmount(m_amount);
|
||||
}
|
||||
|
||||
QString TransactionInfo::fee() const
|
||||
{
|
||||
if(m_pimpl->fee() == 0)
|
||||
if(m_fee == 0)
|
||||
return "";
|
||||
return WalletManager::instance()->displayAmount(m_pimpl->fee());
|
||||
return WalletManager::instance()->displayAmount(m_fee);
|
||||
}
|
||||
|
||||
quint64 TransactionInfo::blockHeight() const
|
||||
{
|
||||
return m_pimpl->blockHeight();
|
||||
return m_blockHeight;
|
||||
}
|
||||
|
||||
QSet<quint32> TransactionInfo::subaddrIndex() const
|
||||
{
|
||||
QSet<quint32> result;
|
||||
for (uint32_t i : m_pimpl->subaddrIndex())
|
||||
result.insert(i);
|
||||
return result;
|
||||
return m_subaddrIndex;
|
||||
}
|
||||
|
||||
quint32 TransactionInfo::subaddrAccount() const
|
||||
{
|
||||
return m_pimpl->subaddrAccount();
|
||||
return m_subaddrAccount;
|
||||
}
|
||||
|
||||
QString TransactionInfo::label() const
|
||||
{
|
||||
return QString::fromStdString(m_pimpl->label());
|
||||
return m_label;
|
||||
}
|
||||
|
||||
quint64 TransactionInfo::confirmations() const
|
||||
{
|
||||
return m_pimpl->confirmations();
|
||||
return m_confirmations;
|
||||
}
|
||||
|
||||
quint64 TransactionInfo::unlockTime() const
|
||||
{
|
||||
return m_pimpl->unlockTime();
|
||||
return m_unlockTime;
|
||||
}
|
||||
|
||||
QString TransactionInfo::hash() const
|
||||
{
|
||||
return QString::fromStdString(m_pimpl->hash());
|
||||
return m_hash;
|
||||
}
|
||||
|
||||
QDateTime TransactionInfo::timestamp() const
|
||||
{
|
||||
QDateTime result = QDateTime::fromTime_t(m_pimpl->timestamp());
|
||||
return result;
|
||||
return m_timestamp;
|
||||
}
|
||||
|
||||
QString TransactionInfo::date() const
|
||||
@@ -127,13 +123,13 @@ QString TransactionInfo::time() const
|
||||
|
||||
QString TransactionInfo::paymentId() const
|
||||
{
|
||||
return QString::fromStdString(m_pimpl->paymentId());
|
||||
return m_paymentId;
|
||||
}
|
||||
|
||||
QString TransactionInfo::destinations_formatted() const
|
||||
{
|
||||
QString destinations;
|
||||
for (auto const& t: transfers()) {
|
||||
for (auto const& t: m_transfers) {
|
||||
if (!destinations.isEmpty())
|
||||
destinations += "<br> ";
|
||||
destinations += WalletManager::instance()->displayAmount(t->amount()) + ": " + t->address();
|
||||
@@ -141,22 +137,29 @@ QString TransactionInfo::destinations_formatted() const
|
||||
return destinations;
|
||||
}
|
||||
|
||||
QList<Transfer*> TransactionInfo::transfers() const
|
||||
TransactionInfo::TransactionInfo(const Monero::TransactionInfo *pimpl, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_amount(pimpl->amount())
|
||||
, m_blockHeight(pimpl->blockHeight())
|
||||
, m_confirmations(pimpl->confirmations())
|
||||
, m_direction(static_cast<Direction>(pimpl->direction()))
|
||||
, m_failed(pimpl->isFailed())
|
||||
, m_fee(pimpl->fee())
|
||||
, m_hash(QString::fromStdString(pimpl->hash()))
|
||||
, m_label(QString::fromStdString(pimpl->label()))
|
||||
, m_paymentId(QString::fromStdString(pimpl->paymentId()))
|
||||
, m_pending(pimpl->isPending())
|
||||
, m_subaddrAccount(pimpl->subaddrAccount())
|
||||
, m_timestamp(QDateTime::fromTime_t(pimpl->timestamp()))
|
||||
, m_unlockTime(pimpl->unlockTime())
|
||||
{
|
||||
if (!m_transfers.isEmpty()) {
|
||||
return m_transfers;
|
||||
}
|
||||
|
||||
for(auto const& t: m_pimpl->transfers()) {
|
||||
TransactionInfo * parent = const_cast<TransactionInfo*>(this);
|
||||
Transfer * transfer = new Transfer(t.amount, QString::fromStdString(t.address), parent);
|
||||
for (auto const &t: pimpl->transfers())
|
||||
{
|
||||
Transfer *transfer = new Transfer(t.amount, QString::fromStdString(t.address), this);
|
||||
m_transfers.append(transfer);
|
||||
}
|
||||
return m_transfers;
|
||||
}
|
||||
|
||||
TransactionInfo::TransactionInfo(Monero::TransactionInfo *pimpl, QObject *parent)
|
||||
: QObject(parent), m_pimpl(pimpl)
|
||||
{
|
||||
|
||||
for (uint32_t i : pimpl->subaddrIndex())
|
||||
{
|
||||
m_subaddrIndex.insert(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,18 +90,25 @@ public:
|
||||
//! only applicable for output transactions
|
||||
//! used in tx details popup
|
||||
QString destinations_formatted() const;
|
||||
//! Could be useful later when addressbook is implemented
|
||||
Q_INVOKABLE QList<Transfer*> transfers() const;
|
||||
private:
|
||||
explicit TransactionInfo(Monero::TransactionInfo * pimpl, QObject *parent = 0);
|
||||
explicit TransactionInfo(const Monero::TransactionInfo *pimpl, QObject *parent = 0);
|
||||
private:
|
||||
friend class TransactionHistory;
|
||||
Monero::TransactionInfo * m_pimpl;
|
||||
mutable QList<Transfer*> m_transfers;
|
||||
quint64 m_amount;
|
||||
quint64 m_blockHeight;
|
||||
quint64 m_confirmations;
|
||||
Direction m_direction;
|
||||
bool m_failed;
|
||||
quint64 m_fee;
|
||||
QString m_hash;
|
||||
QString m_label;
|
||||
QString m_paymentId;
|
||||
bool m_pending;
|
||||
quint32 m_subaddrAccount;
|
||||
QSet<quint32> m_subaddrIndex;
|
||||
QDateTime m_timestamp;
|
||||
quint64 m_unlockTime;
|
||||
};
|
||||
|
||||
// in order to wrap it to QVariant
|
||||
Q_DECLARE_METATYPE(TransactionInfo*)
|
||||
|
||||
|
||||
#endif // TRANSACTIONINFO_H
|
||||
|
||||
@@ -68,38 +68,38 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual void moneySpent(const std::string &txId, uint64_t amount)
|
||||
virtual void moneySpent(const std::string &txId, uint64_t amount) override
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->moneySpent(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
|
||||
virtual void moneyReceived(const std::string &txId, uint64_t amount)
|
||||
virtual void moneyReceived(const std::string &txId, uint64_t amount) override
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->moneyReceived(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount)
|
||||
virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) override
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->unconfirmedMoneyReceived(QString::fromStdString(txId), amount);
|
||||
}
|
||||
|
||||
virtual void newBlock(uint64_t height)
|
||||
virtual void newBlock(uint64_t height) override
|
||||
{
|
||||
// qDebug() << __FUNCTION__;
|
||||
emit m_wallet->newBlock(height, m_wallet->daemonBlockChainTargetHeight());
|
||||
}
|
||||
|
||||
virtual void updated()
|
||||
virtual void updated() override
|
||||
{
|
||||
emit m_wallet->updated();
|
||||
}
|
||||
|
||||
// called when wallet refreshed by background thread or explicitly
|
||||
virtual void refreshed()
|
||||
virtual void refreshed() override
|
||||
{
|
||||
qDebug() << __FUNCTION__;
|
||||
emit m_wallet->refreshed();
|
||||
@@ -153,12 +153,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 +180,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();
|
||||
@@ -237,13 +264,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 +274,10 @@ void Wallet::initAsync(const QString &daemonAddress, bool trustedDaemon, quint64
|
||||
m_walletImpl->startRefresh();
|
||||
}
|
||||
});
|
||||
if (future.first)
|
||||
{
|
||||
setConnectionStatus(Wallet::ConnectionStatus_Connecting);
|
||||
}
|
||||
}
|
||||
|
||||
bool Wallet::isHwBacked() const
|
||||
@@ -289,6 +314,11 @@ bool Wallet::viewOnly() const
|
||||
return m_walletImpl->watchOnly();
|
||||
}
|
||||
|
||||
quint64 Wallet::balance() const
|
||||
{
|
||||
return balance(m_currentSubaddressAccount);
|
||||
}
|
||||
|
||||
quint64 Wallet::balance(quint32 accountIndex) const
|
||||
{
|
||||
return m_walletImpl->balance(accountIndex);
|
||||
@@ -299,6 +329,11 @@ quint64 Wallet::balanceAll() const
|
||||
return m_walletImpl->balanceAll();
|
||||
}
|
||||
|
||||
quint64 Wallet::unlockedBalance() const
|
||||
{
|
||||
return unlockedBalance(m_currentSubaddressAccount);
|
||||
}
|
||||
|
||||
quint64 Wallet::unlockedBalance(quint32 accountIndex) const
|
||||
{
|
||||
return m_walletImpl->unlockedBalance(accountIndex);
|
||||
@@ -351,6 +386,7 @@ QString Wallet::getSubaddressLabel(quint32 accountIndex, quint32 addressIndex) c
|
||||
void Wallet::setSubaddressLabel(quint32 accountIndex, quint32 addressIndex, const QString &label)
|
||||
{
|
||||
m_walletImpl->setSubaddressLabel(accountIndex, addressIndex, label.toStdString());
|
||||
emit currentSubaddressAccountChanged();
|
||||
}
|
||||
void Wallet::deviceShowAddressAsync(quint32 accountIndex, quint32 addressIndex, const QString &paymentId)
|
||||
{
|
||||
@@ -438,7 +474,7 @@ bool Wallet::refresh()
|
||||
bool result = m_walletImpl->refresh();
|
||||
m_history->refresh(currentSubaddressAccount());
|
||||
m_subaddress->refresh(currentSubaddressAccount());
|
||||
m_subaddressAccount->getAll(true);
|
||||
m_subaddressAccount->getAll();
|
||||
if (result)
|
||||
emit updated();
|
||||
return result;
|
||||
@@ -756,7 +792,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);
|
||||
@@ -792,7 +828,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,7 +1010,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)
|
||||
@@ -988,12 +1026,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 = "";
|
||||
|
||||