CameraActivity refactoring
This commit is contained in:
parent
679bd4e4c9
commit
e625543b94
13 changed files with 193 additions and 224 deletions
|
@ -3,6 +3,7 @@
|
|||
#include <QJsonDocument>
|
||||
|
||||
#include "android_controller.h"
|
||||
#include "ui/controllers/importController.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -101,6 +102,7 @@ bool AndroidController::initialize()
|
|||
{"onVpnDisconnected", "()V", reinterpret_cast<void *>(onVpnDisconnected)},
|
||||
{"onStatisticsUpdate", "(JJ)V", reinterpret_cast<void *>(onStatisticsUpdate)},
|
||||
{"onConfigImported", "()V", reinterpret_cast<void *>(onConfigImported)},
|
||||
{"decodeQrCode", "(Ljava/lang/String;)Z", reinterpret_cast<bool *>(decodeQrCode)}
|
||||
};
|
||||
|
||||
QJniEnvironment env;
|
||||
|
@ -240,6 +242,7 @@ void AndroidController::onStatisticsUpdate(JNIEnv *env, jobject thiz, jlong rxBy
|
|||
emit AndroidController::instance()->statisticsUpdated((quint64) rxBytes, (quint64) txBytes);
|
||||
}
|
||||
|
||||
// static
|
||||
void AndroidController::onConfigImported(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
Q_UNUSED(env);
|
||||
|
@ -247,3 +250,18 @@ void AndroidController::onConfigImported(JNIEnv *env, jobject thiz)
|
|||
|
||||
emit AndroidController::instance()->configImported();
|
||||
}
|
||||
|
||||
// static
|
||||
bool AndroidController::decodeQrCode(JNIEnv *env, jobject thiz, jstring data)
|
||||
{
|
||||
Q_UNUSED(thiz);
|
||||
|
||||
const char *buffer = env->GetStringUTFChars(data, nullptr);
|
||||
if (!buffer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QString code(buffer);
|
||||
env->ReleaseStringUTFChars(data, buffer);
|
||||
return ImportController::decodeQrCode(code);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue