Tested against compiling with MSVC and Mingw compilers on Windows.

This commit is contained in:
favoritas37 2014-01-22 18:29:42 +02:00
parent 03a7f06333
commit a1c875ab63
14 changed files with 56 additions and 27 deletions

10
.gitignore vendored
View File

@ -12,7 +12,9 @@ Makefile
*.user
*.mmp
*.pkg
QZXing-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/
QZXing-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Release/
build-QZXingTestApp-Desktop_Qt_5_2_0_GCC_64bit-Debug
build-QZXing-Desktop_Qt_5_2_0_GCC_64bit-Debug
QZXing-build-*
build-*
*.Debug
*.Release
debug/
*.pdb

View File

@ -39,8 +39,10 @@ SOURCES += main.cpp \
include(../../source/QZXing.pri)
include(qmlapplicationviewer/qmlapplicationviewer.pri)
include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
#include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
qtcAddDeployment()
HEADERS += \
droparea.h
OTHER_FILES +=

View File

@ -1,5 +1,5 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 2.2
import QtQuick 1.0
Rectangle {
id: rect

View File

@ -8,6 +8,10 @@
may offer an updated version of it.
*/
#include <qglobal.h>
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
#include "qtquick2applicationviewer.h"
#include <QtCore/QCoreApplication>
@ -85,3 +89,4 @@ void QtQuick2ApplicationViewer::showExpanded()
show();
#endif
}
#endif // version checking

View File

@ -11,12 +11,20 @@
#ifndef QTQUICK2APPLICATIONVIEWER_H
#define QTQUICK2APPLICATIONVIEWER_H
#include <QtQuick/QQuickView>
#include <qglobal.h>
#include <QObject>
class QtQuick2ApplicationViewer : public QQuickView
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
#include <QtQuick/QQuickView>
#endif
class QtQuick2ApplicationViewer
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
: public QQuickView
#endif
{
Q_OBJECT
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
public:
explicit QtQuick2ApplicationViewer(QWindow *parent = 0);
virtual ~QtQuick2ApplicationViewer();
@ -28,6 +36,7 @@ public:
private:
class QtQuick2ApplicationViewerPrivate *d;
#endif
};
#endif // QTQUICK2APPLICATIONVIEWER_H

View File

@ -257,7 +257,8 @@ unix:!symbian {
win32-msvc*{
INCLUDEPATH += $$PWD/zxing/win32/zxing
HEADERS += $$PWD/zxing/win32/zxing/stdint.h \
$$PWD/zxing/win32/zxing/msvc
HEADERS += $$PWD/zxing/win32/zxing/msvc/stdint.h \
$$PWD/zxing/win32/zxing/iconv.h
SOURCES += $$PWD/zxing/win32/zxing/win_iconv.c

View File

@ -262,9 +262,10 @@ unix:!symbian {
win32-msvc*{
INCLUDEPATH += zxing/win32/zxing
HEADERS += zxing/win32/zxing/stdint.h \
zxing/win32/zxing/iconv.h
INCLUDEPATH += zxing/win32/zxing \
zxing/win32/zxing/msvc
HEADERS += zxing/win32/zxing/msvc/stdint.h \
zxing/win32/zxing/iconv.h
SOURCES += zxing/win32/zxing/win_iconv.c
}

View File

@ -20,6 +20,7 @@
#include <zxing/DecodeHints.h>
#include <zxing/common/IllegalArgumentException.h>
#include <qglobal.h>
using zxing::Ref;
using zxing::ResultPointCallback;
@ -29,9 +30,12 @@ using zxing::DecodeHints;
// VC++
using zxing::BarcodeFormat;
const DecodeHintType DecodeHints::CHARACTER_SET;
//favoritas37-22-01-14-change
#ifndef Q_CC_MSVC
const zxing::DecodeHintType DecodeHints::CHARACTER_SET;
#endif // Q_CC_MSVC
const DecodeHints DecodeHints::PRODUCT_HINT(
const zxing::DecodeHints DecodeHints::PRODUCT_HINT(
UPC_A_HINT |
UPC_E_HINT |
EAN_13_HINT |
@ -39,7 +43,7 @@ const DecodeHints DecodeHints::PRODUCT_HINT(
RSS_14_HINT
);
const DecodeHints DecodeHints::ONED_HINT(
const zxing::DecodeHints DecodeHints::ONED_HINT(
CODE_39_HINT |
CODE_93_HINT |
CODE_128_HINT |
@ -48,7 +52,7 @@ const DecodeHints DecodeHints::ONED_HINT(
DecodeHints::PRODUCT_HINT
);
const DecodeHints DecodeHints::DEFAULT_HINT(
const zxing::DecodeHints DecodeHints::DEFAULT_HINT(
ONED_HINT |
QR_CODE_HINT |
DATA_MATRIX_HINT |
@ -132,7 +136,7 @@ Ref<ResultPointCallback> DecodeHints::getResultPointCallback() const {
return callback;
}
DecodeHints zxing::operator | (DecodeHints const& l, DecodeHints const& r) {
zxing::DecodeHints zxing::operator | (DecodeHints const& l, DecodeHints const& r) {
DecodeHints result (l);
result.hints |= r.hints;
if (!result.callback) {

View File

@ -42,8 +42,8 @@ typedef bool boolean;
#include <float.h>
namespace zxing {
inline bool isnan(float v) {return _isnan(v) != 0;}
inline bool isnan(double v) {return _isnan(v) != 0;}
inline bool isnan_z(float v) {return _isnan(v) != 0;}
inline bool isnan_z(double v) {return _isnan(v) != 0;}
inline float nan() {return std::numeric_limits<float>::quiet_NaN();}
}
@ -52,8 +52,8 @@ inline float nan() {return std::numeric_limits<float>::quiet_NaN();}
#include <cmath>
namespace zxing {
inline bool isnan(float v) {return std::isnan(v);}
inline bool isnan(double v) {return std::isnan(v);}
inline bool isnan_z(float v) {return std::isnan(v);}
inline bool isnan_z(double v) {return std::isnan(v);}
inline float nan() {return std::numeric_limits<float>::quiet_NaN();}
}

View File

@ -20,6 +20,8 @@
#include <zxing/pdf417/decoder/BitMatrixParser.h>
#include <zxing/NotFoundException.h>
#include <zxing/common/Point.h>
#include <cmath>
#include <qglobal.h>
using std::map;
using std::vector;
@ -35,10 +37,13 @@ using zxing::Point;
// VC++
using zxing::Line;
//favoritas37-22-01-14-change
#ifndef Q_CC_MSVC
const int LinesSampler::MODULES_IN_SYMBOL;
const int LinesSampler::BARS_IN_SYMBOL;
const int LinesSampler::POSSIBLE_SYMBOLS;
const int LinesSampler::BARCODE_START_OFFSET;
#endif //Q_CC_MSVC
namespace {

View File

@ -100,7 +100,7 @@ Ref<AlignmentPattern> AlignmentPatternFinder::handlePossibleCenter(vector<int> &
int stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
float centerJ = centerFromEnd(stateCount, j);
float centerI = crossCheckVertical(i, (int)centerJ, 2 * stateCount[1], stateCountTotal);
if (!isnan(centerI)) {
if (!isnan_z(centerI)) {
float estimatedModuleSize = (float)(stateCount[0] + stateCount[1] + stateCount[2]) / 3.0f;
int max = possibleCenters_->size();
for (int index = 0; index < max; index++) {

View File

@ -195,10 +195,10 @@ float Detector::calculateModuleSizeOneWay(Ref<ResultPoint> pattern, Ref<ResultPo
(int)otherPattern->getX(), (int)otherPattern->getY());
float moduleSizeEst2 = sizeOfBlackWhiteBlackRunBothWays((int)otherPattern->getX(), (int)otherPattern->getY(),
(int)pattern->getX(), (int)pattern->getY());
if (zxing::isnan(moduleSizeEst1)) {
if (zxing::isnan_z(moduleSizeEst1)) {
return moduleSizeEst2;
}
if (zxing::isnan(moduleSizeEst2)) {
if (zxing::isnan_z(moduleSizeEst2)) {
return moduleSizeEst1;
}
// Average them, and divide by 7 since we've counted the width of 3 black modules,

View File

@ -238,10 +238,10 @@ bool FinderPatternFinder::handlePossibleCenter(int* stateCount, size_t i, size_t
int stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
float centerJ = centerFromEnd(stateCount, j);
float centerI = crossCheckVertical(i, (size_t)centerJ, stateCount[2], stateCountTotal);
if (!isnan(centerI)) {
if (!isnan_z(centerI)) {
// Re-cross check
centerJ = crossCheckHorizontal((size_t)centerJ, (size_t)centerI, stateCount[2], stateCountTotal);
if (!isnan(centerJ)) {
if (!isnan_z(centerJ)) {
float estimatedModuleSize = (float)stateCountTotal / 7.0f;
bool found = false;
size_t max = possibleCenters_.size();