From 296a8c5aa24e47a159910531339b52c7837d3200 Mon Sep 17 00:00:00 2001 From: Shengguang Xiao Date: Wed, 19 Aug 2020 14:18:57 +0800 Subject: [PATCH 1/3] Remove QT from the codebase --- Makefile.am | 9 - build-aux/m4/defi_qt.m4 | 507 -- configure.ac | 104 +- doc/man/Makefile.am | 4 - src/Makefile.am | 8 - src/qt/Makefile | 9 - src/qt/README.md | 95 - src/qt/addressbookpage.cpp | 333 -- src/qt/addressbookpage.h | 86 - src/qt/addresstablemodel.cpp | 453 -- src/qt/addresstablemodel.h | 105 - src/qt/askpassphrasedialog.cpp | 285 -- src/qt/askpassphrasedialog.h | 53 - src/qt/bantablemodel.cpp | 181 - src/qt/bantablemodel.h | 80 - src/qt/clientmodel.cpp | 283 -- src/qt/clientmodel.h | 120 - src/qt/coincontroldialog.cpp | 730 --- src/qt/coincontroldialog.h | 117 - src/qt/coincontroltreewidget.cpp | 34 - src/qt/coincontroltreewidget.h | 22 - src/qt/csvmodelwriter.cpp | 91 - src/qt/csvmodelwriter.h | 46 - src/qt/defi.cpp | 596 --- src/qt/defi.h | 123 - src/qt/defi.qrc | 86 - src/qt/defi_locale.qrc | 90 - src/qt/defiaddressvalidator.cpp | 97 - src/qt/defiaddressvalidator.h | 35 - src/qt/defiamountfield.cpp | 342 -- src/qt/defiamountfield.h | 84 - src/qt/defigui.cpp | 1471 ------ src/qt/defigui.h | 341 -- src/qt/defistrings.cpp | 192 - src/qt/defiunits.cpp | 232 - src/qt/defiunits.h | 131 - src/qt/editaddressdialog.cpp | 164 - src/qt/editaddressdialog.h | 59 - src/qt/forms/addressbookpage.ui | 166 - src/qt/forms/askpassphrasedialog.ui | 167 - src/qt/forms/coincontroldialog.ui | 489 -- src/qt/forms/debugwindow.ui | 1547 ------ src/qt/forms/editaddressdialog.ui | 112 - src/qt/forms/helpmessagedialog.ui | 189 - src/qt/forms/intro.ui | 293 -- src/qt/forms/modaloverlay.ui | 382 -- src/qt/forms/openuridialog.ui | 118 - src/qt/forms/optionsdialog.ui | 900 ---- src/qt/forms/overviewpage.ui | 541 --- src/qt/forms/receivecoinsdialog.ui | 375 -- src/qt/forms/receiverequestdialog.ui | 168 - src/qt/forms/sendcoinsdialog.ui | 1250 ----- src/qt/forms/sendcoinsentry.ui | 1282 ----- src/qt/forms/signverifymessagedialog.ui | 390 -- src/qt/forms/transactiondescdialog.ui | 74 - src/qt/guiconstants.h | 52 - src/qt/guiutil.cpp | 964 ---- src/qt/guiutil.h | 270 -- src/qt/intro.cpp | 334 -- src/qt/intro.h | 79 - src/qt/locale/defi_af.ts | 2173 --------- src/qt/locale/defi_af_ZA.ts | 1473 ------ src/qt/locale/defi_am.ts | 451 -- src/qt/locale/defi_ar.ts | 3196 ------------- src/qt/locale/defi_be_BY.ts | 1321 ----- src/qt/locale/defi_bg.ts | 2441 ---------- src/qt/locale/defi_bg_BG.ts | 913 ---- src/qt/locale/defi_ca.ts | 3559 -------------- src/qt/locale/defi_ca@valencia.ts | 2645 ---------- src/qt/locale/defi_ca_ES.ts | 2941 ------------ src/qt/locale/defi_cs.ts | 3675 -------------- src/qt/locale/defi_cy.ts | 1057 ---- src/qt/locale/defi_da.ts | 3667 -------------- src/qt/locale/defi_de.ts | 3668 -------------- src/qt/locale/defi_el.ts | 227 - src/qt/locale/defi_el_GR.ts | 2095 -------- src/qt/locale/defi_en.ts | 4794 ------------------- src/qt/locale/defi_en_GB.ts | 3679 -------------- src/qt/locale/defi_eo.ts | 1961 -------- src/qt/locale/defi_es.ts | 3678 -------------- src/qt/locale/defi_es_AR.ts | 291 -- src/qt/locale/defi_es_CL.ts | 3181 ------------ src/qt/locale/defi_es_CO.ts | 1934 -------- src/qt/locale/defi_es_DO.ts | 1331 ----- src/qt/locale/defi_es_ES.ts | 3185 ------------ src/qt/locale/defi_es_MX.ts | 691 --- src/qt/locale/defi_es_UY.ts | 490 -- src/qt/locale/defi_es_VE.ts | 853 ---- src/qt/locale/defi_et.ts | 2021 -------- src/qt/locale/defi_et_EE.ts | 779 --- src/qt/locale/defi_eu_ES.ts | 847 ---- src/qt/locale/defi_fa.ts | 1957 -------- src/qt/locale/defi_fa_IR.ts | 2415 ---------- src/qt/locale/defi_fi.ts | 3525 -------------- src/qt/locale/defi_fr.ts | 3667 -------------- src/qt/locale/defi_fr_CA.ts | 183 - src/qt/locale/defi_fr_FR.ts | 2314 --------- src/qt/locale/defi_gl.ts | 1103 ----- src/qt/locale/defi_he.ts | 3355 ------------- src/qt/locale/defi_hi_IN.ts | 614 --- src/qt/locale/defi_hr.ts | 3666 -------------- src/qt/locale/defi_hu.ts | 3122 ------------ src/qt/locale/defi_id.ts | 969 ---- src/qt/locale/defi_id_ID.ts | 2137 --------- src/qt/locale/defi_is.ts | 997 ---- src/qt/locale/defi_it.ts | 3636 -------------- src/qt/locale/defi_it_IT.ts | 1081 ----- src/qt/locale/defi_ja.ts | 3668 -------------- src/qt/locale/defi_ka.ts | 1639 ------- src/qt/locale/defi_kk_KZ.ts | 335 -- src/qt/locale/defi_ko.ts | 471 -- src/qt/locale/defi_ko_KR.ts | 3668 -------------- src/qt/locale/defi_ku_IQ.ts | 391 -- src/qt/locale/defi_ky.ts | 359 -- src/qt/locale/defi_la.ts | 851 ---- src/qt/locale/defi_lt.ts | 1367 ------ src/qt/locale/defi_lv_LV.ts | 1279 ----- src/qt/locale/defi_mk_MK.ts | 605 --- src/qt/locale/defi_ml.ts | 336 -- src/qt/locale/defi_mn.ts | 595 --- src/qt/locale/defi_ms_MY.ts | 632 --- src/qt/locale/defi_nb.ts | 3529 -------------- src/qt/locale/defi_ne.ts | 515 -- src/qt/locale/defi_nl.ts | 3679 -------------- src/qt/locale/defi_pam.ts | 811 ---- src/qt/locale/defi_pl.ts | 3678 -------------- src/qt/locale/defi_pt_BR.ts | 3672 -------------- src/qt/locale/defi_pt_PT.ts | 3502 -------------- src/qt/locale/defi_ro.ts | 1319 ----- src/qt/locale/defi_ro_RO.ts | 3659 -------------- src/qt/locale/defi_ru.ts | 499 -- src/qt/locale/defi_ru_RU.ts | 2407 ---------- src/qt/locale/defi_sk.ts | 3676 -------------- src/qt/locale/defi_sl_SI.ts | 1913 -------- src/qt/locale/defi_sn.ts | 367 -- src/qt/locale/defi_sq.ts | 815 ---- src/qt/locale/defi_sr.ts | 1286 ----- src/qt/locale/defi_sr@latin.ts | 733 --- src/qt/locale/defi_sv.ts | 3680 -------------- src/qt/locale/defi_szl.ts | 2123 -------- src/qt/locale/defi_ta.ts | 731 --- src/qt/locale/defi_th_TH.ts | 877 ---- src/qt/locale/defi_tr.ts | 3547 -------------- src/qt/locale/defi_tr_TR.ts | 1518 ------ src/qt/locale/defi_uk.ts | 3657 -------------- src/qt/locale/defi_ur_PK.ts | 315 -- src/qt/locale/defi_uz@Cyrl.ts | 1211 ----- src/qt/locale/defi_vi.ts | 3437 ------------- src/qt/locale/defi_vi_VN.ts | 1250 ----- src/qt/locale/defi_zh.ts | 235 - src/qt/locale/defi_zh_CN.ts | 3643 -------------- src/qt/locale/defi_zh_HK.ts | 709 --- src/qt/locale/defi_zh_TW.ts | 3671 -------------- src/qt/macdockiconhandler.h | 27 - src/qt/macdockiconhandler.mm | 53 - src/qt/macnotificationhandler.h | 27 - src/qt/macnotificationhandler.mm | 62 - src/qt/macos_appnap.h | 24 - src/qt/macos_appnap.mm | 71 - src/qt/main.cpp | 19 - src/qt/modaloverlay.cpp | 180 - src/qt/modaloverlay.h | 51 - src/qt/networkstyle.cpp | 92 - src/qt/networkstyle.h | 33 - src/qt/notificator.cpp | 257 - src/qt/notificator.h | 77 - src/qt/openuridialog.cpp | 50 - src/qt/openuridialog.h | 34 - src/qt/optionsdialog.cpp | 386 -- src/qt/optionsdialog.h | 78 - src/qt/optionsmodel.cpp | 533 --- src/qt/optionsmodel.h | 110 - src/qt/overviewpage.cpp | 274 -- src/qt/overviewpage.h | 64 - src/qt/paymentrequest.proto | 48 - src/qt/paymentrequestplus.cpp | 213 - src/qt/paymentrequestplus.h | 52 - src/qt/paymentserver.cpp | 832 ---- src/qt/paymentserver.h | 160 - src/qt/peertablemodel.cpp | 243 - src/qt/peertablemodel.h | 92 - src/qt/platformstyle.cpp | 137 - src/qt/platformstyle.h | 52 - src/qt/qrimagewidget.cpp | 141 - src/qt/qrimagewidget.h | 45 - src/qt/qvalidatedlineedit.cpp | 123 - src/qt/qvalidatedlineedit.h | 43 - src/qt/qvaluecombobox.cpp | 31 - src/qt/qvaluecombobox.h | 37 - src/qt/receivecoinsdialog.cpp | 305 -- src/qt/receivecoinsdialog.h | 80 - src/qt/receiverequestdialog.cpp | 97 - src/qt/receiverequestdialog.h | 39 - src/qt/recentrequeststablemodel.cpp | 236 - src/qt/recentrequeststablemodel.h | 105 - src/qt/res/defi-qt-res.rc | 38 - src/qt/res/icons/add.png | Bin 784 -> 0 bytes src/qt/res/icons/address-book.png | Bin 1275 -> 0 bytes src/qt/res/icons/chevron.png | Bin 803 -> 0 bytes src/qt/res/icons/clock1.png | Bin 2618 -> 0 bytes src/qt/res/icons/clock2.png | Bin 2398 -> 0 bytes src/qt/res/icons/clock3.png | Bin 2055 -> 0 bytes src/qt/res/icons/clock4.png | Bin 1909 -> 0 bytes src/qt/res/icons/clock5.png | Bin 1659 -> 0 bytes src/qt/res/icons/connect0.png | Bin 2446 -> 0 bytes src/qt/res/icons/connect1.png | Bin 2163 -> 0 bytes src/qt/res/icons/connect2.png | Bin 1927 -> 0 bytes src/qt/res/icons/connect3.png | Bin 1750 -> 0 bytes src/qt/res/icons/connect4.png | Bin 1548 -> 0 bytes src/qt/res/icons/defi.icns | Bin 919273 -> 0 bytes src/qt/res/icons/defi.ico | Bin 57964 -> 0 bytes src/qt/res/icons/defi.png | Bin 312944 -> 0 bytes src/qt/res/icons/defi_testnet.ico | Bin 57251 -> 0 bytes src/qt/res/icons/edit.png | Bin 1847 -> 0 bytes src/qt/res/icons/editcopy.png | Bin 883 -> 0 bytes src/qt/res/icons/editpaste.png | Bin 1024 -> 0 bytes src/qt/res/icons/export.png | Bin 1750 -> 0 bytes src/qt/res/icons/eye.png | Bin 2241 -> 0 bytes src/qt/res/icons/eye_minus.png | Bin 2438 -> 0 bytes src/qt/res/icons/eye_plus.png | Bin 2599 -> 0 bytes src/qt/res/icons/fontbigger.png | Bin 1180 -> 0 bytes src/qt/res/icons/fontsmaller.png | Bin 951 -> 0 bytes src/qt/res/icons/hd_disabled.png | Bin 4328 -> 0 bytes src/qt/res/icons/hd_enabled.png | Bin 1889 -> 0 bytes src/qt/res/icons/history.png | Bin 762 -> 0 bytes src/qt/res/icons/lock_closed.png | Bin 1197 -> 0 bytes src/qt/res/icons/lock_open.png | Bin 1257 -> 0 bytes src/qt/res/icons/network_disabled.png | Bin 2438 -> 0 bytes src/qt/res/icons/overview.png | Bin 1662 -> 0 bytes src/qt/res/icons/proxy.png | Bin 1278 -> 0 bytes src/qt/res/icons/receive.png | Bin 2067 -> 0 bytes src/qt/res/icons/remove.png | Bin 1723 -> 0 bytes src/qt/res/icons/send.png | Bin 1750 -> 0 bytes src/qt/res/icons/synced.png | Bin 1619 -> 0 bytes src/qt/res/icons/transaction0.png | Bin 1310 -> 0 bytes src/qt/res/icons/transaction2.png | Bin 1619 -> 0 bytes src/qt/res/icons/transaction_abandoned.png | Bin 1473 -> 0 bytes src/qt/res/icons/transaction_conflicted.png | Bin 1091 -> 0 bytes src/qt/res/icons/tx_inout.png | Bin 1655 -> 0 bytes src/qt/res/icons/tx_input.png | Bin 1783 -> 0 bytes src/qt/res/icons/tx_mined.png | Bin 1578 -> 0 bytes src/qt/res/icons/tx_output.png | Bin 1771 -> 0 bytes src/qt/res/icons/warning.png | Bin 2801 -> 0 bytes src/qt/res/movies/makespinner.sh | 14 - src/qt/res/movies/spinner-000.png | Bin 1794 -> 0 bytes src/qt/res/movies/spinner-001.png | Bin 2376 -> 0 bytes src/qt/res/movies/spinner-002.png | Bin 2376 -> 0 bytes src/qt/res/movies/spinner-003.png | Bin 2355 -> 0 bytes src/qt/res/movies/spinner-004.png | Bin 2349 -> 0 bytes src/qt/res/movies/spinner-005.png | Bin 2305 -> 0 bytes src/qt/res/movies/spinner-006.png | Bin 2304 -> 0 bytes src/qt/res/movies/spinner-007.png | Bin 2283 -> 0 bytes src/qt/res/movies/spinner-008.png | Bin 2312 -> 0 bytes src/qt/res/movies/spinner-009.png | Bin 1810 -> 0 bytes src/qt/res/movies/spinner-010.png | Bin 2305 -> 0 bytes src/qt/res/movies/spinner-011.png | Bin 2338 -> 0 bytes src/qt/res/movies/spinner-012.png | Bin 2352 -> 0 bytes src/qt/res/movies/spinner-013.png | Bin 2377 -> 0 bytes src/qt/res/movies/spinner-014.png | Bin 2358 -> 0 bytes src/qt/res/movies/spinner-015.png | Bin 2405 -> 0 bytes src/qt/res/movies/spinner-016.png | Bin 2429 -> 0 bytes src/qt/res/movies/spinner-017.png | Bin 2408 -> 0 bytes src/qt/res/movies/spinner-018.png | Bin 1831 -> 0 bytes src/qt/res/movies/spinner-019.png | Bin 2380 -> 0 bytes src/qt/res/movies/spinner-020.png | Bin 2366 -> 0 bytes src/qt/res/movies/spinner-021.png | Bin 2368 -> 0 bytes src/qt/res/movies/spinner-022.png | Bin 2356 -> 0 bytes src/qt/res/movies/spinner-023.png | Bin 2311 -> 0 bytes src/qt/res/movies/spinner-024.png | Bin 2315 -> 0 bytes src/qt/res/movies/spinner-025.png | Bin 2298 -> 0 bytes src/qt/res/movies/spinner-026.png | Bin 2291 -> 0 bytes src/qt/res/movies/spinner-027.png | Bin 1816 -> 0 bytes src/qt/res/movies/spinner-028.png | Bin 2308 -> 0 bytes src/qt/res/movies/spinner-029.png | Bin 2356 -> 0 bytes src/qt/res/movies/spinner-030.png | Bin 2346 -> 0 bytes src/qt/res/movies/spinner-031.png | Bin 2380 -> 0 bytes src/qt/res/movies/spinner-032.png | Bin 2345 -> 0 bytes src/qt/res/movies/spinner-033.png | Bin 2401 -> 0 bytes src/qt/res/movies/spinner-034.png | Bin 2422 -> 0 bytes src/qt/res/movies/spinner-035.png | Bin 2406 -> 0 bytes src/qt/res/src/clock_0.svg | 14 - src/qt/res/src/clock_1.svg | 15 - src/qt/res/src/clock_2.svg | 13 - src/qt/res/src/clock_3.svg | 15 - src/qt/res/src/clock_4.svg | 23 - src/qt/res/src/connect-0.svg | 66 - src/qt/res/src/connect-1.svg | 69 - src/qt/res/src/connect-2.svg | 59 - src/qt/res/src/connect-3.svg | 72 - src/qt/res/src/connect-4.svg | 65 - src/qt/res/src/defi.svg | 58 - src/qt/res/src/hd_disabled.svg | 26 - src/qt/res/src/hd_enabled.svg | 13 - src/qt/res/src/mine.svg | 12 - src/qt/res/src/network_disabled.svg | 49 - src/qt/res/src/proxy.svg | 70 - src/qt/res/src/qt.svg | 26 - src/qt/res/src/spinner.png | Bin 16636 -> 0 bytes src/qt/res/src/transaction0.svg | 35 - src/qt/res/src/tx_in.svg | 9 - src/qt/res/src/tx_inout.svg | 11 - src/qt/rpcconsole.cpp | 1283 ----- src/qt/rpcconsole.h | 175 - src/qt/sendcoinsdialog.cpp | 936 ---- src/qt/sendcoinsdialog.h | 124 - src/qt/sendcoinsentry.cpp | 289 -- src/qt/sendcoinsentry.h | 77 - src/qt/signverifymessagedialog.cpp | 275 -- src/qt/signverifymessagedialog.h | 53 - src/qt/splashscreen.cpp | 226 - src/qt/splashscreen.h | 69 - src/qt/test/Makefile | 6 - src/qt/test/addressbooktests.cpp | 154 - src/qt/test/addressbooktests.h | 15 - src/qt/test/apptests.cpp | 115 - src/qt/test/apptests.h | 50 - src/qt/test/compattests.cpp | 29 - src/qt/test/compattests.h | 19 - src/qt/test/paymentrequestdata.h | 465 -- src/qt/test/paymentservertests.cpp | 217 - src/qt/test/paymentservertests.h | 35 - src/qt/test/rpcnestedtests.cpp | 128 - src/qt/test/rpcnestedtests.h | 19 - src/qt/test/test_main.cpp | 108 - src/qt/test/uritests.cpp | 66 - src/qt/test/uritests.h | 19 - src/qt/test/util.cpp | 19 - src/qt/test/util.h | 14 - src/qt/test/wallettests.cpp | 265 - src/qt/test/wallettests.h | 15 - src/qt/trafficgraphwidget.cpp | 178 - src/qt/trafficgraphwidget.h | 48 - src/qt/transactiondesc.cpp | 334 -- src/qt/transactiondesc.h | 35 - src/qt/transactiondescdialog.cpp | 25 - src/qt/transactiondescdialog.h | 31 - src/qt/transactionfilterproxy.cpp | 121 - src/qt/transactionfilterproxy.h | 68 - src/qt/transactionrecord.cpp | 245 - src/qt/transactionrecord.h | 148 - src/qt/transactiontablemodel.cpp | 760 --- src/qt/transactiontablemodel.h | 123 - src/qt/transactionview.cpp | 653 --- src/qt/transactionview.h | 124 - src/qt/utilitydialog.cpp | 177 - src/qt/utilitydialog.h | 55 - src/qt/walletcontroller.cpp | 162 - src/qt/walletcontroller.h | 91 - src/qt/walletframe.cpp | 215 - src/qt/walletframe.h | 98 - src/qt/walletmodel.cpp | 608 --- src/qt/walletmodel.h | 307 -- src/qt/walletmodeltransaction.cpp | 87 - src/qt/walletmodeltransaction.h | 45 - src/qt/walletview.cpp | 333 -- src/qt/walletview.h | 132 - src/qt/winshutdownmonitor.cpp | 70 - src/qt/winshutdownmonitor.h | 27 - test/lint/lint-circular-dependencies.sh | 12 - 359 files changed, 6 insertions(+), 217714 deletions(-) delete mode 100644 build-aux/m4/defi_qt.m4 delete mode 100644 src/qt/Makefile delete mode 100644 src/qt/README.md delete mode 100644 src/qt/addressbookpage.cpp delete mode 100644 src/qt/addressbookpage.h delete mode 100644 src/qt/addresstablemodel.cpp delete mode 100644 src/qt/addresstablemodel.h delete mode 100644 src/qt/askpassphrasedialog.cpp delete mode 100644 src/qt/askpassphrasedialog.h delete mode 100644 src/qt/bantablemodel.cpp delete mode 100644 src/qt/bantablemodel.h delete mode 100644 src/qt/clientmodel.cpp delete mode 100644 src/qt/clientmodel.h delete mode 100644 src/qt/coincontroldialog.cpp delete mode 100644 src/qt/coincontroldialog.h delete mode 100644 src/qt/coincontroltreewidget.cpp delete mode 100644 src/qt/coincontroltreewidget.h delete mode 100644 src/qt/csvmodelwriter.cpp delete mode 100644 src/qt/csvmodelwriter.h delete mode 100644 src/qt/defi.cpp delete mode 100644 src/qt/defi.h delete mode 100644 src/qt/defi.qrc delete mode 100644 src/qt/defi_locale.qrc delete mode 100644 src/qt/defiaddressvalidator.cpp delete mode 100644 src/qt/defiaddressvalidator.h delete mode 100644 src/qt/defiamountfield.cpp delete mode 100644 src/qt/defiamountfield.h delete mode 100644 src/qt/defigui.cpp delete mode 100644 src/qt/defigui.h delete mode 100644 src/qt/defistrings.cpp delete mode 100644 src/qt/defiunits.cpp delete mode 100644 src/qt/defiunits.h delete mode 100644 src/qt/editaddressdialog.cpp delete mode 100644 src/qt/editaddressdialog.h delete mode 100644 src/qt/forms/addressbookpage.ui delete mode 100644 src/qt/forms/askpassphrasedialog.ui delete mode 100644 src/qt/forms/coincontroldialog.ui delete mode 100644 src/qt/forms/debugwindow.ui delete mode 100644 src/qt/forms/editaddressdialog.ui delete mode 100644 src/qt/forms/helpmessagedialog.ui delete mode 100644 src/qt/forms/intro.ui delete mode 100644 src/qt/forms/modaloverlay.ui delete mode 100644 src/qt/forms/openuridialog.ui delete mode 100644 src/qt/forms/optionsdialog.ui delete mode 100644 src/qt/forms/overviewpage.ui delete mode 100644 src/qt/forms/receivecoinsdialog.ui delete mode 100644 src/qt/forms/receiverequestdialog.ui delete mode 100644 src/qt/forms/sendcoinsdialog.ui delete mode 100644 src/qt/forms/sendcoinsentry.ui delete mode 100644 src/qt/forms/signverifymessagedialog.ui delete mode 100644 src/qt/forms/transactiondescdialog.ui delete mode 100644 src/qt/guiconstants.h delete mode 100644 src/qt/guiutil.cpp delete mode 100644 src/qt/guiutil.h delete mode 100644 src/qt/intro.cpp delete mode 100644 src/qt/intro.h delete mode 100644 src/qt/locale/defi_af.ts delete mode 100644 src/qt/locale/defi_af_ZA.ts delete mode 100644 src/qt/locale/defi_am.ts delete mode 100644 src/qt/locale/defi_ar.ts delete mode 100644 src/qt/locale/defi_be_BY.ts delete mode 100644 src/qt/locale/defi_bg.ts delete mode 100644 src/qt/locale/defi_bg_BG.ts delete mode 100644 src/qt/locale/defi_ca.ts delete mode 100644 src/qt/locale/defi_ca@valencia.ts delete mode 100644 src/qt/locale/defi_ca_ES.ts delete mode 100644 src/qt/locale/defi_cs.ts delete mode 100644 src/qt/locale/defi_cy.ts delete mode 100644 src/qt/locale/defi_da.ts delete mode 100644 src/qt/locale/defi_de.ts delete mode 100644 src/qt/locale/defi_el.ts delete mode 100644 src/qt/locale/defi_el_GR.ts delete mode 100644 src/qt/locale/defi_en.ts delete mode 100644 src/qt/locale/defi_en_GB.ts delete mode 100644 src/qt/locale/defi_eo.ts delete mode 100644 src/qt/locale/defi_es.ts delete mode 100644 src/qt/locale/defi_es_AR.ts delete mode 100644 src/qt/locale/defi_es_CL.ts delete mode 100644 src/qt/locale/defi_es_CO.ts delete mode 100644 src/qt/locale/defi_es_DO.ts delete mode 100644 src/qt/locale/defi_es_ES.ts delete mode 100644 src/qt/locale/defi_es_MX.ts delete mode 100644 src/qt/locale/defi_es_UY.ts delete mode 100644 src/qt/locale/defi_es_VE.ts delete mode 100644 src/qt/locale/defi_et.ts delete mode 100644 src/qt/locale/defi_et_EE.ts delete mode 100644 src/qt/locale/defi_eu_ES.ts delete mode 100644 src/qt/locale/defi_fa.ts delete mode 100644 src/qt/locale/defi_fa_IR.ts delete mode 100644 src/qt/locale/defi_fi.ts delete mode 100644 src/qt/locale/defi_fr.ts delete mode 100644 src/qt/locale/defi_fr_CA.ts delete mode 100644 src/qt/locale/defi_fr_FR.ts delete mode 100644 src/qt/locale/defi_gl.ts delete mode 100644 src/qt/locale/defi_he.ts delete mode 100644 src/qt/locale/defi_hi_IN.ts delete mode 100644 src/qt/locale/defi_hr.ts delete mode 100644 src/qt/locale/defi_hu.ts delete mode 100644 src/qt/locale/defi_id.ts delete mode 100644 src/qt/locale/defi_id_ID.ts delete mode 100644 src/qt/locale/defi_is.ts delete mode 100644 src/qt/locale/defi_it.ts delete mode 100644 src/qt/locale/defi_it_IT.ts delete mode 100644 src/qt/locale/defi_ja.ts delete mode 100644 src/qt/locale/defi_ka.ts delete mode 100644 src/qt/locale/defi_kk_KZ.ts delete mode 100644 src/qt/locale/defi_ko.ts delete mode 100644 src/qt/locale/defi_ko_KR.ts delete mode 100644 src/qt/locale/defi_ku_IQ.ts delete mode 100644 src/qt/locale/defi_ky.ts delete mode 100644 src/qt/locale/defi_la.ts delete mode 100644 src/qt/locale/defi_lt.ts delete mode 100644 src/qt/locale/defi_lv_LV.ts delete mode 100644 src/qt/locale/defi_mk_MK.ts delete mode 100644 src/qt/locale/defi_ml.ts delete mode 100644 src/qt/locale/defi_mn.ts delete mode 100644 src/qt/locale/defi_ms_MY.ts delete mode 100644 src/qt/locale/defi_nb.ts delete mode 100644 src/qt/locale/defi_ne.ts delete mode 100644 src/qt/locale/defi_nl.ts delete mode 100644 src/qt/locale/defi_pam.ts delete mode 100644 src/qt/locale/defi_pl.ts delete mode 100644 src/qt/locale/defi_pt_BR.ts delete mode 100644 src/qt/locale/defi_pt_PT.ts delete mode 100644 src/qt/locale/defi_ro.ts delete mode 100644 src/qt/locale/defi_ro_RO.ts delete mode 100644 src/qt/locale/defi_ru.ts delete mode 100644 src/qt/locale/defi_ru_RU.ts delete mode 100644 src/qt/locale/defi_sk.ts delete mode 100644 src/qt/locale/defi_sl_SI.ts delete mode 100644 src/qt/locale/defi_sn.ts delete mode 100644 src/qt/locale/defi_sq.ts delete mode 100644 src/qt/locale/defi_sr.ts delete mode 100644 src/qt/locale/defi_sr@latin.ts delete mode 100644 src/qt/locale/defi_sv.ts delete mode 100644 src/qt/locale/defi_szl.ts delete mode 100644 src/qt/locale/defi_ta.ts delete mode 100644 src/qt/locale/defi_th_TH.ts delete mode 100644 src/qt/locale/defi_tr.ts delete mode 100644 src/qt/locale/defi_tr_TR.ts delete mode 100644 src/qt/locale/defi_uk.ts delete mode 100644 src/qt/locale/defi_ur_PK.ts delete mode 100644 src/qt/locale/defi_uz@Cyrl.ts delete mode 100644 src/qt/locale/defi_vi.ts delete mode 100644 src/qt/locale/defi_vi_VN.ts delete mode 100644 src/qt/locale/defi_zh.ts delete mode 100644 src/qt/locale/defi_zh_CN.ts delete mode 100644 src/qt/locale/defi_zh_HK.ts delete mode 100644 src/qt/locale/defi_zh_TW.ts delete mode 100644 src/qt/macdockiconhandler.h delete mode 100644 src/qt/macdockiconhandler.mm delete mode 100644 src/qt/macnotificationhandler.h delete mode 100644 src/qt/macnotificationhandler.mm delete mode 100644 src/qt/macos_appnap.h delete mode 100644 src/qt/macos_appnap.mm delete mode 100644 src/qt/main.cpp delete mode 100644 src/qt/modaloverlay.cpp delete mode 100644 src/qt/modaloverlay.h delete mode 100644 src/qt/networkstyle.cpp delete mode 100644 src/qt/networkstyle.h delete mode 100644 src/qt/notificator.cpp delete mode 100644 src/qt/notificator.h delete mode 100644 src/qt/openuridialog.cpp delete mode 100644 src/qt/openuridialog.h delete mode 100644 src/qt/optionsdialog.cpp delete mode 100644 src/qt/optionsdialog.h delete mode 100644 src/qt/optionsmodel.cpp delete mode 100644 src/qt/optionsmodel.h delete mode 100644 src/qt/overviewpage.cpp delete mode 100644 src/qt/overviewpage.h delete mode 100644 src/qt/paymentrequest.proto delete mode 100644 src/qt/paymentrequestplus.cpp delete mode 100644 src/qt/paymentrequestplus.h delete mode 100644 src/qt/paymentserver.cpp delete mode 100644 src/qt/paymentserver.h delete mode 100644 src/qt/peertablemodel.cpp delete mode 100644 src/qt/peertablemodel.h delete mode 100644 src/qt/platformstyle.cpp delete mode 100644 src/qt/platformstyle.h delete mode 100644 src/qt/qrimagewidget.cpp delete mode 100644 src/qt/qrimagewidget.h delete mode 100644 src/qt/qvalidatedlineedit.cpp delete mode 100644 src/qt/qvalidatedlineedit.h delete mode 100644 src/qt/qvaluecombobox.cpp delete mode 100644 src/qt/qvaluecombobox.h delete mode 100644 src/qt/receivecoinsdialog.cpp delete mode 100644 src/qt/receivecoinsdialog.h delete mode 100644 src/qt/receiverequestdialog.cpp delete mode 100644 src/qt/receiverequestdialog.h delete mode 100644 src/qt/recentrequeststablemodel.cpp delete mode 100644 src/qt/recentrequeststablemodel.h delete mode 100644 src/qt/res/defi-qt-res.rc delete mode 100644 src/qt/res/icons/add.png delete mode 100644 src/qt/res/icons/address-book.png delete mode 100644 src/qt/res/icons/chevron.png delete mode 100644 src/qt/res/icons/clock1.png delete mode 100644 src/qt/res/icons/clock2.png delete mode 100644 src/qt/res/icons/clock3.png delete mode 100644 src/qt/res/icons/clock4.png delete mode 100644 src/qt/res/icons/clock5.png delete mode 100644 src/qt/res/icons/connect0.png delete mode 100644 src/qt/res/icons/connect1.png delete mode 100644 src/qt/res/icons/connect2.png delete mode 100644 src/qt/res/icons/connect3.png delete mode 100644 src/qt/res/icons/connect4.png delete mode 100644 src/qt/res/icons/defi.icns delete mode 100755 src/qt/res/icons/defi.ico delete mode 100644 src/qt/res/icons/defi.png delete mode 100644 src/qt/res/icons/defi_testnet.ico delete mode 100644 src/qt/res/icons/edit.png delete mode 100644 src/qt/res/icons/editcopy.png delete mode 100644 src/qt/res/icons/editpaste.png delete mode 100644 src/qt/res/icons/export.png delete mode 100644 src/qt/res/icons/eye.png delete mode 100644 src/qt/res/icons/eye_minus.png delete mode 100644 src/qt/res/icons/eye_plus.png delete mode 100644 src/qt/res/icons/fontbigger.png delete mode 100644 src/qt/res/icons/fontsmaller.png delete mode 100644 src/qt/res/icons/hd_disabled.png delete mode 100644 src/qt/res/icons/hd_enabled.png delete mode 100644 src/qt/res/icons/history.png delete mode 100644 src/qt/res/icons/lock_closed.png delete mode 100644 src/qt/res/icons/lock_open.png delete mode 100644 src/qt/res/icons/network_disabled.png delete mode 100644 src/qt/res/icons/overview.png delete mode 100644 src/qt/res/icons/proxy.png delete mode 100644 src/qt/res/icons/receive.png delete mode 100644 src/qt/res/icons/remove.png delete mode 100644 src/qt/res/icons/send.png delete mode 100644 src/qt/res/icons/synced.png delete mode 100644 src/qt/res/icons/transaction0.png delete mode 100644 src/qt/res/icons/transaction2.png delete mode 100644 src/qt/res/icons/transaction_abandoned.png delete mode 100644 src/qt/res/icons/transaction_conflicted.png delete mode 100644 src/qt/res/icons/tx_inout.png delete mode 100644 src/qt/res/icons/tx_input.png delete mode 100644 src/qt/res/icons/tx_mined.png delete mode 100644 src/qt/res/icons/tx_output.png delete mode 100644 src/qt/res/icons/warning.png delete mode 100755 src/qt/res/movies/makespinner.sh delete mode 100644 src/qt/res/movies/spinner-000.png delete mode 100644 src/qt/res/movies/spinner-001.png delete mode 100644 src/qt/res/movies/spinner-002.png delete mode 100644 src/qt/res/movies/spinner-003.png delete mode 100644 src/qt/res/movies/spinner-004.png delete mode 100644 src/qt/res/movies/spinner-005.png delete mode 100644 src/qt/res/movies/spinner-006.png delete mode 100644 src/qt/res/movies/spinner-007.png delete mode 100644 src/qt/res/movies/spinner-008.png delete mode 100644 src/qt/res/movies/spinner-009.png delete mode 100644 src/qt/res/movies/spinner-010.png delete mode 100644 src/qt/res/movies/spinner-011.png delete mode 100644 src/qt/res/movies/spinner-012.png delete mode 100644 src/qt/res/movies/spinner-013.png delete mode 100644 src/qt/res/movies/spinner-014.png delete mode 100644 src/qt/res/movies/spinner-015.png delete mode 100644 src/qt/res/movies/spinner-016.png delete mode 100644 src/qt/res/movies/spinner-017.png delete mode 100644 src/qt/res/movies/spinner-018.png delete mode 100644 src/qt/res/movies/spinner-019.png delete mode 100644 src/qt/res/movies/spinner-020.png delete mode 100644 src/qt/res/movies/spinner-021.png delete mode 100644 src/qt/res/movies/spinner-022.png delete mode 100644 src/qt/res/movies/spinner-023.png delete mode 100644 src/qt/res/movies/spinner-024.png delete mode 100644 src/qt/res/movies/spinner-025.png delete mode 100644 src/qt/res/movies/spinner-026.png delete mode 100644 src/qt/res/movies/spinner-027.png delete mode 100644 src/qt/res/movies/spinner-028.png delete mode 100644 src/qt/res/movies/spinner-029.png delete mode 100644 src/qt/res/movies/spinner-030.png delete mode 100644 src/qt/res/movies/spinner-031.png delete mode 100644 src/qt/res/movies/spinner-032.png delete mode 100644 src/qt/res/movies/spinner-033.png delete mode 100644 src/qt/res/movies/spinner-034.png delete mode 100644 src/qt/res/movies/spinner-035.png delete mode 100644 src/qt/res/src/clock_0.svg delete mode 100644 src/qt/res/src/clock_1.svg delete mode 100644 src/qt/res/src/clock_2.svg delete mode 100644 src/qt/res/src/clock_3.svg delete mode 100644 src/qt/res/src/clock_4.svg delete mode 100644 src/qt/res/src/connect-0.svg delete mode 100644 src/qt/res/src/connect-1.svg delete mode 100644 src/qt/res/src/connect-2.svg delete mode 100644 src/qt/res/src/connect-3.svg delete mode 100644 src/qt/res/src/connect-4.svg delete mode 100644 src/qt/res/src/defi.svg delete mode 100644 src/qt/res/src/hd_disabled.svg delete mode 100644 src/qt/res/src/hd_enabled.svg delete mode 100644 src/qt/res/src/mine.svg delete mode 100644 src/qt/res/src/network_disabled.svg delete mode 100644 src/qt/res/src/proxy.svg delete mode 100644 src/qt/res/src/qt.svg delete mode 100644 src/qt/res/src/spinner.png delete mode 100644 src/qt/res/src/transaction0.svg delete mode 100644 src/qt/res/src/tx_in.svg delete mode 100644 src/qt/res/src/tx_inout.svg delete mode 100644 src/qt/rpcconsole.cpp delete mode 100644 src/qt/rpcconsole.h delete mode 100644 src/qt/sendcoinsdialog.cpp delete mode 100644 src/qt/sendcoinsdialog.h delete mode 100644 src/qt/sendcoinsentry.cpp delete mode 100644 src/qt/sendcoinsentry.h delete mode 100644 src/qt/signverifymessagedialog.cpp delete mode 100644 src/qt/signverifymessagedialog.h delete mode 100644 src/qt/splashscreen.cpp delete mode 100644 src/qt/splashscreen.h delete mode 100644 src/qt/test/Makefile delete mode 100644 src/qt/test/addressbooktests.cpp delete mode 100644 src/qt/test/addressbooktests.h delete mode 100644 src/qt/test/apptests.cpp delete mode 100644 src/qt/test/apptests.h delete mode 100644 src/qt/test/compattests.cpp delete mode 100644 src/qt/test/compattests.h delete mode 100644 src/qt/test/paymentrequestdata.h delete mode 100644 src/qt/test/paymentservertests.cpp delete mode 100644 src/qt/test/paymentservertests.h delete mode 100644 src/qt/test/rpcnestedtests.cpp delete mode 100644 src/qt/test/rpcnestedtests.h delete mode 100644 src/qt/test/test_main.cpp delete mode 100644 src/qt/test/uritests.cpp delete mode 100644 src/qt/test/uritests.h delete mode 100644 src/qt/test/util.cpp delete mode 100644 src/qt/test/util.h delete mode 100644 src/qt/test/wallettests.cpp delete mode 100644 src/qt/test/wallettests.h delete mode 100644 src/qt/trafficgraphwidget.cpp delete mode 100644 src/qt/trafficgraphwidget.h delete mode 100644 src/qt/transactiondesc.cpp delete mode 100644 src/qt/transactiondesc.h delete mode 100644 src/qt/transactiondescdialog.cpp delete mode 100644 src/qt/transactiondescdialog.h delete mode 100644 src/qt/transactionfilterproxy.cpp delete mode 100644 src/qt/transactionfilterproxy.h delete mode 100644 src/qt/transactionrecord.cpp delete mode 100644 src/qt/transactionrecord.h delete mode 100644 src/qt/transactiontablemodel.cpp delete mode 100644 src/qt/transactiontablemodel.h delete mode 100644 src/qt/transactionview.cpp delete mode 100644 src/qt/transactionview.h delete mode 100644 src/qt/utilitydialog.cpp delete mode 100644 src/qt/utilitydialog.h delete mode 100644 src/qt/walletcontroller.cpp delete mode 100644 src/qt/walletcontroller.h delete mode 100644 src/qt/walletframe.cpp delete mode 100644 src/qt/walletframe.h delete mode 100644 src/qt/walletmodel.cpp delete mode 100644 src/qt/walletmodel.h delete mode 100644 src/qt/walletmodeltransaction.cpp delete mode 100644 src/qt/walletmodeltransaction.h delete mode 100644 src/qt/walletview.cpp delete mode 100644 src/qt/walletview.h delete mode 100644 src/qt/winshutdownmonitor.cpp delete mode 100644 src/qt/winshutdownmonitor.h diff --git a/Makefile.am b/Makefile.am index 8357a24ec4b..930299fc10b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,6 @@ pkgconfig_DATA = libdeficonsensus.pc endif DEFID_BIN=$(top_builddir)/src/$(DEFI_DAEMON_NAME)$(EXEEXT) -DEFI_QT_BIN=$(top_builddir)/src/qt/$(DEFI_GUI_NAME)$(EXEEXT) DEFI_CLI_BIN=$(top_builddir)/src/$(DEFI_CLI_NAME)$(EXEEXT) DEFI_TX_BIN=$(top_builddir)/src/$(DEFI_TX_NAME)$(EXEEXT) DEFI_WALLET_BIN=$(top_builddir)/src/$(DEFI_WALLET_TOOL_NAME)$(EXEEXT) @@ -95,7 +94,6 @@ dist-hook: $(DEFI_WIN_INSTALLER): all-recursive $(MKDIR_P) $(top_builddir)/release STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(DEFID_BIN) $(top_builddir)/release - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(DEFI_QT_BIN) $(top_builddir)/release STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(DEFI_CLI_BIN) $(top_builddir)/release STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(DEFI_TX_BIN) $(top_builddir)/release STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(DEFI_WALLET_BIN) $(top_builddir)/release @@ -119,10 +117,6 @@ $(OSX_APP)/Contents/Resources/defi.icns: $(OSX_INSTALLER_ICONS) $(MKDIR_P) $(@D) $(INSTALL_DATA) $< $@ -$(OSX_APP)/Contents/MacOS/Defi-Qt: all-recursive - $(MKDIR_P) $(@D) - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(DEFI_QT_BIN) $@ - $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: $(MKDIR_P) $(@D) echo '{ CFBundleDisplayName = "$(PACKAGE_NAME)"; CFBundleName = "$(PACKAGE_NAME)"; }' > $@ @@ -183,9 +177,6 @@ if TARGET_WINDOWS deploy: $(DEFI_WIN_INSTALLER) endif -$(DEFI_QT_BIN): FORCE - $(MAKE) -C src qt/$(@F) - $(DEFID_BIN): FORCE $(MAKE) -C src $(@F) diff --git a/build-aux/m4/defi_qt.m4 b/build-aux/m4/defi_qt.m4 deleted file mode 100644 index 148aeccfbcb..00000000000 --- a/build-aux/m4/defi_qt.m4 +++ /dev/null @@ -1,507 +0,0 @@ -dnl Copyright (c) 2013-2016 The Bitcoin Core developers -dnl Distributed under the MIT software license, see the accompanying -dnl file COPYING or http://www.opensource.org/licenses/mit-license.php. - -dnl Helper for cases where a qt dependency is not met. -dnl Output: If qt version is auto, set defi_enable_qt to false. Else, exit. -AC_DEFUN([DEFI_QT_FAIL],[ - if test "x$defi_qt_want_version" = xauto && test "x$defi_qt_force" != xyes; then - if test "x$defi_enable_qt" != xno; then - AC_MSG_WARN([$1; defi-qt frontend will not be built]) - fi - defi_enable_qt=no - defi_enable_qt_test=no - else - AC_MSG_ERROR([$1]) - fi -]) - -AC_DEFUN([DEFI_QT_CHECK],[ - if test "x$defi_enable_qt" != xno && test "x$defi_qt_want_version" != xno; then - true - $1 - else - true - $2 - fi -]) - -dnl DEFI_QT_PATH_PROGS([FOO], [foo foo2], [/path/to/search/first], [continue if missing]) -dnl Helper for finding the path of programs needed for Qt. -dnl Inputs: $1: Variable to be set -dnl Inputs: $2: List of programs to search for -dnl Inputs: $3: Look for $2 here before $PATH -dnl Inputs: $4: If "yes", don't fail if $2 is not found. -dnl Output: $1 is set to the path of $2 if found. $2 are searched in order. -AC_DEFUN([DEFI_QT_PATH_PROGS],[ - DEFI_QT_CHECK([ - if test "x$3" != x; then - AC_PATH_PROGS($1,$2,,$3) - else - AC_PATH_PROGS($1,$2) - fi - if test "x$$1" = x && test "x$4" != xyes; then - DEFI_QT_FAIL([$1 not found]) - fi - ]) -]) - -dnl Initialize qt input. -dnl This must be called before any other DEFI_QT* macros to ensure that -dnl input variables are set correctly. -dnl CAUTION: Do not use this inside of a conditional. -AC_DEFUN([DEFI_QT_INIT],[ - dnl enable qt support - AC_ARG_WITH([gui], - [AS_HELP_STRING([--with-gui@<:@=no|qt5|auto@:>@], - [build defi-qt GUI (default=auto)])], - [ - defi_qt_want_version=$withval - if test "x$defi_qt_want_version" = xyes; then - defi_qt_force=yes - defi_qt_want_version=auto - fi - ], - [defi_qt_want_version=auto]) - - AC_ARG_WITH([qt-incdir],[AS_HELP_STRING([--with-qt-incdir=INC_DIR],[specify qt include path (overridden by pkgconfig)])], [qt_include_path=$withval], []) - AC_ARG_WITH([qt-libdir],[AS_HELP_STRING([--with-qt-libdir=LIB_DIR],[specify qt lib path (overridden by pkgconfig)])], [qt_lib_path=$withval], []) - AC_ARG_WITH([qt-plugindir],[AS_HELP_STRING([--with-qt-plugindir=PLUGIN_DIR],[specify qt plugin path (overridden by pkgconfig)])], [qt_plugin_path=$withval], []) - AC_ARG_WITH([qt-translationdir],[AS_HELP_STRING([--with-qt-translationdir=PLUGIN_DIR],[specify qt translation path (overridden by pkgconfig)])], [qt_translation_path=$withval], []) - AC_ARG_WITH([qt-bindir],[AS_HELP_STRING([--with-qt-bindir=BIN_DIR],[specify qt bin path])], [qt_bin_path=$withval], []) - - AC_ARG_WITH([qtdbus], - [AS_HELP_STRING([--with-qtdbus], - [enable DBus support (default is yes if qt is enabled and QtDBus is found)])], - [use_dbus=$withval], - [use_dbus=auto]) - - AC_SUBST(QT_TRANSLATION_DIR,$qt_translation_path) -]) - -dnl Find the appropriate version of Qt libraries and includes. -dnl Inputs: $1: Whether or not pkg-config should be used. yes|no. Default: yes. -dnl Inputs: $2: If $1 is "yes" and --with-gui=auto, which qt version should be -dnl tried first. -dnl Outputs: See _DEFI_QT_FIND_LIBS_* -dnl Outputs: Sets variables for all qt-related tools. -dnl Outputs: defi_enable_qt, defi_enable_qt_dbus, defi_enable_qt_test -AC_DEFUN([DEFI_QT_CONFIGURE],[ - use_pkgconfig=$1 - - if test "x$use_pkgconfig" = x; then - use_pkgconfig=yes - fi - - if test "x$use_pkgconfig" = xyes; then - DEFI_QT_CHECK([_DEFI_QT_FIND_LIBS_WITH_PKGCONFIG]) - else - DEFI_QT_CHECK([_DEFI_QT_FIND_LIBS_WITHOUT_PKGCONFIG]) - fi - - dnl This is ugly and complicated. Yuck. Works as follows: - dnl For Qt5, we can check a header to find out whether Qt is build - dnl statically. When Qt is built statically, some plugins must be linked into - dnl the final binary as well. - dnl With Qt5, languages moved into core and the WindowsIntegration plugin was - dnl added. - dnl _DEFI_QT_CHECK_STATIC_PLUGINS does a quick link-check and appends the - dnl results to QT_LIBS. - DEFI_QT_CHECK([ - TEMP_CPPFLAGS=$CPPFLAGS - TEMP_CXXFLAGS=$CXXFLAGS - CPPFLAGS="$QT_INCLUDES $CPPFLAGS" - CXXFLAGS="$PIC_FLAGS $CXXFLAGS" - _DEFI_QT_IS_STATIC - if test "x$defi_cv_static_qt" = xyes; then - _DEFI_QT_FIND_STATIC_PLUGINS - AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static]) - _DEFI_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin)],[-lqminimal]) - AC_DEFINE(QT_QPA_PLATFORM_MINIMAL, 1, [Define this symbol if the minimal qt platform exists]) - if test "x$TARGET_OS" = xwindows; then - _DEFI_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows]) - AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows]) - elif test "x$TARGET_OS" = xlinux; then - _DEFI_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)],[-lqxcb -lxcb-static]) - AC_DEFINE(QT_QPA_PLATFORM_XCB, 1, [Define this symbol if the qt platform is xcb]) - elif test "x$TARGET_OS" = xdarwin; then - AX_CHECK_LINK_FLAG([[-framework IOKit]],[QT_LIBS="$QT_LIBS -framework IOKit"],[AC_MSG_ERROR(could not iokit framework)]) - _DEFI_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)],[-lqcocoa]) - AC_DEFINE(QT_QPA_PLATFORM_COCOA, 1, [Define this symbol if the qt platform is cocoa]) - fi - fi - CPPFLAGS=$TEMP_CPPFLAGS - CXXFLAGS=$TEMP_CXXFLAGS - ]) - - if test "x$use_pkgconfig$qt_bin_path" = xyes; then - qt_bin_path="`$PKG_CONFIG --variable=host_bins Qt5Core 2>/dev/null`" - fi - - if test "x$use_hardening" != xno; then - DEFI_QT_CHECK([ - AC_MSG_CHECKING(whether -fPIE can be used with this Qt config) - TEMP_CPPFLAGS=$CPPFLAGS - TEMP_CXXFLAGS=$CXXFLAGS - CPPFLAGS="$QT_INCLUDES $CPPFLAGS" - CXXFLAGS="$PIE_FLAGS $CXXFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], - [[ - #if defined(QT_REDUCE_RELOCATIONS) - choke - #endif - ]])], - [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIE_FLAGS ], - [ AC_MSG_RESULT(no); QT_PIE_FLAGS=$PIC_FLAGS] - ) - CPPFLAGS=$TEMP_CPPFLAGS - CXXFLAGS=$TEMP_CXXFLAGS - ]) - else - DEFI_QT_CHECK([ - AC_MSG_CHECKING(whether -fPIC is needed with this Qt config) - TEMP_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$QT_INCLUDES $CPPFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], - [[ - #if defined(QT_REDUCE_RELOCATIONS) - choke - #endif - ]])], - [ AC_MSG_RESULT(no)], - [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIC_FLAGS] - ) - CPPFLAGS=$TEMP_CPPFLAGS - ]) - fi - - DEFI_QT_PATH_PROGS([MOC], [moc-qt5 moc5 moc], $qt_bin_path) - DEFI_QT_PATH_PROGS([UIC], [uic-qt5 uic5 uic], $qt_bin_path) - DEFI_QT_PATH_PROGS([RCC], [rcc-qt5 rcc5 rcc], $qt_bin_path) - DEFI_QT_PATH_PROGS([LRELEASE], [lrelease-qt5 lrelease5 lrelease], $qt_bin_path) - DEFI_QT_PATH_PROGS([LUPDATE], [lupdate-qt5 lupdate5 lupdate],$qt_bin_path, yes) - - MOC_DEFS='-DHAVE_CONFIG_H -I$(srcdir)' - case $host in - *darwin*) - DEFI_QT_CHECK([ - MOC_DEFS="${MOC_DEFS} -DQ_OS_MAC" - base_frameworks="-framework Foundation -framework ApplicationServices -framework AppKit" - AX_CHECK_LINK_FLAG([[$base_frameworks]],[QT_LIBS="$QT_LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)]) - ]) - ;; - *mingw*) - DEFI_QT_CHECK([ - AX_CHECK_LINK_FLAG([[-mwindows]],[QT_LDFLAGS="$QT_LDFLAGS -mwindows"],[AC_MSG_WARN(-mwindows linker support not detected)]) - ]) - esac - - - dnl enable qt support - AC_MSG_CHECKING(whether to build ]AC_PACKAGE_NAME[ GUI) - DEFI_QT_CHECK([ - defi_enable_qt=yes - defi_enable_qt_test=yes - if test "x$have_qt_test" = xno; then - defi_enable_qt_test=no - fi - defi_enable_qt_dbus=no - if test "x$use_dbus" != xno && test "x$have_qt_dbus" = xyes; then - defi_enable_qt_dbus=yes - fi - if test "x$use_dbus" = xyes && test "x$have_qt_dbus" = xno; then - AC_MSG_ERROR([libQtDBus not found. Install libQtDBus or remove --with-qtdbus.]) - fi - if test "x$LUPDATE" = x; then - AC_MSG_WARN([lupdate is required to update qt translations]) - fi - ],[ - defi_enable_qt=no - ]) - AC_MSG_RESULT([$defi_enable_qt (Qt5)]) - - AC_SUBST(QT_PIE_FLAGS) - AC_SUBST(QT_INCLUDES) - AC_SUBST(QT_LIBS) - AC_SUBST(QT_LDFLAGS) - AC_SUBST(QT_DBUS_INCLUDES) - AC_SUBST(QT_DBUS_LIBS) - AC_SUBST(QT_TEST_INCLUDES) - AC_SUBST(QT_TEST_LIBS) - AC_SUBST(QT_SELECT, qt5) - AC_SUBST(MOC_DEFS) -]) - -dnl All macros below are internal and should _not_ be used from the main -dnl configure.ac. -dnl ---- - -dnl Internal. Check included version of Qt against minimum specified in doc/dependencies.md -dnl Requires: INCLUDES must be populated as necessary. -dnl Output: defi_cv_qt5=yes|no -AC_DEFUN([_DEFI_QT_CHECK_QT5],[ - AC_CACHE_CHECK(for Qt 5, defi_cv_qt5,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], - [[ - #if QT_VERSION < 0x050501 - choke - #endif - ]])], - [defi_cv_qt5=yes], - [defi_cv_qt5=no]) -])]) - -dnl Internal. Check if the included version of Qt is greater than Qt58. -dnl Requires: INCLUDES must be populated as necessary. -dnl Output: defi_cv_qt58=yes|no -AC_DEFUN([_DEFI_QT_CHECK_QT58],[ - AC_CACHE_CHECK(for > Qt 5.7, defi_cv_qt58,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], - [[ - #if QT_VERSION_MINOR < 8 - choke - #endif - ]])], - [defi_cv_qt58=yes], - [defi_cv_qt58=no]) -])]) - - -dnl Internal. Check if the linked version of Qt was built as static libs. -dnl Requires: Qt5. -dnl Requires: INCLUDES and LIBS must be populated as necessary. -dnl Output: defi_cv_static_qt=yes|no -dnl Output: Defines QT_STATICPLUGIN if plugins are static. -AC_DEFUN([_DEFI_QT_IS_STATIC],[ - AC_CACHE_CHECK(for static Qt, defi_cv_static_qt,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION OR QT_VERSION_STR - # include - #endif - ]], - [[ - #if !defined(QT_STATIC) - choke - #endif - ]])], - [defi_cv_static_qt=yes], - [defi_cv_static_qt=no]) - ]) - if test "x$defi_cv_static_qt" = xyes; then - AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol for static Qt plugins]) - fi -]) - -dnl Internal. Check if the link-requirements for static plugins are met. -dnl Requires: INCLUDES and LIBS must be populated as necessary. -dnl Inputs: $1: A series of Q_IMPORT_PLUGIN(). -dnl Inputs: $2: The libraries that resolve $1. -dnl Output: QT_LIBS is prepended or configure exits. -AC_DEFUN([_DEFI_QT_CHECK_STATIC_PLUGINS],[ - AC_MSG_CHECKING(for static Qt plugins: $2) - CHECK_STATIC_PLUGINS_TEMP_LIBS="$LIBS" - LIBS="$2 $QT_LIBS $LIBS" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - #define QT_STATICPLUGIN - #include - $1]], - [[return 0;]])], - [AC_MSG_RESULT(yes); QT_LIBS="$2 $QT_LIBS"], - [AC_MSG_RESULT(no); DEFI_QT_FAIL(Could not resolve: $2)]) - LIBS="$CHECK_STATIC_PLUGINS_TEMP_LIBS" -]) - -dnl Internal. Find paths necessary for linking qt static plugins -dnl Inputs: qt_plugin_path. optional. -dnl Outputs: QT_LIBS is appended -AC_DEFUN([_DEFI_QT_FIND_STATIC_PLUGINS],[ - if test "x$qt_plugin_path" != x; then - QT_LIBS="$QT_LIBS -L$qt_plugin_path/platforms" - if test -d "$qt_plugin_path/accessible"; then - QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" - fi - if test "x$use_pkgconfig" = xyes; then - : dnl - m4_ifdef([PKG_CHECK_MODULES],[ - if test x$defi_cv_qt58 = xno; then - PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"]) - else - PKG_CHECK_MODULES([QTFONTDATABASE], [Qt5FontDatabaseSupport], [QT_LIBS="-lQt5FontDatabaseSupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTEVENTDISPATCHER], [Qt5EventDispatcherSupport], [QT_LIBS="-lQt5EventDispatcherSupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTTHEME], [Qt5ThemeSupport], [QT_LIBS="-lQt5ThemeSupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTDEVICEDISCOVERY], [Qt5DeviceDiscoverySupport], [QT_LIBS="-lQt5DeviceDiscoverySupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTACCESSIBILITY], [Qt5AccessibilitySupport], [QT_LIBS="-lQt5AccessibilitySupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTFB], [Qt5FbSupport], [QT_LIBS="-lQt5FbSupport $QT_LIBS"]) - fi - if test "x$TARGET_OS" = xlinux; then - PKG_CHECK_MODULES([QTXCBQPA], [Qt5XcbQpa], [QT_LIBS="$QTXCBQPA_LIBS $QT_LIBS"]) - elif test "x$TARGET_OS" = xdarwin; then - PKG_CHECK_MODULES([QTCLIPBOARD], [Qt5ClipboardSupport], [QT_LIBS="-lQt5ClipboardSupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTGRAPHICS], [Qt5GraphicsSupport], [QT_LIBS="-lQt5GraphicsSupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTCGL], [Qt5CglSupport], [QT_LIBS="-lQt5CglSupport $QT_LIBS"]) - fi - ]) - else - if test "x$TARGET_OS" = xwindows; then - AC_CACHE_CHECK(for Qt >= 5.6, defi_cv_need_platformsupport,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], - [[ - #if QT_VERSION < 0x050600 || QT_VERSION_MINOR < 6 - choke - #endif - ]])], - [defi_cv_need_platformsupport=yes], - [defi_cv_need_platformsupport=no]) - ]) - if test "x$defi_cv_need_platformsupport" = xyes; then - if test x$defi_cv_qt58 = xno; then - DEFI_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}PlatformSupport],[main],,DEFI_QT_FAIL(lib$QT_LIB_PREFIXPlatformSupport not found))) - else - DEFI_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}FontDatabaseSupport],[main],,DEFI_QT_FAIL(lib$QT_LIB_PREFIXFontDatabaseSupport not found))) - DEFI_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}EventDispatcherSupport],[main],,DEFI_QT_FAIL(lib$QT_LIB_PREFIXEventDispatcherSupport not found))) - DEFI_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}ThemeSupport],[main],,DEFI_QT_FAIL(lib$QT_LIB_PREFIXThemeSupport not found))) - DEFI_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}FbSupport],[main],,DEFI_QT_FAIL(lib$QT_LIB_PREFIXFbSupport not found))) - DEFI_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}DeviceDiscoverySupport],[main],,DEFI_QT_FAIL(lib$QT_LIB_PREFIXDeviceDiscoverySupport not found))) - DEFI_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}AccessibilitySupport],[main],,DEFI_QT_FAIL(lib$QT_LIB_PREFIXAccessibilitySupport not found))) - QT_LIBS="$QT_LIBS -lversion -ldwmapi -luxtheme" - fi - fi - fi - fi - fi -]) - -dnl Internal. Find Qt libraries using pkg-config. -dnl Inputs: defi_qt_want_version (from --with-gui=). The version to check -dnl first. -dnl Inputs: $1: If defi_qt_want_version is "auto", check for this version -dnl first. -dnl Outputs: All necessary QT_* variables are set. -dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no. -AC_DEFUN([_DEFI_QT_FIND_LIBS_WITH_PKGCONFIG],[ - m4_ifdef([PKG_CHECK_MODULES],[ - QT_LIB_PREFIX=Qt5 - qt5_modules="Qt5Core Qt5Gui Qt5Network Qt5Widgets" - DEFI_QT_CHECK([ - PKG_CHECK_MODULES([QT5], [$qt5_modules], [QT_INCLUDES="$QT5_CFLAGS"; QT_LIBS="$QT5_LIBS" have_qt=yes],[have_qt=no]) - - if test "x$have_qt" != xyes; then - have_qt=no - DEFI_QT_FAIL([Qt dependencies not found]) - fi - ]) - DEFI_QT_CHECK([ - PKG_CHECK_MODULES([QT_TEST], [${QT_LIB_PREFIX}Test], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no]) - if test "x$use_dbus" != xno; then - PKG_CHECK_MODULES([QT_DBUS], [${QT_LIB_PREFIX}DBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no]) - fi - ]) - ]) - true; dnl -]) - -dnl Internal. Find Qt libraries without using pkg-config. Version is deduced -dnl from the discovered headers. -dnl Inputs: defi_qt_want_version (from --with-gui=). The version to use. -dnl If "auto", the version will be discovered by _DEFI_QT_CHECK_QT5. -dnl Outputs: All necessary QT_* variables are set. -dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no. -AC_DEFUN([_DEFI_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[ - TEMP_CPPFLAGS="$CPPFLAGS" - TEMP_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$PIC_FLAGS $CXXFLAGS" - TEMP_LIBS="$LIBS" - DEFI_QT_CHECK([ - if test "x$qt_include_path" != x; then - QT_INCLUDES="-I$qt_include_path -I$qt_include_path/QtCore -I$qt_include_path/QtGui -I$qt_include_path/QtWidgets -I$qt_include_path/QtNetwork -I$qt_include_path/QtTest -I$qt_include_path/QtDBus" - CPPFLAGS="$QT_INCLUDES $CPPFLAGS" - fi - ]) - - DEFI_QT_CHECK([AC_CHECK_HEADER([QtPlugin],,DEFI_QT_FAIL(QtCore headers missing))]) - DEFI_QT_CHECK([AC_CHECK_HEADER([QApplication],, DEFI_QT_FAIL(QtGui headers missing))]) - DEFI_QT_CHECK([AC_CHECK_HEADER([QLocalSocket],, DEFI_QT_FAIL(QtNetwork headers missing))]) - - DEFI_QT_CHECK([ - if test "x$defi_qt_want_version" = xauto; then - _DEFI_QT_CHECK_QT5 - _DEFI_QT_CHECK_QT58 - fi - QT_LIB_PREFIX=Qt5 - ]) - - DEFI_QT_CHECK([ - LIBS= - if test "x$qt_lib_path" != x; then - LIBS="$LIBS -L$qt_lib_path" - fi - - if test "x$TARGET_OS" = xwindows; then - AC_CHECK_LIB([imm32], [main],, DEFI_QT_FAIL(libimm32 not found)) - fi - ]) - - DEFI_QT_CHECK(AC_CHECK_LIB([z] ,[main],,AC_MSG_WARN([zlib not found. Assuming qt has it built-in]))) - if test x$defi_cv_qt58 = xno; then - DEFI_QT_CHECK(AC_SEARCH_LIBS([png_error] ,[qtpng png],,AC_MSG_WARN([libpng not found. Assuming qt has it built-in]))) - DEFI_QT_CHECK(AC_SEARCH_LIBS([pcre16_exec], [qtpcre pcre16],,AC_MSG_WARN([libpcre16 not found. Assuming qt has it built-in]))) - else - DEFI_QT_CHECK(AC_SEARCH_LIBS([png_error] ,[qtlibpng png],,AC_MSG_WARN([libpng not found. Assuming qt has it built-in]))) - DEFI_QT_CHECK(AC_SEARCH_LIBS([pcre2_match_16], [qtpcre2 libqtpcre2],,AC_MSG_WARN([libqtpcre2 not found. Assuming qt has it built-in]))) - fi - DEFI_QT_CHECK(AC_SEARCH_LIBS([hb_ot_tags_from_script] ,[qtharfbuzzng qtharfbuzz harfbuzz],,AC_MSG_WARN([libharfbuzz not found. Assuming qt has it built-in or support is disabled]))) - DEFI_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Core] ,[main],,DEFI_QT_FAIL(lib${QT_LIB_PREFIX}Core not found))) - DEFI_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Gui] ,[main],,DEFI_QT_FAIL(lib${QT_LIB_PREFIX}Gui not found))) - DEFI_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Network],[main],,DEFI_QT_FAIL(lib${QT_LIB_PREFIX}Network not found))) - DEFI_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Widgets],[main],,DEFI_QT_FAIL(lib${QT_LIB_PREFIX}Widgets not found))) - QT_LIBS="$LIBS" - LIBS="$TEMP_LIBS" - - DEFI_QT_CHECK([ - LIBS= - if test "x$qt_lib_path" != x; then - LIBS="-L$qt_lib_path" - fi - AC_CHECK_LIB([${QT_LIB_PREFIX}Test], [main],, have_qt_test=no) - AC_CHECK_HEADER([QTest],, have_qt_test=no) - QT_TEST_LIBS="$LIBS" - if test "x$use_dbus" != xno; then - LIBS= - if test "x$qt_lib_path" != x; then - LIBS="-L$qt_lib_path" - fi - AC_CHECK_LIB([${QT_LIB_PREFIX}DBus], [main],, have_qt_dbus=no) - AC_CHECK_HEADER([QtDBus],, have_qt_dbus=no) - QT_DBUS_LIBS="$LIBS" - fi - ]) - CPPFLAGS="$TEMP_CPPFLAGS" - CXXFLAGS="$TEMP_CXXFLAGS" - LIBS="$TEMP_LIBS" -]) diff --git a/configure.ac b/configure.ac index 4434142f797..36771f1a1b9 100644 --- a/configure.ac +++ b/configure.ac @@ -16,7 +16,6 @@ AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([build-aux/m4]) DEFI_DAEMON_NAME=defid -DEFI_GUI_NAME=defi-qt DEFI_CLI_NAME=defi-cli DEFI_TX_NAME=defi-tx DEFI_WALLET_TOOL_NAME=defi-wallet @@ -965,18 +964,10 @@ if test "x$enable_fuzz" = "xyes"; then build_defi_wallet=no build_defid=no build_defi_libs=no - defi_enable_qt=no - defi_enable_qt_test=no - defi_enable_qt_dbus=no enable_wallet=no use_bench=no use_upnp=no use_zmq=no -else - DEFI_QT_INIT - - dnl sets $defi_enable_qt, $defi_enable_qt_test, $defi_enable_qt_dbus - DEFI_QT_CONFIGURE([$use_pkgconfig]) fi if test x$enable_wallet != xno; then @@ -1013,7 +1004,7 @@ if test x$have_miniupnpc != xno; then fi fi -if test x$build_defi_wallet$build_defi_cli$build_defi_tx$build_defid$defi_enable_qt$use_tests$use_bench = xnonononononono; then +if test x$build_defi_wallet$build_defi_cli$build_defi_tx$build_defid$use_tests$use_bench = xnonononononono; then use_boost=no else use_boost=yes @@ -1197,13 +1188,8 @@ if test x$use_pkgconfig = xyes; then [ PKG_CHECK_MODULES([SSL], [libssl],, [AC_MSG_ERROR(openssl not found.)]) PKG_CHECK_MODULES([CRYPTO], [libcrypto],,[AC_MSG_ERROR(libcrypto not found.)]) - if test x$enable_bip70 != xno; then - DEFI_QT_CHECK([PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [have_protobuf=no])]) - fi - if test x$use_qr != xno; then - DEFI_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])]) - fi - if test x$build_defi_cli$build_defid$defi_enable_qt$use_tests != xnononono; then + + if test x$build_defi_cli$build_defid$use_tests != xnononono; then PKG_CHECK_MODULES([EVENT], [libevent],, [AC_MSG_ERROR(libevent not found.)]) if test x$TARGET_OS != xwindows; then PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads],, [AC_MSG_ERROR(libevent_pthreads not found.)]) @@ -1228,7 +1214,7 @@ else AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),) AC_CHECK_LIB([ssl], [main],SSL_LIBS=-lssl, AC_MSG_ERROR(libssl missing)) - if test x$build_defi_cli$build_defid$defi_enable_qt$use_tests != xnononono; then + if test x$build_defi_cli$build_defid$use_tests != xnononono; then AC_CHECK_HEADER([event2/event.h],, AC_MSG_ERROR(libevent headers missing),) AC_CHECK_LIB([event],[main],EVENT_LIBS=-levent,AC_MSG_ERROR(libevent missing)) if test x$TARGET_OS != xwindows; then @@ -1258,14 +1244,6 @@ else ;; esac fi - - if test x$enable_bip70 != xno; then - DEFI_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],[PROTOBUF_LIBS=-lprotobuf], [have_protobuf=no])) - fi - if test x$use_qr != xno; then - DEFI_QT_CHECK([AC_CHECK_LIB([qrencode], [main],[QR_LIBS=-lqrencode], [have_qrencode=no])]) - DEFI_QT_CHECK([AC_CHECK_HEADER([qrencode.h],, have_qrencode=no)]) - fi fi save_CXXFLAGS="${CXXFLAGS}" @@ -1295,7 +1273,7 @@ dnl univalue check need_bundled_univalue=yes -if test x$build_defi_wallet$build_defi_cli$build_defi_tx$build_defid$defi_enable_qt$use_tests$use_bench = xnonononononono; then +if test x$build_defi_wallet$build_defi_cli$build_defi_tx$build_defid$use_tests$use_bench = xnonononononono; then need_bundled_univalue=no else @@ -1340,11 +1318,6 @@ AC_SUBST(UNIVALUE_CFLAGS) AC_SUBST(UNIVALUE_LIBS) -if test x$have_protobuf != xno && - test x$enable_bip70 != xno; then - DEFI_QT_PATH_PROGS([PROTOC], [protoc],$protoc_bin_path) -fi - AC_MSG_CHECKING([whether to build defid]) AM_CONDITIONAL([BUILD_DEFID], [test x$build_defid = xyes]) AC_MSG_RESULT($build_defid) @@ -1428,63 +1401,6 @@ else fi fi -dnl these are only used when qt is enabled -BUILD_TEST_QT="" -if test x$defi_enable_qt != xno; then - dnl enable dbus support - AC_MSG_CHECKING([whether to build GUI with support for D-Bus]) - if test x$defi_enable_qt_dbus != xno; then - AC_DEFINE([USE_DBUS],[1],[Define if dbus support should be compiled in]) - fi - AC_MSG_RESULT($defi_enable_qt_dbus) - - dnl enable qr support - AC_MSG_CHECKING([whether to build GUI with support for QR codes]) - if test x$have_qrencode = xno; then - if test x$use_qr = xyes; then - AC_MSG_ERROR("QR support requested but cannot be built. use --without-qrencode") - fi - AC_MSG_RESULT(no) - else - if test x$use_qr != xno; then - AC_MSG_RESULT(yes) - AC_DEFINE([USE_QRCODE],[1],[Define if QR support should be compiled in]) - use_qr=yes - else - AC_MSG_RESULT(no) - fi - fi - - if test x$XGETTEXT = x; then - AC_MSG_WARN("xgettext is required to update qt translations") - fi - - AC_MSG_CHECKING([whether to build test_defi-qt]) - if test x$use_gui_tests$defi_enable_qt_test = xyesyes; then - AC_MSG_RESULT([yes]) - BUILD_TEST_QT="yes" - else - AC_MSG_RESULT([no]) - fi - - AC_MSG_CHECKING([whether to build BIP70 support]) - if test x$have_protobuf = xno; then - if test x$enable_bip70 = xyes; then - AC_MSG_ERROR(protobuf missing) - fi - enable_bip70=no - AC_MSG_RESULT(no) - else - if test x$enable_bip70 != xno; then - AC_DEFINE([ENABLE_BIP70],[1],[Define if BIP70 support should be compiled in]) - enable_bip70=yes - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - fi -fi - AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"]) AC_MSG_CHECKING([whether to build test_defi]) @@ -1503,7 +1419,7 @@ else AC_MSG_RESULT([no]) fi -if test x$build_defi_wallet$build_defi_cli$build_defi_tx$build_defi_libs$build_defid$defi_enable_qt$use_bench$use_tests = xnononononononono; then +if test x$build_defi_wallet$build_defi_cli$build_defi_tx$build_defi_libs$build_defid$use_bench$use_tests = xnononononononono; then AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon --with-gui --enable-bench or --enable-tests]) fi @@ -1513,8 +1429,6 @@ AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows]) AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes]) AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes]) AM_CONDITIONAL([ENABLE_FUZZ],[test x$enable_fuzz = xyes]) -AM_CONDITIONAL([ENABLE_QT],[test x$defi_enable_qt = xyes]) -AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$BUILD_TEST_QT = xyes]) AM_CONDITIONAL([ENABLE_BIP70],[test x$enable_bip70 = xyes]) AM_CONDITIONAL([ENABLE_BENCH],[test x$use_bench = xyes]) AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes]) @@ -1547,7 +1461,6 @@ AC_SUBST(COPYRIGHT_HOLDERS, "_COPYRIGHT_HOLDERS") AC_SUBST(COPYRIGHT_HOLDERS_SUBSTITUTION, "_COPYRIGHT_HOLDERS_SUBSTITUTION") AC_SUBST(COPYRIGHT_HOLDERS_FINAL, "_COPYRIGHT_HOLDERS_FINAL") AC_SUBST(DEFI_DAEMON_NAME) -AC_SUBST(DEFI_GUI_NAME) AC_SUBST(DEFI_CLI_NAME) AC_SUBST(DEFI_TX_NAME) AC_SUBST(DEFI_WALLET_TOOL_NAME) @@ -1649,11 +1562,6 @@ esac echo echo "Options used to compile and link:" echo " with wallet = $enable_wallet" -echo " with gui / qt = $defi_enable_qt" -if test x$defi_enable_qt != xno; then - echo " with bip70 = $enable_bip70" - echo " with qr = $use_qr" -fi echo " with zmq = $use_zmq" echo " with test = $use_tests" if test x$use_tests != xno; then diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index 37e80d29915..868cec5c225 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am @@ -4,10 +4,6 @@ if BUILD_DEFID dist_man1_MANS+=defid.1 endif -if ENABLE_QT - dist_man1_MANS+=defi-qt.1 -endif - if BUILD_DEFI_CLI dist_man1_MANS+=defi-cli.1 endif diff --git a/src/Makefile.am b/src/Makefile.am index 69bbb7892c3..cf22670c3b9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -794,11 +794,3 @@ endif if ENABLE_BENCH include Makefile.bench.include endif - -if ENABLE_QT -include Makefile.qt.include -endif - -if ENABLE_QT_TESTS -include Makefile.qttest.include -endif diff --git a/src/qt/Makefile b/src/qt/Makefile deleted file mode 100644 index 8dacd2e39c1..00000000000 --- a/src/qt/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY: FORCE -all: FORCE - $(MAKE) -C .. defi_qt test_defi_qt -clean: FORCE - $(MAKE) -C .. defi_qt_clean test_defi_qt_clean -check: FORCE - $(MAKE) -C .. test_defi_qt_check -defi-qt defi-qt.exe: FORCE - $(MAKE) -C .. defi_qt diff --git a/src/qt/README.md b/src/qt/README.md deleted file mode 100644 index 79761e3f9d7..00000000000 --- a/src/qt/README.md +++ /dev/null @@ -1,95 +0,0 @@ -This directory contains the DefiQT graphical user interface (GUI). It uses the cross-platform framework [Qt](https://www1.qt.io/developers/). - -The current precise version for Qt 5 is specified in [qt.mk](/depends/packages/qt.mk). - -## Compile and run - -See build instructions ([macOS](/doc/build-osx.md), [Windows](/doc/build-windows.md), [Unix](/doc/build-unix.md), etc). - -To run: - -```sh -./src/qt/defi-qt -``` - -## Files and directories - -### forms - -Contains [Designer UI](https://doc.qt.io/qt-5.9/designer-using-a-ui-file.html) files. They are created with [Qt Creator](#using-qt-creator-as-ide), but can be edited using any text editor. - -### locale - -Contains translations. They are periodically updated. The process is described [here](/doc/translation_process.md). - -### res - -Resources such as the icon. - -### test - -Tests. - -### defigui.(h/cpp) - -Represents the main window of the Defi UI. - -### \*model.(h/cpp) - -The model. When it has a corresponding controller, it generally inherits from [QAbstractTableModel](https://doc.qt.io/qt-5/qabstracttablemodel.html). Models that are used by controllers as helpers inherit from other Qt classes like [QValidator](https://doc.qt.io/qt-5/qvalidator.html). - -ClientModel is used by the main application `defigui` and several models like `peertablemodel`. - -### \*page.(h/cpp) - -A controller. `:NAMEpage.cpp` generally includes `:NAMEmodel.h` and `forms/:NAME.page.ui` with a similar `:NAME`. - -### \*dialog.(h/cpp) - -Various dialogs, e.g. to open a URL. Inherit from [QDialog](https://doc.qt.io/qt-5/qdialog.html). - -### paymentserver.(h/cpp) - -Used to process BIP21 and BIP70 (see https://github.com/bitcoin/bitcoin/pull/11622) payment URI / requests. Also handles URI based application switching (e.g. when following a defi:... link from a browser). - -### walletview.(h/cpp) - -Represents the view to a single wallet. - -### Other .h/cpp files - -* UI elements like DefiAmountField, which inherit from QWidget. -* `defistrings.cpp`: automatically generated -* `defiunits.(h/cpp)`: BTC / mBTC / etc handling -* `callback.h` -* `guiconstants.h`: UI colors, app name, etc -* `guiutil.h`: several helper functions -* `macdockiconhandler.(h/mm)`: macOS dock icon handler -* `macnotificationhandler.(h/mm)`: display notifications in macOS - -## Contribute - -See [CONTRIBUTING.md](/CONTRIBUTING.md) for general guidelines. Specifically for Qt: - -* don't change `local/defi_en.ts`; this happens [automatically](/doc/translation_process.md#writing-code-with-translations) - -## Using Qt Creator as IDE - -You can use Qt Creator as an IDE. This is especially useful if you want to change -the UI layout. - -Download and install the community edition of [Qt Creator](https://www.qt.io/download/). -Uncheck everything except Qt Creator during the installation process. - -Instructions for macOS: - -1. Make sure you installed everything through Homebrew mentioned in the [macOS build instructions](/doc/build-osx.md) -2. Use `./configure` with the `--enable-debug` flag -3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project -4. Enter "defi-qt" as project name, enter src/qt as location -5. Leave the file selection as it is -6. Confirm the "summary page" -7. In the "Projects" tab select "Manage Kits..." -8. Select the default "Desktop" kit and select "Clang (x86 64bit in /usr/bin)" as compiler -9. Select LLDB as debugger (you might need to set the path to your installation) -10. Start debugging with Qt Creator (you might need to the executable to "defi-qt" under "Run", which is where you can also add command line arguments) diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp deleted file mode 100644 index 5efc29bfd08..00000000000 --- a/src/qt/addressbookpage.cpp +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#if defined(HAVE_CONFIG_H) -#include -#endif - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel -{ - const QString m_type; - -public: - AddressBookSortFilterProxyModel(const QString& type, QObject* parent) - : QSortFilterProxyModel(parent) - , m_type(type) - { - setDynamicSortFilter(true); - setFilterCaseSensitivity(Qt::CaseInsensitive); - setSortCaseSensitivity(Qt::CaseInsensitive); - } - -protected: - bool filterAcceptsRow(int row, const QModelIndex& parent) const - { - auto model = sourceModel(); - auto label = model->index(row, AddressTableModel::Label, parent); - - if (model->data(label, AddressTableModel::TypeRole).toString() != m_type) { - return false; - } - - auto address = model->index(row, AddressTableModel::Address, parent); - - if (filterRegExp().indexIn(model->data(address).toString()) < 0 && - filterRegExp().indexIn(model->data(label).toString()) < 0) { - return false; - } - - return true; - } -}; - -AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, Tabs _tab, QWidget *parent) : - QDialog(parent), - ui(new Ui::AddressBookPage), - model(nullptr), - mode(_mode), - tab(_tab) -{ - ui->setupUi(this); - - if (!platformStyle->getImagesOnButtons()) { - ui->newAddress->setIcon(QIcon()); - ui->copyAddress->setIcon(QIcon()); - ui->deleteAddress->setIcon(QIcon()); - ui->exportButton->setIcon(QIcon()); - } else { - ui->newAddress->setIcon(platformStyle->SingleColorIcon(":/icons/add")); - ui->copyAddress->setIcon(platformStyle->SingleColorIcon(":/icons/editcopy")); - ui->deleteAddress->setIcon(platformStyle->SingleColorIcon(":/icons/remove")); - ui->exportButton->setIcon(platformStyle->SingleColorIcon(":/icons/export")); - } - - switch(mode) - { - case ForSelection: - switch(tab) - { - case SendingTab: setWindowTitle(tr("Choose the address to send coins to")); break; - case ReceivingTab: setWindowTitle(tr("Choose the address to receive coins with")); break; - } - connect(ui->tableView, &QTableView::doubleClicked, this, &QDialog::accept); - ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); - ui->tableView->setFocus(); - ui->closeButton->setText(tr("C&hoose")); - ui->exportButton->hide(); - break; - case ForEditing: - switch(tab) - { - case SendingTab: setWindowTitle(tr("Sending addresses")); break; - case ReceivingTab: setWindowTitle(tr("Receiving addresses")); break; - } - break; - } - switch(tab) - { - case SendingTab: - ui->labelExplanation->setText(tr("These are your Defi addresses for sending payments. Always check the amount and the receiving address before sending coins.")); - ui->deleteAddress->setVisible(true); - ui->newAddress->setVisible(true); - break; - case ReceivingTab: - ui->labelExplanation->setText(tr("These are your Defi addresses for receiving payments. Use the 'Create new receiving address' button in the receive tab to create new addresses.")); - ui->deleteAddress->setVisible(false); - ui->newAddress->setVisible(false); - break; - } - - // Context menu actions - QAction *copyAddressAction = new QAction(tr("&Copy Address"), this); - QAction *copyLabelAction = new QAction(tr("Copy &Label"), this); - QAction *editAction = new QAction(tr("&Edit"), this); - deleteAction = new QAction(ui->deleteAddress->text(), this); - - // Build context menu - contextMenu = new QMenu(this); - contextMenu->addAction(copyAddressAction); - contextMenu->addAction(copyLabelAction); - contextMenu->addAction(editAction); - if(tab == SendingTab) - contextMenu->addAction(deleteAction); - contextMenu->addSeparator(); - - // Connect signals for context menu actions - connect(copyAddressAction, &QAction::triggered, this, &AddressBookPage::on_copyAddress_clicked); - connect(copyLabelAction, &QAction::triggered, this, &AddressBookPage::onCopyLabelAction); - connect(editAction, &QAction::triggered, this, &AddressBookPage::onEditAction); - connect(deleteAction, &QAction::triggered, this, &AddressBookPage::on_deleteAddress_clicked); - - connect(ui->tableView, &QWidget::customContextMenuRequested, this, &AddressBookPage::contextualMenu); - - connect(ui->closeButton, &QPushButton::clicked, this, &QDialog::accept); -} - -AddressBookPage::~AddressBookPage() -{ - delete ui; -} - -void AddressBookPage::setModel(AddressTableModel *_model) -{ - this->model = _model; - if(!_model) - return; - - auto type = tab == ReceivingTab ? AddressTableModel::Receive : AddressTableModel::Send; - proxyModel = new AddressBookSortFilterProxyModel(type, this); - proxyModel->setSourceModel(_model); - - connect(ui->searchLineEdit, &QLineEdit::textChanged, proxyModel, &QSortFilterProxyModel::setFilterWildcard); - - ui->tableView->setModel(proxyModel); - ui->tableView->sortByColumn(0, Qt::AscendingOrder); - - // Set column widths - ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Label, QHeaderView::Stretch); - ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents); - - connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, - this, &AddressBookPage::selectionChanged); - - // Select row for newly created address - connect(_model, &AddressTableModel::rowsInserted, this, &AddressBookPage::selectNewAddress); - - selectionChanged(); -} - -void AddressBookPage::on_copyAddress_clicked() -{ - GUIUtil::copyEntryData(ui->tableView, AddressTableModel::Address); -} - -void AddressBookPage::onCopyLabelAction() -{ - GUIUtil::copyEntryData(ui->tableView, AddressTableModel::Label); -} - -void AddressBookPage::onEditAction() -{ - if(!model) - return; - - if(!ui->tableView->selectionModel()) - return; - QModelIndexList indexes = ui->tableView->selectionModel()->selectedRows(); - if(indexes.isEmpty()) - return; - - EditAddressDialog dlg( - tab == SendingTab ? - EditAddressDialog::EditSendingAddress : - EditAddressDialog::EditReceivingAddress, this); - dlg.setModel(model); - QModelIndex origIndex = proxyModel->mapToSource(indexes.at(0)); - dlg.loadRow(origIndex.row()); - dlg.exec(); -} - -void AddressBookPage::on_newAddress_clicked() -{ - if(!model) - return; - - if (tab == ReceivingTab) { - return; - } - - EditAddressDialog dlg(EditAddressDialog::NewSendingAddress, this); - dlg.setModel(model); - if(dlg.exec()) - { - newAddressToSelect = dlg.getAddress(); - } -} - -void AddressBookPage::on_deleteAddress_clicked() -{ - QTableView *table = ui->tableView; - if(!table->selectionModel()) - return; - - QModelIndexList indexes = table->selectionModel()->selectedRows(); - if(!indexes.isEmpty()) - { - table->model()->removeRow(indexes.at(0).row()); - } -} - -void AddressBookPage::selectionChanged() -{ - // Set button states based on selected tab and selection - QTableView *table = ui->tableView; - if(!table->selectionModel()) - return; - - if(table->selectionModel()->hasSelection()) - { - switch(tab) - { - case SendingTab: - // In sending tab, allow deletion of selection - ui->deleteAddress->setEnabled(true); - ui->deleteAddress->setVisible(true); - deleteAction->setEnabled(true); - break; - case ReceivingTab: - // Deleting receiving addresses, however, is not allowed - ui->deleteAddress->setEnabled(false); - ui->deleteAddress->setVisible(false); - deleteAction->setEnabled(false); - break; - } - ui->copyAddress->setEnabled(true); - } - else - { - ui->deleteAddress->setEnabled(false); - ui->copyAddress->setEnabled(false); - } -} - -void AddressBookPage::done(int retval) -{ - QTableView *table = ui->tableView; - if(!table->selectionModel() || !table->model()) - return; - - // Figure out which address was selected, and return it - QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address); - - for (const QModelIndex& index : indexes) { - QVariant address = table->model()->data(index); - returnValue = address.toString(); - } - - if(returnValue.isEmpty()) - { - // If no address entry selected, return rejected - retval = Rejected; - } - - QDialog::done(retval); -} - -void AddressBookPage::on_exportButton_clicked() -{ - // CSV is currently the only supported format - QString filename = GUIUtil::getSaveFileName(this, - tr("Export Address List"), QString(), - tr("Comma separated file (*.csv)"), nullptr); - - if (filename.isNull()) - return; - - CSVModelWriter writer(filename); - - // name, column, role - writer.setModel(proxyModel); - writer.addColumn("Label", AddressTableModel::Label, Qt::EditRole); - writer.addColumn("Address", AddressTableModel::Address, Qt::EditRole); - - if(!writer.write()) { - QMessageBox::critical(this, tr("Exporting Failed"), - tr("There was an error trying to save the address list to %1. Please try again.").arg(filename)); - } -} - -void AddressBookPage::contextualMenu(const QPoint &point) -{ - QModelIndex index = ui->tableView->indexAt(point); - if(index.isValid()) - { - contextMenu->exec(QCursor::pos()); - } -} - -void AddressBookPage::selectNewAddress(const QModelIndex &parent, int begin, int /*end*/) -{ - QModelIndex idx = proxyModel->mapFromSource(model->index(begin, AddressTableModel::Address, parent)); - if(idx.isValid() && (idx.data(Qt::EditRole).toString() == newAddressToSelect)) - { - // Select row of newly created address, once - ui->tableView->setFocus(); - ui->tableView->selectRow(idx.row()); - newAddressToSelect.clear(); - } -} diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h deleted file mode 100644 index 0eddc671446..00000000000 --- a/src/qt/addressbookpage.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_ADDRESSBOOKPAGE_H -#define DEFI_QT_ADDRESSBOOKPAGE_H - -#include - -class AddressBookSortFilterProxyModel; -class AddressTableModel; -class PlatformStyle; - -namespace Ui { - class AddressBookPage; -} - -QT_BEGIN_NAMESPACE -class QItemSelection; -class QMenu; -class QModelIndex; -QT_END_NAMESPACE - -/** Widget that shows a list of sending or receiving addresses. - */ -class AddressBookPage : public QDialog -{ - Q_OBJECT - -public: - enum Tabs { - SendingTab = 0, - ReceivingTab = 1 - }; - - enum Mode { - ForSelection, /**< Open address book to pick address */ - ForEditing /**< Open address book for editing */ - }; - - explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent = nullptr); - ~AddressBookPage(); - - void setModel(AddressTableModel *model); - const QString &getReturnValue() const { return returnValue; } - -public Q_SLOTS: - void done(int retval); - -private: - Ui::AddressBookPage *ui; - AddressTableModel *model; - Mode mode; - Tabs tab; - QString returnValue; - AddressBookSortFilterProxyModel *proxyModel; - QMenu *contextMenu; - QAction *deleteAction; // to be able to explicitly disable it - QString newAddressToSelect; - -private Q_SLOTS: - /** Delete currently selected address entry */ - void on_deleteAddress_clicked(); - /** Create a new address for receiving coins and / or add a new address book entry */ - void on_newAddress_clicked(); - /** Copy address of currently selected address entry to clipboard */ - void on_copyAddress_clicked(); - /** Copy label of currently selected address entry to clipboard (no button) */ - void onCopyLabelAction(); - /** Edit currently selected address entry (no button) */ - void onEditAction(); - /** Export button clicked */ - void on_exportButton_clicked(); - - /** Set button states based on selected tab and selection */ - void selectionChanged(); - /** Spawn contextual menu (right mouse menu) for address book entry */ - void contextualMenu(const QPoint &point); - /** New entry/entries were added to address table */ - void selectNewAddress(const QModelIndex &parent, int begin, int /*end*/); - -Q_SIGNALS: - void sendCoins(QString addr); -}; - -#endif // DEFI_QT_ADDRESSBOOKPAGE_H diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp deleted file mode 100644 index 9a04011999e..00000000000 --- a/src/qt/addresstablemodel.cpp +++ /dev/null @@ -1,453 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include -#include - -#include -#include - -#include - -#include -#include - -const QString AddressTableModel::Send = "S"; -const QString AddressTableModel::Receive = "R"; - -struct AddressTableEntry -{ - enum Type { - Sending, - Receiving, - Hidden /* QSortFilterProxyModel will filter these out */ - }; - - Type type; - QString label; - QString address; - - AddressTableEntry() {} - AddressTableEntry(Type _type, const QString &_label, const QString &_address): - type(_type), label(_label), address(_address) {} -}; - -struct AddressTableEntryLessThan -{ - bool operator()(const AddressTableEntry &a, const AddressTableEntry &b) const - { - return a.address < b.address; - } - bool operator()(const AddressTableEntry &a, const QString &b) const - { - return a.address < b; - } - bool operator()(const QString &a, const AddressTableEntry &b) const - { - return a < b.address; - } -}; - -/* Determine address type from address purpose */ -static AddressTableEntry::Type translateTransactionType(const QString &strPurpose, bool isMine) -{ - AddressTableEntry::Type addressType = AddressTableEntry::Hidden; - // "refund" addresses aren't shown, and change addresses aren't in mapAddressBook at all. - if (strPurpose == "send") - addressType = AddressTableEntry::Sending; - else if (strPurpose == "receive") - addressType = AddressTableEntry::Receiving; - else if (strPurpose == "unknown" || strPurpose == "") // if purpose not set, guess - addressType = (isMine ? AddressTableEntry::Receiving : AddressTableEntry::Sending); - return addressType; -} - -// Private implementation -class AddressTablePriv -{ -public: - QList cachedAddressTable; - AddressTableModel *parent; - - explicit AddressTablePriv(AddressTableModel *_parent): - parent(_parent) {} - - void refreshAddressTable(interfaces::Wallet& wallet) - { - cachedAddressTable.clear(); - { - for (const auto& address : wallet.getAddresses()) - { - AddressTableEntry::Type addressType = translateTransactionType( - QString::fromStdString(address.purpose), address.is_mine); - cachedAddressTable.append(AddressTableEntry(addressType, - QString::fromStdString(address.name), - QString::fromStdString(EncodeDestination(address.dest)))); - } - } - // std::lower_bound() and std::upper_bound() require our cachedAddressTable list to be sorted in asc order - // Even though the map is already sorted this re-sorting step is needed because the originating map - // is sorted by binary address, not by base58() address. - std::sort(cachedAddressTable.begin(), cachedAddressTable.end(), AddressTableEntryLessThan()); - } - - void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status) - { - // Find address / label in model - QList::iterator lower = std::lower_bound( - cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan()); - QList::iterator upper = std::upper_bound( - cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan()); - int lowerIndex = (lower - cachedAddressTable.begin()); - int upperIndex = (upper - cachedAddressTable.begin()); - bool inModel = (lower != upper); - AddressTableEntry::Type newEntryType = translateTransactionType(purpose, isMine); - - switch(status) - { - case CT_NEW: - if(inModel) - { - qWarning() << "AddressTablePriv::updateEntry: Warning: Got CT_NEW, but entry is already in model"; - break; - } - parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex); - cachedAddressTable.insert(lowerIndex, AddressTableEntry(newEntryType, label, address)); - parent->endInsertRows(); - break; - case CT_UPDATED: - if(!inModel) - { - qWarning() << "AddressTablePriv::updateEntry: Warning: Got CT_UPDATED, but entry is not in model"; - break; - } - lower->type = newEntryType; - lower->label = label; - parent->emitDataChanged(lowerIndex); - break; - case CT_DELETED: - if(!inModel) - { - qWarning() << "AddressTablePriv::updateEntry: Warning: Got CT_DELETED, but entry is not in model"; - break; - } - parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1); - cachedAddressTable.erase(lower, upper); - parent->endRemoveRows(); - break; - } - } - - int size() - { - return cachedAddressTable.size(); - } - - AddressTableEntry *index(int idx) - { - if(idx >= 0 && idx < cachedAddressTable.size()) - { - return &cachedAddressTable[idx]; - } - else - { - return nullptr; - } - } -}; - -AddressTableModel::AddressTableModel(WalletModel *parent) : - QAbstractTableModel(parent), walletModel(parent) -{ - columns << tr("Label") << tr("Address"); - priv = new AddressTablePriv(this); - priv->refreshAddressTable(parent->wallet()); -} - -AddressTableModel::~AddressTableModel() -{ - delete priv; -} - -int AddressTableModel::rowCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent); - return priv->size(); -} - -int AddressTableModel::columnCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent); - return columns.length(); -} - -QVariant AddressTableModel::data(const QModelIndex &index, int role) const -{ - if(!index.isValid()) - return QVariant(); - - AddressTableEntry *rec = static_cast(index.internalPointer()); - - if(role == Qt::DisplayRole || role == Qt::EditRole) - { - switch(index.column()) - { - case Label: - if(rec->label.isEmpty() && role == Qt::DisplayRole) - { - return tr("(no label)"); - } - else - { - return rec->label; - } - case Address: - return rec->address; - } - } - else if (role == Qt::FontRole) - { - QFont font; - if(index.column() == Address) - { - font = GUIUtil::fixedPitchFont(); - } - return font; - } - else if (role == TypeRole) - { - switch(rec->type) - { - case AddressTableEntry::Sending: - return Send; - case AddressTableEntry::Receiving: - return Receive; - default: break; - } - } - return QVariant(); -} - -bool AddressTableModel::setData(const QModelIndex &index, const QVariant &value, int role) -{ - if(!index.isValid()) - return false; - AddressTableEntry *rec = static_cast(index.internalPointer()); - std::string strPurpose = (rec->type == AddressTableEntry::Sending ? "send" : "receive"); - editStatus = OK; - - if(role == Qt::EditRole) - { - CTxDestination curAddress = DecodeDestination(rec->address.toStdString()); - if(index.column() == Label) - { - // Do nothing, if old label == new label - if(rec->label == value.toString()) - { - editStatus = NO_CHANGES; - return false; - } - walletModel->wallet().setAddressBook(curAddress, value.toString().toStdString(), strPurpose); - } else if(index.column() == Address) { - CTxDestination newAddress = DecodeDestination(value.toString().toStdString()); - // Refuse to set invalid address, set error status and return false - if(boost::get(&newAddress)) - { - editStatus = INVALID_ADDRESS; - return false; - } - // Do nothing, if old address == new address - else if(newAddress == curAddress) - { - editStatus = NO_CHANGES; - return false; - } - // Check for duplicate addresses to prevent accidental deletion of addresses, if you try - // to paste an existing address over another address (with a different label) - if (walletModel->wallet().getAddress( - newAddress, /* name= */ nullptr, /* is_mine= */ nullptr, /* purpose= */ nullptr)) - { - editStatus = DUPLICATE_ADDRESS; - return false; - } - // Double-check that we're not overwriting a receiving address - else if(rec->type == AddressTableEntry::Sending) - { - // Remove old entry - walletModel->wallet().delAddressBook(curAddress); - // Add new entry with new address - walletModel->wallet().setAddressBook(newAddress, value.toString().toStdString(), strPurpose); - } - } - return true; - } - return false; -} - -QVariant AddressTableModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if(orientation == Qt::Horizontal) - { - if(role == Qt::DisplayRole && section < columns.size()) - { - return columns[section]; - } - } - return QVariant(); -} - -Qt::ItemFlags AddressTableModel::flags(const QModelIndex &index) const -{ - if (!index.isValid()) return Qt::NoItemFlags; - - AddressTableEntry *rec = static_cast(index.internalPointer()); - - Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; - // Can edit address and label for sending addresses, - // and only label for receiving addresses. - if(rec->type == AddressTableEntry::Sending || - (rec->type == AddressTableEntry::Receiving && index.column()==Label)) - { - retval |= Qt::ItemIsEditable; - } - return retval; -} - -QModelIndex AddressTableModel::index(int row, int column, const QModelIndex &parent) const -{ - Q_UNUSED(parent); - AddressTableEntry *data = priv->index(row); - if(data) - { - return createIndex(row, column, priv->index(row)); - } - else - { - return QModelIndex(); - } -} - -void AddressTableModel::updateEntry(const QString &address, - const QString &label, bool isMine, const QString &purpose, int status) -{ - // Update address book model from Defi core - priv->updateEntry(address, label, isMine, purpose, status); -} - -QString AddressTableModel::addRow(const QString &type, const QString &label, const QString &address, const OutputType address_type) -{ - std::string strLabel = label.toStdString(); - std::string strAddress = address.toStdString(); - - editStatus = OK; - - if(type == Send) - { - if(!walletModel->validateAddress(address)) - { - editStatus = INVALID_ADDRESS; - return QString(); - } - // Check for duplicate addresses - { - if (walletModel->wallet().getAddress( - DecodeDestination(strAddress), /* name= */ nullptr, /* is_mine= */ nullptr, /* purpose= */ nullptr)) - { - editStatus = DUPLICATE_ADDRESS; - return QString(); - } - } - - // Add entry - walletModel->wallet().setAddressBook(DecodeDestination(strAddress), strLabel, "send"); - } - else if(type == Receive) - { - // Generate a new address to associate with given label - CTxDestination dest; - if(!walletModel->wallet().getNewDestination(address_type, strLabel, dest)) - { - WalletModel::UnlockContext ctx(walletModel->requestUnlock()); - if(!ctx.isValid()) - { - // Unlock wallet failed or was cancelled - editStatus = WALLET_UNLOCK_FAILURE; - return QString(); - } - if(!walletModel->wallet().getNewDestination(address_type, strLabel, dest)) - { - editStatus = KEY_GENERATION_FAILURE; - return QString(); - } - } - strAddress = EncodeDestination(dest); - } - else - { - return QString(); - } - return QString::fromStdString(strAddress); -} - -bool AddressTableModel::removeRows(int row, int count, const QModelIndex &parent) -{ - Q_UNUSED(parent); - AddressTableEntry *rec = priv->index(row); - if(count != 1 || !rec || rec->type == AddressTableEntry::Receiving) - { - // Can only remove one row at a time, and cannot remove rows not in model. - // Also refuse to remove receiving addresses. - return false; - } - walletModel->wallet().delAddressBook(DecodeDestination(rec->address.toStdString())); - return true; -} - -QString AddressTableModel::labelForAddress(const QString &address) const -{ - std::string name; - if (getAddressData(address, &name, /* purpose= */ nullptr)) { - return QString::fromStdString(name); - } - return QString(); -} - -QString AddressTableModel::purposeForAddress(const QString &address) const -{ - std::string purpose; - if (getAddressData(address, /* name= */ nullptr, &purpose)) { - return QString::fromStdString(purpose); - } - return QString(); -} - -bool AddressTableModel::getAddressData(const QString &address, - std::string* name, - std::string* purpose) const { - CTxDestination destination = DecodeDestination(address.toStdString()); - return walletModel->wallet().getAddress(destination, name, /* is_mine= */ nullptr, purpose); -} - -int AddressTableModel::lookupAddress(const QString &address) const -{ - QModelIndexList lst = match(index(0, Address, QModelIndex()), - Qt::EditRole, address, 1, Qt::MatchExactly); - if(lst.isEmpty()) - { - return -1; - } - else - { - return lst.at(0).row(); - } -} - -OutputType AddressTableModel::GetDefaultAddressType() const { return walletModel->wallet().getDefaultAddressType(); }; - -void AddressTableModel::emitDataChanged(int idx) -{ - Q_EMIT dataChanged(index(idx, 0, QModelIndex()), index(idx, columns.length()-1, QModelIndex())); -} diff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h deleted file mode 100644 index 9876e3b8af2..00000000000 --- a/src/qt/addresstablemodel.h +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_ADDRESSTABLEMODEL_H -#define DEFI_QT_ADDRESSTABLEMODEL_H - -#include -#include - -enum class OutputType; - -class AddressTablePriv; -class WalletModel; - -namespace interfaces { -class Wallet; -} - -/** - Qt model of the address book in the core. This allows views to access and modify the address book. - */ -class AddressTableModel : public QAbstractTableModel -{ - Q_OBJECT - -public: - explicit AddressTableModel(WalletModel *parent = nullptr); - ~AddressTableModel(); - - enum ColumnIndex { - Label = 0, /**< User specified label */ - Address = 1 /**< Defi address */ - }; - - enum RoleIndex { - TypeRole = Qt::UserRole /**< Type of address (#Send or #Receive) */ - }; - - /** Return status of edit/insert operation */ - enum EditStatus { - OK, /**< Everything ok */ - NO_CHANGES, /**< No changes were made during edit operation */ - INVALID_ADDRESS, /**< Unparseable address */ - DUPLICATE_ADDRESS, /**< Address already in address book */ - WALLET_UNLOCK_FAILURE, /**< Wallet could not be unlocked to create new receiving address */ - KEY_GENERATION_FAILURE /**< Generating a new public key for a receiving address failed */ - }; - - static const QString Send; /**< Specifies send address */ - static const QString Receive; /**< Specifies receive address */ - - /** @name Methods overridden from QAbstractTableModel - @{*/ - int rowCount(const QModelIndex &parent) const; - int columnCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &index, int role) const; - bool setData(const QModelIndex &index, const QVariant &value, int role); - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - QModelIndex index(int row, int column, const QModelIndex &parent) const; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); - Qt::ItemFlags flags(const QModelIndex &index) const; - /*@}*/ - - /* Add an address to the model. - Returns the added address on success, and an empty string otherwise. - */ - QString addRow(const QString &type, const QString &label, const QString &address, const OutputType address_type); - - /** Look up label for address in address book, if not found return empty string. */ - QString labelForAddress(const QString &address) const; - - /** Look up purpose for address in address book, if not found return empty string. */ - QString purposeForAddress(const QString &address) const; - - /* Look up row index of an address in the model. - Return -1 if not found. - */ - int lookupAddress(const QString &address) const; - - EditStatus getEditStatus() const { return editStatus; } - - OutputType GetDefaultAddressType() const; - -private: - WalletModel* const walletModel; - AddressTablePriv *priv = nullptr; - QStringList columns; - EditStatus editStatus = OK; - - /** Look up address book data given an address string. */ - bool getAddressData(const QString &address, std::string* name, std::string* purpose) const; - - /** Notify listeners that data changed. */ - void emitDataChanged(int index); - -public Q_SLOTS: - /* Update address list from core. - */ - void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status); - - friend class AddressTablePriv; -}; - -#endif // DEFI_QT_ADDRESSTABLEMODEL_H diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp deleted file mode 100644 index 88c6b690867..00000000000 --- a/src/qt/askpassphrasedialog.cpp +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#if defined(HAVE_CONFIG_H) -#include -#endif - -#include -#include - -#include -#include - -#include - -#include -#include -#include - -AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent) : - QDialog(parent), - ui(new Ui::AskPassphraseDialog), - mode(_mode), - model(nullptr), - fCapsLock(false) -{ - ui->setupUi(this); - - ui->passEdit1->setMinimumSize(ui->passEdit1->sizeHint()); - ui->passEdit2->setMinimumSize(ui->passEdit2->sizeHint()); - ui->passEdit3->setMinimumSize(ui->passEdit3->sizeHint()); - - ui->passEdit1->setMaxLength(MAX_PASSPHRASE_SIZE); - ui->passEdit2->setMaxLength(MAX_PASSPHRASE_SIZE); - ui->passEdit3->setMaxLength(MAX_PASSPHRASE_SIZE); - - // Setup Caps Lock detection. - ui->passEdit1->installEventFilter(this); - ui->passEdit2->installEventFilter(this); - ui->passEdit3->installEventFilter(this); - - switch(mode) - { - case Encrypt: // Ask passphrase x2 - ui->warningLabel->setText(tr("Enter the new passphrase to the wallet.
Please use a passphrase of ten or more random characters, or eight or more words.")); - ui->passLabel1->hide(); - ui->passEdit1->hide(); - setWindowTitle(tr("Encrypt wallet")); - break; - case Unlock: // Ask passphrase - ui->warningLabel->setText(tr("This operation needs your wallet passphrase to unlock the wallet.")); - ui->passLabel2->hide(); - ui->passEdit2->hide(); - ui->passLabel3->hide(); - ui->passEdit3->hide(); - setWindowTitle(tr("Unlock wallet")); - break; - case Decrypt: // Ask passphrase - ui->warningLabel->setText(tr("This operation needs your wallet passphrase to decrypt the wallet.")); - ui->passLabel2->hide(); - ui->passEdit2->hide(); - ui->passLabel3->hide(); - ui->passEdit3->hide(); - setWindowTitle(tr("Decrypt wallet")); - break; - case ChangePass: // Ask old passphrase + new passphrase x2 - setWindowTitle(tr("Change passphrase")); - ui->warningLabel->setText(tr("Enter the old passphrase and new passphrase to the wallet.")); - break; - } - textChanged(); - connect(ui->toggleShowPasswordButton, &QPushButton::toggled, this, &AskPassphraseDialog::toggleShowPassword); - connect(ui->passEdit1, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); - connect(ui->passEdit2, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); - connect(ui->passEdit3, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); -} - -AskPassphraseDialog::~AskPassphraseDialog() -{ - secureClearPassFields(); - delete ui; -} - -void AskPassphraseDialog::setModel(WalletModel *_model) -{ - this->model = _model; -} - -void AskPassphraseDialog::accept() -{ - SecureString oldpass, newpass1, newpass2; - if(!model) - return; - oldpass.reserve(MAX_PASSPHRASE_SIZE); - newpass1.reserve(MAX_PASSPHRASE_SIZE); - newpass2.reserve(MAX_PASSPHRASE_SIZE); - // TODO: get rid of this .c_str() by implementing SecureString::operator=(std::string) - // Alternately, find a way to make this input mlock()'d to begin with. - oldpass.assign(ui->passEdit1->text().toStdString().c_str()); - newpass1.assign(ui->passEdit2->text().toStdString().c_str()); - newpass2.assign(ui->passEdit3->text().toStdString().c_str()); - - secureClearPassFields(); - - switch(mode) - { - case Encrypt: { - if(newpass1.empty() || newpass2.empty()) - { - // Cannot encrypt with empty passphrase - break; - } - QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm wallet encryption"), - tr("Warning: If you encrypt your wallet and lose your passphrase, you will LOSE ALL OF YOUR DEFIS!") + "

" + tr("Are you sure you wish to encrypt your wallet?"), - QMessageBox::Yes|QMessageBox::Cancel, - QMessageBox::Cancel); - if(retval == QMessageBox::Yes) - { - if(newpass1 == newpass2) - { - if(model->setWalletEncrypted(true, newpass1)) - { - QMessageBox::warning(this, tr("Wallet encrypted"), - "" + - tr("Your wallet is now encrypted. " - "Remember that encrypting your wallet cannot fully protect " - "your defis from being stolen by malware infecting your computer.") + - "

" + - tr("IMPORTANT: Any previous backups you have made of your wallet file " - "should be replaced with the newly generated, encrypted wallet file. " - "For security reasons, previous backups of the unencrypted wallet file " - "will become useless as soon as you start using the new, encrypted wallet.") + - "
"); - } - else - { - QMessageBox::critical(this, tr("Wallet encryption failed"), - tr("Wallet encryption failed due to an internal error. Your wallet was not encrypted.")); - } - QDialog::accept(); // Success - } - else - { - QMessageBox::critical(this, tr("Wallet encryption failed"), - tr("The supplied passphrases do not match.")); - } - } - else - { - QDialog::reject(); // Cancelled - } - } break; - case Unlock: - try { - if (!model->setWalletLocked(false, oldpass)) { - QMessageBox::critical(this, tr("Wallet unlock failed"), - tr("The passphrase entered for the wallet decryption was incorrect.")); - } else { - QDialog::accept(); // Success - } - } catch (const std::runtime_error& e) { - QMessageBox::critical(this, tr("Wallet unlock failed"), e.what()); - } - break; - case Decrypt: - if(!model->setWalletEncrypted(false, oldpass)) - { - QMessageBox::critical(this, tr("Wallet decryption failed"), - tr("The passphrase entered for the wallet decryption was incorrect.")); - } - else - { - QDialog::accept(); // Success - } - break; - case ChangePass: - if(newpass1 == newpass2) - { - if(model->changePassphrase(oldpass, newpass1)) - { - QMessageBox::information(this, tr("Wallet encrypted"), - tr("Wallet passphrase was successfully changed.")); - QDialog::accept(); // Success - } - else - { - QMessageBox::critical(this, tr("Wallet encryption failed"), - tr("The passphrase entered for the wallet decryption was incorrect.")); - } - } - else - { - QMessageBox::critical(this, tr("Wallet encryption failed"), - tr("The supplied passphrases do not match.")); - } - break; - } -} - -void AskPassphraseDialog::textChanged() -{ - // Validate input, set Ok button to enabled when acceptable - bool acceptable = false; - switch(mode) - { - case Encrypt: // New passphrase x2 - acceptable = !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty(); - break; - case Unlock: // Old passphrase x1 - case Decrypt: - acceptable = !ui->passEdit1->text().isEmpty(); - break; - case ChangePass: // Old passphrase x1, new passphrase x2 - acceptable = !ui->passEdit1->text().isEmpty() && !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty(); - break; - } - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(acceptable); -} - -bool AskPassphraseDialog::event(QEvent *event) -{ - // Detect Caps Lock key press. - if (event->type() == QEvent::KeyPress) { - QKeyEvent *ke = static_cast(event); - if (ke->key() == Qt::Key_CapsLock) { - fCapsLock = !fCapsLock; - } - if (fCapsLock) { - ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!")); - } else { - ui->capsLabel->clear(); - } - } - return QWidget::event(event); -} - -void AskPassphraseDialog::toggleShowPassword(bool show) -{ - ui->toggleShowPasswordButton->setDown(show); - const auto mode = show ? QLineEdit::Normal : QLineEdit::Password; - ui->passEdit1->setEchoMode(mode); - ui->passEdit2->setEchoMode(mode); - ui->passEdit3->setEchoMode(mode); -} - -bool AskPassphraseDialog::eventFilter(QObject *object, QEvent *event) -{ - /* Detect Caps Lock. - * There is no good OS-independent way to check a key state in Qt, but we - * can detect Caps Lock by checking for the following condition: - * Shift key is down and the result is a lower case character, or - * Shift key is not down and the result is an upper case character. - */ - if (event->type() == QEvent::KeyPress) { - QKeyEvent *ke = static_cast(event); - QString str = ke->text(); - if (str.length() != 0) { - const QChar *psz = str.unicode(); - bool fShift = (ke->modifiers() & Qt::ShiftModifier) != 0; - if ((fShift && *psz >= 'a' && *psz <= 'z') || (!fShift && *psz >= 'A' && *psz <= 'Z')) { - fCapsLock = true; - ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!")); - } else if (psz->isLetter()) { - fCapsLock = false; - ui->capsLabel->clear(); - } - } - } - return QDialog::eventFilter(object, event); -} - -static void SecureClearQLineEdit(QLineEdit* edit) -{ - // Attempt to overwrite text so that they do not linger around in memory - edit->setText(QString(" ").repeated(edit->text().size())); - edit->clear(); -} - -void AskPassphraseDialog::secureClearPassFields() -{ - SecureClearQLineEdit(ui->passEdit1); - SecureClearQLineEdit(ui->passEdit2); - SecureClearQLineEdit(ui->passEdit3); -} diff --git a/src/qt/askpassphrasedialog.h b/src/qt/askpassphrasedialog.h deleted file mode 100644 index 536236306b0..00000000000 --- a/src/qt/askpassphrasedialog.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_ASKPASSPHRASEDIALOG_H -#define DEFI_QT_ASKPASSPHRASEDIALOG_H - -#include - -class WalletModel; - -namespace Ui { - class AskPassphraseDialog; -} - -/** Multifunctional dialog to ask for passphrases. Used for encryption, unlocking, and changing the passphrase. - */ -class AskPassphraseDialog : public QDialog -{ - Q_OBJECT - -public: - enum Mode { - Encrypt, /**< Ask passphrase twice and encrypt */ - Unlock, /**< Ask passphrase and unlock */ - ChangePass, /**< Ask old passphrase + new passphrase twice */ - Decrypt /**< Ask passphrase and decrypt wallet */ - }; - - explicit AskPassphraseDialog(Mode mode, QWidget *parent); - ~AskPassphraseDialog(); - - void accept(); - - void setModel(WalletModel *model); - -private: - Ui::AskPassphraseDialog *ui; - Mode mode; - WalletModel *model; - bool fCapsLock; - -private Q_SLOTS: - void textChanged(); - void secureClearPassFields(); - void toggleShowPassword(bool); - -protected: - bool event(QEvent *event); - bool eventFilter(QObject *object, QEvent *event); -}; - -#endif // DEFI_QT_ASKPASSPHRASEDIALOG_H diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp deleted file mode 100644 index efc726e09e3..00000000000 --- a/src/qt/bantablemodel.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include - -#include -#include -#include - -#include - -#include -#include - -bool BannedNodeLessThan::operator()(const CCombinedBan& left, const CCombinedBan& right) const -{ - const CCombinedBan* pLeft = &left; - const CCombinedBan* pRight = &right; - - if (order == Qt::DescendingOrder) - std::swap(pLeft, pRight); - - switch(column) - { - case BanTableModel::Address: - return pLeft->subnet.ToString().compare(pRight->subnet.ToString()) < 0; - case BanTableModel::Bantime: - return pLeft->banEntry.nBanUntil < pRight->banEntry.nBanUntil; - } - - return false; -} - -// private implementation -class BanTablePriv -{ -public: - /** Local cache of peer information */ - QList cachedBanlist; - /** Column to sort nodes by (default to unsorted) */ - int sortColumn{-1}; - /** Order (ascending or descending) to sort nodes by */ - Qt::SortOrder sortOrder; - - /** Pull a full list of banned nodes from CNode into our cache */ - void refreshBanlist(interfaces::Node& node) - { - banmap_t banMap; - node.getBanned(banMap); - - cachedBanlist.clear(); - cachedBanlist.reserve(banMap.size()); - for (const auto& entry : banMap) - { - CCombinedBan banEntry; - banEntry.subnet = entry.first; - banEntry.banEntry = entry.second; - cachedBanlist.append(banEntry); - } - - if (sortColumn >= 0) - // sort cachedBanlist (use stable sort to prevent rows jumping around unnecessarily) - std::stable_sort(cachedBanlist.begin(), cachedBanlist.end(), BannedNodeLessThan(sortColumn, sortOrder)); - } - - int size() const - { - return cachedBanlist.size(); - } - - CCombinedBan *index(int idx) - { - if (idx >= 0 && idx < cachedBanlist.size()) - return &cachedBanlist[idx]; - - return nullptr; - } -}; - -BanTableModel::BanTableModel(interfaces::Node& node, ClientModel *parent) : - QAbstractTableModel(parent), - m_node(node), - clientModel(parent) -{ - columns << tr("IP/Netmask") << tr("Banned Until"); - priv.reset(new BanTablePriv()); - - // load initial data - refresh(); -} - -BanTableModel::~BanTableModel() -{ - // Intentionally left empty -} - -int BanTableModel::rowCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent); - return priv->size(); -} - -int BanTableModel::columnCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent); - return columns.length(); -} - -QVariant BanTableModel::data(const QModelIndex &index, int role) const -{ - if(!index.isValid()) - return QVariant(); - - CCombinedBan *rec = static_cast(index.internalPointer()); - - if (role == Qt::DisplayRole) { - switch(index.column()) - { - case Address: - return QString::fromStdString(rec->subnet.ToString()); - case Bantime: - QDateTime date = QDateTime::fromMSecsSinceEpoch(0); - date = date.addSecs(rec->banEntry.nBanUntil); - return date.toString(Qt::SystemLocaleLongDate); - } - } - - return QVariant(); -} - -QVariant BanTableModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if(orientation == Qt::Horizontal) - { - if(role == Qt::DisplayRole && section < columns.size()) - { - return columns[section]; - } - } - return QVariant(); -} - -Qt::ItemFlags BanTableModel::flags(const QModelIndex &index) const -{ - if (!index.isValid()) return Qt::NoItemFlags; - - Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; - return retval; -} - -QModelIndex BanTableModel::index(int row, int column, const QModelIndex &parent) const -{ - Q_UNUSED(parent); - CCombinedBan *data = priv->index(row); - - if (data) - return createIndex(row, column, data); - return QModelIndex(); -} - -void BanTableModel::refresh() -{ - Q_EMIT layoutAboutToBeChanged(); - priv->refreshBanlist(m_node); - Q_EMIT layoutChanged(); -} - -void BanTableModel::sort(int column, Qt::SortOrder order) -{ - priv->sortColumn = column; - priv->sortOrder = order; - refresh(); -} - -bool BanTableModel::shouldShow() -{ - return priv->size() > 0; -} diff --git a/src/qt/bantablemodel.h b/src/qt/bantablemodel.h deleted file mode 100644 index df834afb2fb..00000000000 --- a/src/qt/bantablemodel.h +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_BANTABLEMODEL_H -#define DEFI_QT_BANTABLEMODEL_H - -#include - -#include - -#include -#include - -class ClientModel; -class BanTablePriv; - -namespace interfaces { - class Node; -} - -struct CCombinedBan { - CSubNet subnet; - CBanEntry banEntry; -}; - -class BannedNodeLessThan -{ -public: - BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder) : - column(nColumn), order(fOrder) {} - bool operator()(const CCombinedBan& left, const CCombinedBan& right) const; - -private: - int column; - Qt::SortOrder order; -}; - -/** - Qt model providing information about connected peers, similar to the - "getpeerinfo" RPC call. Used by the rpc console UI. - */ -class BanTableModel : public QAbstractTableModel -{ - Q_OBJECT - -public: - explicit BanTableModel(interfaces::Node& node, ClientModel *parent = nullptr); - ~BanTableModel(); - void startAutoRefresh(); - void stopAutoRefresh(); - - enum ColumnIndex { - Address = 0, - Bantime = 1 - }; - - /** @name Methods overridden from QAbstractTableModel - @{*/ - int rowCount(const QModelIndex &parent) const; - int columnCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &index, int role) const; - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - QModelIndex index(int row, int column, const QModelIndex &parent) const; - Qt::ItemFlags flags(const QModelIndex &index) const; - void sort(int column, Qt::SortOrder order); - bool shouldShow(); - /*@}*/ - -public Q_SLOTS: - void refresh(); - -private: - interfaces::Node& m_node; - ClientModel *clientModel; - QStringList columns; - std::unique_ptr priv; -}; - -#endif // DEFI_QT_BANTABLEMODEL_H diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp deleted file mode 100644 index 238be084804..00000000000 --- a/src/qt/clientmodel.cpp +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -static int64_t nLastHeaderTipUpdateNotification = 0; -static int64_t nLastBlockTipUpdateNotification = 0; - -ClientModel::ClientModel(interfaces::Node& node, OptionsModel *_optionsModel, QObject *parent) : - QObject(parent), - m_node(node), - optionsModel(_optionsModel), - peerTableModel(nullptr), - banTableModel(nullptr), - pollTimer(nullptr) -{ - cachedBestHeaderHeight = -1; - cachedBestHeaderTime = -1; - peerTableModel = new PeerTableModel(m_node, this); - banTableModel = new BanTableModel(m_node, this); - pollTimer = new QTimer(this); - connect(pollTimer, &QTimer::timeout, this, &ClientModel::updateTimer); - pollTimer->start(MODEL_UPDATE_DELAY); - - subscribeToCoreSignals(); -} - -ClientModel::~ClientModel() -{ - unsubscribeFromCoreSignals(); -} - -int ClientModel::getNumConnections(unsigned int flags) const -{ - CConnman::NumConnections connections = CConnman::CONNECTIONS_NONE; - - if(flags == CONNECTIONS_IN) - connections = CConnman::CONNECTIONS_IN; - else if (flags == CONNECTIONS_OUT) - connections = CConnman::CONNECTIONS_OUT; - else if (flags == CONNECTIONS_ALL) - connections = CConnman::CONNECTIONS_ALL; - - return m_node.getNodeCount(connections); -} - -int ClientModel::getHeaderTipHeight() const -{ - if (cachedBestHeaderHeight == -1) { - // make sure we initially populate the cache via a cs_main lock - // otherwise we need to wait for a tip update - int height; - int64_t blockTime; - if (m_node.getHeaderTip(height, blockTime)) { - cachedBestHeaderHeight = height; - cachedBestHeaderTime = blockTime; - } - } - return cachedBestHeaderHeight; -} - -int64_t ClientModel::getHeaderTipTime() const -{ - if (cachedBestHeaderTime == -1) { - int height; - int64_t blockTime; - if (m_node.getHeaderTip(height, blockTime)) { - cachedBestHeaderHeight = height; - cachedBestHeaderTime = blockTime; - } - } - return cachedBestHeaderTime; -} - -void ClientModel::updateTimer() -{ - // no locking required at this point - // the following calls will acquire the required lock - Q_EMIT mempoolSizeChanged(m_node.getMempoolSize(), m_node.getMempoolDynamicUsage()); - Q_EMIT bytesChanged(m_node.getTotalBytesRecv(), m_node.getTotalBytesSent()); -} - -void ClientModel::updateNumConnections(int numConnections) -{ - Q_EMIT numConnectionsChanged(numConnections); -} - -void ClientModel::updateNetworkActive(bool networkActive) -{ - Q_EMIT networkActiveChanged(networkActive); -} - -void ClientModel::updateAlert() -{ - Q_EMIT alertsChanged(getStatusBarWarnings()); -} - -enum BlockSource ClientModel::getBlockSource() const -{ - if (m_node.getReindex()) - return BlockSource::REINDEX; - else if (m_node.getImporting()) - return BlockSource::DISK; - else if (getNumConnections() > 0) - return BlockSource::NETWORK; - - return BlockSource::NONE; -} - -QString ClientModel::getStatusBarWarnings() const -{ - return QString::fromStdString(m_node.getWarnings("gui")); -} - -OptionsModel *ClientModel::getOptionsModel() -{ - return optionsModel; -} - -PeerTableModel *ClientModel::getPeerTableModel() -{ - return peerTableModel; -} - -BanTableModel *ClientModel::getBanTableModel() -{ - return banTableModel; -} - -QString ClientModel::formatFullVersion() const -{ - return QString::fromStdString(FormatFullVersion()); -} - -QString ClientModel::formatSubVersion() const -{ - return QString::fromStdString(strSubVersion); -} - -bool ClientModel::isReleaseVersion() const -{ - return CLIENT_VERSION_IS_RELEASE; -} - -QString ClientModel::formatClientStartupTime() const -{ - return QDateTime::fromTime_t(GetStartupTime()).toString(); -} - -QString ClientModel::dataDir() const -{ - return GUIUtil::boostPathToQString(GetDataDir()); -} - -QString ClientModel::blocksDir() const -{ - return GUIUtil::boostPathToQString(GetBlocksDir()); -} - -void ClientModel::updateBanlist() -{ - banTableModel->refresh(); -} - -// Handlers for core signals -static void ShowProgress(ClientModel *clientmodel, const std::string &title, int nProgress) -{ - // emits signal "showProgress" - bool invoked = QMetaObject::invokeMethod(clientmodel, "showProgress", Qt::QueuedConnection, - Q_ARG(QString, QString::fromStdString(title)), - Q_ARG(int, nProgress)); - assert(invoked); -} - -static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConnections) -{ - // Too noisy: qDebug() << "NotifyNumConnectionsChanged: " + QString::number(newNumConnections); - bool invoked = QMetaObject::invokeMethod(clientmodel, "updateNumConnections", Qt::QueuedConnection, - Q_ARG(int, newNumConnections)); - assert(invoked); -} - -static void NotifyNetworkActiveChanged(ClientModel *clientmodel, bool networkActive) -{ - bool invoked = QMetaObject::invokeMethod(clientmodel, "updateNetworkActive", Qt::QueuedConnection, - Q_ARG(bool, networkActive)); - assert(invoked); -} - -static void NotifyAlertChanged(ClientModel *clientmodel) -{ - qDebug() << "NotifyAlertChanged"; - bool invoked = QMetaObject::invokeMethod(clientmodel, "updateAlert", Qt::QueuedConnection); - assert(invoked); -} - -static void BannedListChanged(ClientModel *clientmodel) -{ - qDebug() << QString("%1: Requesting update for peer banlist").arg(__func__); - bool invoked = QMetaObject::invokeMethod(clientmodel, "updateBanlist", Qt::QueuedConnection); - assert(invoked); -} - -static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, int height, int64_t blockTime, double verificationProgress, bool fHeader) -{ - // lock free async UI updates in case we have a new block tip - // during initial sync, only update the UI if the last update - // was > 250ms (MODEL_UPDATE_DELAY) ago - int64_t now = 0; - if (initialSync) - now = GetTimeMillis(); - - int64_t& nLastUpdateNotification = fHeader ? nLastHeaderTipUpdateNotification : nLastBlockTipUpdateNotification; - - if (fHeader) { - // cache best headers time and height to reduce future cs_main locks - clientmodel->cachedBestHeaderHeight = height; - clientmodel->cachedBestHeaderTime = blockTime; - } - // if we are in-sync or if we notify a header update, update the UI regardless of last update time - if (fHeader || !initialSync || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) { - //pass an async signal to the UI thread - bool invoked = QMetaObject::invokeMethod(clientmodel, "numBlocksChanged", Qt::QueuedConnection, - Q_ARG(int, height), - Q_ARG(QDateTime, QDateTime::fromTime_t(blockTime)), - Q_ARG(double, verificationProgress), - Q_ARG(bool, fHeader)); - assert(invoked); - nLastUpdateNotification = now; - } -} - -void ClientModel::subscribeToCoreSignals() -{ - // Connect signals to client - m_handler_show_progress = m_node.handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2)); - m_handler_notify_num_connections_changed = m_node.handleNotifyNumConnectionsChanged(std::bind(NotifyNumConnectionsChanged, this, std::placeholders::_1)); - m_handler_notify_network_active_changed = m_node.handleNotifyNetworkActiveChanged(std::bind(NotifyNetworkActiveChanged, this, std::placeholders::_1)); - m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(std::bind(NotifyAlertChanged, this)); - m_handler_banned_list_changed = m_node.handleBannedListChanged(std::bind(BannedListChanged, this)); - m_handler_notify_block_tip = m_node.handleNotifyBlockTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, false)); - m_handler_notify_header_tip = m_node.handleNotifyHeaderTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, true)); -} - -void ClientModel::unsubscribeFromCoreSignals() -{ - // Disconnect signals from client - m_handler_show_progress->disconnect(); - m_handler_notify_num_connections_changed->disconnect(); - m_handler_notify_network_active_changed->disconnect(); - m_handler_notify_alert_changed->disconnect(); - m_handler_banned_list_changed->disconnect(); - m_handler_notify_block_tip->disconnect(); - m_handler_notify_header_tip->disconnect(); -} - -bool ClientModel::getProxyInfo(std::string& ip_port) const -{ - proxyType ipv4, ipv6; - if (m_node.getProxy((Network) 1, ipv4) && m_node.getProxy((Network) 2, ipv6)) { - ip_port = ipv4.proxy.ToStringIPPort(); - return true; - } - return false; -} diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h deleted file mode 100644 index 84e2de34b84..00000000000 --- a/src/qt/clientmodel.h +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_CLIENTMODEL_H -#define DEFI_QT_CLIENTMODEL_H - -#include -#include - -#include -#include - -class BanTableModel; -class OptionsModel; -class PeerTableModel; - -class CBlockIndex; - -namespace interfaces { -class Handler; -class Node; -} - -QT_BEGIN_NAMESPACE -class QTimer; -QT_END_NAMESPACE - -enum class BlockSource { - NONE, - REINDEX, - DISK, - NETWORK -}; - -enum NumConnections { - CONNECTIONS_NONE = 0, - CONNECTIONS_IN = (1U << 0), - CONNECTIONS_OUT = (1U << 1), - CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT), -}; - -/** Model for Defi network client. */ -class ClientModel : public QObject -{ - Q_OBJECT - -public: - explicit ClientModel(interfaces::Node& node, OptionsModel *optionsModel, QObject *parent = nullptr); - ~ClientModel(); - - interfaces::Node& node() const { return m_node; } - OptionsModel *getOptionsModel(); - PeerTableModel *getPeerTableModel(); - BanTableModel *getBanTableModel(); - - //! Return number of connections, default is in- and outbound (total) - int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const; - int getHeaderTipHeight() const; - int64_t getHeaderTipTime() const; - - //! Returns enum BlockSource of the current importing/syncing state - enum BlockSource getBlockSource() const; - //! Return warnings to be displayed in status bar - QString getStatusBarWarnings() const; - - QString formatFullVersion() const; - QString formatSubVersion() const; - bool isReleaseVersion() const; - QString formatClientStartupTime() const; - QString dataDir() const; - QString blocksDir() const; - - bool getProxyInfo(std::string& ip_port) const; - - // caches for the best header - mutable std::atomic cachedBestHeaderHeight; - mutable std::atomic cachedBestHeaderTime; - -private: - interfaces::Node& m_node; - std::unique_ptr m_handler_show_progress; - std::unique_ptr m_handler_notify_num_connections_changed; - std::unique_ptr m_handler_notify_network_active_changed; - std::unique_ptr m_handler_notify_alert_changed; - std::unique_ptr m_handler_banned_list_changed; - std::unique_ptr m_handler_notify_block_tip; - std::unique_ptr m_handler_notify_header_tip; - OptionsModel *optionsModel; - PeerTableModel *peerTableModel; - BanTableModel *banTableModel; - - QTimer *pollTimer; - - void subscribeToCoreSignals(); - void unsubscribeFromCoreSignals(); - -Q_SIGNALS: - void numConnectionsChanged(int count); - void numBlocksChanged(int count, const QDateTime& blockDate, double nVerificationProgress, bool header); - void mempoolSizeChanged(long count, size_t mempoolSizeInBytes); - void networkActiveChanged(bool networkActive); - void alertsChanged(const QString &warnings); - void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut); - - //! Fired when a message should be reported to the user - void message(const QString &title, const QString &message, unsigned int style); - - // Show progress dialog e.g. for verifychain - void showProgress(const QString &title, int nProgress); - -public Q_SLOTS: - void updateTimer(); - void updateNumConnections(int numConnections); - void updateNetworkActive(bool networkActive); - void updateAlert(); - void updateBanlist(); -}; - -#endif // DEFI_QT_CLIENTMODEL_H diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp deleted file mode 100644 index 663f640c89a..00000000000 --- a/src/qt/coincontroldialog.cpp +++ /dev/null @@ -1,730 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#if defined(HAVE_CONFIG_H) -#include -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -QList CoinControlDialog::payAmounts; -bool CoinControlDialog::fSubtractFeeFromAmount = false; - -bool CCoinControlWidgetItem::operator<(const QTreeWidgetItem &other) const { - int column = treeWidget()->sortColumn(); - if (column == CoinControlDialog::COLUMN_AMOUNT || column == CoinControlDialog::COLUMN_DATE || column == CoinControlDialog::COLUMN_CONFIRMATIONS) - return data(column, Qt::UserRole).toLongLong() < other.data(column, Qt::UserRole).toLongLong(); - return QTreeWidgetItem::operator<(other); -} - -CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, QWidget *parent) : - QDialog(parent), - ui(new Ui::CoinControlDialog), - model(nullptr), - platformStyle(_platformStyle) -{ - ui->setupUi(this); - - // context menu actions - QAction *copyAddressAction = new QAction(tr("Copy address"), this); - QAction *copyLabelAction = new QAction(tr("Copy label"), this); - QAction *copyAmountAction = new QAction(tr("Copy amount"), this); - copyTransactionHashAction = new QAction(tr("Copy transaction ID"), this); // we need to enable/disable this - lockAction = new QAction(tr("Lock unspent"), this); // we need to enable/disable this - unlockAction = new QAction(tr("Unlock unspent"), this); // we need to enable/disable this - - // context menu - contextMenu = new QMenu(this); - contextMenu->addAction(copyAddressAction); - contextMenu->addAction(copyLabelAction); - contextMenu->addAction(copyAmountAction); - contextMenu->addAction(copyTransactionHashAction); - contextMenu->addSeparator(); - contextMenu->addAction(lockAction); - contextMenu->addAction(unlockAction); - - // context menu signals - connect(ui->treeWidget, &QWidget::customContextMenuRequested, this, &CoinControlDialog::showMenu); - connect(copyAddressAction, &QAction::triggered, this, &CoinControlDialog::copyAddress); - connect(copyLabelAction, &QAction::triggered, this, &CoinControlDialog::copyLabel); - connect(copyAmountAction, &QAction::triggered, this, &CoinControlDialog::copyAmount); - connect(copyTransactionHashAction, &QAction::triggered, this, &CoinControlDialog::copyTransactionHash); - connect(lockAction, &QAction::triggered, this, &CoinControlDialog::lockCoin); - connect(unlockAction, &QAction::triggered, this, &CoinControlDialog::unlockCoin); - - // clipboard actions - QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); - QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this); - QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this); - QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this); - QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this); - QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); - QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); - - connect(clipboardQuantityAction, &QAction::triggered, this, &CoinControlDialog::clipboardQuantity); - connect(clipboardAmountAction, &QAction::triggered, this, &CoinControlDialog::clipboardAmount); - connect(clipboardFeeAction, &QAction::triggered, this, &CoinControlDialog::clipboardFee); - connect(clipboardAfterFeeAction, &QAction::triggered, this, &CoinControlDialog::clipboardAfterFee); - connect(clipboardBytesAction, &QAction::triggered, this, &CoinControlDialog::clipboardBytes); - connect(clipboardLowOutputAction, &QAction::triggered, this, &CoinControlDialog::clipboardLowOutput); - connect(clipboardChangeAction, &QAction::triggered, this, &CoinControlDialog::clipboardChange); - - ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); - ui->labelCoinControlAmount->addAction(clipboardAmountAction); - ui->labelCoinControlFee->addAction(clipboardFeeAction); - ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction); - ui->labelCoinControlBytes->addAction(clipboardBytesAction); - ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction); - ui->labelCoinControlChange->addAction(clipboardChangeAction); - - // toggle tree/list mode - connect(ui->radioTreeMode, &QRadioButton::toggled, this, &CoinControlDialog::radioTreeMode); - connect(ui->radioListMode, &QRadioButton::toggled, this, &CoinControlDialog::radioListMode); - - // click on checkbox - connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &CoinControlDialog::viewItemChanged); - - // click on header - ui->treeWidget->header()->setSectionsClickable(true); - connect(ui->treeWidget->header(), &QHeaderView::sectionClicked, this, &CoinControlDialog::headerSectionClicked); - - // ok button - connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &CoinControlDialog::buttonBoxClicked); - - // (un)select all - connect(ui->pushButtonSelectAll, &QPushButton::clicked, this, &CoinControlDialog::buttonSelectAllClicked); - - ui->treeWidget->setColumnWidth(COLUMN_CHECKBOX, 84); - ui->treeWidget->setColumnWidth(COLUMN_AMOUNT, 110); - ui->treeWidget->setColumnWidth(COLUMN_LABEL, 190); - ui->treeWidget->setColumnWidth(COLUMN_ADDRESS, 320); - ui->treeWidget->setColumnWidth(COLUMN_DATE, 130); - ui->treeWidget->setColumnWidth(COLUMN_CONFIRMATIONS, 110); - - // default view is sorted by amount desc - sortView(COLUMN_AMOUNT, Qt::DescendingOrder); - - // restore list mode and sortorder as a convenience feature - QSettings settings; - if (settings.contains("nCoinControlMode") && !settings.value("nCoinControlMode").toBool()) - ui->radioTreeMode->click(); - if (settings.contains("nCoinControlSortColumn") && settings.contains("nCoinControlSortOrder")) - sortView(settings.value("nCoinControlSortColumn").toInt(), (static_cast(settings.value("nCoinControlSortOrder").toInt()))); -} - -CoinControlDialog::~CoinControlDialog() -{ - QSettings settings; - settings.setValue("nCoinControlMode", ui->radioListMode->isChecked()); - settings.setValue("nCoinControlSortColumn", sortColumn); - settings.setValue("nCoinControlSortOrder", (int)sortOrder); - - delete ui; -} - -void CoinControlDialog::setModel(WalletModel *_model) -{ - this->model = _model; - - if(_model && _model->getOptionsModel() && _model->getAddressTableModel()) - { - updateView(); - updateLabelLocked(); - CoinControlDialog::updateLabels(_model, this); - } -} - -// ok button -void CoinControlDialog::buttonBoxClicked(QAbstractButton* button) -{ - if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) - done(QDialog::Accepted); // closes the dialog -} - -// (un)select all -void CoinControlDialog::buttonSelectAllClicked() -{ - Qt::CheckState state = Qt::Checked; - for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) - { - if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != Qt::Unchecked) - { - state = Qt::Unchecked; - break; - } - } - ui->treeWidget->setEnabled(false); - for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) - if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != state) - ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state); - ui->treeWidget->setEnabled(true); - if (state == Qt::Unchecked) - coinControl()->UnSelectAll(); // just to be sure - CoinControlDialog::updateLabels(model, this); -} - -// context menu -void CoinControlDialog::showMenu(const QPoint &point) -{ - QTreeWidgetItem *item = ui->treeWidget->itemAt(point); - if(item) - { - contextMenuItem = item; - - // disable some items (like Copy Transaction ID, lock, unlock) for tree roots in context menu - if (item->data(COLUMN_ADDRESS, TxHashRole).toString().length() == 64) // transaction hash is 64 characters (this means it is a child node, so it is not a parent node in tree mode) - { - copyTransactionHashAction->setEnabled(true); - if (model->wallet().isLockedCoin(COutPoint(uint256S(item->data(COLUMN_ADDRESS, TxHashRole).toString().toStdString()), item->data(COLUMN_ADDRESS, VOutRole).toUInt()))) - { - lockAction->setEnabled(false); - unlockAction->setEnabled(true); - } - else - { - lockAction->setEnabled(true); - unlockAction->setEnabled(false); - } - } - else // this means click on parent node in tree mode -> disable all - { - copyTransactionHashAction->setEnabled(false); - lockAction->setEnabled(false); - unlockAction->setEnabled(false); - } - - // show context menu - contextMenu->exec(QCursor::pos()); - } -} - -// context menu action: copy amount -void CoinControlDialog::copyAmount() -{ - GUIUtil::setClipboard(DefiUnits::removeSpaces(contextMenuItem->text(COLUMN_AMOUNT))); -} - -// context menu action: copy label -void CoinControlDialog::copyLabel() -{ - if (ui->radioTreeMode->isChecked() && contextMenuItem->text(COLUMN_LABEL).length() == 0 && contextMenuItem->parent()) - GUIUtil::setClipboard(contextMenuItem->parent()->text(COLUMN_LABEL)); - else - GUIUtil::setClipboard(contextMenuItem->text(COLUMN_LABEL)); -} - -// context menu action: copy address -void CoinControlDialog::copyAddress() -{ - if (ui->radioTreeMode->isChecked() && contextMenuItem->text(COLUMN_ADDRESS).length() == 0 && contextMenuItem->parent()) - GUIUtil::setClipboard(contextMenuItem->parent()->text(COLUMN_ADDRESS)); - else - GUIUtil::setClipboard(contextMenuItem->text(COLUMN_ADDRESS)); -} - -// context menu action: copy transaction id -void CoinControlDialog::copyTransactionHash() -{ - GUIUtil::setClipboard(contextMenuItem->data(COLUMN_ADDRESS, TxHashRole).toString()); -} - -// context menu action: lock coin -void CoinControlDialog::lockCoin() -{ - if (contextMenuItem->checkState(COLUMN_CHECKBOX) == Qt::Checked) - contextMenuItem->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); - - COutPoint outpt(uint256S(contextMenuItem->data(COLUMN_ADDRESS, TxHashRole).toString().toStdString()), contextMenuItem->data(COLUMN_ADDRESS, VOutRole).toUInt()); - model->wallet().lockCoin(outpt); - contextMenuItem->setDisabled(true); - contextMenuItem->setIcon(COLUMN_CHECKBOX, platformStyle->SingleColorIcon(":/icons/lock_closed")); - updateLabelLocked(); -} - -// context menu action: unlock coin -void CoinControlDialog::unlockCoin() -{ - COutPoint outpt(uint256S(contextMenuItem->data(COLUMN_ADDRESS, TxHashRole).toString().toStdString()), contextMenuItem->data(COLUMN_ADDRESS, VOutRole).toUInt()); - model->wallet().unlockCoin(outpt); - contextMenuItem->setDisabled(false); - contextMenuItem->setIcon(COLUMN_CHECKBOX, QIcon()); - updateLabelLocked(); -} - -// copy label "Quantity" to clipboard -void CoinControlDialog::clipboardQuantity() -{ - GUIUtil::setClipboard(ui->labelCoinControlQuantity->text()); -} - -// copy label "Amount" to clipboard -void CoinControlDialog::clipboardAmount() -{ - GUIUtil::setClipboard(ui->labelCoinControlAmount->text().left(ui->labelCoinControlAmount->text().indexOf(" "))); -} - -// copy label "Fee" to clipboard -void CoinControlDialog::clipboardFee() -{ - GUIUtil::setClipboard(ui->labelCoinControlFee->text().left(ui->labelCoinControlFee->text().indexOf(" ")).replace(ASYMP_UTF8, "")); -} - -// copy label "After fee" to clipboard -void CoinControlDialog::clipboardAfterFee() -{ - GUIUtil::setClipboard(ui->labelCoinControlAfterFee->text().left(ui->labelCoinControlAfterFee->text().indexOf(" ")).replace(ASYMP_UTF8, "")); -} - -// copy label "Bytes" to clipboard -void CoinControlDialog::clipboardBytes() -{ - GUIUtil::setClipboard(ui->labelCoinControlBytes->text().replace(ASYMP_UTF8, "")); -} - -// copy label "Dust" to clipboard -void CoinControlDialog::clipboardLowOutput() -{ - GUIUtil::setClipboard(ui->labelCoinControlLowOutput->text()); -} - -// copy label "Change" to clipboard -void CoinControlDialog::clipboardChange() -{ - GUIUtil::setClipboard(ui->labelCoinControlChange->text().left(ui->labelCoinControlChange->text().indexOf(" ")).replace(ASYMP_UTF8, "")); -} - -// treeview: sort -void CoinControlDialog::sortView(int column, Qt::SortOrder order) -{ - sortColumn = column; - sortOrder = order; - ui->treeWidget->sortItems(column, order); - ui->treeWidget->header()->setSortIndicator(sortColumn, sortOrder); -} - -// treeview: clicked on header -void CoinControlDialog::headerSectionClicked(int logicalIndex) -{ - if (logicalIndex == COLUMN_CHECKBOX) // click on most left column -> do nothing - { - ui->treeWidget->header()->setSortIndicator(sortColumn, sortOrder); - } - else - { - if (sortColumn == logicalIndex) - sortOrder = ((sortOrder == Qt::AscendingOrder) ? Qt::DescendingOrder : Qt::AscendingOrder); - else - { - sortColumn = logicalIndex; - sortOrder = ((sortColumn == COLUMN_LABEL || sortColumn == COLUMN_ADDRESS) ? Qt::AscendingOrder : Qt::DescendingOrder); // if label or address then default => asc, else default => desc - } - - sortView(sortColumn, sortOrder); - } -} - -// toggle tree mode -void CoinControlDialog::radioTreeMode(bool checked) -{ - if (checked && model) - updateView(); -} - -// toggle list mode -void CoinControlDialog::radioListMode(bool checked) -{ - if (checked && model) - updateView(); -} - -// checkbox clicked by user -void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column) -{ - if (column == COLUMN_CHECKBOX && item->data(COLUMN_ADDRESS, TxHashRole).toString().length() == 64) // transaction hash is 64 characters (this means it is a child node, so it is not a parent node in tree mode) - { - COutPoint outpt(uint256S(item->data(COLUMN_ADDRESS, TxHashRole).toString().toStdString()), item->data(COLUMN_ADDRESS, VOutRole).toUInt()); - - if (item->checkState(COLUMN_CHECKBOX) == Qt::Unchecked) - coinControl()->UnSelect(outpt); - else if (item->isDisabled()) // locked (this happens if "check all" through parent node) - item->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); - else - coinControl()->Select(outpt); - - // selection changed -> update labels - if (ui->treeWidget->isEnabled()) // do not update on every click for (un)select all - CoinControlDialog::updateLabels(model, this); - } - - // TODO: Remove this temporary qt5 fix after Qt5.3 and Qt5.4 are no longer used. - // Fixed in Qt5.5 and above: https://bugreports.qt.io/browse/QTBUG-43473 - else if (column == COLUMN_CHECKBOX && item->childCount() > 0) - { - if (item->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked && item->child(0)->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked) - item->setCheckState(COLUMN_CHECKBOX, Qt::Checked); - } -} - -// shows count of locked unspent outputs -void CoinControlDialog::updateLabelLocked() -{ - std::vector vOutpts; - model->wallet().listLockedCoins(vOutpts); - if (vOutpts.size() > 0) - { - ui->labelLocked->setText(tr("(%1 locked)").arg(vOutpts.size())); - ui->labelLocked->setVisible(true); - } - else ui->labelLocked->setVisible(false); -} - -void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) -{ - if (!model) - return; - - // nPayAmount - CAmount nPayAmount = 0; - bool fDust = false; - CMutableTransaction txDummy; - for (const CAmount &amount : CoinControlDialog::payAmounts) - { - nPayAmount += amount; - - if (amount > 0) - { - // Assumes a p2pkh script size - CTxOut txout(amount, CScript() << std::vector(24, 0)); - txDummy.vout.push_back(txout); - fDust |= IsDust(txout, model->node().getDustRelayFee()); - } - } - - CAmount nAmount = 0; - CAmount nPayFee = 0; - CAmount nAfterFee = 0; - CAmount nChange = 0; - unsigned int nBytes = 0; - unsigned int nBytesInputs = 0; - unsigned int nQuantity = 0; - bool fWitness = false; - - std::vector vCoinControl; - coinControl()->ListSelected(vCoinControl); - - size_t i = 0; - for (const auto& out : model->wallet().getCoins(vCoinControl)) { - if (out.depth_in_main_chain < 0) continue; - - // unselect already spent, very unlikely scenario, this could happen - // when selected are spent elsewhere, like rpc or another computer - const COutPoint& outpt = vCoinControl[i++]; - if (out.is_spent) - { - coinControl()->UnSelect(outpt); - continue; - } - - // Quantity - nQuantity++; - - // Amount - nAmount += out.txout.nValue; - - // Bytes - CTxDestination address; - int witnessversion = 0; - std::vector witnessprogram; - if (out.txout.scriptPubKey.IsWitnessProgram(witnessversion, witnessprogram)) - { - nBytesInputs += (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4); - fWitness = true; - } - else if(ExtractDestination(out.txout.scriptPubKey, address)) - { - CPubKey pubkey; - PKHash *pkhash = boost::get(&address); - if (pkhash && model->wallet().getPubKey(CKeyID(*pkhash), pubkey)) - { - nBytesInputs += (pubkey.IsCompressed() ? 148 : 180); - } - else - nBytesInputs += 148; // in all error cases, simply assume 148 here - } - else nBytesInputs += 148; - } - - // calculation - if (nQuantity > 0) - { - // Bytes - nBytes = nBytesInputs + ((CoinControlDialog::payAmounts.size() > 0 ? CoinControlDialog::payAmounts.size() + 1 : 2) * 34) + 10; // always assume +1 output for change here - if (fWitness) - { - // there is some fudging in these numbers related to the actual virtual transaction size calculation that will keep this estimate from being exact. - // usually, the result will be an overestimate within a couple of satoshis so that the confirmation dialog ends up displaying a slightly smaller fee. - // also, the witness stack size value is a variable sized integer. usually, the number of stack items will be well under the single byte var int limit. - nBytes += 2; // account for the serialized marker and flag bytes - nBytes += nQuantity; // account for the witness byte that holds the number of stack items for each input. - } - - // in the subtract fee from amount case, we can tell if zero change already and subtract the bytes, so that fee calculation afterwards is accurate - if (CoinControlDialog::fSubtractFeeFromAmount) - if (nAmount - nPayAmount == 0) - nBytes -= 34; - - // Fee - nPayFee = model->wallet().getMinimumFee(nBytes, *coinControl(), nullptr /* returned_target */, nullptr /* reason */); - - if (nPayAmount > 0) - { - nChange = nAmount - nPayAmount; - if (!CoinControlDialog::fSubtractFeeFromAmount) - nChange -= nPayFee; - - // Never create dust outputs; if we would, just add the dust to the fee. - if (nChange > 0 && nChange < MIN_CHANGE) - { - // Assumes a p2pkh script size - CTxOut txout(nChange, CScript() << std::vector(24, 0)); - if (IsDust(txout, model->node().getDustRelayFee())) - { - nPayFee += nChange; - nChange = 0; - if (CoinControlDialog::fSubtractFeeFromAmount) - nBytes -= 34; // we didn't detect lack of change above - } - } - - if (nChange == 0 && !CoinControlDialog::fSubtractFeeFromAmount) - nBytes -= 34; - } - - // after fee - nAfterFee = std::max(nAmount - nPayFee, 0); - } - - // actually update labels - int nDisplayUnit = DefiUnits::BTC; - if (model && model->getOptionsModel()) - nDisplayUnit = model->getOptionsModel()->getDisplayUnit(); - - QLabel *l1 = dialog->findChild("labelCoinControlQuantity"); - QLabel *l2 = dialog->findChild("labelCoinControlAmount"); - QLabel *l3 = dialog->findChild("labelCoinControlFee"); - QLabel *l4 = dialog->findChild("labelCoinControlAfterFee"); - QLabel *l5 = dialog->findChild("labelCoinControlBytes"); - QLabel *l7 = dialog->findChild("labelCoinControlLowOutput"); - QLabel *l8 = dialog->findChild("labelCoinControlChange"); - - // enable/disable "dust" and "change" - dialog->findChild("labelCoinControlLowOutputText")->setEnabled(nPayAmount > 0); - dialog->findChild("labelCoinControlLowOutput") ->setEnabled(nPayAmount > 0); - dialog->findChild("labelCoinControlChangeText") ->setEnabled(nPayAmount > 0); - dialog->findChild("labelCoinControlChange") ->setEnabled(nPayAmount > 0); - - // stats - l1->setText(QString::number(nQuantity)); // Quantity - l2->setText(DefiUnits::formatWithUnit(nDisplayUnit, nAmount)); // Amount - l3->setText(DefiUnits::formatWithUnit(nDisplayUnit, nPayFee)); // Fee - l4->setText(DefiUnits::formatWithUnit(nDisplayUnit, nAfterFee)); // After Fee - l5->setText(((nBytes > 0) ? ASYMP_UTF8 : "") + QString::number(nBytes)); // Bytes - l7->setText(fDust ? tr("yes") : tr("no")); // Dust - l8->setText(DefiUnits::formatWithUnit(nDisplayUnit, nChange)); // Change - if (nPayFee > 0) - { - l3->setText(ASYMP_UTF8 + l3->text()); - l4->setText(ASYMP_UTF8 + l4->text()); - if (nChange > 0 && !CoinControlDialog::fSubtractFeeFromAmount) - l8->setText(ASYMP_UTF8 + l8->text()); - } - - // turn label red when dust - l7->setStyleSheet((fDust) ? "color:red;" : ""); - - // tool tips - QString toolTipDust = tr("This label turns red if any recipient receives an amount smaller than the current dust threshold."); - - // how many satoshis the estimated fee can vary per byte we guess wrong - double dFeeVary = (nBytes != 0) ? (double)nPayFee / nBytes : 0; - - QString toolTip4 = tr("Can vary +/- %1 satoshi(s) per input.").arg(dFeeVary); - - l3->setToolTip(toolTip4); - l4->setToolTip(toolTip4); - l7->setToolTip(toolTipDust); - l8->setToolTip(toolTip4); - dialog->findChild("labelCoinControlFeeText") ->setToolTip(l3->toolTip()); - dialog->findChild("labelCoinControlAfterFeeText") ->setToolTip(l4->toolTip()); - dialog->findChild("labelCoinControlBytesText") ->setToolTip(l5->toolTip()); - dialog->findChild("labelCoinControlLowOutputText")->setToolTip(l7->toolTip()); - dialog->findChild("labelCoinControlChangeText") ->setToolTip(l8->toolTip()); - - // Insufficient funds - QLabel *label = dialog->findChild("labelCoinControlInsuffFunds"); - if (label) - label->setVisible(nChange < 0); -} - -CCoinControl* CoinControlDialog::coinControl() -{ - static CCoinControl coin_control; - return &coin_control; -} - -void CoinControlDialog::updateView() -{ - if (!model || !model->getOptionsModel() || !model->getAddressTableModel()) - return; - - bool treeMode = ui->radioTreeMode->isChecked(); - - ui->treeWidget->clear(); - ui->treeWidget->setEnabled(false); // performance, otherwise updateLabels would be called for every checked checkbox - ui->treeWidget->setAlternatingRowColors(!treeMode); - QFlags flgCheckbox = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable; - QFlags flgTristate = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate; - - int nDisplayUnit = model->getOptionsModel()->getDisplayUnit(); - - for (const auto& coins : model->wallet().listCoins()) { - CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem(); - itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); - QString sWalletAddress = QString::fromStdString(EncodeDestination(coins.first)); - QString sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress); - if (sWalletLabel.isEmpty()) - sWalletLabel = tr("(no label)"); - - if (treeMode) - { - // wallet address - ui->treeWidget->addTopLevelItem(itemWalletAddress); - - itemWalletAddress->setFlags(flgTristate); - itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); - - // label - itemWalletAddress->setText(COLUMN_LABEL, sWalletLabel); - - // address - itemWalletAddress->setText(COLUMN_ADDRESS, sWalletAddress); - } - - CAmount nSum = 0; - int nChildren = 0; - for (const auto& outpair : coins.second) { - const COutPoint& output = std::get<0>(outpair); - const interfaces::WalletTxOut& out = std::get<1>(outpair); - nSum += out.txout.nValue; - nChildren++; - - CCoinControlWidgetItem *itemOutput; - if (treeMode) itemOutput = new CCoinControlWidgetItem(itemWalletAddress); - else itemOutput = new CCoinControlWidgetItem(ui->treeWidget); - itemOutput->setFlags(flgCheckbox); - itemOutput->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked); - - // address - CTxDestination outputAddress; - QString sAddress = ""; - if(ExtractDestination(out.txout.scriptPubKey, outputAddress)) - { - sAddress = QString::fromStdString(EncodeDestination(outputAddress)); - - // if listMode or change => show defi address. In tree mode, address is not shown again for direct wallet address outputs - if (!treeMode || (!(sAddress == sWalletAddress))) - itemOutput->setText(COLUMN_ADDRESS, sAddress); - } - - // label - if (!(sAddress == sWalletAddress)) // change - { - // tooltip from where the change comes from - itemOutput->setToolTip(COLUMN_LABEL, tr("change from %1 (%2)").arg(sWalletLabel).arg(sWalletAddress)); - itemOutput->setText(COLUMN_LABEL, tr("(change)")); - } - else if (!treeMode) - { - QString sLabel = model->getAddressTableModel()->labelForAddress(sAddress); - if (sLabel.isEmpty()) - sLabel = tr("(no label)"); - itemOutput->setText(COLUMN_LABEL, sLabel); - } - - // amount - itemOutput->setText(COLUMN_AMOUNT, DefiUnits::format(nDisplayUnit, out.txout.nValue)); - itemOutput->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)out.txout.nValue)); // padding so that sorting works correctly - - // date - itemOutput->setText(COLUMN_DATE, GUIUtil::dateTimeStr(out.time)); - itemOutput->setData(COLUMN_DATE, Qt::UserRole, QVariant((qlonglong)out.time)); - - // confirmations - itemOutput->setText(COLUMN_CONFIRMATIONS, QString::number(out.depth_in_main_chain)); - itemOutput->setData(COLUMN_CONFIRMATIONS, Qt::UserRole, QVariant((qlonglong)out.depth_in_main_chain)); - - // transaction hash - itemOutput->setData(COLUMN_ADDRESS, TxHashRole, QString::fromStdString(output.hash.GetHex())); - - // vout index - itemOutput->setData(COLUMN_ADDRESS, VOutRole, output.n); - - // disable locked coins - if (model->wallet().isLockedCoin(output)) - { - coinControl()->UnSelect(output); // just to be sure - itemOutput->setDisabled(true); - itemOutput->setIcon(COLUMN_CHECKBOX, platformStyle->SingleColorIcon(":/icons/lock_closed")); - } - - // set checkbox - if (coinControl()->IsSelected(output)) - itemOutput->setCheckState(COLUMN_CHECKBOX, Qt::Checked); - } - - // amount - if (treeMode) - { - itemWalletAddress->setText(COLUMN_CHECKBOX, "(" + QString::number(nChildren) + ")"); - itemWalletAddress->setText(COLUMN_AMOUNT, DefiUnits::format(nDisplayUnit, nSum)); - itemWalletAddress->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)nSum)); - } - } - - // expand all partially selected - if (treeMode) - { - for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) - if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked) - ui->treeWidget->topLevelItem(i)->setExpanded(true); - } - - // sort view - sortView(sortColumn, sortOrder); - ui->treeWidget->setEnabled(true); -} diff --git a/src/qt/coincontroldialog.h b/src/qt/coincontroldialog.h deleted file mode 100644 index ba868fca34d..00000000000 --- a/src/qt/coincontroldialog.h +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_COINCONTROLDIALOG_H -#define DEFI_QT_COINCONTROLDIALOG_H - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -class PlatformStyle; -class WalletModel; - -class CCoinControl; - -namespace Ui { - class CoinControlDialog; -} - -#define ASYMP_UTF8 "\xE2\x89\x88" - -class CCoinControlWidgetItem : public QTreeWidgetItem -{ -public: - explicit CCoinControlWidgetItem(QTreeWidget *parent, int type = Type) : QTreeWidgetItem(parent, type) {} - explicit CCoinControlWidgetItem(int type = Type) : QTreeWidgetItem(type) {} - explicit CCoinControlWidgetItem(QTreeWidgetItem *parent, int type = Type) : QTreeWidgetItem(parent, type) {} - - bool operator<(const QTreeWidgetItem &other) const; -}; - - -class CoinControlDialog : public QDialog -{ - Q_OBJECT - -public: - explicit CoinControlDialog(const PlatformStyle *platformStyle, QWidget *parent = nullptr); - ~CoinControlDialog(); - - void setModel(WalletModel *model); - - // static because also called from sendcoinsdialog - static void updateLabels(WalletModel*, QDialog*); - - static QList payAmounts; - static CCoinControl *coinControl(); - static bool fSubtractFeeFromAmount; - -private: - Ui::CoinControlDialog *ui; - WalletModel *model; - int sortColumn; - Qt::SortOrder sortOrder; - - QMenu *contextMenu; - QTreeWidgetItem *contextMenuItem; - QAction *copyTransactionHashAction; - QAction *lockAction; - QAction *unlockAction; - - const PlatformStyle *platformStyle; - - void sortView(int, Qt::SortOrder); - void updateView(); - - enum - { - COLUMN_CHECKBOX = 0, - COLUMN_AMOUNT, - COLUMN_LABEL, - COLUMN_ADDRESS, - COLUMN_DATE, - COLUMN_CONFIRMATIONS, - }; - - enum - { - TxHashRole = Qt::UserRole, - VOutRole - }; - - friend class CCoinControlWidgetItem; - -private Q_SLOTS: - void showMenu(const QPoint &); - void copyAmount(); - void copyLabel(); - void copyAddress(); - void copyTransactionHash(); - void lockCoin(); - void unlockCoin(); - void clipboardQuantity(); - void clipboardAmount(); - void clipboardFee(); - void clipboardAfterFee(); - void clipboardBytes(); - void clipboardLowOutput(); - void clipboardChange(); - void radioTreeMode(bool); - void radioListMode(bool); - void viewItemChanged(QTreeWidgetItem*, int); - void headerSectionClicked(int); - void buttonBoxClicked(QAbstractButton*); - void buttonSelectAllClicked(); - void updateLabelLocked(); -}; - -#endif // DEFI_QT_COINCONTROLDIALOG_H diff --git a/src/qt/coincontroltreewidget.cpp b/src/qt/coincontroltreewidget.cpp deleted file mode 100644 index 4ffbd832e9e..00000000000 --- a/src/qt/coincontroltreewidget.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include -#include - -CoinControlTreeWidget::CoinControlTreeWidget(QWidget *parent) : - QTreeWidget(parent) -{ - -} - -void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event) -{ - if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox - { - event->ignore(); - if (this->currentItem()) { - int COLUMN_CHECKBOX = 0; - this->currentItem()->setCheckState(COLUMN_CHECKBOX, ((this->currentItem()->checkState(COLUMN_CHECKBOX) == Qt::Checked) ? Qt::Unchecked : Qt::Checked)); - } - } - else if (event->key() == Qt::Key_Escape) // press esc -> close dialog - { - event->ignore(); - CoinControlDialog *coinControlDialog = static_cast(this->parentWidget()); - coinControlDialog->done(QDialog::Accepted); - } - else - { - this->QTreeWidget::keyPressEvent(event); - } -} diff --git a/src/qt/coincontroltreewidget.h b/src/qt/coincontroltreewidget.h deleted file mode 100644 index a7e9bf214ee..00000000000 --- a/src/qt/coincontroltreewidget.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2011-2014 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_COINCONTROLTREEWIDGET_H -#define DEFI_QT_COINCONTROLTREEWIDGET_H - -#include -#include - -class CoinControlTreeWidget : public QTreeWidget -{ - Q_OBJECT - -public: - explicit CoinControlTreeWidget(QWidget *parent = nullptr); - -protected: - virtual void keyPressEvent(QKeyEvent *event); -}; - -#endif // DEFI_QT_COINCONTROLTREEWIDGET_H diff --git a/src/qt/csvmodelwriter.cpp b/src/qt/csvmodelwriter.cpp deleted file mode 100644 index 656afb6e872..00000000000 --- a/src/qt/csvmodelwriter.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include -#include -#include - -CSVModelWriter::CSVModelWriter(const QString &_filename, QObject *parent) : - QObject(parent), - filename(_filename), model(nullptr) -{ -} - -void CSVModelWriter::setModel(const QAbstractItemModel *_model) -{ - this->model = _model; -} - -void CSVModelWriter::addColumn(const QString &title, int column, int role) -{ - Column col; - col.title = title; - col.column = column; - col.role = role; - - columns.append(col); -} - -static void writeValue(QTextStream &f, const QString &value) -{ - QString escaped = value; - escaped.replace('"', "\"\""); - f << "\"" << escaped << "\""; -} - -static void writeSep(QTextStream &f) -{ - f << ","; -} - -static void writeNewline(QTextStream &f) -{ - f << "\n"; -} - -bool CSVModelWriter::write() -{ - QFile file(filename); - if(!file.open(QIODevice::WriteOnly | QIODevice::Text)) - return false; - QTextStream out(&file); - - int numRows = 0; - if(model) - { - numRows = model->rowCount(); - } - - // Header row - for(int i=0; iindex(j, columns[i].column).data(columns[i].role); - writeValue(out, data.toString()); - } - writeNewline(out); - } - - file.close(); - - return file.error() == QFile::NoError; -} diff --git a/src/qt/csvmodelwriter.h b/src/qt/csvmodelwriter.h deleted file mode 100644 index 55760b9a4b2..00000000000 --- a/src/qt/csvmodelwriter.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2011-2014 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_CSVMODELWRITER_H -#define DEFI_QT_CSVMODELWRITER_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QAbstractItemModel; -QT_END_NAMESPACE - -/** Export a Qt table model to a CSV file. This is useful for analyzing or post-processing the data in - a spreadsheet. - */ -class CSVModelWriter : public QObject -{ - Q_OBJECT - -public: - explicit CSVModelWriter(const QString &filename, QObject *parent = nullptr); - - void setModel(const QAbstractItemModel *model); - void addColumn(const QString &title, int column, int role=Qt::EditRole); - - /** Perform export of the model to CSV. - @returns true on success, false otherwise - */ - bool write(); - -private: - QString filename; - const QAbstractItemModel *model; - - struct Column - { - QString title; - int column; - int role; - }; - QList columns; -}; - -#endif // DEFI_QT_CSVMODELWRITER_H diff --git a/src/qt/defi.cpp b/src/qt/defi.cpp deleted file mode 100644 index b4d3ed118d7..00000000000 --- a/src/qt/defi.cpp +++ /dev/null @@ -1,596 +0,0 @@ -// Copyright (c) 2011-2019 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#if defined(HAVE_CONFIG_H) -#include -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef ENABLE_WALLET -#include -#include -#include -#endif // ENABLE_WALLET - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(QT_STATICPLUGIN) -#include -#if defined(QT_QPA_PLATFORM_XCB) -Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); -#elif defined(QT_QPA_PLATFORM_WINDOWS) -Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); -#elif defined(QT_QPA_PLATFORM_COCOA) -Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin); -#endif -#endif - -// Declare meta types used for QMetaObject::invokeMethod -Q_DECLARE_METATYPE(bool*) -Q_DECLARE_METATYPE(CAmount) -Q_DECLARE_METATYPE(uint256) - -static QString GetLangTerritory() -{ - QSettings settings; - // Get desired locale (e.g. "de_DE") - // 1) System default language - QString lang_territory = QLocale::system().name(); - // 2) Language from QSettings - QString lang_territory_qsettings = settings.value("language", "").toString(); - if(!lang_territory_qsettings.isEmpty()) - lang_territory = lang_territory_qsettings; - // 3) -lang command line argument - lang_territory = QString::fromStdString(gArgs.GetArg("-lang", lang_territory.toStdString())); - return lang_territory; -} - -/** Set up translations */ -static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTranslator, QTranslator &translatorBase, QTranslator &translator) -{ - // Remove old translators - QApplication::removeTranslator(&qtTranslatorBase); - QApplication::removeTranslator(&qtTranslator); - QApplication::removeTranslator(&translatorBase); - QApplication::removeTranslator(&translator); - - // Get desired locale (e.g. "de_DE") - // 1) System default language - QString lang_territory = GetLangTerritory(); - - // Convert to "de" only by truncating "_DE" - QString lang = lang_territory; - lang.truncate(lang_territory.lastIndexOf('_')); - - // Load language files for configured locale: - // - First load the translator for the base language, without territory - // - Then load the more specific locale translator - - // Load e.g. qt_de.qm - if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) - QApplication::installTranslator(&qtTranslatorBase); - - // Load e.g. qt_de_DE.qm - if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) - QApplication::installTranslator(&qtTranslator); - - // Load e.g. defi_de.qm (shortcut "de" needs to be defined in defi.qrc) - if (translatorBase.load(lang, ":/translations/")) - QApplication::installTranslator(&translatorBase); - - // Load e.g. defi_de_DE.qm (shortcut "de_DE" needs to be defined in defi.qrc) - if (translator.load(lang_territory, ":/translations/")) - QApplication::installTranslator(&translator); -} - -/* qDebug() message handler --> debug.log */ -void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &msg) -{ - Q_UNUSED(context); - if (type == QtDebugMsg) { - LogPrint(BCLog::QT, "GUI: %s\n", msg.toStdString()); - } else { - LogPrintf("GUI: %s\n", msg.toStdString()); - } -} - -DefiCore::DefiCore(interfaces::Node& node) : - QObject(), m_node(node) -{ -} - -void DefiCore::handleRunawayException(const std::exception *e) -{ - PrintExceptionContinue(e, "Runaway exception"); - Q_EMIT runawayException(QString::fromStdString(m_node.getWarnings("gui"))); -} - -void DefiCore::initialize() -{ - try - { - qDebug() << __func__ << ": Running initialization in thread"; - util::ThreadRename("qt-init"); - bool rv = m_node.appInitMain(); - Q_EMIT initializeResult(rv); - } catch (const std::exception& e) { - handleRunawayException(&e); - } catch (...) { - handleRunawayException(nullptr); - } -} - -void DefiCore::shutdown() -{ - try - { - qDebug() << __func__ << ": Running Shutdown in thread"; - m_node.appShutdown(); - qDebug() << __func__ << ": Shutdown finished"; - Q_EMIT shutdownResult(); - } catch (const std::exception& e) { - handleRunawayException(&e); - } catch (...) { - handleRunawayException(nullptr); - } -} - -static int qt_argc = 1; -static const char* qt_argv = "defi-qt"; - -DefiApplication::DefiApplication(interfaces::Node& node): - QApplication(qt_argc, const_cast(&qt_argv)), - coreThread(nullptr), - m_node(node), - optionsModel(nullptr), - clientModel(nullptr), - window(nullptr), - pollShutdownTimer(nullptr), - returnValue(0), - platformStyle(nullptr) -{ - setQuitOnLastWindowClosed(false); -} - -void DefiApplication::setupPlatformStyle() -{ - // UI per-platform customization - // This must be done inside the DefiApplication constructor, or after it, because - // PlatformStyle::instantiate requires a QApplication - std::string platformName; - platformName = gArgs.GetArg("-uiplatform", DefiGUI::DEFAULT_UIPLATFORM); - platformStyle = PlatformStyle::instantiate(QString::fromStdString(platformName)); - if (!platformStyle) // Fall back to "other" if specified name not found - platformStyle = PlatformStyle::instantiate("other"); - assert(platformStyle); -} - -DefiApplication::~DefiApplication() -{ - if(coreThread) - { - qDebug() << __func__ << ": Stopping thread"; - coreThread->quit(); - coreThread->wait(); - qDebug() << __func__ << ": Stopped thread"; - } - - delete window; - window = nullptr; - delete optionsModel; - optionsModel = nullptr; - delete platformStyle; - platformStyle = nullptr; -} - -#ifdef ENABLE_WALLET -void DefiApplication::createPaymentServer() -{ - paymentServer = new PaymentServer(this); -} -#endif - -void DefiApplication::createOptionsModel(bool resetSettings) -{ - optionsModel = new OptionsModel(m_node, nullptr, resetSettings); -} - -void DefiApplication::createWindow(const NetworkStyle *networkStyle) -{ - window = new DefiGUI(m_node, platformStyle, networkStyle, nullptr); - - pollShutdownTimer = new QTimer(window); - connect(pollShutdownTimer, &QTimer::timeout, window, &DefiGUI::detectShutdown); -} - -void DefiApplication::createSplashScreen(const NetworkStyle *networkStyle) -{ - SplashScreen *splash = new SplashScreen(m_node, nullptr, networkStyle); - // We don't hold a direct pointer to the splash screen after creation, but the splash - // screen will take care of deleting itself when finish() happens. - splash->show(); - connect(this, &DefiApplication::splashFinished, splash, &SplashScreen::finish); - connect(this, &DefiApplication::requestedShutdown, splash, &QWidget::close); -} - -bool DefiApplication::baseInitialize() -{ - return m_node.baseInitialize(); -} - -void DefiApplication::startThread() -{ - if(coreThread) - return; - coreThread = new QThread(this); - DefiCore *executor = new DefiCore(m_node); - executor->moveToThread(coreThread); - - /* communication to and from thread */ - connect(executor, &DefiCore::initializeResult, this, &DefiApplication::initializeResult); - connect(executor, &DefiCore::shutdownResult, this, &DefiApplication::shutdownResult); - connect(executor, &DefiCore::runawayException, this, &DefiApplication::handleRunawayException); - connect(this, &DefiApplication::requestedInitialize, executor, &DefiCore::initialize); - connect(this, &DefiApplication::requestedShutdown, executor, &DefiCore::shutdown); - /* make sure executor object is deleted in its own thread */ - connect(coreThread, &QThread::finished, executor, &QObject::deleteLater); - - coreThread->start(); -} - -void DefiApplication::parameterSetup() -{ - // Default printtoconsole to false for the GUI. GUI programs should not - // print to the console unnecessarily. - gArgs.SoftSetBoolArg("-printtoconsole", false); - - m_node.initLogging(); - m_node.initParameterInteraction(); -} - -void DefiApplication::requestInitialize() -{ - qDebug() << __func__ << ": Requesting initialize"; - startThread(); - Q_EMIT requestedInitialize(); -} - -void DefiApplication::requestShutdown() -{ - // Show a simple window indicating shutdown status - // Do this first as some of the steps may take some time below, - // for example the RPC console may still be executing a command. - shutdownWindow.reset(ShutdownWindow::showShutdownWindow(window)); - - qDebug() << __func__ << ": Requesting shutdown"; - startThread(); - window->hide(); - // Must disconnect node signals otherwise current thread can deadlock since - // no event loop is running. - window->unsubscribeFromCoreSignals(); - // Request node shutdown, which can interrupt long operations, like - // rescanning a wallet. - m_node.startShutdown(); - // Unsetting the client model can cause the current thread to wait for node - // to complete an operation, like wait for a RPC execution to complate. - window->setClientModel(nullptr); - pollShutdownTimer->stop(); - - delete clientModel; - clientModel = nullptr; - - // Request shutdown from core thread - Q_EMIT requestedShutdown(); -} - -void DefiApplication::initializeResult(bool success) -{ - qDebug() << __func__ << ": Initialization result: " << success; - // Set exit result. - returnValue = success ? EXIT_SUCCESS : EXIT_FAILURE; - if(success) - { - // Log this only after AppInitMain finishes, as then logging setup is guaranteed complete - qInfo() << "Platform customization:" << platformStyle->getName(); - clientModel = new ClientModel(m_node, optionsModel); - window->setClientModel(clientModel); -#ifdef ENABLE_WALLET - if (WalletModel::isWalletEnabled()) { - m_wallet_controller = new WalletController(m_node, platformStyle, optionsModel, this); - window->setWalletController(m_wallet_controller); - if (paymentServer) { - paymentServer->setOptionsModel(optionsModel); -#ifdef ENABLE_BIP70 - PaymentServer::LoadRootCAs(); - connect(m_wallet_controller, &WalletController::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK); -#endif - } - } -#endif // ENABLE_WALLET - - // If -min option passed, start window minimized (iconified) or minimized to tray - if (!gArgs.GetBoolArg("-min", false)) { - window->show(); - } else if (clientModel->getOptionsModel()->getMinimizeToTray() && window->hasTrayIcon()) { - // do nothing as the window is managed by the tray icon - } else { - window->showMinimized(); - } - Q_EMIT splashFinished(); - Q_EMIT windowShown(window); - -#ifdef ENABLE_WALLET - // Now that initialization/startup is done, process any command-line - // defi: URIs or payment requests: - if (paymentServer) { - connect(paymentServer, &PaymentServer::receivedPaymentRequest, window, &DefiGUI::handlePaymentRequest); - connect(window, &DefiGUI::receivedURI, paymentServer, &PaymentServer::handleURIOrFile); - connect(paymentServer, &PaymentServer::message, [this](const QString& title, const QString& message, unsigned int style) { - window->message(title, message, style); - }); - QTimer::singleShot(100, paymentServer, &PaymentServer::uiReady); - } -#endif - pollShutdownTimer->start(200); - } else { - Q_EMIT splashFinished(); // Make sure splash screen doesn't stick around during shutdown - quit(); // Exit first main loop invocation - } -} - -void DefiApplication::shutdownResult() -{ - quit(); // Exit second main loop invocation after shutdown finished -} - -void DefiApplication::handleRunawayException(const QString &message) -{ - QMessageBox::critical(nullptr, "Runaway exception", DefiGUI::tr("A fatal error occurred. Defi can no longer continue safely and will quit.") + QString("\n\n") + message); - ::exit(EXIT_FAILURE); -} - -WId DefiApplication::getMainWinId() const -{ - if (!window) - return 0; - - return window->winId(); -} - -static void SetupUIArgs() -{ -#if defined(ENABLE_WALLET) && defined(ENABLE_BIP70) - gArgs.AddArg("-allowselfsignedrootcertificates", strprintf("Allow self signed root certificates (default: %u)", DEFAULT_SELFSIGNED_ROOTCERTS), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::GUI); -#endif - gArgs.AddArg("-choosedatadir", strprintf("Choose data directory on startup (default: %u)", DEFAULT_CHOOSE_DATADIR), ArgsManager::ALLOW_ANY, OptionsCategory::GUI); - gArgs.AddArg("-lang=", "Set language, for example \"de_DE\" (default: system locale)", ArgsManager::ALLOW_ANY, OptionsCategory::GUI); - gArgs.AddArg("-min", "Start minimized", ArgsManager::ALLOW_ANY, OptionsCategory::GUI); - gArgs.AddArg("-resetguisettings", "Reset all settings changed in the GUI", ArgsManager::ALLOW_ANY, OptionsCategory::GUI); - gArgs.AddArg("-rootcertificates=", "Set SSL root certificates for payment request (default: -system-)", ArgsManager::ALLOW_ANY, OptionsCategory::GUI); - gArgs.AddArg("-splash", strprintf("Show splash screen on startup (default: %u)", DEFAULT_SPLASHSCREEN), ArgsManager::ALLOW_ANY, OptionsCategory::GUI); - gArgs.AddArg("-uiplatform", strprintf("Select platform to customize UI for (one of windows, macosx, other; default: %s)", DefiGUI::DEFAULT_UIPLATFORM), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::GUI); -} - -int GuiMain(int argc, char* argv[]) -{ -#ifdef WIN32 - util::WinCmdLineArgs winArgs; - std::tie(argc, argv) = winArgs.get(); -#endif - SetupEnvironment(); - util::ThreadRename("main"); - - std::unique_ptr node = interfaces::MakeNode(); - - // Subscribe to global signals from core - std::unique_ptr handler_message_box = node->handleMessageBox(noui_ThreadSafeMessageBox); - std::unique_ptr handler_question = node->handleQuestion(noui_ThreadSafeQuestion); - std::unique_ptr handler_init_message = node->handleInitMessage(noui_InitMessage); - - // Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory - - /// 1. Basic Qt initialization (not dependent on parameters or configuration) - Q_INIT_RESOURCE(defi); - Q_INIT_RESOURCE(defi_locale); - - // Generate high-dpi pixmaps - QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); -#if QT_VERSION >= 0x050600 - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); -#endif -#ifdef Q_OS_MAC - QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); -#endif - - DefiApplication app(*node); - - // Register meta types used for QMetaObject::invokeMethod - qRegisterMetaType< bool* >(); -#ifdef ENABLE_WALLET - qRegisterMetaType(); -#endif - // Need to pass name here as CAmount is a typedef (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType) - // IMPORTANT if it is no longer a typedef use the normal variant above - qRegisterMetaType< CAmount >("CAmount"); - qRegisterMetaType< std::function >("std::function"); - qRegisterMetaType("QMessageBox::Icon"); - /// 2. Parse command-line options. We do this after qt in order to show an error if there are problems parsing these - // Command-line options take precedence: - node->setupServerArgs(); - SetupUIArgs(); - std::string error; - if (!node->parseParameters(argc, argv, error)) { - node->initError(strprintf("Error parsing command line arguments: %s\n", error)); - // Create a message box, because the gui has neither been created nor has subscribed to core signals - QMessageBox::critical(nullptr, PACKAGE_NAME, - // message can not be translated because translations have not been initialized - QString::fromStdString("Error parsing command line arguments: %1.").arg(QString::fromStdString(error))); - return EXIT_FAILURE; - } - - // Now that the QApplication is setup and we have parsed our parameters, we can set the platform style - app.setupPlatformStyle(); - - /// 3. Application identification - // must be set before OptionsModel is initialized or translations are loaded, - // as it is used to locate QSettings - QApplication::setOrganizationName(QAPP_ORG_NAME); - QApplication::setOrganizationDomain(QAPP_ORG_DOMAIN); - QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT); - - /// 4. Initialization of translations, so that intro dialog is in user's language - // Now that QSettings are accessible, initialize translations - QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator; - initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator); - - // Show help message immediately after parsing command-line options (for "-lang") and setting locale, - // but before showing splash screen. - if (HelpRequested(gArgs) || gArgs.IsArgSet("-version")) { - HelpMessageDialog help(*node, nullptr, gArgs.IsArgSet("-version")); - help.showOrPrint(); - return EXIT_SUCCESS; - } - - /// 5. Now that settings and translations are available, ask user for data directory - // User language is set up: pick a data directory - if (!Intro::pickDataDirectory(*node)) - return EXIT_SUCCESS; - - /// 6. Determine availability of data directory and parse defi.conf - /// - Do not call GetDataDir(true) before this step finishes - if (!CheckDataDirOption()) { - node->initError(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", ""))); - QMessageBox::critical(nullptr, PACKAGE_NAME, - QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", "")))); - return EXIT_FAILURE; - } - if (!node->readConfigFiles(error)) { - node->initError(strprintf("Error reading configuration file: %s\n", error)); - QMessageBox::critical(nullptr, PACKAGE_NAME, - QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error))); - return EXIT_FAILURE; - } - - /// 7. Determine network (and switch to network specific options) - // - Do not call Params() before this step - // - Do this after parsing the configuration file, as the network can be switched there - // - QSettings() will use the new application name after this, resulting in network-specific settings - // - Needs to be done before createOptionsModel - - // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause) - try { - node->selectParams(gArgs.GetChainName()); - } catch(std::exception &e) { - node->initError(strprintf("%s\n", e.what())); - QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: %1").arg(e.what())); - return EXIT_FAILURE; - } -#ifdef ENABLE_WALLET - // Parse URIs on command line -- this can affect Params() - PaymentServer::ipcParseCommandLine(*node, argc, argv); -#endif - - QScopedPointer networkStyle(NetworkStyle::instantiate(QString::fromStdString(Params().NetworkIDString()))); - assert(!networkStyle.isNull()); - // Allow for separate UI settings for testnets - QApplication::setApplicationName(networkStyle->getAppName()); - // Re-initialize translations after changing application name (language in network-specific settings can be different) - initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator); - -#ifdef ENABLE_WALLET - /// 8. URI IPC sending - // - Do this early as we don't want to bother initializing if we are just calling IPC - // - Do this *after* setting up the data directory, as the data directory hash is used in the name - // of the server. - // - Do this after creating app and setting up translations, so errors are - // translated properly. - if (PaymentServer::ipcSendCommandLine()) - exit(EXIT_SUCCESS); - - // Start up the payment server early, too, so impatient users that click on - // defi: links repeatedly have their payment requests routed to this process: - if (WalletModel::isWalletEnabled()) { - app.createPaymentServer(); - } -#endif // ENABLE_WALLET - - /// 9. Main GUI initialization - // Install global event filter that makes sure that long tooltips can be word-wrapped - app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app)); -#if defined(Q_OS_WIN) - // Install global event filter for processing Windows session related Windows messages (WM_QUERYENDSESSION and WM_ENDSESSION) - qApp->installNativeEventFilter(new WinShutdownMonitor()); -#endif - // Install qDebug() message handler to route to debug.log - qInstallMessageHandler(DebugMessageHandler); - // Allow parameter interaction before we create the options model - app.parameterSetup(); - // Load GUI settings from QSettings - app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false)); - - if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false)) - app.createSplashScreen(networkStyle.data()); - - int rv = EXIT_SUCCESS; - try - { - app.createWindow(networkStyle.data()); - // Perform base initialization before spinning up initialization/shutdown thread - // This is acceptable because this function only contains steps that are quick to execute, - // so the GUI thread won't be held up. - if (app.baseInitialize()) { - app.requestInitialize(); -#if defined(Q_OS_WIN) - WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(PACKAGE_NAME), (HWND)app.getMainWinId()); -#endif - app.exec(); - app.requestShutdown(); - app.exec(); - rv = app.getReturnValue(); - } else { - // A dialog with detailed error will have been shown by InitError() - rv = EXIT_FAILURE; - } - } catch (const std::exception& e) { - PrintExceptionContinue(&e, "Runaway exception"); - app.handleRunawayException(QString::fromStdString(node->getWarnings("gui"))); - } catch (...) { - PrintExceptionContinue(nullptr, "Runaway exception"); - app.handleRunawayException(QString::fromStdString(node->getWarnings("gui"))); - } - return rv; -} diff --git a/src/qt/defi.h b/src/qt/defi.h deleted file mode 100644 index 4903147b58c..00000000000 --- a/src/qt/defi.h +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) 2011-2016 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_DEFI_H -#define DEFI_QT_DEFI_H - -#if defined(HAVE_CONFIG_H) -#include -#endif - -#include -#include - -class DefiGUI; -class ClientModel; -class NetworkStyle; -class OptionsModel; -class PaymentServer; -class PlatformStyle; -class WalletController; -class WalletModel; - -namespace interfaces { -class Handler; -class Node; -} // namespace interfaces - -/** Class encapsulating DeFi Blockchain startup and shutdown. - * Allows running startup and shutdown in a different thread from the UI thread. - */ -class DefiCore: public QObject -{ - Q_OBJECT -public: - explicit DefiCore(interfaces::Node& node); - -public Q_SLOTS: - void initialize(); - void shutdown(); - -Q_SIGNALS: - void initializeResult(bool success); - void shutdownResult(); - void runawayException(const QString &message); - -private: - /// Pass fatal exception message to UI thread - void handleRunawayException(const std::exception *e); - - interfaces::Node& m_node; -}; - -/** Main Defi application object */ -class DefiApplication: public QApplication -{ - Q_OBJECT -public: - explicit DefiApplication(interfaces::Node& node); - ~DefiApplication(); - -#ifdef ENABLE_WALLET - /// Create payment server - void createPaymentServer(); -#endif - /// parameter interaction/setup based on rules - void parameterSetup(); - /// Create options model - void createOptionsModel(bool resetSettings); - /// Create main window - void createWindow(const NetworkStyle *networkStyle); - /// Create splash screen - void createSplashScreen(const NetworkStyle *networkStyle); - /// Basic initialization, before starting initialization/shutdown thread. Return true on success. - bool baseInitialize(); - - /// Request core initialization - void requestInitialize(); - /// Request core shutdown - void requestShutdown(); - - /// Get process return value - int getReturnValue() const { return returnValue; } - - /// Get window identifier of QMainWindow (DefiGUI) - WId getMainWinId() const; - - /// Setup platform style - void setupPlatformStyle(); - -public Q_SLOTS: - void initializeResult(bool success); - void shutdownResult(); - /// Handle runaway exceptions. Shows a message box with the problem and quits the program. - void handleRunawayException(const QString &message); - -Q_SIGNALS: - void requestedInitialize(); - void requestedShutdown(); - void splashFinished(); - void windowShown(DefiGUI* window); - -private: - QThread *coreThread; - interfaces::Node& m_node; - OptionsModel *optionsModel; - ClientModel *clientModel; - DefiGUI *window; - QTimer *pollShutdownTimer; -#ifdef ENABLE_WALLET - PaymentServer* paymentServer{nullptr}; - WalletController* m_wallet_controller{nullptr}; -#endif - int returnValue; - const PlatformStyle *platformStyle; - std::unique_ptr shutdownWindow; - - void startThread(); -}; - -int GuiMain(int argc, char* argv[]); - -#endif // DEFI_QT_DEFI_H diff --git a/src/qt/defi.qrc b/src/qt/defi.qrc deleted file mode 100644 index 8c87f1ffd05..00000000000 --- a/src/qt/defi.qrc +++ /dev/null @@ -1,86 +0,0 @@ - - - res/icons/defi.png - res/icons/address-book.png - res/icons/send.png - res/icons/connect0.png - res/icons/connect1.png - res/icons/connect2.png - res/icons/connect3.png - res/icons/connect4.png - res/icons/transaction0.png - res/icons/transaction2.png - res/icons/transaction_conflicted.png - res/icons/clock1.png - res/icons/clock2.png - res/icons/clock3.png - res/icons/clock4.png - res/icons/clock5.png - res/icons/eye.png - res/icons/eye_minus.png - res/icons/eye_plus.png - res/icons/receive.png - res/icons/editpaste.png - res/icons/editcopy.png - res/icons/add.png - res/icons/edit.png - res/icons/history.png - res/icons/overview.png - res/icons/export.png - res/icons/synced.png - res/icons/remove.png - res/icons/tx_mined.png - res/icons/tx_input.png - res/icons/tx_output.png - res/icons/tx_inout.png - res/icons/lock_closed.png - res/icons/lock_open.png - res/icons/warning.png - res/icons/fontbigger.png - res/icons/fontsmaller.png - res/icons/chevron.png - res/icons/transaction_abandoned.png - res/icons/hd_enabled.png - res/icons/hd_disabled.png - res/icons/network_disabled.png - res/icons/proxy.png - - - res/movies/spinner-000.png - res/movies/spinner-001.png - res/movies/spinner-002.png - res/movies/spinner-003.png - res/movies/spinner-004.png - res/movies/spinner-005.png - res/movies/spinner-006.png - res/movies/spinner-007.png - res/movies/spinner-008.png - res/movies/spinner-009.png - res/movies/spinner-010.png - res/movies/spinner-011.png - res/movies/spinner-012.png - res/movies/spinner-013.png - res/movies/spinner-014.png - res/movies/spinner-015.png - res/movies/spinner-016.png - res/movies/spinner-017.png - res/movies/spinner-018.png - res/movies/spinner-019.png - res/movies/spinner-020.png - res/movies/spinner-021.png - res/movies/spinner-022.png - res/movies/spinner-023.png - res/movies/spinner-024.png - res/movies/spinner-025.png - res/movies/spinner-026.png - res/movies/spinner-027.png - res/movies/spinner-028.png - res/movies/spinner-029.png - res/movies/spinner-030.png - res/movies/spinner-031.png - res/movies/spinner-032.png - res/movies/spinner-033.png - res/movies/spinner-034.png - res/movies/spinner-035.png - - diff --git a/src/qt/defi_locale.qrc b/src/qt/defi_locale.qrc deleted file mode 100644 index 7bbe59a4a25..00000000000 --- a/src/qt/defi_locale.qrc +++ /dev/null @@ -1,90 +0,0 @@ - - - locale/defi_af.qm - locale/defi_af_ZA.qm - locale/defi_ar.qm - locale/defi_be_BY.qm - locale/defi_bg_BG.qm - locale/defi_bg.qm - locale/defi_ca_ES.qm - locale/defi_ca.qm - locale/defi_ca@valencia.qm - locale/defi_cs.qm - locale/defi_cy.qm - locale/defi_da.qm - locale/defi_de.qm - locale/defi_el_GR.qm - locale/defi_el.qm - locale/defi_en_GB.qm - locale/defi_en.qm - locale/defi_eo.qm - locale/defi_es_AR.qm - locale/defi_es_CL.qm - locale/defi_es_CO.qm - locale/defi_es_DO.qm - locale/defi_es_ES.qm - locale/defi_es_MX.qm - locale/defi_es.qm - locale/defi_es_UY.qm - locale/defi_es_VE.qm - locale/defi_et_EE.qm - locale/defi_et.qm - locale/defi_eu_ES.qm - locale/defi_fa_IR.qm - locale/defi_fa.qm - locale/defi_fi.qm - locale/defi_fr_CA.qm - locale/defi_fr_FR.qm - locale/defi_fr.qm - locale/defi_gl.qm - locale/defi_he.qm - locale/defi_hi_IN.qm - locale/defi_hr.qm - locale/defi_hu.qm - locale/defi_id_ID.qm - locale/defi_it_IT.qm - locale/defi_it.qm - locale/defi_ja.qm - locale/defi_ka.qm - locale/defi_kk_KZ.qm - locale/defi_ko_KR.qm - locale/defi_ku_IQ.qm - locale/defi_ky.qm - locale/defi_la.qm - locale/defi_lt.qm - locale/defi_lv_LV.qm - locale/defi_mk_MK.qm - locale/defi_mn.qm - locale/defi_ms_MY.qm - locale/defi_nb.qm - locale/defi_ne.qm - locale/defi_nl.qm - locale/defi_pam.qm - locale/defi_pl.qm - locale/defi_pt_BR.qm - locale/defi_pt_PT.qm - locale/defi_ro_RO.qm - locale/defi_ro.qm - locale/defi_ru_RU.qm - locale/defi_ru.qm - locale/defi_sk.qm - locale/defi_sl_SI.qm - locale/defi_sq.qm - locale/defi_sr@latin.qm - locale/defi_sr.qm - locale/defi_sv.qm - locale/defi_ta.qm - locale/defi_th_TH.qm - locale/defi_tr_TR.qm - locale/defi_tr.qm - locale/defi_uk.qm - locale/defi_ur_PK.qm - locale/defi_uz@Cyrl.qm - locale/defi_vi.qm - locale/defi_vi_VN.qm - locale/defi_zh_CN.qm - locale/defi_zh_HK.qm - locale/defi_zh.qm - locale/defi_zh_TW.qm - - diff --git a/src/qt/defiaddressvalidator.cpp b/src/qt/defiaddressvalidator.cpp deleted file mode 100644 index 3e288a5412c..00000000000 --- a/src/qt/defiaddressvalidator.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include - -/* Base58 characters are: - "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" - - This is: - - All numbers except for '0' - - All upper-case letters except for 'I' and 'O' - - All lower-case letters except for 'l' -*/ - -DefiAddressEntryValidator::DefiAddressEntryValidator(QObject *parent) : - QValidator(parent) -{ -} - -QValidator::State DefiAddressEntryValidator::validate(QString &input, int &pos) const -{ - Q_UNUSED(pos); - - // Empty address is "intermediate" input - if (input.isEmpty()) - return QValidator::Intermediate; - - // Correction - for (int idx = 0; idx < input.size();) - { - bool removeChar = false; - QChar ch = input.at(idx); - // Corrections made are very conservative on purpose, to avoid - // users unexpectedly getting away with typos that would normally - // be detected, and thus sending to the wrong address. - switch(ch.unicode()) - { - // Qt categorizes these as "Other_Format" not "Separator_Space" - case 0x200B: // ZERO WIDTH SPACE - case 0xFEFF: // ZERO WIDTH NO-BREAK SPACE - removeChar = true; - break; - default: - break; - } - - // Remove whitespace - if (ch.isSpace()) - removeChar = true; - - // To next character - if (removeChar) - input.remove(idx, 1); - else - ++idx; - } - - // Validation - QValidator::State state = QValidator::Acceptable; - for (int idx = 0; idx < input.size(); ++idx) - { - int ch = input.at(idx).unicode(); - - if (((ch >= '0' && ch<='9') || - (ch >= 'a' && ch<='z') || - (ch >= 'A' && ch<='Z')) && - ch != 'I' && ch != 'O') // Characters invalid in both Base58 and Bech32 - { - // Alphanumeric and not a 'forbidden' character - } - else - { - state = QValidator::Invalid; - } - } - - return state; -} - -DefiAddressCheckValidator::DefiAddressCheckValidator(QObject *parent) : - QValidator(parent) -{ -} - -QValidator::State DefiAddressCheckValidator::validate(QString &input, int &pos) const -{ - Q_UNUSED(pos); - // Validate the passed Defi address - if (IsValidDestinationString(input.toStdString())) { - return QValidator::Acceptable; - } - - return QValidator::Invalid; -} diff --git a/src/qt/defiaddressvalidator.h b/src/qt/defiaddressvalidator.h deleted file mode 100644 index aeab33a91e5..00000000000 --- a/src/qt/defiaddressvalidator.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2011-2014 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_DEFIADDRESSVALIDATOR_H -#define DEFI_QT_DEFIADDRESSVALIDATOR_H - -#include - -/** Base58 entry widget validator, checks for valid characters and - * removes some whitespace. - */ -class DefiAddressEntryValidator : public QValidator -{ - Q_OBJECT - -public: - explicit DefiAddressEntryValidator(QObject *parent); - - State validate(QString &input, int &pos) const; -}; - -/** Defi address widget validator, checks for a valid defi address. - */ -class DefiAddressCheckValidator : public QValidator -{ - Q_OBJECT - -public: - explicit DefiAddressCheckValidator(QObject *parent); - - State validate(QString &input, int &pos) const; -}; - -#endif // DEFI_QT_DEFIADDRESSVALIDATOR_H diff --git a/src/qt/defiamountfield.cpp b/src/qt/defiamountfield.cpp deleted file mode 100644 index 90b2ed91e22..00000000000 --- a/src/qt/defiamountfield.cpp +++ /dev/null @@ -1,342 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/** QSpinBox that uses fixed-point numbers internally and uses our own - * formatting/parsing functions. - */ -class AmountSpinBox: public QAbstractSpinBox -{ - Q_OBJECT - -public: - explicit AmountSpinBox(QWidget *parent): - QAbstractSpinBox(parent) - { - setAlignment(Qt::AlignRight); - - connect(lineEdit(), &QLineEdit::textEdited, this, &AmountSpinBox::valueChanged); - } - - QValidator::State validate(QString &text, int &pos) const - { - if(text.isEmpty()) - return QValidator::Intermediate; - bool valid = false; - parse(text, &valid); - /* Make sure we return Intermediate so that fixup() is called on defocus */ - return valid ? QValidator::Intermediate : QValidator::Invalid; - } - - void fixup(QString &input) const - { - bool valid; - CAmount val; - - if (input.isEmpty() && !m_allow_empty) { - valid = true; - val = m_min_amount; - } else { - valid = false; - val = parse(input, &valid); - } - - if (valid) { - val = qBound(m_min_amount, val, m_max_amount); - input = DefiUnits::format(currentUnit, val, false, DefiUnits::separatorAlways); - lineEdit()->setText(input); - } - } - - CAmount value(bool *valid_out=nullptr) const - { - return parse(text(), valid_out); - } - - void setValue(const CAmount& value) - { - lineEdit()->setText(DefiUnits::format(currentUnit, value, false, DefiUnits::separatorAlways)); - Q_EMIT valueChanged(); - } - - void SetAllowEmpty(bool allow) - { - m_allow_empty = allow; - } - - void SetMinValue(const CAmount& value) - { - m_min_amount = value; - } - - void SetMaxValue(const CAmount& value) - { - m_max_amount = value; - } - - void stepBy(int steps) - { - bool valid = false; - CAmount val = value(&valid); - val = val + steps * singleStep; - val = qBound(m_min_amount, val, m_max_amount); - setValue(val); - } - - void setDisplayUnit(int unit) - { - bool valid = false; - CAmount val = value(&valid); - - currentUnit = unit; - - if(valid) - setValue(val); - else - clear(); - } - - void setSingleStep(const CAmount& step) - { - singleStep = step; - } - - QSize minimumSizeHint() const - { - if(cachedMinimumSizeHint.isEmpty()) - { - ensurePolished(); - - const QFontMetrics fm(fontMetrics()); - int h = lineEdit()->minimumSizeHint().height(); - int w = GUIUtil::TextWidth(fm, DefiUnits::format(DefiUnits::BTC, DefiUnits::maxMoney(), false, DefiUnits::separatorAlways)); - w += 2; // cursor blinking space - - QStyleOptionSpinBox opt; - initStyleOption(&opt); - QSize hint(w, h); - QSize extra(35, 6); - opt.rect.setSize(hint + extra); - extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, - QStyle::SC_SpinBoxEditField, this).size(); - // get closer to final result by repeating the calculation - opt.rect.setSize(hint + extra); - extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, - QStyle::SC_SpinBoxEditField, this).size(); - hint += extra; - hint.setHeight(h); - - opt.rect = rect(); - - cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) - .expandedTo(QApplication::globalStrut()); - } - return cachedMinimumSizeHint; - } - -private: - int currentUnit{DefiUnits::BTC}; - CAmount singleStep{CAmount(100000)}; // satoshis - mutable QSize cachedMinimumSizeHint; - bool m_allow_empty{true}; - CAmount m_min_amount{CAmount(0)}; - CAmount m_max_amount{DefiUnits::maxMoney()}; - - /** - * Parse a string into a number of base monetary units and - * return validity. - * @note Must return 0 if !valid. - */ - CAmount parse(const QString &text, bool *valid_out=nullptr) const - { - CAmount val = 0; - bool valid = DefiUnits::parse(currentUnit, text, &val); - if(valid) - { - if(val < 0 || val > DefiUnits::maxMoney()) - valid = false; - } - if(valid_out) - *valid_out = valid; - return valid ? val : 0; - } - -protected: - bool event(QEvent *event) - { - if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) - { - QKeyEvent *keyEvent = static_cast(event); - if (keyEvent->key() == Qt::Key_Comma) - { - // Translate a comma into a period - QKeyEvent periodKeyEvent(event->type(), Qt::Key_Period, keyEvent->modifiers(), ".", keyEvent->isAutoRepeat(), keyEvent->count()); - return QAbstractSpinBox::event(&periodKeyEvent); - } - } - return QAbstractSpinBox::event(event); - } - - StepEnabled stepEnabled() const - { - if (isReadOnly()) // Disable steps when AmountSpinBox is read-only - return StepNone; - if (text().isEmpty()) // Allow step-up with empty field - return StepUpEnabled; - - StepEnabled rv = StepNone; - bool valid = false; - CAmount val = value(&valid); - if (valid) { - if (val > m_min_amount) - rv |= StepDownEnabled; - if (val < m_max_amount) - rv |= StepUpEnabled; - } - return rv; - } - -Q_SIGNALS: - void valueChanged(); -}; - -#include - -DefiAmountField::DefiAmountField(QWidget *parent) : - QWidget(parent), - amount(nullptr) -{ - amount = new AmountSpinBox(this); - amount->setLocale(QLocale::c()); - amount->installEventFilter(this); - amount->setMaximumWidth(240); - - QHBoxLayout *layout = new QHBoxLayout(this); - layout->addWidget(amount); - unit = new QValueComboBox(this); - unit->setModel(new DefiUnits(this)); - layout->addWidget(unit); - layout->addStretch(1); - layout->setContentsMargins(0,0,0,0); - - setLayout(layout); - - setFocusPolicy(Qt::TabFocus); - setFocusProxy(amount); - - // If one if the widgets changes, the combined content changes as well - connect(amount, &AmountSpinBox::valueChanged, this, &DefiAmountField::valueChanged); - connect(unit, static_cast(&QComboBox::currentIndexChanged), this, &DefiAmountField::unitChanged); - - // Set default based on configuration - unitChanged(unit->currentIndex()); -} - -void DefiAmountField::clear() -{ - amount->clear(); - unit->setCurrentIndex(0); -} - -void DefiAmountField::setEnabled(bool fEnabled) -{ - amount->setEnabled(fEnabled); - unit->setEnabled(fEnabled); -} - -bool DefiAmountField::validate() -{ - bool valid = false; - value(&valid); - setValid(valid); - return valid; -} - -void DefiAmountField::setValid(bool valid) -{ - if (valid) - amount->setStyleSheet(""); - else - amount->setStyleSheet(STYLE_INVALID); -} - -bool DefiAmountField::eventFilter(QObject *object, QEvent *event) -{ - if (event->type() == QEvent::FocusIn) - { - // Clear invalid flag on focus - setValid(true); - } - return QWidget::eventFilter(object, event); -} - -QWidget *DefiAmountField::setupTabChain(QWidget *prev) -{ - QWidget::setTabOrder(prev, amount); - QWidget::setTabOrder(amount, unit); - return unit; -} - -CAmount DefiAmountField::value(bool *valid_out) const -{ - return amount->value(valid_out); -} - -void DefiAmountField::setValue(const CAmount& value) -{ - amount->setValue(value); -} - -void DefiAmountField::SetAllowEmpty(bool allow) -{ - amount->SetAllowEmpty(allow); -} - -void DefiAmountField::SetMinValue(const CAmount& value) -{ - amount->SetMinValue(value); -} - -void DefiAmountField::SetMaxValue(const CAmount& value) -{ - amount->SetMaxValue(value); -} - -void DefiAmountField::setReadOnly(bool fReadOnly) -{ - amount->setReadOnly(fReadOnly); -} - -void DefiAmountField::unitChanged(int idx) -{ - // Use description tooltip for current unit for the combobox - unit->setToolTip(unit->itemData(idx, Qt::ToolTipRole).toString()); - - // Determine new unit ID - int newUnit = unit->itemData(idx, DefiUnits::UnitRole).toInt(); - - amount->setDisplayUnit(newUnit); -} - -void DefiAmountField::setDisplayUnit(int newUnit) -{ - unit->setValue(newUnit); -} - -void DefiAmountField::setSingleStep(const CAmount& step) -{ - amount->setSingleStep(step); -} diff --git a/src/qt/defiamountfield.h b/src/qt/defiamountfield.h deleted file mode 100644 index 6b447ecd33b..00000000000 --- a/src/qt/defiamountfield.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_DEFIAMOUNTFIELD_H -#define DEFI_QT_DEFIAMOUNTFIELD_H - -#include - -#include - -class AmountSpinBox; - -QT_BEGIN_NAMESPACE -class QValueComboBox; -QT_END_NAMESPACE - -/** Widget for entering defi amounts. - */ -class DefiAmountField: public QWidget -{ - Q_OBJECT - - // ugly hack: for some unknown reason CAmount (instead of qint64) does not work here as expected - // discussion: https://github.com/bitcoin/bitcoin/pull/5117 - Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true) - -public: - explicit DefiAmountField(QWidget *parent = nullptr); - - CAmount value(bool *value=nullptr) const; - void setValue(const CAmount& value); - - /** If allow empty is set to false the field will be set to the minimum allowed value if left empty. **/ - void SetAllowEmpty(bool allow); - - /** Set the minimum value in satoshis **/ - void SetMinValue(const CAmount& value); - - /** Set the maximum value in satoshis **/ - void SetMaxValue(const CAmount& value); - - /** Set single step in satoshis **/ - void setSingleStep(const CAmount& step); - - /** Make read-only **/ - void setReadOnly(bool fReadOnly); - - /** Mark current value as invalid in UI. */ - void setValid(bool valid); - /** Perform input validation, mark field as invalid if entered value is not valid. */ - bool validate(); - - /** Change unit used to display amount. */ - void setDisplayUnit(int unit); - - /** Make field empty and ready for new input. */ - void clear(); - - /** Enable/Disable. */ - void setEnabled(bool fEnabled); - - /** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907), - in these cases we have to set it up manually. - */ - QWidget *setupTabChain(QWidget *prev); - -Q_SIGNALS: - void valueChanged(); - -protected: - /** Intercept focus-in event and ',' key presses */ - bool eventFilter(QObject *object, QEvent *event); - -private: - AmountSpinBox *amount; - QValueComboBox *unit; - -private Q_SLOTS: - void unitChanged(int idx); - -}; - -#endif // DEFI_QT_DEFIAMOUNTFIELD_H diff --git a/src/qt/defigui.cpp b/src/qt/defigui.cpp deleted file mode 100644 index 99edd4ef5f9..00000000000 --- a/src/qt/defigui.cpp +++ /dev/null @@ -1,1471 +0,0 @@ -// Copyright (c) 2011-2019 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef ENABLE_WALLET -#include -#include -#include -#include -#endif // ENABLE_WALLET - -#ifdef Q_OS_MAC -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -const std::string DefiGUI::DEFAULT_UIPLATFORM = -#if defined(Q_OS_MAC) - "macosx" -#elif defined(Q_OS_WIN) - "windows" -#else - "other" -#endif - ; - -DefiGUI::DefiGUI(interfaces::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) : - QMainWindow(parent), - m_node(node), - trayIconMenu{new QMenu()}, - platformStyle(_platformStyle), - m_network_style(networkStyle) -{ - QSettings settings; - if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) { - // Restore failed (perhaps missing setting), center the window - move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center()); - } - -#ifdef ENABLE_WALLET - enableWallet = WalletModel::isWalletEnabled(); -#endif // ENABLE_WALLET - QApplication::setWindowIcon(m_network_style->getTrayAndWindowIcon()); - setWindowIcon(m_network_style->getTrayAndWindowIcon()); - updateWindowTitle(); - - rpcConsole = new RPCConsole(node, _platformStyle, nullptr); - helpMessageDialog = new HelpMessageDialog(node, this, false); -#ifdef ENABLE_WALLET - if(enableWallet) - { - /** Create wallet frame and make it the central widget */ - walletFrame = new WalletFrame(_platformStyle, this); - setCentralWidget(walletFrame); - } else -#endif // ENABLE_WALLET - { - /* When compiled without wallet or -disablewallet is provided, - * the central widget is the rpc console. - */ - setCentralWidget(rpcConsole); - Q_EMIT consoleShown(rpcConsole); - } - - // Accept D&D of URIs - setAcceptDrops(true); - - // Create actions for the toolbar, menu bar and tray/dock icon - // Needs walletFrame to be initialized - createActions(); - - // Create application menu bar - createMenuBar(); - - // Create the toolbars - createToolBars(); - - // Create system tray icon and notification - if (QSystemTrayIcon::isSystemTrayAvailable()) { - createTrayIcon(); - } - notificator = new Notificator(QApplication::applicationName(), trayIcon, this); - - // Create status bar - statusBar(); - - // Disable size grip because it looks ugly and nobody needs it - statusBar()->setSizeGripEnabled(false); - - // Status bar notification icons - QFrame *frameBlocks = new QFrame(); - frameBlocks->setContentsMargins(0,0,0,0); - frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); - QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks); - frameBlocksLayout->setContentsMargins(3,0,3,0); - frameBlocksLayout->setSpacing(3); - unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle); - labelWalletEncryptionIcon = new QLabel(); - labelWalletHDStatusIcon = new QLabel(); - labelProxyIcon = new GUIUtil::ClickableLabel(); - connectionsControl = new GUIUtil::ClickableLabel(); - labelBlocksIcon = new GUIUtil::ClickableLabel(); - if(enableWallet) - { - frameBlocksLayout->addStretch(); - frameBlocksLayout->addWidget(unitDisplayControl); - frameBlocksLayout->addStretch(); - frameBlocksLayout->addWidget(labelWalletEncryptionIcon); - frameBlocksLayout->addWidget(labelWalletHDStatusIcon); - } - frameBlocksLayout->addWidget(labelProxyIcon); - frameBlocksLayout->addStretch(); - frameBlocksLayout->addWidget(connectionsControl); - frameBlocksLayout->addStretch(); - frameBlocksLayout->addWidget(labelBlocksIcon); - frameBlocksLayout->addStretch(); - - // Progress bar and label for blocks download - progressBarLabel = new QLabel(); - progressBarLabel->setVisible(false); - progressBar = new GUIUtil::ProgressBar(); - progressBar->setAlignment(Qt::AlignCenter); - progressBar->setVisible(false); - - // Override style sheet for progress bar for styles that have a segmented progress bar, - // as they make the text unreadable (workaround for issue #1071) - // See https://doc.qt.io/qt-5/gallery.html - QString curStyle = QApplication::style()->metaObject()->className(); - if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle") - { - progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }"); - } - - statusBar()->addWidget(progressBarLabel); - statusBar()->addWidget(progressBar); - statusBar()->addPermanentWidget(frameBlocks); - - // Install event filter to be able to catch status tip events (QEvent::StatusTip) - this->installEventFilter(this); - - // Initially wallet actions should be disabled - setWalletActionsEnabled(false); - - // Subscribe to notifications from core - subscribeToCoreSignals(); - - connect(connectionsControl, &GUIUtil::ClickableLabel::clicked, [this] { - m_node.setNetworkActive(!m_node.getNetworkActive()); - }); - connect(labelProxyIcon, &GUIUtil::ClickableLabel::clicked, [this] { - openOptionsDialogWithTab(OptionsDialog::TAB_NETWORK); - }); - - modalOverlay = new ModalOverlay(this->centralWidget()); -#ifdef ENABLE_WALLET - if(enableWallet) { - connect(walletFrame, &WalletFrame::requestedSyncWarningInfo, this, &DefiGUI::showModalOverlay); - connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &DefiGUI::showModalOverlay); - connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &DefiGUI::showModalOverlay); - } -#endif - -#ifdef Q_OS_MAC - m_app_nap_inhibitor = new CAppNapInhibitor; -#endif -} - -DefiGUI::~DefiGUI() -{ - // Unsubscribe from notifications from core - unsubscribeFromCoreSignals(); - - QSettings settings; - settings.setValue("MainWindowGeometry", saveGeometry()); - if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu) - trayIcon->hide(); -#ifdef Q_OS_MAC - delete m_app_nap_inhibitor; - delete appMenuBar; - MacDockIconHandler::cleanup(); -#endif - - delete rpcConsole; -} - -void DefiGUI::createActions() -{ - QActionGroup *tabGroup = new QActionGroup(this); - - overviewAction = new QAction(platformStyle->SingleColorIcon(":/icons/overview"), tr("&Overview"), this); - overviewAction->setStatusTip(tr("Show general overview of wallet")); - overviewAction->setToolTip(overviewAction->statusTip()); - overviewAction->setCheckable(true); - overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); - tabGroup->addAction(overviewAction); - - sendCoinsAction = new QAction(platformStyle->SingleColorIcon(":/icons/send"), tr("&Send"), this); - sendCoinsAction->setStatusTip(tr("Send coins to a Defi address")); - sendCoinsAction->setToolTip(sendCoinsAction->statusTip()); - sendCoinsAction->setCheckable(true); - sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); - tabGroup->addAction(sendCoinsAction); - - sendCoinsMenuAction = new QAction(sendCoinsAction->text(), this); - sendCoinsMenuAction->setStatusTip(sendCoinsAction->statusTip()); - sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip()); - - receiveCoinsAction = new QAction(platformStyle->SingleColorIcon(":/icons/receiving_addresses"), tr("&Receive"), this); - receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and defi: URIs)")); - receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip()); - receiveCoinsAction->setCheckable(true); - receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); - tabGroup->addAction(receiveCoinsAction); - - receiveCoinsMenuAction = new QAction(receiveCoinsAction->text(), this); - receiveCoinsMenuAction->setStatusTip(receiveCoinsAction->statusTip()); - receiveCoinsMenuAction->setToolTip(receiveCoinsMenuAction->statusTip()); - - historyAction = new QAction(platformStyle->SingleColorIcon(":/icons/history"), tr("&Transactions"), this); - historyAction->setStatusTip(tr("Browse transaction history")); - historyAction->setToolTip(historyAction->statusTip()); - historyAction->setCheckable(true); - historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); - tabGroup->addAction(historyAction); - -#ifdef ENABLE_WALLET - // These showNormalIfMinimized are needed because Send Coins and Receive Coins - // can be triggered from the tray menu, and need to show the GUI to be useful. - connect(overviewAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); - connect(overviewAction, &QAction::triggered, this, &DefiGUI::gotoOverviewPage); - connect(sendCoinsAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); - connect(sendCoinsAction, &QAction::triggered, [this]{ gotoSendCoinsPage(); }); - connect(sendCoinsMenuAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); - connect(sendCoinsMenuAction, &QAction::triggered, [this]{ gotoSendCoinsPage(); }); - connect(receiveCoinsAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); - connect(receiveCoinsAction, &QAction::triggered, this, &DefiGUI::gotoReceiveCoinsPage); - connect(receiveCoinsMenuAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); - connect(receiveCoinsMenuAction, &QAction::triggered, this, &DefiGUI::gotoReceiveCoinsPage); - connect(historyAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); - connect(historyAction, &QAction::triggered, this, &DefiGUI::gotoHistoryPage); -#endif // ENABLE_WALLET - - quitAction = new QAction(tr("E&xit"), this); - quitAction->setStatusTip(tr("Quit application")); - quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); - quitAction->setMenuRole(QAction::QuitRole); - aboutAction = new QAction(tr("&About %1").arg(PACKAGE_NAME), this); - aboutAction->setStatusTip(tr("Show information about %1").arg(PACKAGE_NAME)); - aboutAction->setMenuRole(QAction::AboutRole); - aboutAction->setEnabled(false); - aboutQtAction = new QAction(tr("About &Qt"), this); - aboutQtAction->setStatusTip(tr("Show information about Qt")); - aboutQtAction->setMenuRole(QAction::AboutQtRole); - optionsAction = new QAction(tr("&Options..."), this); - optionsAction->setStatusTip(tr("Modify configuration options for %1").arg(PACKAGE_NAME)); - optionsAction->setMenuRole(QAction::PreferencesRole); - optionsAction->setEnabled(false); - toggleHideAction = new QAction(tr("&Show / Hide"), this); - toggleHideAction->setStatusTip(tr("Show or hide the main Window")); - - encryptWalletAction = new QAction(tr("&Encrypt Wallet..."), this); - encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet")); - encryptWalletAction->setCheckable(true); - backupWalletAction = new QAction(tr("&Backup Wallet..."), this); - backupWalletAction->setStatusTip(tr("Backup wallet to another location")); - changePassphraseAction = new QAction(tr("&Change Passphrase..."), this); - changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); - signMessageAction = new QAction(tr("Sign &message..."), this); - signMessageAction->setStatusTip(tr("Sign messages with your Defi addresses to prove you own them")); - verifyMessageAction = new QAction(tr("&Verify message..."), this); - verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Defi addresses")); - - openRPCConsoleAction = new QAction(tr("&Debug window"), this); - openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console")); - // initially disable the debug window menu item - openRPCConsoleAction->setEnabled(false); - openRPCConsoleAction->setObjectName("openRPCConsoleAction"); - - usedSendingAddressesAction = new QAction(tr("&Sending addresses"), this); - usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels")); - usedReceivingAddressesAction = new QAction(tr("&Receiving addresses"), this); - usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels")); - - openAction = new QAction(tr("Open &URI..."), this); - openAction->setStatusTip(tr("Open a defi: URI or payment request")); - - m_open_wallet_action = new QAction(tr("Open Wallet"), this); - m_open_wallet_action->setEnabled(false); - m_open_wallet_action->setStatusTip(tr("Open a wallet")); - m_open_wallet_menu = new QMenu(this); - - m_close_wallet_action = new QAction(tr("Close Wallet..."), this); - m_close_wallet_action->setStatusTip(tr("Close wallet")); - - showHelpMessageAction = new QAction(tr("&Command-line options"), this); - showHelpMessageAction->setMenuRole(QAction::NoRole); - showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Defi command-line options").arg(PACKAGE_NAME)); - - connect(quitAction, &QAction::triggered, qApp, QApplication::quit); - connect(aboutAction, &QAction::triggered, this, &DefiGUI::aboutClicked); - connect(aboutQtAction, &QAction::triggered, qApp, QApplication::aboutQt); - connect(optionsAction, &QAction::triggered, this, &DefiGUI::optionsClicked); - connect(toggleHideAction, &QAction::triggered, this, &DefiGUI::toggleHidden); - connect(showHelpMessageAction, &QAction::triggered, this, &DefiGUI::showHelpMessageClicked); - connect(openRPCConsoleAction, &QAction::triggered, this, &DefiGUI::showDebugWindow); - // prevents an open debug window from becoming stuck/unusable on client shutdown - connect(quitAction, &QAction::triggered, rpcConsole, &QWidget::hide); - -#ifdef ENABLE_WALLET - if(walletFrame) - { - connect(encryptWalletAction, &QAction::triggered, walletFrame, &WalletFrame::encryptWallet); - connect(backupWalletAction, &QAction::triggered, walletFrame, &WalletFrame::backupWallet); - connect(changePassphraseAction, &QAction::triggered, walletFrame, &WalletFrame::changePassphrase); - connect(signMessageAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); - connect(signMessageAction, &QAction::triggered, [this]{ gotoSignMessageTab(); }); - connect(verifyMessageAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); - connect(verifyMessageAction, &QAction::triggered, [this]{ gotoVerifyMessageTab(); }); - connect(usedSendingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedSendingAddresses); - connect(usedReceivingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedReceivingAddresses); - connect(openAction, &QAction::triggered, this, &DefiGUI::openClicked); - connect(m_open_wallet_menu, &QMenu::aboutToShow, [this] { - m_open_wallet_menu->clear(); - for (const std::pair& i : m_wallet_controller->listWalletDir()) { - const std::string& path = i.first; - QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path); - QAction* action = m_open_wallet_menu->addAction(name); - - if (i.second) { - // This wallet is already loaded - action->setEnabled(false); - continue; - } - - connect(action, &QAction::triggered, [this, name, path] { - OpenWalletActivity* activity = m_wallet_controller->openWallet(path); - - QProgressDialog* dialog = new QProgressDialog(this); - dialog->setLabelText(tr("Opening Wallet %1...").arg(name.toHtmlEscaped())); - dialog->setRange(0, 0); - dialog->setCancelButton(nullptr); - dialog->setWindowModality(Qt::ApplicationModal); - dialog->show(); - - connect(activity, &OpenWalletActivity::message, this, [this] (QMessageBox::Icon icon, QString text) { - QMessageBox box; - box.setIcon(icon); - box.setText(tr("Open Wallet Failed")); - box.setInformativeText(text); - box.setStandardButtons(QMessageBox::Ok); - box.setDefaultButton(QMessageBox::Ok); - connect(this, &QObject::destroyed, &box, &QDialog::accept); - box.exec(); - }); - connect(activity, &OpenWalletActivity::opened, this, &DefiGUI::setCurrentWallet); - connect(activity, &OpenWalletActivity::finished, activity, &QObject::deleteLater); - connect(activity, &OpenWalletActivity::finished, dialog, &QObject::deleteLater); - bool invoked = QMetaObject::invokeMethod(activity, "open"); - assert(invoked); - }); - } - if (m_open_wallet_menu->isEmpty()) { - QAction* action = m_open_wallet_menu->addAction(tr("No wallets available")); - action->setEnabled(false); - } - }); - connect(m_close_wallet_action, &QAction::triggered, [this] { - m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this); - }); - } -#endif // ENABLE_WALLET - - connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this), &QShortcut::activated, this, &DefiGUI::showDebugWindowActivateConsole); - connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D), this), &QShortcut::activated, this, &DefiGUI::showDebugWindow); -} - -void DefiGUI::createMenuBar() -{ -#ifdef Q_OS_MAC - // Create a decoupled menu bar on Mac which stays even if the window is closed - appMenuBar = new QMenuBar(); -#else - // Get the main window's menu bar on other platforms - appMenuBar = menuBar(); -#endif - - // Configure the menus - QMenu *file = appMenuBar->addMenu(tr("&File")); - if(walletFrame) - { - file->addAction(m_open_wallet_action); - file->addAction(m_close_wallet_action); - file->addSeparator(); - file->addAction(openAction); - file->addAction(backupWalletAction); - file->addAction(signMessageAction); - file->addAction(verifyMessageAction); - file->addSeparator(); - } - file->addAction(quitAction); - - QMenu *settings = appMenuBar->addMenu(tr("&Settings")); - if(walletFrame) - { - settings->addAction(encryptWalletAction); - settings->addAction(changePassphraseAction); - settings->addSeparator(); - } - settings->addAction(optionsAction); - - QMenu* window_menu = appMenuBar->addMenu(tr("&Window")); - - QAction* minimize_action = window_menu->addAction(tr("Minimize")); - minimize_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); - connect(minimize_action, &QAction::triggered, [] { - qApp->focusWindow()->showMinimized(); - }); - connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) { - minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized); - }); - -#ifdef Q_OS_MAC - QAction* zoom_action = window_menu->addAction(tr("Zoom")); - connect(zoom_action, &QAction::triggered, [] { - QWindow* window = qApp->focusWindow(); - if (window->windowState() != Qt::WindowMaximized) { - window->showMaximized(); - } else { - window->showNormal(); - } - }); - - connect(qApp, &QApplication::focusWindowChanged, [zoom_action] (QWindow* window) { - zoom_action->setEnabled(window != nullptr); - }); -#else - QAction* restore_action = window_menu->addAction(tr("Restore")); - connect(restore_action, &QAction::triggered, [] { - qApp->focusWindow()->showNormal(); - }); - - connect(qApp, &QApplication::focusWindowChanged, [restore_action] (QWindow* window) { - restore_action->setEnabled(window != nullptr); - }); -#endif - - if (walletFrame) { - window_menu->addSeparator(); - QAction* main_window_action = window_menu->addAction(tr("Main Window")); - connect(main_window_action, &QAction::triggered, [this] { - GUIUtil::bringToFront(this); - }); - - window_menu->addSeparator(); - window_menu->addAction(usedSendingAddressesAction); - window_menu->addAction(usedReceivingAddressesAction); - } - - window_menu->addSeparator(); - for (RPCConsole::TabTypes tab_type : rpcConsole->tabs()) { - QAction* tab_action = window_menu->addAction(rpcConsole->tabTitle(tab_type)); - connect(tab_action, &QAction::triggered, [this, tab_type] { - rpcConsole->setTabFocus(tab_type); - showDebugWindow(); - }); - } - - QMenu *help = appMenuBar->addMenu(tr("&Help")); - help->addAction(showHelpMessageAction); - help->addSeparator(); - help->addAction(aboutAction); - help->addAction(aboutQtAction); -} - -void DefiGUI::createToolBars() -{ - if(walletFrame) - { - QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); - appToolBar = toolbar; - toolbar->setContextMenuPolicy(Qt::PreventContextMenu); - toolbar->setMovable(false); - toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - toolbar->addAction(overviewAction); - toolbar->addAction(sendCoinsAction); - toolbar->addAction(receiveCoinsAction); - toolbar->addAction(historyAction); - overviewAction->setChecked(true); - -#ifdef ENABLE_WALLET - QWidget *spacer = new QWidget(); - spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - toolbar->addWidget(spacer); - - m_wallet_selector = new QComboBox(); - m_wallet_selector->setSizeAdjustPolicy(QComboBox::AdjustToContents); - connect(m_wallet_selector, static_cast(&QComboBox::currentIndexChanged), this, &DefiGUI::setCurrentWalletBySelectorIndex); - - m_wallet_selector_label = new QLabel(); - m_wallet_selector_label->setText(tr("Wallet:") + " "); - m_wallet_selector_label->setBuddy(m_wallet_selector); - - m_wallet_selector_label_action = appToolBar->addWidget(m_wallet_selector_label); - m_wallet_selector_action = appToolBar->addWidget(m_wallet_selector); - - m_wallet_selector_label_action->setVisible(false); - m_wallet_selector_action->setVisible(false); -#endif - } -} - -void DefiGUI::setClientModel(ClientModel *_clientModel) -{ - this->clientModel = _clientModel; - if(_clientModel) - { - // Create system tray menu (or setup the dock menu) that late to prevent users from calling actions, - // while the client has not yet fully loaded - createTrayIconMenu(); - - // Keep up to date with client - updateNetworkState(); - connect(_clientModel, &ClientModel::numConnectionsChanged, this, &DefiGUI::setNumConnections); - connect(_clientModel, &ClientModel::networkActiveChanged, this, &DefiGUI::setNetworkActive); - - modalOverlay->setKnownBestHeight(_clientModel->getHeaderTipHeight(), QDateTime::fromTime_t(_clientModel->getHeaderTipTime())); - setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), m_node.getVerificationProgress(), false); - connect(_clientModel, &ClientModel::numBlocksChanged, this, &DefiGUI::setNumBlocks); - - // Receive and report messages from client model - connect(_clientModel, &ClientModel::message, [this](const QString &title, const QString &message, unsigned int style){ - this->message(title, message, style); - }); - - // Show progress dialog - connect(_clientModel, &ClientModel::showProgress, this, &DefiGUI::showProgress); - - rpcConsole->setClientModel(_clientModel); - - updateProxyIcon(); - -#ifdef ENABLE_WALLET - if(walletFrame) - { - walletFrame->setClientModel(_clientModel); - } -#endif // ENABLE_WALLET - unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel()); - - OptionsModel* optionsModel = _clientModel->getOptionsModel(); - if (optionsModel && trayIcon) { - // be aware of the tray icon disable state change reported by the OptionsModel object. - connect(optionsModel, &OptionsModel::hideTrayIconChanged, this, &DefiGUI::setTrayIconVisible); - - // initialize the disable state of the tray icon with the current value in the model. - setTrayIconVisible(optionsModel->getHideTrayIcon()); - } - } else { - // Disable possibility to show main window via action - toggleHideAction->setEnabled(false); - if(trayIconMenu) - { - // Disable context menu on tray icon - trayIconMenu->clear(); - } - // Propagate cleared model to child objects - rpcConsole->setClientModel(nullptr); -#ifdef ENABLE_WALLET - if (walletFrame) - { - walletFrame->setClientModel(nullptr); - } -#endif // ENABLE_WALLET - unitDisplayControl->setOptionsModel(nullptr); - } -} - -#ifdef ENABLE_WALLET -void DefiGUI::setWalletController(WalletController* wallet_controller) -{ - assert(!m_wallet_controller); - assert(wallet_controller); - - m_wallet_controller = wallet_controller; - - m_open_wallet_action->setEnabled(true); - m_open_wallet_action->setMenu(m_open_wallet_menu); - - connect(wallet_controller, &WalletController::walletAdded, this, &DefiGUI::addWallet); - connect(wallet_controller, &WalletController::walletRemoved, this, &DefiGUI::removeWallet); - - for (WalletModel* wallet_model : m_wallet_controller->getOpenWallets()) { - addWallet(wallet_model); - } -} - -void DefiGUI::addWallet(WalletModel* walletModel) -{ - if (!walletFrame) return; - const QString display_name = walletModel->getDisplayName(); - setWalletActionsEnabled(true); - rpcConsole->addWallet(walletModel); - walletFrame->addWallet(walletModel); - m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel)); - if (m_wallet_selector->count() == 2) { - m_wallet_selector_label_action->setVisible(true); - m_wallet_selector_action->setVisible(true); - } -} - -void DefiGUI::removeWallet(WalletModel* walletModel) -{ - if (!walletFrame) return; - int index = m_wallet_selector->findData(QVariant::fromValue(walletModel)); - m_wallet_selector->removeItem(index); - if (m_wallet_selector->count() == 0) { - setWalletActionsEnabled(false); - } else if (m_wallet_selector->count() == 1) { - m_wallet_selector_label_action->setVisible(false); - m_wallet_selector_action->setVisible(false); - } - rpcConsole->removeWallet(walletModel); - walletFrame->removeWallet(walletModel); - updateWindowTitle(); -} - -void DefiGUI::setCurrentWallet(WalletModel* wallet_model) -{ - if (!walletFrame) return; - walletFrame->setCurrentWallet(wallet_model); - for (int index = 0; index < m_wallet_selector->count(); ++index) { - if (m_wallet_selector->itemData(index).value() == wallet_model) { - m_wallet_selector->setCurrentIndex(index); - break; - } - } - updateWindowTitle(); -} - -void DefiGUI::setCurrentWalletBySelectorIndex(int index) -{ - WalletModel* wallet_model = m_wallet_selector->itemData(index).value(); - if (wallet_model) setCurrentWallet(wallet_model); -} - -void DefiGUI::removeAllWallets() -{ - if(!walletFrame) - return; - setWalletActionsEnabled(false); - walletFrame->removeAllWallets(); -} -#endif // ENABLE_WALLET - -void DefiGUI::setWalletActionsEnabled(bool enabled) -{ - overviewAction->setEnabled(enabled); - sendCoinsAction->setEnabled(enabled); - sendCoinsMenuAction->setEnabled(enabled); - receiveCoinsAction->setEnabled(enabled); - receiveCoinsMenuAction->setEnabled(enabled); - historyAction->setEnabled(enabled); - encryptWalletAction->setEnabled(enabled); - backupWalletAction->setEnabled(enabled); - changePassphraseAction->setEnabled(enabled); - signMessageAction->setEnabled(enabled); - verifyMessageAction->setEnabled(enabled); - usedSendingAddressesAction->setEnabled(enabled); - usedReceivingAddressesAction->setEnabled(enabled); - openAction->setEnabled(enabled); - m_close_wallet_action->setEnabled(enabled); -} - -void DefiGUI::createTrayIcon() -{ - assert(QSystemTrayIcon::isSystemTrayAvailable()); - -#ifndef Q_OS_MAC - if (QSystemTrayIcon::isSystemTrayAvailable()) { - trayIcon = new QSystemTrayIcon(m_network_style->getTrayAndWindowIcon(), this); - QString toolTip = tr("%1 client").arg(PACKAGE_NAME) + " " + m_network_style->getTitleAddText(); - trayIcon->setToolTip(toolTip); - } -#endif -} - -void DefiGUI::createTrayIconMenu() -{ -#ifndef Q_OS_MAC - // return if trayIcon is unset (only on non-macOSes) - if (!trayIcon) - return; - - trayIcon->setContextMenu(trayIconMenu.get()); - connect(trayIcon, &QSystemTrayIcon::activated, this, &DefiGUI::trayIconActivated); -#else - // Note: On macOS, the Dock icon is used to provide the tray's functionality. - MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance(); - connect(dockIconHandler, &MacDockIconHandler::dockIconClicked, this, &DefiGUI::macosDockIconActivated); - trayIconMenu->setAsDockMenu(); -#endif - - // Configuration of the tray icon (or Dock icon) menu -#ifndef Q_OS_MAC - // Note: On macOS, the Dock icon's menu already has Show / Hide action. - trayIconMenu->addAction(toggleHideAction); - trayIconMenu->addSeparator(); -#endif - if (enableWallet) { - trayIconMenu->addAction(sendCoinsMenuAction); - trayIconMenu->addAction(receiveCoinsMenuAction); - trayIconMenu->addSeparator(); - trayIconMenu->addAction(signMessageAction); - trayIconMenu->addAction(verifyMessageAction); - trayIconMenu->addSeparator(); - trayIconMenu->addAction(openRPCConsoleAction); - } - trayIconMenu->addAction(optionsAction); -#ifndef Q_OS_MAC // This is built-in on macOS - trayIconMenu->addSeparator(); - trayIconMenu->addAction(quitAction); -#endif -} - -#ifndef Q_OS_MAC -void DefiGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason) -{ - if(reason == QSystemTrayIcon::Trigger) - { - // Click on system tray icon triggers show/hide of the main window - toggleHidden(); - } -} -#else -void DefiGUI::macosDockIconActivated() -{ - show(); - activateWindow(); -} -#endif - -void DefiGUI::optionsClicked() -{ - openOptionsDialogWithTab(OptionsDialog::TAB_MAIN); -} - -void DefiGUI::aboutClicked() -{ - if(!clientModel) - return; - - HelpMessageDialog dlg(m_node, this, true); - dlg.exec(); -} - -void DefiGUI::showDebugWindow() -{ - GUIUtil::bringToFront(rpcConsole); - Q_EMIT consoleShown(rpcConsole); -} - -void DefiGUI::showDebugWindowActivateConsole() -{ - rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE); - showDebugWindow(); -} - -void DefiGUI::showHelpMessageClicked() -{ - helpMessageDialog->show(); -} - -#ifdef ENABLE_WALLET -void DefiGUI::openClicked() -{ - OpenURIDialog dlg(this); - if(dlg.exec()) - { - Q_EMIT receivedURI(dlg.getURI()); - } -} - -void DefiGUI::gotoOverviewPage() -{ - overviewAction->setChecked(true); - if (walletFrame) walletFrame->gotoOverviewPage(); -} - -void DefiGUI::gotoHistoryPage() -{ - historyAction->setChecked(true); - if (walletFrame) walletFrame->gotoHistoryPage(); -} - -void DefiGUI::gotoReceiveCoinsPage() -{ - receiveCoinsAction->setChecked(true); - if (walletFrame) walletFrame->gotoReceiveCoinsPage(); -} - -void DefiGUI::gotoSendCoinsPage(QString addr) -{ - sendCoinsAction->setChecked(true); - if (walletFrame) walletFrame->gotoSendCoinsPage(addr); -} - -void DefiGUI::gotoSignMessageTab(QString addr) -{ - if (walletFrame) walletFrame->gotoSignMessageTab(addr); -} - -void DefiGUI::gotoVerifyMessageTab(QString addr) -{ - if (walletFrame) walletFrame->gotoVerifyMessageTab(addr); -} -#endif // ENABLE_WALLET - -void DefiGUI::updateNetworkState() -{ - int count = clientModel->getNumConnections(); - QString icon; - switch(count) - { - case 0: icon = ":/icons/connect_0"; break; - case 1: case 2: case 3: icon = ":/icons/connect_1"; break; - case 4: case 5: case 6: icon = ":/icons/connect_2"; break; - case 7: case 8: case 9: icon = ":/icons/connect_3"; break; - default: icon = ":/icons/connect_4"; break; - } - - QString tooltip; - - if (m_node.getNetworkActive()) { - tooltip = tr("%n active connection(s) to Defi network", "", count) + QString(".
") + tr("Click to disable network activity."); - } else { - tooltip = tr("Network activity disabled.") + QString("
") + tr("Click to enable network activity again."); - icon = ":/icons/network_disabled"; - } - - // Don't word-wrap this (fixed-width) tooltip - tooltip = QString("") + tooltip + QString(""); - connectionsControl->setToolTip(tooltip); - - connectionsControl->setPixmap(platformStyle->SingleColorIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); -} - -void DefiGUI::setNumConnections(int count) -{ - updateNetworkState(); -} - -void DefiGUI::setNetworkActive(bool networkActive) -{ - updateNetworkState(); -} - -void DefiGUI::updateHeadersSyncProgressLabel() -{ - int64_t headersTipTime = clientModel->getHeaderTipTime(); - int headersTipHeight = clientModel->getHeaderTipHeight(); - int estHeadersLeft = (GetTime() - headersTipTime) / Params().GetConsensus().pos.nTargetSpacing; - if (estHeadersLeft > HEADER_HEIGHT_DELTA_SYNC) - progressBarLabel->setText(tr("Syncing Headers (%1%)...").arg(QString::number(100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight, 'f', 1))); -} - -void DefiGUI::openOptionsDialogWithTab(OptionsDialog::Tab tab) -{ - if (!clientModel || !clientModel->getOptionsModel()) - return; - - OptionsDialog dlg(this, enableWallet); - dlg.setCurrentTab(tab); - dlg.setModel(clientModel->getOptionsModel()); - dlg.exec(); -} - -void DefiGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header) -{ -// Disabling macOS App Nap on initial sync, disk and reindex operations. -#ifdef Q_OS_MAC - (m_node.isInitialBlockDownload() || m_node.getReindex() || m_node.getImporting()) ? m_app_nap_inhibitor->disableAppNap() : m_app_nap_inhibitor->enableAppNap(); -#endif - - if (modalOverlay) - { - if (header) - modalOverlay->setKnownBestHeight(count, blockDate); - else - modalOverlay->tipUpdate(count, blockDate, nVerificationProgress); - } - if (!clientModel) - return; - - // Prevent orphan statusbar messages (e.g. hover Quit in main menu, wait until chain-sync starts -> garbled text) - statusBar()->clearMessage(); - - // Acquire current block source - enum BlockSource blockSource = clientModel->getBlockSource(); - switch (blockSource) { - case BlockSource::NETWORK: - if (header) { - updateHeadersSyncProgressLabel(); - return; - } - progressBarLabel->setText(tr("Synchronizing with network...")); - updateHeadersSyncProgressLabel(); - break; - case BlockSource::DISK: - if (header) { - progressBarLabel->setText(tr("Indexing blocks on disk...")); - } else { - progressBarLabel->setText(tr("Processing blocks on disk...")); - } - break; - case BlockSource::REINDEX: - progressBarLabel->setText(tr("Reindexing blocks on disk...")); - break; - case BlockSource::NONE: - if (header) { - return; - } - progressBarLabel->setText(tr("Connecting to peers...")); - break; - } - - QString tooltip; - - QDateTime currentDate = QDateTime::currentDateTime(); - qint64 secs = blockDate.secsTo(currentDate); - - tooltip = tr("Processed %n block(s) of transaction history.", "", count); - - // Set icon state: spinning if catching up, tick otherwise - if (secs < MAX_BLOCK_TIME_GAP) { - tooltip = tr("Up to date") + QString(".
") + tooltip; - labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); - -#ifdef ENABLE_WALLET - if(walletFrame) - { - walletFrame->showOutOfSyncWarning(false); - modalOverlay->showHide(true, true); - } -#endif // ENABLE_WALLET - - progressBarLabel->setVisible(false); - progressBar->setVisible(false); - } - else - { - QString timeBehindText = GUIUtil::formatNiceTimeOffset(secs); - - progressBarLabel->setVisible(true); - progressBar->setFormat(tr("%1 behind").arg(timeBehindText)); - progressBar->setMaximum(1000000000); - progressBar->setValue(nVerificationProgress * 1000000000.0 + 0.5); - progressBar->setVisible(true); - - tooltip = tr("Catching up...") + QString("
") + tooltip; - if(count != prevBlocks) - { - labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(QString( - ":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0'))) - .pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); - spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES; - } - prevBlocks = count; - -#ifdef ENABLE_WALLET - if(walletFrame) - { - walletFrame->showOutOfSyncWarning(true); - modalOverlay->showHide(); - } -#endif // ENABLE_WALLET - - tooltip += QString("
"); - tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText); - tooltip += QString("
"); - tooltip += tr("Transactions after this will not yet be visible."); - } - - // Don't word-wrap this (fixed-width) tooltip - tooltip = QString("") + tooltip + QString(""); - - labelBlocksIcon->setToolTip(tooltip); - progressBarLabel->setToolTip(tooltip); - progressBar->setToolTip(tooltip); -} - -void DefiGUI::message(const QString& title, QString message, unsigned int style, bool* ret) -{ - // Default title. On macOS, the window title is ignored (as required by the macOS Guidelines). - QString strTitle{PACKAGE_NAME}; - // Default to information icon - int nMBoxIcon = QMessageBox::Information; - int nNotifyIcon = Notificator::Information; - - bool prefix = !(style & CClientUIInterface::MSG_NOPREFIX); - style &= ~CClientUIInterface::MSG_NOPREFIX; - - QString msgType; - if (!title.isEmpty()) { - msgType = title; - } else { - switch (style) { - case CClientUIInterface::MSG_ERROR: - msgType = tr("Error"); - if (prefix) message = tr("Error: %1").arg(message); - break; - case CClientUIInterface::MSG_WARNING: - msgType = tr("Warning"); - if (prefix) message = tr("Warning: %1").arg(message); - break; - case CClientUIInterface::MSG_INFORMATION: - msgType = tr("Information"); - // No need to prepend the prefix here. - break; - default: - break; - } - } - - if (!msgType.isEmpty()) { - strTitle += " - " + msgType; - } - - if (style & CClientUIInterface::ICON_ERROR) { - nMBoxIcon = QMessageBox::Critical; - nNotifyIcon = Notificator::Critical; - } else if (style & CClientUIInterface::ICON_WARNING) { - nMBoxIcon = QMessageBox::Warning; - nNotifyIcon = Notificator::Warning; - } - - if (style & CClientUIInterface::MODAL) { - // Check for buttons, use OK as default, if none was supplied - QMessageBox::StandardButton buttons; - if (!(buttons = (QMessageBox::StandardButton)(style & CClientUIInterface::BTN_MASK))) - buttons = QMessageBox::Ok; - - showNormalIfMinimized(); - QMessageBox mBox(static_cast(nMBoxIcon), strTitle, message, buttons, this); - mBox.setTextFormat(Qt::PlainText); - int r = mBox.exec(); - if (ret != nullptr) - *ret = r == QMessageBox::Ok; - } else { - notificator->notify(static_cast(nNotifyIcon), strTitle, message); - } -} - -void DefiGUI::changeEvent(QEvent *e) -{ - QMainWindow::changeEvent(e); -#ifndef Q_OS_MAC // Ignored on Mac - if(e->type() == QEvent::WindowStateChange) - { - if(clientModel && clientModel->getOptionsModel() && clientModel->getOptionsModel()->getMinimizeToTray()) - { - QWindowStateChangeEvent *wsevt = static_cast(e); - if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized()) - { - QTimer::singleShot(0, this, &DefiGUI::hide); - e->ignore(); - } - else if((wsevt->oldState() & Qt::WindowMinimized) && !isMinimized()) - { - QTimer::singleShot(0, this, &DefiGUI::show); - e->ignore(); - } - } - } -#endif -} - -void DefiGUI::closeEvent(QCloseEvent *event) -{ -#ifndef Q_OS_MAC // Ignored on Mac - if(clientModel && clientModel->getOptionsModel()) - { - if(!clientModel->getOptionsModel()->getMinimizeOnClose()) - { - // close rpcConsole in case it was open to make some space for the shutdown window - rpcConsole->close(); - - QApplication::quit(); - } - else - { - QMainWindow::showMinimized(); - event->ignore(); - } - } -#else - QMainWindow::closeEvent(event); -#endif -} - -void DefiGUI::showEvent(QShowEvent *event) -{ - // enable the debug window when the main window shows up - openRPCConsoleAction->setEnabled(true); - aboutAction->setEnabled(true); - optionsAction->setEnabled(true); -} - -#ifdef ENABLE_WALLET -void DefiGUI::incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label, const QString& walletName) -{ - // On new transaction, make an info balloon - QString msg = tr("Date: %1\n").arg(date) + - tr("Amount: %1\n").arg(DefiUnits::formatWithUnit(unit, amount, true)); - if (m_node.getWallets().size() > 1 && !walletName.isEmpty()) { - msg += tr("Wallet: %1\n").arg(walletName); - } - msg += tr("Type: %1\n").arg(type); - if (!label.isEmpty()) - msg += tr("Label: %1\n").arg(label); - else if (!address.isEmpty()) - msg += tr("Address: %1\n").arg(address); - message((amount)<0 ? tr("Sent transaction") : tr("Incoming transaction"), - msg, CClientUIInterface::MSG_INFORMATION); -} -#endif // ENABLE_WALLET - -void DefiGUI::dragEnterEvent(QDragEnterEvent *event) -{ - // Accept only URIs - if(event->mimeData()->hasUrls()) - event->acceptProposedAction(); -} - -void DefiGUI::dropEvent(QDropEvent *event) -{ - if(event->mimeData()->hasUrls()) - { - for (const QUrl &uri : event->mimeData()->urls()) - { - Q_EMIT receivedURI(uri.toString()); - } - } - event->acceptProposedAction(); -} - -bool DefiGUI::eventFilter(QObject *object, QEvent *event) -{ - // Catch status tip events - if (event->type() == QEvent::StatusTip) - { - // Prevent adding text from setStatusTip(), if we currently use the status bar for displaying other stuff - if (progressBarLabel->isVisible() || progressBar->isVisible()) - return true; - } - return QMainWindow::eventFilter(object, event); -} - -#ifdef ENABLE_WALLET -bool DefiGUI::handlePaymentRequest(const SendCoinsRecipient& recipient) -{ - // URI has to be valid - if (walletFrame && walletFrame->handlePaymentRequest(recipient)) - { - showNormalIfMinimized(); - gotoSendCoinsPage(); - return true; - } - return false; -} - -void DefiGUI::setHDStatus(bool privkeyDisabled, int hdEnabled) -{ - labelWalletHDStatusIcon->setPixmap(platformStyle->SingleColorIcon(privkeyDisabled ? ":/icons/eye" : hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); - labelWalletHDStatusIcon->setToolTip(privkeyDisabled ? tr("Private key disabled") : hdEnabled ? tr("HD key generation is enabled") : tr("HD key generation is disabled")); - - // eventually disable the QLabel to set its opacity to 50% - labelWalletHDStatusIcon->setEnabled(hdEnabled); -} - -void DefiGUI::setEncryptionStatus(int status) -{ - switch(status) - { - case WalletModel::Unencrypted: - labelWalletEncryptionIcon->hide(); - encryptWalletAction->setChecked(false); - changePassphraseAction->setEnabled(false); - encryptWalletAction->setEnabled(true); - break; - case WalletModel::Unlocked: - labelWalletEncryptionIcon->show(); - labelWalletEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); - labelWalletEncryptionIcon->setToolTip(tr("Wallet is encrypted and currently unlocked")); - encryptWalletAction->setChecked(true); - changePassphraseAction->setEnabled(true); - encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported - break; - case WalletModel::Locked: - labelWalletEncryptionIcon->show(); - labelWalletEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); - labelWalletEncryptionIcon->setToolTip(tr("Wallet is encrypted and currently locked")); - encryptWalletAction->setChecked(true); - changePassphraseAction->setEnabled(true); - encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported - break; - } -} - -void DefiGUI::updateWalletStatus() -{ - if (!walletFrame) { - return; - } - WalletView * const walletView = walletFrame->currentWalletView(); - if (!walletView) { - return; - } - WalletModel * const walletModel = walletView->getWalletModel(); - setEncryptionStatus(walletModel->getEncryptionStatus()); - setHDStatus(walletModel->privateKeysDisabled(), walletModel->wallet().hdEnabled()); -} -#endif // ENABLE_WALLET - -void DefiGUI::updateProxyIcon() -{ - std::string ip_port; - bool proxy_enabled = clientModel->getProxyInfo(ip_port); - - if (proxy_enabled) { - if (labelProxyIcon->pixmap() == nullptr) { - QString ip_port_q = QString::fromStdString(ip_port); - labelProxyIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/proxy").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); - labelProxyIcon->setToolTip(tr("Proxy is enabled: %1").arg(ip_port_q)); - } else { - labelProxyIcon->show(); - } - } else { - labelProxyIcon->hide(); - } -} - -void DefiGUI::updateWindowTitle() -{ - QString window_title = PACKAGE_NAME; -#ifdef ENABLE_WALLET - if (walletFrame) { - WalletModel* const wallet_model = walletFrame->currentWalletModel(); - if (wallet_model && !wallet_model->getWalletName().isEmpty()) { - window_title += " - " + wallet_model->getDisplayName(); - } - } -#endif - if (!m_network_style->getTitleAddText().isEmpty()) { - window_title += " - " + m_network_style->getTitleAddText(); - } - setWindowTitle(window_title); -} - -void DefiGUI::showNormalIfMinimized(bool fToggleHidden) -{ - if(!clientModel) - return; - - if (!isHidden() && !isMinimized() && !GUIUtil::isObscured(this) && fToggleHidden) { - hide(); - } else { - GUIUtil::bringToFront(this); - } -} - -void DefiGUI::toggleHidden() -{ - showNormalIfMinimized(true); -} - -void DefiGUI::detectShutdown() -{ - if (m_node.shutdownRequested()) - { - if(rpcConsole) - rpcConsole->hide(); - qApp->quit(); - } -} - -void DefiGUI::showProgress(const QString &title, int nProgress) -{ - if (nProgress == 0) { - progressDialog = new QProgressDialog(title, QString(), 0, 100); - GUIUtil::PolishProgressDialog(progressDialog); - progressDialog->setWindowModality(Qt::ApplicationModal); - progressDialog->setMinimumDuration(0); - progressDialog->setAutoClose(false); - progressDialog->setValue(0); - } else if (nProgress == 100) { - if (progressDialog) { - progressDialog->close(); - progressDialog->deleteLater(); - progressDialog = nullptr; - } - } else if (progressDialog) { - progressDialog->setValue(nProgress); - } -} - -void DefiGUI::setTrayIconVisible(bool fHideTrayIcon) -{ - if (trayIcon) - { - trayIcon->setVisible(!fHideTrayIcon); - } -} - -void DefiGUI::showModalOverlay() -{ - if (modalOverlay && (progressBar->isVisible() || modalOverlay->isLayerVisible())) - modalOverlay->toggleVisibility(); -} - -static bool ThreadSafeMessageBox(DefiGUI* gui, const std::string& message, const std::string& caption, unsigned int style) -{ - bool modal = (style & CClientUIInterface::MODAL); - // The SECURE flag has no effect in the Qt GUI. - // bool secure = (style & CClientUIInterface::SECURE); - style &= ~CClientUIInterface::SECURE; - bool ret = false; - // In case of modal message, use blocking connection to wait for user to click a button - bool invoked = QMetaObject::invokeMethod(gui, "message", - modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection, - Q_ARG(QString, QString::fromStdString(caption)), - Q_ARG(QString, QString::fromStdString(message)), - Q_ARG(unsigned int, style), - Q_ARG(bool*, &ret)); - assert(invoked); - return ret; -} - -void DefiGUI::subscribeToCoreSignals() -{ - // Connect signals to client - m_handler_message_box = m_node.handleMessageBox(std::bind(ThreadSafeMessageBox, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - m_handler_question = m_node.handleQuestion(std::bind(ThreadSafeMessageBox, this, std::placeholders::_1, std::placeholders::_3, std::placeholders::_4)); -} - -void DefiGUI::unsubscribeFromCoreSignals() -{ - // Disconnect signals from client - m_handler_message_box->disconnect(); - m_handler_question->disconnect(); -} - -UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) : - optionsModel(nullptr), - menu(nullptr) -{ - createContextMenu(); - setToolTip(tr("Unit to show amounts in. Click to select another unit.")); - QList units = DefiUnits::availableUnits(); - int max_width = 0; - const QFontMetrics fm(font()); - for (const DefiUnits::Unit unit : units) - { - max_width = qMax(max_width, GUIUtil::TextWidth(fm, DefiUnits::longName(unit))); - } - setMinimumSize(max_width, 0); - setAlignment(Qt::AlignRight | Qt::AlignVCenter); - setStyleSheet(QString("QLabel { color : %1 }").arg(platformStyle->SingleColor().name())); -} - -/** So that it responds to button clicks */ -void UnitDisplayStatusBarControl::mousePressEvent(QMouseEvent *event) -{ - onDisplayUnitsClicked(event->pos()); -} - -/** Creates context menu, its actions, and wires up all the relevant signals for mouse events. */ -void UnitDisplayStatusBarControl::createContextMenu() -{ - menu = new QMenu(this); - for (const DefiUnits::Unit u : DefiUnits::availableUnits()) - { - QAction *menuAction = new QAction(QString(DefiUnits::longName(u)), this); - menuAction->setData(QVariant(u)); - menu->addAction(menuAction); - } - connect(menu, &QMenu::triggered, this, &UnitDisplayStatusBarControl::onMenuSelection); -} - -/** Lets the control know about the Options Model (and its signals) */ -void UnitDisplayStatusBarControl::setOptionsModel(OptionsModel *_optionsModel) -{ - if (_optionsModel) - { - this->optionsModel = _optionsModel; - - // be aware of a display unit change reported by the OptionsModel object. - connect(_optionsModel, &OptionsModel::displayUnitChanged, this, &UnitDisplayStatusBarControl::updateDisplayUnit); - - // initialize the display units label with the current value in the model. - updateDisplayUnit(_optionsModel->getDisplayUnit()); - } -} - -/** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */ -void UnitDisplayStatusBarControl::updateDisplayUnit(int newUnits) -{ - setText(DefiUnits::longName(newUnits)); -} - -/** Shows context menu with Display Unit options by the mouse coordinates */ -void UnitDisplayStatusBarControl::onDisplayUnitsClicked(const QPoint& point) -{ - QPoint globalPos = mapToGlobal(point); - menu->exec(globalPos); -} - -/** Tells underlying optionsModel to update its current display unit. */ -void UnitDisplayStatusBarControl::onMenuSelection(QAction* action) -{ - if (action) - { - optionsModel->setDisplayUnit(action->data()); - } -} diff --git a/src/qt/defigui.h b/src/qt/defigui.h deleted file mode 100644 index 09c72d2d769..00000000000 --- a/src/qt/defigui.h +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 2011-2019 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_DEFIGUI_H -#define DEFI_QT_DEFIGUI_H - -#if defined(HAVE_CONFIG_H) -#include -#endif - -#include - -#include - -#include -#include -#include -#include -#include - -#ifdef Q_OS_MAC -#include -#endif - -#include - -class ClientModel; -class NetworkStyle; -class Notificator; -class OptionsModel; -class PlatformStyle; -class RPCConsole; -class SendCoinsRecipient; -class UnitDisplayStatusBarControl; -class WalletController; -class WalletFrame; -class WalletModel; -class HelpMessageDialog; -class ModalOverlay; - -namespace interfaces { -class Handler; -class Node; -} - -QT_BEGIN_NAMESPACE -class QAction; -class QComboBox; -class QMenu; -class QProgressBar; -class QProgressDialog; -QT_END_NAMESPACE - -namespace GUIUtil { -class ClickableLabel; -class ClickableProgressBar; -} - -/** - Defi GUI main class. This class represents the main window of the Defi UI. It communicates with both the client and - wallet models to give the user an up-to-date view of the current core state. -*/ -class DefiGUI : public QMainWindow -{ - Q_OBJECT - -public: - static const std::string DEFAULT_UIPLATFORM; - - explicit DefiGUI(interfaces::Node& node, const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = nullptr); - ~DefiGUI(); - - /** Set the client model. - The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic. - */ - void setClientModel(ClientModel *clientModel); -#ifdef ENABLE_WALLET - void setWalletController(WalletController* wallet_controller); -#endif - -#ifdef ENABLE_WALLET - /** Set the wallet model. - The wallet model represents a defi wallet, and offers access to the list of transactions, address book and sending - functionality. - */ - void addWallet(WalletModel* walletModel); - void removeWallet(WalletModel* walletModel); - void removeAllWallets(); -#endif // ENABLE_WALLET - bool enableWallet = false; - - /** Get the tray icon status. - Some systems have not "system tray" or "notification area" available. - */ - bool hasTrayIcon() const { return trayIcon; } - - /** Disconnect core signals from GUI client */ - void unsubscribeFromCoreSignals(); - -protected: - void changeEvent(QEvent *e); - void closeEvent(QCloseEvent *event); - void showEvent(QShowEvent *event); - void dragEnterEvent(QDragEnterEvent *event); - void dropEvent(QDropEvent *event); - bool eventFilter(QObject *object, QEvent *event); - -private: - interfaces::Node& m_node; - WalletController* m_wallet_controller{nullptr}; - std::unique_ptr m_handler_message_box; - std::unique_ptr m_handler_question; - ClientModel* clientModel = nullptr; - WalletFrame* walletFrame = nullptr; - - UnitDisplayStatusBarControl* unitDisplayControl = nullptr; - QLabel* labelWalletEncryptionIcon = nullptr; - QLabel* labelWalletHDStatusIcon = nullptr; - GUIUtil::ClickableLabel* labelProxyIcon = nullptr; - GUIUtil::ClickableLabel* connectionsControl = nullptr; - GUIUtil::ClickableLabel* labelBlocksIcon = nullptr; - QLabel* progressBarLabel = nullptr; - GUIUtil::ClickableProgressBar* progressBar = nullptr; - QProgressDialog* progressDialog = nullptr; - - QMenuBar* appMenuBar = nullptr; - QToolBar* appToolBar = nullptr; - QAction* overviewAction = nullptr; - QAction* historyAction = nullptr; - QAction* quitAction = nullptr; - QAction* sendCoinsAction = nullptr; - QAction* sendCoinsMenuAction = nullptr; - QAction* usedSendingAddressesAction = nullptr; - QAction* usedReceivingAddressesAction = nullptr; - QAction* signMessageAction = nullptr; - QAction* verifyMessageAction = nullptr; - QAction* aboutAction = nullptr; - QAction* receiveCoinsAction = nullptr; - QAction* receiveCoinsMenuAction = nullptr; - QAction* optionsAction = nullptr; - QAction* toggleHideAction = nullptr; - QAction* encryptWalletAction = nullptr; - QAction* backupWalletAction = nullptr; - QAction* changePassphraseAction = nullptr; - QAction* aboutQtAction = nullptr; - QAction* openRPCConsoleAction = nullptr; - QAction* openAction = nullptr; - QAction* showHelpMessageAction = nullptr; - QAction* m_open_wallet_action{nullptr}; - QMenu* m_open_wallet_menu{nullptr}; - QAction* m_close_wallet_action{nullptr}; - QAction* m_wallet_selector_label_action = nullptr; - QAction* m_wallet_selector_action = nullptr; - - QLabel *m_wallet_selector_label = nullptr; - QComboBox* m_wallet_selector = nullptr; - - QSystemTrayIcon* trayIcon = nullptr; - const std::unique_ptr trayIconMenu; - Notificator* notificator = nullptr; - RPCConsole* rpcConsole = nullptr; - HelpMessageDialog* helpMessageDialog = nullptr; - ModalOverlay* modalOverlay = nullptr; - -#ifdef Q_OS_MAC - CAppNapInhibitor* m_app_nap_inhibitor = nullptr; -#endif - - /** Keep track of previous number of blocks, to detect progress */ - int prevBlocks = 0; - int spinnerFrame = 0; - - const PlatformStyle *platformStyle; - const NetworkStyle* const m_network_style; - - /** Create the main UI actions. */ - void createActions(); - /** Create the menu bar and sub-menus. */ - void createMenuBar(); - /** Create the toolbars */ - void createToolBars(); - /** Create system tray icon and notification */ - void createTrayIcon(); - /** Create system tray menu (or setup the dock menu) */ - void createTrayIconMenu(); - - /** Enable or disable all wallet-related actions */ - void setWalletActionsEnabled(bool enabled); - - /** Connect core signals to GUI client */ - void subscribeToCoreSignals(); - - /** Update UI with latest network info from model. */ - void updateNetworkState(); - - void updateHeadersSyncProgressLabel(); - - /** Open the OptionsDialog on the specified tab index */ - void openOptionsDialogWithTab(OptionsDialog::Tab tab); - -Q_SIGNALS: - /** Signal raised when a URI was entered or dragged to the GUI */ - void receivedURI(const QString &uri); - /** Signal raised when RPC console shown */ - void consoleShown(RPCConsole* console); - -public Q_SLOTS: - /** Set number of connections shown in the UI */ - void setNumConnections(int count); - /** Set network state shown in the UI */ - void setNetworkActive(bool networkActive); - /** Set number of blocks and last block date shown in the UI */ - void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers); - - /** Notify the user of an event from the core network or transaction handling code. - @param[in] title the message box / notification title - @param[in] message the displayed text - @param[in] style modality and style definitions (icon and used buttons - buttons only for message boxes) - @see CClientUIInterface::MessageBoxFlags - @param[in] ret pointer to a bool that will be modified to whether Ok was clicked (modal only) - */ - void message(const QString& title, QString message, unsigned int style, bool* ret = nullptr); - -#ifdef ENABLE_WALLET - void setCurrentWallet(WalletModel* wallet_model); - void setCurrentWalletBySelectorIndex(int index); - /** Set the UI status indicators based on the currently selected wallet. - */ - void updateWalletStatus(); - -private: - /** Set the encryption status as shown in the UI. - @param[in] status current encryption status - @see WalletModel::EncryptionStatus - */ - void setEncryptionStatus(int status); - - /** Set the hd-enabled status as shown in the UI. - @param[in] hdEnabled current hd enabled status - @see WalletModel::EncryptionStatus - */ - void setHDStatus(bool privkeyDisabled, int hdEnabled); - -public Q_SLOTS: - bool handlePaymentRequest(const SendCoinsRecipient& recipient); - - /** Show incoming transaction notification for new transactions. */ - void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label, const QString& walletName); -#endif // ENABLE_WALLET - -private: - /** Set the proxy-enabled icon as shown in the UI. */ - void updateProxyIcon(); - void updateWindowTitle(); - -public Q_SLOTS: -#ifdef ENABLE_WALLET - /** Switch to overview (home) page */ - void gotoOverviewPage(); - /** Switch to history (transactions) page */ - void gotoHistoryPage(); - /** Switch to receive coins page */ - void gotoReceiveCoinsPage(); - /** Switch to send coins page */ - void gotoSendCoinsPage(QString addr = ""); - - /** Show Sign/Verify Message dialog and switch to sign message tab */ - void gotoSignMessageTab(QString addr = ""); - /** Show Sign/Verify Message dialog and switch to verify message tab */ - void gotoVerifyMessageTab(QString addr = ""); - - /** Show open dialog */ - void openClicked(); -#endif // ENABLE_WALLET - /** Show configuration dialog */ - void optionsClicked(); - /** Show about dialog */ - void aboutClicked(); - /** Show debug window */ - void showDebugWindow(); - /** Show debug window and set focus to the console */ - void showDebugWindowActivateConsole(); - /** Show help message dialog */ - void showHelpMessageClicked(); -#ifndef Q_OS_MAC - /** Handle tray icon clicked */ - void trayIconActivated(QSystemTrayIcon::ActivationReason reason); -#else - /** Handle macOS Dock icon clicked */ - void macosDockIconActivated(); -#endif - - /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */ - void showNormalIfMinimized() { showNormalIfMinimized(false); } - void showNormalIfMinimized(bool fToggleHidden); - /** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */ - void toggleHidden(); - - /** called by a timer to check if ShutdownRequested() has been set **/ - void detectShutdown(); - - /** Show progress dialog e.g. for verifychain */ - void showProgress(const QString &title, int nProgress); - - /** When hideTrayIcon setting is changed in OptionsModel hide or show the icon accordingly. */ - void setTrayIconVisible(bool); - - void showModalOverlay(); -}; - -class UnitDisplayStatusBarControl : public QLabel -{ - Q_OBJECT - -public: - explicit UnitDisplayStatusBarControl(const PlatformStyle *platformStyle); - /** Lets the control know about the Options Model (and its signals) */ - void setOptionsModel(OptionsModel *optionsModel); - -protected: - /** So that it responds to left-button clicks */ - void mousePressEvent(QMouseEvent *event); - -private: - OptionsModel *optionsModel; - QMenu* menu; - - /** Shows context menu with Display Unit options by the mouse coordinates */ - void onDisplayUnitsClicked(const QPoint& point); - /** Creates context menu, its actions, and wires up all the relevant signals for mouse events. */ - void createContextMenu(); - -private Q_SLOTS: - /** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */ - void updateDisplayUnit(int newUnits); - /** Tells underlying optionsModel to update its current display unit. */ - void onMenuSelection(QAction* action); -}; - -#endif // DEFI_QT_DEFIGUI_H diff --git a/src/qt/defistrings.cpp b/src/qt/defistrings.cpp deleted file mode 100644 index cb133949acd..00000000000 --- a/src/qt/defistrings.cpp +++ /dev/null @@ -1,192 +0,0 @@ - - -#include - -// Automatically generated by extract_strings_qt.py -#ifdef __GNUC__ -#define UNUSED __attribute__((unused)) -#else -#define UNUSED -#endif -static const char UNUSED *defi_strings[] = { -QT_TRANSLATE_NOOP("defi-core", "The %s developers"), -QT_TRANSLATE_NOOP("defi-core", "" -"-maxtxfee is set very high! Fees this large could be paid on a single " -"transaction."), -QT_TRANSLATE_NOOP("defi-core", "" -"Can't generate a change-address key. No keys in the internal keypool and " -"can't generate any keys."), -QT_TRANSLATE_NOOP("defi-core", "" -"Cannot obtain a lock on data directory %s. %s is probably already running."), -QT_TRANSLATE_NOOP("defi-core", "" -"Cannot provide specific connections and have addrman find outgoing " -"connections at the same."), -QT_TRANSLATE_NOOP("defi-core", "" -"Cannot upgrade a non HD split wallet without upgrading to support pre split " -"keypool. Please use -upgradewallet=169900 or -upgradewallet with no version " -"specified."), -QT_TRANSLATE_NOOP("defi-core", "" -"Distributed under the MIT software license, see the accompanying file %s or " -"%s"), -QT_TRANSLATE_NOOP("defi-core", "" -"Error reading %s! All keys read correctly, but transaction data or address " -"book entries might be missing or incorrect."), -QT_TRANSLATE_NOOP("defi-core", "" -"Error: Listening for incoming connections failed (listen returned error %s)"), -QT_TRANSLATE_NOOP("defi-core", "" -"Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -" -"fallbackfee."), -QT_TRANSLATE_NOOP("defi-core", "" -"Invalid amount for -maxtxfee=: '%s' (must be at least the minrelay " -"fee of %s to prevent stuck transactions)"), -QT_TRANSLATE_NOOP("defi-core", "" -"Please check that your computer's date and time are correct! If your clock " -"is wrong, %s will not work properly."), -QT_TRANSLATE_NOOP("defi-core", "" -"Please contribute if you find %s useful. Visit %s for further information " -"about the software."), -QT_TRANSLATE_NOOP("defi-core", "" -"Prune configured below the minimum of %d MiB. Please use a higher number."), -QT_TRANSLATE_NOOP("defi-core", "" -"Prune: last wallet synchronisation goes beyond pruned data. You need to -" -"reindex (download the whole blockchain again in case of pruned node)"), -QT_TRANSLATE_NOOP("defi-core", "" -"Rescans are not possible in pruned mode. You will need to use -reindex which " -"will download the whole blockchain again."), -QT_TRANSLATE_NOOP("defi-core", "" -"The block database contains a block which appears to be from the future. " -"This may be due to your computer's date and time being set incorrectly. Only " -"rebuild the block database if you are sure that your computer's date and " -"time are correct"), -QT_TRANSLATE_NOOP("defi-core", "" -"The transaction amount is too small to send after the fee has been deducted"), -QT_TRANSLATE_NOOP("defi-core", "" -"This is a pre-release test build - use at your own risk - do not use for " -"mining or merchant applications"), -QT_TRANSLATE_NOOP("defi-core", "" -"This is the transaction fee you may discard if change is smaller than dust " -"at this level"), -QT_TRANSLATE_NOOP("defi-core", "" -"This is the transaction fee you may pay when fee estimates are not available."), -QT_TRANSLATE_NOOP("defi-core", "" -"This product includes software developed by the OpenSSL Project for use in " -"the OpenSSL Toolkit %s and cryptographic software written by Eric Young and " -"UPnP software written by Thomas Bernard."), -QT_TRANSLATE_NOOP("defi-core", "" -"Total length of network version string (%i) exceeds maximum length (%i). " -"Reduce the number or size of uacomments."), -QT_TRANSLATE_NOOP("defi-core", "" -"Unable to replay blocks. You will need to rebuild the database using -" -"reindex-chainstate."), -QT_TRANSLATE_NOOP("defi-core", "" -"Unable to rewind the database to a pre-fork state. You will need to " -"redownload the blockchain"), -QT_TRANSLATE_NOOP("defi-core", "" -"Warning: Private keys detected in wallet {%s} with disabled private keys"), -QT_TRANSLATE_NOOP("defi-core", "" -"Warning: The network does not appear to fully agree! Some miners appear to " -"be experiencing issues."), -QT_TRANSLATE_NOOP("defi-core", "" -"Warning: Wallet file corrupt, data salvaged! Original %s saved as %s in %s; " -"if your balance or transactions are incorrect you should restore from a " -"backup."), -QT_TRANSLATE_NOOP("defi-core", "" -"Warning: We do not appear to fully agree with our peers! You may need to " -"upgrade, or other nodes may need to upgrade."), -QT_TRANSLATE_NOOP("defi-core", "" -"You need to rebuild the database using -reindex to go back to unpruned " -"mode. This will redownload the entire blockchain"), -QT_TRANSLATE_NOOP("defi-core", "%d of last 100 blocks have unexpected version"), -QT_TRANSLATE_NOOP("defi-core", "%s corrupt, salvage failed"), -QT_TRANSLATE_NOOP("defi-core", "%s is set very high!"), -QT_TRANSLATE_NOOP("defi-core", "-maxmempool must be at least %d MB"), -QT_TRANSLATE_NOOP("defi-core", "Cannot downgrade wallet"), -QT_TRANSLATE_NOOP("defi-core", "Cannot resolve -%s address: '%s'"), -QT_TRANSLATE_NOOP("defi-core", "Cannot write to data directory '%s'; check permissions."), -QT_TRANSLATE_NOOP("defi-core", "Change index out of range"), -QT_TRANSLATE_NOOP("defi-core", "Config setting for %s only applied on %s network when in [%s] section."), -QT_TRANSLATE_NOOP("defi-core", "Copyright (C) %i-%i"), -QT_TRANSLATE_NOOP("defi-core", "Corrupted block database detected"), -QT_TRANSLATE_NOOP("defi-core", "Do you want to rebuild the block database now?"), -QT_TRANSLATE_NOOP("defi-core", "Done loading"), -QT_TRANSLATE_NOOP("defi-core", "Error initializing block database"), -QT_TRANSLATE_NOOP("defi-core", "Error initializing wallet database environment %s!"), -QT_TRANSLATE_NOOP("defi-core", "Error loading %s"), -QT_TRANSLATE_NOOP("defi-core", "Error loading %s: Private keys can only be disabled during creation"), -QT_TRANSLATE_NOOP("defi-core", "Error loading %s: Wallet corrupted"), -QT_TRANSLATE_NOOP("defi-core", "Error loading %s: Wallet requires newer version of %s"), -QT_TRANSLATE_NOOP("defi-core", "Error loading block database"), -QT_TRANSLATE_NOOP("defi-core", "Error loading wallet %s. Duplicate -wallet filename specified."), -QT_TRANSLATE_NOOP("defi-core", "Error opening block database"), -QT_TRANSLATE_NOOP("defi-core", "Error reading from database, shutting down."), -QT_TRANSLATE_NOOP("defi-core", "Error upgrading chainstate database"), -QT_TRANSLATE_NOOP("defi-core", "Error: A fatal internal error occurred, see debug.log for details"), -QT_TRANSLATE_NOOP("defi-core", "Error: Disk space is low for %s"), -QT_TRANSLATE_NOOP("defi-core", "Error: Disk space is too low!"), -QT_TRANSLATE_NOOP("defi-core", "Failed to listen on any port. Use -listen=0 if you want this."), -QT_TRANSLATE_NOOP("defi-core", "Failed to rescan the wallet during initialization"), -QT_TRANSLATE_NOOP("defi-core", "Importing..."), -QT_TRANSLATE_NOOP("defi-core", "Incorrect or no genesis block found. Wrong datadir for network?"), -QT_TRANSLATE_NOOP("defi-core", "Initialization sanity check failed. %s is shutting down."), -QT_TRANSLATE_NOOP("defi-core", "Insufficient funds"), -QT_TRANSLATE_NOOP("defi-core", "Invalid -onion address or hostname: '%s'"), -QT_TRANSLATE_NOOP("defi-core", "Invalid -proxy address or hostname: '%s'"), -QT_TRANSLATE_NOOP("defi-core", "Invalid amount for -%s=: '%s'"), -QT_TRANSLATE_NOOP("defi-core", "Invalid amount for -discardfee=: '%s'"), -QT_TRANSLATE_NOOP("defi-core", "Invalid amount for -fallbackfee=: '%s'"), -QT_TRANSLATE_NOOP("defi-core", "Invalid amount for -paytxfee=: '%s' (must be at least %s)"), -QT_TRANSLATE_NOOP("defi-core", "Invalid netmask specified in -whitelist: '%s'"), -QT_TRANSLATE_NOOP("defi-core", "Keypool ran out, please call keypoolrefill first"), -QT_TRANSLATE_NOOP("defi-core", "Loading P2P addresses..."), -QT_TRANSLATE_NOOP("defi-core", "Loading banlist..."), -QT_TRANSLATE_NOOP("defi-core", "Loading block index..."), -QT_TRANSLATE_NOOP("defi-core", "Loading wallet..."), -QT_TRANSLATE_NOOP("defi-core", "Need to specify a port with -whitebind: '%s'"), -QT_TRANSLATE_NOOP("defi-core", "Not enough file descriptors available."), -QT_TRANSLATE_NOOP("defi-core", "Prune cannot be configured with a negative value."), -QT_TRANSLATE_NOOP("defi-core", "Prune mode is incompatible with -blockfilterindex."), -QT_TRANSLATE_NOOP("defi-core", "Prune mode is incompatible with -txindex."), -QT_TRANSLATE_NOOP("defi-core", "Pruning blockstore..."), -QT_TRANSLATE_NOOP("defi-core", "Reducing -maxconnections from %d to %d, because of system limitations."), -QT_TRANSLATE_NOOP("defi-core", "Replaying blocks..."), -QT_TRANSLATE_NOOP("defi-core", "Rescanning..."), -QT_TRANSLATE_NOOP("defi-core", "Rewinding blocks..."), -QT_TRANSLATE_NOOP("defi-core", "Section [%s] is not recognized."), -QT_TRANSLATE_NOOP("defi-core", "Signing transaction failed"), -QT_TRANSLATE_NOOP("defi-core", "Specified -walletdir \"%s\" does not exist"), -QT_TRANSLATE_NOOP("defi-core", "Specified -walletdir \"%s\" is a relative path"), -QT_TRANSLATE_NOOP("defi-core", "Specified -walletdir \"%s\" is not a directory"), -QT_TRANSLATE_NOOP("defi-core", "Specified blocks directory \"%s\" does not exist."), -QT_TRANSLATE_NOOP("defi-core", "Starting network threads..."), -QT_TRANSLATE_NOOP("defi-core", "The source code is available from %s."), -QT_TRANSLATE_NOOP("defi-core", "The specified config file %s does not exist\n"), -QT_TRANSLATE_NOOP("defi-core", "The transaction amount is too small to pay the fee"), -QT_TRANSLATE_NOOP("defi-core", "The wallet will avoid paying less than the minimum relay fee."), -QT_TRANSLATE_NOOP("defi-core", "This is experimental software."), -QT_TRANSLATE_NOOP("defi-core", "This is the minimum transaction fee you pay on every transaction."), -QT_TRANSLATE_NOOP("defi-core", "This is the transaction fee you will pay if you send a transaction."), -QT_TRANSLATE_NOOP("defi-core", "Transaction amount too small"), -QT_TRANSLATE_NOOP("defi-core", "Transaction amounts must not be negative"), -QT_TRANSLATE_NOOP("defi-core", "Transaction fee and change calculation failed"), -QT_TRANSLATE_NOOP("defi-core", "Transaction has too long of a mempool chain"), -QT_TRANSLATE_NOOP("defi-core", "Transaction must have at least one recipient"), -QT_TRANSLATE_NOOP("defi-core", "Transaction too large for fee policy"), -QT_TRANSLATE_NOOP("defi-core", "Transaction too large"), -QT_TRANSLATE_NOOP("defi-core", "Unable to bind to %s on this computer (bind returned error %s)"), -QT_TRANSLATE_NOOP("defi-core", "Unable to bind to %s on this computer. %s is probably already running."), -QT_TRANSLATE_NOOP("defi-core", "Unable to create the PID file '%s': %s"), -QT_TRANSLATE_NOOP("defi-core", "Unable to generate initial keys"), -QT_TRANSLATE_NOOP("defi-core", "Unable to generate keys"), -QT_TRANSLATE_NOOP("defi-core", "Unable to start HTTP server. See debug log for details."), -QT_TRANSLATE_NOOP("defi-core", "Unknown -blockfilterindex value %s."), -QT_TRANSLATE_NOOP("defi-core", "Unknown network specified in -onlynet: '%s'"), -QT_TRANSLATE_NOOP("defi-core", "Unsupported logging category %s=%s."), -QT_TRANSLATE_NOOP("defi-core", "Upgrading UTXO database"), -QT_TRANSLATE_NOOP("defi-core", "Upgrading txindex database"), -QT_TRANSLATE_NOOP("defi-core", "User Agent comment (%s) contains unsafe characters."), -QT_TRANSLATE_NOOP("defi-core", "Verifying blocks..."), -QT_TRANSLATE_NOOP("defi-core", "Verifying wallet(s)..."), -QT_TRANSLATE_NOOP("defi-core", "Wallet needed to be rewritten: restart %s to complete"), -QT_TRANSLATE_NOOP("defi-core", "Warning: unknown new rules activated (versionbit %i)"), -QT_TRANSLATE_NOOP("defi-core", "Zapping all transactions from wallet..."), -}; diff --git a/src/qt/defiunits.cpp b/src/qt/defiunits.cpp deleted file mode 100644 index ce1a4650033..00000000000 --- a/src/qt/defiunits.cpp +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include - -DefiUnits::DefiUnits(QObject *parent): - QAbstractListModel(parent), - unitlist(availableUnits()) -{ -} - -QList DefiUnits::availableUnits() -{ - QList unitlist; - unitlist.append(BTC); - unitlist.append(mBTC); - unitlist.append(uBTC); - unitlist.append(SAT); - return unitlist; -} - -bool DefiUnits::valid(int unit) -{ - switch(unit) - { - case BTC: - case mBTC: - case uBTC: - case SAT: - return true; - default: - return false; - } -} - -QString DefiUnits::longName(int unit) -{ - switch(unit) - { - case BTC: return QString("DFI"); - case mBTC: return QString("mDFI"); - case uBTC: return QString::fromUtf8("µDFI (bits)"); - case SAT: return QString("Satoshi (sat)"); - default: return QString("???"); - } -} - -QString DefiUnits::shortName(int unit) -{ - switch(unit) - { - case uBTC: return QString::fromUtf8("bits"); - case SAT: return QString("sat"); - default: return longName(unit); - } -} - -QString DefiUnits::description(int unit) -{ - switch(unit) - { - case BTC: return QString("Defis"); - case mBTC: return QString("Milli-Defis (1 / 1" THIN_SP_UTF8 "000)"); - case uBTC: return QString("Micro-Defis (bits) (1 / 1" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)"); - case SAT: return QString("Satoshi (sat) (1 / 100" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)"); - default: return QString("???"); - } -} - -qint64 DefiUnits::factor(int unit) -{ - switch(unit) - { - case BTC: return 100000000; - case mBTC: return 100000; - case uBTC: return 100; - case SAT: return 1; - default: return 100000000; - } -} - -int DefiUnits::decimals(int unit) -{ - switch(unit) - { - case BTC: return 8; - case mBTC: return 5; - case uBTC: return 2; - case SAT: return 0; - default: return 0; - } -} - -QString DefiUnits::format(int unit, const CAmount& nIn, bool fPlus, SeparatorStyle separators) -{ - // Note: not using straight sprintf here because we do NOT want - // localized number formatting. - if(!valid(unit)) - return QString(); // Refuse to format invalid unit - qint64 n = (qint64)nIn; - qint64 coin = factor(unit); - int num_decimals = decimals(unit); - qint64 n_abs = (n > 0 ? n : -n); - qint64 quotient = n_abs / coin; - QString quotient_str = QString::number(quotient); - - // Use SI-style thin space separators as these are locale independent and can't be - // confused with the decimal marker. - QChar thin_sp(THIN_SP_CP); - int q_size = quotient_str.size(); - if (separators == separatorAlways || (separators == separatorStandard && q_size > 4)) - for (int i = 3; i < q_size; i += 3) - quotient_str.insert(q_size - i, thin_sp); - - if (n < 0) - quotient_str.insert(0, '-'); - else if (fPlus && n > 0) - quotient_str.insert(0, '+'); - - if (num_decimals > 0) { - qint64 remainder = n_abs % coin; - QString remainder_str = QString::number(remainder).rightJustified(num_decimals, '0'); - return quotient_str + QString(".") + remainder_str; - } else { - return quotient_str; - } -} - - -// NOTE: Using formatWithUnit in an HTML context risks wrapping -// quantities at the thousands separator. More subtly, it also results -// in a standard space rather than a thin space, due to a bug in Qt's -// XML whitespace canonicalisation -// -// Please take care to use formatHtmlWithUnit instead, when -// appropriate. - -QString DefiUnits::formatWithUnit(int unit, const CAmount& amount, bool plussign, SeparatorStyle separators) -{ - return format(unit, amount, plussign, separators) + QString(" ") + shortName(unit); -} - -QString DefiUnits::formatHtmlWithUnit(int unit, const CAmount& amount, bool plussign, SeparatorStyle separators) -{ - QString str(formatWithUnit(unit, amount, plussign, separators)); - str.replace(QChar(THIN_SP_CP), QString(THIN_SP_HTML)); - return QString("%1").arg(str); -} - - -bool DefiUnits::parse(int unit, const QString &value, CAmount *val_out) -{ - if(!valid(unit) || value.isEmpty()) - return false; // Refuse to parse invalid unit or empty string - int num_decimals = decimals(unit); - - // Ignore spaces and thin spaces when parsing - QStringList parts = removeSpaces(value).split("."); - - if(parts.size() > 2) - { - return false; // More than one dot - } - QString whole = parts[0]; - QString decimals; - - if(parts.size() > 1) - { - decimals = parts[1]; - } - if(decimals.size() > num_decimals) - { - return false; // Exceeds max precision - } - bool ok = false; - QString str = whole + decimals.leftJustified(num_decimals, '0'); - - if(str.size() > 18) - { - return false; // Longer numbers will exceed 63 bits - } - CAmount retvalue(str.toLongLong(&ok)); - if(val_out) - { - *val_out = retvalue; - } - return ok; -} - -QString DefiUnits::getAmountColumnTitle(int unit) -{ - QString amountTitle = QObject::tr("Amount"); - if (DefiUnits::valid(unit)) - { - amountTitle += " ("+DefiUnits::shortName(unit) + ")"; - } - return amountTitle; -} - -int DefiUnits::rowCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent); - return unitlist.size(); -} - -QVariant DefiUnits::data(const QModelIndex &index, int role) const -{ - int row = index.row(); - if(row >= 0 && row < unitlist.size()) - { - Unit unit = unitlist.at(row); - switch(role) - { - case Qt::EditRole: - case Qt::DisplayRole: - return QVariant(longName(unit)); - case Qt::ToolTipRole: - return QVariant(description(unit)); - case UnitRole: - return QVariant(static_cast(unit)); - } - } - return QVariant(); -} - -CAmount DefiUnits::maxMoney() -{ - return MAX_MONEY; -} diff --git a/src/qt/defiunits.h b/src/qt/defiunits.h deleted file mode 100644 index d6173456646..00000000000 --- a/src/qt/defiunits.h +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_DEFIUNITS_H -#define DEFI_QT_DEFIUNITS_H - -#include - -#include -#include - -// U+2009 THIN SPACE = UTF-8 E2 80 89 -#define REAL_THIN_SP_CP 0x2009 -#define REAL_THIN_SP_UTF8 "\xE2\x80\x89" -#define REAL_THIN_SP_HTML " " - -// U+200A HAIR SPACE = UTF-8 E2 80 8A -#define HAIR_SP_CP 0x200A -#define HAIR_SP_UTF8 "\xE2\x80\x8A" -#define HAIR_SP_HTML " " - -// U+2006 SIX-PER-EM SPACE = UTF-8 E2 80 86 -#define SIXPEREM_SP_CP 0x2006 -#define SIXPEREM_SP_UTF8 "\xE2\x80\x86" -#define SIXPEREM_SP_HTML " " - -// U+2007 FIGURE SPACE = UTF-8 E2 80 87 -#define FIGURE_SP_CP 0x2007 -#define FIGURE_SP_UTF8 "\xE2\x80\x87" -#define FIGURE_SP_HTML " " - -// QMessageBox seems to have a bug whereby it doesn't display thin/hair spaces -// correctly. Workaround is to display a space in a small font. If you -// change this, please test that it doesn't cause the parent span to start -// wrapping. -#define HTML_HACK_SP " " - -// Define THIN_SP_* variables to be our preferred type of thin space -#define THIN_SP_CP REAL_THIN_SP_CP -#define THIN_SP_UTF8 REAL_THIN_SP_UTF8 -#define THIN_SP_HTML HTML_HACK_SP - -/** Defi unit definitions. Encapsulates parsing and formatting - and serves as list model for drop-down selection boxes. -*/ -class DefiUnits: public QAbstractListModel -{ - Q_OBJECT - -public: - explicit DefiUnits(QObject *parent); - - /** Defi units. - @note Source: https://en.bitcoin.it/wiki/Units . Please add only sensible ones - */ - enum Unit - { - BTC, - mBTC, - uBTC, - SAT - }; - - enum SeparatorStyle - { - separatorNever, - separatorStandard, - separatorAlways - }; - - //! @name Static API - //! Unit conversion and formatting - ///@{ - - //! Get list of units, for drop-down box - static QList availableUnits(); - //! Is unit ID valid? - static bool valid(int unit); - //! Long name - static QString longName(int unit); - //! Short name - static QString shortName(int unit); - //! Longer description - static QString description(int unit); - //! Number of Satoshis (1e-8) per unit - static qint64 factor(int unit); - //! Number of decimals left - static int decimals(int unit); - //! Format as string - static QString format(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard); - //! Format as string (with unit) - static QString formatWithUnit(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard); - //! Format as HTML string (with unit) - static QString formatHtmlWithUnit(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard); - //! Parse string to coin amount - static bool parse(int unit, const QString &value, CAmount *val_out); - //! Gets title for amount column including current display unit if optionsModel reference available */ - static QString getAmountColumnTitle(int unit); - ///@} - - //! @name AbstractListModel implementation - //! List model for unit drop-down selection box. - ///@{ - enum RoleIndex { - /** Unit identifier */ - UnitRole = Qt::UserRole - }; - int rowCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &index, int role) const; - ///@} - - static QString removeSpaces(QString text) - { - text.remove(' '); - text.remove(QChar(THIN_SP_CP)); -#if (THIN_SP_CP != REAL_THIN_SP_CP) - text.remove(QChar(REAL_THIN_SP_CP)); -#endif - return text; - } - - //! Return maximum number of base units (Satoshis) - static CAmount maxMoney(); - -private: - QList unitlist; -}; -typedef DefiUnits::Unit DefiUnit; - -#endif // DEFI_QT_DEFIUNITS_H diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp deleted file mode 100644 index 88041107b9e..00000000000 --- a/src/qt/editaddressdialog.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include -#include - -#include -#include - -#include -#include - - -EditAddressDialog::EditAddressDialog(Mode _mode, QWidget *parent) : - QDialog(parent), - ui(new Ui::EditAddressDialog), - mapper(nullptr), - mode(_mode), - model(nullptr) -{ - ui->setupUi(this); - - GUIUtil::setupAddressWidget(ui->addressEdit, this); - - switch(mode) - { - case NewSendingAddress: - setWindowTitle(tr("New sending address")); - break; - case EditReceivingAddress: - setWindowTitle(tr("Edit receiving address")); - ui->addressEdit->setEnabled(false); - break; - case EditSendingAddress: - setWindowTitle(tr("Edit sending address")); - break; - } - - mapper = new QDataWidgetMapper(this); - mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); - - GUIUtil::ItemDelegate* delegate = new GUIUtil::ItemDelegate(mapper); - connect(delegate, &GUIUtil::ItemDelegate::keyEscapePressed, this, &EditAddressDialog::reject); - mapper->setItemDelegate(delegate); -} - -EditAddressDialog::~EditAddressDialog() -{ - delete ui; -} - -void EditAddressDialog::setModel(AddressTableModel *_model) -{ - this->model = _model; - if(!_model) - return; - - mapper->setModel(_model); - mapper->addMapping(ui->labelEdit, AddressTableModel::Label); - mapper->addMapping(ui->addressEdit, AddressTableModel::Address); -} - -void EditAddressDialog::loadRow(int row) -{ - mapper->setCurrentIndex(row); -} - -bool EditAddressDialog::saveCurrentRow() -{ - if(!model) - return false; - - switch(mode) - { - case NewSendingAddress: - address = model->addRow( - AddressTableModel::Send, - ui->labelEdit->text(), - ui->addressEdit->text(), - model->GetDefaultAddressType()); - break; - case EditReceivingAddress: - case EditSendingAddress: - if(mapper->submit()) - { - address = ui->addressEdit->text(); - } - break; - } - return !address.isEmpty(); -} - -void EditAddressDialog::accept() -{ - if(!model) - return; - - if(!saveCurrentRow()) - { - switch(model->getEditStatus()) - { - case AddressTableModel::OK: - // Failed with unknown reason. Just reject. - break; - case AddressTableModel::NO_CHANGES: - // No changes were made during edit operation. Just reject. - break; - case AddressTableModel::INVALID_ADDRESS: - QMessageBox::warning(this, windowTitle(), - tr("The entered address \"%1\" is not a valid Defi address.").arg(ui->addressEdit->text()), - QMessageBox::Ok, QMessageBox::Ok); - break; - case AddressTableModel::DUPLICATE_ADDRESS: - QMessageBox::warning(this, windowTitle(), - getDuplicateAddressWarning(), - QMessageBox::Ok, QMessageBox::Ok); - break; - case AddressTableModel::WALLET_UNLOCK_FAILURE: - QMessageBox::critical(this, windowTitle(), - tr("Could not unlock wallet."), - QMessageBox::Ok, QMessageBox::Ok); - break; - case AddressTableModel::KEY_GENERATION_FAILURE: - QMessageBox::critical(this, windowTitle(), - tr("New key generation failed."), - QMessageBox::Ok, QMessageBox::Ok); - break; - - } - return; - } - QDialog::accept(); -} - -QString EditAddressDialog::getDuplicateAddressWarning() const -{ - QString dup_address = ui->addressEdit->text(); - QString existing_label = model->labelForAddress(dup_address); - QString existing_purpose = model->purposeForAddress(dup_address); - - if (existing_purpose == "receive" && - (mode == NewSendingAddress || mode == EditSendingAddress)) { - return tr( - "Address \"%1\" already exists as a receiving address with label " - "\"%2\" and so cannot be added as a sending address." - ).arg(dup_address).arg(existing_label); - } - return tr( - "The entered address \"%1\" is already in the address book with " - "label \"%2\"." - ).arg(dup_address).arg(existing_label); -} - -QString EditAddressDialog::getAddress() const -{ - return address; -} - -void EditAddressDialog::setAddress(const QString &_address) -{ - this->address = _address; - ui->addressEdit->setText(_address); -} diff --git a/src/qt/editaddressdialog.h b/src/qt/editaddressdialog.h deleted file mode 100644 index 8fb86e58cef..00000000000 --- a/src/qt/editaddressdialog.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_EDITADDRESSDIALOG_H -#define DEFI_QT_EDITADDRESSDIALOG_H - -#include - -class AddressTableModel; - -namespace Ui { - class EditAddressDialog; -} - -QT_BEGIN_NAMESPACE -class QDataWidgetMapper; -QT_END_NAMESPACE - -/** Dialog for editing an address and associated information. - */ -class EditAddressDialog : public QDialog -{ - Q_OBJECT - -public: - enum Mode { - NewSendingAddress, - EditReceivingAddress, - EditSendingAddress - }; - - explicit EditAddressDialog(Mode mode, QWidget *parent = nullptr); - ~EditAddressDialog(); - - void setModel(AddressTableModel *model); - void loadRow(int row); - - QString getAddress() const; - void setAddress(const QString &address); - -public Q_SLOTS: - void accept(); - -private: - bool saveCurrentRow(); - - /** Return a descriptive string when adding an already-existing address fails. */ - QString getDuplicateAddressWarning() const; - - Ui::EditAddressDialog *ui; - QDataWidgetMapper *mapper; - Mode mode; - AddressTableModel *model; - - QString address; -}; - -#endif // DEFI_QT_EDITADDRESSDIALOG_H diff --git a/src/qt/forms/addressbookpage.ui b/src/qt/forms/addressbookpage.ui deleted file mode 100644 index 32c3371fab5..00000000000 --- a/src/qt/forms/addressbookpage.ui +++ /dev/null @@ -1,166 +0,0 @@ - - - AddressBookPage - - - - 0 - 0 - 760 - 380 - - - - - - - Qt::PlainText - - - true - - - - - - - Enter address or label to search - - - - - - - Qt::CustomContextMenu - - - Right-click to edit address or label - - - false - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - true - - - false - - - - - - - - - Create a new address - - - &New - - - - :/icons/add:/icons/add - - - false - - - - - - - Copy the currently selected address to the system clipboard - - - &Copy - - - - :/icons/editcopy:/icons/editcopy - - - false - - - - - - - Delete the currently selected address from the list - - - &Delete - - - - :/icons/remove:/icons/remove - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Export the data in the current tab to a file - - - &Export - - - - :/icons/export:/icons/export - - - false - - - - - - - - 0 - 0 - - - - C&lose - - - false - - - - - - - - - - - - diff --git a/src/qt/forms/askpassphrasedialog.ui b/src/qt/forms/askpassphrasedialog.ui deleted file mode 100644 index 69803989cd1..00000000000 --- a/src/qt/forms/askpassphrasedialog.ui +++ /dev/null @@ -1,167 +0,0 @@ - - - AskPassphraseDialog - - - - 0 - 0 - 598 - 222 - - - - - 0 - 0 - - - - - 550 - 0 - - - - Passphrase Dialog - - - - QLayout::SetMinimumSize - - - - - Placeholder text - - - Qt::RichText - - - true - - - - - - - QLayout::SetMinimumSize - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Enter passphrase - - - - - - - QLineEdit::Password - - - - - - - New passphrase - - - - - - - QLineEdit::Password - - - - - - - Repeat new passphrase - - - - - - - QLineEdit::Password - - - - - - - Show password - - - - - - - - 75 - true - - - - - - - Qt::AlignCenter - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - AskPassphraseDialog - accept() - - - 20 - 20 - - - 20 - 20 - - - - - buttonBox - rejected() - AskPassphraseDialog - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/src/qt/forms/coincontroldialog.ui b/src/qt/forms/coincontroldialog.ui deleted file mode 100644 index 5ce469ee963..00000000000 --- a/src/qt/forms/coincontroldialog.ui +++ /dev/null @@ -1,489 +0,0 @@ - - - CoinControlDialog - - - - 0 - 0 - 1000 - 500 - - - - Coin Selection - - - - - - 0 - - - 10 - - - - - 10 - - - 10 - - - 6 - - - 6 - - - - - - 75 - true - - - - Quantity: - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0 - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - Bytes: - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0 - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - 10 - - - 10 - - - 6 - - - 6 - - - - - - 75 - true - - - - Amount: - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0.00 BTC - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - false - - - - 75 - true - - - - Dust: - - - - - - - false - - - IBeamCursor - - - Qt::ActionsContextMenu - - - no - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - 10 - - - 10 - - - 6 - - - 6 - - - - - - 75 - true - - - - Fee: - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0.00 BTC - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - 10 - - - 10 - - - 6 - - - 6 - - - - - - 75 - true - - - - After Fee: - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0.00 BTC - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - false - - - - 75 - true - - - - Change: - - - - - - - false - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0.00 BTC - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - - 0 - 40 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - - - 14 - - - - - - 0 - 0 - - - - (un)select all - - - false - - - - - - - - 0 - 0 - - - - Tree mode - - - - - - - - 0 - 0 - - - - List mode - - - true - - - - - - - (1 locked) - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Qt::CustomContextMenu - - - false - - - 6 - - - true - - - false - - - - - - - - - Amount - - - - - Received with label - - - - - Received with address - - - - - Date - - - - - Confirmations - - - Confirmed - - - - - - - - - - - - - - - - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Ok - - - - - - - - CoinControlTreeWidget - QTreeWidget -
qt/coincontroltreewidget.h
-
-
- - -
diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui deleted file mode 100644 index ea85da3ea0d..00000000000 --- a/src/qt/forms/debugwindow.ui +++ /dev/null @@ -1,1547 +0,0 @@ - - - RPCConsole - - - - 0 - 0 - 740 - 430 - - - - Debug window - - - - - - false - - - QLabel { background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop:0 #F0D0A0, stop:1 #F8D488); color:#000000; } - - - true - - - 3 - - - Qt::TextSelectableByMouse - - - - - - - 0 - - - - &Information - - - - 12 - - - - - - 75 - true - - - - General - - - - - - - Client version - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - User Agent - - - 10 - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Using BerkeleyDB version - - - 10 - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Datadir - - - - - - - IBeamCursor - - - To specify a non-default location of the data directory use the '%1' option. - - - N/A - - - Qt::PlainText - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Blocksdir - - - - - - - IBeamCursor - - - To specify a non-default location of the blocks directory use the '%1' option. - - - N/A - - - Qt::PlainText - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Startup time - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - Network - - - - - - - Name - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Number of connections - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - Block chain - - - - - - - Current number of blocks - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Last block time - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - Memory Pool - - - - - - - Current number of transactions - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Memory usage - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - 3 - - - - - Qt::Vertical - - - - 10 - 5 - - - - - - - - Debug log file - - - - - - - Open the %1 debug log file from the current data directory. This can take a few seconds for large log files. - - - &Open - - - false - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - &Console - - - - 3 - - - 5 - - - - - 4 - - - - - Wallet: - - - - - - - QComboBox::AdjustToContents - - - - (none) - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 24 - 24 - - - - - - - Decrease font size - - - - :/icons/fontsmaller:/icons/fontsmaller - - - - 24 - 16 - - - - false - - - true - - - - - - - - 24 - 24 - - - - Increase font size - - - - - - - :/icons/fontbigger:/icons/fontbigger - - - - 24 - 16 - - - - false - - - true - - - - - - - - 24 - 24 - - - - Clear console - - - Qt::LeftToRight - - - - - - - :/icons/remove:/icons/remove - - - Ctrl+L - - - false - - - true - - - - - - - - - - 0 - 100 - - - - true - - - false - - - 2 - - - - - - - 3 - - - - - false - - - - 16 - 24 - - - - - - - - :/icons/prompticon - :/icons/prompticon:/icons/prompticon - - - - 14 - 14 - - - - false - - - true - - - - - - - - - - false - - - - - - - - - - &Network Traffic - - - - - - - - - 0 - 0 - - - - - - - - - - 1 - - - 288 - - - 12 - - - 6 - - - Qt::Horizontal - - - - - - - - 100 - 0 - - - - Qt::AlignCenter - - - - - - - &Reset - - - false - - - - - - - - - - - - - Totals - - - - - - - - - 0 - 0 - - - - - 10 - 0 - - - - - - - - - 0 - 255 - 0 - - - - - - - - - 0 - 255 - 0 - - - - - - - - - 0 - 255 - 0 - - - - - - - - Qt::Horizontal - - - - - - - Received - - - - - - - - 50 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - 0 - 0 - - - - - 10 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - Qt::Horizontal - - - - - - - Sent - - - - - - - - 50 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - Qt::Vertical - - - - 20 - 407 - - - - - - - - - - - - - - &Peers - - - - - - Qt::Horizontal - - - false - - - - - 1 - 0 - - - - - 400 - 0 - - - - - - - false - - - true - - - false - - - - - - - - 0 - 0 - - - - - 0 - 32 - - - - - 16777215 - 32 - - - - - 12 - - - - IBeamCursor - - - Banned peers - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - true - - - Qt::NoTextInteraction - - - - - - - false - - - true - - - false - - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - 0 - 0 - - - - - 0 - 32 - - - - - 10 - - - - IBeamCursor - - - Select a peer to view detailed information. - - - Qt::AlignHCenter|Qt::AlignTop - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - true - - - - - 0 - 0 - 300 - 426 - - - - - 300 - 0 - - - - - - - Whitelisted - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Direction - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Version - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - User Agent - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Services - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Starting Block - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Synced Headers - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Synced Blocks - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Ban Score - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Connection Time - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Last Send - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Last Receive - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Sent - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Received - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Ping Time - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - The duration of a currently outstanding ping. - - - Ping Wait - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Min Ping - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Time Offset - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - - - - - - TrafficGraphWidget - QWidget -
qt/trafficgraphwidget.h
- 1 - - clear() - -
-
- - - - -
diff --git a/src/qt/forms/editaddressdialog.ui b/src/qt/forms/editaddressdialog.ui deleted file mode 100644 index e968271107f..00000000000 --- a/src/qt/forms/editaddressdialog.ui +++ /dev/null @@ -1,112 +0,0 @@ - - - EditAddressDialog - - - - 0 - 0 - 457 - 126 - - - - Edit Address - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - &Label - - - labelEdit - - - - - - - The label associated with this address list entry - - - - - - - &Address - - - addressEdit - - - - - - - The address associated with this address list entry. This can only be modified for sending addresses. - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - QValidatedLineEdit - QLineEdit -
qt/qvalidatedlineedit.h
-
-
- - - - buttonBox - accepted() - EditAddressDialog - accept() - - - 20 - 20 - - - 20 - 20 - - - - - buttonBox - rejected() - EditAddressDialog - reject() - - - 20 - 20 - - - 20 - 20 - - - - -
diff --git a/src/qt/forms/helpmessagedialog.ui b/src/qt/forms/helpmessagedialog.ui deleted file mode 100644 index 60329ecc6c7..00000000000 --- a/src/qt/forms/helpmessagedialog.ui +++ /dev/null @@ -1,189 +0,0 @@ - - - HelpMessageDialog - - - - 0 - 0 - 780 - 400 - - - - - 0 - - - 12 - - - 12 - - - 12 - - - 12 - - - - - 0 - - - 4 - - - 0 - - - - - - 0 - 0 - - - - - 100 - 100 - - - - :/icons/defi - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - - - - - - - - true - - - - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOn - - - true - - - - - - - IBeamCursor - - - Qt::PlainText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 4 - 4 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Ok - - - - - - - - - - - - - okButton - accepted() - HelpMessageDialog - accept() - - - 20 - 20 - - - 20 - 20 - - - - - okButton - rejected() - HelpMessageDialog - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/src/qt/forms/intro.ui b/src/qt/forms/intro.ui deleted file mode 100644 index cfdd8482e39..00000000000 --- a/src/qt/forms/intro.ui +++ /dev/null @@ -1,293 +0,0 @@ - - - Intro - - - - 0 - 0 - 674 - 415 - - - - Welcome - - - - - - QLabel { font-style:italic; } - - - Welcome to %1. - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Minimum - - - - 20 - 15 - - - - - - - - As this is the first time the program is launched, you can choose where %1 will store its data. - - - true - - - - - - - true - - - - - - - Use the default data directory - - - - - - - Use a custom data directory: - - - - - - - 0 - - - QLayout::SetDefaultConstraint - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 60 - 20 - - - - - - - - QLayout::SetDefaultConstraint - - - - - - - - - - - 0 - 0 - - - - - 30 - 16777215 - - - - - - - false - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 5 - - - - - - - - - 1 - 0 - - - - - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 5 - - - - - - - - - 0 - 0 - - - - Qt::RichText - - - true - - - - - - - - - - - When you click OK, %1 will begin to download and process the full %4 block chain (%2GB) starting with the earliest transactions in %3 when %4 initially launched. - - - true - - - - - - - This initial synchronisation is very demanding, and may expose hardware problems with your computer that had previously gone unnoticed. Each time you run %1, it will continue downloading where it left off. - - - true - - - - - - - If you have chosen to limit block chain storage (pruning), the historical data must still be downloaded and processed, but will be deleted afterward to keep your disk usage low. - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - Intro - accept() - - - 20 - 20 - - - 20 - 20 - - - - - buttonBox - rejected() - Intro - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/src/qt/forms/modaloverlay.ui b/src/qt/forms/modaloverlay.ui deleted file mode 100644 index 3b3727a3714..00000000000 --- a/src/qt/forms/modaloverlay.ui +++ /dev/null @@ -1,382 +0,0 @@ - - - ModalOverlay - - - - 0 - 0 - 640 - 385 - - - - Form - - - - QLayout::SetDefaultConstraint - - - 0 - - - 0 - - - 0 - - - 0 - - - - - #bgWidget { background: rgba(0,0,0,220); } - - - - 60 - - - 60 - - - 60 - - - 60 - - - - - #contentWidget { background: rgba(255,255,255,240); border-radius: 6px; } - -QLabel { color: rgb(40,40,40); } - - - - 0 - - - 10 - - - 10 - - - 10 - - - 10 - - - - - 20 - - - - - 0 - - - - - false - - - - - - - :/icons/warning - :/icons/warning:/icons/warning - - - - 48 - 48 - - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - 0 - - - 0 - - - - - Recent transactions may not yet be visible, and therefore your wallet's balance might be incorrect. This information will be correct once your wallet has finished synchronizing with the defi network, as detailed below. - - - Qt::RichText - - - true - - - - - - - - 75 - true - - - - Attempting to spend defis that are affected by not-yet-displayed transactions will not be accepted by the network. - - - Qt::RichText - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - QFormLayout::FieldsStayAtSizeHint - - - 6 - - - 6 - - - 10 - - - - - - 75 - true - - - - Number of blocks left - - - - - - - Unknown... - - - - - - - - 75 - true - - - - Last block time - - - - - - - - 0 - 0 - - - - Unknown... - - - - - - - - 75 - true - - - - Progress - - - - - - - - - ~ - - - - - - - 24 - - - - - - - - - - - - - 75 - true - - - - Progress increase per hour - - - - - - - calculating... - - - - - - - - 75 - true - - - - Estimated time left until synced - - - - - - - calculating... - - - - - - - - - 10 - - - 10 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Hide - - - Qt::StrongFocus - - - true - - - - - - - - - - - - - - - - ModalOverlay - QWidget -
qt/modaloverlay.h
- 1 -
-
- - -
diff --git a/src/qt/forms/openuridialog.ui b/src/qt/forms/openuridialog.ui deleted file mode 100644 index 0e1048bc070..00000000000 --- a/src/qt/forms/openuridialog.ui +++ /dev/null @@ -1,118 +0,0 @@ - - - OpenURIDialog - - - - 0 - 0 - 564 - 109 - - - - Open URI - - - - - - Open payment request from URI or file - - - - - - - - - URI: - - - - - - - - - - Select payment request file - - - - - - false - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - QValidatedLineEdit - QLineEdit -
qt/qvalidatedlineedit.h
-
-
- - - - buttonBox - accepted() - OpenURIDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - OpenURIDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -
diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui deleted file mode 100644 index 95d58f8aa47..00000000000 --- a/src/qt/forms/optionsdialog.ui +++ /dev/null @@ -1,900 +0,0 @@ - - - OptionsDialog - - - - 0 - 0 - 560 - 440 - - - - Options - - - true - - - - - - 0 - - - - &Main - - - - - - Automatically start %1 after logging in to the system. - - - &Start %1 on system login - - - - - - - Qt::Horizontal - - - - 40 - 5 - - - - - - - - - - Disables some advanced features but all blocks will still be fully validated. Reverting this setting requires re-downloading the entire blockchain. Actual disk usage may be somewhat higher. - - - Prune &block storage to - - - - - - - - - - GB - - - Qt::PlainText - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Reverting this setting requires re-downloading the entire blockchain. - - - Qt::PlainText - - - - - - - - - Size of &database cache - - - Qt::PlainText - - - databaseCache - - - - - - - - - - MiB - - - Qt::PlainText - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Number of script &verification threads - - - Qt::PlainText - - - threadsScriptVerif - - - - - - - (0 = auto, <0 = leave that many cores free) - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - W&allet - - - - - - Expert - - - - - - Whether to show coin control features or not. - - - Enable coin &control features - - - - - - - If you disable the spending of unconfirmed change, the change from a transaction cannot be used until that transaction has at least one confirmation. This also affects how your balance is computed. - - - &Spend unconfirmed change - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - &Network - - - - - - Automatically open the Defi client port on the router. This only works when your router supports UPnP and it is enabled. - - - Map port using &UPnP - - - - - - - Accept connections from outside. - - - Allow incomin&g connections - - - - - - - Connect to the Defi network through a SOCKS5 proxy. - - - &Connect through SOCKS5 proxy (default proxy): - - - - - - - - - Proxy &IP: - - - Qt::PlainText - - - proxyIp - - - - - - - - 140 - 0 - - - - - 140 - 16777215 - - - - IP address of the proxy (e.g. IPv4: 127.0.0.1 / IPv6: ::1) - - - - - - - &Port: - - - Qt::PlainText - - - proxyPort - - - - - - - - 55 - 0 - - - - - 55 - 16777215 - - - - Port of the proxy (e.g. 9050) - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Used for reaching peers via: - - - Qt::PlainText - - - - - - - false - - - Shows if the supplied default SOCKS5 proxy is used to reach peers via this network type. - - - - - - - - - - IPv4 - - - Qt::PlainText - - - - - - - false - - - Shows if the supplied default SOCKS5 proxy is used to reach peers via this network type. - - - - - - - - - - IPv6 - - - Qt::PlainText - - - - - - - false - - - Shows if the supplied default SOCKS5 proxy is used to reach peers via this network type. - - - - - - - - - - Tor - - - Qt::PlainText - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Connect to the Defi network through a separate SOCKS5 proxy for Tor hidden services. - - - Use separate SOCKS&5 proxy to reach peers via Tor hidden services: - - - - - - - - - Proxy &IP: - - - Qt::PlainText - - - proxyIpTor - - - - - - - - 140 - 0 - - - - - 140 - 16777215 - - - - IP address of the proxy (e.g. IPv4: 127.0.0.1 / IPv6: ::1) - - - - - - - &Port: - - - Qt::PlainText - - - proxyPortTor - - - - - - - - 55 - 0 - - - - - 55 - 16777215 - - - - Port of the proxy (e.g. 9050) - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - &Window - - - - - - Hide the icon from the system tray. - - - &Hide tray icon - - - - - - - Show only a tray icon after minimizing the window. - - - &Minimize to the tray instead of the taskbar - - - - - - - Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Exit in the menu. - - - M&inimize on close - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - &Display - - - - - - - - User Interface &language: - - - Qt::PlainText - - - lang - - - - - - - The user interface language can be set here. This setting will take effect after restarting %1. - - - - - - - - - - - &Unit to show amounts in: - - - Qt::PlainText - - - unit - - - - - - - Choose the default subdivision unit to show in the interface and when sending coins. - - - - - - - - - - - Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |. - - - &Third party transaction URLs - - - thirdPartyTxUrls - - - - - - - Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |. - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - - Options set in this dialog are overridden by the command line or in the configuration file: - - - Qt::PlainText - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Qt::PlainText - - - true - - - - - - - - - - - - - - Open the %1 configuration file from the working directory. - - - Open Configuration File - - - false - - - - - - - Reset all client options to default. - - - &Reset Options - - - false - - - - - - - - - Qt::Horizontal - - - - 40 - 48 - - - - - - - - - 200 - 0 - - - - - 75 - true - - - - - - - Qt::PlainText - - - true - - - - - - - Qt::Horizontal - - - - 40 - 48 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - &OK - - - false - - - true - - - - - - - &Cancel - - - false - - - - - - - - - - - - - - QValidatedLineEdit - QLineEdit -
qt/qvalidatedlineedit.h
-
- - QValueComboBox - QComboBox -
qt/qvaluecombobox.h
-
-
- - -
diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui deleted file mode 100644 index f974a8c774b..00000000000 --- a/src/qt/forms/overviewpage.ui +++ /dev/null @@ -1,541 +0,0 @@ - - - OverviewPage - - - - 0 - 0 - 596 - 342 - - - - Form - - - - - - false - - - QLabel { background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop:0 #F0D0A0, stop:1 #F8D488); color:#000000; } - - - true - - - 3 - - - Qt::TextSelectableByMouse - - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 75 - true - - - - Balances - - - - - - - true - - - - 30 - 16777215 - - - - The displayed information may be out of date. Your wallet automatically synchronizes with the Defi network after a connection is established, but this process has not completed yet. - - - - - - - :/icons/warning - :/icons/warning:/icons/warning - - - - 24 - 24 - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 12 - - - - - - 75 - true - - - - IBeamCursor - - - Unconfirmed transactions to watch-only addresses - - - 0.000 000 00 BTC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - IBeamCursor - - - Total of transactions that have yet to be confirmed, and do not yet count toward the spendable balance - - - 0.000 000 00 BTC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - IBeamCursor - - - Mined balance in watch-only addresses that has not yet matured - - - 0.000 000 00 BTC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - - 140 - 0 - - - - Qt::Horizontal - - - - - - - Total: - - - - - - - - 75 - true - - - - IBeamCursor - - - Mined balance that has not yet matured - - - 0.000 000 00 BTC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Immature: - - - - - - - - 75 - true - - - - IBeamCursor - - - Your current total balance - - - 0.000 000 00 BTC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - IBeamCursor - - - Current total balance in watch-only addresses - - - 0.000 000 00 BTC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Watch-only: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Available: - - - - - - - - 75 - true - - - - IBeamCursor - - - Your current spendable balance - - - 0.000 000 00 BTC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - IBeamCursor - - - Your current balance in watch-only addresses - - - 0.000 000 00 BTC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Pending: - - - - - - - Spendable: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 75 - true - - - - Recent transactions - - - - - - - true - - - - 30 - 16777215 - - - - The displayed information may be out of date. Your wallet automatically synchronizes with the Defi network after a connection is established, but this process has not completed yet. - - - - - - - :/icons/warning - :/icons/warning:/icons/warning - - - - 24 - 24 - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - QListView { background: transparent; } - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - QAbstractItemView::NoSelection - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - diff --git a/src/qt/forms/receivecoinsdialog.ui b/src/qt/forms/receivecoinsdialog.ui deleted file mode 100644 index 2a70ff353f5..00000000000 --- a/src/qt/forms/receivecoinsdialog.ui +++ /dev/null @@ -1,375 +0,0 @@ - - - ReceiveCoinsDialog - - - - 0 - 0 - 776 - 396 - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - - - - - An optional amount to request. Leave this empty or zero to not request a specific amount. - - - &Amount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - reqAmount - - - - - - - An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Defi network. - - - &Message: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - reqMessage - - - - - - - An optional label to associate with the new receiving address. - - - - - - - Use this form to request payments. All fields are <b>optional</b>. - - - - - - - An optional label to associate with the new receiving address. - - - &Label: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - reqLabel - - - - - - - An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Defi network. - - - - - - - - - - 150 - 0 - - - - &Create new receiving address - - - - :/icons/receiving_addresses:/icons/receiving_addresses - - - - - - - - 0 - 0 - - - - Clear all fields of the form. - - - Clear - - - - :/icons/remove:/icons/remove - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 1000 - 100 - - - - An optional amount to request. Leave this empty or zero to not request a specific amount. - - - - - - - - 0 - 0 - - - - - 1000 - 16777215 - - - - Qt::StrongFocus - - - Native segwit addresses (aka Bech32 or BIP-173) reduce your transaction fees later on and offer better protection against typos, but old wallets don't support them. When checked, an address compatible with older wallets will be created instead. - - - Generate legacy address - - - - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 10 - - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - 75 - true - - - - Requested payments history - - - - - - - Qt::CustomContextMenu - - - false - - - true - - - - - - - - - false - - - Show the selected request (does the same as double clicking an entry) - - - Show - - - - :/icons/edit:/icons/edit - - - false - - - - - - - false - - - Remove the selected entries from the list - - - Remove - - - - :/icons/remove:/icons/remove - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - DefiAmountField - QLineEdit -
qt/defiamountfield.h
- 1 -
-
- - reqLabel - reqAmount - useLegacyAddress - reqMessage - receiveButton - clearButton - recentRequestsView - showRequestButton - removeRequestButton - - - - - -
diff --git a/src/qt/forms/receiverequestdialog.ui b/src/qt/forms/receiverequestdialog.ui deleted file mode 100644 index 9f896ee3b19..00000000000 --- a/src/qt/forms/receiverequestdialog.ui +++ /dev/null @@ -1,168 +0,0 @@ - - - ReceiveRequestDialog - - - - 0 - 0 - 487 - 597 - - - - - - - - 0 - 0 - - - - - 300 - 320 - - - - QR Code - - - Qt::PlainText - - - Qt::AlignCenter - - - true - - - - - - - - 0 - 0 - - - - - 0 - 50 - - - - QFrame::NoFrame - - - QFrame::Plain - - - true - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - Copy &URI - - - false - - - - - - - Copy &Address - - - false - - - - - - - &Save Image... - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QDialogButtonBox::Close - - - - - - - - - - QRImageWidget - QLabel -
qt/qrimagewidget.h
-
-
- - - - buttonBox - rejected() - ReceiveRequestDialog - reject() - - - 452 - 573 - - - 243 - 298 - - - - - buttonBox - accepted() - ReceiveRequestDialog - accept() - - - 452 - 573 - - - 243 - 298 - - - - -
diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui deleted file mode 100644 index c156065ef40..00000000000 --- a/src/qt/forms/sendcoinsdialog.ui +++ /dev/null @@ -1,1250 +0,0 @@ - - - SendCoinsDialog - - - - 0 - 0 - 850 - 526 - - - - Send Coins - - - - 8 - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 0 - - - 0 - - - 0 - - - 0 - - - 6 - - - - - 0 - - - 10 - - - 10 - - - - - 15 - - - - - - 0 - 0 - - - - - 75 - true - - - - font-weight:bold; - - - Coin Control Features - - - - - - - - - 8 - - - 10 - - - - - - - - Inputs... - - - false - - - - - - - automatically selected - - - 5 - - - - - - - - 75 - true - - - - color:red;font-weight:bold; - - - Insufficient funds! - - - 5 - - - - - - - Qt::Horizontal - - - - 40 - 1 - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 20 - - - 0 - - - 10 - - - - - 10 - - - 14 - - - 10 - - - 4 - - - 6 - - - - - - 75 - true - - - - Quantity: - - - 0 - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0 - - - 0 - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - Bytes: - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0 - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - 10 - - - 14 - - - 6 - - - 4 - - - 6 - - - - - - 75 - true - - - - Amount: - - - 0 - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0.00 BTC - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - Dust: - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - no - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - 10 - - - 14 - - - 6 - - - 4 - - - 6 - - - - - - 75 - true - - - - Fee: - - - 0 - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0.00 BTC - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - 10 - - - 14 - - - 6 - - - 4 - - - 6 - - - - - - 75 - true - - - - After Fee: - - - 0 - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0.00 BTC - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - Change: - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - 0.00 BTC - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - - - - 12 - - - QLayout::SetDefaultConstraint - - - 5 - - - 5 - - - - - If this is activated, but the change address is empty or invalid, change will be sent to a newly generated address. - - - Custom change address - - - - - - - false - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - 3 - - - - - - - - - Qt::Vertical - - - - 800 - 1 - - - - - - - - - - - - - true - - - - - 0 - 0 - 830 - 104 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 6 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - 10 - - - 0 - - - - - 0 - - - - - 0 - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 1 - 4 - - - - - - - - 10 - - - - - - 0 - 0 - - - - - 75 - true - - - - font-weight:bold; - - - Transaction Fee: - - - - - - - - - - - - - - Choose... - - - - - - - - - Qt::Vertical - - - - 1 - 1 - - - - - - - - - - Using the fallbackfee can result in sending a transaction that will take several hours or days (or never) to confirm. Consider choosing your fee manually or wait until you have validated the complete chain. - - - - 75 - true - - - - Warning: Fee estimation is currently not possible. - - - false - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 40 - 20 - - - - - - - - collapse fee-settings - - - Hide - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 10 - - - 4 - - - 10 - - - 4 - - - - - 6 - - - - - - - Specify a custom fee per kB (1,000 bytes) of the transaction's virtual size. - -Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis per kB" for a transaction size of 500 bytes (half of 1 kB) would ultimately yield a fee of only 50 satoshis. - - - per kilobyte - - - - - - - - - - Qt::Horizontal - - - - 1 - 1 - - - - - - - - - - - - true - - - When there is less transaction volume than space in the blocks, miners as well as relaying nodes may enforce a minimum fee. Paying only this minimum fee is just fine, but be aware that this can result in a never confirming transaction once there is more demand for defi transactions than the network can process. - - - A too low fee might result in a never confirming transaction (read the tooltip) - - - - - - - Qt::Horizontal - - - - 1 - 1 - - - - - - - - - - - - - - Recommended: - - - true - - - groupFee - - - - - - - Qt::Vertical - - - - 1 - 1 - - - - - - - - - - - - Custom: - - - groupFee - - - - - - - Qt::Vertical - - - - 1 - 1 - - - - - - - - - - 6 - - - 2 - - - - - - - - - - - - - - - - - - - - - (Smart fee not initialized yet. This usually takes a few blocks...) - - - - - - - Qt::Horizontal - - - - 1 - 1 - - - - - - - - - - - - - - Confirmation time target: - - - - - - - - - 30 - - - - - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - Qt::Vertical - - - - 1 - 1 - - - - - - - - - - - - Enable Replace-By-Fee - - - With Replace-By-Fee (BIP-125) you can increase a transaction's fee after it is sent. Without this, a higher fee may be recommended to compensate for increased transaction delay risk. - - - - - - - - - - Qt::Vertical - - - - 40 - 5 - - - - - - - - - - - - - - - - 150 - 0 - - - - Confirm the send action - - - S&end - - - - :/icons/send:/icons/send - - - false - - - false - - - - - - - - 0 - 0 - - - - Clear all fields of the form. - - - Clear &All - - - - :/icons/remove:/icons/remove - - - false - - - - - - - Send to multiple recipients at once - - - Add &Recipient - - - - :/icons/add:/icons/add - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 3 - - - - - - 0 - 0 - - - - Balance: - - - - - - - - 0 - 0 - - - - IBeamCursor - - - 123.456 BTC - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - - QValidatedLineEdit - QLineEdit -
qt/qvalidatedlineedit.h
-
- - DefiAmountField - QLineEdit -
qt/defiamountfield.h
- 1 -
-
- - - - - - - -
diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui deleted file mode 100644 index 11c15c33dea..00000000000 --- a/src/qt/forms/sendcoinsentry.ui +++ /dev/null @@ -1,1282 +0,0 @@ - - - SendCoinsEntry - - - - 0 - 0 - 729 - 150 - - - - Qt::TabFocus - - - false - - - - This is a normal payment. - - - QFrame::NoFrame - - - - 8 - - - 4 - - - 12 - - - 8 - - - - - Pay &To: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payTo - - - - - - - 0 - - - - - The Defi address to send the payment to - - - - - - - Choose previously used address - - - - - - - :/icons/address-book:/icons/address-book - - - - 22 - 22 - - - - Alt+A - - - - - - - Paste address from clipboard - - - - - - - :/icons/editpaste:/icons/editpaste - - - - 22 - 22 - - - - Alt+P - - - - - - - Remove this entry - - - - - - - :/icons/remove:/icons/remove - - - - 22 - 22 - - - - - - - - - - &Label: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - addAsLabel - - - - - - - Enter a label for this address to add it to the list of used addresses - - - - - - - A&mount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payAmount - - - - - - - - - - - - The fee will be deducted from the amount being sent. The recipient will receive less defis than you enter in the amount field. If multiple recipients are selected, the fee is split equally. - - - S&ubtract fee from amount - - - - - - - Use available balance - - - - - - - - - Message: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - A message that was attached to the defi: URI which will be stored with the transaction for your reference. Note: This message will not be sent over the Defi network. - - - Qt::PlainText - - - - - - - Qt::Horizontal - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 191 - - - - - - - 127 - 127 - 63 - - - - - - - 170 - 170 - 84 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 191 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 191 - - - - - - - 127 - 127 - 63 - - - - - - - 170 - 170 - 84 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 191 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 127 - 127 - 63 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 191 - - - - - - - 127 - 127 - 63 - - - - - - - 170 - 170 - 84 - - - - - - - 127 - 127 - 63 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 127 - 63 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - This is an unauthenticated payment request. - - - true - - - QFrame::NoFrame - - - - 12 - - - - - Pay To: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 0 - - - - - - - - Remove this entry - - - - - - - :/icons/remove:/icons/remove - - - - - - - - - Memo: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::PlainText - - - - - - - A&mount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payAmount_is - - - - - - - false - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - 140 - 232 - 119 - - - - - - - 230 - 255 - 224 - - - - - - - 185 - 243 - 171 - - - - - - - 70 - 116 - 59 - - - - - - - 93 - 155 - 79 - - - - - - - 0 - 0 - 0 - - - - - - - 155 - 255 - 147 - - - - - - - 0 - 0 - 0 - - - - - - - 119 - 255 - 233 - - - - - - - 140 - 232 - 119 - - - - - - - 0 - 0 - 0 - - - - - - - 197 - 243 - 187 - - - - - - - 125 - 194 - 122 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 140 - 232 - 119 - - - - - - - 230 - 255 - 224 - - - - - - - 185 - 243 - 171 - - - - - - - 70 - 116 - 59 - - - - - - - 93 - 155 - 79 - - - - - - - 0 - 0 - 0 - - - - - - - 155 - 255 - 147 - - - - - - - 0 - 0 - 0 - - - - - - - 119 - 255 - 233 - - - - - - - 140 - 232 - 119 - - - - - - - 0 - 0 - 0 - - - - - - - 197 - 243 - 187 - - - - - - - 125 - 194 - 122 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 70 - 116 - 59 - - - - - - - 140 - 232 - 119 - - - - - - - 230 - 255 - 224 - - - - - - - 185 - 243 - 171 - - - - - - - 70 - 116 - 59 - - - - - - - 93 - 155 - 79 - - - - - - - 70 - 116 - 59 - - - - - - - 155 - 255 - 147 - - - - - - - 70 - 116 - 59 - - - - - - - 140 - 232 - 119 - - - - - - - 140 - 232 - 119 - - - - - - - 0 - 0 - 0 - - - - - - - 140 - 232 - 119 - - - - - - - 125 - 194 - 122 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - This is an authenticated payment request. - - - true - - - QFrame::NoFrame - - - - 12 - - - - - Pay To: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 0 - - - - - Qt::PlainText - - - - - - - Remove this entry - - - - - - - :/icons/remove:/icons/remove - - - - - - - - - Memo: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::PlainText - - - - - - - A&mount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payAmount_s - - - - - - - false - - - - - - - - - QValidatedLineEdit - QLineEdit -
qt/qvalidatedlineedit.h
-
- - DefiAmountField - QLineEdit -
qt/defiamountfield.h
-
-
- - payTo - addressBookButton - pasteButton - deleteButton - addAsLabel - payAmount - payAmount_is - deleteButton_is - payAmount_s - deleteButton_s - - - - - -
diff --git a/src/qt/forms/signverifymessagedialog.ui b/src/qt/forms/signverifymessagedialog.ui deleted file mode 100644 index 7cc0180713d..00000000000 --- a/src/qt/forms/signverifymessagedialog.ui +++ /dev/null @@ -1,390 +0,0 @@ - - - SignVerifyMessageDialog - - - - 0 - 0 - 700 - 380 - - - - Signatures - Sign / Verify a Message - - - true - - - - - - 0 - - - - &Sign Message - - - - - - You can sign messages/agreements with your addresses to prove you can receive defis sent to them. Be careful not to sign anything vague or random, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to. - - - Qt::PlainText - - - true - - - - - - - 0 - - - - - The Defi address to sign the message with - - - - - - - Choose previously used address - - - - - - - :/icons/address-book:/icons/address-book - - - Alt+A - - - false - - - - - - - Paste address from clipboard - - - - - - - :/icons/editpaste:/icons/editpaste - - - Alt+P - - - false - - - - - - - - - Enter the message you want to sign here - - - - - - - Signature - - - Qt::PlainText - - - - - - - 0 - - - - - - true - - - - true - - - - - - - Copy the current signature to the system clipboard - - - - - - - :/icons/editcopy:/icons/editcopy - - - false - - - - - - - - - - - Sign the message to prove you own this Defi address - - - Sign &Message - - - - :/icons/edit:/icons/edit - - - false - - - - - - - Reset all sign message fields - - - Clear &All - - - - :/icons/remove:/icons/remove - - - false - - - - - - - Qt::Horizontal - - - - 40 - 48 - - - - - - - - - 75 - true - - - - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 48 - - - - - - - - - - - &Verify Message - - - - - - Enter the receiver's address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack. Note that this only proves the signing party receives with the address, it cannot prove sendership of any transaction! - - - Qt::PlainText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - 0 - - - - - The Defi address the message was signed with - - - - - - - Choose previously used address - - - - - - - :/icons/address-book:/icons/address-book - - - Alt+A - - - false - - - - - - - - - - - - - - - - - Verify the message to ensure it was signed with the specified Defi address - - - Verify &Message - - - - :/icons/transaction_0:/icons/transaction_0 - - - false - - - - - - - Reset all verify message fields - - - Clear &All - - - - :/icons/remove:/icons/remove - - - false - - - - - - - Qt::Horizontal - - - - 40 - 48 - - - - - - - - - 75 - true - - - - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 48 - - - - - - - - - - - - - - - QValidatedLineEdit - QLineEdit -
qt/qvalidatedlineedit.h
-
-
- - - - -
diff --git a/src/qt/forms/transactiondescdialog.ui b/src/qt/forms/transactiondescdialog.ui deleted file mode 100644 index 3a698cfd1d4..00000000000 --- a/src/qt/forms/transactiondescdialog.ui +++ /dev/null @@ -1,74 +0,0 @@ - - - TransactionDescDialog - - - - 0 - 0 - 620 - 250 - - - - Transaction details - - - - - - This pane shows a detailed description of the transaction - - - true - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - - - - buttonBox - accepted() - TransactionDescDialog - accept() - - - 20 - 20 - - - 20 - 20 - - - - - buttonBox - rejected() - TransactionDescDialog - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h deleted file mode 100644 index aa7240d2036..00000000000 --- a/src/qt/guiconstants.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2011-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef DEFI_QT_GUICONSTANTS_H -#define DEFI_QT_GUICONSTANTS_H - -/* Milliseconds between model updates */ -static const int MODEL_UPDATE_DELAY = 250; - -/* AskPassphraseDialog -- Maximum passphrase length */ -static const int MAX_PASSPHRASE_SIZE = 1024; - -/* DefiGUI -- Size of icons in status bar */ -static const int STATUSBAR_ICONSIZE = 16; - -static const bool DEFAULT_SPLASHSCREEN = true; - -/* Invalid field background style */ -#define STYLE_INVALID "background:#FF8080" - -/* Transaction list -- unconfirmed transaction */ -#define COLOR_UNCONFIRMED QColor(128, 128, 128) -/* Transaction list -- negative amount */ -#define COLOR_NEGATIVE QColor(255, 0, 0) -/* Transaction list -- bare address (without label) */ -#define COLOR_BAREADDRESS QColor(140, 140, 140) -/* Transaction list -- TX status decoration - open until date */ -#define COLOR_TX_STATUS_OPENUNTILDATE QColor(64, 64, 255) -/* Transaction list -- TX status decoration - danger, tx needs attention */ -#define COLOR_TX_STATUS_DANGER QColor(200, 100, 100) -/* Transaction list -- TX status decoration - default color */ -#define COLOR_BLACK QColor(0, 0, 0) - -/* Tooltips longer than this (in characters) are converted into rich text, - so that they can be word-wrapped. - */ -static const int TOOLTIP_WRAP_THRESHOLD = 80; - -/* Number of frames in spinner animation */ -#define SPINNER_FRAMES 36 - -#define QAPP_ORG_NAME "Defi" -#define QAPP_ORG_DOMAIN "defi.org" -#define QAPP_APP_NAME_DEFAULT "Defi-Qt" -#define QAPP_APP_NAME_TESTNET "Defi-Qt-testnet" -#define QAPP_APP_NAME_REGTEST "Defi-Qt-regtest" - -/* One gigabyte (GB) in bytes */ -static constexpr uint64_t GB_BYTES{1000000000}; - -#endif // DEFI_QT_GUICONSTANTS_H diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp deleted file mode 100644 index bd50538d9ec..00000000000 --- a/src/qt/guiutil.cpp +++ /dev/null @@ -1,964 +0,0 @@ -// Copyright (c) 2011-2019 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include