mirror of
https://github.com/status-im/qzxing.git
synced 2025-02-16 21:06:43 +00:00
Updated the QZXingDragNDropTest example to be compatible with the QtQuick 2 and Qt 5.
This commit is contained in:
parent
b6ef08bad3
commit
7079f17dc5
4
.gitignore
vendored
4
.gitignore
vendored
@ -13,4 +13,6 @@ Makefile
|
||||
*.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/
|
||||
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
|
||||
|
@ -3,6 +3,8 @@ folder_01.source = qml/QZXingTestApp
|
||||
folder_01.target = qml
|
||||
DEPLOYMENTFOLDERS = folder_01
|
||||
|
||||
QT += widgets
|
||||
|
||||
# Additional import path used to resolve QML modules in Creator's code model
|
||||
QML_IMPORT_PATH =
|
||||
|
||||
@ -34,8 +36,10 @@ SOURCES += main.cpp \
|
||||
droparea.cpp
|
||||
|
||||
# Please do not modify the following two lines. Required for deployment.
|
||||
include(qzxing/QZXing.pri)
|
||||
include(../../source/QZXing.pri)
|
||||
|
||||
include(qmlapplicationviewer/qmlapplicationviewer.pri)
|
||||
include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
|
||||
qtcAddDeployment()
|
||||
|
||||
HEADERS += \
|
||||
|
@ -4,8 +4,7 @@
|
||||
#include <QMimeData>
|
||||
#include <QDebug>
|
||||
|
||||
DropArea::DropArea(QDeclarativeItem *parent)
|
||||
: QDeclarativeItem(parent),
|
||||
DropArea::DropArea(QDeclarativeItem *parent) : QDeclarativeItem(parent),
|
||||
m_accepting(true)
|
||||
{
|
||||
setAcceptDrops(m_accepting);
|
||||
@ -24,21 +23,23 @@ void DropArea::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
|
||||
|
||||
void DropArea::dropEvent(QGraphicsSceneDragDropEvent *event)
|
||||
{
|
||||
qDebug("File!");
|
||||
QList<QUrl> list = event->mimeData()->urls();
|
||||
for(int i=0; i<list.size(); i++)
|
||||
{
|
||||
QString path = list.at(i).path();
|
||||
{
|
||||
QString path = list.at(i).path();
|
||||
emit fileDroped(path.right(path.size()-1));
|
||||
}
|
||||
}
|
||||
unsetCursor();
|
||||
}
|
||||
|
||||
void DropArea::setAcceptingDrops(bool accepting)
|
||||
{
|
||||
if (accepting == m_accepting)
|
||||
return;
|
||||
return;
|
||||
|
||||
m_accepting = accepting;
|
||||
|
||||
setAcceptDrops(m_accepting);
|
||||
emit acceptingDropsChanged();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef DROPAREA_H
|
||||
#define DROPAREA_H
|
||||
|
||||
#include <qglobal.h>
|
||||
#include <QDeclarativeItem>
|
||||
|
||||
/**
|
||||
|
@ -1,13 +1,21 @@
|
||||
#include <QtGlobal>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||
#include <QtGui/QApplication>
|
||||
#include "qmlapplicationviewer.h"
|
||||
#include "droparea.h"
|
||||
#include <QDeclarativeEngine>
|
||||
#include <QDeclarativeContext>
|
||||
#include <qdeclarative.h>
|
||||
#include "droparea.h"
|
||||
#else
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include "qtquick2applicationviewer.h"
|
||||
#endif
|
||||
|
||||
#include <QZXing.h>
|
||||
|
||||
Q_DECL_EXPORT int main(int argc, char *argv[])
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||
QScopedPointer<QApplication> app(createApplication(argc, argv));
|
||||
|
||||
QZXing::registerQMLTypes();
|
||||
@ -15,7 +23,15 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
|
||||
QmlApplicationViewer viewer;
|
||||
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
|
||||
qmlRegisterType<DropArea>("DropArea", 1, 0, "DropArea");
|
||||
viewer.setMainQmlFile(QLatin1String("qml/QZXingTestApp/main.qml"));
|
||||
viewer.setMainQmlFile(QLatin1String("qml/QZXingTestApp/main_QtQuick1.qml"));
|
||||
#else
|
||||
QGuiApplication* app = new QGuiApplication(argc, argv);
|
||||
|
||||
QZXing::registerQMLTypes();
|
||||
|
||||
QtQuick2ApplicationViewer viewer;
|
||||
viewer.setMainQmlFile(QStringLiteral("qml/QZXingTestApp/main_QtQuick2.qml"));
|
||||
#endif
|
||||
viewer.showExpanded();
|
||||
|
||||
return app->exec();
|
||||
|
@ -1,5 +1,5 @@
|
||||
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
|
||||
import QtQuick 1.1
|
||||
import QtQuick 2.2
|
||||
|
||||
Rectangle {
|
||||
id: rect
|
||||
|
@ -1,7 +1,7 @@
|
||||
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
|
||||
import QtQuick 1.1
|
||||
import DropArea 1.0
|
||||
import QZXing 2.2
|
||||
import QZXing 2.3
|
||||
|
||||
Rectangle {
|
||||
width: 360
|
191
examples/QZXingDragNDropTest/qml/QZXingTestApp/main_QtQuick2.qml
Normal file
191
examples/QZXingDragNDropTest/qml/QZXingTestApp/main_QtQuick2.qml
Normal file
@ -0,0 +1,191 @@
|
||||
import QtQuick 2.0
|
||||
import QZXing 2.3
|
||||
|
||||
Rectangle {
|
||||
width: 360
|
||||
height: 360
|
||||
|
||||
Rectangle{
|
||||
id:dropArea
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
height: parent.height-200
|
||||
|
||||
|
||||
DropArea{
|
||||
|
||||
anchors.fill: parent
|
||||
onDropped: {
|
||||
console.log(drop.urls[0])
|
||||
|
||||
var path = drop.urls[0];
|
||||
path = path.replace("file://","");
|
||||
|
||||
decoder.decodeImageFromFile(path)
|
||||
}
|
||||
}
|
||||
|
||||
Text{
|
||||
anchors.centerIn: parent
|
||||
color: "gray"
|
||||
opacity: 0.8
|
||||
text: "Drag image to decode"
|
||||
elide: Text.ElideMiddle
|
||||
font.pixelSize: 30
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id: decSelector
|
||||
width: parent.width -100
|
||||
height: parent.height/2
|
||||
clip:true
|
||||
|
||||
color: "#00ffffff"
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
property bool isFolded: true
|
||||
|
||||
Rectangle{
|
||||
id: label
|
||||
color: "darkgray"
|
||||
border.color: "black"
|
||||
border.width: 1
|
||||
radius: 5
|
||||
|
||||
width: decLabel.width + 20
|
||||
height: decLabel.height + 10
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
anchors.margins: 2
|
||||
|
||||
Text{
|
||||
id: decLabel
|
||||
text: "Active Decoders"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: decSelector.isFolded = !decSelector.isFolded
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
color: "darkgray"
|
||||
border.color: "black"
|
||||
border.width: 1
|
||||
radius: 5
|
||||
clip:true
|
||||
anchors.margins: 2
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: label.top
|
||||
|
||||
Flow{
|
||||
id: flow
|
||||
anchors.fill: parent
|
||||
spacing: 10
|
||||
anchors.margins: 5
|
||||
|
||||
property int hintSum: 0
|
||||
|
||||
move: Transition {
|
||||
NumberAnimation {
|
||||
properties: "x,y"
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
ToggleButton{ text: "Aztec"; decoderHint: QZXing.DecoderFormat_Aztec}
|
||||
ToggleButton{ text: "Codabar"; decoderHint: QZXing.DecoderFormat_CODABAR }
|
||||
ToggleButton{ text: "Code_39"; decoderHint: QZXing.DecoderFormat_CODE_39 }
|
||||
ToggleButton{ text: "Code_93"; decoderHint: QZXing.DecoderFormat_CODE_93 }
|
||||
ToggleButton{ text: "Code_128"; decoderHint: QZXing.DecoderFormat_CODE_128 }
|
||||
ToggleButton{ text: "Data Matrix"; decoderHint: QZXing.DecoderFormat_DATA_MATRIX }
|
||||
ToggleButton{ text: "EAN_8"; decoderHint: QZXing.DecoderFormat_EAN_8 }
|
||||
ToggleButton{ text: "EAN_13"; decoderHint: QZXing.DecoderFormat_EAN_13 }
|
||||
ToggleButton{ text: "ITF"; decoderHint: QZXing.DecoderFormat_ITF }
|
||||
ToggleButton{ text: "Maxicode"; decoderHint: QZXing.DecoderFormat_MAXICODE }
|
||||
ToggleButton{ text: "PDF_417"; decoderHint: QZXing.DecoderFormat_PDF_417 }
|
||||
ToggleButton{ text: "Qr Code"; decoderHint: QZXing.DecoderFormat_QR_CODE }
|
||||
ToggleButton{ text: "RSS 14"; decoderHint: QZXing.DecoderFormat_RSS_14 }
|
||||
ToggleButton{ text: "RSS expanded"; decoderHint: QZXing.DecoderFormat_RSS_EXPANDED }
|
||||
ToggleButton{ text: "UPC A"; decoderHint: QZXing.DecoderFormat_UPC_A }
|
||||
ToggleButton{ text: "UPC E"; decoderHint: QZXing.DecoderFormat_UPC_E }
|
||||
ToggleButton{ text: "UPC EAN extension"; decoderHint: QZXing.DecoderFormat_UPC_EAN_EXTENSION }
|
||||
|
||||
function updateDecoderHints(hint)
|
||||
{
|
||||
//XOR operator to toggle the specific decoder
|
||||
hintSum = hintSum ^ hint;
|
||||
decoder.enabledDecoders = hintSum
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
states:[
|
||||
State{
|
||||
name: "folded"
|
||||
when: decSelector.isFolded
|
||||
PropertyChanges{target:decSelector; y: -decSelector.height+label.height}
|
||||
},
|
||||
State{
|
||||
name: "unfolded"
|
||||
when: !decSelector.isFolded
|
||||
PropertyChanges{target:decSelector; y: 0}
|
||||
}
|
||||
]
|
||||
|
||||
Behavior on y {NumberAnimation{duration:250; easing.type: Easing.OutCubic}}
|
||||
}
|
||||
}
|
||||
|
||||
QZXing{
|
||||
id: decoder
|
||||
//enabledDecoders: QZXing.DecoderFormat_QR_CODE
|
||||
|
||||
onTagFound: {
|
||||
log.add("Tag found: " +tag+ ", milliseconds: " + processingTime)
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id: logRect
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: dropArea.bottom
|
||||
|
||||
border.color: "gray"
|
||||
border.width: 1
|
||||
|
||||
clip: true
|
||||
|
||||
Flickable{
|
||||
anchors.fill: parent
|
||||
contentHeight: log.height
|
||||
contentWidth: log.width
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
|
||||
|
||||
TextEdit{
|
||||
id: log
|
||||
font.pointSize: 10
|
||||
width: logRect.width
|
||||
|
||||
wrapMode: TextEdit.WordWrap
|
||||
|
||||
function add(message)
|
||||
{
|
||||
text = "=> " + message + "\n\n" + text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
// checksum 0xc01f version 0x90005
|
||||
/*
|
||||
This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
|
||||
QtQuick2ApplicationViewer is a convenience class containing mobile device specific
|
||||
code such as screen orientation handling. Also QML paths and debugging are
|
||||
handled here.
|
||||
It is recommended not to modify this file, since newer versions of Qt Creator
|
||||
may offer an updated version of it.
|
||||
*/
|
||||
|
||||
#include "qtquick2applicationviewer.h"
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtQml/QQmlEngine>
|
||||
|
||||
class QtQuick2ApplicationViewerPrivate
|
||||
{
|
||||
QString mainQmlFile;
|
||||
friend class QtQuick2ApplicationViewer;
|
||||
static QString adjustPath(const QString &path);
|
||||
};
|
||||
|
||||
QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path)
|
||||
{
|
||||
#if defined(Q_OS_IOS)
|
||||
if (!QDir::isAbsolutePath(path))
|
||||
return QString::fromLatin1("%1/%2")
|
||||
.arg(QCoreApplication::applicationDirPath(), path);
|
||||
#elif defined(Q_OS_MAC)
|
||||
if (!QDir::isAbsolutePath(path))
|
||||
return QString::fromLatin1("%1/../Resources/%2")
|
||||
.arg(QCoreApplication::applicationDirPath(), path);
|
||||
#elif defined(Q_OS_BLACKBERRY)
|
||||
if (!QDir::isAbsolutePath(path))
|
||||
return QString::fromLatin1("app/native/%1").arg(path);
|
||||
#elif !defined(Q_OS_ANDROID)
|
||||
QString pathInInstallDir =
|
||||
QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
|
||||
if (QFileInfo(pathInInstallDir).exists())
|
||||
return pathInInstallDir;
|
||||
pathInInstallDir =
|
||||
QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
|
||||
if (QFileInfo(pathInInstallDir).exists())
|
||||
return pathInInstallDir;
|
||||
#elif defined(Q_OS_ANDROID_NO_SDK)
|
||||
return QLatin1String("/data/user/qt/") + path;
|
||||
#endif
|
||||
return path;
|
||||
}
|
||||
|
||||
QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent)
|
||||
: QQuickView(parent)
|
||||
, d(new QtQuick2ApplicationViewerPrivate())
|
||||
{
|
||||
connect(engine(), SIGNAL(quit()), SLOT(close()));
|
||||
setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
}
|
||||
|
||||
QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file)
|
||||
{
|
||||
d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
|
||||
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
|
||||
setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
|
||||
#else
|
||||
setSource(QUrl::fromLocalFile(d->mainQmlFile));
|
||||
#endif
|
||||
}
|
||||
|
||||
void QtQuick2ApplicationViewer::addImportPath(const QString &path)
|
||||
{
|
||||
engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
|
||||
}
|
||||
|
||||
void QtQuick2ApplicationViewer::showExpanded()
|
||||
{
|
||||
#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
|
||||
showFullScreen();
|
||||
#else
|
||||
show();
|
||||
#endif
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
// checksum 0xfde6 version 0x90005
|
||||
/*
|
||||
This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
|
||||
QtQuick2ApplicationViewer is a convenience class containing mobile device specific
|
||||
code such as screen orientation handling. Also QML paths and debugging are
|
||||
handled here.
|
||||
It is recommended not to modify this file, since newer versions of Qt Creator
|
||||
may offer an updated version of it.
|
||||
*/
|
||||
|
||||
#ifndef QTQUICK2APPLICATIONVIEWER_H
|
||||
#define QTQUICK2APPLICATIONVIEWER_H
|
||||
|
||||
#include <QtQuick/QQuickView>
|
||||
|
||||
class QtQuick2ApplicationViewer : public QQuickView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QtQuick2ApplicationViewer(QWindow *parent = 0);
|
||||
virtual ~QtQuick2ApplicationViewer();
|
||||
|
||||
void setMainQmlFile(const QString &file);
|
||||
void addImportPath(const QString &path);
|
||||
|
||||
void showExpanded();
|
||||
|
||||
private:
|
||||
class QtQuick2ApplicationViewerPrivate *d;
|
||||
};
|
||||
|
||||
#endif // QTQUICK2APPLICATIONVIEWER_H
|
@ -0,0 +1,202 @@
|
||||
# checksum 0x21c9 version 0x90005
|
||||
# This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
|
||||
# The code below adds the QtQuick2ApplicationViewer to the project and handles
|
||||
# the activation of QML debugging.
|
||||
# It is recommended not to modify this file, since newer versions of Qt Creator
|
||||
# may offer an updated version of it.
|
||||
|
||||
QT += qml quick
|
||||
|
||||
SOURCES += $$PWD/qtquick2applicationviewer.cpp
|
||||
HEADERS += $$PWD/qtquick2applicationviewer.h
|
||||
INCLUDEPATH += $$PWD
|
||||
# This file was generated by an application wizard of Qt Creator.
|
||||
# The code below handles deployment to Android and Maemo, aswell as copying
|
||||
# of the application data to shadow build directories on desktop.
|
||||
# It is recommended not to modify this file, since newer versions of Qt Creator
|
||||
# may offer an updated version of it.
|
||||
|
||||
defineTest(qtcAddDeployment) {
|
||||
for(deploymentfolder, DEPLOYMENTFOLDERS) {
|
||||
item = item$${deploymentfolder}
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
itemsources = $${item}.files
|
||||
} else {
|
||||
itemsources = $${item}.sources
|
||||
}
|
||||
$$itemsources = $$eval($${deploymentfolder}.source)
|
||||
itempath = $${item}.path
|
||||
$$itempath= $$eval($${deploymentfolder}.target)
|
||||
export($$itemsources)
|
||||
export($$itempath)
|
||||
DEPLOYMENT += $$item
|
||||
}
|
||||
|
||||
MAINPROFILEPWD = $$PWD
|
||||
|
||||
android-no-sdk {
|
||||
for(deploymentfolder, DEPLOYMENTFOLDERS) {
|
||||
item = item$${deploymentfolder}
|
||||
itemfiles = $${item}.files
|
||||
$$itemfiles = $$eval($${deploymentfolder}.source)
|
||||
itempath = $${item}.path
|
||||
$$itempath = /data/user/qt/$$eval($${deploymentfolder}.target)
|
||||
export($$itemfiles)
|
||||
export($$itempath)
|
||||
INSTALLS += $$item
|
||||
}
|
||||
|
||||
target.path = /data/user/qt
|
||||
|
||||
export(target.path)
|
||||
INSTALLS += target
|
||||
} else:android {
|
||||
for(deploymentfolder, DEPLOYMENTFOLDERS) {
|
||||
item = item$${deploymentfolder}
|
||||
itemfiles = $${item}.files
|
||||
$$itemfiles = $$eval($${deploymentfolder}.source)
|
||||
itempath = $${item}.path
|
||||
$$itempath = /assets/$$eval($${deploymentfolder}.target)
|
||||
export($$itemfiles)
|
||||
export($$itempath)
|
||||
INSTALLS += $$item
|
||||
}
|
||||
|
||||
x86 {
|
||||
target.path = /libs/x86
|
||||
} else: armeabi-v7a {
|
||||
target.path = /libs/armeabi-v7a
|
||||
} else {
|
||||
target.path = /libs/armeabi
|
||||
}
|
||||
|
||||
export(target.path)
|
||||
INSTALLS += target
|
||||
} else:win32 {
|
||||
copyCommand =
|
||||
for(deploymentfolder, DEPLOYMENTFOLDERS) {
|
||||
source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
|
||||
source = $$replace(source, /, \\)
|
||||
sourcePathSegments = $$split(source, \\)
|
||||
target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
|
||||
target = $$replace(target, /, \\)
|
||||
target ~= s,\\\\\\.?\\\\,\\,
|
||||
!isEqual(source,$$target) {
|
||||
!isEmpty(copyCommand):copyCommand += &&
|
||||
isEqual(QMAKE_DIR_SEP, \\) {
|
||||
copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
|
||||
} else {
|
||||
source = $$replace(source, \\\\, /)
|
||||
target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
|
||||
target = $$replace(target, \\\\, /)
|
||||
copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
|
||||
}
|
||||
}
|
||||
}
|
||||
!isEmpty(copyCommand) {
|
||||
copyCommand = @echo Copying application data... && $$copyCommand
|
||||
copydeploymentfolders.commands = $$copyCommand
|
||||
first.depends = $(first) copydeploymentfolders
|
||||
export(first.depends)
|
||||
export(copydeploymentfolders.commands)
|
||||
QMAKE_EXTRA_TARGETS += first copydeploymentfolders
|
||||
}
|
||||
} else:ios {
|
||||
copyCommand =
|
||||
for(deploymentfolder, DEPLOYMENTFOLDERS) {
|
||||
source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
|
||||
source = $$replace(source, \\\\, /)
|
||||
target = $CODESIGNING_FOLDER_PATH/$$eval($${deploymentfolder}.target)
|
||||
target = $$replace(target, \\\\, /)
|
||||
sourcePathSegments = $$split(source, /)
|
||||
targetFullPath = $$target/$$last(sourcePathSegments)
|
||||
targetFullPath ~= s,/\\.?/,/,
|
||||
!isEqual(source,$$targetFullPath) {
|
||||
!isEmpty(copyCommand):copyCommand += &&
|
||||
copyCommand += mkdir -p \"$$target\"
|
||||
copyCommand += && cp -r \"$$source\" \"$$target\"
|
||||
}
|
||||
}
|
||||
!isEmpty(copyCommand) {
|
||||
copyCommand = echo Copying application data... && $$copyCommand
|
||||
!isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";"
|
||||
QMAKE_POST_LINK += "$$copyCommand"
|
||||
export(QMAKE_POST_LINK)
|
||||
}
|
||||
} else:unix {
|
||||
maemo5 {
|
||||
desktopfile.files = $${TARGET}.desktop
|
||||
desktopfile.path = /usr/share/applications/hildon
|
||||
icon.files = $${TARGET}64.png
|
||||
icon.path = /usr/share/icons/hicolor/64x64/apps
|
||||
} else:!isEmpty(MEEGO_VERSION_MAJOR) {
|
||||
desktopfile.files = $${TARGET}_harmattan.desktop
|
||||
desktopfile.path = /usr/share/applications
|
||||
icon.files = $${TARGET}80.png
|
||||
icon.path = /usr/share/icons/hicolor/80x80/apps
|
||||
} else { # Assumed to be a Desktop Unix
|
||||
copyCommand =
|
||||
for(deploymentfolder, DEPLOYMENTFOLDERS) {
|
||||
source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
|
||||
source = $$replace(source, \\\\, /)
|
||||
macx {
|
||||
target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
|
||||
} else {
|
||||
target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
|
||||
}
|
||||
target = $$replace(target, \\\\, /)
|
||||
sourcePathSegments = $$split(source, /)
|
||||
targetFullPath = $$target/$$last(sourcePathSegments)
|
||||
targetFullPath ~= s,/\\.?/,/,
|
||||
!isEqual(source,$$targetFullPath) {
|
||||
!isEmpty(copyCommand):copyCommand += &&
|
||||
copyCommand += $(MKDIR) \"$$target\"
|
||||
copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
|
||||
}
|
||||
}
|
||||
!isEmpty(copyCommand) {
|
||||
copyCommand = @echo Copying application data... && $$copyCommand
|
||||
copydeploymentfolders.commands = $$copyCommand
|
||||
first.depends = $(first) copydeploymentfolders
|
||||
export(first.depends)
|
||||
export(copydeploymentfolders.commands)
|
||||
QMAKE_EXTRA_TARGETS += first copydeploymentfolders
|
||||
}
|
||||
}
|
||||
!isEmpty(target.path) {
|
||||
installPrefix = $${target.path}
|
||||
} else {
|
||||
installPrefix = /opt/$${TARGET}
|
||||
}
|
||||
for(deploymentfolder, DEPLOYMENTFOLDERS) {
|
||||
item = item$${deploymentfolder}
|
||||
itemfiles = $${item}.files
|
||||
$$itemfiles = $$eval($${deploymentfolder}.source)
|
||||
itempath = $${item}.path
|
||||
$$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
|
||||
export($$itemfiles)
|
||||
export($$itempath)
|
||||
INSTALLS += $$item
|
||||
}
|
||||
|
||||
!isEmpty(desktopfile.path) {
|
||||
export(icon.files)
|
||||
export(icon.path)
|
||||
export(desktopfile.files)
|
||||
export(desktopfile.path)
|
||||
INSTALLS += icon desktopfile
|
||||
}
|
||||
|
||||
isEmpty(target.path) {
|
||||
target.path = $${installPrefix}/bin
|
||||
export(target.path)
|
||||
}
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
export (ICON)
|
||||
export (INSTALLS)
|
||||
export (DEPLOYMENT)
|
||||
export (LIBS)
|
||||
export (QMAKE_EXTRA_TARGETS)
|
||||
}
|
@ -5,8 +5,10 @@
|
||||
#include <QObject>
|
||||
#include <QImage>
|
||||
|
||||
#if QT_VERSION >= 0x040700
|
||||
#if QT_VERSION >= 0x040700 && QT_VERSION < 0x050000
|
||||
#include <QtDeclarative>
|
||||
#elif QT_VERSION >= 0x050000
|
||||
#include <QtQml/qqml.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -62,7 +64,7 @@ public:
|
||||
#if QT_VERSION >= 0x040700
|
||||
static void registerQMLTypes()
|
||||
{
|
||||
qmlRegisterType<QZXing>("QZXing", 2, 2, "QZXing");
|
||||
qmlRegisterType<QZXing>("QZXing", 2, 3, "QZXing");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,20 +1,21 @@
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_VERSION, 4.7): QT += declarative
|
||||
greaterThan(QT_VERSION, 5.0): QT += quick
|
||||
|
||||
DEFINES += QZXING_LIBRARY \
|
||||
ZXING_ICONV_CONST \
|
||||
DISABLE_LIBRARY_FEATURES
|
||||
|
||||
INCLUDEPATH += $$PWD \
|
||||
$$PWD/zxing
|
||||
$$PWD/zxing
|
||||
|
||||
|
||||
HEADERS += $$PWD/QZXing_global.h \
|
||||
HEADERS += $$PWD/QZXing_global.h \
|
||||
$$PWD/CameraImageWrapper.h \
|
||||
$$PWD/imagehandler.h \
|
||||
$$PWD/qzxing.h \
|
||||
$$PWD/QZXing.h \
|
||||
$$PWD/zxing/zxing/ZXing.h \
|
||||
$$PWD/zxing/zxing/IllegalStateException.h \
|
||||
$$PWD/zxing/zxing/InvertedLuminanceSource.h \
|
||||
@ -250,7 +251,7 @@ unix:!symbian {
|
||||
}
|
||||
|
||||
DEFINES += NOFMAXL
|
||||
INSTALLS q+= target
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
win32-msvc*{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
QT += core gui
|
||||
|
||||
VERSION = 2.2
|
||||
VERSION = 2.3
|
||||
|
||||
greaterThan(QT_VERSION, 4.7): QT += declarative
|
||||
|
||||
@ -21,7 +21,7 @@ INCLUDEPATH += ./ \
|
||||
HEADERS += QZXing_global.h \
|
||||
CameraImageWrapper.h \
|
||||
imagehandler.h \
|
||||
qzxing.h \
|
||||
QZXing.h \
|
||||
zxing/zxing/ZXing.h \
|
||||
zxing/zxing/IllegalStateException.h \
|
||||
zxing/zxing/InvertedLuminanceSource.h \
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "qzxing.h"
|
||||
#include "QZXing.h"
|
||||
|
||||
#include <zxing/common/GlobalHistogramBinarizer.h>
|
||||
#include <zxing/Binarizer.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user