added qr-code decoder for android
- added color change for status and navigation bar for android
This commit is contained in:
parent
b9a13d3a32
commit
0411792ca5
13 changed files with 255 additions and 58 deletions
|
@ -7,6 +7,9 @@
|
|||
#include "core/defs.h"
|
||||
#include "ui/models/containers_model.h"
|
||||
#include "ui/models/servers_model.h"
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "jni.h"
|
||||
#endif
|
||||
|
||||
class ImportController : public QObject
|
||||
{
|
||||
|
@ -21,25 +24,44 @@ public slots:
|
|||
void extractConfigFromFile();
|
||||
void extractConfigFromData(QString &data);
|
||||
void extractConfigFromCode(QString code);
|
||||
void extractConfigFromQr();
|
||||
bool extractConfigFromQr(const QByteArray &data);
|
||||
QString getConfig();
|
||||
QString getConfigFileName();
|
||||
|
||||
#if defined Q_OS_ANDROID
|
||||
void startDecodingQr();
|
||||
#endif
|
||||
|
||||
signals:
|
||||
void importFinished();
|
||||
void importErrorOccurred(QString errorMessage);
|
||||
|
||||
void qrDecodingFinished();
|
||||
|
||||
private:
|
||||
QJsonObject extractAmneziaConfig(QString &data);
|
||||
QJsonObject extractOpenVpnConfig(const QString &data);
|
||||
QJsonObject extractWireGuardConfig(const QString &data);
|
||||
|
||||
#if defined Q_OS_ANDROID
|
||||
void stopDecodingQr();
|
||||
static void onNewQrCodeDataChunk(JNIEnv *env, jobject thiz, jstring data);
|
||||
void parseQrCodeChunk(const QString &code);
|
||||
#endif
|
||||
|
||||
QSharedPointer<ServersModel> m_serversModel;
|
||||
QSharedPointer<ContainersModel> m_containersModel;
|
||||
std::shared_ptr<Settings> m_settings;
|
||||
|
||||
QJsonObject m_config;
|
||||
QString m_configFileName;
|
||||
|
||||
#if defined Q_OS_ANDROID
|
||||
QMap<int, QByteArray> m_qrCodeChunks;
|
||||
bool m_isQrCodeProcessed;
|
||||
int m_totalQrCodeChunksCount;
|
||||
int m_receivedQrCodeChunksCount;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // IMPORTCONTROLLER_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue