diff --git a/resources/qml/Components/DataListView.qml b/resources/qml/Components/DataListView.qml index 38f7c7a..edc4270 100644 --- a/resources/qml/Components/DataListView.qml +++ b/resources/qml/Components/DataListView.qml @@ -64,21 +64,6 @@ ListView { } } - InfoArea { - id: infoArea - - anchors { - left: control.left - right: control.right - top: control.top - margins: app.landscape() ? control.width * 0.4:control.width * 0.3 - topMargin: control.height*( status === 901 ? 0.6:0.5) - height * 0.8 - } - - excludedCodes: [200, 902, 905] - errorCode: control.status - } - PullRefresher { target: control diff --git a/resources/qml/Components/DisclaimerDialog.qml b/resources/qml/Components/DisclaimerDialog.qml index c96c3cf..71b172c 100644 --- a/resources/qml/Components/DisclaimerDialog.qml +++ b/resources/qml/Components/DisclaimerDialog.qml @@ -13,8 +13,15 @@ Dialog { x: (parent.width - width) * 0.5 y: (parent.height - height) * 0.5 - width: parent.width * 0.8 - height: implicitHeight + implicitWidth: parent.width * 0.9 + + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding + + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0) + + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0)) + + //width: app.width * 0.8 + //height: implicitHeight modal: true @@ -41,8 +48,7 @@ Dialog { contentItem: Label { wrapMode: Text.Wrap - width: control.width * 0.8 - height: implicitHeight + width: control.parent * 0.8 text: control.content diff --git a/resources/qml/Components/QrCodeScanPopup.qml b/resources/qml/Pages/QrCodeScanPage.qml similarity index 67% rename from resources/qml/Components/QrCodeScanPopup.qml rename to resources/qml/Pages/QrCodeScanPage.qml index 1ebc2ca..7474d1c 100644 --- a/resources/qml/Components/QrCodeScanPopup.qml +++ b/resources/qml/Pages/QrCodeScanPage.qml @@ -6,30 +6,23 @@ import QtMultimedia 5.12 import QtQuick.Shapes 1.12 import QtQuick.Controls.Material 2.12 +import "../Components" -Dialog { +Page { id: control property string _statusText: "" property string _statusColor: Material.primaryTextColor property bool _freezeScanning: false + signal headerComponentChanged() - parent: Overlay.overlay - - x: (parent.width - width) * 0.5 - y: (parent.height - height) * 0.5 - - height: app.height * 0.8 - width: app.width * 0.8 - - modal: true //% "Scan QR-Code" title: qsTrId("#scanQrCode") - standardButtons: Dialog.Cancel + onFocusChanged: focus ? open() : close() - onOpened: { - setDefaultStatusText() + function open() { + _setDefaultStatusText() control._freezeScanning = false if(serverConn.isCameraPermissionGranted()) cameraLoader.sourceComponent = cameraComponent @@ -37,18 +30,49 @@ Dialog { cameraLoader.sourceComponent = noPermissionComponent } - onClosed: cameraLoader.sourceComponent = null + function close() { + cameraLoader.sourceComponent = null + } - function setDefaultStatusText() { + function _setDefaultStatusText() { //% "Place the Code in the center" _statusText = qsTrId("#placeQrCodeInCenter") _statusColor = Material.primaryTextColor } + function _handleTag(tag) { + if(control._freezeScanning) + return + + control._freezeScanning = true + + //% "Plase wait" + control._statusText = qsTrId("#pleaseWait") + "..." + + if(app.openWidgetFromUrl(tag)) + control.close() + else { + //% "Invalid QR-Code" + control._statusText = qsTrId("#invalidQrCode") + control._statusColor = Material.color(Material.Red) + statusTextResetTimer.start() + control._freezeScanning = false + } + } + + function _requestCameraPermission() { + var permissionGranted = serverConn.requestCameraPermission() + + if(permissionGranted) + cameraLoader.sourceComponent = cameraComponent + } + contentItem: Loader { id: cameraLoader - asynchronous: true + anchors.fill: parent + + //asynchronous: true sourceComponent: null } @@ -68,6 +92,10 @@ Dialog { } } + FancyBusyIndicator { + anchors.centerIn: parent + } + VideoOutput { id: videoOutput x: 0 @@ -116,7 +144,7 @@ Dialog { border.width: width * 0.1 border.color: "#000000" - opacity: 0.3 + opacity: 0.5 color: "transparent" } @@ -173,50 +201,53 @@ Dialog { Component { id: noPermissionComponent - Item { - anchors.fill: parent + ColumnLayout { + //anchors.fill: parent + //anchors.margins: app.landscape() ? app.height * 0.1 : app.width * 0.1 + + property int columnWidth: control.width * 0.9 + + spacing: height * 0.02 + + Item { + Layout.fillHeight: true + } Label { id: noPermissionIcon - anchors { - top: parent.top - topMargin: parent.height * 0 - horizontalCenter: parent.horizontalCenter - } - font.pixelSize: parent.height * 0.3 + + Layout.preferredWidth: parent.columnWidth + Layout.alignment: Layout.Center + + font.pixelSize: app.landscape() ? parent.height * 0.25:parent.height * 0.15 font.family: fa5solid.name + + horizontalAlignment: Text.AlignHCenter + text: "\uf3ed" } Label { id: noPermissionText - anchors { - top: noPermissionIcon.bottom - topMargin: noPermissionIcon.height * 0.15 - horizontalCenter: parent.horizontalCenter - } - width: parent.width * 0.9 + Layout.preferredWidth: parent.columnWidth + Layout.alignment: Layout.Center font.bold: true - font.pixelSize: noPermissionIcon.height * 0.15 + font.pixelSize: noPermissionIcon.height * 0.2 horizontalAlignment: Text.AlignHCenter wrapMode: Text.Wrap - //% "Camera permission denied!" + //% "Camera access required" text: qsTrId("#cameraPermissionDenied") } Label { id: noPermissionDetailText - anchors { - top: noPermissionText.bottom - topMargin: noPermissionText.height * 0.15 - horizontalCenter: parent.horizontalCenter - } - width: parent.width * 0.9 + Layout.preferredWidth: parent.columnWidth + Layout.alignment: Layout.Center font.pixelSize: noPermissionText.font.pixelSize * 0.7 @@ -224,10 +255,26 @@ Dialog { wrapMode: Text.Wrap - //% "This app requires access to your camera in order to scan QR-Codes. It will never record or store any photos or videos." + //% "blueROCK needs to access your camera in order to scan QR-Codes. It will never record or store any photos or videos." text: qsTrId("#cameraPermissionDeniedDetails") } + Button { + id: grantPermissionButton + + Layout.alignment: Layout.Center + + //% "Allow access" + text: qsTrId("#allowAccess") + + onClicked: control._requestCameraPermission() + } + + + Item { + Layout.fillHeight: true + } + } } @@ -235,25 +282,7 @@ Dialog { id: zxingFilter decoder { - onTagFound: { - if(control._freezeScanning) - return - - control._freezeScanning = true - - //% "Plase wait" - control._statusText = qsTrId("#pleaseWait") + "..." - - if(app.openWidgetFromUrl(tag)) - control.close() - else { - //% "Invalid QR-Code" - control._statusText = qsTrId("#invalidQrCode") - control._statusColor = Material.color(Material.Red) - statusTextResetTimer.start() - control._freezeScanning = false - } - } + onTagFound: control._handleTag(tag) enabledDecoders: QZXing.DecoderFormat_QR_CODE } @@ -264,6 +293,6 @@ Dialog { running: false repeat: false interval: 3000 - onTriggered: setDefaultStatusText() + onTriggered: _setDefaultStatusText() } } diff --git a/resources/qml/Pages/StartPage.qml b/resources/qml/Pages/StartPage.qml index ebc6a09..eb8b0db 100644 --- a/resources/qml/Pages/StartPage.qml +++ b/resources/qml/Pages/StartPage.qml @@ -117,7 +117,9 @@ Page { ], //% "About blueROCK" ["\uf05a", qsTrId("#aboutBluerock"), aboutBluerockDisclaimerDialog.open], - ["\uf029", qsTrId("#scanQrCode"), qrCodeScanPopup.open], + ["\uf029", qsTrId("#scanQrCode"), function(){ + mainStack.push("qrc:/Pages/QrCodeScanPage.qml") + }], ] model: buttons @@ -172,10 +174,4 @@ Page { //% "This app was built using the Qt Framework licensed under the GNU lgplV3 license.

This app is open source and licensed under the GNU agplV3 license, the source code can be found here.

Resultservice and rankings provided by digital ROCK." content: qsTrId("#aboutBluerockDisclaimer") } - - QrCodeScanPopup { - id: qrCodeScanPopup - Material.theme: root.Material.theme - } - } diff --git a/resources/qml/qml.qrc b/resources/qml/qml.qrc index 5fe014c..4393e01 100644 --- a/resources/qml/qml.qrc +++ b/resources/qml/qml.qrc @@ -29,6 +29,6 @@ Components/ColoredItemDelegate.qml Components/AlignedButton.qml Components/SharePopup.qml - Components/QrCodeScanPopup.qml + Pages/QrCodeScanPage.qml diff --git a/resources/translations/de.qm b/resources/translations/de.qm index 0fa4d50..91dae98 100644 Binary files a/resources/translations/de.qm and b/resources/translations/de.qm differ diff --git a/resources/translations/de.ts b/resources/translations/de.ts index 7028d3e..577a7d5 100644 --- a/resources/translations/de.ts +++ b/resources/translations/de.ts @@ -4,34 +4,40 @@ - + Scan QR-Code QR-Code scannen - + Place the Code in the center Positioniere den Code in der Mitte - - Camera permission denied! + + Camera access required + Camera access denied - - This app requires access to your camera in order to scan QR-Codes. It will never record or store any photos or videos. - This app requires access to your camera in order to scan QR-Codes. It will never record store any photos or videos. + + blueROCK needs to access your camera in order to scan QR-Codes. It will never record or store any photos or videos. + This app needs to access your camera in order to scan QR-Codes. It will never record or store any photos or videos. + + + + + Allow access - + Plase wait Bitte warten - + Invalid QR-Code Ungültiger QR-Code @@ -112,17 +118,17 @@ Über blueROCK - + Where are the IFSC results? Wo sind die IFSC Ergebnisse? - + Unfortunately, the IFSC has restricted the access to their data and <b>is not willing to share results with blueROCK anymore</b>. Because of this, blueROCK is no longer able to access and display IFSC results.<br><br>You can find current IFSC results <a href="https://ifsc.results.info">over here</a> and on <a href="https://ifsc-climbing.org">their website</a>. Leider hat die IFSC den Zugang zu ihren Ergebnissen eingeschränkt<b>und ist nicht mehr bereit, Ergebnisse mit blueROCK zu teilen</b>. Daher ist blueROCK nicht länger in der Lage auf IFSC Ergebnisse zuzugriefen und diese anzuzeigen.<br><br>Aktuelle IFSC Ergebnisse finden sich <a href="https://ifsc.results.info">hier</a> und auf der <a href="https://ifsc-climbing.org">IFSC Webseite</a>. - + This app was built using the <a href='https://qt.io'>Qt Framework</a> licensed under the <a href='https://www.gnu.org/licenses/lgpl-3.0.en.html'>GNU lgplV3 license</a>.<br><br>This app is open source and licensed under the <a href='https://www.gnu.org/licenses/agpl-3.0.en.html'>GNU agplV3 license</a>, the source code can be found <a href='https://itsblue.dev/dorian/blueROCK/'>here</a>.<br><br>Resultservice and rankings provided by <a href='http://www.digitalROCK.de'>digital ROCK</a>. Diese App wurde unter Verwendung des <a href='https://qt.io'>Qt Frameworks</a> unter der <a href='https://www.gnu.org/licenses/lgpl-3.0.en.html'>GNU lgplV3 Lizenz</a> erstellt.<br><br>Diese App ist Open-source und lizensiert unter der <a href='https://www.gnu.org/licenses/agpl-3.0.en.html'>GNU agplV3 Lizenz</a>. Der Sourcecode findet sich <a href='https://itsblue.dev/dorian/blueROCK/'>hier</a>.Die Ergebnisse und Ranglisten werden von <a href='http://www.digitalROCK.de'>digital ROCK</a> zur Verfügung gestellt. diff --git a/resources/translations/en.qm b/resources/translations/en.qm index eb94bc0..cd69813 100644 Binary files a/resources/translations/en.qm and b/resources/translations/en.qm differ diff --git a/resources/translations/en.ts b/resources/translations/en.ts index 6689a06..883332c 100644 --- a/resources/translations/en.ts +++ b/resources/translations/en.ts @@ -4,34 +4,40 @@ - + Scan QR-Code - + Place the Code in the center - - Camera permission denied! + + Camera access required + Camera access denied - - This app requires access to your camera in order to scan QR-Codes. It will never record or store any photos or videos. - This app requires access to your camera in order to scan QR-Codes. It will never record store any photos or videos. + + blueROCK needs to access your camera in order to scan QR-Codes. It will never record or store any photos or videos. + This app needs to access your camera in order to scan QR-Codes. It will never record or store any photos or videos. + + + + + Allow access - + Plase wait - + Invalid QR-Code @@ -108,17 +114,17 @@ - + Where are the IFSC results? - + Unfortunately, the IFSC has restricted the access to their data and <b>is not willing to share results with blueROCK anymore</b>. Because of this, blueROCK is no longer able to access and display IFSC results.<br><br>You can find current IFSC results <a href="https://ifsc.results.info">over here</a> and on <a href="https://ifsc-climbing.org">their website</a>. - + This app was built using the <a href='https://qt.io'>Qt Framework</a> licensed under the <a href='https://www.gnu.org/licenses/lgpl-3.0.en.html'>GNU lgplV3 license</a>.<br><br>This app is open source and licensed under the <a href='https://www.gnu.org/licenses/agpl-3.0.en.html'>GNU agplV3 license</a>, the source code can be found <a href='https://itsblue.dev/dorian/blueROCK/'>here</a>.<br><br>Resultservice and rankings provided by <a href='http://www.digitalROCK.de'>digital ROCK</a>. diff --git a/sources/bluerockbackend.cpp b/sources/bluerockbackend.cpp index 6438387..9ebbd46 100644 --- a/sources/bluerockbackend.cpp +++ b/sources/bluerockbackend.cpp @@ -147,7 +147,7 @@ bool BlueRockBackend::isCameraPermissionGranted() { QtAndroid::PermissionResult cameraAccess = QtAndroid::checkPermission("android.permission.CAMERA"); return cameraAccess == QtAndroid::PermissionResult::Granted; #else - return false; + return true; #endif } @@ -204,7 +204,7 @@ bool BlueRockBackend::requestCameraPermission() { return true; #else - return false; + return true; #endif }