mirror of https://github.com/status-im/qzxing.git
exclude custom android code if Qt 6 and greater
This commit is contained in:
parent
7d3b430b9e
commit
30fa997992
|
@ -15,12 +15,10 @@ CONFIG(debug, debug|release) {
|
||||||
}
|
}
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
application.h \
|
application.h
|
||||||
native.h
|
|
||||||
|
|
||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
application.cpp \
|
application.cpp
|
||||||
native.cpp
|
|
||||||
|
|
||||||
RESOURCES += qml.qrc
|
RESOURCES += qml.qrc
|
||||||
|
|
||||||
|
@ -33,28 +31,35 @@ include(../../src/QZXing-components.pri)
|
||||||
include(deployment.pri)
|
include(deployment.pri)
|
||||||
|
|
||||||
android {
|
android {
|
||||||
QT += androidextras
|
lessThan(QT_VERSION, 6.2) {
|
||||||
|
HEADERS += \
|
||||||
|
native.h
|
||||||
|
|
||||||
DISTFILES += \
|
SOURCES += \
|
||||||
android/AndroidManifest.xml \
|
native.cpp
|
||||||
android/gradle/wrapper/gradle-wrapper.jar \
|
|
||||||
android/gradlew \
|
|
||||||
android/res/values/libs.xml \
|
|
||||||
android/build.gradle \
|
|
||||||
android/gradle/wrapper/gradle-wrapper.properties \
|
|
||||||
android/gradlew.bat \
|
|
||||||
android/AndroidManifest.xml \
|
|
||||||
android/gradle/wrapper/gradle-wrapper.jar \
|
|
||||||
android/gradlew \
|
|
||||||
android/res/values/libs.xml \
|
|
||||||
android/build.gradle \
|
|
||||||
android/gradle/wrapper/gradle-wrapper.properties \
|
|
||||||
android/gradlew.bat
|
|
||||||
|
|
||||||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
|
QT += androidextras
|
||||||
|
|
||||||
|
DISTFILES += \
|
||||||
|
android/AndroidManifest.xml \
|
||||||
|
android/gradle/wrapper/gradle-wrapper.jar \
|
||||||
|
android/gradlew \
|
||||||
|
android/res/values/libs.xml \
|
||||||
|
android/build.gradle \
|
||||||
|
android/gradle/wrapper/gradle-wrapper.properties \
|
||||||
|
android/gradlew.bat \
|
||||||
|
android/AndroidManifest.xml \
|
||||||
|
android/gradle/wrapper/gradle-wrapper.jar \
|
||||||
|
android/gradlew \
|
||||||
|
android/res/values/libs.xml \
|
||||||
|
android/build.gradle \
|
||||||
|
android/gradle/wrapper/gradle-wrapper.properties \
|
||||||
|
android/gradlew.bat
|
||||||
|
|
||||||
|
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else:ios {
|
else:ios {
|
||||||
QMAKE_INFO_PLIST=Info.plist
|
QMAKE_INFO_PLIST=Info.plist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
#include "native.h"
|
#include "native.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x060100
|
||||||
#include <QAndroidJniObject>
|
#include <QAndroidJniObject>
|
||||||
#include <QtAndroid>
|
#include <QtAndroid>
|
||||||
|
#else
|
||||||
|
#include <QJniObject>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // Q_OS_ANDROID
|
#endif // Q_OS_ANDROID
|
||||||
|
|
||||||
Application::Application()
|
Application::Application()
|
||||||
|
@ -18,7 +28,9 @@ Application::Application()
|
||||||
connect(this, &Application::onPermissionsDenied,
|
connect(this, &Application::onPermissionsDenied,
|
||||||
this, &Application::initializeQML);
|
this, &Application::initializeQML);
|
||||||
|
|
||||||
NativeHelpers::registerApplicationInstance(this);
|
#if QT_VERSION < 0x060000
|
||||||
|
NativeHelpers::registerApplicationInstance(this);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::initializeQML()
|
void Application::initializeQML()
|
||||||
|
@ -36,10 +48,14 @@ void Application::checkPermissions()
|
||||||
//intentionally called in the C++ thread since it is blocking and will continue after the check
|
//intentionally called in the C++ thread since it is blocking and will continue after the check
|
||||||
qDebug() << "About to request permissions";
|
qDebug() << "About to request permissions";
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
QAndroidJniObject::callStaticMethod<void>("org/ftylitak/qzxing/Utilities",
|
QAndroidJniObject::callStaticMethod<void>("org/ftylitak/qzxing/Utilities",
|
||||||
"requestQZXingPermissions",
|
"requestQZXingPermissions",
|
||||||
"(Landroid/app/Activity;)V",
|
"(Landroid/app/Activity;)V",
|
||||||
QtAndroid::androidActivity().object());
|
QtAndroid::androidActivity().object());
|
||||||
|
#else
|
||||||
|
emit onPermissionsGranted();
|
||||||
|
#endif
|
||||||
qDebug() << "Permissions granted";
|
qDebug() << "Permissions granted";
|
||||||
#else
|
#else
|
||||||
emit onPermissionsGranted();
|
emit onPermissionsGranted();
|
||||||
|
|
Loading…
Reference in New Issue