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 += \
|
||||
application.h \
|
||||
native.h
|
||||
application.h
|
||||
|
||||
SOURCES += main.cpp \
|
||||
application.cpp \
|
||||
native.cpp
|
||||
application.cpp
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
|
||||
|
@ -33,28 +31,35 @@ include(../../src/QZXing-components.pri)
|
|||
include(deployment.pri)
|
||||
|
||||
android {
|
||||
QT += androidextras
|
||||
lessThan(QT_VERSION, 6.2) {
|
||||
HEADERS += \
|
||||
native.h
|
||||
|
||||
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
|
||||
SOURCES += \
|
||||
native.cpp
|
||||
|
||||
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 {
|
||||
QMAKE_INFO_PLIST=Info.plist
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
#include "application.h"
|
||||
#include <QDebug>
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
#include "native.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
|
||||
#if QT_VERSION < 0x060100
|
||||
#include <QAndroidJniObject>
|
||||
#include <QtAndroid>
|
||||
#else
|
||||
#include <QJniObject>
|
||||
#endif
|
||||
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
Application::Application()
|
||||
|
@ -18,7 +28,9 @@ Application::Application()
|
|||
connect(this, &Application::onPermissionsDenied,
|
||||
this, &Application::initializeQML);
|
||||
|
||||
NativeHelpers::registerApplicationInstance(this);
|
||||
#if QT_VERSION < 0x060000
|
||||
NativeHelpers::registerApplicationInstance(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
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
|
||||
qDebug() << "About to request permissions";
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
QAndroidJniObject::callStaticMethod<void>("org/ftylitak/qzxing/Utilities",
|
||||
"requestQZXingPermissions",
|
||||
"(Landroid/app/Activity;)V",
|
||||
QtAndroid::androidActivity().object());
|
||||
#else
|
||||
emit onPermissionsGranted();
|
||||
#endif
|
||||
qDebug() << "Permissions granted";
|
||||
#else
|
||||
emit onPermissionsGranted();
|
||||
|
|
Loading…
Reference in New Issue