Added the support of DataMatrix decoding. Trying to fix the Decoder Selection but still has a few problems.

This commit is contained in:
favoritas37 2011-11-26 14:59:57 +02:00
parent 47c9f4538b
commit 0942470215
36 changed files with 173 additions and 180 deletions

View File

@ -41,6 +41,7 @@ QQrDecoder::QQrDecoder(QWidget *parent): QMainWindow(parent), decoder(this)
ui.setupUi(this); ui.setupUi(this);
connect(ui.centralwidget, SIGNAL(imageCaptured(QImage)), this, SLOT(decodeImage(QImage))); connect(ui.centralwidget, SIGNAL(imageCaptured(QImage)), this, SLOT(decodeImage(QImage)));
connect(&decoder, SIGNAL(tagFound(QString)), this, SLOT(reportTagFound(QString))); connect(&decoder, SIGNAL(tagFound(QString)), this, SLOT(reportTagFound(QString)));
//decoder.setDecoder( QZXing::DecoderFormat_DATA_MATRIX);//DecoderFormat_QR_CODE | DecoderFormat_EAN_13 );
} }
QQrDecoder::~QQrDecoder() QQrDecoder::~QQrDecoder()

View File

@ -36,8 +36,6 @@
#include "ui_QQrDecoder.h" #include "ui_QQrDecoder.h"
#include <qzxing.h> #include <qzxing.h>
#include "CameraImageWrapper.h"
class QQrDecoder : public QMainWindow class QQrDecoder : public QMainWindow
{ {
Q_OBJECT Q_OBJECT

View File

@ -43,12 +43,6 @@ symbian{
" " " "
DEPLOYMENT += customrules DEPLOYMENT += customrules
} }
else{
DEFINES += NO_ICONV
}
DEFINES += ZXING_ICONV_CONST
ICON = QQrDecoder.svg ICON = QQrDecoder.svg

View File

@ -0,0 +1,22 @@
// ============================================================================
// * Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-11-26T14:57:01
// * This file is generated by qmake and should not be modified by the
// * user.
// ============================================================================
CHARACTER_SET UTF8
#include <appinfo.rh>
#include "QQrDecoder.loc"
RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info
{
short_caption = STRING_r_short_caption;
caption_and_icon =
CAPTION_AND_ICON_INFO
{
caption = STRING_r_caption;
number_of_icons = 1;
icon_file = "\\resource\\apps\\QQrDecoder.mif";
};
}

Binary file not shown.

View File

@ -0,0 +1,18 @@
// ============================================================================
// * Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-11-26T14:57:01
// * This file is generated by qmake and should not be modified by the
// * user.
// ============================================================================
#include <QQrDecoder.rsg>
#include <appinfo.rh>
UID2 KUidAppRegistrationResourceFile
UID3 0xEF2CE79D
RESOURCE APP_REGISTRATION_INFO
{
app_file="QQrDecoder";
localisable_resource_file="\\resource\\apps\\QQrDecoder";
}

View File

@ -5,6 +5,10 @@
#include <QObject> #include <QObject>
#include <QImage> #include <QImage>
#if QT_VERSION >= 0x040700
#include <QtDeclarative>
#endif
/** /**
* A class containing a very very small subset of the ZXing library. * A class containing a very very small subset of the ZXing library.
* Created for ease of use. * Created for ease of use.
@ -15,20 +19,22 @@
* Regarding DecoderFormat, by default all of those are enabled (except DataMatrix will is still not supported) * Regarding DecoderFormat, by default all of those are enabled (except DataMatrix will is still not supported)
*/ */
class QZXINGSHARED_EXPORT QZXing : public QObject{ class QZXINGSHARED_EXPORT QZXing : public QObject{
Q_OBJECT Q_OBJECT
Q_ENUMS(DecoderFormat)
public: public:
enum DecoderFormat { enum DecoderFormat {
DecoderFormat_None = 0, DecoderFormat_None = 0,
DecoderFormat_QR_CODE, DecoderFormat_QR_CODE = 1,
DecoderFormat_DATA_MATRIX, DecoderFormat_DATA_MATRIX = 2,
DecoderFormat_UPC_E, DecoderFormat_UPC_E = 4,
DecoderFormat_UPC_A, DecoderFormat_UPC_A = 8,
DecoderFormat_EAN_8, DecoderFormat_EAN_8 = 16,
DecoderFormat_EAN_13, DecoderFormat_EAN_13 = 32,
DecoderFormat_CODE_128, DecoderFormat_CODE_128 = 64,
DecoderFormat_CODE_39, DecoderFormat_CODE_39 = 128,
DecoderFormat_ITF DecoderFormat_ITF = 256
} ; } ;
typedef unsigned int DecoderFormatType;
public: public:
QZXing(QObject *parent = NULL); QZXing(QObject *parent = NULL);
@ -38,7 +44,14 @@ public:
* As argument it is possible to pass conjuction of decoders by using logic OR. * As argument it is possible to pass conjuction of decoders by using logic OR.
* e.x. setDecoder ( DecoderFormat_QR_CODE | DecoderFormat_EAN_13 | DecoderFormat_CODE_39 ) * e.x. setDecoder ( DecoderFormat_QR_CODE | DecoderFormat_EAN_13 | DecoderFormat_CODE_39 )
*/ */
void setDecoder(DecoderFormat hint); void setDecoder(DecoderFormatType hint);
#if QT_VERSION >= 0x040700
static void registerQMLTypes()
{
qmlRegisterType<QZXing>("QZXing", 1, 0, "QZXing");
}
#endif
public slots: public slots:
/** /**
@ -54,6 +67,7 @@ signals:
private: private:
void* decoder; void* decoder;
DecoderFormatType supportedFormats;
}; };
#endif // QZXING_H #endif // QZXING_H

Binary file not shown.

View File

@ -24,16 +24,17 @@ class QZXINGSHARED_EXPORT QZXing : public QObject{
public: public:
enum DecoderFormat { enum DecoderFormat {
DecoderFormat_None = 0, DecoderFormat_None = 0,
DecoderFormat_QR_CODE, DecoderFormat_QR_CODE = 1,
DecoderFormat_DATA_MATRIX, DecoderFormat_DATA_MATRIX = 2,
DecoderFormat_UPC_E, DecoderFormat_UPC_E = 4,
DecoderFormat_UPC_A, DecoderFormat_UPC_A = 8,
DecoderFormat_EAN_8, DecoderFormat_EAN_8 = 16,
DecoderFormat_EAN_13, DecoderFormat_EAN_13 = 32,
DecoderFormat_CODE_128, DecoderFormat_CODE_128 = 64,
DecoderFormat_CODE_39, DecoderFormat_CODE_39 = 128,
DecoderFormat_ITF DecoderFormat_ITF = 256
} ; } ;
typedef unsigned int DecoderFormatType;
public: public:
QZXing(QObject *parent = NULL); QZXing(QObject *parent = NULL);
@ -43,7 +44,7 @@ public:
* As argument it is possible to pass conjuction of decoders by using logic OR. * As argument it is possible to pass conjuction of decoders by using logic OR.
* e.x. setDecoder ( DecoderFormat_QR_CODE | DecoderFormat_EAN_13 | DecoderFormat_CODE_39 ) * e.x. setDecoder ( DecoderFormat_QR_CODE | DecoderFormat_EAN_13 | DecoderFormat_CODE_39 )
*/ */
void setDecoder(DecoderFormat hint); void setDecoder(DecoderFormatType hint);
#if QT_VERSION >= 0x040700 #if QT_VERSION >= 0x040700
static void registerQMLTypes() static void registerQMLTypes()
@ -66,6 +67,7 @@ signals:
private: private:
void* decoder; void* decoder;
DecoderFormatType supportedFormats;
}; };
#endif // QZXING_H #endif // QZXING_H

View File

@ -33,6 +33,7 @@ HEADERS += zxing/BarcodeFormat.h \
zxing/ResultPoint.h \ zxing/ResultPoint.h \
zxing/ResultPointCallback.h \ zxing/ResultPointCallback.h \
zxing/FormatException.h \ zxing/FormatException.h \
zxing/NotFoundException.h \
zxing/common/StringUtils.h \ zxing/common/StringUtils.h \
zxing/common/CharacterSetECI.h \ zxing/common/CharacterSetECI.h \
zxing/common/ECI.h \ zxing/common/ECI.h \
@ -57,6 +58,8 @@ HEADERS += zxing/BarcodeFormat.h \
zxing/common/reedsolomon/GF256Poly.h \ zxing/common/reedsolomon/GF256Poly.h \
zxing/common/reedsolomon/ReedSolomonDecoder.h \ zxing/common/reedsolomon/ReedSolomonDecoder.h \
zxing/common/reedsolomon/ReedSolomonException.h \ zxing/common/reedsolomon/ReedSolomonException.h \
zxing/common/detector/MonochromeRectangleDetector.h \
zxing/common/detector/WhiteRectangleDetector.h \
zxing/oned/Code128Reader.h \ zxing/oned/Code128Reader.h \
zxing/oned/Code39Reader.h \ zxing/oned/Code39Reader.h \
zxing/oned/EAN13Reader.h \ zxing/oned/EAN13Reader.h \
@ -86,6 +89,16 @@ HEADERS += zxing/BarcodeFormat.h \
zxing/qrcode/detector/FinderPatternFinder.h \ zxing/qrcode/detector/FinderPatternFinder.h \
zxing/qrcode/detector/FinderPatternInfo.h \ zxing/qrcode/detector/FinderPatternInfo.h \
zxing/qrcode/detector/QREdgeDetector.h \ zxing/qrcode/detector/QREdgeDetector.h \
zxing/datamatrix/VersionDM.h \
zxing/datamatrix/DataMatrixReader.h \
zxing/datamatrix/decoder/BitMatrixParserDM.h \
zxing/datamatrix/decoder/DataBlockDM.h \
zxing/datamatrix/decoder/DecodedBitStreamParserDM.h \
zxing/datamatrix/decoder/DecoderDM.h \
zxing/datamatrix/detector/CornerPoint.h \
zxing/datamatrix/detector/DetectorDM.h \
zxing/datamatrix/detector/DetectorException.h \
zxing/datamatrix/detector/MonochromeRectangleDetectorDM.h \
QZXing_global.h \ QZXing_global.h \
CameraImageWrapper.h \ CameraImageWrapper.h \
qzxing.h qzxing.h
@ -103,6 +116,7 @@ SOURCES += zxing/BarcodeFormat.cpp \
zxing/ResultPoint.cpp \ zxing/ResultPoint.cpp \
zxing/ResultPointCallback.cpp \ zxing/ResultPointCallback.cpp \
zxing/FormatException.cpp \ zxing/FormatException.cpp \
zxing/NotFoundException.cpp \
zxing/common/StringUtils.cpp \ zxing/common/StringUtils.cpp \
zxing/common/CharacterSetECI.cpp \ zxing/common/CharacterSetECI.cpp \
zxing/common/ECI.cpp \ zxing/common/ECI.cpp \
@ -126,6 +140,8 @@ SOURCES += zxing/BarcodeFormat.cpp \
zxing/common/reedsolomon/GF256Poly.cpp \ zxing/common/reedsolomon/GF256Poly.cpp \
zxing/common/reedsolomon/ReedSolomonDecoder.cpp \ zxing/common/reedsolomon/ReedSolomonDecoder.cpp \
zxing/common/reedsolomon/ReedSolomonException.cpp \ zxing/common/reedsolomon/ReedSolomonException.cpp \
zxing/common/detector/MonochromeRectangleDetector.cpp \
zxing/common/detector/WhiteRectangleDetector.cpp \
zxing/oned/Code128Reader.cpp \ zxing/oned/Code128Reader.cpp \
zxing/oned/Code39Reader.cpp \ zxing/oned/Code39Reader.cpp \
zxing/oned/EAN13Reader.cpp \ zxing/oned/EAN13Reader.cpp \
@ -155,23 +171,33 @@ SOURCES += zxing/BarcodeFormat.cpp \
zxing/qrcode/detector/FinderPatternFinder.cpp \ zxing/qrcode/detector/FinderPatternFinder.cpp \
zxing/qrcode/detector/FinderPatternInfo.cpp \ zxing/qrcode/detector/FinderPatternInfo.cpp \
zxing/qrcode/detector/QREdgeDetector.cpp \ zxing/qrcode/detector/QREdgeDetector.cpp \
zxing/datamatrix/VersionDM.cpp \
zxing/datamatrix/DataMatrixReader.cpp \
zxing/datamatrix/decoder/BitMatrixParserDM.cpp \
zxing/datamatrix/decoder/DataBlockDM.cpp\
zxing/datamatrix/decoder/DecodedBitStreamParserDM.cpp \
zxing/datamatrix/decoder/DecoderDM.cpp \
zxing/datamatrix/detector/CornerPoint.cpp \
zxing/datamatrix/detector/DetectorDM.cpp \
zxing/datamatrix/detector/DetectorException.cpp \
zxing/datamatrix/detector/MonochromeRectangleDetectorDM.cpp \
CameraImageWrapper.cpp \ CameraImageWrapper.cpp \
qzxing.cpp qzxing.cpp
symbian { symbian {
MMP_RULES += EXPORTUNFROZEN #MMP_RULES += EXPORTUNFROZEN
TARGET.UID3 = 0xE618743C TARGET.UID3 = 0xE618743C
TARGET.EPOCALLOWDLLDATA = 1 TARGET.EPOCALLOWDLLDATA = 1
addFiles.sources = QZXing.dll addFiles.sources = QZXing.dll
addFiles.path = !:/sys/bin addFiles.path = !:/sys/bin
DEPLOYMENT += addFiles DEPLOYMENT += addFiles
TARGET.CAPABILITY = All -TCB -AllFiles -DRM #TARGET.CAPABILITY = All -TCB -AllFiles -DRM
#TARGET.CAPABILITY += NetworkServices \ TARGET.CAPABILITY += NetworkServices \
# ReadUserData \ ReadUserData \
# WriteUserData \ WriteUserData \
# LocalServices \ LocalServices \
# UserEnvironment \ UserEnvironment \
# Location Location
} }
unix:!symbian { unix:!symbian {

BIN
source/QZXing.sis Normal file

Binary file not shown.

View File

@ -9,8 +9,4 @@
# define QZXINGSHARED_EXPORT Q_DECL_IMPORT # define QZXINGSHARED_EXPORT Q_DECL_IMPORT
#endif #endif
#if defined(MSVC2008)
kyguig
#endif
#endif // QZXING_GLOBAL_H #endif // QZXING_GLOBAL_H

View File

@ -1,92 +0,0 @@
EXPORTS
_ZN6QZXing10setDecoderENS_13DecoderFormatE @ 1 NONAME
_ZN6QZXing11decodeImageE6QImage @ 2 NONAME
_ZN6QZXing11qt_metacallEN11QMetaObject4CallEiPPv @ 3 NONAME
_ZN6QZXing11qt_metacastEPKc @ 4 NONAME
_ZN6QZXing15decodingStartedEv @ 5 NONAME
_ZN6QZXing16decodingFinishedEb @ 6 NONAME
_ZN6QZXing16staticMetaObjectE @ 7 NONAME DATA 16
_ZN6QZXing19getStaticMetaObjectEv @ 8 NONAME
_ZN6QZXing8tagFoundE7QString @ 9 NONAME
_ZN6QZXingC1EP7QObject @ 10 NONAME
_ZN6QZXingC2EP7QObject @ 11 NONAME
_ZNK6QZXing10metaObjectEv @ 12 NONAME
_ZTI18CameraImageWrapper @ 13 NONAME
_ZTI6QZXing @ 14 NONAME
_ZTIN5zxing11ResultPointE @ 15 NONAME
_ZTIN5zxing12BinaryBitmapE @ 16 NONAME
_ZTIN5zxing15FormatExceptionE @ 17 NONAME
_ZTIN5zxing15HybridBinarizerE @ 18 NONAME
_ZTIN5zxing15LuminanceSourceE @ 19 NONAME
_ZTIN5zxing15ReaderExceptionE @ 20 NONAME
_ZTIN5zxing17MultiFormatReaderE @ 21 NONAME
_ZTIN5zxing19ResultPointCallbackE @ 22 NONAME
_ZTIN5zxing20ReedSolomonExceptionE @ 23 NONAME
_ZTIN5zxing24GlobalHistogramBinarizerE @ 24 NONAME
_ZTIN5zxing24GreyscaleLuminanceSourceE @ 25 NONAME
_ZTIN5zxing24IllegalArgumentExceptionE @ 26 NONAME
_ZTIN5zxing31GreyscaleRotatedLuminanceSourceE @ 27 NONAME
_ZTIN5zxing4oned10EAN8ReaderE @ 28 NONAME
_ZTIN5zxing4oned10OneDReaderE @ 29 NONAME
_ZTIN5zxing4oned10UPCAReaderE @ 30 NONAME
_ZTIN5zxing4oned10UPCEReaderE @ 31 NONAME
_ZTIN5zxing4oned11EAN13ReaderE @ 32 NONAME
_ZTIN5zxing4oned12Code39ReaderE @ 33 NONAME
_ZTIN5zxing4oned12UPCEANReaderE @ 34 NONAME
_ZTIN5zxing4oned13Code128ReaderE @ 35 NONAME
_ZTIN5zxing4oned21MultiFormatOneDReaderE @ 36 NONAME
_ZTIN5zxing4oned23MultiFormatUPCEANReaderE @ 37 NONAME
_ZTIN5zxing4oned9ITFReaderE @ 38 NONAME
_ZTIN5zxing6ReaderE @ 39 NONAME
_ZTIN5zxing6ResultE @ 40 NONAME
_ZTIN5zxing6qrcode12QRCodeReaderE @ 41 NONAME
_ZTIN5zxing6qrcode14QREdgeDetectorE @ 42 NONAME
_ZTIN5zxing6qrcode22AlignmentPatternFinderE @ 43 NONAME
_ZTIN5zxing6qrcode7VersionE @ 44 NONAME
_ZTIN5zxing6qrcode8DataMaskE @ 45 NONAME
_ZTIN5zxing6qrcode8DetectorE @ 46 NONAME
_ZTIN5zxing8BitArrayE @ 47 NONAME
_ZTIN5zxing9BinarizerE @ 48 NONAME
_ZTIN5zxing9BitMatrixE @ 49 NONAME
_ZTIN5zxing9ExceptionE @ 50 NONAME
_ZTIN5zxing9GF256PolyE @ 51 NONAME
_ZTV18CameraImageWrapper @ 52 NONAME
_ZTV6QZXing @ 53 NONAME
_ZTVN5zxing11ResultPointE @ 54 NONAME
_ZTVN5zxing12BinaryBitmapE @ 55 NONAME
_ZTVN5zxing15FormatExceptionE @ 56 NONAME
_ZTVN5zxing15HybridBinarizerE @ 57 NONAME
_ZTVN5zxing15LuminanceSourceE @ 58 NONAME
_ZTVN5zxing15ReaderExceptionE @ 59 NONAME
_ZTVN5zxing17MultiFormatReaderE @ 60 NONAME
_ZTVN5zxing19ResultPointCallbackE @ 61 NONAME
_ZTVN5zxing20ReedSolomonExceptionE @ 62 NONAME
_ZTVN5zxing24GlobalHistogramBinarizerE @ 63 NONAME
_ZTVN5zxing24GreyscaleLuminanceSourceE @ 64 NONAME
_ZTVN5zxing24IllegalArgumentExceptionE @ 65 NONAME
_ZTVN5zxing31GreyscaleRotatedLuminanceSourceE @ 66 NONAME
_ZTVN5zxing4oned10EAN8ReaderE @ 67 NONAME
_ZTVN5zxing4oned10OneDReaderE @ 68 NONAME
_ZTVN5zxing4oned10UPCAReaderE @ 69 NONAME
_ZTVN5zxing4oned10UPCEReaderE @ 70 NONAME
_ZTVN5zxing4oned11EAN13ReaderE @ 71 NONAME
_ZTVN5zxing4oned12Code39ReaderE @ 72 NONAME
_ZTVN5zxing4oned12UPCEANReaderE @ 73 NONAME
_ZTVN5zxing4oned13Code128ReaderE @ 74 NONAME
_ZTVN5zxing4oned21MultiFormatOneDReaderE @ 75 NONAME
_ZTVN5zxing4oned23MultiFormatUPCEANReaderE @ 76 NONAME
_ZTVN5zxing4oned9ITFReaderE @ 77 NONAME
_ZTVN5zxing6ReaderE @ 78 NONAME
_ZTVN5zxing6ResultE @ 79 NONAME
_ZTVN5zxing6qrcode12QRCodeReaderE @ 80 NONAME
_ZTVN5zxing6qrcode14QREdgeDetectorE @ 81 NONAME
_ZTVN5zxing6qrcode22AlignmentPatternFinderE @ 82 NONAME
_ZTVN5zxing6qrcode7VersionE @ 83 NONAME
_ZTVN5zxing6qrcode8DataMaskE @ 84 NONAME
_ZTVN5zxing6qrcode8DetectorE @ 85 NONAME
_ZTVN5zxing8BitArrayE @ 86 NONAME
_ZTVN5zxing9BinarizerE @ 87 NONAME
_ZTVN5zxing9BitMatrixE @ 88 NONAME
_ZTVN5zxing9ExceptionE @ 89 NONAME
_ZTVN5zxing9GF256PolyE @ 90 NONAME

View File

@ -9,44 +9,52 @@
using namespace zxing; using namespace zxing;
QZXing::QZXing(QObject *parent) : QObject(parent) QZXing::QZXing(QObject *parent) : QObject(parent), supportedFormats(511)
{ {
decoder = new MultiFormatReader(); decoder = new MultiFormatReader();
((MultiFormatReader*)decoder)->setHints(DecodeHints::DEFAULT_HINT); // setDecoder(DecoderFormat_QR_CODE |
// DecoderFormat_DATA_MATRIX |
// DecoderFormat_UPC_E |
// DecoderFormat_UPC_A |
// DecoderFormat_EAN_8 |
// DecoderFormat_EAN_13 |
// DecoderFormat_CODE_128 |
// DecoderFormat_CODE_39 |
// DecoderFormat_ITF);
} }
void QZXing::setDecoder(DecoderFormat hint) void QZXing::setDecoder(DecoderFormatType hint)
{ {
DecodeHints enabledDecoders; DecodeHints newHints;
if(hint & DecoderFormat_QR_CODE) if(hint & DecoderFormat_QR_CODE)
enabledDecoders.addFormat((BarcodeFormat)DecoderFormat_QR_CODE); newHints.addFormat((BarcodeFormat)DecoderFormat_QR_CODE);
if(hint & DecoderFormat_DATA_MATRIX) if(hint & DecoderFormat_DATA_MATRIX)
enabledDecoders.addFormat((BarcodeFormat)DecoderFormat_DATA_MATRIX); newHints.addFormat((BarcodeFormat)DecoderFormat_DATA_MATRIX);
if(hint & DecoderFormat_UPC_E) if(hint & DecoderFormat_UPC_E)
enabledDecoders.addFormat((BarcodeFormat)DecoderFormat_UPC_E); newHints.addFormat((BarcodeFormat)DecoderFormat_UPC_E);
if(hint & DecoderFormat_UPC_A) if(hint & DecoderFormat_UPC_A)
enabledDecoders.addFormat((BarcodeFormat)DecoderFormat_UPC_A); newHints.addFormat((BarcodeFormat)DecoderFormat_UPC_A);
if(hint & DecoderFormat_EAN_8) if(hint & DecoderFormat_EAN_8)
enabledDecoders.addFormat((BarcodeFormat)DecoderFormat_EAN_8); newHints.addFormat((BarcodeFormat)DecoderFormat_EAN_8);
if(hint & DecoderFormat_EAN_13) if(hint & DecoderFormat_EAN_13)
enabledDecoders.addFormat((BarcodeFormat)DecoderFormat_EAN_13); newHints.addFormat((BarcodeFormat)DecoderFormat_EAN_13);
if(hint & DecoderFormat_CODE_128) if(hint & DecoderFormat_CODE_128)
enabledDecoders.addFormat((BarcodeFormat)DecoderFormat_CODE_128); newHints.addFormat((BarcodeFormat)DecoderFormat_CODE_128);
if(hint & DecoderFormat_CODE_39) if(hint & DecoderFormat_CODE_39)
enabledDecoders.addFormat((BarcodeFormat)DecoderFormat_CODE_39); newHints.addFormat((BarcodeFormat)DecoderFormat_CODE_39);
if(hint & DecoderFormat_ITF) if(hint & DecoderFormat_ITF)
enabledDecoders.addFormat((BarcodeFormat)DecoderFormat_ITF); newHints.addFormat((BarcodeFormat)DecoderFormat_ITF);
((MultiFormatReader*)decoder)->setHints(enabledDecoders); supportedFormats = newHints.getCurrentHint();
} }
QString QZXing::decodeImage(QImage image) QString QZXing::decodeImage(QImage image)
@ -63,7 +71,7 @@ QString QZXing::decodeImage(QImage image)
Ref<BinaryBitmap> ref(bb); Ref<BinaryBitmap> ref(bb);
res = ((MultiFormatReader*)decoder)->decode(ref); res = ((MultiFormatReader*)decoder)->decode(ref, DecodeHints(supportedFormats));
QString string = QString(res->getText()->getText().c_str()); QString string = QString(res->getText()->getText().c_str());
emit tagFound(string); emit tagFound(string);

View File

@ -109,4 +109,9 @@ Ref<ResultPointCallback> DecodeHints::getResultPointCallback() const {
return callback; return callback;
} }
DecodeHintType DecodeHints::getCurrentHint()
{
return hints;
}
} /* namespace */ } /* namespace */

View File

@ -63,6 +63,7 @@ class DecodeHints {
void setResultPointCallback(Ref<ResultPointCallback> const&); void setResultPointCallback(Ref<ResultPointCallback> const&);
Ref<ResultPointCallback> getResultPointCallback() const; Ref<ResultPointCallback> getResultPointCallback() const;
DecodeHintType getCurrentHint();
}; };
} }

View File

@ -67,9 +67,9 @@ namespace zxing {
if (hints.containsFormat(BarcodeFormat_QR_CODE)) { if (hints.containsFormat(BarcodeFormat_QR_CODE)) {
readers_.push_back(Ref<Reader>(new zxing::qrcode::QRCodeReader())); readers_.push_back(Ref<Reader>(new zxing::qrcode::QRCodeReader()));
} }
// if (hints.containsFormat(BarcodeFormat_DATA_MATRIX)) { if (hints.containsFormat(BarcodeFormat_DATA_MATRIX)) {
// readers_.push_back(Ref<Reader>(new zxing::datamatrix::DataMatrixReader())); readers_.push_back(Ref<Reader>(new zxing::datamatrix::DataMatrixReader()));
// } }
//TODO: add PDF417 here once PDF417 reader is implemented //TODO: add PDF417 here once PDF417 reader is implemented
if (addOneDReader && tryHarder) { if (addOneDReader && tryHarder) {
readers_.push_back(Ref<Reader>(new zxing::oned::MultiFormatOneDReader(hints))); readers_.push_back(Ref<Reader>(new zxing::oned::MultiFormatOneDReader(hints)));

View File

@ -42,7 +42,7 @@ private:
Ref<BitMatrix> image_; Ref<BitMatrix> image_;
public: public:
MonochromeRectangleDetector(Ref<BitMatrix> image) : image_(image) { }; MonochromeRectangleDetector(Ref<BitMatrix> image) : image_(image) { }
std::vector<Ref<ResultPoint> > detect(); std::vector<Ref<ResultPoint> > detect();
@ -53,7 +53,7 @@ private:
Ref<TwoInts> blackWhiteRange(int fixedDimension, int maxWhiteRun, int minDim, int maxDim, Ref<TwoInts> blackWhiteRange(int fixedDimension, int maxWhiteRun, int minDim, int maxDim,
bool horizontal); bool horizontal);
int max(int a, float b) { return (float) a > b ? a : (int) b;}; int max(int a, float b) { return (float) a > b ? a : (int) b;}
}; };
} }

View File

@ -19,7 +19,7 @@
*/ */
#include <zxing/datamatrix/DataMatrixReader.h> #include <zxing/datamatrix/DataMatrixReader.h>
#include <zxing/datamatrix/detector/Detector.h> #include <zxing/datamatrix/detector/DetectorDM.h>
#include <iostream> #include <iostream>
namespace zxing { namespace zxing {

View File

@ -23,7 +23,7 @@
#include <zxing/Reader.h> #include <zxing/Reader.h>
#include <zxing/DecodeHints.h> #include <zxing/DecodeHints.h>
#include <zxing/datamatrix/decoder/Decoder.h> #include <zxing/datamatrix/decoder/DecoderDM.h>
namespace zxing { namespace zxing {
namespace datamatrix { namespace datamatrix {

View File

@ -18,7 +18,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include <zxing/datamatrix/Version.h> #include <zxing/datamatrix/VersionDM.h>
#include <limits> #include <limits>
#include <iostream> #include <iostream>

View File

@ -1,5 +1,5 @@
#ifndef __VERSION_H__ #ifndef __VERSION_DM_H__
#define __VERSION_H__ #define __VERSION_DM_H__
/* /*
* Version.h * Version.h
@ -84,4 +84,4 @@ private:
} }
} }
#endif // __VERSION_H__ #endif // __VERSION_DM_H__

View File

@ -18,7 +18,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include <zxing/datamatrix/decoder/BitMatrixParser.h> #include <zxing/datamatrix/decoder/BitMatrixParserDM.h>
#include <zxing/common/IllegalArgumentException.h> #include <zxing/common/IllegalArgumentException.h>
#include <iostream> #include <iostream>

View File

@ -25,7 +25,7 @@
#include <zxing/common/BitMatrix.h> #include <zxing/common/BitMatrix.h>
#include <zxing/common/Counted.h> #include <zxing/common/Counted.h>
#include <zxing/common/Array.h> #include <zxing/common/Array.h>
#include <zxing/datamatrix/Version.h> #include <zxing/datamatrix/VersionDM.h>
namespace zxing { namespace zxing {
namespace datamatrix { namespace datamatrix {

View File

@ -18,7 +18,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include <zxing/datamatrix/decoder/DataBlock.h> #include <zxing/datamatrix/decoder/DataBlockDM.h>
#include <zxing/common/IllegalArgumentException.h> #include <zxing/common/IllegalArgumentException.h>
namespace zxing { namespace zxing {

View File

@ -24,7 +24,7 @@
#include <vector> #include <vector>
#include <zxing/common/Counted.h> #include <zxing/common/Counted.h>
#include <zxing/common/Array.h> #include <zxing/common/Array.h>
#include <zxing/datamatrix/Version.h> #include <zxing/datamatrix/VersionDM.h>
namespace zxing { namespace zxing {
namespace datamatrix { namespace datamatrix {

View File

@ -19,7 +19,7 @@
*/ */
#include <zxing/FormatException.h> #include <zxing/FormatException.h>
#include <zxing/datamatrix/decoder/DecodedBitStreamParser.h> #include <zxing/datamatrix/decoder/DecodedBitStreamParserDM.h>
#include <iostream> #include <iostream>
#include <zxing/common/DecoderResult.h> #include <zxing/common/DecoderResult.h>

View File

@ -18,11 +18,11 @@
* limitations under the License. * limitations under the License.
*/ */
#include <zxing/datamatrix/decoder/Decoder.h> #include <zxing/datamatrix/decoder/DecoderDM.h>
#include <zxing/datamatrix/decoder/BitMatrixParser.h> #include <zxing/datamatrix/decoder/BitMatrixParserDM.h>
#include <zxing/datamatrix/decoder/DataBlock.h> #include <zxing/datamatrix/decoder/DataBlockDM.h>
#include <zxing/datamatrix/decoder/DecodedBitStreamParser.h> #include <zxing/datamatrix/decoder/DecodedBitStreamParserDM.h>
#include <zxing/datamatrix/Version.h> #include <zxing/datamatrix/VersionDM.h>
#include <zxing/ReaderException.h> #include <zxing/ReaderException.h>
#include <zxing/common/reedsolomon/ReedSolomonException.h> #include <zxing/common/reedsolomon/ReedSolomonException.h>

View File

@ -21,7 +21,7 @@
#include <zxing/ResultPoint.h> #include <zxing/ResultPoint.h>
#include <zxing/common/GridSampler.h> #include <zxing/common/GridSampler.h>
#include <zxing/datamatrix/detector/Detector.h> #include <zxing/datamatrix/detector/DetectorDM.h>
#include <cmath> #include <cmath>
#include <sstream> #include <sstream>
#include <cstdlib> #include <cstdlib>

View File

@ -1,6 +1,6 @@
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#ifndef __DETECTOR_H__ #ifndef __DETECTOR_DM_H__
#define __DETECTOR_H__ #define __DETECTOR_DM_H__
/* /*
* Detector.h * Detector.h
@ -91,4 +91,4 @@ class Detector: public Counted {
} }
} }
#endif // __DETECTOR_H__ #endif // __DETECTOR_DM_H__

View File

@ -5,8 +5,8 @@
* Author: luiz * Author: luiz
*/ */
#ifndef DETECTOREXCEPTION_H_ #ifndef DETECTOREXCEPTION_DM_H_
#define DETECTOREXCEPTION_H_ #define DETECTOREXCEPTION_DM_H_
#include <zxing/Exception.h> #include <zxing/Exception.h>
@ -20,4 +20,4 @@ class DetectorException : public Exception {
}; };
} /* namespace nexxera */ } /* namespace nexxera */
} /* namespace zxing */ } /* namespace zxing */
#endif /* DETECTOREXCEPTION_H_ */ #endif /* DETECTOREXCEPTION_DM_H_ */

View File

@ -19,7 +19,7 @@
*/ */
#include <zxing/ReaderException.h> #include <zxing/ReaderException.h>
#include <zxing/datamatrix/detector/MonochromeRectangleDetector.h> #include <zxing/datamatrix/detector/MonochromeRectangleDetectorDM.h>
#include <sstream> #include <sstream>
namespace zxing { namespace zxing {

View File

@ -42,7 +42,7 @@ private:
Ref<BitMatrix> image_; Ref<BitMatrix> image_;
public: public:
MonochromeRectangleDetector(Ref<BitMatrix> image) : image_(image) { }; MonochromeRectangleDetector(Ref<BitMatrix> image) : image_(image) { }
std::vector<Ref<CornerPoint> > detect(); std::vector<Ref<CornerPoint> > detect();
@ -53,7 +53,7 @@ private:
Ref<TwoInts> blackWhiteRange(int fixedDimension, int maxWhiteRun, int minDim, int maxDim, Ref<TwoInts> blackWhiteRange(int fixedDimension, int maxWhiteRun, int minDim, int maxDim,
bool horizontal); bool horizontal);
int max(int a, float b) { return (float) a > b ? a : (int) b;}; int max(int a, float b) { return (float) a > b ? a : (int) b;}
}; };
} }
} }

View File

@ -82,7 +82,7 @@ void DecodedBitStreamParser::append(std::string &result,
size_t nTo = maxOut; size_t nTo = maxOut;
while (nFrom > 0) { while (nFrom > 0) {
size_t oneway = iconv(cd, (char**)&fromPtr, &nFrom, &toPtr, &nTo); size_t oneway = iconv(cd, (const char**)&fromPtr, &nFrom, &toPtr, &nTo);
if (oneway == (size_t)(-1)) { if (oneway == (size_t)(-1)) {
iconv_close(cd); iconv_close(cd);
delete[] bufOut; delete[] bufOut;