fix android test
This commit is contained in:
@@ -656,4 +656,5 @@ maemo{
|
|||||||
|
|
||||||
android_test{
|
android_test{
|
||||||
DEFINES += ANDROID
|
DEFINES += ANDROID
|
||||||
|
DEFINES += ANDROID_TEST
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,18 +74,20 @@ aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0);
|
|
||||||
JNIEnv* env;
|
|
||||||
int api = -2;
|
int api = -2;
|
||||||
if (currVM->AttachCurrentThread(&env, NULL)<0) {
|
#ifndef ANDROID_TEST
|
||||||
qCritical()<<"AttachCurrentThread failed";
|
JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0);
|
||||||
} else {
|
JNIEnv* env;
|
||||||
jclass jclassApplicationClass = env->FindClass("android/os/Build$VERSION");
|
if (currVM->AttachCurrentThread(&env, NULL)<0) {
|
||||||
if (jclassApplicationClass) {
|
qCritical()<<"AttachCurrentThread failed";
|
||||||
api = env->GetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"SDK_INT", "I"));
|
} else {
|
||||||
|
jclass jclassApplicationClass = env->FindClass("android/os/Build$VERSION");
|
||||||
|
if (jclassApplicationClass) {
|
||||||
|
api = env->GetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"SDK_INT", "I"));
|
||||||
|
}
|
||||||
|
currVM->DetachCurrentThread();
|
||||||
}
|
}
|
||||||
currVM->DetachCurrentThread();
|
#endif
|
||||||
}
|
|
||||||
label_pokerthVersion->setText(QString(tr("PokerTH %1 for Android (API%2)").arg(POKERTH_BETA_RELEASE_STRING).arg(api)));
|
label_pokerthVersion->setText(QString(tr("PokerTH %1 for Android (API%2)").arg(POKERTH_BETA_RELEASE_STRING).arg(api)));
|
||||||
#else
|
#else
|
||||||
label_pokerthVersion->setText(QString(tr("PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING)));
|
label_pokerthVersion->setText(QString(tr("PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING)));
|
||||||
|
|||||||
Reference in New Issue
Block a user