QR Code generation via libqrencode #629

pull sje397 wants to merge 1 commits into bitcoin:master from sje397:master changing 13 files +434 −7
  1. sje397 commented at 2:43 PM on November 10, 2011: contributor

    Added QR Code generation button to address book page, a dialog to display the result including fields for label, message, and request amount (the latter visible only for personal addresses). Images can be saved to disk. Codes use the 'bitcoin' URI scheme described here: https://en.bitcoin.it/wiki/URI_Scheme

    Enabled via qmake option 'USE_QRC'.

  2. luke-jr commented at 4:03 PM on November 10, 2011: member

    Basic code/UI ACK except for a couple of minor issues:

    • USE_QRC might be confused with Qt Resource Compiler (or whatever 'qrc' is), maybe USE_QRCODE ?
    • QR Codes are set to "text" instead of "URI"
  3. sje397 commented at 10:27 PM on November 10, 2011: contributor

    Thanks luke-jr. I'll change the define to USE_QRCODE. The library only supports the following encoding modes though...what is type 'URI' under the surface?

    /**

    • Encoding mode. */ typedef enum { QR_MODE_NUL = -1, ///< Terminator (NUL character). Internal use only QR_MODE_NUM = 0, ///< Numeric mode QR_MODE_AN, ///< Alphabet-numeric mode QR_MODE_8, ///< 8-bit data mode QR_MODE_KANJI, ///< Kanji (shift-jis) mode QR_MODE_STRUCTURE, ///< Internal use only QR_MODE_ECI, ///< ECI mode QR_MODE_FNC1FIRST, ///< FNC1, first position QR_MODE_FNC1SECOND, ///< FNC1, second position } QRencodeMode;
  4. luke-jr commented at 10:59 PM on November 10, 2011: member

    Nevermind the mode thing. Looks like the problem is with my QR Code reader "detecting" URI vs text based on the content. :/

  5. sje397 commented at 8:03 AM on November 11, 2011: contributor

    Ok, change pushed.

  6. luke-jr commented at 3:02 PM on November 11, 2011: member

    ACK

  7. laanwj commented at 2:49 PM on November 12, 2011: member

    Neat! ACK.

    Can you squash/rebase these into one commit?

  8. sje397 commented at 2:55 PM on November 12, 2011: contributor

    Squashed.

  9. laanwj commented at 3:10 PM on November 12, 2011: member

    Thanks.

    Some small issues:

    • It doesn't build in qt creator without libqrcode (even if USE_QRCODE is not added); probably missing #ifdefs inside qrcodedialog.cpp

      ../bitcoin/src/qt/qrcodedialog.cpp:10: error: qrencode.h: No such file or directory

    • QRCodeDialog::genCode() is only called from the UI thread. Is it still neccesary to have it in a static critical section?

  10. sje397 commented at 3:17 PM on November 12, 2011: contributor

    Fixing now.

    The first issue involves adding the qrcodedialog to the project conditionally, so needs changes to the pro file.

    I'll fix the second. I was being overly attentive to the 'not thread safe' warning in the library docs.

  11. sje397 commented at 3:25 PM on November 12, 2011: contributor

    Done and resquashed.

  12. laanwj commented at 3:36 PM on November 12, 2011: member

    That's fast :) Now builds and runs on machine without the library.

    Also works great when enabled, I tried scanning it with my phone from the screen and it got it right the first time.

    Another small code issue:

    • AddressBookPage::on_showQRCode_clicked(): d = new QRCodeDialog causes a memory leak every time the dialog is opened (at least until the addressbookpage is destroyed). Better to simply use QRCodeDialog d(...
  13. sje397 commented at 3:43 PM on November 12, 2011: contributor

    Yeah that's not ideal as is.

    Using QRCodeDialog d(... as you suggest though causes the dialog to be destroyed immediately as the variable goes out of scope. Are you suggesting it (and not 'they') should be modal?

  14. sje397 commented at 3:45 PM on November 12, 2011: contributor

    How about I set the 'Qt::WA_DeleteOnClose' attribute on the qrcodedialog widget instead?

  15. laanwj commented at 3:46 PM on November 12, 2011: member

    Sorry, I misunderstood. I thought that was the idea to be modal :-)

    Keep it as it is, it's fine. Qt has a flag to delete a window when closed, it might be useful to enable that, but I don't think this will ever be a big issue.

  16. sje397 commented at 3:49 PM on November 12, 2011: contributor

    Snap. I've set that flag and rebased again. 2:49am - g'night ;)

  17. laanwj commented at 3:50 PM on November 12, 2011: member

    Thanks. Goodnight!

  18. mikehearn commented at 11:00 AM on November 13, 2011: contributor

    Did you check if this is compatible with the Android Wallet app? I'm not sure exactly what format it's using.

  19. sje397 commented at 11:34 AM on November 13, 2011: contributor

    Sorry, I've only got access to my wife's rather ancient android phone which refuses to find the app in the app store for me or install the one I can find on the net.

    That app is using Google's ZXing library (http://code.google.com/p/zxing/), and I did test using http://zxing.org/w/decode.jspx which uses the same library.

    From what I can tell from the source, that app uses the same URI scheme also (the one at https://en.bitcoin.it/wiki/URI_Scheme). The alternative, x-btc (https://en.bitcoin.it/wiki/X-btc) seems a little less popular.

  20. mikehearn commented at 11:35 AM on November 13, 2011: contributor

    Great! If you send me a qrcode generated by this patch I can try scanning it.

  21. sje397 commented at 11:40 AM on November 13, 2011: contributor

    @mikehearn I can do that - what email?

  22. mikehearn commented at 11:41 AM on November 13, 2011: contributor

    mike@plan99.net

  23. luke-jr commented at 1:51 PM on November 13, 2011: member

    If the Android app isn't standards compliant, then it should be fixed. That is IMO outside the scope of this pull request. If libqrcode isn't standards compliant, it also should be fixed and is outside the scope of this code as well. I did confirm that it works with my N900's QR Code reader (mBarcode on Maemo), except for being detected as a URI (I presume they're using a known URI scheme list).

  24. mikehearn commented at 1:53 PM on November 13, 2011: contributor

    It works with the Android app :) It's best to do interop testing early so issues can be found wherever they lie. Seems like the app doesn't use the label/message fields though.

  25. luke-jr commented at 1:56 PM on November 13, 2011: member

    Most apps don't, I think.

  26. gavinandresen commented at 8:45 PM on December 19, 2011: contributor

    NACK: see http://imgur.com/Ljrgg On my Mac, showing the QR code for one of my receiving addresses I get too-skinny-text-boxes for Label and Message.

  27. gavinandresen commented at 8:49 PM on December 19, 2011: contributor

    Really cool feature, by the way.

    But could you also update doc/build-*.txt for instructions on how to get libqrencode (on the mac, 'port install qrencode' works nicely)

    It'd be really nice if the contrib/gitian-descriptors/gitian-*.yml files were modified to build with qrencode support, too...

  28. Added QRCode generation functions via libqrencode. Switch on with USE_QRENCODE=1.
    Amended build docs for Linux and OSX, and OSX makefile.
    Added package 'qrencode' to gitian.yml
    22123c85f3
  29. sje397 commented at 11:16 AM on December 20, 2011: contributor

    Hi Gavin - I reorganised the dialog and added minimum sizes to those fields. I updated the Linux and OSX build docs, and added the 'qrencode' package to the gitian.yml file. I don't have a windows dev box to do any testing there or any experience with gitian builds so I'm reluctant to get into that stuff. I also updated makefile.osx to link qrencode (dynamically) if USE_QRCODE=1 is set - but again I don't have a Mac here to test.

  30. sje397 closed this on Dec 20, 2011

  31. sje397 reopened this on Dec 20, 2011

  32. laanwj referenced this in commit 96b1e085c3 on Dec 23, 2011
  33. laanwj merged this on Dec 23, 2011
  34. laanwj closed this on Dec 23, 2011

  35. coblee referenced this in commit ee2f046403 on Jul 17, 2012
  36. ptschip referenced this in commit ff99effdea on Jun 1, 2017
  37. fjahr referenced this in commit e541a90ef6 on Jul 24, 2019
  38. elichai referenced this in commit 461acf5c6c on Aug 22, 2019
  39. sipa referenced this in commit 6b9cd1520b on Sep 24, 2019
  40. kallewoof referenced this in commit a6beb256ed on Oct 4, 2019
  41. kallewoof referenced this in commit c866f52e2a on Oct 4, 2019
  42. sipa referenced this in commit 544c1f35e7 on Nov 6, 2019
  43. sipa referenced this in commit d5cd9db7a3 on Nov 19, 2019
  44. sipa referenced this in commit de659898b6 on Jan 21, 2020
  45. sipa referenced this in commit 36362dfb90 on Jan 23, 2020
  46. jnewbery referenced this in commit 85e7d06351 on Mar 17, 2020
  47. sipa referenced this in commit 4977ac14d3 on Mar 18, 2020
  48. sipa referenced this in commit 5bf7fb5baa on Mar 18, 2020
  49. sipa referenced this in commit fb2a05e468 on Mar 19, 2020
  50. sipa referenced this in commit 497fad6f09 on Mar 21, 2020
  51. sipa referenced this in commit eae016f117 on Mar 22, 2020
  52. sipa referenced this in commit 4e37a7c2cb on Mar 27, 2020
  53. jnewbery referenced this in commit 9696dea839 on Apr 16, 2020
  54. jnewbery referenced this in commit a541fd0e87 on Apr 19, 2020
  55. sipa referenced this in commit c308759ea5 on Apr 19, 2020
  56. sipa referenced this in commit 4eaec32f1c on May 2, 2020
  57. sipa referenced this in commit ef7117193c on May 22, 2020
  58. sipa referenced this in commit 67f232b5d8 on Jun 9, 2020
  59. stackman27 referenced this in commit 78cde6f8c7 on Jun 26, 2020
  60. KolbyML referenced this in commit bc86927231 on Sep 4, 2020
  61. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me