Make QtMultimedia dependency optional

This commit is contained in:
MoroccanMalinois
2017-03-27 17:39:47 +00:00
parent 12573652a0
commit fb3a6182fc
6 changed files with 50 additions and 28 deletions

View File

@@ -32,7 +32,6 @@ import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Dialogs 1.2
import Qt.labs.settings 1.0
import QtMultimedia 5.4
import moneroComponents.Wallet 1.0
import moneroComponents.PendingTransaction 1.0
@@ -65,9 +64,10 @@ ApplicationWindow {
property bool viewOnly: false
property bool foundNewBlock: false
property int timeToUnlock: 0
property bool qrScannerEnabled: (typeof builtWithScanner != "undefined") && builtWithScanner && (QtMultimedia.availableCameras.length > 0)
property bool qrScannerEnabled: (typeof builtWithScanner != "undefined") && builtWithScanner
property int blocksToSync: 1
property var isMobile: (appWindow.width > 700) ? false : true
property var cameraUi
// true if wallet ever synchronized
property bool walletInitialized : false
@@ -809,6 +809,18 @@ ApplicationWindow {
// Connect app exit to qml window exit handling
mainApp.closing.connect(appWindow.close);
if( appWindow.qrScannerEnabled ){
console.log("qrScannerEnabled : load component QRCodeScanner");
var component = Qt.createComponent("components/QRCodeScanner.qml");
if (component.status == Component.Ready) {
console.log("Camera component ready");
cameraUi = component.createObject(appWindow);
} else {
console.log("component not READY !!!");
appWindow.qrScannerEnabled = false;
}
} else console.log("qrScannerEnabled disabled");
if(!walletsFound()) {
rootItem.state = "wizard"
} else {
@@ -941,11 +953,6 @@ ApplicationWindow {
messageText: qsTr("Please wait...")
}
QRCodeScanner {
id: cameraUi
visible : false
}
Item {
id: rootItem
anchors.fill: parent