dash/src/qt
fanquake d96e363a3f
Merge #17031: gui: Prevent processing duplicate payment requests
3f89e1eb237efcbd6415ca2cd0acddb6596153d7 Prevent processing duplicate payment requests (João Barbosa)

Pull request description:

  Considering the following from Qt [src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm#L267](13e0a36626/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm (L267))

  ```cpp
  - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
  {
      Q_UNUSED(filenames);
      Q_UNUSED(sender);

      for (NSString *fileName in filenames) {
          QString qtFileName = QString::fromNSString(fileName);
          if (inLaunch) {
              // We need to be careful because Cocoa will be nice enough to take
              // command line arguments and send them to us as events. Given the history
              // of Qt Applications, this will result in behavior people don't want, as
              // they might be doing the opening themselves with the command line parsing.
              if (qApp->arguments().contains(qtFileName))
                  continue;
          }
          QWindowSystemInterface::handleFileOpenEvent(qtFileName);
      }
  ```

  And that a2714a5c69f0b0506689af04c3e785f71ee0915d was merged, now Qt isn't able to filter out the above notifications, and then a [QFileOpenEvent](https://doc.qt.io/qt-5/qfileopenevent.html) event is delivered to `PaymentServer::eventFilter`, which in turn (re)adds the payment request.

  This change fixes #17025, but makes sense regardless of the issue.

ACKs for top commit:
  laanwj:
    Nah, this seems fine, utACK 3f89e1eb237efcbd6415ca2cd0acddb6596153d7
  Sjors:
    ACK 3f89e1e on macOS 10.14.6
  achow101:
    Code review ACK 3f89e1eb237efcbd6415ca2cd0acddb6596153d7

Tree-SHA512: dd1e0c73fd84953418173ca71f6f5a67ad74a5dc7e3b1d54915ef0545f513df6a24f27242a77bb094e2833a478e2f3bf30ecd50251f3c55b65e780097cb8ab4d
2021-07-13 13:14:04 -05:00
..
forms Merge #14375: qt: Correct misleading "overridden options" label 2021-06-28 13:40:50 -05:00
locale 80%+: ar, bg, de, es, fr, it, ja, ko, nl, pl, pt, ro, sk, th, tr, vi, zh_CN, zh_TW (#4169) 2021-05-25 00:45:15 +02:00
res Merge #11491: [gui] Add proxy icon in statusbar 2021-07-06 19:50:27 +03:00
test Merge pull request #4226 from PastaPastaPasta/backport-triv-pr6 2021-07-08 23:25:09 +03:00
addressbookpage.cpp bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
addressbookpage.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
addresstablemodel.cpp Merge #16674: refactor: remove obsolete qt algorithm usage 2021-07-12 20:52:56 -05:00
addresstablemodel.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
appearancewidget.cpp merge bitcoin#14555: Move util files to directory 2021-06-27 12:03:13 +05:30
appearancewidget.h qt: Fix some font weight related issues (#4131) 2021-05-06 13:15:47 -04:00
askpassphrasedialog.cpp Update copyright (#4115) 2021-04-20 22:33:02 +03:00
askpassphrasedialog.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
bantablemodel.cpp Merge #16674: refactor: remove obsolete qt algorithm usage 2021-07-12 20:52:56 -05:00
bantablemodel.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
bitcoinaddressvalidator.cpp Update copyright (#4115) 2021-04-20 22:33:02 +03:00
bitcoinaddressvalidator.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
bitcoinamountfield.cpp bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
bitcoinamountfield.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
bitcoingui.cpp Use one global string for "CoinJoin" in gui related stuff (#4117) 2021-07-11 12:28:50 +03:00
bitcoingui.h Merge #13528: qt: Move BitcoinGUI initializers to class, fix initializer order warning 2021-07-06 19:50:27 +03:00
bitcoinunits.cpp Merge #13264: [qt] Satoshi unit 2021-07-06 19:50:27 +03:00
bitcoinunits.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
callback.h Merge #10969: Declare single-argument (non-converting) constructors "explicit" 2020-01-10 10:33:57 -06:00
clientmodel.cpp Merge #11491: [gui] Add proxy icon in statusbar 2021-07-06 19:50:27 +03:00
clientmodel.h Merge #11491: [gui] Add proxy icon in statusbar 2021-07-06 19:50:27 +03:00
coincontroldialog.cpp Use one global string for "CoinJoin" in gui related stuff (#4117) 2021-07-11 12:28:50 +03:00
coincontroldialog.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
coincontroltreewidget.cpp Merge #10498: Use static_cast instead of C-style casts for non-fundamental types 2020-06-10 18:32:43 -05:00
coincontroltreewidget.h
csvmodelwriter.cpp Backport 11651 (#3358) 2020-03-20 01:46:56 +03:00
csvmodelwriter.h
dash_locale.qrc Translations 2020-01 (#3192) 2020-01-17 16:00:53 +01:00
dash.cpp Merge #13235: Break circular dependency: init -> * -> init by extracting shutdown.h 2021-07-02 00:42:18 +03:00
dash.qrc Merge #11491: [gui] Add proxy icon in statusbar 2021-07-06 19:50:27 +03:00
dashstrings.cpp qt: Transaltions202105 (#4137) 2021-05-12 00:56:24 +02:00
editaddressdialog.cpp Merge #12830: [qt] [tests] Clarify address book error messages, add tests 2021-05-23 01:24:26 +03:00
editaddressdialog.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
guiconstants.h qt: Make sure the statusbar reflects internal states correct (#3698) 2020-09-13 01:48:10 +03:00
guiutil.cpp Merge #14801: qt: Use window() instead of obsolete topLevelWidget() 2021-07-08 11:57:12 -05:00
guiutil.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
intro.cpp Merge #16971: qt: Change default size of intro frame 2021-07-13 13:14:02 -05:00
intro.h scripted-diff: Merge #12906: Avoid interface keyword to fix windows gitian build 2020-10-14 12:10:12 +01:00
macdockiconhandler.h Backport bitcoin#14123 and bitcoin#16720 (#3463) 2020-04-30 13:28:44 +03:00
macdockiconhandler.mm Merge #13458: gui: Drop qt4 support 2020-06-12 18:47:26 -03:00
macnotificationhandler.h Merge #11268: [macOS] remove Growl support, remove unused code 2020-01-10 10:33:55 -06:00
macnotificationhandler.mm Merge #14975: qt: Refactoring with QString::toNSString() 2021-07-08 11:57:14 -05:00
macos_appnap.h
macos_appnap.mm
masternodelist.cpp Extensive include refactoring (#4095) 2021-04-15 23:41:16 -04:00
masternodelist.h merge bitcoin#14555: Move util files to directory 2021-06-27 12:03:13 +05:30
modaloverlay.cpp qt: Fix font size and scaling issues (#3734) 2020-09-29 02:15:20 +03:00
modaloverlay.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
networkstyle.cpp merge bitcoin#14555: Move util files to directory 2021-06-27 12:03:13 +05:30
networkstyle.h Update copyright (#4115) 2021-04-20 22:33:02 +03:00
notificator.cpp Merge #15007: qt: Notificator class refactoring 2021-06-28 13:40:51 -05:00
notificator.h Merge #15007: qt: Notificator class refactoring 2021-06-28 13:40:51 -05:00
openuridialog.cpp Update copyright (#4115) 2021-04-20 22:33:02 +03:00
openuridialog.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
optionsdialog.cpp Use one global string for "CoinJoin" in gui related stuff (#4117) 2021-07-11 12:28:50 +03:00
optionsdialog.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
optionsmodel.cpp qt: Fix some font weight related issues (#4131) 2021-05-06 13:15:47 -04:00
optionsmodel.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
overviewpage.cpp Use one global string for "CoinJoin" in gui related stuff (#4117) 2021-07-11 12:28:50 +03:00
overviewpage.h refactor: PrivateSend -> CoinJoin + Move the tab (#4038) 2021-03-17 18:36:11 -04:00
paymentrequest.proto
paymentrequestplus.cpp merge bitcoin#14555: Move util files to directory 2021-06-27 12:03:13 +05:30
paymentrequestplus.h Merge #11372: Address encoding cleanup 2021-01-08 22:35:34 +03:00
paymentserver.cpp Merge #17031: gui: Prevent processing duplicate payment requests 2021-07-13 13:14:04 -05:00
paymentserver.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
peertablemodel.cpp Merge #16674: refactor: remove obsolete qt algorithm usage 2021-07-12 20:52:56 -05:00
peertablemodel.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
qrdialog.cpp Remove direct bitcoin calls from qt/optionsmodel.cpp 2020-10-03 21:36:27 +02:00
qrdialog.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
qvalidatedlineedit.cpp Backport 11651 (#3358) 2020-03-20 01:46:56 +03:00
qvalidatedlineedit.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
qvaluecombobox.cpp Backport 11651 (#3358) 2020-03-20 01:46:56 +03:00
qvaluecombobox.h
README.md Merge #13366: Docs: Rename “OS X” to the newer “macOS” convention 2021-06-28 02:31:48 +03:00
receivecoinsdialog.cpp Merge #9662: Add createwallet "disableprivatekeys" option: a sane mode for watchonly-wallets 2021-07-02 12:59:27 +03:00
receivecoinsdialog.h qt: Drop PlatformStyle (#3573) 2020-07-26 14:20:19 +03:00
receiverequestdialog.cpp qt: Fix font size and scaling issues (#3734) 2020-09-29 02:15:20 +03:00
receiverequestdialog.h Merge #12610: Multiwallet for the GUI 2020-07-20 10:09:19 -05:00
recentrequeststablemodel.cpp Merge #16674: refactor: remove obsolete qt algorithm usage 2021-07-12 20:52:56 -05:00
recentrequeststablemodel.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
rpcconsole.cpp Merge pull request #4225 from PastaPastaPasta/backport-triv-pr5 2021-07-04 00:07:27 +03:00
rpcconsole.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
sendcoinsdialog.cpp Merge #16964: gui: Change sendcoins dialogue Yes to Send 2021-07-13 13:14:03 -05:00
sendcoinsdialog.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
sendcoinsentry.cpp Update copyright (#4115) 2021-04-20 22:33:02 +03:00
sendcoinsentry.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
signverifymessagedialog.cpp Merge #13235: Break circular dependency: init -> * -> init by extracting shutdown.h 2021-07-02 00:42:18 +03:00
signverifymessagedialog.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
splashscreen.cpp Merge #13235: Break circular dependency: init -> * -> init by extracting shutdown.h 2021-07-02 00:42:18 +03:00
splashscreen.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
trafficgraphdata.cpp qt: Lower the number of data samples in TrafficGraphData to make it move much smoother (#3841) 2020-12-05 21:01:22 +00:00
trafficgraphdata.h qt: Finetune RPCConsole (#3720) 2020-09-21 14:22:04 +03:00
trafficgraphwidget.cpp scripted-diff: Merge #12906: Avoid interface keyword to fix windows gitian build 2020-10-14 12:10:12 +01:00
trafficgraphwidget.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
transactiondesc.cpp merge bitcoin#14555: Move util files to directory 2021-06-27 12:03:13 +05:30
transactiondesc.h scripted-diff: Merge #12906: Avoid interface keyword to fix windows gitian build 2020-10-14 12:10:12 +01:00
transactiondescdialog.cpp qt: Make sure font size in TransactionDescDialog is adjusted properly (#3707) 2020-09-16 12:14:09 +03:00
transactiondescdialog.h
transactionfilterproxy.cpp qt: Finetune OverviewPage (#3715) 2020-09-25 19:04:53 +03:00
transactionfilterproxy.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
transactionrecord.cpp Merge #12830: [qt] [tests] Clarify address book error messages, add tests 2021-05-23 01:24:26 +03:00
transactionrecord.h Add/fix/tweak translated strings (#4052) 2021-03-24 13:13:25 +03:00
transactiontablemodel.cpp Merge #16674: refactor: remove obsolete qt algorithm usage 2021-07-12 20:52:56 -05:00
transactiontablemodel.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
transactionview.cpp Use one global string for "CoinJoin" in gui related stuff (#4117) 2021-07-11 12:28:50 +03:00
transactionview.h refactor: PrivateSend -> CoinJoin + Move the tab (#4038) 2021-03-17 18:36:11 -04:00
utilitydialog.cpp Use one global string for "CoinJoin" in gui related stuff (#4117) 2021-07-11 12:28:50 +03:00
utilitydialog.h bitcoin#18914: Apply override specifier consistently 2021-06-17 11:25:48 +05:30
walletframe.cpp Merge #13111: Add unloadwallet RPC 2021-04-05 03:31:50 +02:00
walletframe.h refactor: PrivateSend -> CoinJoin + Move the tab (#4038) 2021-03-17 18:36:11 -04:00
walletmodel.cpp Merge #9662: Add createwallet "disableprivatekeys" option: a sane mode for watchonly-wallets 2021-07-02 12:59:27 +03:00
walletmodel.h Merge #9662: Add createwallet "disableprivatekeys" option: a sane mode for watchonly-wallets 2021-07-02 12:59:27 +03:00
walletmodeltransaction.cpp Merge #11372: Address encoding cleanup 2021-01-08 22:35:34 +03:00
walletmodeltransaction.h scripted-diff: Merge #12906: Avoid interface keyword to fix windows gitian build 2020-10-14 12:10:12 +01:00
walletview.cpp Add/fix/tweak translated strings (#4052) 2021-03-24 13:13:25 +03:00
walletview.h refactor: PrivateSend -> CoinJoin + Move the tab (#4038) 2021-03-17 18:36:11 -04:00
winshutdownmonitor.cpp Merge #13235: Break circular dependency: init -> * -> init by extracting shutdown.h 2021-07-02 00:42:18 +03:00
winshutdownmonitor.h Merge #13458: gui: Drop qt4 support 2020-06-12 18:47:26 -03:00

This directory contains the DashQT 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 not supported.

Compile and run

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

To run:

./src/qt/dash-qt

Files and directories

forms

Contains Designer UI files. They are created with Qt Creator, 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 Dash 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 dash:... 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 macOS

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 macOS:

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