Merge lp://staging/~dpm/qreator/touch-scanner into lp://staging/qreator/touch
Status: | Merged |
---|---|
Merged at revision: | 16 |
Proposed branch: | lp://staging/~dpm/qreator/touch-scanner |
Merge into: | lp://staging/qreator/touch |
Diff against target: |
4388 lines (+4189/-50) 12 files modified
.bzrignore (+2/-0) js/jsqrcode-combined.js (+3748/-0) qreator-touch.qml (+49/-16) qreator/Creator.qml (+0/-17) qreator/Decoder.qml (+68/-0) qreator/DeviceOrientation.qml (+37/-0) qreator/History.qml (+2/-2) qreator/QrCodeCanvas.qml (+4/-4) qreator/QrCodeDialog.qml (+44/-0) qreator/QrCodeToolbar.qml (+13/-2) qreator/Scanner.qml (+185/-9) qreator/UploadImageDialog.qml (+37/-0) |
To merge this branch: | bzr merge lp://staging/~dpm/qreator/touch-scanner |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Schwarzburg | Approve | ||
Review via email:
|
Description of the change
This branch implements the initial scanning support for Qreator
# Choice of decoding backend
I've tried hard to use the JavaScript backend, but due to either the camera, JavaScript limitations, or my own limitations in JavaScript knowledge, I've not managed to get it working in a way that it offers acceptable performance on a device.
In any case, I've abstracted the decoding backend in a Decoder component, and I'll leave the JavaScript backend in the source tree for a few revisions for testing purposes and in case we need to review the decision. Switching backends is as easy as setting the useJsbackend boolean property of the Decoder component.
The main issue is that for the decoding to be fast (as in less than 30 seconds) on a device, the picture taken needs to be downscaled to about 640px width. The C++ backend does that without trouble, but I've not found a way to do it with JavaScript. Downscaling the resolution at the camera level before passing the image to the decoding backend was something else I tried, but first the camera needs to be queried for supported resolutions (otherwise if I just set its resolution to 640x480 it might or might not work), and there seems to be no way to do that in QML.
Therefore, given the fact that it's working already, I've chosen to use the C++ plugin. This means that for either developing or running Qreator the qtdeclarative5-
I want to consider the decoding backend as a library (i.e. a black box with interfaces) and it not be the focus of development. It just needs a bit of polish right now, but I hope to have it done in a couple of days.
# Caveats
• Decoding is not yet automated (e.g. with a timer), in the sense that the user has to take the picture himself/herself by revealing the toolbar on the scan page and press the "Decode" action. A further iteration of the scanner will implement automatic decoding.
• The camera is always active when Qreator is running. In a further iteration we'll need to deactivate it when a) the app loses focus and b) when we switch away from the Scanner tab to another one
• The "Open" action on the dialog shown upon successful decoding does nothing yet
• There is an issue whereby the root page of the PageStack in the Create tab allows a toolbar to be revealed, when in fact there should not be any toolbar there. It seems to happen only the first time the root page is shown. Perhaps an SDK bug?
# Camera caveats
For all its awesomeness and plug-and-play feel, the QML camera component has also been a source of headaches:
• When using camera.
• There is no way to tell the camera not to store the pictures on the filesystem, and e.g. simply pass the in-memory preview to the decoder. It's nice to be able to store the pictures taken, but we cannot do it when scanning for codes automatically, as we'd be filling the filesystem with pictures taken every half a second or so. An option might be
just to delete the files from the filesystem via the C++ plugin.
• Cannot query device resolutions from the camera, thus there is no guarantee a given resolution will be set. I.e. we cannot use a low resolution to scan images, they need to be downscaled afterwards
[1] https:/
Hi David,
First of all: Really great work!
I played with it on the desktop and it worked quite well (except for the camera..., now I have also pictures that are half bright, half dark :-) but thats another topic...).
I'm not surprised about the increase of performance with C++, and I think we should keep that in mind as advice for others and ourselves in the future: QML/JS for the interface, C++ for intensive tasks. On mobile devices, snappy applications are important!
I do have a few minor questions:
- you wrote "qt5declarative -qzxing- plugin" , but you meant "qtdeclarative5 -qzxing- plugin" , right?
- Did you remove the history tab since it is still empty, or did you change your mind about including it as a tab, or do you want it removed in general?
- I guess that the debug tab is just there temporary? Do you want to remove it for every release but keep it there in-between releases?
As I said, great work!