add qrcode scanner

This commit is contained in:
MoroccanMalinois
2017-01-31 04:36:08 +00:00
parent 43d5bd3e2d
commit 93d2eb5e1a
13 changed files with 627 additions and 14 deletions

View File

@@ -39,6 +39,7 @@
#include "WalletManager.h"
#include "Wallet.h"
#include "QRCodeImageProvider.h"
#include "QrCodeScanner.h"
#include "PendingTransaction.h"
#include "UnsignedTransaction.h"
#include "TranslationManager.h"
@@ -109,6 +110,8 @@ int main(int argc, char *argv[])
qRegisterMetaType<TransactionInfo::Direction>();
qRegisterMetaType<TransactionHistoryModel::TransactionInfoRole>();
qmlRegisterType<QrCodeScanner>("moneroComponents.QRCodeScanner", 1, 0, "QRCodeScanner");
QQmlApplicationEngine engine;
OSCursor cursor;
@@ -167,5 +170,15 @@ int main(int argc, char *argv[])
//WalletManager::instance()->setLogLevel(WalletManager::LogLevel_Max);
bool builtWithScanner = false;
#ifdef WITH_SCANNER
builtWithScanner = true;
QObject *qmlCamera = rootObject->findChild<QObject*>("qrCameraQML");
QCamera *camera_ = qvariant_cast<QCamera*>(qmlCamera->property("mediaObject"));
QObject *qmlFinder = rootObject->findChild<QObject*>("QrFinder");
qobject_cast<QrCodeScanner*>(qmlFinder)->setSource(camera_);
#endif
engine.rootContext()->setContextProperty("builtWithScanner", builtWithScanner);
return app.exec();
}