Skip to content

Commit

Permalink
fixed compilation of QZXingLive for platforms other than Android
Browse files Browse the repository at this point in the history
  • Loading branch information
ftylitak committed Mar 16, 2017
1 parent a69cd45 commit f581e87
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ debug/
.gradle
.idea
.build
.obj
12 changes: 4 additions & 8 deletions examples/QZXingLive/QZXingLive.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ CONFIG(debug, debug|release) {
}

HEADERS += \
application.h
application.h \
native.h

SOURCES += main.cpp \
application.cpp
application.cpp \
native.cpp

RESOURCES += qml.qrc

Expand All @@ -30,12 +32,6 @@ include(deployment.pri)
android {
QT += androidextras

HEADERS += \
native.h

SOURCES += \
native.cpp

DISTFILES += \
android/AndroidManifest.xml \
android/gradle/wrapper/gradle-wrapper.jar \
Expand Down
8 changes: 7 additions & 1 deletion examples/QZXingLive/native.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#include <jni.h>
#if defined(Q_OS_ANDROID)
#include <jni.h>
#endif //Q_OS_ANDROID
#include "native.h"
#include <QMetaObject>

QObject *NativeHelpers::application_p_ = 0;

#if defined(Q_OS_ANDROID)

// define our native static functions
// these are the functions that Java part will call directly from Android UI thread
static void onPermissionsGranted(JNIEnv * /*env*/, jobject /*obj*/)
Expand Down Expand Up @@ -45,3 +49,5 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* /*reserved*/)

return JNI_VERSION_1_6;
}

#endif // Q_OS_ANDROID

0 comments on commit f581e87

Please sign in to comment.