lbrycrd/src/qt
Wladimir J. van der Laan 5f0c6a7b0e
Merge #10244: Refactor: separate gui from wallet and node
9960137 Add developer notes about blocking GUI code (Russell Yanofsky)
9a61eed Use WalletBalances struct in Qt (Russell Yanofsky)
56f33ca Remove direct bitcoin calls from qt/sendcoinsdialog.cpp (Russell Yanofsky)
e872c93 Remove direct bitcoin access from qt/guiutil.cpp (Russell Yanofsky)
5884558 Remove direct bitcoin calls from qt transaction table files (Russell Yanofsky)
3cab2ce Remove direct bitcoin calls from qt/paymentserver.cpp (Russell Yanofsky)
3ec2ebc Remove direct bitcoin calls from qt/addresstablemodel.cpp (Russell Yanofsky)
827de03 Remove direct bitcoin calls from qt/coincontroldialog.cpp (Russell Yanofsky)
a0704a8 Remove most direct bitcoin calls from qt/walletmodel.cpp (Russell Yanofsky)
90d4640 Remove direct bitcoin calls from qt/optionsdialog.cpp (Russell Yanofsky)
582daf6 Remove direct bitcoin calls from qt/rpcconsole.cpp (Russell Yanofsky)
3034a46 Remove direct bitcoin calls from qt/bantablemodel.cpp (Russell Yanofsky)
e0b66a3 Remove direct bitcoin calls from qt/peertablemodel.cpp (Russell Yanofsky)
d7c2c95 Remove direct bitcoin calls from qt/intro.cpp (Russell Yanofsky)
fe6f27e Remove direct bitcoin calls from qt/clientmodel.cpp (Russell Yanofsky)
5fba3af Remove direct bitcoin calls from qt/splashscreen.cpp (Russell Yanofsky)
c2f672f Remove direct bitcoin calls from qt/utilitydialog.cpp (Russell Yanofsky)
3d619e9 Remove direct bitcoin calls from qt/bitcoingui.cpp (Russell Yanofsky)
c0f2756 Remove direct bitcoin calls from qt/optionsmodel.cpp (Russell Yanofsky)
71e0d90 Remove direct bitcoin calls from qt/bitcoin.cpp (Russell Yanofsky)
ea73b84 Add src/interface/README.md (Russell Yanofsky)

Pull request description:

  This is a refactoring PR that does not change behavior in any way. This change:

  1. Creates abstract [`Node`](https://github.com/ryanofsky/bitcoin/blob/pr/ipc-local/src/interface/node.h) and [`Wallet`](https://github.com/ryanofsky/bitcoin/blob/pr/ipc-local/src/interface/wallet.h) interfaces in [`src/interface/`](https://github.com/ryanofsky/bitcoin/tree/pr/ipc-local/src/interface)
  1. Updates Qt code to call the new interfaces. This largely consists of diffs of the form:

  ```diff
  -    InitLogging();
  -    InitParameterInteraction();
  +    node.initLogging();
  +    node.initParameterInteraction();
  ```

  This change allows followup PR #10102 (makes `bitcoin-qt` control `bitcoind` over an IPC socket) to work without any significant updates to Qt code. Additionally:

  * It provides a single place to describe the interface between GUI and daemon code.
  * It can make better GUI testing possible, because Node and Wallet objects have virtual methods that can be overloaded for mocking.
  * It can be used to help make the GUI more responsive (see https://github.com/bitcoin/bitcoin/issues/10504)

  Other notes:

  * I used python scripts [hide-globals.py](https://github.com/ryanofsky/home/blob/master/src/2017/hide-globals/hide-globals.py) and [replace-syms.py](https://github.com/ryanofsky/home/blob/master/src/2017/hide-globals/replace-syms.py) to identify all the places where Qt code was accessing libbitcoin global variables and calling functions accessing those global variables.
  * These changes were originally part of #10102. Thanks to @JeremyRubin for the suggestion of splitting them out.

  Commits:

  - [`ea73b84d2d` Add src/interface/README.md](ea73b84d2d)
  - [`71e0d90876` Remove direct bitcoin calls from qt/bitcoin.cpp](71e0d90876)
  - [`c0f2756be5` Remove direct bitcoin calls from qt/optionsmodel.cpp](c0f2756be5)
  - [`3d619e9d36` Remove direct bitcoin calls from qt/bitcoingui.cpp](3d619e9d36)
  - [`c2f672fb19` Remove direct bitcoin calls from qt/utilitydialog.cpp](c2f672fb19)
  - [`5fba3af21e` Remove direct bitcoin calls from qt/splashscreen.cpp](5fba3af21e)
  - [`fe6f27e6ea` Remove direct bitcoin calls from qt/clientmodel.cpp](fe6f27e6ea)
  - [`d7c2c95948` Remove direct bitcoin calls from qt/intro.cpp](d7c2c95948)
  - [`e0b66a3b7c` Remove direct bitcoin calls from qt/peertablemodel.cpp](e0b66a3b7c)
  - [`3034a462a5` Remove direct bitcoin calls from qt/bantablemodel.cpp](3034a462a5)
  - [`582daf6d22` Remove direct bitcoin calls from qt/rpcconsole.cpp](582daf6d22)
  - [`90d4640b7e` Remove direct bitcoin calls from qt/optionsdialog.cpp](90d4640b7e)
  - [`a0704a8996` Remove most direct bitcoin calls from qt/walletmodel.cpp](a0704a8996)
  - [`827de038ab` Remove direct bitcoin calls from qt/coincontroldialog.cpp](827de038ab)
  - [`3ec2ebcd9b` Remove direct bitcoin calls from qt/addresstablemodel.cpp](3ec2ebcd9b)
  - [`3cab2ce5f9` Remove direct bitcoin calls from qt/paymentserver.cpp](3cab2ce5f9)
  - [`58845587e1` Remove direct bitcoin calls from qt transaction table files](58845587e1)
  - [`e872c93ee8` Remove direct bitcoin access from qt/guiutil.cpp](e872c93ee8)
  - [`56f33ca349` Remove direct bitcoin calls from qt/sendcoinsdialog.cpp](56f33ca349)
  - [`9a61eed1fc` Use WalletBalances struct in Qt](9a61eed1fc)
  - [`9960137697` Add developer notes about blocking GUI code](9960137697)

Tree-SHA512: 7b9eff2f37d4ea21972d7cc6a3dbe144248595d6c330524396d867f3cd2841d666cdc040fd3605af559dab51b075812402f61d628d16cf13719335c1d8bf8ed3
2018-04-05 18:19:35 +02:00
..
forms Merge #12610: Multiwallet for the GUI 2018-03-26 18:51:38 +07:00
locale qt: Periodic translations update 2018-01-30 13:43:26 +01:00
res [qt] Make network disabled icon 50% opaque 2016-11-13 22:06:35 +01:00
test Merge #10244: Refactor: separate gui from wallet and node 2018-04-05 18:19:35 +02:00
addressbookpage.cpp Qt: remove "new" button during receive-mode in addressbook 2018-03-19 12:13:08 +07:00
addressbookpage.h [qt] Add support to search the address book 2018-01-03 16:15:15 +00:00
addresstablemodel.cpp Remove direct bitcoin calls from qt/addresstablemodel.cpp 2018-04-04 16:52:40 -04:00
addresstablemodel.h Remove direct bitcoin calls from qt/addresstablemodel.cpp 2018-04-04 16:52:40 -04:00
askpassphrasedialog.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
askpassphrasedialog.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
bantablemodel.cpp Remove direct bitcoin calls from qt/bantablemodel.cpp 2018-04-04 16:52:40 -04:00
bantablemodel.h Merge #10244: Refactor: separate gui from wallet and node 2018-04-05 18:19:35 +02:00
bitcoin.cpp Merge #10244: Refactor: separate gui from wallet and node 2018-04-05 18:19:35 +02:00
bitcoin.qrc Overhaul network activity toggle 2016-10-24 10:23:58 +00:00
bitcoin_locale.qrc qt: periodic translations update 2017-01-10 12:52:02 +01:00
bitcoinaddressvalidator.cpp Split key_io (address/key encodings) off from base58 2018-02-19 18:55:21 -08:00
bitcoinaddressvalidator.h
bitcoinamountfield.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
bitcoinamountfield.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
bitcoingui.cpp Remove most direct bitcoin calls from qt/walletmodel.cpp 2018-04-04 16:52:40 -04:00
bitcoingui.h Remove direct bitcoin calls from qt/bitcoingui.cpp 2018-04-04 16:52:40 -04:00
bitcoinstrings.cpp initwallet: Do not translate highly technical addresstype help 2018-01-24 11:30:44 -05:00
bitcoinunits.cpp Merge #12035: [qt] change µBTC to bits 2018-01-03 22:16:13 -10:00
bitcoinunits.h Merge #12035: [qt] change µBTC to bits 2018-01-03 22:16:13 -10:00
callback.h Declare single-argument (non-converting) constructors "explicit" 2017-08-16 16:33:25 +02:00
clientmodel.cpp Remove direct bitcoin calls from qt/bantablemodel.cpp 2018-04-04 16:52:40 -04:00
clientmodel.h Remove direct bitcoin calls from qt/clientmodel.cpp 2018-04-04 16:52:40 -04:00
coincontroldialog.cpp Remove direct bitcoin calls from qt/coincontroldialog.cpp 2018-04-04 16:52:40 -04:00
coincontroldialog.h [gui] Defer coin control instancing 2018-02-01 19:40:20 +00:00
coincontroltreewidget.cpp Merge #10498: Use static_cast instead of C-style casts for non-fundamental types 2018-02-07 16:15:28 -05:00
coincontroltreewidget.h
csvmodelwriter.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
csvmodelwriter.h
editaddressdialog.cpp Merge #12721: Qt: remove "new" button during receive-mode in addressbook 2018-03-20 09:15:22 +01:00
editaddressdialog.h Qt: remove "new" button during receive-mode in addressbook 2018-03-19 12:13:08 +07:00
guiconstants.h Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
guiutil.cpp Remove direct bitcoin access from qt/guiutil.cpp 2018-04-04 16:52:40 -04:00
guiutil.h Remove direct bitcoin access from qt/guiutil.cpp 2018-04-04 16:52:40 -04:00
intro.cpp Remove direct bitcoin calls from qt/intro.cpp 2018-04-04 16:52:40 -04:00
intro.h Remove direct bitcoin calls from qt/intro.cpp 2018-04-04 16:52:40 -04:00
macdockiconhandler.h
macdockiconhandler.mm Document the preference of nullptr over NULL or (void*)0 2017-08-18 09:51:00 +02:00
macnotificationhandler.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
macnotificationhandler.mm [macOS] remove Growl support, remove unused code 2017-09-07 10:11:44 -07:00
Makefile
modaloverlay.cpp Fix typos 2018-03-21 08:34:44 +02:00
modaloverlay.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
networkstyle.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
networkstyle.h
notificator.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
notificator.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
openuridialog.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
openuridialog.h
optionsdialog.cpp Remove direct bitcoin calls from qt/optionsdialog.cpp 2018-04-04 16:52:40 -04:00
optionsdialog.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
optionsmodel.cpp Remove direct bitcoin calls from qt/optionsmodel.cpp 2018-04-04 16:52:40 -04:00
optionsmodel.h Remove direct bitcoin calls from qt/optionsdialog.cpp 2018-04-04 16:52:40 -04:00
overviewpage.cpp Use WalletBalances struct in Qt 2018-04-04 16:52:41 -04:00
overviewpage.h Use WalletBalances struct in Qt 2018-04-04 16:52:41 -04:00
paymentrequest.proto Specify Protobuf version 2 in paymentrequest.proto 2016-09-16 11:45:08 +08:00
paymentrequestplus.cpp Split key_io (address/key encodings) off from base58 2018-02-19 18:55:21 -08:00
paymentrequestplus.h Split key_io (address/key encodings) off from base58 2018-02-19 18:55:21 -08:00
paymentserver.cpp Merge #10244: Refactor: separate gui from wallet and node 2018-04-05 18:19:35 +02:00
paymentserver.h Remove direct bitcoin calls from qt/paymentserver.cpp 2018-04-04 16:52:40 -04:00
peertablemodel.cpp Remove direct bitcoin calls from qt/peertablemodel.cpp 2018-04-04 16:52:40 -04:00
peertablemodel.h Merge #10244: Refactor: separate gui from wallet and node 2018-04-05 18:19:35 +02:00
platformstyle.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
platformstyle.h
qvalidatedlineedit.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
qvalidatedlineedit.h
qvaluecombobox.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
qvaluecombobox.h
README.md [docs] initial QT documentation, move Qt Creator instructions 2017-12-19 16:48:07 +01:00
receivecoinsdialog.cpp Remove most direct bitcoin calls from qt/walletmodel.cpp 2018-04-04 16:52:40 -04:00
receivecoinsdialog.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
receiverequestdialog.cpp Qt: show wallet name in request dlg in case of multiwallet 2018-03-26 18:40:27 +07:00
receiverequestdialog.h Qt: show wallet name in request dlg in case of multiwallet 2018-03-26 18:40:27 +07:00
recentrequeststablemodel.cpp Remove direct bitcoin calls from qt transaction table files 2018-04-04 16:52:40 -04:00
recentrequeststablemodel.h Remove direct bitcoin calls from qt transaction table files 2018-04-04 16:52:40 -04:00
rpcconsole.cpp Remove direct bitcoin calls from qt/rpcconsole.cpp 2018-04-04 16:52:40 -04:00
rpcconsole.h Remove direct bitcoin calls from qt/rpcconsole.cpp 2018-04-04 16:52:40 -04:00
sendcoinsdialog.cpp Use WalletBalances struct in Qt 2018-04-04 16:52:41 -04:00
sendcoinsdialog.h Use WalletBalances struct in Qt 2018-04-04 16:52:41 -04:00
sendcoinsentry.cpp Remove direct bitcoin access from qt/guiutil.cpp 2018-04-04 16:52:40 -04:00
sendcoinsentry.h Remove direct bitcoin access from qt/guiutil.cpp 2018-04-04 16:52:40 -04:00
signverifymessagedialog.cpp Remove most direct bitcoin calls from qt/walletmodel.cpp 2018-04-04 16:52:40 -04:00
signverifymessagedialog.h
splashscreen.cpp Remove direct bitcoin calls from qt/splashscreen.cpp 2018-04-04 16:52:40 -04:00
splashscreen.h Remove direct bitcoin calls from qt/splashscreen.cpp 2018-04-04 16:52:40 -04:00
trafficgraphwidget.cpp Remove direct bitcoin calls from qt/clientmodel.cpp 2018-04-04 16:52:40 -04:00
trafficgraphwidget.h
transactiondesc.cpp Remove direct bitcoin calls from qt transaction table files 2018-04-04 16:52:40 -04:00
transactiondesc.h Remove direct bitcoin calls from qt transaction table files 2018-04-04 16:52:40 -04:00
transactiondescdialog.cpp qt: Remove TransactionTableModel::TxIDRole 2018-03-07 13:08:20 +00:00
transactiondescdialog.h
transactionfilterproxy.cpp qt: Avoid querying unnecessary model data when filtering transactions 2018-03-11 22:21:51 +00:00
transactionfilterproxy.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
transactionrecord.cpp Remove direct bitcoin calls from qt transaction table files 2018-04-04 16:52:40 -04:00
transactionrecord.h Remove direct bitcoin calls from qt transaction table files 2018-04-04 16:52:40 -04:00
transactiontablemodel.cpp Remove direct bitcoin calls from qt transaction table files 2018-04-04 16:52:40 -04:00
transactiontablemodel.h Remove direct bitcoin calls from qt transaction table files 2018-04-04 16:52:40 -04:00
transactionview.cpp Remove most direct bitcoin calls from qt/walletmodel.cpp 2018-04-04 16:52:40 -04:00
transactionview.h [qt] navigate to transaction history page after send 2018-03-01 10:40:36 +01:00
utilitydialog.cpp Remove direct bitcoin calls from qt/utilitydialog.cpp 2018-04-04 16:52:40 -04:00
utilitydialog.h Remove direct bitcoin calls from qt/utilitydialog.cpp 2018-04-04 16:52:40 -04:00
walletframe.cpp Qt: Get wallet name from WalletModel rather than passing it around 2018-03-26 18:40:26 +07:00
walletframe.h Qt: Get wallet name from WalletModel rather than passing it around 2018-03-26 18:40:26 +07:00
walletmodel.cpp Use WalletBalances struct in Qt 2018-04-04 16:52:41 -04:00
walletmodel.h Use WalletBalances struct in Qt 2018-04-04 16:52:41 -04:00
walletmodeltransaction.cpp Remove most direct bitcoin calls from qt/walletmodel.cpp 2018-04-04 16:52:40 -04:00
walletmodeltransaction.h Merge #10244: Refactor: separate gui from wallet and node 2018-04-05 18:19:35 +02:00
walletview.cpp Remove most direct bitcoin calls from qt/walletmodel.cpp 2018-04-04 16:52:40 -04:00
walletview.h Qt: When multiple wallets are used, include in notifications the name 2018-03-26 18:40:26 +07:00
winshutdownmonitor.cpp Fix Windows build errors introduced in #10498 2018-02-12 15:48:37 +01:00
winshutdownmonitor.h

This directory contains the BitcoinQT graphical user interface (GUI). It uses the cross platform framework QT.

The current precise version for QT 5 is specified in qt.mk. QT 4 is also supported (see #8263).

Compile and run

See build instructions (OSX, Windows, Unix, etc).

To run:

./src/qt/bitcoin-qt

Files and directories

forms

Contains Designer UI files. They are created with [Qt Creator](#use-qt-Creator-as IDE), but can be edited using any text editor.

locale

Contains translations. They are periodically updated. The process is described here.

res

Resources such as the icon.

test

Tests.

bitcoingui.(h/cpp)

Represents the main window of the Bitcoin UI.

*model.(h/cpp)

The model. When it has a corresponding controller, it generally inherits from QAbstractTableModel. Models that are used by controllers as helpers inherit from other QT classes like QValidator.

ClientModel is used by the main application bitcoingui 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.

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 bitcoin:... link from a browser).

walletview.(h/cpp)

Represents the view to a single wallet.

Other .h/cpp files

  • UI elements like BitcoinAmountField, which inherit from QWidget.
  • bitcoinstrings.cpp: automatically generated
  • bitcoinunits.(h/cpp): BTC / mBTC / etc handling
  • callback.h
  • guiconstants.h: UI colors, app name, etc
  • guiutil.h: several helper functions
  • macdockiconhandler.(h/cpp)
  • macdockiconhandler.(h/cpp): display notifications in OSX

Contribute

See CONTRIBUTING.md for general guidelines. Specifically for QT:

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. Uncheck everything except Qt Creator during the installation process.

Instructions for OSX:

  1. Make sure you installed everything through Homebrew mentioned in the OSX build instructions
  2. Use ./configure with the --enable-debug flag
  3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project
  4. Enter "bitcoin-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 "bitcoin-qt" under "Run", which is where you can also add command line arguments)