src: Support Ubuntu Touch in QZXingFilter

With qtubuntu-camera gaining basic viewfinder mapping support it
is possible to make use of QZXingFilter in Ubuntu Touch apps.

Consumers of the library may either use 'CONFIG+=ubports' in their
qmake projects, or define Q_OS_UBUNTUTOUCH themselves when using
CMake since QZXing can easily be built as a subproject.
This commit is contained in:
Alfred Neumayer 2022-08-17 07:44:48 +02:00
parent 6ea2b31e26
commit 5de416671e
2 changed files with 5 additions and 1 deletions

View File

@ -450,6 +450,10 @@ unix {
DEFINES += NOFMAXL
contains( CONFIG, ubports) {
DEFINES += Q_OS_UBUNTUTOUCH
}
contains( CONFIG, sailfishapp) {
DEFINES += Q_OS_SAILFISH
} else {

View File

@ -196,7 +196,7 @@ static QImage* rgbDataToGrayscale(const uchar* data, const CaptureRect& captureR
for (int y = 1; y <= captureRect.targetHeight; ++y) {
//Quick fix for iOS & macOS devices. Will be handled better in the future
#if defined(Q_OS_IOS) || defined (Q_OS_MAC) || defined(Q_OS_SAILFISH)
#if defined(Q_OS_IOS) || defined (Q_OS_MAC) || defined(Q_OS_SAILFISH) || defined(Q_OS_UBUNTUTOUCH)
uchar* pixel = pixelInit + (y - 1) * captureRect.targetWidth;
#else
uchar* pixel = pixelInit + (captureRect.targetHeight - y) * captureRect.targetWidth;