diff --git a/src/CameraImageWrapper.cpp b/src/CameraImageWrapper.cpp index 026cfb5..a51dd8c 100644 --- a/src/CameraImageWrapper.cpp +++ b/src/CameraImageWrapper.cpp @@ -9,7 +9,11 @@ CameraImageWrapper::CameraImageWrapper() : LuminanceSource(0,0), image(NULL) CameraImageWrapper::CameraImageWrapper(const QImage &sourceImage) : LuminanceSource(sourceImage.width(), sourceImage.height()) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) image = grayScaleImage( &sourceImage ); +#else + image = new QImage(sourceImage); +#endif delegate = Ref( new GreyscaleLuminanceSource(getMatrixP(),image->width(), image->height(),0, 0, image->width(), image->height())); } @@ -42,6 +46,7 @@ CameraImageWrapper *CameraImageWrapper::Factory(const QImage &sourceImage, int m return new CameraImageWrapper(sourceImage); } +#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) QImage* CameraImageWrapper::grayScaleImage(const QImage *origin) { QImage *tmp = new QImage(origin->width(), origin->height(), QImage::Format_Grayscale8); @@ -58,7 +63,7 @@ QImage* CameraImageWrapper::grayScaleImage(const QImage *origin) return tmp; } - +#endif QImage CameraImageWrapper::getOriginalImage() { return *image; @@ -128,8 +133,14 @@ ArrayRef CameraImageWrapper::getRowP(int y, ArrayRef row) const row.reset(ArrayRef(width)); for (int x = 0; x < width; x++) + { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) row[x] = image->pixel(x,y); - +#else + QRgb pixel = image->pixel(x,y); + row[x] = qGray(pixel); +#endif + } return row; } diff --git a/src/CameraImageWrapper.h b/src/CameraImageWrapper.h index 9e37b5b..64904a8 100644 --- a/src/CameraImageWrapper.h +++ b/src/CameraImageWrapper.h @@ -32,8 +32,9 @@ public: private: ArrayRef getRowP(int y, ArrayRef row) const; ArrayRef getMatrixP() const; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) QImage* grayScaleImage(const QImage *origin); - +#endif unsigned int gray(unsigned int r, unsigned int g, unsigned int b); QImage* image; diff --git a/src/QZXing.pri b/src/QZXing.pri index 8862bac..7bacf84 100644 --- a/src/QZXing.pri +++ b/src/QZXing.pri @@ -258,15 +258,30 @@ symbian { Location } -unix:!symbian { - maemo5 { - target.path = /opt/usr/lib - } else { - target.path = /usr/lib +!symbian { + isEmpty(PREFIX) { + maemo5 { + target.path = /opt/usr/lib + } else { + target.path = /usr/lib + } } DEFINES += NOFMAXL - INSTALLS += target + + # Installation + headers.files = qzxing.h QZXing_global.h + headers.path = $$PREFIX/include + target.path = $$PREFIX/lib + INSTALLS += headers target + + # pkg-config support + CONFIG += create_pc create_prl no_install_prl + QMAKE_PKGCONFIG_DESTDIR = pkgconfig + QMAKE_PKGCONFIG_LIBDIR = ${prefix}/lib + QMAKE_PKGCONFIG_INCDIR = ${prefix}/include + + unix:QMAKE_CLEAN += -r pkgconfig lib$${TARGET}.prl } win32-msvc*{