mirror of
https://github.com/monero-project/monero-gui.git
synced 2026-04-02 04:07:26 -04:00
Compare commits
364 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96f9c11320 | ||
|
|
4a5b191f7f | ||
|
|
148d487988 | ||
|
|
7b137f7682 | ||
|
|
2e81ea2c09 | ||
|
|
5150945414 | ||
|
|
ec8cd137cc | ||
|
|
d5365298d2 | ||
|
|
30bf63b4b8 | ||
|
|
e8ee55a502 | ||
|
|
212fa083e2 | ||
|
|
3daf16e65d | ||
|
|
abfaac9772 | ||
|
|
28e6558a48 | ||
|
|
2d20bfd7ac | ||
|
|
45bfcfd2e9 | ||
|
|
46cea8db6b | ||
|
|
b4c0cb65de | ||
|
|
56e611480a | ||
|
|
ff201af778 | ||
|
|
ef2be82c21 | ||
|
|
6fce5c7a84 | ||
|
|
157166269b | ||
|
|
caa273afea | ||
|
|
d58ce3f599 | ||
|
|
19a6f399f3 | ||
|
|
18c964afca | ||
|
|
158e0c3523 | ||
|
|
770a7a344b | ||
|
|
f3ddf525a4 | ||
|
|
df2b85e7ee | ||
|
|
e86fa3e4fb | ||
|
|
5702bdef39 | ||
|
|
c7213abb9a | ||
|
|
5ee363f9f3 | ||
|
|
3e01647744 | ||
|
|
f491b41100 | ||
|
|
a564abbe6b | ||
|
|
149732af3a | ||
|
|
2bb6da5f09 | ||
|
|
11370c50eb | ||
|
|
0ae4677a25 | ||
|
|
1c2879bda3 | ||
|
|
0997b38e1e | ||
|
|
be177d6205 | ||
|
|
919b2e4f3a | ||
|
|
8b9580d621 | ||
|
|
6f5bacabfd | ||
|
|
6fab741f2e | ||
|
|
c2977ac410 | ||
|
|
1adf58793f | ||
|
|
9fa597bb58 | ||
|
|
d79f8e8b17 | ||
|
|
a817bfba05 | ||
|
|
04429e85e6 | ||
|
|
e52d86d442 | ||
|
|
7f164e739a | ||
|
|
43214de7d0 | ||
|
|
0cf683a6cf | ||
|
|
c9fd9634ee | ||
|
|
ddcee95b88 | ||
|
|
299067a273 | ||
|
|
08635e3030 | ||
|
|
fdff5f68dd | ||
|
|
9b18344d23 | ||
|
|
153154f484 | ||
|
|
ee0137056d | ||
|
|
1b0f274aed | ||
|
|
cd054f6c26 | ||
|
|
d6cb9b6c85 | ||
|
|
852378accb | ||
|
|
fe73011422 | ||
|
|
9d2f083a97 | ||
|
|
33afd0bb83 | ||
|
|
a165a14519 | ||
|
|
33e1801c57 | ||
|
|
fac3fcb518 | ||
|
|
8457055f08 | ||
|
|
e01c847fde | ||
|
|
bedf04d08a | ||
|
|
83da709436 | ||
|
|
f51b0d7d0c | ||
|
|
1f9d60602a | ||
|
|
7a285b3613 | ||
|
|
6ee5effc15 | ||
|
|
954c972530 | ||
|
|
e5b0837c8e | ||
|
|
a73ae62526 | ||
|
|
44df1bccfc | ||
|
|
0a0dbf8853 | ||
|
|
25ca081109 | ||
|
|
b932df85fd | ||
|
|
9da52f2387 | ||
|
|
79ee893499 | ||
|
|
1b2d940850 | ||
|
|
db4273ee82 | ||
|
|
cb1f3ad0ce | ||
|
|
c81a842b6e | ||
|
|
26ad7b78b5 | ||
|
|
381442a138 | ||
|
|
7cb24f50b8 | ||
|
|
8c5891e28a | ||
|
|
61c0e15404 | ||
|
|
b03714ec45 | ||
|
|
701f063797 | ||
|
|
6ed5369829 | ||
|
|
4661167734 | ||
|
|
39d9d7d071 | ||
|
|
8ad5fd4c76 | ||
|
|
3c28ecef93 | ||
|
|
d3943ca2a9 | ||
|
|
73f76cec99 | ||
|
|
b76b43da6c | ||
|
|
05733c14b7 | ||
|
|
21d8c096ff | ||
|
|
13ca3eeb84 | ||
|
|
4cea7e1647 | ||
|
|
afc2e846fd | ||
|
|
c601313943 | ||
|
|
73c0522a56 | ||
|
|
06a66e3a00 | ||
|
|
12355deb94 | ||
|
|
cbbbf30198 | ||
|
|
40e108eb2b | ||
|
|
cdfe9f338f | ||
|
|
adb04cef71 | ||
|
|
1123dd7046 | ||
|
|
f1fdbee25d | ||
|
|
ff51dd08d3 | ||
|
|
476896864c | ||
|
|
0b7cf4a544 | ||
|
|
caff6193f2 | ||
|
|
e2a82c9037 | ||
|
|
28ee4164cd | ||
|
|
7af099958e | ||
|
|
0d8e363407 | ||
|
|
7306b84d41 | ||
|
|
9d25f7230b | ||
|
|
b28f2dae33 | ||
|
|
619b2d7947 | ||
|
|
a23c49e5b6 | ||
|
|
61fc38b29c | ||
|
|
22386aa7e1 | ||
|
|
f5c5df7b67 | ||
|
|
1aa98c3cfd | ||
|
|
67c47d468c | ||
|
|
0fcaadae53 | ||
|
|
5b5c0ac658 | ||
|
|
1b4c21700f | ||
|
|
9df9cb8da7 | ||
|
|
a32d39cc96 | ||
|
|
8ef7b7c89a | ||
|
|
1ef96f9544 | ||
|
|
d413b16d34 | ||
|
|
37fea0ee33 | ||
|
|
b12ec3b0f0 | ||
|
|
4c257aff67 | ||
|
|
be1f63f93d | ||
|
|
839167aff5 | ||
|
|
87400e781e | ||
|
|
98ce87a572 | ||
|
|
d555ba55a9 | ||
|
|
1387fd4f9c | ||
|
|
6ff43fa81e | ||
|
|
076c70906a | ||
|
|
923a32cfd5 | ||
|
|
e7c37fc7bc | ||
|
|
2b83edc982 | ||
|
|
4208b66baf | ||
|
|
b9e74f6b6d | ||
|
|
270b86b142 | ||
|
|
6c67a39d2e | ||
|
|
56722e4747 | ||
|
|
91239881f1 | ||
|
|
2d464a1266 | ||
|
|
0dda5796ec | ||
|
|
e1987522e2 | ||
|
|
1b519b8302 | ||
|
|
d488979351 | ||
|
|
d313c2de37 | ||
|
|
560dd09f8a | ||
|
|
ea778c41dd | ||
|
|
6595a7b1c1 | ||
|
|
dea513fc84 | ||
|
|
55759545d1 | ||
|
|
248ec22eb5 | ||
|
|
04eab65b10 | ||
|
|
8643f85fef | ||
|
|
e0679ce5e6 | ||
|
|
31dbe7ea42 | ||
|
|
f745670b36 | ||
|
|
a80746adf1 | ||
|
|
2e8bec15da | ||
|
|
24d8360da1 | ||
|
|
f75d988437 | ||
|
|
3a1601f132 | ||
|
|
fd956b54b5 | ||
|
|
6467333fe7 | ||
|
|
4effbd3c8e | ||
|
|
8845ce6d49 | ||
|
|
3aeaf99057 | ||
|
|
c41e3d8e7a | ||
|
|
9d05462715 | ||
|
|
394e56915d | ||
|
|
749c166b10 | ||
|
|
a563582d95 | ||
|
|
a000b8d850 | ||
|
|
4b626924e6 | ||
|
|
e97fb0b3d8 | ||
|
|
aa1ab4f448 | ||
|
|
1752fde08b | ||
|
|
121904f340 | ||
|
|
05f63a24cc | ||
|
|
e2085bdaa3 | ||
|
|
7e83173c77 | ||
|
|
183c8084a5 | ||
|
|
5bc305679c | ||
|
|
2557bdb35f | ||
|
|
79a87ca03b | ||
|
|
a8eab144e4 | ||
|
|
83cffa469e | ||
|
|
b1b7307578 | ||
|
|
e0dfda2189 | ||
|
|
370607a7dc | ||
|
|
dc1d0a68c8 | ||
|
|
fed38b9e06 | ||
|
|
17213bfe8c | ||
|
|
e1b5ee24e9 | ||
|
|
35f92b76a2 | ||
|
|
9255d649d9 | ||
|
|
86f5aae63d | ||
|
|
75e433388f | ||
|
|
f51b0f6704 | ||
|
|
1895755efb | ||
|
|
03db3f96ff | ||
|
|
1d2840f8b5 | ||
|
|
4e16698558 | ||
|
|
c013d7d125 | ||
|
|
27e4771622 | ||
|
|
e65159163d | ||
|
|
77b7a5244a | ||
|
|
3c69023135 | ||
|
|
fad8dab165 | ||
|
|
16646eb651 | ||
|
|
6898d5dd42 | ||
|
|
67be96e6d5 | ||
|
|
9ce88c6aeb | ||
|
|
5ea99a73e7 | ||
|
|
43aeea8eb7 | ||
|
|
7eeda0a8f0 | ||
|
|
9220937c4b | ||
|
|
6aaf294f0b | ||
|
|
721a0cbf91 | ||
|
|
d1bde4f8b2 | ||
|
|
380b955bce | ||
|
|
0db4c36db0 | ||
|
|
dcc040a119 | ||
|
|
63e32c4a83 | ||
|
|
7972d8a219 | ||
|
|
872b81fe39 | ||
|
|
6136e88fcb | ||
|
|
c77637d141 | ||
|
|
0d047035fb | ||
|
|
b5aa659757 | ||
|
|
88d297d8cc | ||
|
|
eb924a34d1 | ||
|
|
352da92229 | ||
|
|
99907e539a | ||
|
|
e8bcabe66b | ||
|
|
829414ed01 | ||
|
|
36262f029a | ||
|
|
13ee9b1f26 | ||
|
|
085abb798a | ||
|
|
c137a6ea36 | ||
|
|
2cea0fc669 | ||
|
|
aaa1cb47c0 | ||
|
|
1577ce278b | ||
|
|
9d48f96fc8 | ||
|
|
1a51e93e55 | ||
|
|
b62b821002 | ||
|
|
f3ee46175c | ||
|
|
17a3c51a43 | ||
|
|
410897ced7 | ||
|
|
2fd3974194 | ||
|
|
7c50e1ff4b | ||
|
|
dec5dcf25c | ||
|
|
9fc260c62d | ||
|
|
c9d36b1302 | ||
|
|
d931022963 | ||
|
|
df885b6eaa | ||
|
|
f78c95b73b | ||
|
|
b22fb24e47 | ||
|
|
8c8faf29e4 | ||
|
|
b7b1221221 | ||
|
|
38c3534ead | ||
|
|
f631b75f0a | ||
|
|
11fd19e0f8 | ||
|
|
1572b4cf79 | ||
|
|
10a47d783e | ||
|
|
14cc1d096a | ||
|
|
840421fd7b | ||
|
|
51739dfb22 | ||
|
|
be5e6772a4 | ||
|
|
c869390272 | ||
|
|
50c22ca300 | ||
|
|
f1b4eb6c56 | ||
|
|
d37c4ddef2 | ||
|
|
2522ff13fe | ||
|
|
596b71b293 | ||
|
|
8159b75be3 | ||
|
|
7677103f1b | ||
|
|
fead82b198 | ||
|
|
f55bf48bad | ||
|
|
e0faddf964 | ||
|
|
a00ed6a75a | ||
|
|
b54127e997 | ||
|
|
c672d8016d | ||
|
|
ccd8eb1c3a | ||
|
|
d5b165bde2 | ||
|
|
c978027933 | ||
|
|
9deec4dad0 | ||
|
|
e306992ce8 | ||
|
|
19daa074ca | ||
|
|
1c62edeff4 | ||
|
|
34439af67e | ||
|
|
e1e862bce4 | ||
|
|
0b2e74cdb5 | ||
|
|
3fee17e564 | ||
|
|
1e7d8293cb | ||
|
|
a3fc6754e0 | ||
|
|
8354c251c5 | ||
|
|
8f5053bd61 | ||
|
|
92b0a115f4 | ||
|
|
6a3e1aaf40 | ||
|
|
c32e11d3e8 | ||
|
|
9580c19da3 | ||
|
|
27532dc1bf | ||
|
|
c0e0626b84 | ||
|
|
c6d5c5dc3a | ||
|
|
749460fb46 | ||
|
|
c9ee76c2ee | ||
|
|
94dbf179d5 | ||
|
|
7deecbfdf6 | ||
|
|
29a742ba26 | ||
|
|
47559e51be | ||
|
|
f64dcde600 | ||
|
|
52c090b82f | ||
|
|
1edc068047 | ||
|
|
d18af7da72 | ||
|
|
53066ae92b | ||
|
|
333c9ee311 | ||
|
|
ff4de8e8f7 | ||
|
|
ef5d855950 | ||
|
|
e6f30578c0 | ||
|
|
f1e3926192 | ||
|
|
7f0c19950b | ||
|
|
1580c3a574 | ||
|
|
c8f4355e15 | ||
|
|
39561f8ead | ||
|
|
b15dbbb9b0 | ||
|
|
a73a4363ec | ||
|
|
55cbc562b6 | ||
|
|
527adcba17 | ||
|
|
66e769603c |
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
||||
*
|
||||
144
.github/workflows/build.yml
vendored
144
.github/workflows/build.yml
vendored
@@ -4,24 +4,24 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build-macos:
|
||||
|
||||
runs-on: macOS-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: update brew and install dependencies
|
||||
run: brew update && brew install boost hidapi zmq libpgm miniupnpc ldns expat libunwind-headers protobuf qt5 libgcrypt
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: install dependencies
|
||||
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install boost hidapi zmq libpgm miniupnpc ldns expat libunwind-headers protobuf qt5 pkg-config
|
||||
- name: build
|
||||
run: export PATH=$PATH:/usr/local/opt/qt/bin && ./build.sh
|
||||
run: DEV_MODE=ON make release -j3
|
||||
- name: test qml
|
||||
run: build/release/bin/monero-wallet-gui.app/Contents/MacOS/monero-wallet-gui --test-qml
|
||||
|
||||
build-ubuntu:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: remove bundled boost
|
||||
run: sudo rm -rf /usr/local/share/boost
|
||||
- name: set apt conf
|
||||
@@ -36,22 +36,132 @@ jobs:
|
||||
- name: install monero gui dependencies
|
||||
run: sudo apt -y install qtbase5-dev qt5-default qtdeclarative5-dev qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qt-labs-settings qml-module-qt-labs-folderlistmodel qttools5-dev-tools qml-module-qtquick-templates2 libqt5svg5-dev libgcrypt20-dev xvfb
|
||||
- name: build
|
||||
run: ./build.sh
|
||||
run: DEV_MODE=ON make release -j3
|
||||
- name: test qml
|
||||
run: xvfb-run -a build/release/bin/monero-wallet-gui --test-qml
|
||||
|
||||
build-windows:
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: numworks/setup-msys2@v1
|
||||
- name: update pacman
|
||||
run: msys2do pacman -Syu --noconfirm
|
||||
- name: install monero dependencies
|
||||
run: msys2do pacman -S --noconfirm mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb git mingw-w64-x86_64-qt5 mingw-w64-x86_64-libgcrypt
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: eine/setup-msys2@v2
|
||||
with:
|
||||
update: true
|
||||
install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb git mingw-w64-x86_64-qt5 mingw-w64-x86_64-libgcrypt
|
||||
- name: build
|
||||
run: msys2do ./build.sh release
|
||||
run: DEV_MODE=ON make release-win64 -j2
|
||||
- name: test qml
|
||||
run: msys2do build/release/bin/monero-wallet-gui --test-qml
|
||||
run: build/release/bin/monero-wallet-gui --test-qml
|
||||
|
||||
macos-bundle:
|
||||
runs-on: macOS-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: install dependencies
|
||||
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install boost hidapi zmq libpgm miniupnpc ldns expat libunwind-headers protobuf pkg-config python3 p7zip
|
||||
- name: install dependencies
|
||||
run: pip3 install requests semantic_version lxml
|
||||
- name: download qt
|
||||
run: |
|
||||
curl -O https://raw.githubusercontent.com/engnr/qt-downloader/master/qt-downloader
|
||||
chmod +x qt-downloader
|
||||
./qt-downloader macos desktop 5.15.2 clang_64
|
||||
working-directory: ../
|
||||
- name: build
|
||||
run: CMAKE_PREFIX_PATH=/Users/runner/work/monero-gui/5.15.2/clang_64 make release -j3
|
||||
- name: deploy
|
||||
run: make deploy
|
||||
working-directory: build/release
|
||||
- name: create .tar
|
||||
run: tar -cf monero-wallet-gui.tar monero-wallet-gui.app
|
||||
working-directory: build/release/bin
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ github.job }}
|
||||
path: build/release/bin/monero-wallet-gui.tar
|
||||
|
||||
docker-linux-static:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: satackey/action-docker-layer-caching@v0.0.8
|
||||
continue-on-error: true
|
||||
with:
|
||||
key: docker-linux-static-{hash}
|
||||
restore-keys: |
|
||||
docker-linux-static-
|
||||
- name: preprare build enviroment
|
||||
run: docker build --tag monero:build-env-linux --build-arg THREADS=3 --file Dockerfile.linux .
|
||||
- name: build
|
||||
run: docker run --rm -v /home/runner/work/monero-gui/monero-gui:/monero-gui -w /monero-gui monero:build-env-linux sh -c 'make release-static -j3'
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ github.job }}
|
||||
path: |
|
||||
/home/runner/work/monero-gui/monero-gui/build/release/bin/monero-wallet-gui
|
||||
/home/runner/work/monero-gui/monero-gui/build/release/bin/monerod
|
||||
|
||||
docker-windows-static:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: satackey/action-docker-layer-caching@v0.0.8
|
||||
continue-on-error: true
|
||||
with:
|
||||
key: docker-windows-static-{hash}
|
||||
restore-keys: |
|
||||
docker-windows-static-
|
||||
- name: preprare build enviroment
|
||||
run: docker build --tag monero:build-env-windows --build-arg THREADS=3 --file Dockerfile.windows .
|
||||
- name: build
|
||||
run: docker run --rm -v /home/runner/work/monero-gui/monero-gui:/monero-gui -w /monero-gui monero:build-env-windows sh -c 'make depends root=/depends target=x86_64-w64-mingw32 tag=win-x64 -j3'
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ github.job }}
|
||||
path: |
|
||||
/home/runner/work/monero-gui/monero-gui/build/x86_64-w64-mingw32/release/bin/monero-wallet-gui.exe
|
||||
/home/runner/work/monero-gui/monero-gui/build/x86_64-w64-mingw32/release/bin/monerod.exe
|
||||
|
||||
docker-android:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: preprare build enviroment
|
||||
run: docker build --tag monero:build-env-android --build-arg THREADS=3 --file Dockerfile.android .
|
||||
- name: build
|
||||
run: docker run --rm -v /home/runner/work/monero-gui/monero-gui:/monero-gui -e THREADS=3 monero:build-env-android
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ github.job }}
|
||||
path: /home/runner/work/monero-gui/monero-gui/build/Android/release/android-build/monero-gui.apk
|
||||
|
||||
source-archive:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: archive
|
||||
run: |
|
||||
pip install git-archive-all
|
||||
export VERSION="monero-gui-$(git describe)"
|
||||
export OUTPUT="$VERSION.tar"
|
||||
echo "OUTPUT=$OUTPUT" >> $GITHUB_ENV
|
||||
/home/runner/.local/bin/git-archive-all --prefix "$VERSION/" --force-submodules "$OUTPUT"
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ env.OUTPUT }}
|
||||
path: /home/runner/work/monero-gui/monero-gui/${{ env.OUTPUT }}
|
||||
|
||||
371
CMakeLists.txt
371
CMakeLists.txt
@@ -1,85 +1,72 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
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}")
|
||||
set(VERSION_MAJOR "17")
|
||||
set(VERSION_MINOR "1")
|
||||
set(VERSION_REVISION "5")
|
||||
set(VERSION "0.${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}")
|
||||
|
||||
option(STATIC "Link libraries statically, requires static Qt")
|
||||
|
||||
option(USE_DEVICE_TREZOR ON)
|
||||
option(ENABLE_PASS_STRENGTH_METER "Disable zxcvbn" OFF)
|
||||
option(USE_DEVICE_TREZOR "Trezor support compilation" ON)
|
||||
option(ENABLE_PASS_STRENGTH_METER "Enable zxcvbn library for password strength" 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)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckLinkerFlag)
|
||||
include(FindCcache)
|
||||
|
||||
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)
|
||||
set(ARCH "x86-64" CACHE STRING "Target architecture")
|
||||
set(BUILD_64 ON CACHE BOOL "Build 64-bit binaries")
|
||||
|
||||
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")
|
||||
if(NOT MANUAL_SUBMODULES)
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
if(NOT DEV_MODE)
|
||||
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 --recursive\nor run cmake with -DMANUAL_SUBMODULES=1,\n or if you want to build from latest master run cmake with -DDEV_MODE=ON,\n or run make devmode")
|
||||
endif()
|
||||
endfunction ()
|
||||
message(STATUS "Checking submodules")
|
||||
check_submodule(monero)
|
||||
else()
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} fetch WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/monero RESULT_VARIABLE GIT_FETCH_RESULT)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} checkout -f origin/master WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/monero RESULT_VARIABLE GIT_CHECKOUT_MASTER_RESULT)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --force --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/monero RESULT_VARIABLE GIT_SUBMODULE_UPDATE_RESULT)
|
||||
if(NOT GIT_FETCH_RESULT EQUAL "0" OR NOT GIT_CHECKOUT_MASTER_RESULT EQUAL "0" OR NOT GIT_SUBMODULE_UPDATE_RESULT EQUAL "0")
|
||||
message(FATAL_ERROR "Updating git submodule to master (-DDEV_MODE=ON) failed")
|
||||
endif()
|
||||
endfunction ()
|
||||
message(STATUS "Checking submodules")
|
||||
check_submodule(monero)
|
||||
else()
|
||||
execute_process(COMMAND cd monero && git checkout origin/master)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(STATIC_OLD ${STATIC})
|
||||
set(STATIC ON CACHE BOOL "Link libraries statically" FORCE)
|
||||
add_subdirectory(monero)
|
||||
set(STATIC ${STATIC_OLD} CACHE BOOL "Link libraries statically" FORCE)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
set_property(TARGET wallet_merged PROPERTY FOLDER "monero")
|
||||
get_directory_property(ARCH_WIDTH DIRECTORY "monero" DEFINITION ARCH_WIDTH)
|
||||
get_directory_property(UNBOUND_LIBRARY DIRECTORY "monero" DEFINITION UNBOUND_LIBRARY)
|
||||
get_directory_property(DEVICE_TREZOR_READY DIRECTORY "monero" DEFINITION DEVICE_TREZOR_READY)
|
||||
get_directory_property(TREZOR_DEP_LIBS DIRECTORY "monero" DEFINITION TREZOR_DEP_LIBS)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_definitions(-DQT_NO_DEBUG)
|
||||
@@ -89,18 +76,17 @@ 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")
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
add_definitions(-DMONERO_GUI_STATIC)
|
||||
endif()
|
||||
|
||||
# Include password strength library
|
||||
if(ENABLE_PASS_STRENGTH_METER)
|
||||
message(STATUS "Buildin with pass strength meter support.")
|
||||
message(STATUS "Building with pass strength meter support.")
|
||||
else()
|
||||
add_definitions(-DDISABLE_PASS_STRENGTH_METER)
|
||||
endif()
|
||||
|
||||
include(CheckTrezor) # Trezor support check
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# force version update
|
||||
@@ -137,6 +123,9 @@ monero_gui_add_library(gui_version SOURCES version.js DEPENDS genversiongui)
|
||||
message(STATUS "${CMAKE_MODULE_PATH}")
|
||||
|
||||
# OpenSSL
|
||||
if(APPLE AND NOT OPENSSL_ROOT_DIR)
|
||||
execute_process(COMMAND brew --prefix openssl OUTPUT_VARIABLE OPENSSL_ROOT_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
find_package(OpenSSL REQUIRED)
|
||||
message(STATUS "OpenSSL: Version ${OPENSSL_VERSION}")
|
||||
message(STATUS "OpenSSL: include dir at ${OPENSSL_INCLUDE_DIR}")
|
||||
@@ -145,7 +134,7 @@ message(STATUS "OpenSSL: libraries at ${OPENSSL_LIBRARIES} ${OPENSSL_SSL_LIBRARI
|
||||
# Zbar (for QR scanner)
|
||||
if(WITH_SCANNER)
|
||||
add_definitions(-DWITH_SCANNER)
|
||||
find_package(ZBar0)
|
||||
find_package(ZBar0 REQUIRED)
|
||||
message(STATUS "libzbar: include dir at ${ZBAR_INCLUDE_DIR}")
|
||||
message(STATUS "libzbar: libraries at ${ZBAR_LIBRARIES}")
|
||||
endif()
|
||||
@@ -160,15 +149,23 @@ 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}")
|
||||
if(NOT ANDROID)
|
||||
find_package(HIDAPI REQUIRED)
|
||||
message(STATUS "libhidapi: include dir at ${HIDAPI_INCLUDE_DIRS}")
|
||||
message(STATUS "libhidapi: libraries at ${HIDAPI_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
# Boost
|
||||
if(DEBUG)
|
||||
set(Boost_DEBUG ON)
|
||||
endif()
|
||||
find_package(Boost 1.62 REQUIRED COMPONENTS
|
||||
if(APPLE AND NOT BOOST_ROOT)
|
||||
execute_process(COMMAND brew --prefix boost OUTPUT_VARIABLE BOOST_ROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
if(MINGW)
|
||||
set(Boost_THREADAPI win32)
|
||||
endif()
|
||||
find_package(Boost 1.58 REQUIRED COMPONENTS
|
||||
system
|
||||
filesystem
|
||||
thread
|
||||
@@ -179,8 +176,12 @@ find_package(Boost 1.62 REQUIRED COMPONENTS
|
||||
program_options
|
||||
locale)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
set(CMAKE_SKIP_RPATH ON)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES_PREV ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so")
|
||||
find_package(X11 REQUIRED)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_PREV})
|
||||
message(STATUS "X11_FOUND = ${X11_FOUND}")
|
||||
message(STATUS "X11_INCLUDE_DIR = ${X11_INCLUDE_DIR}")
|
||||
message(STATUS "X11_LIBRARIES = ${X11_LIBRARIES}")
|
||||
@@ -196,21 +197,6 @@ 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
|
||||
@@ -223,41 +209,87 @@ endif()
|
||||
set(QT5_LIBRARIES
|
||||
Qt5Core
|
||||
Qt5Quick
|
||||
Qt5QuickControls2
|
||||
Qt5Widgets
|
||||
Qt5Gui
|
||||
Qt5Network
|
||||
Qt5Qml
|
||||
Qt5Multimedia
|
||||
Qt5Xml
|
||||
Qt5XmlPatterns
|
||||
Qt5Svg
|
||||
Qt5Xml
|
||||
)
|
||||
|
||||
if(WITH_SCANNER)
|
||||
list(APPEND QT5_LIBRARIES Qt5Multimedia)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
list(APPEND QT5_LIBRARIES Qt5MacExtras)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
if(NOT CMAKE_PREFIX_PATH AND DEFINED ENV{CMAKE_PREFIX_PATH})
|
||||
message(STATUS "Using CMAKE_PREFIX_PATH environment variable: '$ENV{CMAKE_PREFIX_PATH}'")
|
||||
set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
|
||||
endif()
|
||||
if(APPLE AND NOT CMAKE_PREFIX_PATH)
|
||||
execute_process(COMMAND brew --prefix qt5 OUTPUT_VARIABLE QT5_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${QT5_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
# TODO: drop this once we switch to Qt 5.14+
|
||||
find_package(Qt5QmlModels QUIET)
|
||||
if(Qt5QmlModels_FOUND)
|
||||
pkg_check_modules(Qt5QmlModels_PKG_CONFIG QUIET Qt5QmlModels)
|
||||
if(Qt5QmlModels_PKG_CONFIG_FOUND)
|
||||
list(APPEND QT5_LIBRARIES Qt5QmlModels)
|
||||
endif()
|
||||
|
||||
# TODO: drop this once we switch to Qt 5.12+
|
||||
find_package(Qt5XmlPatterns QUIET)
|
||||
if(Qt5XmlPatterns_FOUND)
|
||||
list(APPEND QT5_LIBRARIES Qt5XmlPatterns)
|
||||
endif()
|
||||
|
||||
foreach(QT5_MODULE ${QT5_LIBRARIES})
|
||||
find_package(${QT5_MODULE} REQUIRED)
|
||||
include_directories(${${QT5_MODULE}_INCLUDE_DIRS})
|
||||
endforeach()
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(PKGCONFIG_FOUND)
|
||||
pkg_check_modules(QT5_PKG_CONFIG ${QT5_LIBRARIES})
|
||||
if(NOT (CMAKE_CROSSCOMPILING AND ANDROID))
|
||||
pkg_check_modules(QT5_PKG_CONFIG REQUIRED ${QT5_LIBRARIES})
|
||||
else()
|
||||
set(QT5_LIBRARIES_ABI)
|
||||
foreach(QT5_MODULE ${QT5_LIBRARIES})
|
||||
list(APPEND QT5_LIBRARIES_ABI "${QT5_MODULE}_${CMAKE_ANDROID_ARCH_ABI}")
|
||||
endforeach()
|
||||
pkg_check_modules(QT5_PKG_CONFIG REQUIRED ${QT5_LIBRARIES_ABI})
|
||||
endif()
|
||||
|
||||
if(QT5_PKG_CONFIG_FOUND)
|
||||
set(QT5_PKG_CONFIG "QT5_PKG_CONFIG")
|
||||
if(STATIC)
|
||||
set(QT5_PKG_CONFIG "${QT5_PKG_CONFIG}_STATIC")
|
||||
endif()
|
||||
get_target_property(QMAKE_IMPORTED_LOCATION Qt5::qmake IMPORTED_LOCATION)
|
||||
get_filename_component(QT_INSTALL_PREFIX "${QMAKE_IMPORTED_LOCATION}/../.." ABSOLUTE)
|
||||
|
||||
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})
|
||||
if(APPLE AND NOT STATIC)
|
||||
set(CMAKE_BUILD_RPATH "${QT_INSTALL_PREFIX}/lib")
|
||||
endif()
|
||||
|
||||
if(QT5_PKG_CONFIG_FOUND)
|
||||
set(QT5_PKG_CONFIG "QT5_PKG_CONFIG")
|
||||
if(STATIC)
|
||||
set(QT5_PKG_CONFIG "${QT5_PKG_CONFIG}_STATIC")
|
||||
endif()
|
||||
|
||||
if(UNIX AND CMAKE_PREFIX_PATH)
|
||||
if(APPLE)
|
||||
list(JOIN ${QT5_PKG_CONFIG}_LDFLAGS_OTHER " " ${QT5_PKG_CONFIG}_LDFLAGS_OTHER)
|
||||
endif()
|
||||
# temporal workaround for https://bugreports.qt.io/browse/QTBUG-80922
|
||||
STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${QT_INSTALL_PREFIX}" ${QT5_PKG_CONFIG}_LDFLAGS_OTHER "${${QT5_PKG_CONFIG}_LDFLAGS_OTHER}")
|
||||
STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${QT_INSTALL_PREFIX}" ${QT5_PKG_CONFIG}_LIBRARIES "${${QT5_PKG_CONFIG}_LIBRARIES}")
|
||||
STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${QT_INSTALL_PREFIX}" ${QT5_PKG_CONFIG}_INCLUDE_DIRS "${${QT5_PKG_CONFIG}_INCLUDE_DIRS}")
|
||||
STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${QT_INSTALL_PREFIX}" ${QT5_PKG_CONFIG}_LIBRARY_DIRS "${${QT5_PKG_CONFIG}_LIBRARY_DIRS}")
|
||||
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()
|
||||
|
||||
list(APPEND QT5_LIBRARIES
|
||||
@@ -268,37 +300,118 @@ list(APPEND QT5_LIBRARIES
|
||||
)
|
||||
|
||||
if(STATIC)
|
||||
set(QT5_LIBRARIES
|
||||
qtquickcontrols2plugin # has to be the first one, depends on Qt5QuickControls2
|
||||
${QT5_LIBRARIES}
|
||||
declarative_multimedia
|
||||
set(QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/Qt/labs/folderlistmodel)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/Qt/labs/settings)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtGraphicalEffects)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtGraphicalEffects/private)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtMultimedia)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQml)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick.2)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Controls)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Controls.2)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Dialogs)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Dialogs/Private)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Layouts)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/PrivateWidgets)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Templates.2)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Window.2)
|
||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/XmlListModel)
|
||||
|
||||
set(QT5_EXTRA_LIBRARIES_LIST
|
||||
qtquicktemplates2plugin
|
||||
Qt5QuickTemplates2
|
||||
qtquickcontrols2plugin
|
||||
Qt5QuickControls2
|
||||
dialogplugin
|
||||
dialogsprivateplugin
|
||||
qmlfolderlistmodelplugin
|
||||
qmlsettingsplugin
|
||||
qmlxmllistmodelplugin
|
||||
qquicklayoutsplugin
|
||||
Qt5EventDispatcherSupport
|
||||
Qt5FontDatabaseSupport
|
||||
Qt5MultimediaQuick_p
|
||||
Qt5PacketProtocol
|
||||
Qt5ThemeSupport
|
||||
)
|
||||
|
||||
if(WITH_SCANNER)
|
||||
list(APPEND QT5_EXTRA_LIBRARIES_LIST
|
||||
declarative_multimedia
|
||||
Qt5MultimediaQuick_p
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND QT5_EXTRA_LIBRARIES_LIST
|
||||
qtgraphicaleffectsplugin
|
||||
qtgraphicaleffectsprivate
|
||||
qtquick2plugin
|
||||
qtquickcontrolsplugin
|
||||
qtquicktemplates2plugin
|
||||
widgetsplugin
|
||||
windowplugin
|
||||
)
|
||||
|
||||
if(MINGW)
|
||||
list(APPEND QT5_LIBRARIES qtfreetype)
|
||||
if(NOT ${Qt5Core_VERSION} VERSION_LESS 5.14)
|
||||
list(APPEND QT5_EXTRA_LIBRARIES_LIST qmlplugin)
|
||||
endif()
|
||||
|
||||
set(QT5_EXTRA_LIBRARIES)
|
||||
foreach(LIBRARY ${QT5_EXTRA_LIBRARIES_LIST})
|
||||
find_library(${LIBRARY}_LIBRARY ${LIBRARY} PATHS ${QT5_EXTRA_PATHS} REQUIRED)
|
||||
list(APPEND QT5_EXTRA_LIBRARIES ${${LIBRARY}_LIBRARY})
|
||||
endforeach()
|
||||
|
||||
if(MINGW)
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
list(APPEND QT5_LIBRARIES D3D11 Dwrite D2d1)
|
||||
list(APPEND QT5_EXTRA_LIBRARIES D3D11 Dwrite D2d1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(QT5_LIBRARIES
|
||||
${QT5_EXTRA_LIBRARIES}
|
||||
${QT5_LIBRARIES}
|
||||
)
|
||||
|
||||
set(QT5_INTEGRATION_LIBRARIES_LIST
|
||||
Qt5EventDispatcherSupport
|
||||
Qt5PacketProtocol
|
||||
Qt5ThemeSupport
|
||||
Qt5FontDatabaseSupport
|
||||
)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
list(APPEND QT5_INTEGRATION_LIBRARIES_LIST
|
||||
Qt5XcbQpa
|
||||
Qt5ServiceSupport
|
||||
Qt5GlxSupport
|
||||
)
|
||||
elseif(MINGW)
|
||||
list(APPEND QT5_INTEGRATION_LIBRARIES_LIST qtfreetype)
|
||||
endif()
|
||||
|
||||
foreach(LIBRARY ${QT5_INTEGRATION_LIBRARIES_LIST})
|
||||
find_library(${LIBRARY}_LIBRARY ${LIBRARY} PATHS ${QT5_EXTRA_PATHS} REQUIRED)
|
||||
list(APPEND QT5_LIBRARIES ${${LIBRARY}_LIBRARY})
|
||||
endforeach()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
pkg_check_modules(X11XCB_XCBGLX REQUIRED x11-xcb xcb-glx)
|
||||
list(APPEND QT5_LIBRARIES ${X11XCB_XCBGLX_LIBRARIES})
|
||||
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
|
||||
list(APPEND QT5_LIBRARIES ${FONTCONFIG_STATIC_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
set(QT5_EXTRA_LIBRARIES_LIST
|
||||
GLESv2
|
||||
log
|
||||
z
|
||||
jnigraphics
|
||||
android
|
||||
EGL
|
||||
Qt5VirtualKeyboard_${CMAKE_ANDROID_ARCH_ABI}
|
||||
c++_shared
|
||||
)
|
||||
foreach(LIBRARY ${QT5_EXTRA_LIBRARIES_LIST})
|
||||
find_library(${LIBRARY}_LIBRARY ${LIBRARY} PATHS "${ANDROID_TOOLCHAIN_ROOT}/sysroot/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${ANDROID_PLATFORM_LEVEL}" REQUIRED)
|
||||
list(APPEND QT5_LIBRARIES ${${LIBRARY}_LIBRARY})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
message(STATUS "Using Boost include dir at ${Boost_INCLUDE_DIRS}")
|
||||
@@ -313,7 +426,9 @@ if(MINGW)
|
||||
else()
|
||||
set(ICU_LIBRARIES icuio icuin icuuc icudt icutu iconv)
|
||||
endif()
|
||||
elseif(APPLE OR OPENBSD OR ANDROID)
|
||||
elseif(APPLE)
|
||||
set(EXTRA_LIBRARIES "-framework AppKit")
|
||||
elseif(OPENBSD OR ANDROID)
|
||||
set(EXTRA_LIBRARIES "")
|
||||
elseif(FREEBSD)
|
||||
set(EXTRA_LIBRARIES execinfo)
|
||||
@@ -377,7 +492,12 @@ if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VER
|
||||
endif()
|
||||
|
||||
# linker
|
||||
if (NOT (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU"))
|
||||
if (APPLE)
|
||||
add_linker_flag_if_supported(-Wl,-bind_at_load LD_SECURITY_FLAGS)
|
||||
add_linker_flag_if_supported(-Wl,-dead_strip LD_SECURITY_FLAGS)
|
||||
add_linker_flag_if_supported(-Wl,-dead_strip_dylibs LD_SECURITY_FLAGS)
|
||||
endif()
|
||||
if (NOT APPLE AND 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()
|
||||
@@ -399,9 +519,9 @@ if (WIN32)
|
||||
add_linker_flag_if_supported(-Wl,--high-entropy-va LD_SECURITY_FLAGS)
|
||||
endif()
|
||||
|
||||
add_linker_flag_if_supported(-static-libgcc STATIC_FLAGS)
|
||||
add_linker_flag_if_supported(-static-libstdc++ STATIC_FLAGS)
|
||||
if(STATIC)
|
||||
add_linker_flag_if_supported(-static-libgcc STATIC_FLAGS)
|
||||
add_linker_flag_if_supported(-static-libstdc++ STATIC_FLAGS)
|
||||
if(MINGW)
|
||||
add_linker_flag_if_supported(-static STATIC_FLAGS)
|
||||
endif()
|
||||
@@ -412,6 +532,9 @@ endif()
|
||||
add_c_flag_if_supported(-fno-strict-aliasing C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-fno-strict-aliasing CXX_SECURITY_FLAGS)
|
||||
|
||||
add_c_flag_if_supported(-fPIC C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-fPIC CXX_SECURITY_FLAGS)
|
||||
|
||||
message(STATUS "Using C security hardening flags: ${C_SECURITY_FLAGS}")
|
||||
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
|
||||
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
|
||||
@@ -432,12 +555,14 @@ if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED)
|
||||
endif()
|
||||
endif()
|
||||
if (WIN32)
|
||||
list(APPEND EXTRA_LIBRARIES setupapi Version)
|
||||
find_library(VERSION_LIBRARY version PATHS /usr/x86_64-w64-mingw32/lib)
|
||||
if(VERSION_LIBRARY STREQUAL "VERSION_LIBRARY-NOTFOUND")
|
||||
set(VERSION_LIBRARY Version)
|
||||
endif()
|
||||
list(APPEND EXTRA_LIBRARIES setupapi ${VERSION_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(translations)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
# Required to make wallet_merged build before the gui
|
||||
add_dependencies(monero-wallet-gui wallet_merged)
|
||||
|
||||
|
||||
42
DEPLOY.md
Normal file
42
DEPLOY.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# macOS:
|
||||
|
||||
Use macOS 10.12 - 10.13 for better backwards compability.
|
||||
|
||||
1. `HOMEBREW_OPTFLAGS="-march=core2" HOMEBREW_OPTIMIZATION_LEVEL="O0" brew install boost zmq libpgm miniupnpc libsodium expat libunwind-headers protobuf libgcrypt hidapi`
|
||||
|
||||
2. Get the latest LTS from here: https://www.qt.io/offline-installers and install
|
||||
|
||||
3. `git clone --recursive -b v0.X.Y.Z --depth 1 https://github.com/monero-project/monero-gui`
|
||||
|
||||
4. `CMAKE_PREFIX_PATH=~/Qt5.12.8/5.12.8/clang_64 make release`
|
||||
|
||||
5. `cd build/release && make deploy`
|
||||
|
||||
6. Replace the `monerod` binary inside `monero-wallet-gui.app/Contents/MacOS/` with one built using deterministic builds / gitian.
|
||||
|
||||
## Codesigning and notarizing
|
||||
|
||||
1. Save the following text as `entitlements.plist`
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.disable-executable-page-protection</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
```
|
||||
|
||||
2. `codesign --deep --force --verify --verbose --options runtime --timestamp --entitlements entitlements.plist --sign 'XXXXXXXXXX' monero-wallet-gui.app`
|
||||
|
||||
You can check if this step worked by using `codesign -dvvv monero-wallet-gui.app`
|
||||
|
||||
3. `hdiutil create -fs HFS+ -srcfolder monero-gui-v0.X.Y.Z -volname monero-wallet-gui monero-gui-mac-x64-v0.X.Y.Z.dmg`
|
||||
|
||||
4. `xcrun altool -t osx --file monero-gui-mac-x64-v0.X.Y.Z.dmg --primary-bundle-id org.monero-project.monero-wallet-gui.dmg --notarize-app --username email@address.org`
|
||||
|
||||
5. `xcrun altool --notarization-info aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee -u email@address.org`
|
||||
|
||||
6. `xcrun stapler staple -v monero-gui-mac-x64-v0.X.Y.Z.dmg`
|
||||
217
Dockerfile.android
Normal file
217
Dockerfile.android
Normal file
@@ -0,0 +1,217 @@
|
||||
FROM debian:unstable
|
||||
|
||||
ARG THREADS=1
|
||||
ARG ANDROID_NDK_REVISION=21d
|
||||
ARG ANDROID_NDK_HASH=bcf4023eb8cb6976a4c7cff0a8a8f145f162bf4d
|
||||
ARG ANDROID_SDK_REVISION=4333796
|
||||
ARG ANDROID_SDK_HASH=92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9
|
||||
ARG QT_VERSION=5.15.2
|
||||
|
||||
WORKDIR /opt/android
|
||||
ENV WORKDIR=/opt/android
|
||||
|
||||
ENV ANDROID_NATIVE_API_LEVEL=28
|
||||
ENV ANDROID_API=android-${ANDROID_NATIVE_API_LEVEL}
|
||||
ENV ANDROID_CLANG=aarch64-linux-android${ANDROID_NATIVE_API_LEVEL}-clang
|
||||
ENV ANDROID_CLANGPP=aarch64-linux-android${ANDROID_NATIVE_API_LEVEL}-clang++
|
||||
ENV ANDROID_NDK_ROOT=${WORKDIR}/android-ndk-r${ANDROID_NDK_REVISION}
|
||||
ENV ANDROID_SDK_ROOT=${WORKDIR}/tools
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
|
||||
ENV PATH=${JAVA_HOME}/bin:${PATH}
|
||||
ENV PREFIX=${WORKDIR}/prefix
|
||||
ENV TOOLCHAIN_DIR=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y ant automake build-essential ca-certificates-java cmake file gettext git libc6 libncurses5 \
|
||||
libstdc++6 libtinfo5 libtool libz1 openjdk-8-jdk-headless openjdk-8-jre-headless pkg-config python3 unzip wget
|
||||
|
||||
RUN wget -q https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \
|
||||
&& unzip -q sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \
|
||||
&& rm -f sdk-tools-linux-${ANDROID_SDK_REVISION}.zip
|
||||
|
||||
RUN wget -q https://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \
|
||||
&& unzip -q android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \
|
||||
&& rm -f android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip
|
||||
|
||||
RUN cd ${ANDROID_SDK_ROOT} && echo y | ./bin/sdkmanager "platform-tools" "platforms;${ANDROID_API}" "tools" > /dev/null
|
||||
RUN cp -r ${WORKDIR}/platforms ${WORKDIR}/platform-tools ${ANDROID_SDK_ROOT}
|
||||
|
||||
ENV HOST_PATH=${PATH}
|
||||
ENV PATH=${TOOLCHAIN_DIR}/aarch64-linux-android/bin:${TOOLCHAIN_DIR}/bin:${PATH}
|
||||
|
||||
ARG ZLIB_VERSION=1.2.11
|
||||
ARG ZLIB_HASH=c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
|
||||
RUN wget -q https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
|
||||
&& tar -xzf zlib-${ZLIB_VERSION}.tar.gz \
|
||||
&& rm zlib-${ZLIB_VERSION}.tar.gz \
|
||||
&& cd zlib-${ZLIB_VERSION} \
|
||||
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --static \
|
||||
&& make -j${THREADS} \
|
||||
&& make -j${THREADS} install \
|
||||
&& rm -rf $(pwd)
|
||||
|
||||
RUN git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} --depth 1 \
|
||||
&& cd qt5 \
|
||||
&& perl init-repository --module-subset=default,-qtwebengine \
|
||||
&& PATH=${HOST_PATH} ./configure -v -developer-build -release \
|
||||
-xplatform android-clang \
|
||||
-android-ndk-platform ${ANDROID_API} \
|
||||
-android-ndk ${ANDROID_NDK_ROOT} \
|
||||
-android-sdk ${ANDROID_SDK_ROOT} \
|
||||
-android-ndk-host linux-x86_64 \
|
||||
-no-dbus \
|
||||
-opengl es2 \
|
||||
-no-use-gold-linker \
|
||||
-no-sql-mysql \
|
||||
-opensource -confirm-license \
|
||||
-android-arch arm64-v8a \
|
||||
-prefix ${PREFIX} \
|
||||
-nomake tools -nomake tests -nomake examples \
|
||||
-skip qtwebengine \
|
||||
-skip qtserialport \
|
||||
-skip qtconnectivity \
|
||||
-skip qttranslations \
|
||||
-skip qtpurchasing \
|
||||
-skip qtgamepad -skip qtscript -skip qtdoc \
|
||||
-no-warnings-are-errors \
|
||||
&& sed -i '213,215d' qtbase/src/3rdparty/pcre2/src/sljit/sljitConfigInternal.h \
|
||||
&& PATH=${HOST_PATH} make -j${THREADS} \
|
||||
&& PATH=${HOST_PATH} make -j${THREADS} install \
|
||||
&& cd qttools/src/linguist/lrelease && \
|
||||
../../../../qtbase/bin/qmake && \
|
||||
PATH=${HOST_PATH} make -j$THREADS install && \
|
||||
cd ../../../.. && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
ARG ICONV_VERSION=1.16
|
||||
ARG ICONV_HASH=e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04
|
||||
RUN wget -q http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \
|
||||
&& echo "${ICONV_HASH} libiconv-${ICONV_VERSION}.tar.gz" | sha256sum -c \
|
||||
&& tar -xzf libiconv-${ICONV_VERSION}.tar.gz \
|
||||
&& rm -f libiconv-${ICONV_VERSION}.tar.gz \
|
||||
&& cd libiconv-${ICONV_VERSION} \
|
||||
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --build=x86_64-linux-gnu --host=aarch64 --prefix=${PREFIX} --disable-rpath \
|
||||
&& make -j${THREADS} \
|
||||
&& make -j${THREADS} install
|
||||
|
||||
ARG BOOST_VERSION=1_74_0
|
||||
ARG BOOST_VERSION_DOT=1.74.0
|
||||
ARG BOOST_HASH=83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1
|
||||
RUN wget -q https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \
|
||||
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
|
||||
&& tar -xf boost_${BOOST_VERSION}.tar.bz2 \
|
||||
&& rm -f boost_${BOOST_VERSION}.tar.bz2 \
|
||||
&& cd boost_${BOOST_VERSION} \
|
||||
&& PATH=${HOST_PATH} ./bootstrap.sh --prefix=${PREFIX} \
|
||||
&& PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} ./b2 --build-type=minimal link=static runtime-link=static \
|
||||
--with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization \
|
||||
--with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi \
|
||||
threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} \
|
||||
cflags='--target=aarch64-linux-android' \
|
||||
cxxflags='--target=aarch64-linux-android' \
|
||||
linkflags='--target=aarch64-linux-android --sysroot=${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm64 ${ANDROID_NDK_ROOT}/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so -nostdlib++' \
|
||||
install -j${THREADS} \
|
||||
&& rm -rf $(pwd)
|
||||
|
||||
ARG OPENSSL_VERSION=1.1.1g
|
||||
ARG OPENSSL_HASH=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
|
||||
RUN wget -q https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
|
||||
&& tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
|
||||
&& rm openssl-${OPENSSL_VERSION}.tar.gz \
|
||||
&& cd openssl-${OPENSSL_VERSION} \
|
||||
&& ANDROID_NDK_HOME=${ANDROID_NDK_ROOT} ./Configure CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} \
|
||||
android-arm64 no-asm no-shared --static \
|
||||
--with-zlib-include=${PREFIX}/include --with-zlib-lib=${PREFIX}/lib \
|
||||
--prefix=${PREFIX} --openssldir=${PREFIX} \
|
||||
&& sed -i 's/CNF_EX_LIBS=-ldl -pthread//g;s/BIN_CFLAGS=-pie $(CNF_CFLAGS) $(CFLAGS)//g' Makefile \
|
||||
&& ANDROID_NDK_HOME=${ANDROID_NDK_ROOT} make -j${THREADS} \
|
||||
&& make -j${THREADS} install \
|
||||
&& rm -rf $(pwd)
|
||||
|
||||
ARG ZMQ_VERSION=v4.3.3
|
||||
ARG ZMQ_HASH=04f5bbedee58c538934374dc45182d8fc5926fa3
|
||||
RUN git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} --depth 1 \
|
||||
&& cd libzmq \
|
||||
&& git checkout ${ZMQ_HASH} \
|
||||
&& ./autogen.sh \
|
||||
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --host=aarch64-linux-android \
|
||||
--enable-static --disable-shared \
|
||||
&& make -j${THREADS} \
|
||||
&& make -j${THREADS} install \
|
||||
&& rm -rf $(pwd)
|
||||
|
||||
ARG SODIUM_VERSION=1.0.18
|
||||
ARG SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677
|
||||
RUN set -ex \
|
||||
&& git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} --depth 1 \
|
||||
&& cd libsodium \
|
||||
&& test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \
|
||||
&& ./autogen.sh \
|
||||
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared \
|
||||
&& make -j${THREADS} install \
|
||||
&& rm -rf $(pwd)
|
||||
|
||||
RUN git clone https://github.com/ZBar/ZBar.git --depth 1 \
|
||||
&& cd ZBar \
|
||||
&& git reset --hard 854a5d97059e395807091ac4d80c53f7968abb8f \
|
||||
&& sed -i 's/SHARED/STATIC/' android/jni/Android.mk \
|
||||
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CPP_FEATURES := exceptions rtti features\n\0/' android/jni/Android.mk \
|
||||
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS := -Wno-multichar\n\0/' android/jni/Android.mk \
|
||||
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -D_ANDROID\n\0/' android/jni/Android.mk \
|
||||
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -DLIBDIR="\\".\\""\n\0/' android/jni/Android.mk \
|
||||
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -DBUILDING_LIBICONV\n\0/' android/jni/Android.mk \
|
||||
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -DBUILDING_LIBCHARSET\n\0/' android/jni/Android.mk \
|
||||
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -DIN_LIBRARY\n\0/' android/jni/Android.mk \
|
||||
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -fno-stack-protector\n\0/' android/jni/Android.mk \
|
||||
&& echo "APP_ABI := arm64-v8a \nAPP_STL := c++_shared \nTARGET_PLATFORM := ${ANDROID_API} \nTARGET_ARCH_ABI := arm64-v8a \nAPP_CFLAGS += -target aarch64-none-linux-android -fexceptions -fstack-protector-strong -fno-limit-debug-info -mfloat-abi=softfp -fno-builtin-memmove -fno-omit-frame-pointer -fno-stack-protector\n" \
|
||||
>> android/jni/Application.mk \
|
||||
&& cd android \
|
||||
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ${ANDROID_NDK_ROOT}/ndk-build ICONV_SRC=${WORKDIR}/libiconv-${ICONV_VERSION} -B V=1 NDK_APPLICATION_MK=jni/Application.mk \
|
||||
&& cp obj/local/arm64-v8a/lib* ${PREFIX}/lib \
|
||||
&& cp -r ../include/* ${PREFIX}/include
|
||||
|
||||
RUN git clone -b libgpg-error-1.38 --depth 1 git://git.gnupg.org/libgpg-error.git \
|
||||
&& cd libgpg-error \
|
||||
&& git reset --hard 71d278824c5fe61865f7927a2ed1aa3115f9e439 \
|
||||
&& ./autogen.sh \
|
||||
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --host=aarch64-linux-android --prefix=${PREFIX} --disable-rpath --disable-shared --enable-static --disable-doc --disable-tests \
|
||||
&& PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} make -j${THREADS} \
|
||||
&& make -j${THREADS} install \
|
||||
&& rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b libgcrypt-1.8.5 --depth 1 git://git.gnupg.org/libgcrypt.git \
|
||||
&& cd libgcrypt \
|
||||
&& git reset --hard 56606331bc2a80536db9fc11ad53695126007298 \
|
||||
&& ./autogen.sh \
|
||||
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --host=aarch64-linux-android --prefix=${PREFIX} --with-gpg-error-prefix=${PREFIX} --disable-shared --enable-static --disable-doc --disable-tests \
|
||||
&& PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} make -j${THREADS} \
|
||||
&& make -j${THREADS} install \
|
||||
&& rm -rf $(pwd)
|
||||
|
||||
RUN cd tools \
|
||||
&& wget -q http://dl-ssl.google.com/android/repository/tools_r25.2.5-linux.zip \
|
||||
&& unzip -q tools_r25.2.5-linux.zip \
|
||||
&& rm -f tools_r25.2.5-linux.zip \
|
||||
&& echo y | ${ANDROID_SDK_ROOT}/tools/android update sdk --no-ui --all --filter build-tools-28.0.3
|
||||
|
||||
CMD set -ex \
|
||||
&& cd /monero-gui \
|
||||
&& mkdir -p build/Android/release \
|
||||
&& cd build/Android/release \
|
||||
&& cmake \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" \
|
||||
-DCMAKE_PREFIX_PATH="${PREFIX}" \
|
||||
-DCMAKE_FIND_ROOT_PATH="${PREFIX}" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DARCH="armv8-a" \
|
||||
-DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL} \
|
||||
-DANDROID_ABI="arm64-v8a" \
|
||||
-DANDROID_TOOLCHAIN=clang \
|
||||
-DBoost_USE_STATIC_RUNTIME=ON \
|
||||
-DLRELEASE_PATH="${PREFIX}/bin" \
|
||||
-DQT_ANDROID_APPLICATION_BINARY="monero-wallet-gui" \
|
||||
-DWITH_SCANNER=ON \
|
||||
../../.. \
|
||||
&& PATH=${HOST_PATH} make generate_translations_header \
|
||||
&& make -j${THREADS} -C src \
|
||||
&& make -j${THREADS} apk
|
||||
284
Dockerfile.linux
Normal file
284
Dockerfile.linux
Normal file
@@ -0,0 +1,284 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
ARG THREADS=1
|
||||
ARG QT_VERSION=5.15.2
|
||||
|
||||
ENV CFLAGS="-fPIC"
|
||||
ENV CPPFLAGS="-fPIC"
|
||||
ENV CXXFLAGS="-fPIC"
|
||||
ENV SOURCE_DATE_EPOCH=1397818193
|
||||
|
||||
RUN apt update
|
||||
|
||||
RUN apt install -y automake git pkg-config python xutils-dev && \
|
||||
git clone -b xorgproto-2020.1 --depth 1 https://gitlab.freedesktop.org/xorg/proto/xorgproto && \
|
||||
cd xorgproto && \
|
||||
git reset --hard c62e8203402cafafa5ba0357b6d1c019156c9f36 && \
|
||||
./autogen.sh && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b 1.12 --depth 1 https://gitlab.freedesktop.org/xorg/proto/xcbproto && \
|
||||
cd xcbproto && \
|
||||
git reset --hard 6398e42131eedddde0d98759067dde933191f049 && \
|
||||
./autogen.sh && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN apt install -y libtool-bin && \
|
||||
git clone -b libXau-1.0.9 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxau && \
|
||||
cd libxau && \
|
||||
git reset --hard d9443b2c57b512cfb250b35707378654d86c7dea && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN apt install -y libpthread-stubs0-dev && \
|
||||
git clone -b 1.12 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb && \
|
||||
cd libxcb && \
|
||||
git reset --hard d34785a34f28fa6a00f8ce00d87e3132ff0f6467 && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
make -j$THREADS clean && \
|
||||
rm /usr/local/lib/libxcb-xinerama.so && \
|
||||
./autogen.sh --disable-shared --enable-static && \
|
||||
make -j$THREADS && \
|
||||
cp src/.libs/libxcb-xinerama.a /usr/local/lib/ && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-util && \
|
||||
cd libxcb-util && \
|
||||
git reset --hard acf790d7752f36e450d476ad79807d4012ec863b && \
|
||||
git submodule init && \
|
||||
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-image && \
|
||||
cd libxcb-image && \
|
||||
git reset --hard d882052fb2ce439c6483fce944ba8f16f7294639 && \
|
||||
git submodule init && \
|
||||
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-keysyms && \
|
||||
cd libxcb-keysyms && \
|
||||
git reset --hard 0e51ee5570a6a80bdf98770b975dfe8a57f4eeb1 && \
|
||||
git submodule init && \
|
||||
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b 0.3.9 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-render-util && \
|
||||
cd libxcb-render-util && \
|
||||
git reset --hard 0317caf63de532fd7a0493ed6afa871a67253747 && \
|
||||
git submodule init && \
|
||||
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b 0.4.1 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-wm && \
|
||||
cd libxcb-wm && \
|
||||
git reset --hard 24eb17df2e1245885e72c9d4bbb0a0f69f0700f2 && \
|
||||
git submodule init && \
|
||||
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN apt install -y bison && \
|
||||
git clone -b xkbcommon-0.5.0 --depth 1 https://github.com/xkbcommon/libxkbcommon && \
|
||||
cd libxkbcommon && \
|
||||
git reset --hard c43c3c866eb9d52cd8f61e75cbef1c30d07f3a28 && \
|
||||
./autogen.sh --prefix=/usr --enable-shared --disable-static --enable-x11 --disable-docs && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib && \
|
||||
cd zlib && \
|
||||
git reset --hard cacf7f1d4e3d44d871b605da3b647f07d718623f && \
|
||||
./configure --static && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b VER-2-10-2 --depth 1 https://git.savannah.gnu.org/git/freetype/freetype2.git && \
|
||||
cd freetype2 && \
|
||||
git reset --hard 132f19b779828b194b3fede187cee719785db4d8 && \
|
||||
./autogen.sh && \
|
||||
./configure --disable-shared --enable-static --with-zlib=no && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b R_2_2_9 --depth 1 https://github.com/libexpat/libexpat && \
|
||||
cd libexpat/expat && \
|
||||
git reset --hard a7bc26b69768f7fb24f0c7976fae24b157b85b13 && \
|
||||
./buildconf.sh && \
|
||||
./configure --disable-shared --enable-static && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN apt install -y autopoint gettext gperf libpng12-dev && \
|
||||
git clone -b 2.13.92 --depth 1 https://gitlab.freedesktop.org/fontconfig/fontconfig && \
|
||||
cd fontconfig && \
|
||||
git reset --hard b1df1101a643ae16cdfa1d83b939de2497b1bf27 && \
|
||||
./autogen.sh --disable-shared --enable-static --sysconfdir=/etc --localstatedir=/var && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b release-64-2 --depth 1 https://github.com/unicode-org/icu && \
|
||||
cd icu/icu4c/source && \
|
||||
git reset --hard e2d85306162d3a0691b070b4f0a73e4012433444 && \
|
||||
./configure --disable-shared --enable-static --disable-tests --disable-samples && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN apt install -y wget && \
|
||||
wget https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.gz && \
|
||||
echo "9995e192e68528793755692917f9eb6422f3052a53c5e13ba278a228af6c7acf boost_1_73_0.tar.gz" | sha256sum -c && \
|
||||
tar -xzf boost_1_73_0.tar.gz && \
|
||||
rm boost_1_73_0.tar.gz && \
|
||||
cd boost_1_73_0 && \
|
||||
./bootstrap.sh && \
|
||||
./b2 --with-atomic --with-system --with-filesystem --with-thread --with-date_time --with-chrono --with-regex --with-serialization --with-program_options --with-locale variant=release link=static runtime-link=static cflags="${CFLAGS}" cxxflags="${CXXFLAGS}" install -a --prefix=/usr && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz && \
|
||||
echo "ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46 openssl-1.1.1g.tar.gz" | sha256sum -c && \
|
||||
tar -xzf openssl-1.1.1g.tar.gz && \
|
||||
rm openssl-1.1.1g.tar.gz && \
|
||||
cd openssl-1.1.1g && \
|
||||
./config no-asm no-shared no-zlib-dynamic --openssldir=/usr && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN apt install -y libgl1-mesa-dev libglib2.0-dev mesa-common-dev && \
|
||||
rm /usr/lib/x86_64-linux-gnu/libX11.a && \
|
||||
rm /usr/lib/x86_64-linux-gnu/libXext.a && \
|
||||
rm /usr/lib/x86_64-linux-gnu/libX11-xcb.a && \
|
||||
git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} --depth 1 && \
|
||||
cd qt5 && \
|
||||
git clone git://code.qt.io/qt/qtbase.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtdeclarative.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtgraphicaleffects.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtimageformats.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtmultimedia.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtquickcontrols.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtquickcontrols2.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtsvg.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qttools.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qttranslations.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtx11extras.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtxmlpatterns.git -b ${QT_VERSION} --depth 1 && \
|
||||
sed -ri s/\(Libs:.*\)/\\1\ -lexpat/ /usr/local/lib/pkgconfig/fontconfig.pc && \
|
||||
sed -ri s/\(Libs:.*\)/\\1\ -lz/ /usr/local/lib/pkgconfig/freetype2.pc && \
|
||||
sed -ri s/\(Libs:.*\)/\\1\ -lXau/ /usr/local/lib/pkgconfig/xcb.pc && \
|
||||
sed -i s/\\/usr\\/X11R6\\/lib64/\\/usr\\/local\\/lib/ qtbase/mkspecs/linux-g++-64/qmake.conf && \
|
||||
./configure --prefix=/usr -platform linux-g++-64 -opensource -confirm-license -release -static -no-avx \
|
||||
-opengl desktop -qpa xcb -xcb -xcb-xlib -feature-xlib -system-freetype -fontconfig -glib \
|
||||
-no-dbus -no-feature-qml-worker-script -no-linuxfb -no-openssl -no-sql-sqlite -no-kms -no-use-gold-linker \
|
||||
-qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \
|
||||
-skip qt3d -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d \
|
||||
-skip qtdoc -skip qtgamepad -skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing \
|
||||
-skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttools \
|
||||
-skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview \
|
||||
-skip qtwinextras -skip qtx11extras -skip gamepad -skip serialbus -skip location -skip webengine \
|
||||
-nomake examples -nomake tests -nomake tools && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
cd qttools/src/linguist/lrelease && \
|
||||
../../../../qtbase/bin/qmake && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
cd ../../../.. && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN apt install -y libudev-dev && \
|
||||
git clone -b v1.0.23 --depth 1 https://github.com/libusb/libusb && \
|
||||
cd libusb && \
|
||||
git reset --hard e782eeb2514266f6738e242cdcb18e3ae1ed06fa && \
|
||||
./autogen.sh --disable-shared --enable-static && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b hidapi-0.9.0 --depth 1 https://github.com/libusb/hidapi && \
|
||||
cd hidapi && \
|
||||
git reset --hard 7da5cc91fc0d2dbe4df4f08cd31f6ca1a262418f && \
|
||||
./bootstrap && \
|
||||
./configure --disable-shared --enable-static && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN apt install -y libsodium-dev && \
|
||||
git clone -b v4.3.2 --depth 1 https://github.com/zeromq/libzmq && \
|
||||
cd libzmq && \
|
||||
git reset --hard a84ffa12b2eb3569ced199660bac5ad128bff1f0 && \
|
||||
./autogen.sh && \
|
||||
./configure --disable-shared --enable-static --disable-libunwind --with-libsodium && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b libgpg-error-1.38 --depth 1 git://git.gnupg.org/libgpg-error.git && \
|
||||
cd libgpg-error && \
|
||||
git reset --hard 71d278824c5fe61865f7927a2ed1aa3115f9e439 && \
|
||||
./autogen.sh && \
|
||||
./configure --disable-shared --enable-static --disable-doc --disable-tests && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b libgcrypt-1.8.5 --depth 1 git://git.gnupg.org/libgcrypt.git && \
|
||||
cd libgcrypt && \
|
||||
git reset --hard 56606331bc2a80536db9fc11ad53695126007298 && \
|
||||
./autogen.sh && \
|
||||
./configure --disable-shared --enable-static --disable-doc && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b v3.10.0 --depth 1 https://github.com/protocolbuffers/protobuf && \
|
||||
cd protobuf && \
|
||||
git reset --hard 6d4e7fd7966c989e38024a8ea693db83758944f1 && \
|
||||
./autogen.sh && \
|
||||
./configure --enable-static --disable-shared && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b v3.18.4 --depth 1 https://github.com/Kitware/CMake && \
|
||||
cd CMake && \
|
||||
git reset --hard 3cc3d42aba879fff5e85b363ae8f21386a3f9f9b && \
|
||||
./bootstrap && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN apt install -y libusb-1.0-0-dev
|
||||
71
Dockerfile.windows
Normal file
71
Dockerfile.windows
Normal file
@@ -0,0 +1,71 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
ARG THREADS=1
|
||||
|
||||
RUN apt update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y build-essential cmake g++-mingw-w64 gettext git libtool pkg-config \
|
||||
python && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN update-alternatives --set x86_64-w64-mingw32-g++ $(which x86_64-w64-mingw32-g++-posix) && \
|
||||
update-alternatives --set x86_64-w64-mingw32-gcc $(which x86_64-w64-mingw32-gcc-posix)
|
||||
|
||||
RUN git clone -b v0.17.0.0 --depth 1 https://github.com/monero-project/monero && \
|
||||
cd monero && \
|
||||
git reset --hard d27d4526fe89b7cdeb4b296280c4a6cf7efe21f8 && \
|
||||
cp -a contrib/depends / && \
|
||||
cd .. && \
|
||||
rm -rf monero
|
||||
|
||||
RUN make -j$THREADS -C /depends HOST=x86_64-w64-mingw32 NO_QT=1
|
||||
|
||||
RUN curl -LO https://download.qt.io/archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz && \
|
||||
echo "5ce285209290a157d7f42ec8eb22bf3f1d76f2e03a95fc0b99b553391be01642 qt-everywhere-opensource-src-5.9.9.tar.xz" > hashsum.txt && \
|
||||
sha256sum -c hashsum.txt && \
|
||||
tar -xf qt-everywhere-opensource-src-5.9.9.tar.xz && \
|
||||
rm qt-everywhere-opensource-src-5.9.9.tar.xz && \
|
||||
cd qt-everywhere-opensource-src-5.9.9 && \
|
||||
./configure --prefix=/depends/x86_64-w64-mingw32 -xplatform win32-g++ \
|
||||
-device-option CROSS_COMPILE=/usr/bin/x86_64-w64-mingw32- \
|
||||
-I $(pwd)/qtbase/src/3rdparty/angle/include \
|
||||
-opensource -confirm-license -release -static -static-runtime -opengl dynamic -no-angle \
|
||||
-no-avx -no-openssl -no-sql-sqlite \
|
||||
-qt-freetype -qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \
|
||||
-skip gamepad -skip location -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts \
|
||||
-skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtlocation -skip qtmacextras \
|
||||
-skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtscript -skip qtscxml -skip qtsensors \
|
||||
-skip qtserialbus -skip qtserialport -skip qtspeech -skip qttools -skip qtvirtualkeyboard -skip qtwayland \
|
||||
-skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtx11extras \
|
||||
-skip serialbus -skip webengine \
|
||||
-nomake examples -nomake tests -nomake tools && \
|
||||
make QMAKE="$(pwd)/qtbase/bin/qmake CONFIG-='debug debug_and_release'" -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
cd qttools/src/linguist/lrelease && \
|
||||
../../../../qtbase/bin/qmake && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
cd ../../../.. && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone -b libgpg-error-1.38 --depth 1 git://git.gnupg.org/libgpg-error.git && \
|
||||
cd libgpg-error && \
|
||||
git reset --hard 71d278824c5fe61865f7927a2ed1aa3115f9e439 && \
|
||||
./autogen.sh && \
|
||||
./configure --disable-shared --enable-static --disable-doc --disable-tests \
|
||||
--host=x86_64-w64-mingw32 --prefix=/depends/x86_64-w64-mingw32 && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
cd .. && \
|
||||
rm -rf libgpg-error
|
||||
|
||||
RUN git clone -b libgcrypt-1.8.5 --depth 1 git://git.gnupg.org/libgcrypt.git && \
|
||||
cd libgcrypt && \
|
||||
git reset --hard 56606331bc2a80536db9fc11ad53695126007298 && \
|
||||
./autogen.sh && \
|
||||
./configure --disable-shared --enable-static --disable-doc \
|
||||
--host=x86_64-w64-mingw32 --prefix=/depends/x86_64-w64-mingw32 \
|
||||
--with-gpg-error-prefix=/depends/x86_64-w64-mingw32 && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
cd .. && \
|
||||
rm -rf libgcrypt
|
||||
@@ -221,7 +221,7 @@ Rectangle {
|
||||
MoneroComponents.Label {
|
||||
fontSize: 16
|
||||
visible: isSyncing
|
||||
text: qsTr("Syncing...")
|
||||
text: qsTr("Syncing...") + translationManager.emptyString
|
||||
color: MoneroComponents.Style.blackTheme ? "white" : "black"
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 20
|
||||
@@ -263,6 +263,10 @@ Rectangle {
|
||||
anchors.leftMargin: 58
|
||||
anchors.baseline: currencyLabel.baseline
|
||||
color: MoneroComponents.Style.blackTheme ? "white" : "black"
|
||||
Binding on color {
|
||||
when: balancePart1MouseArea.containsMouse || balancePart2MouseArea.containsMouse
|
||||
value: MoneroComponents.Style.orange
|
||||
}
|
||||
text: {
|
||||
if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) {
|
||||
return balanceFiatString.split('.')[0] + "."
|
||||
@@ -284,14 +288,6 @@ Rectangle {
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onEntered: {
|
||||
balancePart1.color = MoneroComponents.Style.orange
|
||||
balancePart2.color = MoneroComponents.Style.orange
|
||||
}
|
||||
onExited: {
|
||||
balancePart1.color = Qt.binding(function() { return MoneroComponents.Style.blackTheme ? "white" : "black" })
|
||||
balancePart2.color = Qt.binding(function() { return MoneroComponents.Style.blackTheme ? "white" : "black" })
|
||||
}
|
||||
onClicked: {
|
||||
console.log("Copied to clipboard");
|
||||
clipboard.setText(balancePart1.text + balancePart2.text);
|
||||
@@ -305,7 +301,7 @@ Rectangle {
|
||||
anchors.left: balancePart1.right
|
||||
anchors.leftMargin: 2
|
||||
anchors.baseline: currencyLabel.baseline
|
||||
color: MoneroComponents.Style.blackTheme ? "white" : "black"
|
||||
color: balancePart1.color
|
||||
text: {
|
||||
if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) {
|
||||
return balanceFiatString.split('.')[1]
|
||||
@@ -315,11 +311,10 @@ Rectangle {
|
||||
}
|
||||
font.pixelSize: 16
|
||||
MouseArea {
|
||||
id: balancePart2MouseArea
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onEntered: balancePart1MouseArea.entered()
|
||||
onExited: balancePart1MouseArea.exited()
|
||||
onClicked: balancePart1MouseArea.clicked(mouse)
|
||||
}
|
||||
}
|
||||
|
||||
55
Makefile
55
Makefile
@@ -1,42 +1,63 @@
|
||||
ANDROID_STANDALONE_TOOLCHAIN_PATH ?= /usr/local/toolchain
|
||||
MANUAL_SUBMODULES ?= OFF
|
||||
|
||||
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)
|
||||
builddir := build
|
||||
topdir := ../..
|
||||
ifeq ($(USE_SINGLE_BUILDDIR), OFF)
|
||||
os := $(shell echo `uname | sed -e 's|[:/\\ \(\)]|_|g'`)
|
||||
builddir := $(builddir)/$(os)
|
||||
topdir := $(topdir)/..
|
||||
|
||||
branch:=$(shell git branch | grep '\* ' | cut -f2- -d' '| sed -e 's|[:/\\ \(\)]|_|g')
|
||||
builddir := $(builddir)/$(branch)
|
||||
topdir := $(topdir)/..
|
||||
|
||||
deldirs := $(builddir)
|
||||
else
|
||||
builddir := build
|
||||
topdir := ../..
|
||||
deldirs := $(builddir)/debug $(builddir)/release $(builddir)/fuzz
|
||||
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)
|
||||
mkdir -p build && cd build && cmake -D ARCH="x86-64" -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -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
|
||||
mkdir -p build && cd build && cmake -D DEV_MODE=$(or ${DEV_MODE},ON) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} .. && $(MAKE) VERBOSE=1
|
||||
|
||||
depends:
|
||||
mkdir -p build/$(target)/release
|
||||
cd build/$(target)/release && cmake -D STATIC=ON -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D BUILD_TAG=$(tag) -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$(root)/$(target)/share/toolchain.cmake ../../.. && $(MAKE)
|
||||
|
||||
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)
|
||||
mkdir -p build && cd build && cmake -D ARCH="x86-64" -D DEV_MODE=$(or ${DEV_MODE},ON) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -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)
|
||||
mkdir -p build && cd build && cmake -D ARCH="x86-64" -D DEV_MODE=$(or ${DEV_MODE},ON) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D WITH_SCANNER=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release .. && $(MAKE)
|
||||
|
||||
release:
|
||||
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE)
|
||||
|
||||
release-linux-armv8:
|
||||
mkdir -p $(builddir)/release
|
||||
cd $(builddir)/release
|
||||
cmake -D DEV_MODE=$(or ${DEV_MODE},OFF) -D ARCH="armv8-a" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="linux-armv8" $(topdir) && $(MAKE)
|
||||
|
||||
release-static:
|
||||
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=ON -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release $(topdir) && $(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=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
|
||||
mkdir -p $(builddir)/debug && cd $(builddir)/debug && cmake -D STATIC=ON -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},ON) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
|
||||
|
||||
debug-static-mac64:
|
||||
mkdir -p $(builddir)/debug
|
||||
cd $(builddir)/debug && cmake -D STATIC=ON -D DEV_MODE=$(or ${DEV_MODE},ON) -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="mac-x64" $(topdir) && $(MAKE)
|
||||
cd $(builddir)/debug && cmake -D STATIC=ON -D DEV_MODE=$(or ${DEV_MODE},ON) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -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=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
|
||||
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=ON -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
|
||||
|
||||
release-win64:
|
||||
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=OFF -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},OFF) -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
|
||||
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=OFF -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
|
||||
|
||||
@@ -50,7 +50,10 @@ Rectangle {
|
||||
property alias contentHeight: mainFlickable.contentHeight
|
||||
property alias flickable: mainFlickable
|
||||
|
||||
property Transfer transferView: Transfer { }
|
||||
property Transfer transferView: Transfer {
|
||||
onPaymentClicked: root.paymentClicked(address, paymentId, amount, mixinCount, priority, description)
|
||||
onSweepUnmixableClicked: root.sweepUnmixableClicked()
|
||||
}
|
||||
property Receive receiveView: Receive { }
|
||||
property Merchant merchantView: Merchant { }
|
||||
property TxKey txkeyView: TxKey { }
|
||||
@@ -260,18 +263,4 @@ Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: borderLeft.right
|
||||
}
|
||||
|
||||
/* connect "payment" click */
|
||||
Connections {
|
||||
ignoreUnknownSignals: false
|
||||
target: transferView
|
||||
onPaymentClicked : {
|
||||
console.log("MiddlePanel: paymentClicked")
|
||||
paymentClicked(address, paymentId, amount, mixinCount, priority, description)
|
||||
}
|
||||
onSweepUnmixableClicked : {
|
||||
console.log("MiddlePanel: sweepUnmixableClicked")
|
||||
sweepUnmixableClicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
167
README.md
167
README.md
@@ -36,19 +36,17 @@ As with many development projects, the repository on Github is considered to be
|
||||
|
||||
Monero is a 100% community-sponsored endeavor. If you want to join our efforts, the easiest thing you can do is support the project financially. Both Monero and Bitcoin donations can be made to **donate.getmonero.org** if using a client that supports the [OpenAlias](https://openalias.org) standard.
|
||||
|
||||
The Monero donation address is: `44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A` (viewkey: `f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501`)
|
||||
The Monero donation address is: `888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H` (viewkey: `f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501`)
|
||||
|
||||
The Bitcoin donation address is: `1KTexdemPdxSBcG55heUuTjDRYqbC5ZL8H`
|
||||
|
||||
GUI development funding and/or some supporting services are also graciously provided by sponsors:
|
||||
GUI development funding and/or some supporting services are also graciously provided by [sponsors](https://www.getmonero.org/community/sponsorships/):
|
||||
|
||||
[<img width="80" src="https://static.getmonero.org/images/sponsors/mymonero.png"/>](https://mymonero.com)
|
||||
[<img width="150" src="https://static.getmonero.org/images/sponsors/kitware.png?1"/>](http://kitware.com)
|
||||
[<img width="100" src="https://static.getmonero.org/images/sponsors/dome9.png"/>](http://dome9.com)
|
||||
[<img width="150" src="https://static.getmonero.org/images/sponsors/araxis.png"/>](http://araxis.com)
|
||||
[<img width="150" src="https://static.getmonero.org/images/sponsors/jetbrains.png"/>](http://www.jetbrains.com/)
|
||||
[<img width="150" src="https://static.getmonero.org/images/sponsors/navicat.png"/>](http://www.navicat.com/)
|
||||
[<img width="150" src="https://static.getmonero.org/images/sponsors/symas.png"/>](http://www.symas.com/)
|
||||
[<img width="150" src="https://www.getmonero.org/img/sponsors/tarilabs.png"/>](https://tarilabs.com/)
|
||||
[<img width="150" src="https://www.getmonero.org/img/sponsors/globee.png"/>](https://globee.com/)
|
||||
[<img width="150" src="https://www.getmonero.org/img/sponsors/symas.png"/>](https://symas.com/)
|
||||
[<img width="150" src="https://www.getmonero.org/img/sponsors/forked_logo.png"/>](http://www.forked.net/)
|
||||
[<img width="150" src="https://www.getmonero.org/img/sponsors/macstadium.png"/>](https://www.macstadium.com/)
|
||||
|
||||
There are also several mining pools that kindly donate a portion of their fees, [a list of them can be found on our Bitcointalk post](https://bitcointalk.org/index.php?topic=583449.0).
|
||||
|
||||
@@ -70,10 +68,11 @@ Status of the translations:
|
||||
## Installing the Monero GUI from a package
|
||||
|
||||
Packages are available for
|
||||
|
||||
* Arch Linux: pacman -S monero-gui
|
||||
* Void Linux: xbps-install -S monero-core
|
||||
* GuixSD: guix package -i monero-core
|
||||
* Arch Linux: [monero-gui](https://www.archlinux.org/packages/community/x86_64/monero-gui/)
|
||||
* Debian: See the [whonix/monero-gui repository](https://gitlab.com/whonix/monero-gui#how-to-install-monero-using-apt-get)
|
||||
* Void Linux: `xbps-install -S monero-gui`
|
||||
* GuixSD: `guix package -i monero-gui`
|
||||
* macOS (homebrew): `brew cask install monero-wallet`
|
||||
|
||||
Packaging for your favorite distribution would be a welcome contribution!
|
||||
|
||||
@@ -81,6 +80,99 @@ Packaging for your favorite distribution would be a welcome contribution!
|
||||
|
||||
*Note*: Qt 5.9.7 is the minimum version required to build the GUI.
|
||||
|
||||
### Building Windows static binaries with Docker (any OS)
|
||||
|
||||
1. Install Docker [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
|
||||
2. Clone the repository
|
||||
```
|
||||
git clone --recursive https://github.com/monero-project/monero-gui.git
|
||||
```
|
||||
3. Prepare build environment
|
||||
```
|
||||
cd monero-gui
|
||||
docker build --tag monero:build-env-windows --build-arg THREADS=4 --file Dockerfile.windows .
|
||||
```
|
||||
\* `4` - number of CPU threads to use
|
||||
|
||||
4. Build
|
||||
```
|
||||
docker run --rm -it -v <MONERO_GUI_DIR_FULL_PATH>:/monero-gui -w /monero-gui monero:build-env-windows sh -c 'make depends root=/depends target=x86_64-w64-mingw32 tag=win-x64 -j4'
|
||||
```
|
||||
\* `<MONERO_GUI_DIR_FULL_PATH>` - absolute path to `monero-gui` directory
|
||||
\* `4` - number of CPU threads to use
|
||||
5. Monero GUI Windows static binaries will be placed in `monero-gui/build/x86_64-w64-mingw32/release/bin` directory
|
||||
|
||||
### Building Linux static binaries with Docker (any OS)
|
||||
|
||||
1. Install Docker [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
|
||||
2. Clone the repository
|
||||
```
|
||||
git clone --recursive https://github.com/monero-project/monero-gui.git
|
||||
```
|
||||
3. Prepare build environment
|
||||
```
|
||||
cd monero-gui
|
||||
docker build --tag monero:build-env-linux --build-arg THREADS=4 --file Dockerfile.linux .
|
||||
```
|
||||
\* `4` - number of CPU threads to use
|
||||
|
||||
4. Build
|
||||
```
|
||||
docker run --rm -it -v <MONERO_GUI_DIR_FULL_PATH>:/monero-gui -w /monero-gui monero:build-env-linux sh -c 'make release-static -j4'
|
||||
```
|
||||
\* `<MONERO_GUI_DIR_FULL_PATH>` - absolute path to `monero-gui` directory
|
||||
\* `4` - number of CPU threads to use
|
||||
5. Monero GUI Linux static binaries will be placed in `monero-gui/build/release/bin` directory
|
||||
|
||||
### Building Android APK with Docker (any OS) *Experimental*
|
||||
- Minimum Android 9 Pie (API 28)
|
||||
- ARMv8-A 64-bit CPU
|
||||
1. Install Docker [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
|
||||
2. Clone the repository
|
||||
```
|
||||
git clone --recursive https://github.com/monero-project/monero-gui.git
|
||||
```
|
||||
3. Prepare build environment
|
||||
```
|
||||
cd monero-gui
|
||||
docker build --tag monero:build-env-android --build-arg THREADS=4 --file Dockerfile.android .
|
||||
```
|
||||
\* `4` - number of CPU threads to use
|
||||
|
||||
4. Build
|
||||
```
|
||||
docker run --rm -it -v <MONERO_GUI_DIR_FULL_PATH>:/monero-gui -e THREADS=4 monero:build-env-android
|
||||
```
|
||||
\* `<MONERO_GUI_DIR_FULL_PATH>` - absolute path to `monero-gui` directory
|
||||
\* `4` - number of CPU threads to use
|
||||
5. Monero GUI APK will be placed in `monero-gui/build/Android/release/android-build` directory
|
||||
6. Deploy
|
||||
* Using ADB (Android debugger bridge)
|
||||
- [Enable adb debugging on your device](https://developer.android.com/studio/command-line/adb.html#Enabling)
|
||||
* Connect your device with USB and install Monero GUI APK with adb:
|
||||
```
|
||||
adb install build/Android/release/android-build/monero-gui.apk
|
||||
```
|
||||
* Troubleshooting:
|
||||
```
|
||||
adb devices -l
|
||||
adb logcat
|
||||
```
|
||||
* If using adb inside docker, make sure you did
|
||||
```
|
||||
docker run -v /dev/bus/usb:/dev/bus/usb --privileged
|
||||
```
|
||||
* Using a web server
|
||||
```
|
||||
mkdir /usr/tmp
|
||||
cp build/Android/release/android-build/monero-gui.apk /usr/tmp
|
||||
docker run -d -v /usr/tmp:/usr/share/nginx/html:ro -p 8080:80 nginx
|
||||
```
|
||||
Now it should be accessible through a web browser at
|
||||
```
|
||||
http://<your.local.ip>:8080/QtApp-debug.apk
|
||||
```
|
||||
|
||||
### On Linux:
|
||||
|
||||
(Tested on Ubuntu 17.10 x64, Ubuntu 18.04 x64 and Gentoo x64)
|
||||
@@ -130,14 +222,18 @@ The following instructions will fetch Qt from your distribution's repositories i
|
||||
|
||||
3. Clone repository
|
||||
|
||||
`git clone https://github.com/monero-project/monero-gui.git`
|
||||
```
|
||||
git clone --recursive https://github.com/monero-project/monero-gui.git
|
||||
cd monero-gui
|
||||
```
|
||||
|
||||
4. Build
|
||||
|
||||
```
|
||||
cd monero-gui
|
||||
QT_SELECT=5 ./build.sh
|
||||
make release -j4
|
||||
```
|
||||
\* `4` - number of CPU threads to use
|
||||
\* Add `CMAKE_PREFIX_PATH` enviroment variable to set a custom Qt install directory, e.g. `CMAKE_PREFIX_PATH=$HOME/Qt/5.9.7/gcc_64 make release -j4`
|
||||
|
||||
The executable can be found in the build/release/bin folder.
|
||||
|
||||
@@ -155,25 +251,25 @@ The executable can be found in the build/release/bin folder.
|
||||
|
||||
`brew install qt5` (or download QT 5.9.7+ from [qt.io](https://www.qt.io/download-open-source/))
|
||||
|
||||
5. Add the Qt bin directory to your path
|
||||
5. Grab an up-to-date copy of the monero-gui repository
|
||||
|
||||
- Example for Qt: `export PATH=$PATH:$HOME/Qt/5.9.7/clang_64/bin`
|
||||
- Example for Homebrew: `export PATH=$PATH:/usr/local/opt/qt/bin`
|
||||
```
|
||||
git clone --recursive https://github.com/monero-project/monero-gui.git
|
||||
cd monero-gui
|
||||
```
|
||||
|
||||
6. Grab an up-to-date copy of the monero-gui repository
|
||||
6. Start the build
|
||||
|
||||
`git clone https://github.com/monero-project/monero-gui.git`
|
||||
|
||||
7. Go into the repository
|
||||
|
||||
`cd monero-gui`
|
||||
|
||||
8. Start the build
|
||||
|
||||
`./build.sh`
|
||||
```
|
||||
make release -j4
|
||||
```
|
||||
\* `4` - number of CPU threads to use
|
||||
\* Add `CMAKE_PREFIX_PATH` enviroment variable to set a custom Qt install directory, e.g. `CMAKE_PREFIX_PATH=$HOME/Qt/5.9.7/clang_64 make release -j4`
|
||||
|
||||
The executable can be found in the `build/release/bin` folder.
|
||||
|
||||
For building an application bundle see `DEPLOY.md`.
|
||||
|
||||
### On Windows:
|
||||
|
||||
The Monero GUI on Windows is 64 bits only; 32-bit Windows GUI builds are not officially supported anymore.
|
||||
@@ -213,18 +309,17 @@ The Monero GUI on Windows is 64 bits only; 32-bit Windows GUI builds are not off
|
||||
6. Clone repository
|
||||
|
||||
```
|
||||
git clone https://github.com/monero-project/monero-gui.git
|
||||
git clone --recursive https://github.com/monero-project/monero-gui.git
|
||||
cd monero-gui
|
||||
```
|
||||
|
||||
7. Build
|
||||
|
||||
```
|
||||
cd monero-gui
|
||||
source ./build.sh release-static
|
||||
cd build
|
||||
make release-win64 -j4
|
||||
cd build/release
|
||||
make deploy
|
||||
```
|
||||
\* `4` - number of CPU threads to use
|
||||
|
||||
**Note:** The use of `source` above is a dirty workaround for a suspected bug in the current QT version 5.11.2-3 available in the MSYS2 packaging system, see https://github.com/monero-project/monero-gui/issues/1559 for more info.
|
||||
|
||||
The executable can be found in the `.\release\bin` directory.
|
||||
The executable can be found in the `.\bin` directory.
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
Copyright (c) 2014-2018, The Monero Project
|
||||
|
||||
|
||||
## Current status : ALPHA
|
||||
|
||||
- Minimum Android 5.0 (api level 21)
|
||||
- Modal dialogs can appear in background giving the feeling that the application is frozen (Work around : turn screen off/on or switch to another app and back)
|
||||
|
||||
## Build using Docker
|
||||
|
||||
# Base environnement
|
||||
|
||||
cd monero/utils/build_scripts
|
||||
docker build -f android32.Dockerfile -t monero-android .
|
||||
cd ..
|
||||
|
||||
# Build GUI
|
||||
|
||||
cd android/docker
|
||||
docker build -t monero-gui-android .
|
||||
docker create -it --name monero-gui-android monero-gui-android bash
|
||||
|
||||
# Get the apk
|
||||
|
||||
docker cp monero-gui-android:/opt/android/monero-gui/build/release/bin/bin/QtApp-debug.apk .
|
||||
|
||||
## Deployment
|
||||
|
||||
- Using ADB (Android debugger bridge) :
|
||||
|
||||
First, see section [Enable adb debugging on your device](https://developer.android.com/studio/command-line/adb.html#Enabling)
|
||||
The only place where we are allowed to play is `/data/local/tmp`. So :
|
||||
|
||||
adb push /opt/android/monero-gui/build/release/bin/bin/QtApp-debug.apk /data/local/tmp
|
||||
adb shell pm install -r /data/local/tmp/QtApp-debug.apk
|
||||
|
||||
- Troubleshooting:
|
||||
|
||||
adb devices -l
|
||||
adb logcat
|
||||
|
||||
if using adb inside docker, make sure you did "docker run -v /dev/bus/usb:/dev/bus/usb --privileged"
|
||||
|
||||
- Using a web server
|
||||
|
||||
mkdir /usr/tmp
|
||||
cp QtApp-debug.apk /usr/tmp
|
||||
docker run -d -v /usr/tmp:/usr/share/nginx/html:ro -p 8080:80 nginx
|
||||
|
||||
Now it should be accessible through a web browser at
|
||||
|
||||
http://<your.local.ip>:8080/QtApp-debug.apk
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
FROM monero-android
|
||||
|
||||
#INSTALL JAVA
|
||||
RUN echo "deb http://ftp.fr.debian.org/debian/ jessie-backports main contrib non-free" >> /etc/apt/sources.list
|
||||
RUN dpkg --add-architecture i386 \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 libz1:i386 \
|
||||
&& apt-get install -y -t jessie-backports ca-certificates-java openjdk-8-jdk-headless openjdk-8-jre-headless ant
|
||||
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
|
||||
ENV PATH $JAVA_HOME/bin:$PATH
|
||||
|
||||
#Get Qt
|
||||
ENV QT_VERSION 5.8
|
||||
|
||||
RUN git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} \
|
||||
&& cd qt5 \
|
||||
&& perl init-repository
|
||||
|
||||
## Note: Need to use libc++ but Qt does not provide mkspec for libc++.
|
||||
## Their support of it is quite recent and they claim they don't use it by default
|
||||
## [only because it produces bigger binary objects](https://bugreports.qt.io/browse/QTBUG-50724).
|
||||
|
||||
#Create new mkspec for clang + libc++
|
||||
RUN cp -r qt5/qtbase/mkspecs/android-clang qt5/qtbase/mkspecs/android-clang-libc \
|
||||
&& cd qt5/qtbase/mkspecs/android-clang-libc \
|
||||
&& sed -i '16i ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/$$ANDROID_TARGET_ARCH' qmake.conf \
|
||||
&& sed -i '17i ANDROID_SOURCES_CXX_STL_INCDIR = $$NDK_ROOT/sources/cxx-stl/llvm-libc++/include' qmake.conf \
|
||||
&& echo "QMAKE_LIBS_PRIVATE = -lc++_shared -llog -lz -lm -ldl -lc -lgcc " >> qmake.conf \
|
||||
&& echo "QMAKE_CFLAGS -= -mfpu=vfp " >> qmake.conf \
|
||||
&& echo "QMAKE_CXXFLAGS -= -mfpu=vfp " >> qmake.conf \
|
||||
&& echo "QMAKE_CFLAGS += -mfpu=vfp4 " >> qmake.conf \
|
||||
&& echo "QMAKE_CXXFLAGS += -mfpu=vfp4 " >> qmake.conf
|
||||
|
||||
ENV ANDROID_API android-21
|
||||
|
||||
#ANDROID SDK TOOLS
|
||||
RUN echo y | $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --all --filter platform-tools
|
||||
RUN echo y | $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --all --filter ${ANDROID_API}
|
||||
RUN echo y | $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --all --filter build-tools-25.0.1
|
||||
|
||||
ENV CLEAN_PATH $JAVA_HOME/bin:/usr/cmake-3.6.3-Linux-x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
#build Qt
|
||||
RUN cd qt5 && PATH=${CLEAN_PATH} ./configure -developer-build -release \
|
||||
-xplatform android-clang-libc \
|
||||
-android-ndk-platform ${ANDROID_API} \
|
||||
-android-ndk $ANDROID_NDK_ROOT \
|
||||
-android-sdk $ANDROID_SDK_ROOT \
|
||||
-opensource -confirm-license \
|
||||
-prefix ${WORKDIR}/Qt-${QT_VERSION} \
|
||||
-nomake tests -nomake examples \
|
||||
-skip qtserialport \
|
||||
-skip qtconnectivity \
|
||||
-skip qttranslations \
|
||||
-skip qtgamepad -skip qtscript -skip qtdoc
|
||||
|
||||
# build Qt tools : gnustl_shared.so is hard-coded in androiddeployqt
|
||||
# replace it with libc++_shared.so
|
||||
COPY androiddeployqt.patch qt5/qttools/androiddeployqt.patch
|
||||
RUN cd qt5/qttools \
|
||||
&& git apply androiddeployqt.patch \
|
||||
&& cd .. \
|
||||
&& PATH=${CLEAN_PATH} make -j4 \
|
||||
&& PATH=${CLEAN_PATH} make install
|
||||
|
||||
# Get iconv and ZBar
|
||||
ENV ICONV_VERSION 1.14
|
||||
RUN git clone https://github.com/ZBar/ZBar.git \
|
||||
&& curl -s -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \
|
||||
&& tar -xzf libiconv-${ICONV_VERSION}.tar.gz \
|
||||
&& cd libiconv-${ICONV_VERSION} \
|
||||
&& CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ ./configure --build=x86_64-linux-gnu --host=arm-eabi --prefix=${WORKDIR}/libiconv --disable-rpath
|
||||
|
||||
ENV PATH $ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:${WORKDIR}/Qt-${QT_VERSION}/bin:$PATH
|
||||
|
||||
#Build libiconv.a and libzbarjni.a
|
||||
COPY android.mk.patch ZBar/android.mk.patch
|
||||
RUN cd ZBar \
|
||||
&& git apply android.mk.patch \
|
||||
&& echo \
|
||||
"APP_ABI := armeabi-v7a \n\
|
||||
APP_STL := c++_shared \n\
|
||||
TARGET_PLATFORM := ${ANDROID_API} \n\
|
||||
TARGET_ARCH_ABI := armeabi-v7a \n\
|
||||
APP_CFLAGS += -target armv7-none-linux-androideabi -fexceptions -fstack-protector-strong -fno-limit-debug-info -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -fno-omit-frame-pointer -fno-stack-protector\n"\
|
||||
>> android/jni/Application.mk \
|
||||
&& cd android \
|
||||
&& android update project --path . -t "${ANDROID_API}" \
|
||||
&& CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ ant -Dndk.dir=${ANDROID_NDK_ROOT} -Diconv.src=${WORKDIR}/libiconv-${ICONV_VERSION} zbar-clean zbar-ndk-build
|
||||
|
||||
RUN cp openssl/lib* ${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm/usr/lib
|
||||
RUN cp boost_${BOOST_VERSION}/android32/lib/lib* ${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm/usr/lib
|
||||
RUN cp ZBar/android/obj/local/armeabi-v7a/lib* ${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm/usr/lib
|
||||
|
||||
RUN git clone https://github.com/monero-project/monero-gui.git \
|
||||
&& cd monero-gui \
|
||||
&& git submodule update \
|
||||
&& CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ BOOST_ROOT=/opt/android/boost_1_62_0 \
|
||||
BOOST_LIBRARYDIR=${WORKDIR}/boost_${BOOST_VERSION}/android32/lib/ \
|
||||
OPENSSL_ROOT_DIR=${WORKDIR}/openssl/ \
|
||||
CMAKE_INCLUDE_PATH=${WORKDIR}/cppzmq/ \
|
||||
CMAKE_LIBRARY_PATH=${WORKDIR}/zeromq4-1/.libs \
|
||||
CXXFLAGS="-I ${WORKDIR}/zeromq4-1/include/" \
|
||||
./build.sh release-android \
|
||||
&& cd build \
|
||||
&& make deploy
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
|
||||
index e442b07..158afd5 100644
|
||||
--- a/android/jni/Android.mk
|
||||
+++ b/android/jni/Android.mk
|
||||
@@ -12,14 +12,18 @@ LOCAL_PATH := $(ICONV_SRC)
|
||||
|
||||
LOCAL_MODULE := libiconv
|
||||
|
||||
+LOCAL_ARM_MODE := arm
|
||||
+LOCAL_CPP_FEATURES := exceptions rtti features
|
||||
LOCAL_CFLAGS := \
|
||||
-Wno-multichar \
|
||||
-D_ANDROID \
|
||||
- -DLIBDIR="c" \
|
||||
+ -DLIBDIR="\".\"" \
|
||||
-DBUILDING_LIBICONV \
|
||||
-DBUILDING_LIBCHARSET \
|
||||
-DIN_LIBRARY
|
||||
|
||||
+LOCAL_CFLAGS += -fno-stack-protector
|
||||
+
|
||||
LOCAL_SRC_FILES := \
|
||||
lib/iconv.c \
|
||||
libcharset/lib/localcharset.c \
|
||||
@@ -30,13 +34,14 @@ LOCAL_C_INCLUDES := \
|
||||
$(ICONV_SRC)/libcharset \
|
||||
$(ICONV_SRC)/libcharset/include
|
||||
|
||||
-include $(BUILD_SHARED_LIBRARY)
|
||||
+include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
LOCAL_LDLIBS := -llog -lcharset
|
||||
|
||||
# libzbarjni
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
+
|
||||
LOCAL_PATH := $(MY_LOCAL_PATH)
|
||||
LOCAL_MODULE := zbarjni
|
||||
LOCAL_SRC_FILES := ../../java/zbarjni.c \
|
||||
@@ -71,6 +76,17 @@ LOCAL_C_INCLUDES := ../include \
|
||||
../zbar \
|
||||
$(ICONV_SRC)/include
|
||||
|
||||
-LOCAL_SHARED_LIBRARIES := libiconv
|
||||
+LOCAL_STATIC_LIBRARIES := libiconv
|
||||
+LOCAL_ARM_MODE := arm
|
||||
+LOCAL_CPP_FEATURES := exceptions rtti features
|
||||
+
|
||||
+LOCAL_CFLAGS := \
|
||||
+ -Wno-multichar \
|
||||
+ -D_ANDROID \
|
||||
+ -DLIBDIR="\".\"" \
|
||||
+ -DBUILDING_LIBICONV \
|
||||
+ -DBUILDING_LIBCHARSET \
|
||||
+ -DIN_LIBRARY
|
||||
+
|
||||
|
||||
-include $(BUILD_SHARED_LIBRARY)
|
||||
\ No newline at end of file
|
||||
+include $(BUILD_STATIC_LIBRARY)
|
||||
@@ -1,62 +0,0 @@
|
||||
diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp
|
||||
index 8a8e591..71d693e 100644
|
||||
--- a/src/androiddeployqt/main.cpp
|
||||
+++ b/src/androiddeployqt/main.cpp
|
||||
@@ -1122,7 +1122,7 @@ bool updateLibsXml(const Options &options)
|
||||
|
||||
QString libsPath = QLatin1String("libs/") + options.architecture + QLatin1Char('/');
|
||||
|
||||
- QString qtLibs = QLatin1String("<item>gnustl_shared</item>\n");
|
||||
+ QString qtLibs = QLatin1String("<item>c++_shared</item>\n");
|
||||
QString bundledInLibs;
|
||||
QString bundledInAssets;
|
||||
foreach (Options::BundledFile bundledFile, options.bundledFiles) {
|
||||
@@ -2519,6 +2519,39 @@ bool installApk(const Options &options)
|
||||
return true;
|
||||
}
|
||||
|
||||
+bool copyStl(Options *options)
|
||||
+{
|
||||
+ if (options->deploymentMechanism == Options::Debug && !options->installApk)
|
||||
+ return true;
|
||||
+
|
||||
+ if (options->verbose)
|
||||
+ fprintf(stdout, "Copying LIBC++ STL library\n");
|
||||
+
|
||||
+ QString filePath = options->ndkPath
|
||||
+ + QLatin1String("/sources/cxx-stl/llvm-libc++")
|
||||
+ + QLatin1String("/libs/")
|
||||
+ + options->architecture
|
||||
+ + QLatin1String("/libc++_shared.so");
|
||||
+ if (!QFile::exists(filePath)) {
|
||||
+ fprintf(stderr, "LIBC STL library does not exist at %s\n", qPrintable(filePath));
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ QString destinationDirectory =
|
||||
+ options->deploymentMechanism == Options::Debug
|
||||
+ ? options->temporaryDirectoryName + QLatin1String("/lib")
|
||||
+ : options->outputDirectory + QLatin1String("/libs/") + options->architecture;
|
||||
+
|
||||
+ if (!copyFileIfNewer(filePath, destinationDirectory
|
||||
+ + QLatin1String("/libc++_shared.so"), options->verbose)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (options->deploymentMechanism == Options::Debug && !deployToLocalTmp(options, QLatin1String("/lib/libc++_shared.so")))
|
||||
+ return false;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
bool copyGnuStl(Options *options)
|
||||
{
|
||||
if (options->deploymentMechanism == Options::Debug && !options->installApk)
|
||||
@@ -2870,7 +2903,7 @@ int main(int argc, char *argv[])
|
||||
if (Q_UNLIKELY(options.timing))
|
||||
fprintf(stdout, "[TIMING] %d ms: Read dependencies\n", options.timer.elapsed());
|
||||
|
||||
- if (options.deploymentMechanism != Options::Ministro && !copyGnuStl(&options))
|
||||
+ if (options.deploymentMechanism != Options::Ministro && !copyStl(&options))
|
||||
return CannotCopyGnuStl;
|
||||
|
||||
if (Q_UNLIKELY(options.timing))
|
||||
124
build.sh
124
build.sh
@@ -1,124 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
BUILD_TYPE=$1
|
||||
BUILD_TREZOR=${BUILD_TREZOR-true}
|
||||
source ./utils.sh
|
||||
platform=$(get_platform)
|
||||
# default build type
|
||||
if [ -z $BUILD_TYPE ]; then
|
||||
BUILD_TYPE=release
|
||||
fi
|
||||
|
||||
# Return 0 if the command exists, 1 if it does not.
|
||||
exists() {
|
||||
command -v "$1" &>/dev/null
|
||||
}
|
||||
|
||||
# Return the first value in $@ that's a runnable command.
|
||||
find_command() {
|
||||
for arg in "$@"; do
|
||||
if exists "$arg"; then
|
||||
echo "$arg"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
if [ "$BUILD_TYPE" == "release" ]; then
|
||||
echo "Building release"
|
||||
CONFIG="CONFIG+=release";
|
||||
BIN_PATH=release/bin
|
||||
elif [ "$BUILD_TYPE" == "release-static" ]; then
|
||||
echo "Building release-static"
|
||||
if [ "$platform" != "darwin" ]; then
|
||||
CONFIG="CONFIG+=release static";
|
||||
else
|
||||
# OS X: build static libwallet but dynamic Qt.
|
||||
echo "OS X: Building Qt project without static flag"
|
||||
CONFIG="CONFIG+=release";
|
||||
fi
|
||||
BIN_PATH=release/bin
|
||||
elif [ "$BUILD_TYPE" == "release-android" ]; then
|
||||
echo "Building release for ANDROID"
|
||||
CONFIG="CONFIG+=release static WITH_SCANNER DISABLE_PASS_STRENGTH_METER";
|
||||
ANDROID=true
|
||||
BIN_PATH=release/bin
|
||||
DISABLE_PASS_STRENGTH_METER=true
|
||||
elif [ "$BUILD_TYPE" == "debug-android" ]; then
|
||||
echo "Building debug for ANDROID : ultra INSECURE !!"
|
||||
CONFIG="CONFIG+=debug qml_debug WITH_SCANNER DISABLE_PASS_STRENGTH_METER";
|
||||
ANDROID=true
|
||||
BIN_PATH=debug/bin
|
||||
DISABLE_PASS_STRENGTH_METER=true
|
||||
elif [ "$BUILD_TYPE" == "debug" ]; then
|
||||
echo "Building debug"
|
||||
CONFIG="CONFIG+=debug"
|
||||
BIN_PATH=debug/bin
|
||||
else
|
||||
echo "Valid build types are release, release-static, release-android, debug-android and debug"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
source ./utils.sh
|
||||
pushd $(pwd)
|
||||
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
MONERO_DIR=monero
|
||||
MONEROD_EXEC=monerod
|
||||
|
||||
MAKE='make'
|
||||
if [[ $platform == *bsd* ]]; then
|
||||
MAKE='gmake'
|
||||
fi
|
||||
|
||||
# build libwallet
|
||||
export BUILD_TREZOR
|
||||
./get_libwallet_api.sh $BUILD_TYPE
|
||||
|
||||
# build zxcvbn
|
||||
if [ "$DISABLE_PASS_STRENGTH_METER" != true ]; then
|
||||
$MAKE -C src/zxcvbn-c || exit
|
||||
fi
|
||||
|
||||
if [ ! -d build ]; then mkdir build; fi
|
||||
|
||||
|
||||
# Platform indepenent settings
|
||||
if [ "$ANDROID" != true ] && ([ "$platform" == "linux32" ] || [ "$platform" == "linux64" ]); then
|
||||
exists lsb_release && distro="$(lsb_release -is)"
|
||||
if [ "$distro" = "Ubuntu" ] || [ "$distro" = "Fedora" ] || test -f /etc/fedora-release; then
|
||||
CONFIG="$CONFIG libunwind_off"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$platform" == "darwin" ]; then
|
||||
BIN_PATH=$BIN_PATH/monero-wallet-gui.app/Contents/MacOS/
|
||||
elif [ "$platform" == "mingw64" ] || [ "$platform" == "mingw32" ]; then
|
||||
MONEROD_EXEC=monerod.exe
|
||||
fi
|
||||
|
||||
# force version update
|
||||
get_tag
|
||||
echo "var GUI_VERSION = \"$TAGNAME\"" > version.js
|
||||
pushd "$MONERO_DIR"
|
||||
get_tag
|
||||
popd
|
||||
echo "var GUI_MONERO_VERSION = \"$TAGNAME\"" >> version.js
|
||||
|
||||
cd build
|
||||
if ! QMAKE=$(find_command qmake qmake-qt5); then
|
||||
echo "Failed to find suitable qmake command."
|
||||
exit 1
|
||||
fi
|
||||
$QMAKE ../monero-wallet-gui.pro "$CONFIG" || exit
|
||||
$MAKE || exit
|
||||
|
||||
# Copy monerod to bin folder
|
||||
if [ "$platform" != "mingw32" ] && [ "$ANDROID" != true ]; then
|
||||
cp ../$MONERO_DIR/bin/$MONEROD_EXEC $BIN_PATH
|
||||
fi
|
||||
|
||||
# make deploy
|
||||
popd
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
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()
|
||||
103
cmake/Deploy.cmake
Normal file
103
cmake/Deploy.cmake
Normal file
@@ -0,0 +1,103 @@
|
||||
if(APPLE OR (WIN32 AND NOT STATIC))
|
||||
add_custom_target(deploy)
|
||||
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
|
||||
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
|
||||
|
||||
if(APPLE AND NOT IOS)
|
||||
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
|
||||
add_custom_command(TARGET deploy
|
||||
POST_BUILD
|
||||
COMMAND "${MACDEPLOYQT_EXECUTABLE}" "$<TARGET_FILE_DIR:monero-wallet-gui>/../.." -always-overwrite -qmldir="${CMAKE_SOURCE_DIR}"
|
||||
COMMENT "Running macdeployqt..."
|
||||
)
|
||||
|
||||
# workaround for a Qt bug that requires manually adding libqsvg.dylib to bundle
|
||||
find_file(_qt_svg_dylib "libqsvg.dylib" PATHS "${CMAKE_PREFIX_PATH}/plugins/imageformats" NO_DEFAULT_PATH)
|
||||
if(_qt_svg_dylib)
|
||||
add_custom_command(TARGET deploy
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${_qt_svg_dylib} $<TARGET_FILE_DIR:monero-wallet-gui>/../PlugIns/imageformats/
|
||||
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtGui.framework/Versions/5/QtGui" "@executable_path/../Frameworks/QtGui.fr amework/Versions/5/QtGui" $<TARGET_FILE_DIR:monero-wallet-gui>/../PlugIns/imageformats/libqsvg.dylib
|
||||
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtWidgets.framework/Versions/5/QtWidgets" "@executable_path/../Frameworks/ QtGui.framework/Versions/5/QtGui" $<TARGET_FILE_DIR:monero-wallet-gui>/../PlugIns/imageformats/libqsvg.dylib
|
||||
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtSvg.framework/Versions/5/QtSvg" "@executable_path/../Frameworks/QtGui.fr amework/Versions/5/QtGui" $<TARGET_FILE_DIR:monero-wallet-gui>/../PlugIns/imageformats/libqsvg.dylib
|
||||
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtCore.framework/Versions/5/QtCore" "@executable_path/../Frameworks/QtGui. framework/Versions/5/QtGui" $<TARGET_FILE_DIR:monero-wallet-gui>/../PlugIns/imageformats/libqsvg.dylib
|
||||
COMMENT "Copying libqsvg.dylib, running install_name_tool"
|
||||
)
|
||||
endif()
|
||||
|
||||
elseif(WIN32)
|
||||
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}")
|
||||
add_custom_command(TARGET monero-wallet-gui POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E env PATH="${_qt_bin_dir}" "${WINDEPLOYQT_EXECUTABLE}" "$<TARGET_FILE:monero-wallet-gui>" -no-translations -qmldir="${CMAKE_SOURCE_DIR}"
|
||||
COMMENT "Running windeployqt..."
|
||||
)
|
||||
set(WIN_DEPLOY_DLLS
|
||||
libboost_chrono-mt.dll
|
||||
libboost_filesystem-mt.dll
|
||||
libboost_locale-mt.dll
|
||||
libboost_program_options-mt.dll
|
||||
libboost_regex-mt.dll
|
||||
libboost_serialization-mt.dll
|
||||
libboost_thread-mt.dll
|
||||
libprotobuf.dll
|
||||
libbrotlicommon.dll
|
||||
libbrotlidec.dll
|
||||
libusb-1.0.dll
|
||||
zlib1.dll
|
||||
libzstd.dll
|
||||
libwinpthread-1.dll
|
||||
libtiff-5.dll
|
||||
libstdc++-6.dll
|
||||
libpng16-16.dll
|
||||
libpcre16-0.dll
|
||||
libpcre-1.dll
|
||||
libmng-2.dll
|
||||
liblzma-5.dll
|
||||
liblcms2-2.dll
|
||||
libjpeg-8.dll
|
||||
libintl-8.dll
|
||||
libiconv-2.dll
|
||||
libharfbuzz-0.dll
|
||||
libgraphite2.dll
|
||||
libglib-2.0-0.dll
|
||||
libfreetype-6.dll
|
||||
libbz2-1.dll
|
||||
libssp-0.dll
|
||||
libpcre2-16-0.dll
|
||||
libhidapi-0.dll
|
||||
libdouble-conversion.dll
|
||||
libgcrypt-20.dll
|
||||
libgpg-error-0.dll
|
||||
libsodium-23.dll
|
||||
libzmq.dll
|
||||
#platform files
|
||||
libgcc_s_seh-1.dll
|
||||
#openssl files
|
||||
libssl-1_1-x64.dll
|
||||
libcrypto-1_1-x64.dll
|
||||
)
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
list(APPEND WIN_DEPLOY_DLLS
|
||||
libicudtd67.dll
|
||||
libicuind67.dll
|
||||
libicuiod67.dll
|
||||
libicutud67.dll
|
||||
libicuucd67.dll
|
||||
)
|
||||
else() # assume release
|
||||
list(APPEND WIN_DEPLOY_DLLS
|
||||
libicudt67.dll
|
||||
libicuin67.dll
|
||||
libicuio67.dll
|
||||
libicutu67.dll
|
||||
libicuuc67.dll
|
||||
)
|
||||
endif()
|
||||
list(TRANSFORM WIN_DEPLOY_DLLS PREPEND "$ENV{MSYSTEM_PREFIX}/bin/")
|
||||
add_custom_command(TARGET deploy
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${WIN_DEPLOY_DLLS} "$<TARGET_FILE_DIR:monero-wallet-gui>"
|
||||
COMMENT "Copying DLLs to target folder"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
1803
cmake/Doxyfile.in
1803
cmake/Doxyfile.in
File diff suppressed because it is too large
Load Diff
@@ -1,14 +0,0 @@
|
||||
/* increase vertical space */
|
||||
#titlearea, #nav-path {
|
||||
display: none;
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
|
||||
/* uncomment these lines for some extra vertical space */
|
||||
|
||||
/*
|
||||
.tablist li {
|
||||
line-height: 26px;
|
||||
}
|
||||
*/
|
||||
@@ -1,98 +0,0 @@
|
||||
# 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)
|
||||
@@ -1,25 +0,0 @@
|
||||
# - 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 )
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
# Copyright (c) 2014-2019, The Monero Project
|
||||
# Copyright (c) 2014-2020, The Monero Project
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other
|
||||
# materials provided with the distribution.
|
||||
#
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software without specific
|
||||
# prior written permission.
|
||||
#
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
@@ -24,17 +25,32 @@
|
||||
# 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.
|
||||
# - Try to find readline include dirs and libraries
|
||||
#
|
||||
# Automatically finds ccache build accelerator, if it's found in PATH.
|
||||
#
|
||||
# Usage of this module as follows:
|
||||
#
|
||||
# project(monero)
|
||||
# include(FindCcache) # Include AFTER the project() macro to be able to reach the CMAKE_CXX_COMPILER variable
|
||||
#
|
||||
# Properties modified by this module:
|
||||
#
|
||||
# GLOBAL PROPERTY RULE_LAUNCH_COMPILE set to ccache, when ccache found
|
||||
# GLOBAL PROPERTY RULE_LAUNCH_LINK set to ccache, when ccache found
|
||||
|
||||
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)
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if (CCACHE_FOUND)
|
||||
set(TEMP_CPP_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test-program.cpp")
|
||||
file(WRITE "${TEMP_CPP_FILE}" "int main() { return 0; }")
|
||||
execute_process(COMMAND "${CCACHE_FOUND}" "${CMAKE_CXX_COMPILER}" "${TEMP_CPP_FILE}" RESULT_VARIABLE RET)
|
||||
if (${RET} EQUAL 0)
|
||||
message("found usable ccache: ${CCACHE_FOUND}")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_FOUND}")
|
||||
else()
|
||||
message("found ccache ${CCACHE_FOUND}, but is UNUSABLE! Return code: ${RET}")
|
||||
endif()
|
||||
else()
|
||||
message("ccache NOT found!")
|
||||
endif()
|
||||
@@ -1,41 +0,0 @@
|
||||
# - 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 )
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
# --------------------------------- 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 ---------------------------------
|
||||
@@ -1,91 +0,0 @@
|
||||
# - 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)
|
||||
|
||||
@@ -9,14 +9,30 @@
|
||||
#
|
||||
|
||||
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 )
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_ZBAR QUIET zbar)
|
||||
if(PC_ZBAR_FOUND)
|
||||
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)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ZBAR_LIBRARIES AND ANDROID)
|
||||
find_library(ZBARJNI_LIBRARY NAMES zbarjni)
|
||||
find_library(ICONV_LIBRARY NAMES iconv)
|
||||
if(ZBARJNI_LIBRARY AND ICONV_LIBRARY)
|
||||
set(ZBAR_LIBRARIES ${ZBARJNI_LIBRARY} ${ICONV_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ZBAR_INCLUDE_DIR)
|
||||
find_path(ZBAR_H_PATH zbar.h)
|
||||
if(ZBAR_H_PATH)
|
||||
set(ZBAR_INCLUDE_DIR "${ZBAR_H_PATH}/zbar")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ZBAR DEFAULT_MSG ZBAR_LIBRARIES ZBAR_INCLUDE_DIR)
|
||||
message(STATUS "Found zbar libraries ${ZBAR_LIBRARIES}")
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
# 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()
|
||||
@@ -28,37 +28,40 @@
|
||||
#
|
||||
# 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)
|
||||
function (git_get_version_tag git directory result_var)
|
||||
execute_process(COMMAND "${git}" rev-parse --short HEAD
|
||||
WORKING_DIRECTORY ${directory}
|
||||
OUTPUT_VARIABLE COMMIT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT COMMIT)
|
||||
message(WARNING "${directory}: cannot determine current commit. Make sure that you are building from a Git working tree")
|
||||
set(${result_var} "unknown" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
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()
|
||||
execute_process(COMMAND "${git}" describe --tags --exact-match
|
||||
WORKING_DIRECTORY ${directory}
|
||||
OUTPUT_VARIABLE TAG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(TAG)
|
||||
message(STATUS "${directory}: building tagged release ${TAG}-${COMMIT}")
|
||||
set(${result_var} "${TAG}-${COMMIT}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
configure_file("src/version.js.in" "${TO}")
|
||||
endif()
|
||||
execute_process(COMMAND "${git}" describe --tags --long
|
||||
WORKING_DIRECTORY ${directory}
|
||||
OUTPUT_VARIABLE MOST_RECENT_TAG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(MOST_RECENT_TAG)
|
||||
message(STATUS "${directory}: ahead of or behind a tagged release, building ${MOST_RECENT_TAG}")
|
||||
set(${result_var} "${MOST_RECENT_TAG}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "${directory}: building ${COMMIT} commit")
|
||||
set(${result_var} "${COMMIT}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -1,81 +0,0 @@
|
||||
# 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")
|
||||
|
||||
@@ -26,9 +26,8 @@
|
||||
# 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")
|
||||
function (write_static_version_header VERSION_TAG_GUI)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/version.js.in" "${CMAKE_CURRENT_SOURCE_DIR}/version.js")
|
||||
endfunction ()
|
||||
|
||||
find_package(Git QUIET)
|
||||
@@ -37,16 +36,14 @@ if ("$Format:$" STREQUAL "")
|
||||
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}")
|
||||
|
||||
include(GitGetVersionTag)
|
||||
git_get_version_tag(${GIT_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} VERSION_TAG_GUI)
|
||||
STRING(REGEX REPLACE "^v([0-9])" "\\1" VERSION_TAG_GUI ${VERSION_TAG_GUI})
|
||||
write_static_version_header(${VERSION_TAG_GUI})
|
||||
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")
|
||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/version.js")
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
syntax = "proto2";
|
||||
|
||||
import "google/protobuf/descriptor.proto";
|
||||
|
||||
message Success {
|
||||
optional string message = 1;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
// 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;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
// 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;
|
||||
}
|
||||
@@ -109,6 +109,7 @@ Item {
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.NoWrap
|
||||
visible: text != ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ Item {
|
||||
|
||||
Connections {
|
||||
target: datePicker
|
||||
onCurrentDateChanged: {
|
||||
function onCurrentDateChanged() {
|
||||
dateInput.setDate(datePicker.currentDate)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
// Copyright (c) 2014-2019, The Monero Project
|
||||
//
|
||||
// Copyright (c) 2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
@@ -26,18 +26,42 @@
|
||||
// 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"
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
google::protobuf::UnknownFieldSet ufs;
|
||||
ufs.ClearAndFreeMemory();
|
||||
import FontAwesome 1.0
|
||||
|
||||
Success sc;
|
||||
sc.set_message("test");
|
||||
sc.SerializeToOstream(&std::cerr);
|
||||
return 0;
|
||||
import "../components" as MoneroComponents
|
||||
|
||||
Item {
|
||||
implicitHeight: layout.height
|
||||
implicitWidth: layout.width
|
||||
|
||||
RowLayout {
|
||||
id: layout
|
||||
opacity: mouseArea.containsMouse ? 1 : 0.85
|
||||
spacing: 10
|
||||
|
||||
MoneroComponents.Label {
|
||||
Layout.bottomMargin: 5
|
||||
fontColor: MoneroComponents.Style.defaultFontColor
|
||||
fontFamily: FontAwesome.fontFamilySolid
|
||||
fontSize: 26
|
||||
styleName: "Solid"
|
||||
text: FontAwesome.language
|
||||
}
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
font.pixelSize: 14
|
||||
text: persistentSettings.language
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
onClicked: appWindow.toggleLanguageView()
|
||||
}
|
||||
}
|
||||
@@ -131,9 +131,9 @@ Drawer {
|
||||
translationManager.setLanguage(locale_spl[0]);
|
||||
|
||||
// set wizard language settings
|
||||
wizard.language_locale = locale;
|
||||
wizard.language_wallet = wallet_language;
|
||||
wizard.language_language = display_name;
|
||||
persistentSettings.locale = locale;
|
||||
persistentSettings.language = display_name;
|
||||
persistentSettings.language_wallet = wallet_language;
|
||||
|
||||
appWindow.showStatusMessage(qsTr("Language changed."), 3);
|
||||
appWindow.toggleLanguageView();
|
||||
|
||||
@@ -204,7 +204,7 @@ Item {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 1
|
||||
color: "transparent"
|
||||
color: item.enabled ? "transparent" : MoneroComponents.Style.inputBoxBackgroundDisabled
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
||||
@@ -39,6 +39,15 @@ Rectangle {
|
||||
property var connected: Wallet.ConnectionStatus_Disconnected
|
||||
|
||||
function getConnectionStatusString(status) {
|
||||
switch (appWindow.daemonStartStopInProgress)
|
||||
{
|
||||
case 1:
|
||||
return qsTr("Starting the node");
|
||||
case 2:
|
||||
return qsTr("Stopping the node");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (status) {
|
||||
case Wallet.ConnectionStatus_Connected:
|
||||
if (!appWindow.daemonSynced)
|
||||
|
||||
@@ -41,10 +41,11 @@ import "../js/Utils.js" as Utils
|
||||
Item {
|
||||
id: root
|
||||
visible: false
|
||||
z: parent.z + 2
|
||||
|
||||
property alias password: passwordInput1.text
|
||||
property string walletName
|
||||
property var okButtonText
|
||||
property string okButtonIcon
|
||||
property string errorText
|
||||
property bool passwordDialogMode
|
||||
property bool passphraseDialogMode
|
||||
@@ -63,7 +64,8 @@ Item {
|
||||
capsLockTextLabel.visible = oshelper.isCapsLock();
|
||||
passwordInput1.reset();
|
||||
passwordInput2.reset();
|
||||
passwordInput1.input.forceActiveFocus();
|
||||
if(!appWindow.currentWallet || appWindow.active)
|
||||
passwordInput1.input.forceActiveFocus();
|
||||
root.walletName = walletName ? walletName : ""
|
||||
errorTextLabel.text = errorText ? errorText : "";
|
||||
leftPanel.enabled = false
|
||||
@@ -75,10 +77,12 @@ Item {
|
||||
appWindow.updateBalance();
|
||||
}
|
||||
|
||||
function open(walletName, errorText) {
|
||||
function open(walletName, errorText, okButtonText, okButtonIcon) {
|
||||
passwordDialogMode = true;
|
||||
passphraseDialogMode = false;
|
||||
newPasswordDialogMode = false;
|
||||
root.okButtonText = okButtonText;
|
||||
root.okButtonIcon = okButtonIcon ? okButtonIcon : "";
|
||||
_openInit(walletName, errorText);
|
||||
}
|
||||
|
||||
@@ -274,6 +278,7 @@ Item {
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
id: cancelButton
|
||||
primary: false
|
||||
small: true
|
||||
text: qsTr("Cancel") + translationManager.emptyString
|
||||
KeyNavigation.tab: passwordInput1
|
||||
@@ -282,8 +287,10 @@ Item {
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
id: okButton
|
||||
fontAwesomeIcon: true
|
||||
rightIcon: okButtonIcon
|
||||
small: true
|
||||
text: qsTr("Ok") + translationManager.emptyString
|
||||
text: okButtonText ? okButtonText : qsTr("Ok") + translationManager.emptyString
|
||||
KeyNavigation.tab: cancelButton
|
||||
enabled: (passwordDialogMode == true) ? true : passwordInput1.text === passwordInput2.text
|
||||
onClicked: onOk()
|
||||
|
||||
@@ -86,9 +86,14 @@ Rectangle {
|
||||
id : finder
|
||||
objectName: "QrFinder"
|
||||
onDecoded : {
|
||||
root.qrcode_decoded(address, payment_id, amount, tx_description, recipient_name, extra_parameters)
|
||||
root.state = "Stopped"
|
||||
}
|
||||
const parsed = walletManager.parse_uri_to_object(data);
|
||||
if (!parsed.error) {
|
||||
root.qrcode_decoded(parsed.address, parsed.payment_id, parsed.amount, parsed.tx_description, parsed.recipient_name, parsed.extra_parameters);
|
||||
root.state = "Stopped";
|
||||
} else {
|
||||
onNotifyError(parsed.error);
|
||||
}
|
||||
}
|
||||
onNotifyError : {
|
||||
if( warning )
|
||||
messageDialog.icon = StandardIcon.Critical
|
||||
|
||||
@@ -43,6 +43,9 @@ GridLayout {
|
||||
property alias daemonAddrLabelText: daemonAddr.labelText
|
||||
property alias daemonPortLabelText: daemonPort.labelText
|
||||
|
||||
property string initialAddress: ""
|
||||
property var initialHostPort: initialAddress.match(/^(.*?)(?:\:?(\d*))$/)
|
||||
|
||||
// TODO: LEGACY; remove these placeHolder variables when
|
||||
// the wizards get redesigned to the black-theme
|
||||
property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name
|
||||
@@ -58,6 +61,9 @@ GridLayout {
|
||||
property bool lineEditFontBold: false
|
||||
property int lineEditFontSize: 15
|
||||
|
||||
// Author: David M. Syzdek https://github.com/syzdek https://gist.github.com/syzdek/6086792
|
||||
readonly property var ipv6Regex: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/
|
||||
|
||||
signal editingFinished()
|
||||
signal textChanged()
|
||||
|
||||
@@ -91,8 +97,12 @@ GridLayout {
|
||||
fontColor: lineEditFontColor
|
||||
fontBold: lineEditFontBold
|
||||
fontSize: lineEditFontSize
|
||||
onEditingFinished: root.editingFinished()
|
||||
onEditingFinished: {
|
||||
text = text.replace(ipv6Regex, "[$1]");
|
||||
root.editingFinished();
|
||||
}
|
||||
onTextChanged: root.textChanged()
|
||||
text: initialHostPort[1]
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
@@ -114,5 +124,6 @@ GridLayout {
|
||||
|
||||
onEditingFinished: root.editingFinished()
|
||||
onTextChanged: root.textChanged()
|
||||
text: initialHostPort[2]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,13 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import FontAwesome 1.0
|
||||
|
||||
import "../components" as MoneroComponents
|
||||
|
||||
Item {
|
||||
id: button
|
||||
property bool fontAwesomeIcon: false
|
||||
property bool primary: true
|
||||
property string rightIcon: ""
|
||||
property string rightIconInactive: ""
|
||||
@@ -135,7 +138,7 @@ Item {
|
||||
}
|
||||
|
||||
Image {
|
||||
visible: button.rightIcon !== ""
|
||||
visible: !fontAwesomeIcon && button.rightIcon !== ""
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
||||
width: button.small ? 16 : 20
|
||||
height: button.small ? 16 : 20
|
||||
@@ -146,6 +149,16 @@ Item {
|
||||
return button.rightIcon;
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
font.family: FontAwesome.fontFamilySolid
|
||||
font.pixelSize: button.small ? 16 : 20
|
||||
font.styleName: "Solid"
|
||||
text: button.rightIcon
|
||||
visible: fontAwesomeIcon && button.rightIcon !== ""
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
||||
191
components/SuccessfulTxDialog.qml
Normal file
191
components/SuccessfulTxDialog.qml
Normal file
@@ -0,0 +1,191 @@
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import moneroComponents.Clipboard 1.0
|
||||
import "../components" as MoneroComponents
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
x: parent.width/2 - root.width/2
|
||||
y: parent.height/2 - root.height/2
|
||||
// TODO: implement without hardcoding sizes
|
||||
width: 580
|
||||
height: 400
|
||||
color: MoneroComponents.Style.blackTheme ? "black" : "white"
|
||||
visible: false
|
||||
radius: 10
|
||||
border.color: MoneroComponents.Style.blackTheme ? Qt.rgba(255, 255, 255, 0.25) : Qt.rgba(0, 0, 0, 0.25)
|
||||
border.width: 1
|
||||
focus: true
|
||||
Keys.enabled: true
|
||||
Keys.onEscapePressed: {
|
||||
root.close()
|
||||
root.rejected()
|
||||
}
|
||||
Keys.onEnterPressed: {
|
||||
root.close()
|
||||
root.accepted()
|
||||
}
|
||||
Keys.onReturnPressed: {
|
||||
root.close()
|
||||
root.accepted()
|
||||
}
|
||||
KeyNavigation.tab: doneButton
|
||||
|
||||
Clipboard { id: clipboard }
|
||||
|
||||
property var transactionID;
|
||||
|
||||
// same signals as Dialog has
|
||||
signal accepted()
|
||||
signal rejected()
|
||||
|
||||
function open(txid) {
|
||||
root.transactionID = txid;
|
||||
root.visible = true;
|
||||
root.forceActiveFocus();
|
||||
}
|
||||
|
||||
function close() {
|
||||
root.visible = false;
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 10
|
||||
anchors.fill: parent
|
||||
anchors.margins: 25
|
||||
|
||||
ColumnLayout{
|
||||
Layout.topMargin: 10
|
||||
Layout.leftMargin: 0
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
|
||||
MoneroComponents.Label {
|
||||
fontSize: 18
|
||||
fontFamily: "Arial"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: {
|
||||
if (appWindow.viewOnly){
|
||||
return qsTr("Transaction file successfully saved!") + translationManager.emptyString;
|
||||
} else {
|
||||
return qsTr("Transaction successfully sent!") + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: successImage
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
width: 140
|
||||
height: 140
|
||||
source: "qrc:///images/success.png"
|
||||
|
||||
SequentialAnimation{
|
||||
running: successImage.visible
|
||||
ScaleAnimator { target: successImage; from: 0.4; to: 1.3; duration: 125}
|
||||
ScaleAnimator { target: successImage; from: 1.3; to: 1; duration: 80}
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.LineEditMulti {
|
||||
visible: !appWindow.viewOnly
|
||||
Layout.leftMargin: 25
|
||||
Layout.rightMargin: 25
|
||||
borderDisabled: true
|
||||
readOnly: true
|
||||
copyButton: true
|
||||
wrapMode: Text.Wrap
|
||||
labelText: qsTr("Transaction ID:") + translationManager.emptyString
|
||||
text: root.transactionID ? root.transactionID : "";
|
||||
fontSize: 16
|
||||
}
|
||||
|
||||
MoneroComponents.LineEditMulti {
|
||||
visible: appWindow.viewOnly
|
||||
Layout.leftMargin: 25
|
||||
borderDisabled: true
|
||||
readOnly: true
|
||||
wrapMode: Text.Wrap
|
||||
labelText: qsTr("Transaction file location:") + translationManager.emptyString
|
||||
text: walletManager.urlToLocalPath(saveTxDialog.fileUrl)
|
||||
fontSize: 16
|
||||
}
|
||||
|
||||
// open folder / done buttons
|
||||
RowLayout {
|
||||
id: buttons
|
||||
spacing: 70
|
||||
Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 50
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
id: openFolderButton
|
||||
visible: appWindow.viewOnly
|
||||
text: qsTr("Open folder") + translationManager.emptyString;
|
||||
width: 200
|
||||
KeyNavigation.tab: doneButton
|
||||
Keys.enabled: openFolderButton.visible
|
||||
Keys.onReturnPressed: openFolderButton.onClicked
|
||||
Keys.onEnterPressed: openFolderButton.onClicked
|
||||
Keys.onEscapePressed: {
|
||||
root.close()
|
||||
root.rejected()
|
||||
}
|
||||
onClicked: {
|
||||
oshelper.openContainingFolder(walletManager.urlToLocalPath(saveTxDialog.fileUrl))
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
id: doneButton
|
||||
text: qsTr("Done") + translationManager.emptyString;
|
||||
width: 200
|
||||
focus: true
|
||||
KeyNavigation.tab: openFolderButton
|
||||
Keys.enabled: doneButton.visible
|
||||
Keys.onReturnPressed: doneButton.onClicked
|
||||
Keys.onEnterPressed: doneButton.onClicked
|
||||
Keys.onEscapePressed: {
|
||||
root.close()
|
||||
root.rejected()
|
||||
}
|
||||
onClicked: {
|
||||
root.close()
|
||||
root.accepted()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
466
components/TxConfirmationDialog.qml
Normal file
466
components/TxConfirmationDialog.qml
Normal file
@@ -0,0 +1,466 @@
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import "../components" as MoneroComponents
|
||||
import FontAwesome 1.0
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
x: parent.width/2 - root.width/2
|
||||
y: parent.height/2 - root.height/2
|
||||
// TODO: implement without hardcoding sizes
|
||||
width: 580
|
||||
height: 400
|
||||
color: MoneroComponents.Style.blackTheme ? "black" : "white"
|
||||
visible: false
|
||||
radius: 10
|
||||
border.color: MoneroComponents.Style.blackTheme ? Qt.rgba(255, 255, 255, 0.25) : Qt.rgba(0, 0, 0, 0.25)
|
||||
border.width: 1
|
||||
focus: true
|
||||
Keys.enabled: true
|
||||
Keys.onEscapePressed: {
|
||||
root.close()
|
||||
root.clearFields()
|
||||
root.rejected()
|
||||
}
|
||||
Keys.onEnterPressed: {
|
||||
if (root.state == "default") {
|
||||
root.close()
|
||||
root.accepted()
|
||||
} else if (root.state == "error") {
|
||||
root.close()
|
||||
root.clearFields()
|
||||
root.rejected()
|
||||
}
|
||||
}
|
||||
Keys.onReturnPressed: {
|
||||
if (root.state == "default") {
|
||||
root.close()
|
||||
root.accepted()
|
||||
} else if (root.state == "error") {
|
||||
root.close()
|
||||
root.clearFields()
|
||||
root.rejected()
|
||||
}
|
||||
}
|
||||
KeyNavigation.tab: confirmButton
|
||||
|
||||
property var transactionAmount: ""
|
||||
property var transactionAddress: ""
|
||||
property var transactionDescription: ""
|
||||
property var transactionFee: ""
|
||||
property var transactionPriority: ""
|
||||
property bool sweepUnmixable: false
|
||||
property alias errorText: errorText
|
||||
property alias confirmButton: confirmButton
|
||||
property alias backButton: backButton
|
||||
property alias bottomText: bottomText
|
||||
property alias bottomTextAnimation: bottomTextAnimation
|
||||
|
||||
state: "default"
|
||||
states: [
|
||||
State {
|
||||
// waiting for user action, show tx details + back and confirm buttons
|
||||
name: "default";
|
||||
when: errorText.text == "" && bottomText.text == ""
|
||||
PropertyChanges { target: errorText; visible: false }
|
||||
PropertyChanges { target: txAmountText; visible: root.transactionAmount !== "(all)" || (root.transactionAmount === "(all)" && currentWallet.isHwBacked() === true) }
|
||||
PropertyChanges { target: txAmountBusyIndicator; visible: !txAmountText.visible }
|
||||
PropertyChanges { target: txFiatAmountText; visible: txAmountText.visible && persistentSettings.fiatPriceEnabled && root.transactionAmount !== "(all)" }
|
||||
PropertyChanges { target: txDetails; visible: true }
|
||||
PropertyChanges { target: bottom; visible: true }
|
||||
PropertyChanges { target: bottomMessage; visible: false }
|
||||
PropertyChanges { target: buttons; visible: true }
|
||||
PropertyChanges { target: backButton; visible: true; primary: false }
|
||||
PropertyChanges { target: confirmButton; visible: true }
|
||||
}, State {
|
||||
// error message being displayed, show only back button
|
||||
name: "error";
|
||||
when: errorText.text !== ""
|
||||
PropertyChanges { target: dialogTitle; text: "Error" }
|
||||
PropertyChanges { target: errorText; visible: true }
|
||||
PropertyChanges { target: txAmountText; visible: false }
|
||||
PropertyChanges { target: txAmountBusyIndicator; visible: false }
|
||||
PropertyChanges { target: txFiatAmountText; visible: false }
|
||||
PropertyChanges { target: txDetails; visible: false }
|
||||
PropertyChanges { target: bottom; visible: true }
|
||||
PropertyChanges { target: bottomMessage; visible: false }
|
||||
PropertyChanges { target: buttons; visible: true }
|
||||
PropertyChanges { target: backButton; visible: true; primary: true }
|
||||
PropertyChanges { target: confirmButton; visible: false }
|
||||
}, State {
|
||||
// creating or sending transaction, show tx details and don't show any button
|
||||
name: "bottomText";
|
||||
when: errorText.text == "" && bottomText.text !== ""
|
||||
PropertyChanges { target: errorText; visible: false }
|
||||
PropertyChanges { target: txAmountText; visible: root.transactionAmount !== "(all)" || (root.transactionAmount === "(all)" && currentWallet.isHwBacked() === true) }
|
||||
PropertyChanges { target: txAmountBusyIndicator; visible: !txAmountText.visible }
|
||||
PropertyChanges { target: txFiatAmountText; visible: txAmountText.visible && persistentSettings.fiatPriceEnabled && root.transactionAmount !== "(all)" }
|
||||
PropertyChanges { target: txDetails; visible: true }
|
||||
PropertyChanges { target: bottom; visible: true }
|
||||
PropertyChanges { target: bottomMessage; visible: true }
|
||||
PropertyChanges { target: buttons; visible: false }
|
||||
}
|
||||
]
|
||||
|
||||
// same signals as Dialog has
|
||||
signal accepted()
|
||||
signal rejected()
|
||||
|
||||
function open() {
|
||||
root.visible = true;
|
||||
|
||||
//clean previous error message
|
||||
errorText.text = "";
|
||||
root.forceActiveFocus()
|
||||
}
|
||||
|
||||
function close() {
|
||||
root.visible = false;
|
||||
}
|
||||
|
||||
function clearFields() {
|
||||
root.transactionAmount = "";
|
||||
root.transactionAddress = "";
|
||||
root.transactionDescription = "";
|
||||
root.transactionFee = "";
|
||||
root.transactionPriority = "";
|
||||
root.sweepUnmixable = false;
|
||||
}
|
||||
|
||||
function showFiatConversion(valueXMR) {
|
||||
const fiatFee = fiatApiConvertToFiat(valueXMR);
|
||||
return "%1 %2".arg(fiatFee < 0.01 ? "<0.01" : "~" + fiatFee).arg(fiatApiCurrencySymbol());
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 10
|
||||
anchors.fill: parent
|
||||
anchors.margins: 25
|
||||
|
||||
RowLayout {
|
||||
Layout.topMargin: 10
|
||||
Layout.fillWidth: true
|
||||
|
||||
MoneroComponents.Label {
|
||||
id: dialogTitle
|
||||
Layout.fillWidth: true
|
||||
fontSize: 18
|
||||
fontFamily: "Arial"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: {
|
||||
if (appWindow.viewOnly) {
|
||||
return qsTr("Create transaction file") + translationManager.emptyString;
|
||||
} else if (root.sweepUnmixable) {
|
||||
return qsTr("Sweep unmixable outputs") + translationManager.emptyString;
|
||||
} else {
|
||||
return qsTr("Confirm send") + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: errorText
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
wrapMode: Text.Wrap
|
||||
font.pixelSize: 15
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 71
|
||||
|
||||
BusyIndicator {
|
||||
id: txAmountBusyIndicator
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment : Qt.AlignTop | Qt.AlignLeft
|
||||
running: root.transactionAmount == "(all)"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: txAmountText
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pixelSize: root.transactionAmount == "(all)" && currentWallet.isHwBacked() === true ? 32 : 42
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
text: {
|
||||
if (root.transactionAmount == "(all)" && currentWallet.isHwBacked() === true) {
|
||||
return qsTr("All unlocked balance") + translationManager.emptyString;
|
||||
} else {
|
||||
return root.transactionAmount + " XMR " + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: txFiatAmountText
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pixelSize: 20
|
||||
color: MoneroComponents.Style.buttonSecondaryTextColor
|
||||
text: showFiatConversion(transactionAmount) + translationManager.emptyString
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
id: txDetails
|
||||
Layout.fillWidth: true
|
||||
columnSpacing: 15
|
||||
rowSpacing: 16
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment : Qt.AlignTop | Qt.AlignLeft
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
color: MoneroComponents.Style.dimmedFontColor
|
||||
text: qsTr("From") + ":" + translationManager.emptyString
|
||||
font.pixelSize: 15
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 16
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
font.pixelSize: 15
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
text: {
|
||||
if (currentWallet) {
|
||||
var walletTitle = function() {
|
||||
if (currentWallet.isLedger()) {
|
||||
return "Ledger";
|
||||
} else if (currentWallet.isTrezor()) {
|
||||
return "Trezor";
|
||||
} else {
|
||||
return qsTr("My wallet");
|
||||
}
|
||||
}
|
||||
var walletName = appWindow.walletName;
|
||||
if (appWindow.currentWallet.numSubaddressAccounts() > 1) {
|
||||
var currentSubaddressAccount = currentWallet.currentSubaddressAccount;
|
||||
var currentAccountLabel = currentWallet.getSubaddressLabel(currentWallet.currentSubaddressAccount, 0);
|
||||
return walletTitle() + " (" + walletName + ")" + "<br>" + qsTr("Account #") + currentSubaddressAccount + (currentAccountLabel !== "" ? " (" + currentAccountLabel + ")" : "") + translationManager.emptyString;
|
||||
} else {
|
||||
return walletTitle() + " (" + walletName + ")" + translationManager.emptyString;
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment : Qt.AlignTop | Qt.AlignLeft
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
font.pixelSize: 15
|
||||
color: MoneroComponents.Style.dimmedFontColor
|
||||
text: qsTr("To") + ":" + translationManager.emptyString
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 16
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
font.pixelSize: 15
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.Wrap
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
text: {
|
||||
if (root.transactionAddress) {
|
||||
const addressBookName = currentWallet ? currentWallet.addressBook.getDescription(root.transactionAddress) : null;
|
||||
var fulladdress = root.transactionAddress;
|
||||
var spacedaddress = fulladdress.match(/.{1,4}/g);
|
||||
var spacedaddress = spacedaddress.join(' ');
|
||||
if (!addressBookName) {
|
||||
return qsTr("Monero address") + "<br>" + spacedaddress + translationManager.emptyString;
|
||||
} else {
|
||||
return FontAwesome.addressBook + " " + addressBookName + "<br>" + spacedaddress;
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment : Qt.AlignTop | Qt.AlignLeft
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
color: MoneroComponents.Style.dimmedFontColor
|
||||
text: qsTr("Fee") + ":" + translationManager.emptyString
|
||||
font.pixelSize: 15
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 16
|
||||
|
||||
Text {
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
font.pixelSize: 15
|
||||
text: {
|
||||
if (currentWallet) {
|
||||
if (!root.transactionFee) {
|
||||
if (currentWallet.isHwBacked() === true) {
|
||||
return qsTr("See on device") + translationManager.emptyString;
|
||||
} else {
|
||||
return qsTr("Calculating fee") + "..." + translationManager.emptyString;
|
||||
}
|
||||
} else {
|
||||
return root.transactionFee + " XMR"
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: 8
|
||||
color: MoneroComponents.Style.buttonSecondaryTextColor
|
||||
visible: persistentSettings.fiatPriceEnabled && root.transactionFee
|
||||
font.pixelSize: 15
|
||||
text: showFiatConversion(root.transactionFee)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: bottom
|
||||
Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
|
||||
RowLayout {
|
||||
id: bottomMessage
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 50
|
||||
|
||||
BusyIndicator {
|
||||
visible: !bottomTextAnimation.running
|
||||
running: !bottomTextAnimation.running
|
||||
scale: .5
|
||||
}
|
||||
|
||||
Text {
|
||||
id: bottomText
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
text: ""
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.Wrap
|
||||
font.pixelSize: 17
|
||||
opacity: 1
|
||||
|
||||
SequentialAnimation{
|
||||
id:bottomTextAnimation
|
||||
running: false
|
||||
loops: Animation.Infinite
|
||||
alwaysRunToEnd: true
|
||||
NumberAnimation { target: bottomText; property: "opacity"; to: 0; duration: 500}
|
||||
NumberAnimation { target: bottomText; property: "opacity"; to: 1; duration: 500}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: buttons
|
||||
spacing: 70
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 50
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
id: backButton
|
||||
text: qsTr("Back") + translationManager.emptyString;
|
||||
width: 200
|
||||
focus: false
|
||||
primary: false
|
||||
KeyNavigation.tab: confirmButton
|
||||
Keys.enabled: backButton.visible
|
||||
Keys.onReturnPressed: backButton.onClicked
|
||||
Keys.onEnterPressed: backButton.onClicked
|
||||
Keys.onEscapePressed: {
|
||||
root.close()
|
||||
root.clearFields()
|
||||
root.rejected()
|
||||
}
|
||||
onClicked: {
|
||||
root.close()
|
||||
root.clearFields()
|
||||
root.rejected()
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
id: confirmButton
|
||||
text: qsTr("Confirm") + translationManager.emptyString;
|
||||
rightIcon: "qrc:///images/rightArrow.png"
|
||||
width: 200
|
||||
focus: false
|
||||
KeyNavigation.tab: backButton
|
||||
Keys.enabled: confirmButton.visible
|
||||
Keys.onReturnPressed: confirmButton.onClicked
|
||||
Keys.onEnterPressed: confirmButton.onClicked
|
||||
Keys.onEscapePressed: {
|
||||
root.close()
|
||||
root.clearFields()
|
||||
root.rejected()
|
||||
}
|
||||
onClicked: {
|
||||
root.close()
|
||||
root.accepted()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,5 +199,6 @@ Popup {
|
||||
|
||||
Downloader {
|
||||
id: downloader
|
||||
proxyAddress: persistentSettings.getProxyAddress()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
android-no-sdk {
|
||||
target.path = /data/user/qt
|
||||
export(target.path)
|
||||
INSTALLS += target
|
||||
} else:android {
|
||||
x86 {
|
||||
target.path = /libs/x86
|
||||
} else: armeabi-v7a {
|
||||
target.path = /libs/armeabi-v7a
|
||||
} else {
|
||||
target.path = /libs/armeabi
|
||||
}
|
||||
export(target.path)
|
||||
INSTALLS += target
|
||||
} else:unix {
|
||||
isEmpty(target.path) {
|
||||
qnx {
|
||||
target.path = /tmp/$${TARGET}/bin
|
||||
} else {
|
||||
target.path = /opt/$${TARGET}/bin
|
||||
}
|
||||
export(target.path)
|
||||
}
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
export(INSTALLS)
|
||||
@@ -1,286 +0,0 @@
|
||||
#!/bin/bash
|
||||
MONERO_URL=https://github.com/monero-project/monero.git
|
||||
MONERO_BRANCH=master
|
||||
|
||||
pushd $(pwd)
|
||||
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source $ROOT_DIR/utils.sh
|
||||
|
||||
INSTALL_DIR=$ROOT_DIR/wallet
|
||||
MONERO_DIR=$ROOT_DIR/monero
|
||||
BUILD_LIBWALLET=false
|
||||
|
||||
# init and update monero submodule
|
||||
if [ ! -d $MONERO_DIR/src ]; then
|
||||
git submodule init monero
|
||||
fi
|
||||
git submodule update --remote
|
||||
git -C $MONERO_DIR fetch
|
||||
git -C $MONERO_DIR checkout v0.16.0.0
|
||||
|
||||
# get monero core tag
|
||||
pushd $MONERO_DIR
|
||||
get_tag
|
||||
popd
|
||||
# create local monero branch
|
||||
git -C $MONERO_DIR checkout -B $VERSIONTAG
|
||||
|
||||
# Merge monero PR dependencies
|
||||
|
||||
# Workaround for git username requirements
|
||||
# Save current user settings and revert back when we are done with merging PR's
|
||||
OLD_GIT_USER=$(git -C $MONERO_DIR config --local user.name)
|
||||
OLD_GIT_EMAIL=$(git -C $MONERO_DIR config --local user.email)
|
||||
git -C $MONERO_DIR config user.name "Monero GUI"
|
||||
git -C $MONERO_DIR config user.email "gui@monero.local"
|
||||
# check for PR requirements in most recent commit message (i.e requires #xxxx)
|
||||
for PR in $(git log --format=%B -n 1 | grep -io "requires #[0-9]*" | sed 's/[^0-9]*//g'); do
|
||||
echo "Merging monero push request #$PR"
|
||||
# fetch pull request and merge
|
||||
git -C $MONERO_DIR fetch origin pull/$PR/head:PR-$PR
|
||||
git -C $MONERO_DIR merge --quiet PR-$PR -m "Merge monero PR #$PR"
|
||||
BUILD_LIBWALLET=true
|
||||
done
|
||||
|
||||
# revert back to old git config
|
||||
$(git -C $MONERO_DIR config user.name "$OLD_GIT_USER")
|
||||
$(git -C $MONERO_DIR config user.email "$OLD_GIT_EMAIL")
|
||||
|
||||
git -C $MONERO_DIR submodule init
|
||||
git -C $MONERO_DIR submodule update
|
||||
|
||||
# Build libwallet if it doesnt exist
|
||||
if [ ! -f $MONERO_DIR/lib/libwallet_merged.a ]; then
|
||||
echo "libwallet_merged.a not found - Building libwallet"
|
||||
BUILD_LIBWALLET=true
|
||||
# Build libwallet if no previous version file exists
|
||||
elif [ ! -f $MONERO_DIR/version.sh ]; then
|
||||
echo "monero/version.h not found - Building libwallet"
|
||||
BUILD_LIBWALLET=true
|
||||
## Compare previously built version with submodule + merged PR's version.
|
||||
else
|
||||
source $MONERO_DIR/version.sh
|
||||
# compare submodule version with latest build
|
||||
pushd "$MONERO_DIR"
|
||||
get_tag
|
||||
popd
|
||||
echo "latest libwallet version: $GUI_MONERO_VERSION"
|
||||
echo "Installed libwallet version: $VERSIONTAG"
|
||||
# check if recent
|
||||
if [ "$VERSIONTAG" != "$GUI_MONERO_VERSION" ]; then
|
||||
echo "Building new libwallet version $GUI_MONERO_VERSION"
|
||||
BUILD_LIBWALLET=true
|
||||
else
|
||||
echo "latest libwallet ($GUI_MONERO_VERSION) is already built. Remove monero/lib/libwallet_merged.a to force rebuild"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$BUILD_LIBWALLET" != true ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "GUI_MONERO_VERSION=\"$VERSIONTAG\"" > $MONERO_DIR/version.sh
|
||||
|
||||
## Continue building libwallet
|
||||
|
||||
# default build type
|
||||
BUILD_TYPE=$1
|
||||
if [ -z $BUILD_TYPE ]; then
|
||||
BUILD_TYPE=release
|
||||
fi
|
||||
|
||||
BUILD_TREZOR_FLAGS=" -DUSE_DEVICE_TREZOR=ON"
|
||||
if [ "$BUILD_TREZOR" == false ]; then
|
||||
BUILD_TREZOR_FLAGS=" -DUSE_DEVICE_TREZOR=OFF"
|
||||
fi
|
||||
BUILD_TREZOR_FLAGS=" -DUSE_DEVICE_TREZOR_UDP_RELEASE=ON ${BUILD_TREZOR_FLAGS}"
|
||||
|
||||
STATIC=false
|
||||
ANDROID=false
|
||||
if [ "$BUILD_TYPE" == "release" ]; then
|
||||
echo "Building libwallet release"
|
||||
CMAKE_BUILD_TYPE=Release
|
||||
elif [ "$BUILD_TYPE" == "release-static" ]; then
|
||||
echo "Building libwallet release-static"
|
||||
CMAKE_BUILD_TYPE=Release
|
||||
STATIC=true
|
||||
elif [ "$BUILD_TYPE" == "release-android" ]; then
|
||||
echo "Building libwallet release-static for ANDROID"
|
||||
CMAKE_BUILD_TYPE=Release
|
||||
STATIC=true
|
||||
ANDROID=true
|
||||
elif [ "$BUILD_TYPE" == "debug-android" ]; then
|
||||
echo "Building libwallet debug-static for ANDROID"
|
||||
CMAKE_BUILD_TYPE=Debug
|
||||
STATIC=true
|
||||
ANDROID=true
|
||||
elif [ "$BUILD_TYPE" == "debug" ]; then
|
||||
echo "Building libwallet debug"
|
||||
CMAKE_BUILD_TYPE=Debug
|
||||
STATIC=true
|
||||
else
|
||||
echo "Valid build types are release, release-static, release-android, debug-android and debug"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
echo "cleaning up existing monero build dir, libs and includes"
|
||||
rm -fr $MONERO_DIR/build
|
||||
rm -fr $MONERO_DIR/lib
|
||||
rm -fr $MONERO_DIR/include
|
||||
rm -fr $MONERO_DIR/bin
|
||||
|
||||
|
||||
mkdir -p $MONERO_DIR/build/$BUILD_TYPE
|
||||
pushd $MONERO_DIR/build/$BUILD_TYPE
|
||||
|
||||
# reusing function from "utils.sh"
|
||||
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="$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 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
|
||||
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="$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="$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 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="$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 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="$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="$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 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 ARCH="$ARCH" -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
fi
|
||||
|
||||
## Windows 64
|
||||
## Windows is always static to work outside msys2
|
||||
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="$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="$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 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 ARCH="$ARCH" -D BUILD_GUI_DEPS=ON $BUILD_TREZOR_FLAGS -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
||||
fi
|
||||
fi
|
||||
|
||||
# set CPU core count
|
||||
# thanks to SO: http://stackoverflow.com/a/20283965/4118915
|
||||
if test -z "$CPU_CORE_COUNT"; then
|
||||
CPU_CORE_COUNT=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu)
|
||||
fi
|
||||
|
||||
# Build libwallet_merged
|
||||
pushd $MONERO_DIR/build/$BUILD_TYPE/src/wallet
|
||||
eval $make_exec version -C ../..
|
||||
eval $make_exec -j$CPU_CORE_COUNT
|
||||
eval $make_exec install -j$CPU_CORE_COUNT
|
||||
popd
|
||||
|
||||
# Build monerod
|
||||
# win32 need to build daemon manually with msys2 toolchain
|
||||
if [ "$platform" != "mingw32" ] && [ "$ANDROID" != true ]; then
|
||||
pushd $MONERO_DIR/build/$BUILD_TYPE/src/daemon
|
||||
eval make -j$CPU_CORE_COUNT
|
||||
eval make install -j$CPU_CORE_COUNT
|
||||
popd
|
||||
fi
|
||||
|
||||
# build install epee
|
||||
eval make -C $MONERO_DIR/build/$BUILD_TYPE/contrib/epee all install
|
||||
|
||||
# install easylogging
|
||||
eval make -C $MONERO_DIR/build/$BUILD_TYPE/external/easylogging++ all install
|
||||
|
||||
# install lmdb
|
||||
eval make -C $MONERO_DIR/build/$BUILD_TYPE/external/db_drivers/liblmdb all install
|
||||
|
||||
# Install libunbound
|
||||
if [ -d $MONERO_DIR/build/$BUILD_TYPE/external/unbound ]; then
|
||||
echo "Installing libunbound..."
|
||||
pushd $MONERO_DIR/build/$BUILD_TYPE/external/unbound
|
||||
# no need to make, it was already built as dependency for libwallet
|
||||
# make -j$CPU_CORE_COUNT
|
||||
$make_exec install -j$CPU_CORE_COUNT
|
||||
popd
|
||||
fi
|
||||
|
||||
# install randomx
|
||||
eval make -C $MONERO_DIR/build/$BUILD_TYPE/external/randomx all install
|
||||
|
||||
popd
|
||||
BIN
images/success.png
Normal file
BIN
images/success.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
BIN
images/success@2x.png
Normal file
BIN
images/success@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -1,4 +1,4 @@
|
||||
; Monero Nitrogen Nebula GUI Wallet Installer for Windows
|
||||
; Monero Oxygen Orion GUI Wallet Installer for Windows
|
||||
; Copyright (c) 2017-2020, The Monero Project
|
||||
; See LICENSE
|
||||
#define GuiVersion GetFileVersion("bin\monero-wallet-gui.exe")
|
||||
@@ -105,6 +105,9 @@ Source: "bin\extras\monero-gen-ssl-cert.exe"; DestDir: "{app}"; Flags: ignorever
|
||||
; Qt Quick 2D Renderer fallback for systems / environments with "low-level graphics" i.e. without 3D support
|
||||
Source: "bin\start-low-graphics-mode.bat"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
; Use a scale factor of 2 for Qt for high-DPI systems, as long as Qt does not handle some such systems adequately
|
||||
Source: "bin\start-high-dpi.bat"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
; Mesa, open-source OpenGL implementation; part of "low-level graphics" support
|
||||
Source: "bin\opengl32sw.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Copyright (c) 2017-2020, The Monero Project
|
||||
|
||||
This is a *Inno Setup* script `Monero.iss` plus some related files
|
||||
that allows you to build a standalone Windows installer (.exe) for
|
||||
the GUI wallet that comes with the Nitrogen Nebula release of Monero.
|
||||
the GUI wallet that comes with the Oxygen Orion release of Monero.
|
||||
|
||||
This turns the GUI wallet into a more or less standard Windows program,
|
||||
by default installed into a subdirectory of `C:\Program Files`, a
|
||||
@@ -18,7 +18,7 @@ Monero.
|
||||
As the setup script in file [Monero.iss](Monero.iss) has to list many
|
||||
files and directories of the GUI wallet package to install by name,
|
||||
this version of the script only works with exactly the GUI wallet
|
||||
for Monero release *Nitrogen Nebula* that you find on
|
||||
for Monero release *Oxygen Orion* that you find on
|
||||
[the official download page](https://getmonero.org/downloads/).
|
||||
|
||||
It should however be easy to modify the script for future
|
||||
@@ -32,15 +32,15 @@ See [LICENSE](LICENSE).
|
||||
|
||||
You can only build on Windows, and the result is always a
|
||||
Windows .exe file that can act as a standalone installer for the
|
||||
Nitrogen Nebula GUI wallet.
|
||||
GUI wallet.
|
||||
|
||||
Note that the installer build process is now reproducible / deterministic. For details check the file [Deterministic.md](Deterministic.md).
|
||||
|
||||
The build steps in detail:
|
||||
|
||||
1. Install *Inno Setup*. You can get it from [here](http://www.jrsoftware.org/isdl.php)
|
||||
2. Get the Inno Setup script plus related files by cloning the whole [monero-gui GitHub repository](https://github.com/monero-project/monero-gui); you will only need the files in the installer directory `installers\windows` however. Depending on development state, additionally instead of simply using `master` you may have to checkout a specific branch, like `release-v0.16`.
|
||||
3. The setup script is written to take the GUI wallet files from a subdirectory named `bin`; so create `installers\windows\bin`, get the zip file of the GUI wallet from [here](https://getmonero.org/downloads/), unpack it somewhere, and copy all the files and subdirectories in the single subdirectory there (currently named `monero-gui-0.16.0.0`) to this `bin` subdirectory
|
||||
2. Get the Inno Setup script plus related files by cloning the whole [monero-gui GitHub repository](https://github.com/monero-project/monero-gui); you will only need the files in the installer directory `installers\windows` however. Depending on development state, additionally instead of simply using `master` you may have to checkout a specific branch, like `release-v0.17`.
|
||||
3. The setup script is written to take the GUI wallet files from a subdirectory named `bin`; so create `installers\windows\bin`, get the zip file of the GUI wallet from [here](https://getmonero.org/downloads/), unpack it somewhere, and copy all the files and subdirectories in the single subdirectory there (currently named `monero-gui-0.17.0.0`) to this `bin` subdirectory
|
||||
4. Start Inno Setup, load `Monero.iss` and compile it
|
||||
5. The result i.e. the finished installer will be the file `mysetup.exe` in the `installers\windows\Output` subdirectory
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Monero Nitrogen Nebula GUI Wallet</title>
|
||||
<title>Monero Oxygen Orion GUI Wallet</title>
|
||||
</head>
|
||||
|
||||
<body style="font-family: Arial, Helvetica, sans-serif">
|
||||
<h1>Monero Nitrogen Nebula GUI Wallet</h1>
|
||||
<h1>Monero Oxygen Orion GUI Wallet</h1>
|
||||
|
||||
<p>Copyright (c) 2014-2020, The Monero Project</p>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<h2>Content of the Package</h2>
|
||||
|
||||
<p>You just installed the <i>Monero GUI wallet</i> for Windows, release Nitrogen Nebula, version {#GuiVersion}.
|
||||
<p>You just installed the <i>Monero GUI wallet</i> for Windows, release Oxygen Orion, version {#GuiVersion}.
|
||||
The wallet enables you to send and receive Moneroj in a secure and very private way.
|
||||
</p>
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 440 KiB After Width: | Height: | Size: 440 KiB |
@@ -1,49 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# 3 header files required by monero are missing from the IOS SDK. I copied them from iphoneSimulator SDK
|
||||
# cd /Applications/XCode.app
|
||||
# sudo cp ./Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sys/vmmeter.h ./Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sys/
|
||||
# sudo cp ./Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/netinet/udp_var.h ./Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/netinet/
|
||||
# sudo cp ./Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/netinet/ip_var.h ./Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/netinet/
|
||||
|
||||
|
||||
if [ -z $BUILD_TYPE ]; then
|
||||
BUILD_TYPE=release
|
||||
fi
|
||||
|
||||
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
if [ -z $BOOST_LIBRARYDIR ]; then
|
||||
BOOST_LIBRARYDIR=${ROOT_DIR}/../ofxiOSBoost/build/ios/prefix/lib
|
||||
fi
|
||||
if [ -z $BOOST_INCLUDEDIR ]; then
|
||||
BOOST_INCLUDEDIR=${ROOT_DIR}/../ofxiOSBoost/build/ios/prefix/include
|
||||
fi
|
||||
if [ -z $OPENSSL_INCLUDE_DIR ]; then
|
||||
OPENSSL_INCLUDE_DIR=${ROOT_DIR}/../openssl/1.0.2j/include
|
||||
fi
|
||||
if [ -z $OPENSSL_ROOT_DIR ]; then
|
||||
OPENSSL_ROOT_DIR=${ROOT_DIR}/../openssl/1.0.2j
|
||||
fi
|
||||
|
||||
echo "Building IOS armv7"
|
||||
rm -r monero/build > /dev/null
|
||||
mkdir -p monero/build/release
|
||||
pushd monero/build/release
|
||||
cmake -D IOS=ON -D ARCH=armv7 -D BOOST_LIBRARYDIR=${BOOST_INCLUDEDIR} -D BOOST_INCLUDEDIR=${BOOST_INCLUDEDIR} -D OPENSSL_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR} -D OPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} -D CMAKE_BUILD_TYPE=debug -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="/Users/jacob/crypto/monero-core/monero" ../..
|
||||
make -j4 && make install
|
||||
popd
|
||||
echo "Building IOS arm64"
|
||||
rm -r monero/build > /dev/null
|
||||
mkdir -p monero/build/release
|
||||
pushd monero/build/release
|
||||
cmake -D IOS=ON -D ARCH=armv8-a -D BOOST_LIBRARYDIR=${BOOST_INCLUDEDIR} -D BOOST_INCLUDEDIR=${BOOST_INCLUDEDIR} -D OPENSSL_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR} -D OPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} -D CMAKE_BUILD_TYPE=debug -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="/Users/jacob/crypto/monero-core/monero" ../..
|
||||
make -j4 && make install
|
||||
popd
|
||||
|
||||
echo "Creating fat library for armv7 and arm64"
|
||||
pushd monero
|
||||
mkdir -p lib-ios
|
||||
lipo -create lib-armv7/libwallet_merged.a lib-arm64/libwallet_merged.a -output lib-ios/libwallet_merged.a
|
||||
lipo -create lib-armv7/libunbound.a lib-arm64/libunbound.a -output lib-ios/libunbound.a
|
||||
lipo -create lib-armv7/libepee.a lib-arm64/libepee.a -output lib-ios/libepee.a
|
||||
popd
|
||||
38
js/Utils.js
38
js/Utils.js
@@ -55,36 +55,14 @@ function ago(epoch) {
|
||||
var now = new Date().getTime() / 1000;
|
||||
var delta = now - epoch;
|
||||
|
||||
if(delta < 60) {
|
||||
if (delta <= 1) {
|
||||
return 1 + " " + qsTr("second ago")
|
||||
} else {
|
||||
return Math.floor(delta) + " " + qsTr("seconds ago")
|
||||
}
|
||||
} else if (delta >= 60 && delta <= 3600) {
|
||||
if(delta >= 60 && delta < 120){
|
||||
return 1 + " " + qsTr("minute ago")
|
||||
} else {
|
||||
return parseInt(Math.floor(delta / 60)) + " " + qsTr("minutes ago")
|
||||
}
|
||||
} else if (delta >= 3600 && delta <= 86400) {
|
||||
if(delta >= 3600 && delta < 7200) {
|
||||
return 1 + " " + qsTr("hour ago")
|
||||
} else {
|
||||
return parseInt(Math.floor(delta / 60 / 60)) + " " + qsTr("hours ago")
|
||||
}
|
||||
} else if (delta >= 86400){
|
||||
if(delta >= 86400 && delta < 172800) {
|
||||
return 1 + " " + qsTr("day ago")
|
||||
} else {
|
||||
var _delta = parseInt(Math.floor(delta / 24 / 60 / 60));
|
||||
if(_delta === 1) {
|
||||
return 1 + " " + qsTr("day ago")
|
||||
} else {
|
||||
return _delta + " " + qsTr("days ago")
|
||||
}
|
||||
}
|
||||
}
|
||||
if(delta < 60)
|
||||
return qsTr("%n second(s) ago", "0", Math.floor(delta))
|
||||
else if (delta >= 60 && delta <= 3600)
|
||||
return qsTr("%n minute(s) ago", "0", Math.floor(delta / 60))
|
||||
else if (delta >= 3600 && delta <= 86400)
|
||||
return qsTr("%n hour(s) ago", "0", Math.floor(delta / 60 / 60))
|
||||
else if (delta >= 86400)
|
||||
return qsTr("%n day(s) ago", "0", Math.floor(delta / 24 / 60 / 60))
|
||||
}
|
||||
|
||||
function netTypeToString(){
|
||||
|
||||
@@ -65,7 +65,7 @@ function createWalletPath(isIOS, folder_path,account_name){
|
||||
return folder_path + "/" + account_name + "/" + account_name
|
||||
}
|
||||
|
||||
function walletPathExists(directory, filename, isIOS, walletManager) {
|
||||
function walletPathExists(accountsDir, directory, filename, isIOS, walletManager) {
|
||||
if(!filename || filename === "") return false;
|
||||
if(!directory || directory === "") return false;
|
||||
|
||||
@@ -76,7 +76,7 @@ function walletPathExists(directory, filename, isIOS, walletManager) {
|
||||
directory += "/"
|
||||
|
||||
if(isIOS)
|
||||
var path = moneroAccountsDir + filename;
|
||||
var path = accountsDir + filename;
|
||||
else
|
||||
var path = directory + filename + "/" + filename;
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
@@ -53,7 +53,6 @@ Lojban
|
||||
<language display_name="Українська" locale="uk_UA" wallet_language="English" flag="/lang/flags/ua.png" qs="none"/>
|
||||
<language display_name="Lietuvių" locale="lt_LT" wallet_language="English" flag="/lang/flags/lt.png" qs="none"/>
|
||||
<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"/> -->
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source $ROOT_DIR/utils.sh
|
||||
|
||||
TARGET=$1
|
||||
|
||||
GUI_EXEC=$2
|
||||
|
||||
platform=$(get_platform)
|
||||
|
||||
if [[ "$platform" == "linux64" ]]; then
|
||||
PLAT_DIR="/usr/lib/x86_64-linux-gnu"
|
||||
elif [[ "$platform" == "linux32" ]]; then
|
||||
PLAT_DIR="/usr/lib/i386-linux-gnu"
|
||||
elif [[ "$platform" == "linuxarmv7" ]]; then
|
||||
PLAT_DIR="/usr/lib/arm-linux-gnueabihf"
|
||||
elif [[ "$platform" == "linuxarmv8" ]]; then
|
||||
PLAT_DIR="/usr/lib/aarch64-linux-gnu"
|
||||
else
|
||||
PLAT_DIR="/usr/lib"
|
||||
fi
|
||||
|
||||
if [ -z "$QT_DIR" ]; then
|
||||
QT_DIR=$PLAT_DIR/qt5
|
||||
fi
|
||||
|
||||
if [ -z "$QTXML_DIR" ]; then
|
||||
QTXML_DIR=$PLAT_DIR
|
||||
fi
|
||||
|
||||
# Copy dependencies
|
||||
EXCLUDE='libstdc++|libgcc_s.so|libc.so|libpthread'
|
||||
INCLUDE='libunbound'
|
||||
cp -rv $QT_DIR/qml $TARGET || exit
|
||||
cp -rv $QT_DIR/plugins $TARGET || exit
|
||||
mkdir -p $TARGET/libs || exit
|
||||
#ldd $TARGET/$GUI_EXEC | grep "=> /" | awk '{print $3}' | grep $INCLUDE | xargs -I '{}' cp -v '{}' $TARGET/libs || exit
|
||||
#ldd $TARGET/$GUI_EXEC | grep "=> /" | awk '{print $3}' | grep -Ev $EXCLUDE | xargs -I '{}' cp -v '{}' $TARGET/libs || exit
|
||||
#ldd $TARGET/plugins/platforms/libqxcb.so| grep "=> /" | awk '{print $3}' | grep -Ev $EXCLUDE | xargs -I '{}' cp -v '{}' $TARGET/libs || exit
|
||||
#cp -v $QTXML_DIR/libQt5XmlPatterns.so.5 $TARGET/libs || exit
|
||||
|
||||
# Create start script
|
||||
cat > $TARGET/start-gui.sh <<EOL
|
||||
#!/bin/bash
|
||||
export LD_LIBRARY_PATH=\`pwd\`/libs
|
||||
export QT_PLUGIN_PATH=\`pwd\`/plugins
|
||||
export QML2_IMPORT_PATH=\`pwd\`/qml
|
||||
# make it so that it can be called from anywhere and also through soft links
|
||||
SCRIPT_DIR="\$(dirname "\$(test -L "\${BASH_SOURCE[0]}" && readlink "\${BASH_SOURCE[0]}" || echo "\${BASH_SOURCE[0]}")")"
|
||||
"\$SCRIPT_DIR"/$GUI_EXEC "\$@"
|
||||
EOL
|
||||
|
||||
# Create start script
|
||||
cat > $TARGET/start-tails.AppImage <<EOL
|
||||
#!/bin/bash
|
||||
# Silly hack to provide a launcher that is double clickable
|
||||
bash ./start-gui.sh
|
||||
EOL
|
||||
|
||||
chmod +x $TARGET/start-gui.sh
|
||||
chmod +x $TARGET/start-tails.AppImage
|
||||
307
main.qml
307
main.qml
@@ -33,7 +33,11 @@ import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
import FontAwesome 1.0
|
||||
|
||||
import moneroComponents.Network 1.0
|
||||
import moneroComponents.Wallet 1.0
|
||||
import moneroComponents.WalletManager 1.0
|
||||
import moneroComponents.PendingTransaction 1.0
|
||||
import moneroComponents.NetworkType 1.0
|
||||
import moneroComponents.Settings 1.0
|
||||
@@ -57,17 +61,17 @@ ApplicationWindow {
|
||||
property bool hideBalanceForced: false
|
||||
property bool ctrlPressed: false
|
||||
property alias persistentSettings : persistentSettings
|
||||
property string accountsDir: !persistentSettings.portable ? moneroAccountsDir : persistentSettings.portableFolderName + "/wallets"
|
||||
property var currentWallet;
|
||||
property bool disconnected: currentWallet ? currentWallet.disconnected : false
|
||||
property var transaction;
|
||||
property var transactionDescription;
|
||||
property var walletPassword
|
||||
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: !persistentSettings.useRemoteNode && !disconnected
|
||||
property bool daemonStartStopInProgress: false
|
||||
property int daemonStartStopInProgress: 0
|
||||
property alias toolTip: toolTip
|
||||
property string walletName
|
||||
property bool viewOnly: false
|
||||
@@ -229,12 +233,6 @@ ApplicationWindow {
|
||||
else
|
||||
walletManager.setLogLevel(persistentSettings.logLevel)
|
||||
|
||||
// setup language
|
||||
var locale = persistentSettings.locale
|
||||
if (locale !== "") {
|
||||
translationManager.setLanguage(locale.split("_")[0]);
|
||||
}
|
||||
|
||||
// Reload transfer page with translations enabled
|
||||
middlePanel.transferView.onPageCompleted();
|
||||
|
||||
@@ -257,7 +255,7 @@ ApplicationWindow {
|
||||
// wallet already opened with wizard, we just need to initialize it
|
||||
var wallet_path = persistentSettings.wallet_path;
|
||||
if(isIOS)
|
||||
wallet_path = moneroAccountsDir + wallet_path;
|
||||
wallet_path = appWindow.accountsDir + 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");
|
||||
|
||||
@@ -363,6 +361,7 @@ ApplicationWindow {
|
||||
currentWallet.deviceButtonPressed.connect(onDeviceButtonPressed);
|
||||
currentWallet.walletPassphraseNeeded.connect(onWalletPassphraseNeededWallet);
|
||||
currentWallet.transactionCommitted.connect(onTransactionCommitted);
|
||||
currentWallet.proxyAddress = Qt.binding(persistentSettings.getWalletProxyAddress);
|
||||
middlePanel.paymentClicked.connect(handlePayment);
|
||||
middlePanel.sweepUnmixableClicked.connect(handleSweepUnmixable);
|
||||
middlePanel.getProofClicked.connect(handleGetProof);
|
||||
@@ -387,7 +386,9 @@ ApplicationWindow {
|
||||
0,
|
||||
persistentSettings.is_recovering,
|
||||
persistentSettings.is_recovering_from_device,
|
||||
persistentSettings.restore_height);
|
||||
persistentSettings.restore_height,
|
||||
persistentSettings.getWalletProxyAddress());
|
||||
|
||||
// save wallet keys in case wallet settings have been changed in the init
|
||||
currentWallet.setPassword(walletPassword);
|
||||
}
|
||||
@@ -428,6 +429,10 @@ ApplicationWindow {
|
||||
leftPanel.minutesToUnlock = (balance !== balanceU) ? currentWallet.history.minutesToUnlock : "";
|
||||
leftPanel.balanceString = balance
|
||||
leftPanel.balanceUnlockedString = balanceU
|
||||
if (middlePanel.state === "Account") {
|
||||
middlePanel.accountView.balanceAllText = walletManager.displayAmount(appWindow.currentWallet.balanceAll());
|
||||
middlePanel.accountView.unlockedBalanceAllText = walletManager.displayAmount(appWindow.currentWallet.unlockedBalanceAll());
|
||||
}
|
||||
}
|
||||
|
||||
function onUriHandler(uri){
|
||||
@@ -496,16 +501,30 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
function onDeviceButtonRequest(code){
|
||||
prevSplashText = splash.messageText;
|
||||
splashDisplayedBeforeButtonRequest = splash.visible;
|
||||
appWindow.showProcessingSplash(qsTr("Please proceed to the device..."));
|
||||
if (txConfirmationPopup.visible) {
|
||||
txConfirmationPopup.bottomTextAnimation.running = true
|
||||
if (!txConfirmationPopup.errorText.visible) {
|
||||
txConfirmationPopup.bottomText.text = qsTr("Please confirm transaction on the device...") + translationManager.emptyString;
|
||||
} else {
|
||||
txConfirmationPopup.bottomText.text = qsTr("Please proceed to the device...") + translationManager.emptyString;
|
||||
}
|
||||
} else {
|
||||
prevSplashText = splash.messageText;
|
||||
splashDisplayedBeforeButtonRequest = splash.visible;
|
||||
appWindow.showProcessingSplash(qsTr("Please proceed to the device..."));
|
||||
}
|
||||
}
|
||||
|
||||
function onDeviceButtonPressed(){
|
||||
if (splashDisplayedBeforeButtonRequest){
|
||||
appWindow.showProcessingSplash(prevSplashText);
|
||||
if (txConfirmationPopup.visible) {
|
||||
txConfirmationPopup.bottomTextAnimation.running = false;
|
||||
txConfirmationPopup.bottomText.text = qsTr("Signing transaction in the device...") + translationManager.emptyString;
|
||||
} else {
|
||||
hideProcessingSplash();
|
||||
if (splashDisplayedBeforeButtonRequest){
|
||||
appWindow.showProcessingSplash(prevSplashText);
|
||||
} else {
|
||||
hideProcessingSplash();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -605,7 +624,14 @@ ApplicationWindow {
|
||||
const callback = function() {
|
||||
persistentSettings.useRemoteNode = true;
|
||||
currentDaemonAddress = persistentSettings.remoteNodeAddress;
|
||||
currentWallet.initAsync(currentDaemonAddress, isTrustedDaemon());
|
||||
currentWallet.initAsync(
|
||||
currentDaemonAddress,
|
||||
isTrustedDaemon(),
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
persistentSettings.getWalletProxyAddress());
|
||||
walletManager.setDaemonAddressAsync(currentDaemonAddress);
|
||||
};
|
||||
|
||||
@@ -623,7 +649,14 @@ ApplicationWindow {
|
||||
console.log("disconnecting remote node");
|
||||
persistentSettings.useRemoteNode = false;
|
||||
currentDaemonAddress = localDaemonAddress
|
||||
currentWallet.initAsync(currentDaemonAddress, isTrustedDaemon());
|
||||
currentWallet.initAsync(
|
||||
currentDaemonAddress,
|
||||
isTrustedDaemon(),
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
persistentSettings.getWalletProxyAddress());
|
||||
walletManager.setDaemonAddressAsync(currentDaemonAddress);
|
||||
firstBlockSeen = 0;
|
||||
}
|
||||
@@ -681,31 +714,33 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
function startDaemon(flags){
|
||||
daemonStartStopInProgress = true;
|
||||
daemonStartStopInProgress = 1;
|
||||
|
||||
// Pause refresh while starting daemon
|
||||
currentWallet.pauseRefresh();
|
||||
|
||||
appWindow.showProcessingSplash(qsTr("Waiting for daemon to start..."))
|
||||
const noSync = appWindow.walletMode === 0;
|
||||
const bootstrapNodeAddress = persistentSettings.walletMode < 2 ? "auto" : persistentSettings.bootstrapNodeAddress
|
||||
daemonManager.start(flags, persistentSettings.nettype, persistentSettings.blockchainDataDir, bootstrapNodeAddress, noSync);
|
||||
}
|
||||
|
||||
function stopDaemon(callback){
|
||||
daemonStartStopInProgress = true;
|
||||
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop..."))
|
||||
function stopDaemon(callback, splash){
|
||||
daemonStartStopInProgress = 2;
|
||||
if (splash) {
|
||||
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop..."));
|
||||
}
|
||||
daemonManager.stopAsync(persistentSettings.nettype, function(result) {
|
||||
daemonStartStopInProgress = false;
|
||||
hideProcessingSplash();
|
||||
daemonStartStopInProgress = 0;
|
||||
if (splash) {
|
||||
hideProcessingSplash();
|
||||
}
|
||||
callback(result);
|
||||
});
|
||||
}
|
||||
|
||||
function onDaemonStarted(){
|
||||
console.log("daemon started");
|
||||
daemonStartStopInProgress = false;
|
||||
hideProcessingSplash();
|
||||
daemonStartStopInProgress = 0;
|
||||
currentWallet.connected(true);
|
||||
// resume refresh
|
||||
currentWallet.startRefresh();
|
||||
@@ -718,8 +753,7 @@ ApplicationWindow {
|
||||
|
||||
function onDaemonStartFailure(error) {
|
||||
console.log("daemon start failed");
|
||||
daemonStartStopInProgress = false;
|
||||
hideProcessingSplash();
|
||||
daemonStartStopInProgress = 0;
|
||||
// resume refresh
|
||||
currentWallet.startRefresh();
|
||||
informationPopup.title = qsTr("Daemon failed to start") + translationManager.emptyString;
|
||||
@@ -776,7 +810,7 @@ ApplicationWindow {
|
||||
function walletsFound() {
|
||||
if (persistentSettings.wallet_path.length > 0) {
|
||||
if(isIOS)
|
||||
return walletManager.walletExists(moneroAccountsDir + persistentSettings.wallet_path);
|
||||
return walletManager.walletExists(appWindow.accountsDir + persistentSettings.wallet_path);
|
||||
else
|
||||
return walletManager.walletExists(persistentSettings.wallet_path);
|
||||
}
|
||||
@@ -785,51 +819,33 @@ ApplicationWindow {
|
||||
|
||||
function onTransactionCreated(pendingTransaction,address,paymentId,mixinCount){
|
||||
console.log("Transaction created");
|
||||
hideProcessingSplash();
|
||||
txConfirmationPopup.bottomText.text = "";
|
||||
transaction = pendingTransaction;
|
||||
// validate address;
|
||||
if (transaction.status !== PendingTransaction.Status_Ok) {
|
||||
console.error("Can't create transaction: ", transaction.errorString);
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||
if (currentWallet.connected() == Wallet.ConnectionStatus_WrongVersion)
|
||||
informationPopup.text = qsTr("Can't create transaction: Wrong daemon version: ") + transaction.errorString
|
||||
else
|
||||
informationPopup.text = qsTr("Can't create transaction: ") + transaction.errorString
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open();
|
||||
if (currentWallet.connected() == Wallet.ConnectionStatus_WrongVersion) {
|
||||
txConfirmationPopup.errorText.text = qsTr("Can't create transaction: Wrong daemon version: ") + transaction.errorString
|
||||
} else {
|
||||
txConfirmationPopup.errorText.text = qsTr("Can't create transaction: ") + transaction.errorString
|
||||
}
|
||||
// deleting transaction object, we don't want memleaks
|
||||
currentWallet.disposeTransaction(transaction);
|
||||
|
||||
} else if (transaction.txCount == 0) {
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString
|
||||
informationPopup.text = qsTr("No unmixable outputs to sweep") + translationManager.emptyString
|
||||
informationPopup.icon = StandardIcon.Information
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open()
|
||||
console.error("Can't create transaction: ", transaction.errorString);
|
||||
txConfirmationPopup.errorText.text = qsTr("No unmixable outputs to sweep") + translationManager.emptyString
|
||||
// deleting transaction object, we don't want memleaks
|
||||
currentWallet.disposeTransaction(transaction);
|
||||
} else {
|
||||
console.log("Transaction created, amount: " + walletManager.displayAmount(transaction.amount)
|
||||
+ ", fee: " + walletManager.displayAmount(transaction.fee));
|
||||
|
||||
// here we show confirmation popup;
|
||||
transactionConfirmationPopup.title = qsTr("Please confirm transaction:\n") + translationManager.emptyString;
|
||||
transactionConfirmationPopup.text = "";
|
||||
transactionConfirmationPopup.text += (address === "" ? "" : (qsTr("Address: ") + address));
|
||||
transactionConfirmationPopup.text += (paymentId === "" ? "" : (qsTr("\nPayment ID: ") + paymentId));
|
||||
transactionConfirmationPopup.text += qsTr("\n\nAmount: ") + walletManager.displayAmount(transaction.amount);
|
||||
transactionConfirmationPopup.text += qsTr("\nFee: ") + walletManager.displayAmount(transaction.fee);
|
||||
transactionConfirmationPopup.text += qsTr("\nRingsize: ") + (mixinCount + 1);
|
||||
transactionConfirmationPopup.text += qsTr("\n\nNumber of transactions: ") + transaction.txCount
|
||||
transactionConfirmationPopup.text += (transactionDescription === "" ? "" : (qsTr("\nDescription: ") + transactionDescription))
|
||||
for (var i = 0; i < transaction.subaddrIndices.length; ++i){
|
||||
transactionConfirmationPopup.text += qsTr("\nSpending address index: ") + transaction.subaddrIndices[i];
|
||||
}
|
||||
|
||||
transactionConfirmationPopup.text += translationManager.emptyString;
|
||||
transactionConfirmationPopup.icon = StandardIcon.Question
|
||||
transactionConfirmationPopup.open()
|
||||
// here we update txConfirmationPopup
|
||||
txConfirmationPopup.transactionAmount = Utils.removeTrailingZeros(walletManager.displayAmount(transaction.amount));
|
||||
txConfirmationPopup.transactionFee = Utils.removeTrailingZeros(walletManager.displayAmount(transaction.fee));
|
||||
txConfirmationPopup.confirmButton.text = viewOnly ? qsTr("Save as file") : qsTr("Confirm") + translationManager.emptyString;
|
||||
txConfirmationPopup.confirmButton.rightIcon = viewOnly ? "" : "qrc:///images/rightArrow.png"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,12 +859,12 @@ ApplicationWindow {
|
||||
", mixins: ", mixinCount,
|
||||
", priority: ", priority,
|
||||
", description: ", description);
|
||||
|
||||
var splashMsg = qsTr("Creating transaction...");
|
||||
splashMsg += appWindow.currentWallet.isLedger() ? qsTr("\n\nPlease check your hardware wallet –\nyour input may be required.") : "";
|
||||
showProcessingSplash(splashMsg);
|
||||
|
||||
transactionDescription = description;
|
||||
txConfirmationPopup.bottomTextAnimation.running = false
|
||||
txConfirmationPopup.bottomText.text = qsTr("Creating transaction...") + translationManager.emptyString;
|
||||
txConfirmationPopup.transactionAddress = address;
|
||||
txConfirmationPopup.transactionAmount = Utils.removeTrailingZeros(amount);
|
||||
txConfirmationPopup.transactionPriority = priority;
|
||||
txConfirmationPopup.transactionDescription = description;
|
||||
|
||||
// validate amount;
|
||||
if (amount !== "(all)") {
|
||||
@@ -856,31 +872,21 @@ ApplicationWindow {
|
||||
console.log("integer amount: ", amountxmr);
|
||||
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.displayAmount(currentWallet.unlockedBalance()))
|
||||
+ translationManager.emptyString
|
||||
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open()
|
||||
txConfirmationPopup.errorText.text = qsTr("Amount is wrong: expected number from %1 to %2")
|
||||
.arg(walletManager.displayAmount(0))
|
||||
.arg(walletManager.displayAmount(currentWallet.unlockedBalance()))
|
||||
+ translationManager.emptyString;
|
||||
return;
|
||||
} 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()))
|
||||
+ translationManager.emptyString
|
||||
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open()
|
||||
txConfirmationPopup.errorText.text = qsTr("Insufficient funds. Unlocked balance: %1")
|
||||
.arg(walletManager.displayAmount(currentWallet.unlockedBalance()))
|
||||
+ translationManager.emptyString;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
txConfirmationPopup.open();
|
||||
|
||||
if (amount === "(all)")
|
||||
currentWallet.createTransactionAllAsync(address, paymentId, mixinCount, priority);
|
||||
else
|
||||
@@ -891,7 +897,7 @@ ApplicationWindow {
|
||||
FileDialog {
|
||||
id: saveTxDialog
|
||||
title: "Please choose a location"
|
||||
folder: "file://" +moneroAccountsDir
|
||||
folder: "file://" + appWindow.accountsDir
|
||||
selectExisting: false;
|
||||
|
||||
onAccepted: {
|
||||
@@ -908,40 +914,27 @@ ApplicationWindow {
|
||||
function handleSweepUnmixable() {
|
||||
console.log("Creating transaction: ")
|
||||
|
||||
txConfirmationPopup.sweepUnmixable = true;
|
||||
transaction = currentWallet.createSweepUnmixableTransaction();
|
||||
if (transaction.status !== PendingTransaction.Status_Ok) {
|
||||
console.error("Can't create transaction: ", transaction.errorString);
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||
informationPopup.text = qsTr("Can't create transaction: ") + transaction.errorString
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open();
|
||||
txConfirmationPopup.errorText.text = qsTr("Can't create transaction: ") + transaction.errorString + translationManager.emptyString
|
||||
// deleting transaction object, we don't want memleaks
|
||||
currentWallet.disposeTransaction(transaction);
|
||||
|
||||
} else if (transaction.txCount == 0) {
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString
|
||||
informationPopup.text = qsTr("No unmixable outputs to sweep") + translationManager.emptyString
|
||||
informationPopup.icon = StandardIcon.Information
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open()
|
||||
console.error("No unmixable outputs to sweep");
|
||||
txConfirmationPopup.errorText.text = qsTr("No unmixable outputs to sweep") + translationManager.emptyString
|
||||
// deleting transaction object, we don't want memleaks
|
||||
currentWallet.disposeTransaction(transaction);
|
||||
} else {
|
||||
console.log("Transaction created, amount: " + walletManager.displayAmount(transaction.amount)
|
||||
+ ", fee: " + walletManager.displayAmount(transaction.fee));
|
||||
|
||||
// here we show confirmation popup;
|
||||
|
||||
transactionConfirmationPopup.title = qsTr("Confirmation") + translationManager.emptyString
|
||||
transactionConfirmationPopup.text = qsTr("Please confirm transaction:\n")
|
||||
+ qsTr("\n\nAmount: ") + walletManager.displayAmount(transaction.amount)
|
||||
+ qsTr("\nFee: ") + walletManager.displayAmount(transaction.fee)
|
||||
+ translationManager.emptyString
|
||||
transactionConfirmationPopup.icon = StandardIcon.Question
|
||||
transactionConfirmationPopup.open()
|
||||
txConfirmationPopup.transactionAmount = Utils.removeTrailingZeros(walletManager.displayAmount(transaction.amount));
|
||||
txConfirmationPopup.transactionFee = Utils.removeTrailingZeros(walletManager.displayAmount(transaction.fee));
|
||||
// committing transaction
|
||||
}
|
||||
txConfirmationPopup.open();
|
||||
}
|
||||
|
||||
// called after user confirms transaction
|
||||
@@ -959,39 +952,28 @@ ApplicationWindow {
|
||||
// Store to file
|
||||
transaction.setFilename(path);
|
||||
}
|
||||
|
||||
appWindow.showProcessingSplash(qsTr("Sending transaction ..."));
|
||||
currentWallet.commitTransactionAsync(transaction);
|
||||
}
|
||||
|
||||
function onTransactionCommitted(success, transaction, txid) {
|
||||
hideProcessingSplash();
|
||||
if (!success) {
|
||||
console.log("Error committing transaction: " + transaction.errorString);
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString
|
||||
informationPopup.text = qsTr("Couldn't send the money: ") + transaction.errorString
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.onCloseCallback = null;
|
||||
informationPopup.open();
|
||||
} else {
|
||||
var txid_text = ""
|
||||
informationPopup.title = qsTr("Information") + translationManager.emptyString
|
||||
for (var i = 0; i < txid.length; ++i) {
|
||||
if (txid_text.length > 0)
|
||||
txid_text += ", "
|
||||
txid_text += txid[i]
|
||||
}
|
||||
informationPopup.text = (viewOnly)? qsTr("Transaction saved to file: %1").arg(path) : qsTr("Monero sent successfully: %1 transaction(s) ").arg(txid.length) + txid_text + translationManager.emptyString
|
||||
informationPopup.icon = StandardIcon.Information
|
||||
if (transactionDescription.length > 0) {
|
||||
if (txConfirmationPopup.transactionDescription.length > 0) {
|
||||
for (var i = 0; i < txid.length; ++i)
|
||||
currentWallet.setUserNote(txid[i], transactionDescription);
|
||||
currentWallet.setUserNote(txid[i], txConfirmationPopup.transactionDescription);
|
||||
}
|
||||
|
||||
// Clear tx fields
|
||||
middlePanel.transferView.clearFields()
|
||||
|
||||
txConfirmationPopup.clearFields()
|
||||
successfulTxPopup.open(txid)
|
||||
}
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open()
|
||||
currentWallet.refresh()
|
||||
currentWallet.disposeTransaction(transaction)
|
||||
currentWallet.storeAsync(function(success) {
|
||||
@@ -1254,7 +1236,7 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
var url = provider[userCurrency];
|
||||
Network.getJSON(url, fiatApiJsonReceived);
|
||||
network.getJSON(url, fiatApiJsonReceived);
|
||||
}
|
||||
|
||||
function fiatApiCurrencySymbol() {
|
||||
@@ -1272,7 +1254,7 @@ ApplicationWindow {
|
||||
function fiatApiConvertToFiat(amount) {
|
||||
var ticker = persistentSettings.fiatPriceCurrency === "xmrusd" ? appWindow.fiatPriceXMRUSD : appWindow.fiatPriceXMREUR;
|
||||
if(ticker <= 0){
|
||||
console.log(fiatApiError("Invalid ticker value: " + ticker));
|
||||
fiatApiError("Invalid ticker value: " + ticker);
|
||||
return "?.??";
|
||||
}
|
||||
return (amount * ticker).toFixed(2);
|
||||
@@ -1303,6 +1285,8 @@ ApplicationWindow {
|
||||
x = (Screen.width - width) / 2
|
||||
y = (Screen.height - maxWindowHeight) / 2
|
||||
|
||||
translationManager.setLanguage(persistentSettings.locale.split("_")[0]);
|
||||
|
||||
applyWalletMode(persistentSettings.walletMode);
|
||||
|
||||
//
|
||||
@@ -1340,6 +1324,7 @@ ApplicationWindow {
|
||||
} else {
|
||||
wizard.wizardState = "wizardHome";
|
||||
rootItem.state = "normal"
|
||||
logger.resetLogFilePath(persistentSettings.portable);
|
||||
openWallet("wizard");
|
||||
}
|
||||
|
||||
@@ -1357,8 +1342,9 @@ ApplicationWindow {
|
||||
return "";
|
||||
}
|
||||
|
||||
property string language
|
||||
property string locale
|
||||
property string language: 'English (US)'
|
||||
property string language_wallet: 'English'
|
||||
property string locale: 'en_US'
|
||||
property string account_name
|
||||
property string wallet_path
|
||||
property bool allow_background_mining : false
|
||||
@@ -1401,6 +1387,25 @@ ApplicationWindow {
|
||||
property string fiatPriceProvider: "kraken"
|
||||
property string fiatPriceCurrency: "xmrusd"
|
||||
|
||||
property string proxyAddress: "127.0.0.1:9050"
|
||||
property bool proxyEnabled: isTails
|
||||
function getProxyAddress() {
|
||||
if ((socksProxyFlagSet && socksProxyFlag == "") || !proxyEnabled) {
|
||||
return "";
|
||||
}
|
||||
var proxyAddressSetOrForced = socksProxyFlagSet ? socksProxyFlag : proxyAddress;
|
||||
if (proxyAddressSetOrForced == "") {
|
||||
return "127.0.0.1:0";
|
||||
}
|
||||
return proxyAddressSetOrForced;
|
||||
}
|
||||
function getWalletProxyAddress() {
|
||||
if (!useRemoteNode) {
|
||||
return "";
|
||||
}
|
||||
return getProxyAddress();
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
MoneroComponents.Style.blackTheme = persistentSettings.blackTheme
|
||||
}
|
||||
@@ -1421,10 +1426,11 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
// Confrirmation aka question dialog
|
||||
StandardDialog {
|
||||
// Transaction confirmation popup
|
||||
TxConfirmationDialog {
|
||||
// dynamically change onclose handler
|
||||
id: txConfirmationPopup
|
||||
z: parent.z + 1
|
||||
id: transactionConfirmationPopup
|
||||
onAccepted: {
|
||||
var handleAccepted = function() {
|
||||
// Save transaction to file if view only wallet
|
||||
@@ -1446,11 +1452,21 @@ ApplicationWindow {
|
||||
if(!persistentSettings.askPasswordBeforeSending) {
|
||||
handleAccepted()
|
||||
} else {
|
||||
passwordDialog.open()
|
||||
passwordDialog.open(
|
||||
"",
|
||||
"",
|
||||
(appWindow.viewOnly ? qsTr("Save transaction file") : qsTr("Send transaction")) + translationManager.emptyString,
|
||||
appWindow.viewOnly ? "" : FontAwesome.arrowCircleRight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Transaction successfully sent popup
|
||||
SuccessfulTxDialog {
|
||||
id: successfulTxPopup
|
||||
z: parent.z + 1
|
||||
}
|
||||
|
||||
StandardDialog {
|
||||
z: parent.z + 1
|
||||
id: confirmationDialog
|
||||
@@ -1523,7 +1539,7 @@ ApplicationWindow {
|
||||
PasswordDialog {
|
||||
id: passwordDialog
|
||||
visible: false
|
||||
z: parent.z + 1
|
||||
z: parent.z + 2
|
||||
anchors.fill: parent
|
||||
property var onAcceptedCallback
|
||||
property var onRejectedCallback
|
||||
@@ -1720,7 +1736,7 @@ ApplicationWindow {
|
||||
anchors.fill: blurredArea
|
||||
source: blurredArea
|
||||
radius: 64
|
||||
visible: passwordDialog.visible || inputDialog.visible || splash.visible || updateDialog.visible || devicePassphraseDialog.visible
|
||||
visible: passwordDialog.visible || inputDialog.visible || splash.visible || updateDialog.visible || devicePassphraseDialog.visible || txConfirmationPopup.visible || successfulTxPopup.visible
|
||||
}
|
||||
|
||||
|
||||
@@ -1826,11 +1842,6 @@ ApplicationWindow {
|
||||
function toggleLanguageView(){
|
||||
languageSidebar.isOpened ? languageSidebar.close() : languageSidebar.open();
|
||||
resetLanguageFields()
|
||||
// update after changing language from settings page
|
||||
if (persistentSettings.language != wizard.language_language) {
|
||||
persistentSettings.language = wizard.language_language
|
||||
persistentSettings.locale = wizard.language_locale
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
@@ -1839,7 +1850,7 @@ ApplicationWindow {
|
||||
repeat: true
|
||||
running: persistentSettings.autosave
|
||||
onTriggered: {
|
||||
if (currentWallet) {
|
||||
if (currentWallet && !currentWallet.refreshing) {
|
||||
currentWallet.storeAsync(function(success) {
|
||||
if (success) {
|
||||
appWindow.showStatusMessage(qsTr("Autosaved the wallet"), 3);
|
||||
@@ -1918,7 +1929,7 @@ ApplicationWindow {
|
||||
// Simple mode connection check timer
|
||||
id: simpleModeConnectionTimer
|
||||
interval: 2000
|
||||
running: appWindow.walletMode < 2 && currentWallet != undefined && !daemonStartStopInProgress
|
||||
running: appWindow.walletMode < 2 && currentWallet != undefined && daemonStartStopInProgress == 0
|
||||
repeat: true
|
||||
onTriggered: appWindow.checkSimpleModeConnection()
|
||||
}
|
||||
@@ -1996,7 +2007,7 @@ ApplicationWindow {
|
||||
if(daemonManager == undefined || persistentSettings.useRemoteNode) {
|
||||
closeAccepted();
|
||||
} else if (appWindow.walletMode == 0) {
|
||||
stopDaemon(closeAccepted);
|
||||
stopDaemon(closeAccepted, true);
|
||||
} else {
|
||||
showProcessingSplash(qsTr("Checking local node status..."));
|
||||
const handler = function(running) {
|
||||
@@ -2139,7 +2150,7 @@ ApplicationWindow {
|
||||
if (mode < 2) {
|
||||
persistentSettings.useRemoteNode = false;
|
||||
|
||||
if (middlePanel.settingsView.settingsStateViewState === "Node" || middlePanel.settingsView.settingsStateViewState === "Log") {
|
||||
if (middlePanel.settingsView.settingsStateViewState === "Node") {
|
||||
middlePanel.settingsView.settingsStateViewState = "Wallet"
|
||||
}
|
||||
}
|
||||
@@ -2235,4 +2246,14 @@ ApplicationWindow {
|
||||
id: languageSidebar
|
||||
dragMargin: 0
|
||||
}
|
||||
|
||||
Network {
|
||||
id: network
|
||||
proxyAddress: persistentSettings.getProxyAddress()
|
||||
}
|
||||
|
||||
WalletManager {
|
||||
id: walletManager
|
||||
proxyAddress: persistentSettings.getProxyAddress()
|
||||
}
|
||||
}
|
||||
|
||||
2
monero
2
monero
Submodule monero updated: ab594cfee9...3942a1cd04
@@ -1,574 +0,0 @@
|
||||
# qml components require at least QT 5.9.7
|
||||
lessThan (QT_MAJOR_VERSION, 5) | lessThan (QT_MINOR_VERSION, 9) {
|
||||
error("Can't build with Qt $${QT_VERSION}. Use at least Qt 5.9.7")
|
||||
}
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
QT += svg qml gui-private quick widgets
|
||||
|
||||
WALLET_ROOT=$$PWD/monero
|
||||
|
||||
CONFIG += c++11 link_pkgconfig
|
||||
packagesExist(libusb-1.0) {
|
||||
PKGCONFIG += libusb-1.0
|
||||
}
|
||||
packagesExist(hidapi-libusb) {
|
||||
PKGCONFIG += hidapi-libusb
|
||||
}
|
||||
|
||||
GCC_VERSION = $$system("g++ -dumpversion")
|
||||
GCC_VERSION = $$split(GCC_VERSION, .)
|
||||
GCC_VERSION_MAJOR = $$member(GCC_VERSION, 0)
|
||||
GCC_VERSION_MINOR = $$member(GCC_VERSION, 1)
|
||||
greaterThan(GCC_VERSION_MAJOR, 9) | if(equals(GCC_VERSION_MAJOR, 9) : greaterThan(GCC_VERSION_MINOR, 0)) {
|
||||
GCC_9_1_OR_GREATER = TRUE
|
||||
}
|
||||
|
||||
!win32 | !isEmpty(GCC_9_1_OR_GREATER) {
|
||||
QMAKE_CXXFLAGS += -fPIC -fstack-protector -fstack-protector-strong
|
||||
QMAKE_LFLAGS += -fstack-protector -fstack-protector-strong
|
||||
}
|
||||
|
||||
!win32 {
|
||||
packagesExist(protobuf) {
|
||||
PKGCONFIG += protobuf
|
||||
}
|
||||
}
|
||||
|
||||
# cleaning "auto-generated" bitmonero directory on "make distclean"
|
||||
QMAKE_DISTCLEAN += -r $$WALLET_ROOT
|
||||
|
||||
INCLUDEPATH += $$WALLET_ROOT/include \
|
||||
$$PWD/src/libwalletqt \
|
||||
$$PWD/src/QR-Code-generator \
|
||||
$$PWD/src \
|
||||
$$WALLET_ROOT/src \
|
||||
$$WALLET_ROOT/external/easylogging++ \
|
||||
$$WALLET_ROOT/contrib/epee/include
|
||||
|
||||
HEADERS += \
|
||||
src/main/filter.h \
|
||||
src/main/clipboardAdapter.h \
|
||||
src/main/oscursor.h \
|
||||
src/libwalletqt/WalletManager.h \
|
||||
src/libwalletqt/Wallet.h \
|
||||
src/libwalletqt/PassphraseHelper.h \
|
||||
src/libwalletqt/PendingTransaction.h \
|
||||
src/libwalletqt/TransactionHistory.h \
|
||||
src/libwalletqt/TransactionInfo.h \
|
||||
src/libwalletqt/QRCodeImageProvider.h \
|
||||
src/libwalletqt/Transfer.h \
|
||||
src/NetworkType.h \
|
||||
src/main/oshelper.h \
|
||||
src/TranslationManager.h \
|
||||
src/model/TransactionHistoryModel.h \
|
||||
src/model/TransactionHistorySortFilterModel.h \
|
||||
src/QR-Code-generator/BitBuffer.hpp \
|
||||
src/QR-Code-generator/QrCode.hpp \
|
||||
src/QR-Code-generator/QrSegment.hpp \
|
||||
src/model/AddressBookModel.h \
|
||||
src/libwalletqt/AddressBook.h \
|
||||
src/model/SubaddressModel.h \
|
||||
src/libwalletqt/Subaddress.h \
|
||||
src/model/SubaddressAccountModel.h \
|
||||
src/libwalletqt/SubaddressAccount.h \
|
||||
src/zxcvbn-c/zxcvbn.h \
|
||||
src/libwalletqt/UnsignedTransaction.h \
|
||||
src/main/Logger.h \
|
||||
src/main/MainApp.h \
|
||||
src/qt/downloader.h \
|
||||
src/qt/FutureScheduler.h \
|
||||
src/qt/ipc.h \
|
||||
src/qt/KeysFiles.h \
|
||||
src/qt/network.h \
|
||||
src/qt/utils.h \
|
||||
src/qt/macoshelper.h \
|
||||
src/qt/MoneroSettings.h \
|
||||
src/qt/TailsOS.h
|
||||
|
||||
SOURCES += src/main/main.cpp \
|
||||
src/main/filter.cpp \
|
||||
src/main/clipboardAdapter.cpp \
|
||||
src/main/oscursor.cpp \
|
||||
src/libwalletqt/WalletManager.cpp \
|
||||
src/libwalletqt/WalletListenerImpl.cpp \
|
||||
src/libwalletqt/Wallet.cpp \
|
||||
src/libwalletqt/PassphraseHelper.cpp \
|
||||
src/libwalletqt/PendingTransaction.cpp \
|
||||
src/libwalletqt/TransactionHistory.cpp \
|
||||
src/libwalletqt/TransactionInfo.cpp \
|
||||
src/libwalletqt/QRCodeImageProvider.cpp \
|
||||
src/main/oshelper.cpp \
|
||||
src/openpgp/openpgp.cpp \
|
||||
src/TranslationManager.cpp \
|
||||
src/model/TransactionHistoryModel.cpp \
|
||||
src/model/TransactionHistorySortFilterModel.cpp \
|
||||
src/QR-Code-generator/BitBuffer.cpp \
|
||||
src/QR-Code-generator/QrCode.cpp \
|
||||
src/QR-Code-generator/QrSegment.cpp \
|
||||
src/model/AddressBookModel.cpp \
|
||||
src/libwalletqt/AddressBook.cpp \
|
||||
src/model/SubaddressModel.cpp \
|
||||
src/libwalletqt/Subaddress.cpp \
|
||||
src/model/SubaddressAccountModel.cpp \
|
||||
src/libwalletqt/SubaddressAccount.cpp \
|
||||
src/zxcvbn-c/zxcvbn.c \
|
||||
src/libwalletqt/UnsignedTransaction.cpp \
|
||||
src/main/Logger.cpp \
|
||||
src/main/MainApp.cpp \
|
||||
src/qt/downloader.cpp \
|
||||
src/qt/FutureScheduler.cpp \
|
||||
src/qt/ipc.cpp \
|
||||
src/qt/KeysFiles.cpp \
|
||||
src/qt/network.cpp \
|
||||
src/qt/updater.cpp \
|
||||
src/qt/utils.cpp \
|
||||
src/qt/MoneroSettings.cpp \
|
||||
src/qt/TailsOS.cpp
|
||||
|
||||
CONFIG(DISABLE_PASS_STRENGTH_METER) {
|
||||
HEADERS -= src/zxcvbn-c/zxcvbn.h
|
||||
SOURCES -= src/zxcvbn-c/zxcvbn.c
|
||||
DEFINES += "DISABLE_PASS_STRENGTH_METER"
|
||||
}
|
||||
|
||||
!ios {
|
||||
HEADERS += src/daemon/DaemonManager.h
|
||||
SOURCES += src/daemon/DaemonManager.cpp
|
||||
}
|
||||
|
||||
lupdate_only {
|
||||
SOURCES = *.qml \
|
||||
components/*.qml \
|
||||
components/effects/*.qml \
|
||||
pages/*.qml \
|
||||
pages/settings/*.qml \
|
||||
pages/merchant/*.qml \
|
||||
wizard/*.qml \
|
||||
wizard/*js
|
||||
}
|
||||
|
||||
# Linker flags required by Trezor
|
||||
TREZOR_LINKER = $$cat($$WALLET_ROOT/lib/trezor_link_flags.txt)
|
||||
|
||||
ios:armv7 {
|
||||
message("target is armv7")
|
||||
LIBS += \
|
||||
-L$$PWD/../ofxiOSBoost/build/libs/boost/lib/armv7 \
|
||||
}
|
||||
ios:arm64 {
|
||||
message("target is arm64")
|
||||
LIBS += \
|
||||
-L$$PWD/../ofxiOSBoost/build/libs/boost/lib/arm64 \
|
||||
}
|
||||
|
||||
LIBS_COMMON = \
|
||||
-lgcrypt \
|
||||
-lgpg-error \
|
||||
-lwallet_merged \
|
||||
-llmdb \
|
||||
-lepee \
|
||||
-lunbound \
|
||||
-lsodium \
|
||||
-leasylogging \
|
||||
-lrandomx
|
||||
|
||||
!ios:!android {
|
||||
LIBS += -L$$WALLET_ROOT/lib \
|
||||
$$LIBS_COMMON
|
||||
}
|
||||
|
||||
android {
|
||||
message("Host is Android")
|
||||
LIBS += -L$$WALLET_ROOT/lib \
|
||||
$$LIBS_COMMON
|
||||
}
|
||||
|
||||
|
||||
|
||||
QMAKE_CXXFLAGS += -Werror -Wformat -Wformat-security
|
||||
QMAKE_CFLAGS += -Werror -Wformat -Wformat-security
|
||||
QMAKE_CXXFLAGS_RELEASE += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2
|
||||
QMAKE_CFLAGS_RELEASE += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2
|
||||
|
||||
ios {
|
||||
message("Host is IOS")
|
||||
|
||||
QMAKE_LFLAGS += -v
|
||||
QMAKE_IOS_DEVICE_ARCHS = arm64
|
||||
CONFIG += arm64
|
||||
LIBS += -L$$WALLET_ROOT/lib-ios \
|
||||
$$LIBS_COMMON
|
||||
|
||||
LIBS+= \
|
||||
-L$$PWD/../OpenSSL-for-iPhone/lib \
|
||||
-L$$PWD/../ofxiOSBoost/build/libs/boost/lib/arm64 \
|
||||
-lboost_serialization \
|
||||
-lboost_thread \
|
||||
-lboost_system \
|
||||
-lboost_date_time \
|
||||
-lboost_filesystem \
|
||||
-lboost_regex \
|
||||
-lboost_chrono \
|
||||
-lboost_program_options \
|
||||
-lssl \
|
||||
-lcrypto \
|
||||
-ldl
|
||||
}
|
||||
|
||||
CONFIG(WITH_SCANNER) {
|
||||
if( greaterThan(QT_MINOR_VERSION, 5) ) {
|
||||
message("using camera scanner")
|
||||
QT += multimedia
|
||||
DEFINES += "WITH_SCANNER"
|
||||
INCLUDEPATH += $$PWD/src/QR-Code-scanner
|
||||
HEADERS += \
|
||||
src/QR-Code-scanner/QrScanThread.h \
|
||||
src/QR-Code-scanner/QrCodeScanner.h
|
||||
SOURCES += \
|
||||
src/QR-Code-scanner/QrScanThread.cpp \
|
||||
src/QR-Code-scanner/QrCodeScanner.cpp
|
||||
android {
|
||||
INCLUDEPATH += $$PWD/../ZBar/include
|
||||
LIBS += -lzbarjni -liconv
|
||||
} else {
|
||||
LIBS += -lzbar
|
||||
macx {
|
||||
ZBAR_DIR = $$system(brew --prefix zbar, lines, EXIT_CODE)
|
||||
equals(EXIT_CODE, 0) {
|
||||
INCLUDEPATH += $$ZBAR_DIR/include
|
||||
} else {
|
||||
INCLUDEPATH += /usr/local/include
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
message("Skipping camera scanner because of Incompatible Qt Version !")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# currently we only support x86 build as qt.io only provides prebuilt qt for x86 mingw
|
||||
|
||||
win32 {
|
||||
|
||||
# QMAKE_HOST.arch is unreliable, will allways report 32bit if mingw32 shell is run.
|
||||
# Obtaining arch through uname should be reliable. This also fixes building the project in Qt creator without changes.
|
||||
MSYS_HOST_ARCH = $$system(uname -a | grep -o "x86_64")
|
||||
|
||||
# WIN64 Host settings
|
||||
contains(MSYS_HOST_ARCH, x86_64) {
|
||||
message("Host is 64bit")
|
||||
MSYS_ROOT_PATH=c:/msys64
|
||||
|
||||
# WIN32 Host settings
|
||||
} else {
|
||||
message("Host is 32bit")
|
||||
MSYS_ROOT_PATH=c:/msys32
|
||||
}
|
||||
|
||||
# WIN64 Target settings
|
||||
contains(QMAKE_HOST.arch, x86_64) {
|
||||
MSYS_MINGW_PATH=/mingw64
|
||||
|
||||
# WIN32 Target settings
|
||||
} else {
|
||||
MSYS_MINGW_PATH=/mingw32
|
||||
}
|
||||
|
||||
MSYS_PATH=$$MSYS_ROOT_PATH$$MSYS_MINGW_PATH
|
||||
|
||||
# boost root path
|
||||
BOOST_PATH=$$MSYS_PATH/boost
|
||||
BOOST_MINGW_PATH=$$MSYS_MINGW_PATH/boost
|
||||
|
||||
LIBS+=-L$$MSYS_PATH/lib
|
||||
LIBS+=-L$$MSYS_MINGW_PATH/lib
|
||||
LIBS+=-L$$BOOST_PATH/lib
|
||||
LIBS+=-L$$BOOST_MINGW_PATH/lib
|
||||
|
||||
QMAKE_LFLAGS += -static-libgcc -static-libstdc++
|
||||
|
||||
LIBS+= \
|
||||
-Wl,-Bdynamic \
|
||||
-lwinscard \
|
||||
-lwsock32 \
|
||||
-lIphlpapi \
|
||||
-lcrypt32 \
|
||||
-lhidapi \
|
||||
-lgdi32 $$TREZOR_LINKER \
|
||||
-Wl,-Bstatic \
|
||||
-lboost_serialization-mt \
|
||||
-lboost_thread-mt \
|
||||
-lboost_system-mt \
|
||||
-lboost_date_time-mt \
|
||||
-lboost_filesystem-mt \
|
||||
-lboost_regex-mt \
|
||||
-lboost_chrono-mt \
|
||||
-lboost_program_options-mt \
|
||||
-lboost_locale-mt \
|
||||
-licuio \
|
||||
-licuin \
|
||||
-licuuc \
|
||||
-licudt \
|
||||
-licutu \
|
||||
-liconv \
|
||||
-lstdc++ \
|
||||
-lpthread \
|
||||
-lsetupapi \
|
||||
-lssl \
|
||||
-lsodium \
|
||||
-lcrypto \
|
||||
-lws2_32 \
|
||||
-lole32
|
||||
|
||||
!contains(QMAKE_TARGET.arch, x86_64) {
|
||||
message("Target is 32bit")
|
||||
## Windows x86 (32bit) specific build here
|
||||
## there's 2Mb stack in libwallet allocated internally, so we set stack=4Mb
|
||||
## this fixes app crash for x86 Windows build
|
||||
QMAKE_LFLAGS += -Wl,--stack,4194304
|
||||
} else {
|
||||
message("Target is 64bit")
|
||||
}
|
||||
|
||||
QMAKE_LFLAGS += -Wl,--dynamicbase -Wl,--nxcompat
|
||||
}
|
||||
|
||||
linux {
|
||||
CONFIG(static) {
|
||||
message("using static libraries")
|
||||
LIBS+= -Wl,-Bstatic
|
||||
QMAKE_LFLAGS += -static-libgcc -static-libstdc++
|
||||
QMAKE_LIBDIR += /usr/local/ssl/lib
|
||||
# contains(QT_ARCH, x86_64) {
|
||||
LIBS+= -lunbound \
|
||||
-lusb-1.0 \
|
||||
-lhidapi-hidraw \
|
||||
-ludev
|
||||
# }
|
||||
} else {
|
||||
# On some distro's we need to add dynload
|
||||
LIBS+= -ldl
|
||||
}
|
||||
|
||||
LIBS+= \
|
||||
-lboost_serialization \
|
||||
-lboost_thread \
|
||||
-lboost_system \
|
||||
-lboost_date_time \
|
||||
-lboost_filesystem \
|
||||
-lboost_regex \
|
||||
-lboost_chrono \
|
||||
-lboost_program_options \
|
||||
-lssl \
|
||||
-llmdb \
|
||||
-lsodium \
|
||||
-lhidapi-libusb \
|
||||
-lcrypto $$TREZOR_LINKER
|
||||
|
||||
if(!android) {
|
||||
LIBS+= \
|
||||
-Wl,-Bdynamic \
|
||||
-lGL \
|
||||
-lX11
|
||||
}
|
||||
# currently monero has an issue with "static" build and linunwind-dev,
|
||||
# so we link libunwind-dev only for non-Ubuntu distros
|
||||
CONFIG(libunwind_off) {
|
||||
message(Building without libunwind)
|
||||
} else {
|
||||
message(Building with libunwind)
|
||||
LIBS += -Wl,-Bdynamic -lunwind
|
||||
}
|
||||
|
||||
QMAKE_LFLAGS += -pie -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack
|
||||
}
|
||||
|
||||
macx {
|
||||
# mixing static and shared libs are not supported on mac
|
||||
# CONFIG(static) {
|
||||
# message("using static libraries")
|
||||
# LIBS+= -Wl,-Bstatic
|
||||
# }
|
||||
|
||||
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) {
|
||||
INCLUDEPATH += $$BOOST_DIR/include
|
||||
} else {
|
||||
INCLUDEPATH += /usr/local/include
|
||||
}
|
||||
|
||||
GCRYPT_DIR = $$system(brew --prefix libgcrypt, lines, EXIT_CODE)
|
||||
equals(EXIT_CODE, 0) {
|
||||
INCLUDEPATH += $$GCRYPT_DIR/include
|
||||
} else {
|
||||
INCLUDEPATH += /usr/local/include
|
||||
}
|
||||
|
||||
GPGP_ERROR_DIR = $$system(brew --prefix libgpg-error, lines, EXIT_CODE)
|
||||
equals(EXIT_CODE, 0) {
|
||||
INCLUDEPATH += $$GPGP_ERROR_DIR/include
|
||||
} else {
|
||||
INCLUDEPATH += /usr/local/include
|
||||
}
|
||||
|
||||
QT += macextras
|
||||
OBJECTIVE_SOURCES += src/qt/macoshelper.mm
|
||||
LIBS+= -Wl,-dead_strip
|
||||
LIBS+= -Wl,-dead_strip_dylibs
|
||||
LIBS+= -Wl,-bind_at_load
|
||||
LIBS+= \
|
||||
-L/usr/local/lib \
|
||||
-L$$OPENSSL_LIBRARY_DIR \
|
||||
-L/usr/local/opt/boost/lib \
|
||||
-lboost_serialization \
|
||||
-lboost_thread-mt \
|
||||
-lboost_system \
|
||||
-lboost_date_time \
|
||||
-lboost_filesystem \
|
||||
-lboost_regex \
|
||||
-lboost_chrono \
|
||||
-lboost_program_options \
|
||||
-framework CoreFoundation \
|
||||
-framework AppKit \
|
||||
-lhidapi \
|
||||
-lssl \
|
||||
-lsodium \
|
||||
-lcrypto \
|
||||
-ldl $$TREZOR_LINKER
|
||||
|
||||
QMAKE_LFLAGS += -pie
|
||||
}
|
||||
|
||||
|
||||
# translation stuff
|
||||
TRANSLATIONS = $$files($$PWD/translations/monero-core_*.ts)
|
||||
|
||||
CONFIG(release, debug|release) {
|
||||
DESTDIR = release/bin
|
||||
LANGUPD_OPTIONS = -locations none -no-ui-lines -no-obsolete
|
||||
LANGREL_OPTIONS = -compress -nounfinished -removeidentical
|
||||
|
||||
} else {
|
||||
DESTDIR = debug/bin
|
||||
LANGUPD_OPTIONS =
|
||||
# LANGREL_OPTIONS = -markuntranslated "MISS_TR "
|
||||
}
|
||||
|
||||
TRANSLATION_TARGET_DIR = $$OUT_PWD/translations
|
||||
|
||||
!ios {
|
||||
isEmpty(QMAKE_LUPDATE) {
|
||||
win32:LANGUPD = $$[QT_INSTALL_BINS]\lupdate.exe
|
||||
else:LANGUPD = $$[QT_INSTALL_BINS]/lupdate
|
||||
}
|
||||
|
||||
isEmpty(QMAKE_LRELEASE) {
|
||||
win32:LANGREL = $$[QT_INSTALL_BINS]\lrelease.exe
|
||||
else:LANGREL = $$[QT_INSTALL_BINS]/lrelease
|
||||
}
|
||||
|
||||
langupd.command = \
|
||||
$$LANGUPD $$LANGUPD_OPTIONS $$shell_path($$_PRO_FILE) -ts $$_PRO_FILE_PWD/$$TRANSLATIONS
|
||||
|
||||
|
||||
|
||||
langrel.depends = langupd
|
||||
langrel.input = TRANSLATIONS
|
||||
langrel.output = $$TRANSLATION_TARGET_DIR/${QMAKE_FILE_BASE}.qm
|
||||
langrel.commands = \
|
||||
$$LANGREL $$LANGREL_OPTIONS ${QMAKE_FILE_IN} -qm $$TRANSLATION_TARGET_DIR/${QMAKE_FILE_BASE}.qm
|
||||
langrel.CONFIG += no_link
|
||||
|
||||
QMAKE_EXTRA_TARGETS += langupd deploy deploy_win
|
||||
QMAKE_EXTRA_COMPILERS += langrel
|
||||
|
||||
# Compile an initial version of translation files when running qmake
|
||||
# the first time and generate the resource file for translations.
|
||||
!exists($$TRANSLATION_TARGET_DIR) {
|
||||
mkpath($$TRANSLATION_TARGET_DIR)
|
||||
}
|
||||
qrc_entry = "<RCC>"
|
||||
qrc_entry += ' <qresource prefix="/">'
|
||||
write_file($$TRANSLATION_TARGET_DIR/translations.qrc, qrc_entry)
|
||||
for(tsfile, TRANSLATIONS) {
|
||||
qmfile = $$TRANSLATION_TARGET_DIR/$$basename(tsfile)
|
||||
qmfile ~= s/.ts$/.qm/
|
||||
system($$LANGREL $$LANGREL_OPTIONS $$tsfile -qm $$qmfile)
|
||||
qrc_entry = " <file>$$basename(qmfile)</file>"
|
||||
write_file($$TRANSLATION_TARGET_DIR/translations.qrc, qrc_entry, append)
|
||||
}
|
||||
qrc_entry = " </qresource>"
|
||||
qrc_entry += "</RCC>"
|
||||
write_file($$TRANSLATION_TARGET_DIR/translations.qrc, qrc_entry, append)
|
||||
RESOURCES += $$TRANSLATION_TARGET_DIR/translations.qrc
|
||||
}
|
||||
|
||||
|
||||
# Update: no issues with the "slow link process" anymore,
|
||||
# for development, just build debug version of libwallet_merged lib
|
||||
# by invoking 'get_libwallet_api.sh Debug'
|
||||
# so we update translations everytime even for debug build
|
||||
|
||||
PRE_TARGETDEPS += langupd compiler_langrel_make_all
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
CONFIG += qtquickcompiler
|
||||
|
||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
||||
QML_IMPORT_PATH = fonts
|
||||
|
||||
# Default rules for deployment.
|
||||
include(deployment.pri)
|
||||
macx {
|
||||
deploy.commands += macdeployqt $$sprintf("%1/%2/%3.app", $$OUT_PWD, $$DESTDIR, $$TARGET) -qmldir=$$PWD
|
||||
}
|
||||
|
||||
win32 {
|
||||
deploy.commands += windeployqt $$sprintf("%1/%2/%3.exe", $$OUT_PWD, $$DESTDIR, $$TARGET) -release -no-translations -qmldir=$$PWD
|
||||
# Win64 msys2 deploy settings
|
||||
contains(QMAKE_HOST.arch, x86_64) {
|
||||
deploy.commands += $$escape_expand(\n\t) $$PWD/windeploy_helper.sh $$DESTDIR
|
||||
}
|
||||
}
|
||||
|
||||
linux:!android {
|
||||
deploy.commands += $$escape_expand(\n\t) $$PWD/linuxdeploy_helper.sh $$DESTDIR $$TARGET
|
||||
}
|
||||
|
||||
android{
|
||||
deploy.commands += make install INSTALL_ROOT=$$DESTDIR && androiddeployqt --input android-libmonero-wallet-gui.so-deployment-settings.json --output $$DESTDIR --deployment bundled --android-platform android-21 --jdk /usr/lib/jvm/java-8-openjdk-amd64 -qmldir=$$PWD
|
||||
}
|
||||
|
||||
|
||||
OTHER_FILES += \
|
||||
.gitignore \
|
||||
$$TRANSLATIONS
|
||||
|
||||
DISTFILES += \
|
||||
notes.txt \
|
||||
monero/src/wallet/CMakeLists.txt
|
||||
|
||||
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
|
||||
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
|
||||
@@ -48,6 +48,8 @@ Rectangle {
|
||||
color: "transparent"
|
||||
property var model
|
||||
property alias accountHeight: mainLayout.height
|
||||
property alias balanceAllText: balanceAll.text
|
||||
property alias unlockedBalanceAllText: unlockedBalanceAll.text
|
||||
property bool selectAndSend: false
|
||||
property int currentAccountIndex
|
||||
|
||||
@@ -186,7 +188,7 @@ Rectangle {
|
||||
delegate: Rectangle {
|
||||
id: tableItem2
|
||||
height: subaddressAccountListRow.subaddressAccountListItemHeight
|
||||
width: parent.width
|
||||
width: parent ? parent.width : undefined
|
||||
Layout.fillWidth: true
|
||||
color: "transparent"
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ Rectangle {
|
||||
delegate: Rectangle {
|
||||
id: tableItem2
|
||||
height: addressBookListRow.addressBookListItemHeight
|
||||
width: parent.width
|
||||
width: parent ? parent.width : undefined
|
||||
Layout.fillWidth: true
|
||||
color: "transparent"
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ Rectangle {
|
||||
image: "qrc:///images/whiteDropIndicator.png"
|
||||
fontAwesomeFallbackIcon: FontAwesome.arrowDown
|
||||
fontAwesomeFallbackSize: 14
|
||||
rotation: sortAndFilter.collapsed ? 0 : 180
|
||||
rotation: sortAndFilter.collapsed ? 180 : 0
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
|
||||
MouseArea {
|
||||
@@ -569,12 +569,11 @@ Rectangle {
|
||||
delegate: Rectangle {
|
||||
id: delegate
|
||||
property bool collapsed: root.txDataCollapsed.indexOf(hash) >= 0 ? true : false
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent ? parent.left : undefined
|
||||
anchors.right: parent ? parent.right : undefined
|
||||
height: {
|
||||
if(!collapsed) return 60;
|
||||
if(isout && delegate.address !== "") return 320;
|
||||
return 220;
|
||||
return 320;
|
||||
}
|
||||
color: {
|
||||
if(!collapsed) return "transparent"
|
||||
@@ -618,6 +617,7 @@ Rectangle {
|
||||
spacing: 0
|
||||
clip: true
|
||||
Layout.preferredHeight: 120
|
||||
Layout.minimumWidth: 180
|
||||
|
||||
Rectangle {
|
||||
color: "transparent"
|
||||
@@ -633,17 +633,7 @@ Rectangle {
|
||||
MoneroComponents.TextPlain {
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 15
|
||||
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;
|
||||
}
|
||||
text: (isout ? qsTr("Sent") : qsTr("Received")) + translationManager.emptyString
|
||||
color: MoneroComponents.Style.historyHeaderTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
themeTransitionBlackColor: MoneroComponents.Style._b_historyHeaderTextColor
|
||||
@@ -659,7 +649,7 @@ Rectangle {
|
||||
MoneroComponents.TextPlain {
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 15
|
||||
text: displayAmount
|
||||
text: (amount == 0 ? qsTr("Unknown amount") : displayAmount) + translationManager.emptyString
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -711,7 +701,7 @@ Rectangle {
|
||||
font.pixelSize: 15
|
||||
text: {
|
||||
if(!isout && confirmationsRequired === 60) return qsTr("Yes") + translationManager.emptyString;
|
||||
if(fee !== "") return fee + " XMR";
|
||||
if(fee !== "") return Utils.removeTrailingZeros(fee) + " XMR";
|
||||
return "-";
|
||||
}
|
||||
|
||||
@@ -739,6 +729,7 @@ Rectangle {
|
||||
spacing: 0
|
||||
clip: true
|
||||
Layout.preferredHeight: 120
|
||||
Layout.minimumWidth: 230
|
||||
|
||||
Rectangle {
|
||||
color: "transparent"
|
||||
@@ -754,7 +745,7 @@ Rectangle {
|
||||
MoneroComponents.TextPlain {
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 15
|
||||
text: qsTr("Blockheight") + translationManager.emptyString
|
||||
text: (isout ? qsTr("To") : qsTr("In")) + translationManager.emptyString
|
||||
color: MoneroComponents.Style.historyHeaderTextColor
|
||||
themeTransitionBlackColor: MoneroComponents.Style._b_historyHeaderTextColor
|
||||
themeTransitionWhiteColor: MoneroComponents.Style._w_historyHeaderTextColor
|
||||
@@ -768,15 +759,50 @@ Rectangle {
|
||||
Layout.preferredHeight: 20
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
id: addressField
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 14
|
||||
text: blockheight > 0 ? blockheight : qsTr('Pending') + translationManager.emptyString;
|
||||
font.pixelSize: 15
|
||||
text: {
|
||||
if (isout) {
|
||||
if (isFailed) {
|
||||
return qsTr("Failed") + translationManager.emptyString;
|
||||
}
|
||||
if (isPending) {
|
||||
return qsTr("Waiting confirmation...") + translationManager.emptyString;
|
||||
}
|
||||
if (address) {
|
||||
const addressBookName = currentWallet ? currentWallet.addressBook.getDescription(address) : null;
|
||||
return (addressBookName ? FontAwesome.addressBook + " " + addressBookName : TxUtils.addressTruncate(address, 8));
|
||||
}
|
||||
if (amount != 0) {
|
||||
return qsTr("Unknown recipient") + translationManager.emptyString;
|
||||
} else {
|
||||
return qsTr("My wallet") + translationManager.emptyString;
|
||||
}
|
||||
} else {
|
||||
const receivingAddress = currentWallet ? currentWallet.address(subaddrAccount, subaddrIndex) : null;
|
||||
const receivingAddressLabel = currentWallet ? appWindow.currentWallet.getSubaddressLabel(subaddrAccount, subaddrIndex) : null;
|
||||
if (receivingAddress) {
|
||||
if (subaddrIndex == 0) {
|
||||
return qsTr("Address") + " #0" + " (" + qsTr("Primary address") + ")" + translationManager.emptyString;
|
||||
} else {
|
||||
if (receivingAddressLabel) {
|
||||
return qsTr("Address") + " #" + subaddrIndex + " (" + receivingAddressLabel + ")" + translationManager.emptyString;
|
||||
} else {
|
||||
return qsTr("Address") + " #" + subaddrIndex + " (" + TxUtils.addressTruncate(receivingAddress, 4) + ")" + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return qsTr("Unknown address") + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
MouseArea {
|
||||
state: "copyable"
|
||||
state: isout ? "copyable_address" : "copyable_receiving_address"
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onEntered: parent.color = MoneroComponents.Style.orange
|
||||
@@ -847,6 +873,7 @@ Rectangle {
|
||||
spacing: 0
|
||||
clip: true
|
||||
Layout.preferredHeight: 120
|
||||
Layout.minimumWidth: 130
|
||||
|
||||
Rectangle {
|
||||
color: "transparent"
|
||||
@@ -909,9 +936,15 @@ Rectangle {
|
||||
Layout.preferredHeight: 10
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: "transparent"
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 10
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 60
|
||||
Layout.preferredHeight: 50
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
id: btnDetails
|
||||
@@ -919,7 +952,7 @@ Rectangle {
|
||||
small: true
|
||||
label.font.family: FontAwesome.fontFamily
|
||||
fontSize: 18
|
||||
width: 28
|
||||
width: 34
|
||||
|
||||
MouseArea {
|
||||
state: "details"
|
||||
@@ -949,7 +982,7 @@ Rectangle {
|
||||
small: true
|
||||
label.font.family: FontAwesome.fontFamilyBrands
|
||||
fontSize: 18
|
||||
width: 36
|
||||
width: 34
|
||||
|
||||
MouseArea {
|
||||
state: "proof"
|
||||
@@ -1128,7 +1161,6 @@ Rectangle {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: isout
|
||||
color: "transparent"
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 20
|
||||
@@ -1136,7 +1168,7 @@ Rectangle {
|
||||
MoneroComponents.TextPlain {
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 15
|
||||
text: qsTr("Address sent to") + translationManager.emptyString
|
||||
text: qsTr("Blockheight") + translationManager.emptyString
|
||||
color: MoneroComponents.Style.historyHeaderTextColor
|
||||
themeTransitionBlackColor: MoneroComponents.Style._b_historyHeaderTextColor
|
||||
themeTransitionWhiteColor: MoneroComponents.Style._w_historyHeaderTextColor
|
||||
@@ -1145,30 +1177,20 @@ Rectangle {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: isout
|
||||
color: "transparent"
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 20
|
||||
|
||||
MoneroComponents.TextPlain {
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 15
|
||||
text: {
|
||||
if(isout && address !== ""){
|
||||
return TxUtils.addressTruncate(address, 24);
|
||||
}
|
||||
|
||||
if(isout && blockheight === 0)
|
||||
return qsTr("Waiting for transaction to leave txpool.") + translationManager.emptyString
|
||||
else
|
||||
return qsTr("Unknown recipient") + translationManager.emptyString;
|
||||
}
|
||||
font.pixelSize: 14
|
||||
text: (blockheight > 0 ? blockheight : qsTr('Pending')) + translationManager.emptyString;
|
||||
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
MouseArea {
|
||||
state: "copyable_address"
|
||||
state: "copyable"
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onEntered: parent.color = MoneroComponents.Style.orange
|
||||
@@ -1202,7 +1224,8 @@ Rectangle {
|
||||
for(var i = 0; i < res.length; i+=1){
|
||||
if(res[i].containsMouse === true){
|
||||
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_address') (address ? root.toClipboard(address) : root.toClipboard(addressField.text));
|
||||
if(res[i].state === 'copyable_receiving_address') root.toClipboard(currentWallet.address(subaddrAccount, subaddrIndex));
|
||||
if(res[i].state === 'copyable_txkey') root.getTxKey(hash, res[i]);
|
||||
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);
|
||||
@@ -1394,7 +1417,7 @@ Rectangle {
|
||||
txs.push(item);
|
||||
} else if(item.address !== "" && item.address.toLowerCase().startsWith(root.sortSearchString.toLowerCase())){
|
||||
txs.push(item);
|
||||
} else if(item.blockheight.toString().startsWith(root.sortSearchString)) {
|
||||
} else if(typeof item.blockheight !== "undefined" && item.blockheight.toString().startsWith(root.sortSearchString)) {
|
||||
txs.push(item);
|
||||
} else if(item.tx_note.toLowerCase().indexOf(root.sortSearchString.toLowerCase()) !== -1) {
|
||||
txs.push(item);
|
||||
@@ -1472,6 +1495,8 @@ Rectangle {
|
||||
|
||||
for (var i = 0; i < count; ++i) {
|
||||
var idx = _model.index(i, 0);
|
||||
var isPending = model.data(idx, TransactionHistoryModel.TransactionPendingRole);
|
||||
var isFailed = model.data(idx, TransactionHistoryModel.TransactionFailedRole);
|
||||
var isout = _model.data(idx, TransactionHistoryModel.TransactionIsOutRole);
|
||||
var amount = _model.data(idx, TransactionHistoryModel.TransactionAmountRole);
|
||||
var hash = _model.data(idx, TransactionHistoryModel.TransactionHashRole);
|
||||
@@ -1488,13 +1513,12 @@ Rectangle {
|
||||
var timestamp = new Date(date + " " + time).getTime() / 1000;
|
||||
var dateHuman = Utils.ago(timestamp);
|
||||
|
||||
var displayAmount = amount;
|
||||
if(displayAmount === 0){
|
||||
// *sometimes* amount is 0, while the 'destinations string'
|
||||
if (amount === 0) {
|
||||
// transactions to the same account have amount === 0, while the 'destinations string'
|
||||
// has the correct amount, so we try to fetch it from that instead.
|
||||
displayAmount = TxUtils.destinationsToAmount(destinations);
|
||||
displayAmount = Number(displayAmount *1);
|
||||
amount = Number(TxUtils.destinationsToAmount(destinations));
|
||||
}
|
||||
var displayAmount = Utils.removeTrailingZeros(amount.toFixed(12)) + " XMR";
|
||||
|
||||
var tx_note = currentWallet.getUserNote(hash);
|
||||
var address = "";
|
||||
@@ -1509,9 +1533,11 @@ Rectangle {
|
||||
|
||||
root.txModelData.push({
|
||||
"i": i,
|
||||
"isPending": isPending,
|
||||
"isFailed": isFailed,
|
||||
"isout": isout,
|
||||
"amount": Number(amount),
|
||||
"displayAmount": displayAmount + " XMR",
|
||||
"amount": amount,
|
||||
"displayAmount": displayAmount,
|
||||
"hash": hash,
|
||||
"paymentId": paymentId,
|
||||
"address": address,
|
||||
@@ -1692,7 +1718,7 @@ Rectangle {
|
||||
informationPopup.open();
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var _folder = 'file://' + moneroAccountsDir;
|
||||
var _folder = 'file://' + appWindow.accountsDir;
|
||||
try {
|
||||
_folder = 'file://' + desktopFolder;
|
||||
}
|
||||
|
||||
@@ -251,7 +251,19 @@ Rectangle {
|
||||
|
||||
function updateStatusText() {
|
||||
if (appWindow.isMining) {
|
||||
statusText.text = qsTr("Mining at %1 H/s").arg(walletManager.miningHashRate()) + translationManager.emptyString;
|
||||
var userHashRate = walletManager.miningHashRate();
|
||||
if (userHashRate === 0) {
|
||||
statusText.text = qsTr("Mining temporarily suspended.") + translationManager.emptyString;
|
||||
}
|
||||
else {
|
||||
var blockTime = 120;
|
||||
var blocksPerDay = 86400 / blockTime;
|
||||
var globalHashRate = walletManager.networkDifficulty() / blockTime;
|
||||
var probabilityFindNextBlock = userHashRate / globalHashRate;
|
||||
var probabilityFindBlockDay = 1 - Math.pow(1 - probabilityFindNextBlock, blocksPerDay);
|
||||
var chanceFindBlockDay = Math.round(1 / probabilityFindBlockDay);
|
||||
statusText.text = qsTr("Mining at %1 H/s. It gives you a 1 in %2 daily chance of finding a block.").arg(userHashRate).arg(chanceFindBlockDay) + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
else {
|
||||
statusText.text = qsTr("Not mining") + translationManager.emptyString;
|
||||
|
||||
@@ -105,7 +105,7 @@ Rectangle {
|
||||
delegate: Rectangle {
|
||||
id: tableItem2
|
||||
height: subaddressListRow.subaddressListItemHeight
|
||||
width: parent.width
|
||||
width: parent ? parent.width : undefined
|
||||
Layout.fillWidth: true
|
||||
color: "transparent"
|
||||
|
||||
|
||||
@@ -296,6 +296,7 @@ Rectangle {
|
||||
inlineButtonText: qsTr("All") + translationManager.emptyString
|
||||
inlineButton.onClicked: amountLine.text = "(all)"
|
||||
onTextChanged: {
|
||||
amountLine.text = amountLine.text.replace(",", ".");
|
||||
const match = amountLine.text.match(/^0+(\d.*)/);
|
||||
if (match) {
|
||||
const cursorPosition = amountLine.cursorPosition;
|
||||
@@ -311,7 +312,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
validator: RegExpValidator {
|
||||
regExp: /^(\d{1,8})?([\.]\d{1,12})?$/
|
||||
regExp: /^(\d{1,8})?([\.,]\d{1,12})?$/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,7 +553,8 @@ Rectangle {
|
||||
if (appWindow.viewOnly && !appWindow.isTrustedDaemon()){
|
||||
errorMessage = "<p class='orange'>" + qsTr("* To import, you must connect to a local node or a trusted remote node") + "</p>";
|
||||
}
|
||||
return "<style type='text/css'>p{line-height:20px; margin-top:0px; margin-bottom:0px; color:#ffffff;} p.orange{color:#ff9323;}</style>" +
|
||||
return "<style type='text/css'>p{line-height:20px; margin-top:0px; margin-bottom:0px; color:" + MoneroComponents.Style.defaultFontColor +
|
||||
";} p.orange{color:#ff9323;}</style>" +
|
||||
"<p>" + qsTr("1. Using cold wallet, export the key images into a file") + "</p>" +
|
||||
"<p>" + qsTr("2. Using view-only wallet, import the key images file") + "</p>" +
|
||||
errorMessage + translationManager.emptyString
|
||||
@@ -592,7 +594,8 @@ Rectangle {
|
||||
if (appWindow.viewOnly && !pageRoot.checkInformation(amountLine.text, addressLine.text, appWindow.persistentSettings.nettype)){
|
||||
errorMessage = "<p class='orange'>" + qsTr("* To create a transaction file, please enter address and amount above") + "</p>";
|
||||
}
|
||||
return "<style type='text/css'>p{line-height:20px; margin-top:0px; margin-bottom:0px; color:#ffffff;} p.orange{color:#ff9323;}</style>" +
|
||||
return "<style type='text/css'>p{line-height:20px; margin-top:0px; margin-bottom:0px; color:" + MoneroComponents.Style.defaultFontColor +
|
||||
";} p.orange{color:#ff9323;}</style>" +
|
||||
"<p>" + qsTr("1. Using view-only wallet, export the outputs into a file") + "</p>" +
|
||||
"<p>" + qsTr("2. Using cold wallet, import the outputs file and export the key images") + "</p>" +
|
||||
"<p>" + qsTr("3. Using view-only wallet, import the key images file and create a transaction file") + "</p>" +
|
||||
@@ -620,7 +623,7 @@ Rectangle {
|
||||
FileDialog {
|
||||
id: signTxDialog
|
||||
title: qsTr("Please choose a file") + translationManager.emptyString
|
||||
folder: "file://" +moneroAccountsDir
|
||||
folder: "file://" + appWindow.accountsDir
|
||||
nameFilters: [ "Unsigned transfers (*)"]
|
||||
|
||||
onAccepted: {
|
||||
@@ -681,7 +684,7 @@ Rectangle {
|
||||
FileDialog {
|
||||
id: submitTxDialog
|
||||
title: qsTr("Please choose a file") + translationManager.emptyString
|
||||
folder: "file://" +moneroAccountsDir
|
||||
folder: "file://" + appWindow.accountsDir
|
||||
nameFilters: [ "signed transfers (*)"]
|
||||
|
||||
onAccepted: {
|
||||
|
||||
@@ -47,7 +47,7 @@ ListView {
|
||||
id: trackingTableItem
|
||||
visible: trackingListView.message === ""
|
||||
height: 53
|
||||
width: parent.width
|
||||
width: parent ? parent.width : undefined
|
||||
Layout.fillWidth: true
|
||||
|
||||
RowLayout {
|
||||
|
||||
@@ -273,7 +273,6 @@ Rectangle {
|
||||
// LOG
|
||||
id: navLog
|
||||
property bool isActive: settingsStateView.state === "Log"
|
||||
visible: appWindow.walletMode >= 2
|
||||
Layout.preferredWidth: navLogText.width + grid.textMargin
|
||||
Layout.preferredHeight: 32
|
||||
Layout.minimumWidth: 72
|
||||
|
||||
@@ -47,7 +47,7 @@ Rectangle {
|
||||
} else if(appWindow.walletMode === 1){
|
||||
return qsTr("Simple mode") + " (bootstrap)" + translationManager.emptyString;
|
||||
} else if(appWindow.walletMode === 2){
|
||||
return qsTr("Advanced mode") + translationManager.emptyString;
|
||||
return "%1 (%2)".arg(qsTr("Advanced mode")).arg(persistentSettings.useRemoteNode ? qsTr("Remote node") : qsTr("Local node")) + translationManager.emptyString;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ Rectangle {
|
||||
MoneroComponents.TextBlock {
|
||||
font.pixelSize: 14
|
||||
color: MoneroComponents.Style.dimmedFontColor
|
||||
text: Version.GUI_MONERO_VERSION + translationManager.emptyString
|
||||
text: moneroVersion
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -135,7 +135,7 @@ Rectangle {
|
||||
Layout.fillWidth: true
|
||||
color: MoneroComponents.Style.dimmedFontColor
|
||||
font.pixelSize: 14
|
||||
property string walletPath: (isIOS ? moneroAccountsDir : "") + persistentSettings.wallet_path
|
||||
property string walletPath: (isIOS ? appWindow.accountsDir : "") + persistentSettings.wallet_path
|
||||
text: "\
|
||||
<style type='text/css'>\
|
||||
a {cursor:pointer;text-decoration: none; color: #FF6C3C}\
|
||||
@@ -272,9 +272,9 @@ Rectangle {
|
||||
<style type='text/css'>\
|
||||
a {cursor:pointer;text-decoration: none; color: #FF6C3C}\
|
||||
</style>\
|
||||
<a href='#'>%1</a>".arg(walletLogPath)
|
||||
<a href='#'>%1</a>".arg(logger.logFilePath)
|
||||
textFormat: Text.RichText
|
||||
onLinkActivated: oshelper.openContainingFolder(walletLogPath)
|
||||
onLinkActivated: oshelper.openContainingFolder(logger.logFilePath)
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
@@ -381,27 +381,40 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Copy info to clipboard
|
||||
MoneroComponents.StandardButton {
|
||||
small: true
|
||||
text: qsTr("Copy to clipboard") + translationManager.emptyString
|
||||
onClicked: {
|
||||
var data = "";
|
||||
data += "GUI version: " + Version.GUI_VERSION + " (Qt " + qtRuntimeVersion + ")";
|
||||
data += "\nEmbedded Monero version: " + Version.GUI_MONERO_VERSION;
|
||||
data += "\nWallet path: " + walletLocation.walletPath;
|
||||
RowLayout {
|
||||
spacing: 20;
|
||||
|
||||
data += "\nWallet creation height: ";
|
||||
if(currentWallet)
|
||||
data += currentWallet.walletCreationHeight;
|
||||
MoneroComponents.StandardButton {
|
||||
small: true
|
||||
text: qsTr("Copy to clipboard") + translationManager.emptyString
|
||||
onClicked: {
|
||||
var data = "";
|
||||
data += "GUI version: " + Version.GUI_VERSION + " (Qt " + qtRuntimeVersion + ")";
|
||||
data += "\nEmbedded Monero version: " + moneroVersion;
|
||||
data += "\nWallet path: " + walletLocation.walletPath;
|
||||
|
||||
data += "\nWallet log path: " + walletLogPath;
|
||||
data += "\nWallet mode: " + walletModeString;
|
||||
data += "\nGraphics: " + isOpenGL ? "OpenGL" : "Low graphics mode";
|
||||
data += "\nWallet restore height: ";
|
||||
if(currentWallet)
|
||||
data += currentWallet.walletCreationHeight;
|
||||
|
||||
console.log("Copied to clipboard");
|
||||
clipboard.setText(data);
|
||||
appWindow.showStatusMessage(qsTr("Copied to clipboard"), 3);
|
||||
data += "\nWallet log path: " + logger.logFilePath;
|
||||
data += "\nWallet mode: " + walletModeString;
|
||||
data += "\nGraphics mode: " + isOpenGL ? "OpenGL" : "Low graphics mode";
|
||||
if (isTails)
|
||||
data += "\nTails: " + tailsUsePersistence ? "persistent" : "persistence disabled";
|
||||
|
||||
console.log("Copied to clipboard");
|
||||
clipboard.setText(data);
|
||||
appWindow.showStatusMessage(qsTr("Copied to clipboard"), 3);
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
small: true
|
||||
text: qsTr("Donate to Monero") + translationManager.emptyString
|
||||
onClicked: {
|
||||
middlePanel.sendTo("888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H", "", "Donation to Monero Core Team");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,10 +88,24 @@ Rectangle {
|
||||
}
|
||||
|
||||
MoneroComponents.CheckBox {
|
||||
id: askPasswordBeforeSendingCheckbox
|
||||
checked: persistentSettings.askPasswordBeforeSending
|
||||
onClicked: persistentSettings.askPasswordBeforeSending = !persistentSettings.askPasswordBeforeSending
|
||||
text: qsTr("Ask for password before sending a transaction") + translationManager.emptyString
|
||||
toggleOnClick: false
|
||||
onClicked: {
|
||||
if (persistentSettings.askPasswordBeforeSending) {
|
||||
passwordDialog.onAcceptedCallback = function() {
|
||||
if (appWindow.walletPassword === passwordDialog.password){
|
||||
persistentSettings.askPasswordBeforeSending = false;
|
||||
} else {
|
||||
passwordDialog.showError(qsTr("Wrong password"));
|
||||
}
|
||||
}
|
||||
passwordDialog.onRejectedCallback = null;
|
||||
passwordDialog.open()
|
||||
} else {
|
||||
persistentSettings.askPasswordBeforeSending = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.CheckBox {
|
||||
@@ -237,6 +251,37 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.CheckBox {
|
||||
id: proxyCheckbox
|
||||
Layout.topMargin: 6
|
||||
enabled: !socksProxyFlagSet
|
||||
checked: socksProxyFlagSet ? socksProxyFlag : persistentSettings.proxyEnabled
|
||||
onClicked: {
|
||||
persistentSettings.proxyEnabled = !persistentSettings.proxyEnabled;
|
||||
}
|
||||
text: qsTr("Socks5 proxy (%1%2)")
|
||||
.arg(appWindow.walletMode >= 2 ? qsTr("remote node connections, ") : "")
|
||||
.arg(qsTr("updates downloading, fetching price sources")) + translationManager.emptyString
|
||||
}
|
||||
|
||||
MoneroComponents.RemoteNodeEdit {
|
||||
id: proxyEdit
|
||||
enabled: proxyCheckbox.enabled
|
||||
Layout.leftMargin: 36
|
||||
Layout.topMargin: 6
|
||||
Layout.minimumWidth: 100
|
||||
placeholderFontSize: 15
|
||||
visible: proxyCheckbox.checked
|
||||
|
||||
daemonAddrLabelText: qsTr("IP address") + translationManager.emptyString
|
||||
daemonPortLabelText: qsTr("Port") + translationManager.emptyString
|
||||
|
||||
initialAddress: socksProxyFlagSet ? socksProxyFlag : persistentSettings.proxyAddress
|
||||
onEditingFinished: {
|
||||
persistentSettings.proxyAddress = proxyEdit.getAddress();
|
||||
}
|
||||
}
|
||||
|
||||
MoneroComponents.StandardButton {
|
||||
visible: !persistentSettings.customDecorations
|
||||
Layout.topMargin: 10
|
||||
|
||||
@@ -213,9 +213,27 @@ Rectangle {
|
||||
MoneroComponents.LineEdit {
|
||||
id: sendCommandText
|
||||
Layout.fillWidth: true
|
||||
property var lastCommands: []
|
||||
property int currentCommandIndex
|
||||
fontBold: false
|
||||
placeholderText: qsTr("command + enter (e.g 'help' or 'status')") + translationManager.emptyString
|
||||
placeholderFontSize: 16
|
||||
Keys.onUpPressed: {
|
||||
if (currentCommandIndex != 0) {
|
||||
sendCommandText.text = lastCommands[currentCommandIndex - 1]
|
||||
currentCommandIndex = currentCommandIndex - 1
|
||||
}
|
||||
}
|
||||
Keys.onDownPressed: {
|
||||
if (currentCommandIndex == lastCommands.length - 1) {
|
||||
currentCommandIndex = lastCommands.length;
|
||||
return text = "";
|
||||
}
|
||||
if (currentCommandIndex != lastCommands.length) {
|
||||
sendCommandText.text = lastCommands[currentCommandIndex + 1]
|
||||
currentCommandIndex = currentCommandIndex + 1
|
||||
}
|
||||
}
|
||||
onAccepted: {
|
||||
if(text.length > 0) {
|
||||
consoleArea.logCommand(">>> " + text)
|
||||
@@ -225,6 +243,8 @@ Rectangle {
|
||||
}
|
||||
});
|
||||
}
|
||||
lastCommands.push(text);
|
||||
currentCommandIndex = lastCommands.length;
|
||||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ Rectangle{
|
||||
MouseArea {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
enabled: persistentSettings.useRemoteNode
|
||||
onClicked: {
|
||||
persistentSettings.useRemoteNode = false;
|
||||
appWindow.disconnectRemoteNode();
|
||||
@@ -227,6 +228,7 @@ Rectangle{
|
||||
MouseArea {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
enabled: !persistentSettings.useRemoteNode
|
||||
onClicked: {
|
||||
appWindow.connectRemoteNode();
|
||||
}
|
||||
@@ -268,9 +270,7 @@ Rectangle{
|
||||
daemonAddrLabelText: qsTr("Address") + translationManager.emptyString
|
||||
daemonPortLabelText: qsTr("Port") + translationManager.emptyString
|
||||
|
||||
property var rna: persistentSettings.remoteNodeAddress
|
||||
daemonAddrText: rna.search(":") != -1 ? rna.split(":")[0].trim() : ""
|
||||
daemonPortText: rna.search(":") != -1 ? (rna.split(":")[1].trim() == "") ? appWindow.getDefaultDaemonRpcPort(persistentSettings.nettype) : rna.split(":")[1] : ""
|
||||
initialAddress: persistentSettings.remoteNodeAddress
|
||||
onEditingFinished: {
|
||||
persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress();
|
||||
console.log("setting remote node to " + persistentSettings.remoteNodeAddress);
|
||||
@@ -419,15 +419,7 @@ Rectangle{
|
||||
|
||||
daemonAddrLabelText: qsTr("Bootstrap Address") + translationManager.emptyString
|
||||
daemonPortLabelText: qsTr("Bootstrap Port") + translationManager.emptyString
|
||||
daemonAddrText: persistentSettings.bootstrapNodeAddress.split(":")[0].trim()
|
||||
daemonPortText: {
|
||||
var node_split = persistentSettings.bootstrapNodeAddress.split(":");
|
||||
if(node_split.length == 2){
|
||||
(node_split[1].trim() == "") ? appWindow.getDefaultDaemonRpcPort(persistentSettings.nettype) : node_split[1];
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
initialAddress: persistentSettings.bootstrapNodeAddress
|
||||
onEditingFinished: {
|
||||
if (daemonAddrText == "auto") {
|
||||
persistentSettings.bootstrapNodeAddress = daemonAddrText;
|
||||
|
||||
@@ -62,7 +62,7 @@ Rectangle {
|
||||
iconText: FontAwesome.eye
|
||||
description: qsTr("Creates a new wallet that can only view and initiate transactions, but requires a spendable wallet to sign transactions before sending.") + translationManager.emptyString
|
||||
title: qsTr("Create a view-only wallet") + translationManager.emptyString
|
||||
visible: !appWindow.viewOnly
|
||||
visible: !appWindow.viewOnly && (currentWallet ? !currentWallet.isLedger() : true)
|
||||
|
||||
onClicked: {
|
||||
var newPath = currentWallet.path + "_viewonly";
|
||||
|
||||
6
qml.qrc
6
qml.qrc
@@ -4,6 +4,7 @@
|
||||
<file>LeftPanel.qml</file>
|
||||
<file>MiddlePanel.qml</file>
|
||||
<file>components/Label.qml</file>
|
||||
<file>components/LanguageButton.qml</file>
|
||||
<file>components/SettingsListItem.qml</file>
|
||||
<file>components/Slider.qml</file>
|
||||
<file>components/UpdateDialog.qml</file>
|
||||
@@ -87,7 +88,6 @@
|
||||
<file>lang/flags/ua.png</file>
|
||||
<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>
|
||||
@@ -241,5 +241,9 @@
|
||||
<file>components/AdvancedOptionsItem.qml</file>
|
||||
<file>images/busy-indicator.png</file>
|
||||
<file>images/busy-indicator@2x.png</file>
|
||||
<file>images/success.png</file>
|
||||
<file>images/success@2x.png</file>
|
||||
<file>components/SuccessfulTxDialog.qml</file>
|
||||
<file>components/TxConfirmationDialog.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
add_subdirectory(QR-Code-generator)
|
||||
add_subdirectory(QR-Code-scanner)
|
||||
add_subdirectory(daemon)
|
||||
add_subdirectory(libwalletqt)
|
||||
@@ -22,9 +21,6 @@ file(GLOB SOURCE_FILES
|
||||
"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"
|
||||
@@ -36,21 +32,21 @@ file(GLOB SOURCE_FILES
|
||||
"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"
|
||||
"daemon/*.h"
|
||||
"daemon/*.cpp"
|
||||
"model/*.h"
|
||||
"model/*.cpp"
|
||||
"qt/*.h"
|
||||
"qt/*.cpp"
|
||||
)
|
||||
if(APPLE)
|
||||
list(APPEND SOURCE_FILES "qt/macoshelper.mm")
|
||||
endif()
|
||||
|
||||
if(ENABLE_PASS_STRENGTH_METER)
|
||||
file(GLOB PASS_STRENGTH_FILES
|
||||
@@ -61,8 +57,6 @@ 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"
|
||||
)
|
||||
@@ -76,17 +70,36 @@ if(MINGW)
|
||||
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})
|
||||
find_program(Qt5_WINDRES_EXECUTABLE NAMES windres x86_64-w64-mingw32-windres REQUIRED CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
add_custom_command(OUTPUT ${ICON_RES} COMMAND ${Qt5_WINDRES_EXECUTABLE} ${ICON_RC} ${ICON_RES} MAIN_DEPENDENCY ${ICON_RC})
|
||||
list(APPEND RESOURCES ${ICON_RES})
|
||||
endif()
|
||||
|
||||
add_executable(monero-wallet-gui ${EXECUTABLE_FLAG} main/main.cpp
|
||||
if(APPLE)
|
||||
set(ICON ${PROJECT_SOURCE_DIR}/images/appicon.icns)
|
||||
set_source_files_properties(${ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
list(APPEND RESOURCES ${ICON})
|
||||
endif()
|
||||
|
||||
set(monero_wallet_gui_sources
|
||||
${SOURCE_FILES}
|
||||
${PASS_STRENGTH_FILES}
|
||||
${QR_CODE_FILES}
|
||||
${RESOURCES}
|
||||
)
|
||||
set_property(TARGET monero-wallet-gui PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
|
||||
if(NOT ANDROID)
|
||||
add_executable(monero-wallet-gui ${EXECUTABLE_FLAG} ${monero_wallet_gui_sources})
|
||||
else()
|
||||
add_library(monero-wallet-gui SHARED ${monero_wallet_gui_sources})
|
||||
set_target_properties(monero-wallet-gui PROPERTIES COMPILE_DEFINITIONS "ANDROID")
|
||||
endif()
|
||||
|
||||
set_target_properties(monero-wallet-gui PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||
MACOSX_BUNDLE TRUE
|
||||
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/share/Info.plist"
|
||||
)
|
||||
|
||||
# OpenGL
|
||||
target_include_directories(monero-wallet-gui PUBLIC ${OPENGL_INCLUDE_DIR})
|
||||
@@ -103,11 +116,11 @@ target_include_directories(monero-wallet-gui PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/monero/src
|
||||
${CMAKE_SOURCE_DIR}/monero/external/easylogging++
|
||||
${CMAKE_SOURCE_DIR}/monero/contrib/epee/include
|
||||
${CMAKE_SOURCE_DIR}/monero/external/qrcodegen
|
||||
${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}
|
||||
@@ -126,24 +139,17 @@ target_compile_definitions(monero-wallet-gui
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
|
||||
|
||||
if(X11_FOUND)
|
||||
target_link_libraries(monero-wallet-gui ${X11_LIBRARIES} pthread dl Xt xcb X11)
|
||||
endif()
|
||||
|
||||
if(DEVICE_TREZOR_READY)
|
||||
target_link_libraries(monero-wallet-gui ${TREZOR_DEP_LIBS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(monero-wallet-gui
|
||||
${CMAKE_BINARY_DIR}/lib/libwallet_merged.a
|
||||
wallet_merged
|
||||
${LMDB_LIBRARY}
|
||||
${CMAKE_BINARY_DIR}/monero/contrib/epee/src/libepee.a
|
||||
${CMAKE_BINARY_DIR}/monero/external/unbound/libunbound.a
|
||||
epee
|
||||
qrcodegen
|
||||
${UNBOUND_LIBRARY}
|
||||
${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
|
||||
easylogging
|
||||
blockchain_db
|
||||
randomx
|
||||
hardforks
|
||||
${Boost_LIBRARIES}
|
||||
${OPENSSL_LIBRARIES}
|
||||
${CMAKE_DL_LIBS}
|
||||
@@ -153,18 +159,35 @@ target_link_libraries(monero-wallet-gui
|
||||
${EXTRA_LIBRARIES}
|
||||
${ICU_LIBRARIES}
|
||||
openpgp
|
||||
translations
|
||||
)
|
||||
|
||||
if(WITH_SCANNER)
|
||||
target_link_libraries(monero-wallet-gui
|
||||
${ZBAR_LIBRARIES}
|
||||
jpeg
|
||||
v4l2
|
||||
v4lconvert
|
||||
rt
|
||||
)
|
||||
if(DEVICE_TREZOR_READY)
|
||||
target_link_libraries(monero-wallet-gui ${TREZOR_DEP_LIBS})
|
||||
endif()
|
||||
|
||||
if(X11_FOUND)
|
||||
target_link_libraries(monero-wallet-gui ${X11_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WITH_SCANNER)
|
||||
if(NOT ANDROID)
|
||||
target_link_libraries(monero-wallet-gui
|
||||
${ZBAR_LIBRARIES}
|
||||
jpeg
|
||||
v4l2
|
||||
v4lconvert
|
||||
rt
|
||||
)
|
||||
else()
|
||||
target_link_libraries(monero-wallet-gui ${ZBAR_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET monero-wallet-gui POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:daemon> $<TARGET_FILE_DIR:monero-wallet-gui>)
|
||||
|
||||
include(Deploy)
|
||||
|
||||
install(TARGETS monero-wallet-gui
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}
|
||||
DESTINATION bin
|
||||
)
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
// 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.
|
||||
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) 2016 Project Nayuki
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* (MIT License)
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include "BitBuffer.hpp"
|
||||
|
||||
|
||||
qrcodegen::BitBuffer::BitBuffer() :
|
||||
data(),
|
||||
bitLength(0) {}
|
||||
|
||||
|
||||
int qrcodegen::BitBuffer::getBitLength() const {
|
||||
return bitLength;
|
||||
}
|
||||
|
||||
|
||||
std::vector<uint8_t> qrcodegen::BitBuffer::getBytes() const {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
void qrcodegen::BitBuffer::appendBits(uint32_t val, int len) {
|
||||
if (len < 0 || len > 32 || (len < 32 && (val >> len) != 0))
|
||||
throw "Value out of range";
|
||||
size_t newBitLen = bitLength + len;
|
||||
while (data.size() * 8 < newBitLen)
|
||||
data.push_back(0);
|
||||
for (int i = len - 1; i >= 0; i--, bitLength++) // Append bit by bit
|
||||
data.at(bitLength >> 3) |= ((val >> i) & 1) << (7 - (bitLength & 7));
|
||||
}
|
||||
|
||||
|
||||
void qrcodegen::BitBuffer::appendData(const QrSegment &seg) {
|
||||
size_t newBitLen = bitLength + seg.bitLength;
|
||||
while (data.size() * 8 < newBitLen)
|
||||
data.push_back(0);
|
||||
for (int i = 0; i < seg.bitLength; i++, bitLength++) { // Append bit by bit
|
||||
int bit = (seg.data.at(i >> 3) >> (7 - (i & 7))) & 1;
|
||||
data.at(bitLength >> 3) |= bit << (7 - (bitLength & 7));
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
// 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.
|
||||
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) 2016 Project Nayuki
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* (MIT License)
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include "QrSegment.hpp"
|
||||
|
||||
|
||||
namespace qrcodegen {
|
||||
|
||||
/*
|
||||
* An appendable sequence of bits. Bits are packed in big endian within a byte.
|
||||
*/
|
||||
class BitBuffer final {
|
||||
|
||||
/*---- Fields ----*/
|
||||
private:
|
||||
|
||||
std::vector<uint8_t> data;
|
||||
int bitLength;
|
||||
|
||||
|
||||
|
||||
/*---- Constructor ----*/
|
||||
public:
|
||||
|
||||
// Creates an empty bit buffer (length 0).
|
||||
BitBuffer();
|
||||
|
||||
|
||||
|
||||
/*---- Methods ----*/
|
||||
public:
|
||||
|
||||
// Returns the number of bits in the buffer, which is a non-negative value.
|
||||
int getBitLength() const;
|
||||
|
||||
|
||||
// Returns a copy of all bytes, padding up to the nearest byte.
|
||||
std::vector<uint8_t> getBytes() const;
|
||||
|
||||
|
||||
// Appends the given number of bits of the given value to this sequence.
|
||||
// If 0 <= len <= 31, then this requires 0 <= val < 2^len.
|
||||
void appendBits(uint32_t val, int len);
|
||||
|
||||
|
||||
// Appends the data of the given segment to this bit buffer.
|
||||
void appendData(const QrSegment &seg);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
file(GLOB_RECURSE SRC_SOURCES *.cpp)
|
||||
file(GLOB_RECURSE SRC_HEADERS *.h)
|
||||
|
||||
|
||||
@@ -1,644 +0,0 @@
|
||||
// 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.
|
||||
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) 2016 Project Nayuki
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* (MIT License)
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <sstream>
|
||||
#include "BitBuffer.hpp"
|
||||
#include "QrCode.hpp"
|
||||
|
||||
|
||||
qrcodegen::QrCode::Ecc::Ecc(int ord, int fb) :
|
||||
ordinal(ord),
|
||||
formatBits(fb) {}
|
||||
|
||||
|
||||
const qrcodegen::QrCode::Ecc qrcodegen::QrCode::Ecc::LOW (0, 1);
|
||||
const qrcodegen::QrCode::Ecc qrcodegen::QrCode::Ecc::MEDIUM (1, 0);
|
||||
const qrcodegen::QrCode::Ecc qrcodegen::QrCode::Ecc::QUARTILE(2, 3);
|
||||
const qrcodegen::QrCode::Ecc qrcodegen::QrCode::Ecc::HIGH (3, 2);
|
||||
|
||||
|
||||
qrcodegen::QrCode qrcodegen::QrCode::encodeText(const char *text, const Ecc &ecl) {
|
||||
std::vector<QrSegment> segs(QrSegment::makeSegments(text));
|
||||
return encodeSegments(segs, ecl);
|
||||
}
|
||||
|
||||
|
||||
qrcodegen::QrCode qrcodegen::QrCode::encodeBinary(const std::vector<uint8_t> &data, const Ecc &ecl) {
|
||||
std::vector<QrSegment> segs;
|
||||
segs.push_back(QrSegment::makeBytes(data));
|
||||
return encodeSegments(segs, ecl);
|
||||
}
|
||||
|
||||
|
||||
qrcodegen::QrCode qrcodegen::QrCode::encodeSegments(const std::vector<QrSegment> &segs, const Ecc &ecl,
|
||||
int minVersion, int maxVersion, int mask, bool boostEcl) {
|
||||
if (!(1 <= minVersion && minVersion <= maxVersion && maxVersion <= 40) || mask < -1 || mask > 7)
|
||||
throw "Invalid value";
|
||||
|
||||
// Find the minimal version number to use
|
||||
int version, dataUsedBits;
|
||||
for (version = minVersion; ; version++) {
|
||||
int dataCapacityBits = getNumDataCodewords(version, ecl) * 8; // Number of data bits available
|
||||
dataUsedBits = QrSegment::getTotalBits(segs, version);
|
||||
if (dataUsedBits != -1 && dataUsedBits <= dataCapacityBits)
|
||||
break; // This version number is found to be suitable
|
||||
if (version >= maxVersion) // All versions in the range could not fit the given data
|
||||
throw "Data too long";
|
||||
}
|
||||
if (dataUsedBits == -1)
|
||||
throw "Assertion error";
|
||||
|
||||
// Increase the error correction level while the data still fits in the current version number
|
||||
const Ecc *newEcl = &ecl;
|
||||
if (boostEcl) {
|
||||
if (dataUsedBits <= getNumDataCodewords(version, Ecc::MEDIUM ) * 8) newEcl = &Ecc::MEDIUM ;
|
||||
if (dataUsedBits <= getNumDataCodewords(version, Ecc::QUARTILE) * 8) newEcl = &Ecc::QUARTILE;
|
||||
if (dataUsedBits <= getNumDataCodewords(version, Ecc::HIGH ) * 8) newEcl = &Ecc::HIGH ;
|
||||
}
|
||||
|
||||
// Create the data bit string by concatenating all segments
|
||||
int dataCapacityBits = getNumDataCodewords(version, *newEcl) * 8;
|
||||
BitBuffer bb;
|
||||
for (size_t i = 0; i < segs.size(); i++) {
|
||||
const QrSegment &seg(segs.at(i));
|
||||
bb.appendBits(seg.mode.modeBits, 4);
|
||||
bb.appendBits(seg.numChars, seg.mode.numCharCountBits(version));
|
||||
bb.appendData(seg);
|
||||
}
|
||||
|
||||
// Add terminator and pad up to a byte if applicable
|
||||
bb.appendBits(0, std::min(4, dataCapacityBits - bb.getBitLength()));
|
||||
bb.appendBits(0, (8 - bb.getBitLength() % 8) % 8);
|
||||
|
||||
// Pad with alternate bytes until data capacity is reached
|
||||
for (uint8_t padByte = 0xEC; bb.getBitLength() < dataCapacityBits; padByte ^= 0xEC ^ 0x11)
|
||||
bb.appendBits(padByte, 8);
|
||||
if (bb.getBitLength() % 8 != 0)
|
||||
throw "Assertion error";
|
||||
|
||||
// Create the QR Code symbol
|
||||
return QrCode(version, *newEcl, bb.getBytes(), mask);
|
||||
}
|
||||
|
||||
|
||||
qrcodegen::QrCode::QrCode(int ver, const Ecc &ecl, const std::vector<uint8_t> &dataCodewords, int mask) :
|
||||
// Initialize scalar fields
|
||||
version(ver),
|
||||
size(1 <= ver && ver <= 40 ? ver * 4 + 17 : -1), // Avoid signed overflow undefined behavior
|
||||
errorCorrectionLevel(ecl) {
|
||||
|
||||
// Check arguments
|
||||
if (ver < 1 || ver > 40 || mask < -1 || mask > 7)
|
||||
throw "Value out of range";
|
||||
|
||||
std::vector<bool> row(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
modules.push_back(row);
|
||||
isFunction.push_back(row);
|
||||
}
|
||||
|
||||
// Draw function patterns, draw all codewords, do masking
|
||||
drawFunctionPatterns();
|
||||
const std::vector<uint8_t> allCodewords(appendErrorCorrection(dataCodewords));
|
||||
drawCodewords(allCodewords);
|
||||
this->mask = handleConstructorMasking(mask);
|
||||
}
|
||||
|
||||
|
||||
qrcodegen::QrCode::QrCode(const QrCode &qr, int mask) :
|
||||
// Copy scalar fields
|
||||
version(qr.version),
|
||||
size(qr.size),
|
||||
errorCorrectionLevel(qr.errorCorrectionLevel) {
|
||||
|
||||
// Check arguments
|
||||
if (mask < -1 || mask > 7)
|
||||
throw "Mask value out of range";
|
||||
|
||||
// Handle grid fields
|
||||
modules = qr.modules;
|
||||
isFunction = qr.isFunction;
|
||||
|
||||
// Handle masking
|
||||
applyMask(qr.mask); // Undo old mask
|
||||
this->mask = handleConstructorMasking(mask);
|
||||
}
|
||||
|
||||
|
||||
int qrcodegen::QrCode::getMask() const {
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
int qrcodegen::QrCode::getModule(int x, int y) const {
|
||||
if (0 <= x && x < size && 0 <= y && y < size)
|
||||
return modules.at(y).at(x) ? 1 : 0;
|
||||
else
|
||||
return 0; // Infinite white border
|
||||
}
|
||||
|
||||
|
||||
std::string qrcodegen::QrCode::toSvgString(int border) const {
|
||||
if (border < 0)
|
||||
throw "Border must be non-negative";
|
||||
std::ostringstream sb;
|
||||
sb << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||
sb << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
|
||||
sb << "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 ";
|
||||
sb << (size + border * 2) << " " << (size + border * 2) << "\">\n";
|
||||
sb << "\t<rect width=\"100%\" height=\"100%\" fill=\"#FFFFFF\" stroke-width=\"0\"/>\n";
|
||||
sb << "\t<path d=\"";
|
||||
bool head = true;
|
||||
for (int y = -border; y < size + border; y++) {
|
||||
for (int x = -border; x < size + border; x++) {
|
||||
if (getModule(x, y) == 1) {
|
||||
if (head)
|
||||
head = false;
|
||||
else
|
||||
sb << " ";
|
||||
sb << "M" << (x + border) << "," << (y + border) << "h1v1h-1z";
|
||||
}
|
||||
}
|
||||
}
|
||||
sb << "\" fill=\"#000000\" stroke-width=\"0\"/>\n";
|
||||
sb << "</svg>\n";
|
||||
return sb.str();
|
||||
}
|
||||
|
||||
|
||||
void qrcodegen::QrCode::drawFunctionPatterns() {
|
||||
// Draw the horizontal and vertical timing patterns
|
||||
for (int i = 0; i < size; i++) {
|
||||
setFunctionModule(6, i, i % 2 == 0);
|
||||
setFunctionModule(i, 6, i % 2 == 0);
|
||||
}
|
||||
|
||||
// Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules)
|
||||
drawFinderPattern(3, 3);
|
||||
drawFinderPattern(size - 4, 3);
|
||||
drawFinderPattern(3, size - 4);
|
||||
|
||||
// Draw the numerous alignment patterns
|
||||
const std::vector<int> alignPatPos(getAlignmentPatternPositions(version));
|
||||
int numAlign = alignPatPos.size();
|
||||
for (int i = 0; i < numAlign; i++) {
|
||||
for (int j = 0; j < numAlign; j++) {
|
||||
if ((i == 0 && j == 0) || (i == 0 && j == numAlign - 1) || (i == numAlign - 1 && j == 0))
|
||||
continue; // Skip the three finder corners
|
||||
else
|
||||
drawAlignmentPattern(alignPatPos.at(i), alignPatPos.at(j));
|
||||
}
|
||||
}
|
||||
|
||||
// Draw configuration data
|
||||
drawFormatBits(0); // Dummy mask value; overwritten later in the constructor
|
||||
drawVersion();
|
||||
}
|
||||
|
||||
|
||||
void qrcodegen::QrCode::drawFormatBits(int mask) {
|
||||
// Calculate error correction code and pack bits
|
||||
int data = errorCorrectionLevel.formatBits << 3 | mask; // errCorrLvl is uint2, mask is uint3
|
||||
int rem = data;
|
||||
for (int i = 0; i < 10; i++)
|
||||
rem = (rem << 1) ^ ((rem >> 9) * 0x537);
|
||||
data = data << 10 | rem;
|
||||
data ^= 0x5412; // uint15
|
||||
if (data >> 15 != 0)
|
||||
throw "Assertion error";
|
||||
|
||||
// Draw first copy
|
||||
for (int i = 0; i <= 5; i++)
|
||||
setFunctionModule(8, i, ((data >> i) & 1) != 0);
|
||||
setFunctionModule(8, 7, ((data >> 6) & 1) != 0);
|
||||
setFunctionModule(8, 8, ((data >> 7) & 1) != 0);
|
||||
setFunctionModule(7, 8, ((data >> 8) & 1) != 0);
|
||||
for (int i = 9; i < 15; i++)
|
||||
setFunctionModule(14 - i, 8, ((data >> i) & 1) != 0);
|
||||
|
||||
// Draw second copy
|
||||
for (int i = 0; i <= 7; i++)
|
||||
setFunctionModule(size - 1 - i, 8, ((data >> i) & 1) != 0);
|
||||
for (int i = 8; i < 15; i++)
|
||||
setFunctionModule(8, size - 15 + i, ((data >> i) & 1) != 0);
|
||||
setFunctionModule(8, size - 8, true);
|
||||
}
|
||||
|
||||
|
||||
void qrcodegen::QrCode::drawVersion() {
|
||||
if (version < 7)
|
||||
return;
|
||||
|
||||
// Calculate error correction code and pack bits
|
||||
int rem = version; // version is uint6, in the range [7, 40]
|
||||
for (int i = 0; i < 12; i++)
|
||||
rem = (rem << 1) ^ ((rem >> 11) * 0x1F25);
|
||||
int data = version << 12 | rem; // uint18
|
||||
if (data >> 18 != 0)
|
||||
throw "Assertion error";
|
||||
|
||||
// Draw two copies
|
||||
for (int i = 0; i < 18; i++) {
|
||||
bool bit = ((data >> i) & 1) != 0;
|
||||
int a = size - 11 + i % 3, b = i / 3;
|
||||
setFunctionModule(a, b, bit);
|
||||
setFunctionModule(b, a, bit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void qrcodegen::QrCode::drawFinderPattern(int x, int y) {
|
||||
for (int i = -4; i <= 4; i++) {
|
||||
for (int j = -4; j <= 4; j++) {
|
||||
int dist = std::max(std::abs(i), std::abs(j)); // Chebyshev/infinity norm
|
||||
int xx = x + j, yy = y + i;
|
||||
if (0 <= xx && xx < size && 0 <= yy && yy < size)
|
||||
setFunctionModule(xx, yy, dist != 2 && dist != 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void qrcodegen::QrCode::drawAlignmentPattern(int x, int y) {
|
||||
for (int i = -2; i <= 2; i++) {
|
||||
for (int j = -2; j <= 2; j++)
|
||||
setFunctionModule(x + j, y + i, std::max(std::abs(i), std::abs(j)) != 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void qrcodegen::QrCode::setFunctionModule(int x, int y, bool isBlack) {
|
||||
modules.at(y).at(x) = isBlack;
|
||||
isFunction.at(y).at(x) = true;
|
||||
}
|
||||
|
||||
|
||||
std::vector<uint8_t> qrcodegen::QrCode::appendErrorCorrection(const std::vector<uint8_t> &data) const {
|
||||
if (data.size() != static_cast<unsigned int>(getNumDataCodewords(version, errorCorrectionLevel)))
|
||||
throw "Invalid argument";
|
||||
|
||||
// Calculate parameter numbers
|
||||
int numBlocks = NUM_ERROR_CORRECTION_BLOCKS[errorCorrectionLevel.ordinal][version];
|
||||
int totalEcc = NUM_ERROR_CORRECTION_CODEWORDS[errorCorrectionLevel.ordinal][version];
|
||||
if (totalEcc % numBlocks != 0)
|
||||
throw "Assertion error";
|
||||
int blockEccLen = totalEcc / numBlocks;
|
||||
int numShortBlocks = numBlocks - getNumRawDataModules(version) / 8 % numBlocks;
|
||||
int shortBlockLen = getNumRawDataModules(version) / 8 / numBlocks;
|
||||
|
||||
// Split data into blocks and append ECC to each block
|
||||
std::vector<std::vector<uint8_t>> blocks;
|
||||
const ReedSolomonGenerator rs(blockEccLen);
|
||||
for (int i = 0, k = 0; i < numBlocks; i++) {
|
||||
std::vector<uint8_t> dat;
|
||||
dat.insert(dat.begin(), data.begin() + k, data.begin() + (k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1)));
|
||||
k += dat.size();
|
||||
const std::vector<uint8_t> ecc(rs.getRemainder(dat));
|
||||
if (i < numShortBlocks)
|
||||
dat.push_back(0);
|
||||
dat.insert(dat.end(), ecc.begin(), ecc.end());
|
||||
blocks.push_back(dat);
|
||||
}
|
||||
|
||||
// Interleave (not concatenate) the bytes from every block into a single sequence
|
||||
std::vector<uint8_t> result;
|
||||
for (int i = 0; static_cast<unsigned int>(i) < blocks.at(0).size(); i++) {
|
||||
for (int j = 0; static_cast<unsigned int>(j) < blocks.size(); j++) {
|
||||
// Skip the padding byte in short blocks
|
||||
if (i != shortBlockLen - blockEccLen || j >= numShortBlocks)
|
||||
result.push_back(blocks.at(j).at(i));
|
||||
}
|
||||
}
|
||||
if (result.size() != static_cast<unsigned int>(getNumRawDataModules(version) / 8))
|
||||
throw "Assertion error";
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void qrcodegen::QrCode::drawCodewords(const std::vector<uint8_t> &data) {
|
||||
if (data.size() != static_cast<unsigned int>(getNumRawDataModules(version) / 8))
|
||||
throw "Invalid argument";
|
||||
|
||||
size_t i = 0; // Bit index into the data
|
||||
// Do the funny zigzag scan
|
||||
for (int right = size - 1; right >= 1; right -= 2) { // Index of right column in each column pair
|
||||
if (right == 6)
|
||||
right = 5;
|
||||
for (int vert = 0; vert < size; vert++) { // Vertical counter
|
||||
for (int j = 0; j < 2; j++) {
|
||||
int x = right - j; // Actual x coordinate
|
||||
bool upwards = ((right & 2) == 0) ^ (x < 6);
|
||||
int y = upwards ? size - 1 - vert : vert; // Actual y coordinate
|
||||
if (!isFunction.at(y).at(x) && i < data.size() * 8) {
|
||||
modules.at(y).at(x) = ((data.at(i >> 3) >> (7 - (i & 7))) & 1) != 0;
|
||||
i++;
|
||||
}
|
||||
// If there are any remainder bits (0 to 7), they are already
|
||||
// set to 0/false/white when the grid of modules was initialized
|
||||
}
|
||||
}
|
||||
}
|
||||
if (static_cast<unsigned int>(i) != data.size() * 8)
|
||||
throw "Assertion error";
|
||||
}
|
||||
|
||||
|
||||
void qrcodegen::QrCode::applyMask(int mask) {
|
||||
if (mask < 0 || mask > 7)
|
||||
throw "Mask value out of range";
|
||||
for (int y = 0; y < size; y++) {
|
||||
for (int x = 0; x < size; x++) {
|
||||
bool invert;
|
||||
switch (mask) {
|
||||
case 0: invert = (x + y) % 2 == 0; break;
|
||||
case 1: invert = y % 2 == 0; break;
|
||||
case 2: invert = x % 3 == 0; break;
|
||||
case 3: invert = (x + y) % 3 == 0; break;
|
||||
case 4: invert = (x / 3 + y / 2) % 2 == 0; break;
|
||||
case 5: invert = x * y % 2 + x * y % 3 == 0; break;
|
||||
case 6: invert = (x * y % 2 + x * y % 3) % 2 == 0; break;
|
||||
case 7: invert = ((x + y) % 2 + x * y % 3) % 2 == 0; break;
|
||||
default: throw "Assertion error";
|
||||
}
|
||||
modules.at(y).at(x) = modules.at(y).at(x) ^ (invert & !isFunction.at(y).at(x));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int qrcodegen::QrCode::handleConstructorMasking(int mask) {
|
||||
if (mask == -1) { // Automatically choose best mask
|
||||
int32_t minPenalty = INT32_MAX;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
drawFormatBits(i);
|
||||
applyMask(i);
|
||||
int penalty = getPenaltyScore();
|
||||
if (penalty < minPenalty) {
|
||||
mask = i;
|
||||
minPenalty = penalty;
|
||||
}
|
||||
applyMask(i); // Undoes the mask due to XOR
|
||||
}
|
||||
}
|
||||
if (mask < 0 || mask > 7)
|
||||
throw "Assertion error";
|
||||
drawFormatBits(mask); // Overwrite old format bits
|
||||
applyMask(mask); // Apply the final choice of mask
|
||||
return mask; // The caller shall assign this value to the final-declared field
|
||||
}
|
||||
|
||||
|
||||
int qrcodegen::QrCode::getPenaltyScore() const {
|
||||
int result = 0;
|
||||
|
||||
// Adjacent modules in row having same color
|
||||
for (int y = 0; y < size; y++) {
|
||||
bool colorX = modules.at(y).at(0);
|
||||
for (int x = 1, runX = 1; x < size; x++) {
|
||||
if (modules.at(y).at(x) != colorX) {
|
||||
colorX = modules.at(y).at(x);
|
||||
runX = 1;
|
||||
} else {
|
||||
runX++;
|
||||
if (runX == 5)
|
||||
result += PENALTY_N1;
|
||||
else if (runX > 5)
|
||||
result++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Adjacent modules in column having same color
|
||||
for (int x = 0; x < size; x++) {
|
||||
bool colorY = modules.at(0).at(x);
|
||||
for (int y = 1, runY = 1; y < size; y++) {
|
||||
if (modules.at(y).at(x) != colorY) {
|
||||
colorY = modules.at(y).at(x);
|
||||
runY = 1;
|
||||
} else {
|
||||
runY++;
|
||||
if (runY == 5)
|
||||
result += PENALTY_N1;
|
||||
else if (runY > 5)
|
||||
result++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2*2 blocks of modules having same color
|
||||
for (int y = 0; y < size - 1; y++) {
|
||||
for (int x = 0; x < size - 1; x++) {
|
||||
bool color = modules.at(y).at(x);
|
||||
if ( color == modules.at(y).at(x + 1) &&
|
||||
color == modules.at(y + 1).at(x) &&
|
||||
color == modules.at(y + 1).at(x + 1))
|
||||
result += PENALTY_N2;
|
||||
}
|
||||
}
|
||||
|
||||
// Finder-like pattern in rows
|
||||
for (int y = 0; y < size; y++) {
|
||||
for (int x = 0, bits = 0; x < size; x++) {
|
||||
bits = ((bits << 1) & 0x7FF) | (modules.at(y).at(x) ? 1 : 0);
|
||||
if (x >= 10 && (bits == 0x05D || bits == 0x5D0)) // Needs 11 bits accumulated
|
||||
result += PENALTY_N3;
|
||||
}
|
||||
}
|
||||
// Finder-like pattern in columns
|
||||
for (int x = 0; x < size; x++) {
|
||||
for (int y = 0, bits = 0; y < size; y++) {
|
||||
bits = ((bits << 1) & 0x7FF) | (modules.at(y).at(x) ? 1 : 0);
|
||||
if (y >= 10 && (bits == 0x05D || bits == 0x5D0)) // Needs 11 bits accumulated
|
||||
result += PENALTY_N3;
|
||||
}
|
||||
}
|
||||
|
||||
// Balance of black and white modules
|
||||
int black = 0;
|
||||
for (int y = 0; y < size; y++) {
|
||||
for (int x = 0; x < size; x++) {
|
||||
if (modules.at(y).at(x))
|
||||
black++;
|
||||
}
|
||||
}
|
||||
int total = size * size;
|
||||
// Find smallest k such that (45-5k)% <= dark/total <= (55+5k)%
|
||||
for (int k = 0; black*20 < (9-k)*total || black*20 > (11+k)*total; k++)
|
||||
result += PENALTY_N4;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::vector<int> qrcodegen::QrCode::getAlignmentPatternPositions(int ver) {
|
||||
if (ver < 1 || ver > 40)
|
||||
throw "Version number out of range";
|
||||
else if (ver == 1)
|
||||
return std::vector<int>();
|
||||
else {
|
||||
int numAlign = ver / 7 + 2;
|
||||
int step;
|
||||
if (ver != 32)
|
||||
step = (ver * 4 + numAlign * 2 + 1) / (2 * numAlign - 2) * 2; // ceil((size - 13) / (2*numAlign - 2)) * 2
|
||||
else // C-C-C-Combo breaker!
|
||||
step = 26;
|
||||
|
||||
std::vector<int> result;
|
||||
int size = ver * 4 + 17;
|
||||
for (int i = 0, pos = size - 7; i < numAlign - 1; i++, pos -= step)
|
||||
result.insert(result.begin(), pos);
|
||||
result.insert(result.begin(), 6);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int qrcodegen::QrCode::getNumRawDataModules(int ver) {
|
||||
if (ver < 1 || ver > 40)
|
||||
throw "Version number out of range";
|
||||
int result = (16 * ver + 128) * ver + 64;
|
||||
if (ver >= 2) {
|
||||
int numAlign = ver / 7 + 2;
|
||||
result -= (25 * numAlign - 10) * numAlign - 55;
|
||||
if (ver >= 7)
|
||||
result -= 18 * 2; // Subtract version information
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int qrcodegen::QrCode::getNumDataCodewords(int ver, const Ecc &ecl) {
|
||||
if (ver < 1 || ver > 40)
|
||||
throw "Version number out of range";
|
||||
return getNumRawDataModules(ver) / 8 - NUM_ERROR_CORRECTION_CODEWORDS[ecl.ordinal][ver];
|
||||
}
|
||||
|
||||
|
||||
/*---- Tables of constants ----*/
|
||||
|
||||
const int qrcodegen::QrCode::PENALTY_N1 = 3;
|
||||
const int qrcodegen::QrCode::PENALTY_N2 = 3;
|
||||
const int qrcodegen::QrCode::PENALTY_N3 = 40;
|
||||
const int qrcodegen::QrCode::PENALTY_N4 = 10;
|
||||
|
||||
|
||||
const int16_t qrcodegen::QrCode::NUM_ERROR_CORRECTION_CODEWORDS[4][41] = {
|
||||
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
||||
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
||||
{-1, 7, 10, 15, 20, 26, 36, 40, 48, 60, 72, 80, 96, 104, 120, 132, 144, 168, 180, 196, 224, 224, 252, 270, 300, 312, 336, 360, 390, 420, 450, 480, 510, 540, 570, 570, 600, 630, 660, 720, 750}, // Low
|
||||
{-1, 10, 16, 26, 36, 48, 64, 72, 88, 110, 130, 150, 176, 198, 216, 240, 280, 308, 338, 364, 416, 442, 476, 504, 560, 588, 644, 700, 728, 784, 812, 868, 924, 980, 1036, 1064, 1120, 1204, 1260, 1316, 1372}, // Medium
|
||||
{-1, 13, 22, 36, 52, 72, 96, 108, 132, 160, 192, 224, 260, 288, 320, 360, 408, 448, 504, 546, 600, 644, 690, 750, 810, 870, 952, 1020, 1050, 1140, 1200, 1290, 1350, 1440, 1530, 1590, 1680, 1770, 1860, 1950, 2040}, // Quartile
|
||||
{-1, 17, 28, 44, 64, 88, 112, 130, 156, 192, 224, 264, 308, 352, 384, 432, 480, 532, 588, 650, 700, 750, 816, 900, 960, 1050, 1110, 1200, 1260, 1350, 1440, 1530, 1620, 1710, 1800, 1890, 1980, 2100, 2220, 2310, 2430}, // High
|
||||
};
|
||||
|
||||
const int8_t qrcodegen::QrCode::NUM_ERROR_CORRECTION_BLOCKS[4][41] = {
|
||||
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
||||
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
||||
{-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25}, // Low
|
||||
{-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49}, // Medium
|
||||
{-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68}, // Quartile
|
||||
{-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81}, // High
|
||||
};
|
||||
|
||||
|
||||
qrcodegen::QrCode::ReedSolomonGenerator::ReedSolomonGenerator(int degree) :
|
||||
coefficients() {
|
||||
if (degree < 1 || degree > 255)
|
||||
throw "Degree out of range";
|
||||
|
||||
// Start with the monomial x^0
|
||||
coefficients.resize(degree);
|
||||
coefficients.at(degree - 1) = 1;
|
||||
|
||||
// Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}),
|
||||
// drop the highest term, and store the rest of the coefficients in order of descending powers.
|
||||
// Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).
|
||||
int root = 1;
|
||||
for (int i = 0; i < degree; i++) {
|
||||
// Multiply the current product by (x - r^i)
|
||||
for (size_t j = 0; j < coefficients.size(); j++) {
|
||||
coefficients.at(j) = multiply(coefficients.at(j), static_cast<uint8_t>(root));
|
||||
if (j + 1 < coefficients.size())
|
||||
coefficients.at(j) ^= coefficients.at(j + 1);
|
||||
}
|
||||
root = (root << 1) ^ ((root >> 7) * 0x11D); // Multiply by 0x02 mod GF(2^8/0x11D)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::vector<uint8_t> qrcodegen::QrCode::ReedSolomonGenerator::getRemainder(const std::vector<uint8_t> &data) const {
|
||||
// Compute the remainder by performing polynomial division
|
||||
std::vector<uint8_t> result(coefficients.size());
|
||||
for (size_t i = 0; i < data.size(); i++) {
|
||||
uint8_t factor = data.at(i) ^ result.at(0);
|
||||
result.erase(result.begin());
|
||||
result.push_back(0);
|
||||
for (size_t j = 0; j < result.size(); j++)
|
||||
result.at(j) ^= multiply(coefficients.at(j), factor);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
uint8_t qrcodegen::QrCode::ReedSolomonGenerator::multiply(uint8_t x, uint8_t y) {
|
||||
// Russian peasant multiplication
|
||||
int z = 0;
|
||||
for (int i = 7; i >= 0; i--) {
|
||||
z = (z << 1) ^ ((z >> 7) * 0x11D);
|
||||
z ^= ((y >> i) & 1) * x;
|
||||
}
|
||||
if (z >> 8 != 0)
|
||||
throw "Assertion error";
|
||||
return static_cast<uint8_t>(z);
|
||||
}
|
||||
@@ -1,342 +0,0 @@
|
||||
// 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.
|
||||
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) 2016 Project Nayuki
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* (MIT License)
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "QrSegment.hpp"
|
||||
|
||||
|
||||
namespace qrcodegen {
|
||||
|
||||
/*
|
||||
* Represents an immutable square grid of black and white cells for a QR Code symbol, and
|
||||
* provides static functions to create a QR Code from user-supplied textual or binary data.
|
||||
* This class covers the QR Code model 2 specification, supporting all versions (sizes)
|
||||
* from 1 to 40, all 4 error correction levels, and only 3 character encoding modes.
|
||||
*/
|
||||
class QrCode final {
|
||||
|
||||
/*---- Public helper enumeration ----*/
|
||||
public:
|
||||
|
||||
/*
|
||||
* Represents the error correction level used in a QR Code symbol.
|
||||
*/
|
||||
class Ecc final {
|
||||
// Constants declared in ascending order of error protection.
|
||||
public:
|
||||
const static Ecc LOW, MEDIUM, QUARTILE, HIGH;
|
||||
|
||||
// Fields.
|
||||
public:
|
||||
const int ordinal; // (Public) In the range 0 to 3 (unsigned 2-bit integer).
|
||||
const int formatBits; // (Package-private) In the range 0 to 3 (unsigned 2-bit integer).
|
||||
|
||||
// Constructor.
|
||||
private:
|
||||
Ecc(int ord, int fb);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*---- Public static factory functions ----*/
|
||||
public:
|
||||
|
||||
/*
|
||||
* Returns a QR Code symbol representing the given Unicode text string at the given error correction level.
|
||||
* As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer Unicode
|
||||
* code points (not UTF-16 code units). The smallest possible QR Code version is automatically chosen for the output.
|
||||
* The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
||||
*/
|
||||
static QrCode encodeText(const char *text, const Ecc &ecl);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a QR Code symbol representing the given binary data string at the given error correction level.
|
||||
* This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
||||
* bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
|
||||
* The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
||||
*/
|
||||
static QrCode encodeBinary(const std::vector<uint8_t> &data, const Ecc &ecl);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a QR Code symbol representing the specified data segments with the specified encoding parameters.
|
||||
* The smallest possible QR Code version within the specified range is automatically chosen for the output.
|
||||
* This function allows the user to create a custom sequence of segments that switches
|
||||
* between modes (such as alphanumeric and binary) to encode text more efficiently.
|
||||
* This function is considered to be lower level than simply encoding text or binary data.
|
||||
*/
|
||||
static QrCode encodeSegments(const std::vector<QrSegment> &segs, const Ecc &ecl,
|
||||
int minVersion=1, int maxVersion=40, int mask=-1, bool boostEcl=true); // All optional parameters
|
||||
|
||||
|
||||
|
||||
/*---- Instance fields ----*/
|
||||
|
||||
// Public immutable scalar parameters
|
||||
public:
|
||||
|
||||
/* This QR Code symbol's version number, which is always between 1 and 40 (inclusive). */
|
||||
const int version;
|
||||
|
||||
/* The width and height of this QR Code symbol, measured in modules.
|
||||
* Always equal to version × 4 + 17, in the range 21 to 177. */
|
||||
const int size;
|
||||
|
||||
/* The error correction level used in this QR Code symbol. */
|
||||
const Ecc &errorCorrectionLevel;
|
||||
|
||||
/* The mask pattern used in this QR Code symbol, in the range 0 to 7 (i.e. unsigned 3-bit integer).
|
||||
* Note that even if a constructor was called with automatic masking requested
|
||||
* (mask = -1), the resulting object will still have a mask value between 0 and 7. */
|
||||
private:
|
||||
int mask;
|
||||
|
||||
// Private grids of modules/pixels (conceptually immutable)
|
||||
private:
|
||||
std::vector<std::vector<bool>> modules; // The modules of this QR Code symbol (false = white, true = black)
|
||||
std::vector<std::vector<bool>> isFunction; // Indicates function modules that are not subjected to masking
|
||||
|
||||
|
||||
|
||||
/*---- Constructors ----*/
|
||||
public:
|
||||
|
||||
/*
|
||||
* Creates a new QR Code symbol with the given version number, error correction level, binary data array,
|
||||
* and mask number. This is a cumbersome low-level constructor that should not be invoked directly by the user.
|
||||
* To go one level up, see the encodeSegments() function.
|
||||
*/
|
||||
QrCode(int ver, const Ecc &ecl, const std::vector<uint8_t> &dataCodewords, int mask);
|
||||
|
||||
|
||||
/*
|
||||
* Creates a new QR Code symbol based on the given existing object, but with a potentially
|
||||
* different mask pattern. The version, error correction level, codewords, etc. of the newly
|
||||
* created object are all identical to the argument object; only the mask may differ.
|
||||
*/
|
||||
QrCode(const QrCode &qr, int mask);
|
||||
|
||||
|
||||
|
||||
/*---- Public instance methods ----*/
|
||||
public:
|
||||
|
||||
int getMask() const;
|
||||
|
||||
|
||||
/*
|
||||
* Returns the color of the module (pixel) at the given coordinates, which is either 0 for white or 1 for black. The top
|
||||
* left corner has the coordinates (x=0, y=0). If the given coordinates are out of bounds, then 0 (white) is returned.
|
||||
*/
|
||||
int getModule(int x, int y) const;
|
||||
|
||||
|
||||
/*
|
||||
* Based on the given number of border modules to add as padding, this returns a
|
||||
* string whose contents represents an SVG XML file that depicts this QR Code symbol.
|
||||
* Note that Unix newlines (\n) are always used, regardless of the platform.
|
||||
*/
|
||||
std::string toSvgString(int border) const;
|
||||
|
||||
|
||||
|
||||
/*---- Private helper methods for constructor: Drawing function modules ----*/
|
||||
private:
|
||||
|
||||
void drawFunctionPatterns();
|
||||
|
||||
|
||||
// Draws two copies of the format bits (with its own error correction code)
|
||||
// based on the given mask and this object's error correction level field.
|
||||
void drawFormatBits(int mask);
|
||||
|
||||
|
||||
// Draws two copies of the version bits (with its own error correction code),
|
||||
// based on this object's version field (which only has an effect for 7 <= version <= 40).
|
||||
void drawVersion();
|
||||
|
||||
|
||||
// Draws a 9*9 finder pattern including the border separator, with the center module at (x, y).
|
||||
void drawFinderPattern(int x, int y);
|
||||
|
||||
|
||||
// Draws a 5*5 alignment pattern, with the center module at (x, y).
|
||||
void drawAlignmentPattern(int x, int y);
|
||||
|
||||
|
||||
// Sets the color of a module and marks it as a function module.
|
||||
// Only used by the constructor. Coordinates must be in range.
|
||||
void setFunctionModule(int x, int y, bool isBlack);
|
||||
|
||||
|
||||
/*---- Private helper methods for constructor: Codewords and masking ----*/
|
||||
private:
|
||||
|
||||
// Returns a new byte string representing the given data with the appropriate error correction
|
||||
// codewords appended to it, based on this object's version and error correction level.
|
||||
std::vector<uint8_t> appendErrorCorrection(const std::vector<uint8_t> &data) const;
|
||||
|
||||
|
||||
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
||||
// data area of this QR Code symbol. Function modules need to be marked off before this is called.
|
||||
void drawCodewords(const std::vector<uint8_t> &data);
|
||||
|
||||
|
||||
// XORs the data modules in this QR Code with the given mask pattern. Due to XOR's mathematical
|
||||
// properties, calling applyMask(m) twice with the same value is equivalent to no change at all.
|
||||
// This means it is possible to apply a mask, undo it, and try another mask. Note that a final
|
||||
// well-formed QR Code symbol needs exactly one mask applied (not zero, not two, etc.).
|
||||
void applyMask(int mask);
|
||||
|
||||
|
||||
// A messy helper function for the constructors. This QR Code must be in an unmasked state when this
|
||||
// method is called. The given argument is the requested mask, which is -1 for auto or 0 to 7 for fixed.
|
||||
// This method applies and returns the actual mask chosen, from 0 to 7.
|
||||
int handleConstructorMasking(int mask);
|
||||
|
||||
|
||||
// Calculates and returns the penalty score based on state of this QR Code's current modules.
|
||||
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
|
||||
int getPenaltyScore() const;
|
||||
|
||||
|
||||
|
||||
/*---- Private static helper functions ----*/
|
||||
private:
|
||||
|
||||
// Returns a set of positions of the alignment patterns in ascending order. These positions are
|
||||
// used on both the x and y axes. Each value in the resulting array is in the range [0, 177).
|
||||
// This stateless pure function could be implemented as table of 40 variable-length lists of unsigned bytes.
|
||||
static std::vector<int> getAlignmentPatternPositions(int ver);
|
||||
|
||||
|
||||
// Returns the number of raw data modules (bits) available at the given version number.
|
||||
// These data modules are used for both user data codewords and error correction codewords.
|
||||
// This stateless pure function could be implemented as a 40-entry lookup table.
|
||||
static int getNumRawDataModules(int ver);
|
||||
|
||||
|
||||
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
|
||||
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
||||
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
||||
static int getNumDataCodewords(int ver, const Ecc &ecl);
|
||||
|
||||
|
||||
/*---- Private tables of constants ----*/
|
||||
private:
|
||||
|
||||
// For use in getPenaltyScore(), when evaluating which mask is best.
|
||||
static const int PENALTY_N1;
|
||||
static const int PENALTY_N2;
|
||||
static const int PENALTY_N3;
|
||||
static const int PENALTY_N4;
|
||||
|
||||
static const int16_t NUM_ERROR_CORRECTION_CODEWORDS[4][41];
|
||||
static const int8_t NUM_ERROR_CORRECTION_BLOCKS[4][41];
|
||||
|
||||
|
||||
|
||||
/*---- Private helper class ----*/
|
||||
private:
|
||||
|
||||
/*
|
||||
* Computes the Reed-Solomon error correction codewords for a sequence of data codewords
|
||||
* at a given degree. Objects are immutable, and the state only depends on the degree.
|
||||
* This class exists because the divisor polynomial does not need to be recalculated for every input.
|
||||
*/
|
||||
class ReedSolomonGenerator final {
|
||||
|
||||
/*-- Immutable field --*/
|
||||
private:
|
||||
|
||||
// Coefficients of the divisor polynomial, stored from highest to lowest power, excluding the leading term which
|
||||
// is always 1. For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}.
|
||||
std::vector<uint8_t> coefficients;
|
||||
|
||||
|
||||
/*-- Constructor --*/
|
||||
public:
|
||||
|
||||
/*
|
||||
* Creates a Reed-Solomon ECC generator for the given degree. This could be implemented
|
||||
* as a lookup table over all possible parameter values, instead of as an algorithm.
|
||||
*/
|
||||
ReedSolomonGenerator(int degree);
|
||||
|
||||
|
||||
/*-- Method --*/
|
||||
public:
|
||||
|
||||
/*
|
||||
* Computes and returns the Reed-Solomon error correction codewords for the given sequence of data codewords.
|
||||
* The returned object is always a new byte array. This method does not alter this object's state (because it is immutable).
|
||||
*/
|
||||
std::vector<uint8_t> getRemainder(const std::vector<uint8_t> &data) const;
|
||||
|
||||
|
||||
/*-- Static function --*/
|
||||
private:
|
||||
|
||||
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
|
||||
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
|
||||
static uint8_t multiply(uint8_t x, uint8_t y);
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
// 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.
|
||||
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) 2016 Project Nayuki
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* (MIT License)
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include "BitBuffer.hpp"
|
||||
#include "QrSegment.hpp"
|
||||
|
||||
|
||||
qrcodegen::QrSegment::Mode::Mode(int mode, int cc0, int cc1, int cc2) :
|
||||
modeBits(mode) {
|
||||
numBitsCharCount[0] = cc0;
|
||||
numBitsCharCount[1] = cc1;
|
||||
numBitsCharCount[2] = cc2;
|
||||
}
|
||||
|
||||
|
||||
int qrcodegen::QrSegment::Mode::numCharCountBits(int ver) const {
|
||||
if ( 1 <= ver && ver <= 9) return numBitsCharCount[0];
|
||||
else if (10 <= ver && ver <= 26) return numBitsCharCount[1];
|
||||
else if (27 <= ver && ver <= 40) return numBitsCharCount[2];
|
||||
else throw "Version number out of range";
|
||||
}
|
||||
|
||||
|
||||
const qrcodegen::QrSegment::Mode qrcodegen::QrSegment::Mode::NUMERIC (0x1, 10, 12, 14);
|
||||
const qrcodegen::QrSegment::Mode qrcodegen::QrSegment::Mode::ALPHANUMERIC(0x2, 9, 11, 13);
|
||||
const qrcodegen::QrSegment::Mode qrcodegen::QrSegment::Mode::BYTE (0x4, 8, 16, 16);
|
||||
const qrcodegen::QrSegment::Mode qrcodegen::QrSegment::Mode::KANJI (0x8, 8, 10, 12);
|
||||
|
||||
|
||||
|
||||
qrcodegen::QrSegment qrcodegen::QrSegment::makeBytes(const std::vector<uint8_t> &data) {
|
||||
return QrSegment(Mode::BYTE, data.size(), data, data.size() * 8);
|
||||
}
|
||||
|
||||
|
||||
qrcodegen::QrSegment qrcodegen::QrSegment::makeNumeric(const char *digits) {
|
||||
BitBuffer bb;
|
||||
int accumData = 0;
|
||||
int accumCount = 0;
|
||||
int charCount = 0;
|
||||
for (; *digits != '\0'; digits++, charCount++) {
|
||||
char c = *digits;
|
||||
if (c < '0' || c > '9')
|
||||
throw "String contains non-numeric characters";
|
||||
accumData = accumData * 10 + (c - '0');
|
||||
accumCount++;
|
||||
if (accumCount == 3) {
|
||||
bb.appendBits(accumData, 10);
|
||||
accumData = 0;
|
||||
accumCount = 0;
|
||||
}
|
||||
}
|
||||
if (accumCount > 0) // 1 or 2 digits remaining
|
||||
bb.appendBits(accumData, accumCount * 3 + 1);
|
||||
return QrSegment(Mode::NUMERIC, charCount, bb.getBytes(), bb.getBitLength());
|
||||
}
|
||||
|
||||
|
||||
qrcodegen::QrSegment qrcodegen::QrSegment::makeAlphanumeric(const char *text) {
|
||||
BitBuffer bb;
|
||||
int accumData = 0;
|
||||
int accumCount = 0;
|
||||
int charCount = 0;
|
||||
for (; *text != '\0'; text++, charCount++) {
|
||||
char c = *text;
|
||||
if (c < ' ' || c > 'Z')
|
||||
throw "String contains unencodable characters in alphanumeric mode";
|
||||
accumData = accumData * 45 + ALPHANUMERIC_ENCODING_TABLE[c - ' '];
|
||||
accumCount++;
|
||||
if (accumCount == 2) {
|
||||
bb.appendBits(accumData, 11);
|
||||
accumData = 0;
|
||||
accumCount = 0;
|
||||
}
|
||||
}
|
||||
if (accumCount > 0) // 1 character remaining
|
||||
bb.appendBits(accumData, 6);
|
||||
return QrSegment(Mode::ALPHANUMERIC, charCount, bb.getBytes(), bb.getBitLength());
|
||||
}
|
||||
|
||||
|
||||
std::vector<qrcodegen::QrSegment> qrcodegen::QrSegment::makeSegments(const char *text) {
|
||||
// Select the most efficient segment encoding automatically
|
||||
std::vector<QrSegment> result;
|
||||
if (*text == '\0'); // Leave the vector empty
|
||||
else if (QrSegment::isNumeric(text))
|
||||
result.push_back(QrSegment::makeNumeric(text));
|
||||
else if (QrSegment::isAlphanumeric(text))
|
||||
result.push_back(QrSegment::makeAlphanumeric(text));
|
||||
else {
|
||||
std::vector<uint8_t> bytes;
|
||||
for (; *text != '\0'; text++)
|
||||
bytes.push_back(static_cast<uint8_t>(*text));
|
||||
result.push_back(QrSegment::makeBytes(bytes));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
qrcodegen::QrSegment::QrSegment(const Mode &md, int numCh, const std::vector<uint8_t> &b, int bitLen) :
|
||||
mode(md),
|
||||
numChars(numCh),
|
||||
data(b),
|
||||
bitLength(bitLen) {
|
||||
if (numCh < 0 || bitLen < 0 || b.size() != static_cast<unsigned int>((bitLen + 7) / 8))
|
||||
throw "Invalid value";
|
||||
}
|
||||
|
||||
|
||||
int qrcodegen::QrSegment::getTotalBits(const std::vector<QrSegment> &segs, int version) {
|
||||
if (version < 1 || version > 40)
|
||||
throw "Version number out of range";
|
||||
int result = 0;
|
||||
for (size_t i = 0; i < segs.size(); i++) {
|
||||
const QrSegment &seg(segs.at(i));
|
||||
int ccbits = seg.mode.numCharCountBits(version);
|
||||
// Fail if segment length value doesn't fit in the length field's bit-width
|
||||
if (seg.numChars >= (1 << ccbits))
|
||||
return -1;
|
||||
result += 4 + ccbits + seg.bitLength;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool qrcodegen::QrSegment::isAlphanumeric(const char *text) {
|
||||
for (; *text != '\0'; text++) {
|
||||
char c = *text;
|
||||
if (c < ' ' || c > 'Z' || ALPHANUMERIC_ENCODING_TABLE[c - ' '] == -1)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool qrcodegen::QrSegment::isNumeric(const char *text) {
|
||||
for (; *text != '\0'; text++) {
|
||||
char c = *text;
|
||||
if (c < '0' || c > '9')
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const int8_t qrcodegen::QrSegment::ALPHANUMERIC_ENCODING_TABLE[59] = {
|
||||
// SP, !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, :, ;, <, =, >, ?, @, // ASCII codes 32 to 64
|
||||
36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, -1, // Array indices 0 to 32
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, // Array indices 33 to 58
|
||||
// A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, // ASCII codes 65 to 90
|
||||
};
|
||||
@@ -1,198 +0,0 @@
|
||||
// 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.
|
||||
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) 2016 Project Nayuki
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* (MIT License)
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace qrcodegen {
|
||||
|
||||
/*
|
||||
* Represents a character string to be encoded in a QR Code symbol. Each segment has
|
||||
* a mode, and a sequence of characters that is already encoded as a sequence of bits.
|
||||
* Instances of this class are immutable.
|
||||
* This segment class imposes no length restrictions, but QR Codes have restrictions.
|
||||
* Even in the most favorable conditions, a QR Code can only hold 7089 characters of data.
|
||||
* Any segment longer than this is meaningless for the purpose of generating QR Codes.
|
||||
*/
|
||||
class QrSegment final {
|
||||
|
||||
/*---- Public helper enumeration ----*/
|
||||
|
||||
/*
|
||||
* The mode field of a segment. Immutable. Provides methods to retrieve closely related values.
|
||||
*/
|
||||
public:
|
||||
class Mode final {
|
||||
|
||||
/*-- Constants --*/
|
||||
public:
|
||||
|
||||
static const Mode NUMERIC;
|
||||
static const Mode ALPHANUMERIC;
|
||||
static const Mode BYTE;
|
||||
static const Mode KANJI;
|
||||
|
||||
|
||||
/*-- Fields --*/
|
||||
|
||||
/* (Package-private) An unsigned 4-bit integer value (range 0 to 15) representing the mode indicator bits for this mode object. */
|
||||
public:
|
||||
const int modeBits;
|
||||
|
||||
private:
|
||||
int numBitsCharCount[3];
|
||||
|
||||
|
||||
/*-- Constructor --*/
|
||||
|
||||
private:
|
||||
Mode(int mode, int cc0, int cc1, int cc2);
|
||||
|
||||
|
||||
/*-- Method --*/
|
||||
|
||||
/*
|
||||
* (Package-private) Returns the bit width of the segment character count field for this mode object at the given version number.
|
||||
*/
|
||||
public:
|
||||
int numCharCountBits(int ver) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*---- Public static factory functions ----*/
|
||||
public:
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given binary data encoded in byte mode.
|
||||
*/
|
||||
static QrSegment makeBytes(const std::vector<uint8_t> &data);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
||||
*/
|
||||
static QrSegment makeNumeric(const char *digits);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given text string encoded in alphanumeric mode. The characters allowed are:
|
||||
* 0 to 9, A to Z (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
||||
*/
|
||||
static QrSegment makeAlphanumeric(const char *text);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a list of zero or more segments to represent the given text string.
|
||||
* The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
||||
*/
|
||||
static std::vector<QrSegment> makeSegments(const char *text);
|
||||
|
||||
|
||||
/*---- Public static helper functions ----*/
|
||||
public:
|
||||
|
||||
/*
|
||||
* Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
||||
*/
|
||||
static bool isAlphanumeric(const char *text);
|
||||
|
||||
|
||||
/*
|
||||
* Tests whether the given string can be encoded as a segment in numeric mode.
|
||||
*/
|
||||
static bool isNumeric(const char *text);
|
||||
|
||||
|
||||
|
||||
/*---- Instance fields ----*/
|
||||
public:
|
||||
|
||||
/* The mode indicator for this segment. */
|
||||
const Mode mode;
|
||||
|
||||
/* The length of this segment's unencoded data, measured in characters. Always zero or positive. */
|
||||
const int numChars;
|
||||
|
||||
/* The bits of this segment packed into a byte array in big endian. */
|
||||
const std::vector<uint8_t> data;
|
||||
|
||||
/* The length of this segment's encoded data, measured in bits. Satisfies ceil(bitLength / 8) = data.size(). */
|
||||
const int bitLength;
|
||||
|
||||
|
||||
/*---- Constructor ----*/
|
||||
public:
|
||||
|
||||
/*
|
||||
* Creates a new QR Code data segment with the given parameters and data.
|
||||
*/
|
||||
QrSegment(const Mode &md, int numCh, const std::vector<uint8_t> &b, int bitLen);
|
||||
|
||||
|
||||
// Package-private helper function.
|
||||
static int getTotalBits(const std::vector<QrSegment> &segs, int version);
|
||||
|
||||
|
||||
/*---- Private constant ----*/
|
||||
private:
|
||||
|
||||
/* Maps shifted ASCII codes to alphanumeric mode character codes. */
|
||||
static const int8_t ALPHANUMERIC_ENCODING_TABLE[59];
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
QR Code generator library
|
||||
=========================
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
This project aims to provide the best and clearest QR Code generator library. The primary goals are flexible options and absolute correctness. The secondary goals are compact implementation size and good documentation comments.
|
||||
|
||||
Home page with live JavaScript demo and extensive description: [https://www.nayuki.io/page/qr-code-generator-library](https://www.nayuki.io/page/qr-code-generator-library)
|
||||
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
Core features:
|
||||
|
||||
* Available in 4 programming languages, all with nearly equal functionality: Java, JavaScript, Python, C++
|
||||
* Significantly shorter code but more documentation comments compared to competing libraries
|
||||
* Supports encoding all 40 versions (sizes) and all 4 error correction levels, as per the QR Code Model 2 standard
|
||||
* Output formats: Raw modules/pixels of the QR symbol (all languages), SVG XML string (all languages), BufferedImage raster bitmap (Java only)
|
||||
* Encodes numeric and special-alphanumeric text in less space than general text
|
||||
* Open source code under the permissive MIT License
|
||||
|
||||
Manual parameters:
|
||||
|
||||
* User can specify minimum and maximum version numbers allowed, then library will automatically choose smallest version in the range that fits the data
|
||||
* User can specify mask pattern manually, otherwise library will automatically evaluate all 8 masks and select the optimal one
|
||||
* User can specify absolute error correction level, or allow the library to boost it if it doesn't increase the version number
|
||||
|
||||
Optional advanced features (Java only):
|
||||
|
||||
* Encodes Japanese Unicode text in kanji mode to save a lot of space compared to UTF-8 bytes
|
||||
* Computes optimal segment mode switching for text with mixed numeric/alphanumeric/general parts
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Java language:
|
||||
|
||||
import io.nayuki.qrcodegen.*;
|
||||
|
||||
// Simple operation
|
||||
QrCode qr0 = QrCode.encodeText("Hello, world!", QrCode.Ecc.MEDIUM);
|
||||
BufferedImage img = qr0.toImage(4, 10);
|
||||
ImageIO.write(img, "png", new File("qr-code.png"));
|
||||
|
||||
// Manual operation
|
||||
List<QrSegment> segs = QrSegment.makeSegments("3141592653589793238462643383");
|
||||
QrCode qr1 = QrCode.encodeSegments(segs, QrCode.Ecc.HIGH, 5, 5, 2, false);
|
||||
|
||||
JavaScript language:
|
||||
|
||||
// Name abbreviated for the sake of these examples here
|
||||
var QRC = qrcodegen.QrCode;
|
||||
|
||||
// Simple operation
|
||||
var qr0 = QRC.encodeText("Hello, world!", QRC.Ecc.MEDIUM);
|
||||
var svg = qr0.toSvgString(4);
|
||||
|
||||
// Manual operation
|
||||
var segs = qrcodegen.QrSegment.makeSegments("3141592653589793238462643383");
|
||||
var qr1 = QRC.encodeSegments(segs, QRC.Ecc.HIGH, 5, 5, 2, false);
|
||||
|
||||
Python language:
|
||||
|
||||
from qrcodegen import *
|
||||
|
||||
# Simple operation
|
||||
qr0 = QrCode.encode_text("Hello, world!", QrCode.Ecc.MEDIUM)
|
||||
svg = qr0.to_svg_str(4)
|
||||
|
||||
# Manual operation
|
||||
segs = QrSegment.make_segments("3141592653589793238462643383")
|
||||
qr1 = QrCode.encode_segments(segs, QrCode.Ecc.HIGH, 5, 5, 2, False)
|
||||
|
||||
C++ language:
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "QrCode.hpp"
|
||||
using namespace qrcodegen;
|
||||
|
||||
// Simple operation
|
||||
QrCode qr0 = QrCode::encodeText("Hello, world!", QrCode::Ecc::MEDIUM);
|
||||
std::string svg = qr0.toSvgString(4);
|
||||
|
||||
// Manual operation
|
||||
std::vector<QrSegment> segs =
|
||||
QrSegment::makeSegments("3141592653589793238462643383");
|
||||
QrCode qr1 = QrCode::encodeSegments(segs, QrCode::Ecc::HIGH, 5, 5, 2, false);
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Copyright © 2016 Project Nayuki
|
||||
[https://www.nayuki.io/page/qr-code-generator-library](https://www.nayuki.io/page/qr-code-generator-library)
|
||||
|
||||
(MIT License)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
* The Software is provided "as is", without warranty of any kind, express or
|
||||
implied, including but not limited to the warranties of merchantability,
|
||||
fitness for a particular purpose and noninfringement. In no event shall the
|
||||
authors or copyright holders be liable for any claim, damages or other
|
||||
liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
out of or in connection with the Software or the use or other dealings in the
|
||||
Software.
|
||||
@@ -40,7 +40,7 @@ QrCodeScanner::QrCodeScanner(QObject *parent)
|
||||
m_probe = new QVideoProbe(this);
|
||||
m_thread = new QrScanThread(this);
|
||||
m_thread->start();
|
||||
QObject::connect(m_thread, SIGNAL(decoded(int,QString)), this, SLOT(processCode(int,QString)));
|
||||
QObject::connect(m_thread, SIGNAL(decoded(int, QString)), this, SIGNAL(decoded(int, QString)));
|
||||
QObject::connect(m_thread, SIGNAL(notifyError(const QString &, bool)), this, SIGNAL(notifyError(const QString &, bool)));
|
||||
connect(m_probe, SIGNAL(videoFrameProbed(QVideoFrame)), this, SLOT(processFrame(QVideoFrame)));
|
||||
}
|
||||
@@ -48,37 +48,6 @@ void QrCodeScanner::setSource(QCamera *camera)
|
||||
{
|
||||
m_probe->setSource(camera);
|
||||
}
|
||||
void QrCodeScanner::processCode(int type, const QString &data)
|
||||
{
|
||||
if (! m_enabled) return;
|
||||
qDebug() << "decoded - type: " << type << " data: " << data;
|
||||
QString address, payment_id, tx_description, recipient_name, error;
|
||||
QVector<QString> unknown_parameters;
|
||||
uint64_t amount(0);
|
||||
if( ! WalletManager::instance()->parse_uri(data, address, payment_id, amount, tx_description, recipient_name, unknown_parameters, error) )
|
||||
{
|
||||
qDebug() << "Failed to parse_uri : " << error;
|
||||
emit notifyError(error);
|
||||
return;
|
||||
}
|
||||
QVariantMap parsed_unknown_parameters;
|
||||
if(unknown_parameters.size() > 0)
|
||||
{
|
||||
qDebug() << "unknown parameters " << unknown_parameters;
|
||||
foreach(const QString &item, unknown_parameters )
|
||||
{
|
||||
QStringList parsed_item = item.split("=");
|
||||
if(parsed_item.size() == 2) {
|
||||
parsed_unknown_parameters.insert(parsed_item[0], parsed_item[1]);
|
||||
}
|
||||
}
|
||||
emit notifyError(error, true);
|
||||
}
|
||||
qDebug() << "Parsed URI : " << address << " " << payment_id << " " << amount << " " << tx_description << " " << recipient_name << " " << error;
|
||||
QString s_amount = WalletManager::instance()->displayAmount(amount);
|
||||
qDebug() << "Amount passed " << s_amount ;
|
||||
emit decoded(address, payment_id, s_amount, tx_description, recipient_name, parsed_unknown_parameters);
|
||||
}
|
||||
void QrCodeScanner::processFrame(QVideoFrame frame)
|
||||
{
|
||||
if(frame.isValid()){
|
||||
|
||||
@@ -51,13 +51,12 @@ public:
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
public Q_SLOTS:
|
||||
void processCode(int type, const QString &data);
|
||||
void processFrame(QVideoFrame);
|
||||
|
||||
Q_SIGNALS:
|
||||
void enabledChanged();
|
||||
|
||||
void decoded(const QString &address, const QString &payment_id, const QString &amount, const QString &tx_description, const QString &recipient_name, const QVariantMap &extra_parameters);
|
||||
void decoded(int type, const QString &data);
|
||||
void decode(int type, const QString &data);
|
||||
void notifyError(const QString &error, bool warning = false);
|
||||
|
||||
|
||||
@@ -30,13 +30,8 @@
|
||||
#include <QtGlobal>
|
||||
#include <QDebug>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
extern QImage qt_imageFromVideoFrame(const QVideoFrame &f);
|
||||
#else
|
||||
QImage qt_imageFromVideoFrame(const QVideoFrame &f){
|
||||
Q_ASSERT_X(0 != 0, "qt_imageFromVideoFrame", "Should have been managed in .pro");
|
||||
return QImage();
|
||||
}
|
||||
#endif
|
||||
|
||||
QrScanThread::QrScanThread(QObject *parent)
|
||||
@@ -108,7 +103,11 @@ void QrScanThread::processQImage(const QImage &qimg)
|
||||
|
||||
void QrScanThread::processVideoFrame(const QVideoFrame &frame)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
processQImage( qt_imageFromVideoFrame(frame) );
|
||||
#else
|
||||
processQImage(frame.image());
|
||||
#endif
|
||||
}
|
||||
|
||||
void QrScanThread::stop()
|
||||
|
||||
@@ -112,10 +112,14 @@ bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const
|
||||
arguments << "--no-sync";
|
||||
}
|
||||
|
||||
if (!flags.contains("--out-peers", Qt::CaseSensitive) && bootstrapNodeAddress == "auto") {
|
||||
arguments << "--out-peers" << "16";
|
||||
}
|
||||
|
||||
arguments << "--check-updates" << "disabled";
|
||||
|
||||
// --max-concurrency based on threads available. max: 6
|
||||
int32_t concurrency = qBound(1, QThread::idealThreadCount() / 2, 6);
|
||||
// --max-concurrency based on threads available.
|
||||
int32_t concurrency = qMax(1, QThread::idealThreadCount() / 2);
|
||||
|
||||
if(!flags.contains("--max-concurrency", Qt::CaseSensitive)){
|
||||
arguments << "--max-concurrency" << QString::number(concurrency);
|
||||
|
||||
@@ -38,7 +38,7 @@ QImage QRCodeImageProvider::genQrImage(const QString &id, QSize *size)
|
||||
unsigned int black = 0;
|
||||
unsigned int white = 1;
|
||||
unsigned int borderSize = 4;
|
||||
unsigned int imageSize = qrcode.size + (2 * borderSize);
|
||||
unsigned int imageSize = qrcode.getSize() + (2 * borderSize);
|
||||
QImage img = QImage(imageSize, imageSize, QImage::Format_Mono);
|
||||
|
||||
for (unsigned int y = 0; y < imageSize; ++y)
|
||||
|
||||
@@ -61,14 +61,14 @@ quint64 TransactionInfo::atomicAmount() const
|
||||
|
||||
QString TransactionInfo::displayAmount() const
|
||||
{
|
||||
return WalletManager::instance()->displayAmount(m_amount);
|
||||
return WalletManager::displayAmount(m_amount);
|
||||
}
|
||||
|
||||
QString TransactionInfo::fee() const
|
||||
{
|
||||
if(m_fee == 0)
|
||||
return "";
|
||||
return WalletManager::instance()->displayAmount(m_fee);
|
||||
return WalletManager::displayAmount(m_fee);
|
||||
}
|
||||
|
||||
quint64 TransactionInfo::blockHeight() const
|
||||
@@ -132,7 +132,7 @@ QString TransactionInfo::destinations_formatted() const
|
||||
for (auto const& t: m_transfers) {
|
||||
if (!destinations.isEmpty())
|
||||
destinations += "<br> ";
|
||||
destinations += WalletManager::instance()->displayAmount(t->amount()) + ": " + t->address();
|
||||
destinations += WalletManager::displayAmount(t->amount()) + ": " + t->address();
|
||||
}
|
||||
return destinations;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "Wallet.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
|
||||
#include "PendingTransaction.h"
|
||||
#include "UnsignedTransaction.h"
|
||||
#include "TransactionHistory.h"
|
||||
@@ -50,6 +55,8 @@
|
||||
#include <QVector>
|
||||
#include <QMutexLocker>
|
||||
|
||||
#include "qt/ScopeGuard.h"
|
||||
|
||||
namespace {
|
||||
static const int DAEMON_BLOCKCHAIN_HEIGHT_CACHE_TTL_SECONDS = 5;
|
||||
static const int DAEMON_BLOCKCHAIN_TARGET_HEIGHT_CACHE_TTL_SECONDS = 30;
|
||||
@@ -124,6 +131,19 @@ bool Wallet::disconnected() const
|
||||
return m_disconnected;
|
||||
}
|
||||
|
||||
bool Wallet::refreshing() const
|
||||
{
|
||||
return m_refreshing;
|
||||
}
|
||||
|
||||
void Wallet::refreshingSet(bool value)
|
||||
{
|
||||
if (m_refreshing.exchange(value) != value)
|
||||
{
|
||||
emit refreshingChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void Wallet::setConnectionStatus(ConnectionStatus value)
|
||||
{
|
||||
if (m_connectionStatus == value)
|
||||
@@ -144,6 +164,29 @@ void Wallet::setConnectionStatus(ConnectionStatus value)
|
||||
}
|
||||
}
|
||||
|
||||
QString Wallet::getProxyAddress() const
|
||||
{
|
||||
QMutexLocker locker(&m_proxyMutex);
|
||||
return m_proxyAddress;
|
||||
}
|
||||
|
||||
void Wallet::setProxyAddress(QString address)
|
||||
{
|
||||
m_scheduler.run([this, address] {
|
||||
{
|
||||
QMutexLocker locker(&m_proxyMutex);
|
||||
|
||||
if (!m_walletImpl->setProxy(address.toStdString()))
|
||||
{
|
||||
qCritical() << "failed to set proxy" << address;
|
||||
}
|
||||
|
||||
m_proxyAddress = address;
|
||||
}
|
||||
emit proxyAddressChanged();
|
||||
});
|
||||
}
|
||||
|
||||
bool Wallet::synchronized() const
|
||||
{
|
||||
return m_walletImpl->synchronized();
|
||||
@@ -173,7 +216,7 @@ void Wallet::storeAsync(const QJSValue &callback, const QString &path /* = "" */
|
||||
{
|
||||
const auto future = m_scheduler.run(
|
||||
[this, path] {
|
||||
QMutexLocker locker(&m_storeMutex);
|
||||
QMutexLocker locker(&m_asyncMutex);
|
||||
|
||||
return QJSValueList({m_walletImpl->store(path.toStdString())});
|
||||
},
|
||||
@@ -184,7 +227,7 @@ void Wallet::storeAsync(const QJSValue &callback, const QString &path /* = "" */
|
||||
}
|
||||
}
|
||||
|
||||
bool Wallet::init(const QString &daemonAddress, bool trustedDaemon, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight)
|
||||
bool Wallet::init(const QString &daemonAddress, bool trustedDaemon, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight, const QString& proxyAddress)
|
||||
{
|
||||
qDebug() << "init non async";
|
||||
if (isRecovering){
|
||||
@@ -198,7 +241,20 @@ bool Wallet::init(const QString &daemonAddress, bool trustedDaemon, quint64 uppe
|
||||
if (isRecovering || isRecoveringFromDevice) {
|
||||
m_walletImpl->setRefreshFromBlockHeight(restoreHeight);
|
||||
}
|
||||
m_walletImpl->init(daemonAddress.toStdString(), upperTransactionLimit, m_daemonUsername.toStdString(), m_daemonPassword.toStdString());
|
||||
|
||||
{
|
||||
QMutexLocker locker(&m_proxyMutex);
|
||||
|
||||
if (!m_walletImpl->init(daemonAddress.toStdString(), upperTransactionLimit, m_daemonUsername.toStdString(), m_daemonPassword.toStdString(), false, false, proxyAddress.toStdString()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
m_proxyAddress = proxyAddress;
|
||||
}
|
||||
emit proxyAddressChanged();
|
||||
|
||||
setTrustedDaemon(trustedDaemon);
|
||||
return true;
|
||||
}
|
||||
@@ -210,17 +266,24 @@ void Wallet::setDaemonLogin(const QString &daemonUsername, const QString &daemon
|
||||
m_daemonPassword = daemonPassword;
|
||||
}
|
||||
|
||||
void Wallet::initAsync(const QString &daemonAddress, bool trustedDaemon, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight)
|
||||
void Wallet::initAsync(
|
||||
const QString &daemonAddress,
|
||||
bool trustedDaemon /* = false */,
|
||||
quint64 upperTransactionLimit /* = 0 */,
|
||||
bool isRecovering /* = false */,
|
||||
bool isRecoveringFromDevice /* = false */,
|
||||
quint64 restoreHeight /* = 0 */,
|
||||
const QString &proxyAddress /* = "" */)
|
||||
{
|
||||
qDebug() << "initAsync: " + daemonAddress;
|
||||
const auto future = m_scheduler.run([this, daemonAddress, trustedDaemon, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight] {
|
||||
bool success = init(daemonAddress, trustedDaemon, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight);
|
||||
const auto future = m_scheduler.run([this, daemonAddress, trustedDaemon, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight, proxyAddress] {
|
||||
bool success = init(daemonAddress, trustedDaemon, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight, proxyAddress);
|
||||
if (success)
|
||||
{
|
||||
emit walletCreationHeightChanged();
|
||||
qDebug() << "init async finished - starting refresh";
|
||||
connected(true);
|
||||
m_walletImpl->startRefresh();
|
||||
startRefresh();
|
||||
}
|
||||
});
|
||||
if (future.first)
|
||||
@@ -423,41 +486,37 @@ bool Wallet::importKeyImages(const QString& path)
|
||||
return m_walletImpl->importKeyImages(path.toStdString());
|
||||
}
|
||||
|
||||
bool Wallet::refresh()
|
||||
bool Wallet::refresh(bool historyAndSubaddresses /* = true */)
|
||||
{
|
||||
bool result = m_walletImpl->refresh();
|
||||
m_history->refresh(currentSubaddressAccount());
|
||||
m_subaddress->refresh(currentSubaddressAccount());
|
||||
m_subaddressAccount->getAll();
|
||||
if (result)
|
||||
emit updated();
|
||||
return result;
|
||||
refreshingSet(true);
|
||||
const auto cleanup = sg::make_scope_guard([this]() noexcept {
|
||||
refreshingSet(false);
|
||||
});
|
||||
|
||||
{
|
||||
QMutexLocker locker(&m_asyncMutex);
|
||||
|
||||
bool result = m_walletImpl->refresh();
|
||||
if (historyAndSubaddresses)
|
||||
{
|
||||
m_history->refresh(currentSubaddressAccount());
|
||||
m_subaddress->refresh(currentSubaddressAccount());
|
||||
m_subaddressAccount->getAll();
|
||||
}
|
||||
if (result)
|
||||
emit updated();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
void Wallet::refreshAsync()
|
||||
void Wallet::startRefresh()
|
||||
{
|
||||
qDebug() << "refresh async";
|
||||
m_walletImpl->refreshAsync();
|
||||
m_refreshEnabled = true;
|
||||
}
|
||||
|
||||
void Wallet::setAutoRefreshInterval(int seconds)
|
||||
void Wallet::pauseRefresh()
|
||||
{
|
||||
m_walletImpl->setAutoRefreshInterval(seconds);
|
||||
}
|
||||
|
||||
int Wallet::autoRefreshInterval() const
|
||||
{
|
||||
return m_walletImpl->autoRefreshInterval();
|
||||
}
|
||||
|
||||
void Wallet::startRefresh() const
|
||||
{
|
||||
m_walletImpl->startRefresh();
|
||||
}
|
||||
|
||||
void Wallet::pauseRefresh() const
|
||||
{
|
||||
m_walletImpl->pauseRefresh();
|
||||
m_refreshEnabled = false;
|
||||
}
|
||||
|
||||
PendingTransaction *Wallet::createTransaction(const QString &dst_addr, const QString &payment_id,
|
||||
@@ -831,6 +890,8 @@ bool Wallet::parse_uri(const QString &uri, QString &address, QString &payment_id
|
||||
|
||||
bool Wallet::rescanSpent()
|
||||
{
|
||||
QMutexLocker locker(&m_asyncMutex);
|
||||
|
||||
return m_walletImpl->rescanSpent();
|
||||
}
|
||||
|
||||
@@ -998,6 +1059,8 @@ Wallet::Wallet(Monero::Wallet *w, QObject *parent)
|
||||
, m_subaddressModel(nullptr)
|
||||
, m_subaddressAccount(nullptr)
|
||||
, m_subaddressAccountModel(nullptr)
|
||||
, m_refreshEnabled(false)
|
||||
, m_refreshing(false)
|
||||
, m_scheduler(this)
|
||||
{
|
||||
m_history = new TransactionHistory(m_walletImpl->history(), this);
|
||||
@@ -1015,12 +1078,16 @@ Wallet::Wallet(Monero::Wallet *w, QObject *parent)
|
||||
m_connectionStatusRunning = false;
|
||||
m_daemonUsername = "";
|
||||
m_daemonPassword = "";
|
||||
|
||||
startRefreshThread();
|
||||
}
|
||||
|
||||
Wallet::~Wallet()
|
||||
{
|
||||
qDebug("~Wallet: Closing wallet");
|
||||
|
||||
pauseRefresh();
|
||||
m_walletImpl->stop();
|
||||
m_scheduler.shutdownWaitForFinished();
|
||||
|
||||
delete m_addressBook;
|
||||
@@ -1047,3 +1114,32 @@ Wallet::~Wallet()
|
||||
m_walletListener = NULL;
|
||||
qDebug("m_walletImpl deleted");
|
||||
}
|
||||
|
||||
void Wallet::startRefreshThread()
|
||||
{
|
||||
const auto future = m_scheduler.run([this] {
|
||||
constexpr const std::chrono::seconds refreshInterval{10};
|
||||
constexpr const std::chrono::milliseconds intervalResolution{100};
|
||||
|
||||
auto last = std::chrono::steady_clock::now();
|
||||
while (!m_scheduler.stopping())
|
||||
{
|
||||
if (m_refreshEnabled)
|
||||
{
|
||||
const auto now = std::chrono::steady_clock::now();
|
||||
const auto elapsed = now - last;
|
||||
if (elapsed >= refreshInterval)
|
||||
{
|
||||
refresh(false);
|
||||
last = std::chrono::steady_clock::now();
|
||||
}
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(intervalResolution);
|
||||
}
|
||||
});
|
||||
if (!future.first)
|
||||
{
|
||||
throw std::runtime_error("failed to start auto refresh thread");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ class Wallet : public QObject, public PassprasePrompter
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool disconnected READ disconnected NOTIFY disconnectedChanged)
|
||||
Q_PROPERTY(bool refreshing READ refreshing NOTIFY refreshingChanged)
|
||||
Q_PROPERTY(QString seed READ getSeed)
|
||||
Q_PROPERTY(QString seedLanguage READ getSeedLanguage)
|
||||
Q_PROPERTY(Status status READ status)
|
||||
@@ -87,6 +88,7 @@ class Wallet : public QObject, public PassprasePrompter
|
||||
Q_PROPERTY(QString secretSpendKey READ getSecretSpendKey)
|
||||
Q_PROPERTY(QString publicSpendKey READ getPublicSpendKey)
|
||||
Q_PROPERTY(QString daemonLogPath READ getDaemonLogPath CONSTANT)
|
||||
Q_PROPERTY(QString proxyAddress READ getProxyAddress WRITE setProxyAddress NOTIFY proxyAddressChanged)
|
||||
Q_PROPERTY(quint64 walletCreationHeight READ getWalletCreationHeight WRITE setWalletCreationHeight NOTIFY walletCreationHeightChanged)
|
||||
|
||||
public:
|
||||
@@ -149,7 +151,14 @@ public:
|
||||
Q_INVOKABLE void storeAsync(const QJSValue &callback, const QString &path = "");
|
||||
|
||||
//! initializes wallet asynchronously
|
||||
Q_INVOKABLE void initAsync(const QString &daemonAddress, bool trustedDaemon = false, quint64 upperTransactionLimit = 0, bool isRecovering = false, bool isRecoveringFromDevice = false, quint64 restoreHeight = 0);
|
||||
Q_INVOKABLE void initAsync(
|
||||
const QString &daemonAddress,
|
||||
bool trustedDaemon = false,
|
||||
quint64 upperTransactionLimit = 0,
|
||||
bool isRecovering = false,
|
||||
bool isRecoveringFromDevice = false,
|
||||
quint64 restoreHeight = 0,
|
||||
const QString &proxyAddress = "");
|
||||
|
||||
// Set daemon rpc user/pass
|
||||
Q_INVOKABLE void setDaemonLogin(const QString &daemonUsername = "", const QString &daemonPassword = "");
|
||||
@@ -199,20 +208,11 @@ public:
|
||||
Q_INVOKABLE bool importKeyImages(const QString& path);
|
||||
|
||||
//! refreshes the wallet
|
||||
Q_INVOKABLE bool refresh();
|
||||
|
||||
//! refreshes the wallet asynchronously
|
||||
Q_INVOKABLE void refreshAsync();
|
||||
|
||||
//! setup auto-refresh interval in seconds
|
||||
Q_INVOKABLE void setAutoRefreshInterval(int seconds);
|
||||
|
||||
//! return auto-refresh interval in seconds
|
||||
Q_INVOKABLE int autoRefreshInterval() const;
|
||||
Q_INVOKABLE bool refresh(bool historyAndSubaddresses = true);
|
||||
|
||||
// pause/resume refresh
|
||||
Q_INVOKABLE void startRefresh() const;
|
||||
Q_INVOKABLE void pauseRefresh() const;
|
||||
Q_INVOKABLE void startRefresh();
|
||||
Q_INVOKABLE void pauseRefresh();
|
||||
|
||||
//! creates transaction
|
||||
Q_INVOKABLE PendingTransaction * createTransaction(const QString &dst_addr, const QString &payment_id,
|
||||
@@ -385,6 +385,8 @@ signals:
|
||||
void connectionStatusChanged(int status) const;
|
||||
void currentSubaddressAccountChanged() const;
|
||||
void disconnectedChanged() const;
|
||||
void proxyAddressChanged() const;
|
||||
void refreshingChanged() const;
|
||||
|
||||
private:
|
||||
Wallet(QObject * parent = nullptr);
|
||||
@@ -402,10 +404,22 @@ private:
|
||||
quint64 daemonBlockChainTargetHeight() const;
|
||||
|
||||
//! initializes wallet
|
||||
bool init(const QString &daemonAddress, bool trustedDaemon, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight);
|
||||
bool init(
|
||||
const QString &daemonAddress,
|
||||
bool trustedDaemon,
|
||||
quint64 upperTransactionLimit,
|
||||
bool isRecovering,
|
||||
bool isRecoveringFromDevice,
|
||||
quint64 restoreHeight,
|
||||
const QString& proxyAddress);
|
||||
|
||||
bool disconnected() const;
|
||||
bool refreshing() const;
|
||||
void refreshingSet(bool value);
|
||||
void setConnectionStatus(ConnectionStatus value);
|
||||
QString getProxyAddress() const;
|
||||
void setProxyAddress(QString address);
|
||||
void startRefreshThread();
|
||||
|
||||
private:
|
||||
friend class WalletManager;
|
||||
@@ -436,13 +450,17 @@ private:
|
||||
mutable SubaddressModel * m_subaddressModel;
|
||||
SubaddressAccount * m_subaddressAccount;
|
||||
mutable SubaddressAccountModel * m_subaddressAccountModel;
|
||||
QMutex m_asyncMutex;
|
||||
QMutex m_connectionStatusMutex;
|
||||
bool m_connectionStatusRunning;
|
||||
QString m_daemonUsername;
|
||||
QString m_daemonPassword;
|
||||
QString m_proxyAddress;
|
||||
mutable QMutex m_proxyMutex;
|
||||
std::atomic<bool> m_refreshEnabled;
|
||||
std::atomic<bool> m_refreshing;
|
||||
WalletListenerImpl *m_walletListener;
|
||||
FutureScheduler m_scheduler;
|
||||
QMutex m_storeMutex;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -85,17 +85,6 @@ private:
|
||||
PassphraseHelper m_phelper;
|
||||
};
|
||||
|
||||
WalletManager * WalletManager::m_instance = nullptr;
|
||||
|
||||
WalletManager *WalletManager::instance()
|
||||
{
|
||||
if (!m_instance) {
|
||||
m_instance = new WalletManager;
|
||||
}
|
||||
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
Wallet *WalletManager::createWallet(const QString &path, const QString &password,
|
||||
const QString &language, NetworkType::Type nettype, quint64 kdfRounds)
|
||||
{
|
||||
@@ -272,7 +261,7 @@ QString WalletManager::maximumAllowedAmountAsString() const
|
||||
return WalletManager::displayAmount(WalletManager::maximumAllowedAmount());
|
||||
}
|
||||
|
||||
QString WalletManager::displayAmount(quint64 amount) const
|
||||
QString WalletManager::displayAmount(quint64 amount)
|
||||
{
|
||||
return QString::fromStdString(Monero::Wallet::displayAmount(amount));
|
||||
}
|
||||
@@ -415,13 +404,27 @@ QVariantMap WalletManager::parse_uri_to_object(const QString &uri) const
|
||||
if (this->parse_uri(uri, address, payment_id, amount, tx_description, recipient_name, unknown_parameters, error)) {
|
||||
result.insert("address", address);
|
||||
result.insert("payment_id", payment_id);
|
||||
result.insert("amount", amount > 0 ? this->displayAmount(amount) : "");
|
||||
result.insert("amount", amount > 0 ? displayAmount(amount) : "");
|
||||
result.insert("tx_description", tx_description);
|
||||
result.insert("recipient_name", recipient_name);
|
||||
|
||||
QVariantMap extra_parameters;
|
||||
if (unknown_parameters.size() > 0)
|
||||
{
|
||||
for (const QString &item : unknown_parameters)
|
||||
{
|
||||
const auto parsed_item = item.splitRef("=");
|
||||
if (parsed_item.size() == 2)
|
||||
{
|
||||
extra_parameters.insert(parsed_item[0].toString(), parsed_item[1].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
result.insert("extra_parameters", extra_parameters);
|
||||
} else {
|
||||
result.insert("error", error);
|
||||
result.insert("error", !error.isEmpty() ? error : tr("Unknown error"));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -558,3 +561,26 @@ void WalletManager::onPassphraseEntered(const QString &passphrase, bool enter_on
|
||||
m_passphraseReceiver->onPassphraseEntered(passphrase, enter_on_device, entry_abort);
|
||||
}
|
||||
}
|
||||
|
||||
QString WalletManager::proxyAddress() const
|
||||
{
|
||||
QMutexLocker locker(&m_proxyMutex);
|
||||
return m_proxyAddress;
|
||||
}
|
||||
|
||||
void WalletManager::setProxyAddress(QString address)
|
||||
{
|
||||
m_scheduler.run([this, address] {
|
||||
{
|
||||
QMutexLocker locker(&m_proxyMutex);
|
||||
|
||||
if (!m_pimpl->setProxy(address.toStdString()))
|
||||
{
|
||||
qCritical() << "Failed to set proxy address" << address;
|
||||
}
|
||||
|
||||
m_proxyAddress = std::move(address);
|
||||
}
|
||||
emit proxyAddressChanged();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -49,8 +49,12 @@ class WalletManager : public QObject, public PassprasePrompter
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool connected READ connected)
|
||||
Q_PROPERTY(QString proxyAddress READ proxyAddress WRITE setProxyAddress NOTIFY proxyAddressChanged)
|
||||
|
||||
public:
|
||||
explicit WalletManager(QObject *parent = 0);
|
||||
~WalletManager();
|
||||
|
||||
enum LogLevel {
|
||||
LogLevel_Silent = Monero::WalletManagerFactory::LogLevel_Silent,
|
||||
LogLevel_0 = Monero::WalletManagerFactory::LogLevel_0,
|
||||
@@ -62,7 +66,6 @@ public:
|
||||
LogLevel_Max = Monero::WalletManagerFactory::LogLevel_Max,
|
||||
};
|
||||
|
||||
static WalletManager * instance();
|
||||
// wizard: createWallet path;
|
||||
Q_INVOKABLE Wallet * createWallet(const QString &path, const QString &password,
|
||||
const QString &language, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
|
||||
@@ -129,7 +132,7 @@ public:
|
||||
Q_INVOKABLE QString errorString() const;
|
||||
|
||||
//! since we can't call static method from QML, move it to this class
|
||||
Q_INVOKABLE QString displayAmount(quint64 amount) const;
|
||||
Q_INVOKABLE static QString displayAmount(quint64 amount);
|
||||
Q_INVOKABLE quint64 amountFromString(const QString &amount) const;
|
||||
Q_INVOKABLE quint64 amountFromDouble(double amount) const;
|
||||
Q_INVOKABLE quint64 maximumAllowedAmount() const;
|
||||
@@ -189,6 +192,9 @@ public:
|
||||
Q_INVOKABLE void onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort=false);
|
||||
virtual void onWalletPassphraseNeeded(bool on_device) override;
|
||||
|
||||
QString proxyAddress() const;
|
||||
void setProxyAddress(QString address);
|
||||
|
||||
signals:
|
||||
|
||||
void walletOpened(Wallet * wallet);
|
||||
@@ -203,14 +209,12 @@ signals:
|
||||
const QString &firstSigner,
|
||||
const QString &secondSigner) const;
|
||||
void miningStatus(bool isMining) const;
|
||||
void proxyAddressChanged() const;
|
||||
|
||||
public slots:
|
||||
private:
|
||||
friend class WalletPassphraseListenerImpl;
|
||||
|
||||
explicit WalletManager(QObject *parent = 0);
|
||||
~WalletManager();
|
||||
|
||||
bool isMining() const;
|
||||
|
||||
static WalletManager * m_instance;
|
||||
@@ -219,6 +223,8 @@ private:
|
||||
QPointer<Wallet> m_currentWallet;
|
||||
PassphraseReceiver * m_passphraseReceiver;
|
||||
QMutex m_mutex_passphraseReceiver;
|
||||
QString m_proxyAddress;
|
||||
mutable QMutex m_proxyMutex;
|
||||
FutureScheduler m_scheduler;
|
||||
};
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
// 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 "Logger.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QStandardPaths>
|
||||
#include <QFileInfo>
|
||||
@@ -33,9 +35,11 @@
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
|
||||
#include "Logger.h"
|
||||
#include <easylogging++.h>
|
||||
#include <wallet/api/wallet2_api.h>
|
||||
|
||||
#include "qt/MoneroSettings.h"
|
||||
#include "qt/TailsOS.h"
|
||||
#include "wallet/api/wallet2_api.h"
|
||||
|
||||
// default log path by OS (should be writable)
|
||||
static const QString defaultLogName = "monero-wallet-gui.log";
|
||||
@@ -63,15 +67,21 @@ static const QString defaultLogName = "monero-wallet-gui.log";
|
||||
|
||||
|
||||
// return the absolute path of the logfile and ensure path folder exists
|
||||
const QString getLogPath(const QString logPath)
|
||||
const QString getLogPath(const QString &userDefinedLogFilePath, bool portable)
|
||||
{
|
||||
const QFileInfo fi(logPath);
|
||||
const QFileInfo fi(userDefinedLogFilePath);
|
||||
if (!userDefinedLogFilePath.isEmpty() && !fi.isDir())
|
||||
{
|
||||
return fi.absoluteFilePath();
|
||||
}
|
||||
|
||||
if (portable)
|
||||
{
|
||||
return QDir(MoneroSettings::portableFolderName()).filePath(defaultLogName);
|
||||
}
|
||||
|
||||
if(TailsOS::detect() && TailsOS::usePersistence)
|
||||
return QDir::homePath() + "/Persistent/Monero/logs/" + defaultLogName;
|
||||
|
||||
if(!logPath.isEmpty() && !fi.isDir())
|
||||
return fi.absoluteFilePath();
|
||||
else {
|
||||
QDir appDir(osPath + "/" + appFolder);
|
||||
if(!appDir.exists())
|
||||
@@ -98,3 +108,27 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt
|
||||
}
|
||||
}
|
||||
|
||||
Logger::Logger(QCoreApplication &parent, QString userDefinedLogFilePath)
|
||||
: QObject(&parent)
|
||||
, m_applicationFilePath(parent.applicationFilePath().toStdString())
|
||||
, m_userDefinedLogFilePath(std::move(userDefinedLogFilePath))
|
||||
{
|
||||
el::Configurations c;
|
||||
c.setGlobally(el::ConfigurationType::ToFile, "false");
|
||||
c.setGlobally(el::ConfigurationType::ToStandardOutput, "true");
|
||||
el::Loggers::setDefaultConfigurations(c, true);
|
||||
qInstallMessageHandler(messageHandler);
|
||||
}
|
||||
|
||||
void Logger::resetLogFilePath(bool portable)
|
||||
{
|
||||
m_logFilePath = QDir::toNativeSeparators(getLogPath(m_userDefinedLogFilePath, portable));
|
||||
Monero::Wallet::init(m_applicationFilePath.c_str(), "monero-wallet-gui", m_logFilePath.toStdString(), true);
|
||||
qWarning() << "Logging to" << m_logFilePath;
|
||||
emit logFilePathChanged();
|
||||
}
|
||||
|
||||
QString Logger::logFilePath() const
|
||||
{
|
||||
return m_logFilePath;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,28 @@
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
#pragma once
|
||||
|
||||
const QString getLogPath(const QString logPath);
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message);
|
||||
#include <QCoreApplication>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
#endif // LOGGER_H
|
||||
class Logger : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString logFilePath READ logFilePath NOTIFY logFilePathChanged)
|
||||
|
||||
public:
|
||||
Logger(QCoreApplication &parent, QString userDefinedLogFilePath);
|
||||
|
||||
Q_INVOKABLE void resetLogFilePath(bool portable);
|
||||
QString logFilePath() const;
|
||||
|
||||
signals:
|
||||
void logFilePathChanged() const;
|
||||
|
||||
private:
|
||||
const std::string m_applicationFilePath;
|
||||
QString m_logFilePath;
|
||||
const QString m_userDefinedLogFilePath;
|
||||
};
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#include <QScreen>
|
||||
#include <QRegExp>
|
||||
#include <QThread>
|
||||
|
||||
#include <version.h>
|
||||
|
||||
#include "clipboardAdapter.h"
|
||||
#include "filter.h"
|
||||
#include "oscursor.h"
|
||||
@@ -58,7 +61,6 @@
|
||||
#include "model/SubaddressModel.h"
|
||||
#include "SubaddressAccount.h"
|
||||
#include "model/SubaddressAccountModel.h"
|
||||
#include "wallet/api/wallet2_api.h"
|
||||
#include "Logger.h"
|
||||
#include "MainApp.h"
|
||||
#include "qt/downloader.h"
|
||||
@@ -69,6 +71,7 @@
|
||||
#include "qt/TailsOS.h"
|
||||
#include "qt/KeysFiles.h"
|
||||
#include "qt/MoneroSettings.h"
|
||||
#include "qt/NetworkAccessBlockingFactory.h"
|
||||
|
||||
// IOS exclusions
|
||||
#ifndef Q_OS_IOS
|
||||
@@ -77,6 +80,8 @@
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <QOpenGLContext>
|
||||
#elif defined(Q_OS_MACOS)
|
||||
#include "qt/macoshelper.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_SCANNER
|
||||
@@ -92,13 +97,12 @@
|
||||
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
|
||||
#elif defined(Q_OS_LINUX)
|
||||
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
|
||||
Q_IMPORT_PLUGIN(QXcbGlxIntegrationPlugin);
|
||||
#endif
|
||||
Q_IMPORT_PLUGIN(QSvgIconPlugin)
|
||||
Q_IMPORT_PLUGIN(QGifPlugin)
|
||||
Q_IMPORT_PLUGIN(QICNSPlugin)
|
||||
Q_IMPORT_PLUGIN(QICOPlugin)
|
||||
Q_IMPORT_PLUGIN(QJpegPlugin)
|
||||
Q_IMPORT_PLUGIN(QMngPlugin)
|
||||
Q_IMPORT_PLUGIN(QSvgPlugin)
|
||||
Q_IMPORT_PLUGIN(QTgaPlugin)
|
||||
Q_IMPORT_PLUGIN(QTiffPlugin)
|
||||
@@ -116,6 +120,9 @@ Q_IMPORT_PLUGIN(QQmlDebugServerFactory)
|
||||
Q_IMPORT_PLUGIN(QTcpServerConnectionFactory)
|
||||
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
Q_IMPORT_PLUGIN(QtQmlPlugin)
|
||||
#endif
|
||||
Q_IMPORT_PLUGIN(QtQuick2Plugin)
|
||||
Q_IMPORT_PLUGIN(QtQuickLayoutsPlugin)
|
||||
Q_IMPORT_PLUGIN(QtGraphicalEffectsPlugin)
|
||||
@@ -130,7 +137,9 @@ Q_IMPORT_PLUGIN(QtQuick2PrivateWidgetsPlugin)
|
||||
Q_IMPORT_PLUGIN(QtQuickControls2Plugin)
|
||||
Q_IMPORT_PLUGIN(QtQuickTemplates2Plugin)
|
||||
Q_IMPORT_PLUGIN(QmlXmlListModelPlugin)
|
||||
#ifdef WITH_SCANNER
|
||||
Q_IMPORT_PLUGIN(QMultimediaDeclarativeModule)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -145,11 +154,11 @@ bool isOpenGL = true;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(translations);
|
||||
|
||||
// platform dependant settings
|
||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||
bool isDesktop = true;
|
||||
#elif defined(Q_OS_LINUX)
|
||||
bool isLinux = true;
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
bool isAndroid = true;
|
||||
#elif defined(Q_OS_IOS)
|
||||
@@ -171,8 +180,8 @@ int main(int argc, char *argv[])
|
||||
// disable "QApplication: invalid style override passed" warning
|
||||
if (isDesktop) qputenv("QT_STYLE_OVERRIDE", "fusion");
|
||||
#ifdef Q_OS_LINUX
|
||||
// force platform xcb
|
||||
if (isDesktop) qputenv("QT_QPA_PLATFORM", "xcb");
|
||||
// platform xcb by default
|
||||
if (isDesktop && qEnvironmentVariableIsEmpty("QT_QPA_PLATFORM")) qputenv("QT_QPA_PLATFORM", "xcb");
|
||||
#endif
|
||||
|
||||
// enable High DPI scaling
|
||||
@@ -181,6 +190,20 @@ int main(int argc, char *argv[])
|
||||
// Turn off colors in monerod log output.
|
||||
qputenv("TERM", "goaway");
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
QDir::setCurrent(QDir(MacOSHelper::bundlePath() + QDir::separator() + "..").canonicalPath());
|
||||
#endif
|
||||
|
||||
if (MoneroSettings::portableConfigExists())
|
||||
{
|
||||
const QString cacheDir(MoneroSettings::portableFolderName() + QDir::separator() + ".cache");
|
||||
if (!qputenv("QML_DISK_CACHE_PATH", cacheDir.toUtf8()))
|
||||
{
|
||||
qCritical() << "Error: failed to set QML disk cache path";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
MainApp app(argc, argv);
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
@@ -249,6 +272,8 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
||||
|
||||
QCommandLineOption disableCheckUpdatesOption("disable-check-updates", "Disable automatic check for updates.");
|
||||
parser.addOption(disableCheckUpdatesOption);
|
||||
QCommandLineOption socksProxyOption("socks5-proxy", "Enable socks5 proxy. Used for remote node connection (advanced mode), updates downloading and fetching price sources.", "address:port");
|
||||
parser.addOption(socksProxyOption);
|
||||
QCommandLineOption testQmlOption("test-qml");
|
||||
testQmlOption.setFlags(QCommandLineOption::HiddenFromHelp);
|
||||
parser.addOption(logPathOption);
|
||||
@@ -258,10 +283,7 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
||||
|
||||
Monero::Utils::onStartup();
|
||||
|
||||
// Log settings
|
||||
const QString logPath = QDir::toNativeSeparators(getLogPath(parser.value(logPathOption)));
|
||||
Monero::Wallet::init(argv[0], "monero-wallet-gui", logPath.toStdString().c_str(), true);
|
||||
qInstallMessageHandler(messageHandler);
|
||||
Logger logger(app, parser.value(logPathOption));
|
||||
|
||||
// loglevel is configured in main.qml. Anything lower than
|
||||
// qWarning is not shown here unless MONERO_LOG_LEVEL env var is set
|
||||
@@ -270,7 +292,6 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
||||
if (logLevelOk && logLevel >= 0 && logLevel <= Monero::WalletManagerFactory::LogLevel_Max){
|
||||
Monero::WalletManagerFactory::setLogLevel(logLevel);
|
||||
}
|
||||
qWarning().noquote() << "app startd" << "(log: " + logPath + ")";
|
||||
|
||||
if (parser.isSet(verifyUpdateOption))
|
||||
{
|
||||
@@ -350,6 +371,9 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
||||
// registering types for QML
|
||||
qmlRegisterType<clipboardAdapter>("moneroComponents.Clipboard", 1, 0, "Clipboard");
|
||||
qmlRegisterType<Downloader>("moneroComponents.Downloader", 1, 0, "Downloader");
|
||||
qmlRegisterType<Network>("moneroComponents.Network", 1, 0, "Network");
|
||||
qmlRegisterType<WalletKeysFilesModel>("moneroComponents.WalletKeysFilesModel", 1, 0, "WalletKeysFilesModel");
|
||||
qmlRegisterType<WalletManager>("moneroComponents.WalletManager", 1, 0, "WalletManager");
|
||||
|
||||
// Temporary Qt.labs.settings replacement
|
||||
qmlRegisterType<MoneroSettings>("moneroComponents.Settings", 1, 0, "MoneroSettings");
|
||||
@@ -363,15 +387,9 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
||||
qmlRegisterUncreatableType<UnsignedTransaction>("moneroComponents.UnsignedTransaction", 1, 0, "UnsignedTransaction",
|
||||
"UnsignedTransaction can't be instantiated directly");
|
||||
|
||||
qmlRegisterUncreatableType<WalletManager>("moneroComponents.WalletManager", 1, 0, "WalletManager",
|
||||
"WalletManager can't be instantiated directly");
|
||||
|
||||
qmlRegisterUncreatableType<TranslationManager>("moneroComponents.TranslationManager", 1, 0, "TranslationManager",
|
||||
"TranslationManager can't be instantiated directly");
|
||||
|
||||
qmlRegisterUncreatableType<WalletKeysFilesModel>("moneroComponents.walletKeysFilesModel", 1, 0, "WalletKeysFilesModel",
|
||||
"walletKeysFilesModel can't be instantiated directly");
|
||||
|
||||
qmlRegisterUncreatableType<TransactionHistoryModel>("moneroComponents.TransactionHistoryModel", 1, 0, "TransactionHistoryModel",
|
||||
"TransactionHistoryModel can't be instantiated directly");
|
||||
|
||||
@@ -418,6 +436,9 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
||||
engine.setNetworkAccessManagerFactory(new NetworkAccessBlockingFactory);
|
||||
#endif
|
||||
OSCursor cursor;
|
||||
engine.rootContext()->setContextProperty("globalCursor", &cursor);
|
||||
OSHelper osHelper;
|
||||
@@ -427,22 +448,18 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
||||
|
||||
engine.rootContext()->setContextProperty("moneroAccountsDir", moneroAccountsDir);
|
||||
|
||||
WalletManager *walletManager = WalletManager::instance();
|
||||
|
||||
engine.rootContext()->setContextProperty("walletManager", walletManager);
|
||||
|
||||
engine.rootContext()->setContextProperty("translationManager", TranslationManager::instance());
|
||||
|
||||
engine.addImageProvider(QLatin1String("qrcode"), new QRCodeImageProvider());
|
||||
|
||||
engine.rootContext()->setContextProperty("logger", &logger);
|
||||
|
||||
engine.rootContext()->setContextProperty("mainApp", &app);
|
||||
|
||||
engine.rootContext()->setContextProperty("IPC", ipc);
|
||||
|
||||
engine.rootContext()->setContextProperty("qtRuntimeVersion", qVersion());
|
||||
|
||||
engine.rootContext()->setContextProperty("walletLogPath", logPath);
|
||||
|
||||
engine.rootContext()->setContextProperty("tailsUsePersistence", TailsOS::usePersistence);
|
||||
|
||||
// Exclude daemon manager from IOS
|
||||
@@ -468,11 +485,6 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
||||
engine.rootContext()->setContextProperty("desktopFolder", desktopFolder);
|
||||
#endif
|
||||
|
||||
// Wallet .keys files model (wizard -> open wallet)
|
||||
WalletKeysFilesModel walletKeysFilesModel(walletManager);
|
||||
engine.rootContext()->setContextProperty("walletKeysFilesModel", &walletKeysFilesModel);
|
||||
engine.rootContext()->setContextProperty("walletKeysFilesModelProxy", &walletKeysFilesModel.proxyModel());
|
||||
|
||||
// Get default account name
|
||||
QString accountName = qgetenv("USER"); // mac/linux
|
||||
if (accountName.isEmpty())
|
||||
@@ -485,6 +497,8 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
||||
engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath());
|
||||
engine.rootContext()->setContextProperty("idealThreadCount", QThread::idealThreadCount());
|
||||
engine.rootContext()->setContextProperty("disableCheckUpdatesFlag", parser.isSet(disableCheckUpdatesOption));
|
||||
engine.rootContext()->setContextProperty("socksProxyFlag", parser.value(socksProxyOption));
|
||||
engine.rootContext()->setContextProperty("socksProxyFlagSet", parser.isSet(socksProxyOption));
|
||||
|
||||
bool builtWithScanner = false;
|
||||
#ifdef WITH_SCANNER
|
||||
@@ -492,8 +506,7 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
||||
#endif
|
||||
engine.rootContext()->setContextProperty("builtWithScanner", builtWithScanner);
|
||||
|
||||
Network network;
|
||||
engine.rootContext()->setContextProperty("Network", &network);
|
||||
engine.rootContext()->setContextProperty("moneroVersion", MONERO_VERSION_FULL);
|
||||
|
||||
// Load main window (context properties needs to be defined obove this line)
|
||||
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user