In the send-sweep module as well as in the PayWithQR this removes
the UserIntent handling and instead moves that to the main.qml
exclusively.
Additionally in the send-sweep module the camera work is split
into its own page, like in the other parts of the app. This helps
us avoiding hacks when we want the main functionality without the
camera.
This is the last of the series of reworks, we should have all
former functionality working again.
The initial design has done well for over 2 years, but problems
are starting to show.
This does a bit of cleanup in the UX and many cleanups in the
underlying architecture that were the result of those UX choices.
We remove the clipboard (paste) concept from the camera pipeline
completely and simply make it a new top-level button "paste" on the
send page. This helps discovery AND helps architecture!
The both workflows now also become 2 stage affairs, when the button
is pressed we open a page that does the scanning or pasting and then
introspects the actual data in order to redirect to the right page.
This means that we auto-detect if the scanned item is an address or
a private key or whatever, and handle it appropriately without needing
any user interaction.
After working on android and the qtmultimedia library for a week,
I have a much better understanding of what works and what doesn't.
The resulting design is thus presented. We will have one
CameraController class which refers to one overlay panel in QML
and in different places in the GUI objects based on QRScanner
can be created to initiate a scan.
This additionally moves the actual scanning out of the GUI thread
since blocking that is a no-no.
Now to move towards actually supporting scanning usecases.
This takes the camera feed and pipes it through the ZXing (pronounced
zebra-crossing) library which detects the barcodes in the image.
When we find it, we pluck out the text.
This makes it possible for the mobile app on Android to use the camera.
We only ask for permission when the user actively goes to the 'QR-Scan'
tab, and we show a simple preview of the camera feed.
Notice that the permissions stuff is quite ugly right now due to Qt
having that module in development and the public APIs are simply not
available yet. But at least it works, which is all that matters.
When the next minor Qt release comes out we can hopefully clean this
up and use a version that needs no ifdefs.