From f4aa3deaeccab5e1ba14e0fce4c535c160aae6a1 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 6 Jun 2021 21:53:41 +0200 Subject: [PATCH] some more minor adjustments --- .../AndroidManifest.xml | 2 +- {android-sources => android}/build.gradle | 4 ++ .../gradle.properties | 0 .../gradle/wrapper/gradle-wrapper.jar | Bin .../gradle/wrapper/gradle-wrapper.properties | 0 {android-sources => android}/gradlew | 0 {android-sources => android}/gradlew.bat | 0 .../res/drawable-hdpi/icon.png | Bin .../res/drawable-ldpi/icon.png | Bin .../res/drawable-mdpi/icon.png | Bin .../res/values/libs.xml | 0 blueROCK.pro | 24 ++++--- resources/qml/Components/DisclaimerDialog.qml | 53 ++++++++++++++ .../qml/Components/SpeedFlowChartLocker.qml | 30 +++++++- .../qml/Components/SpeedFlowChartPopup.qml | 31 ++++---- resources/qml/Pages/StartPage.qml | 67 +++++++++--------- resources/qml/main.qml | 8 ++- resources/qml/qml.qrc | 1 + sources/main.cpp | 2 + 19 files changed, 160 insertions(+), 62 deletions(-) rename {android-sources => android}/AndroidManifest.xml (99%) rename {android-sources => android}/build.gradle (97%) rename {android-sources => android}/gradle.properties (100%) rename {android-sources => android}/gradle/wrapper/gradle-wrapper.jar (100%) rename {android-sources => android}/gradle/wrapper/gradle-wrapper.properties (100%) rename {android-sources => android}/gradlew (100%) rename {android-sources => android}/gradlew.bat (100%) rename {android-sources => android}/res/drawable-hdpi/icon.png (100%) rename {android-sources => android}/res/drawable-ldpi/icon.png (100%) rename {android-sources => android}/res/drawable-mdpi/icon.png (100%) rename {android-sources => android}/res/values/libs.xml (100%) create mode 100644 resources/qml/Components/DisclaimerDialog.qml diff --git a/android-sources/AndroidManifest.xml b/android/AndroidManifest.xml similarity index 99% rename from android-sources/AndroidManifest.xml rename to android/AndroidManifest.xml index 650953d..6c2852d 100644 --- a/android-sources/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -72,5 +72,5 @@ - + diff --git a/android-sources/build.gradle b/android/build.gradle similarity index 97% rename from android-sources/build.gradle rename to android/build.gradle index 443a800..36ab286 100644 --- a/android-sources/build.gradle +++ b/android/build.gradle @@ -74,4 +74,8 @@ android { minSdkVersion = qtMinSdkVersion targetSdkVersion = qtTargetSdkVersion } + + lintOptions { + checkReleaseBuilds false + } } diff --git a/android-sources/gradle.properties b/android/gradle.properties similarity index 100% rename from android-sources/gradle.properties rename to android/gradle.properties diff --git a/android-sources/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from android-sources/gradle/wrapper/gradle-wrapper.jar rename to android/gradle/wrapper/gradle-wrapper.jar diff --git a/android-sources/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from android-sources/gradle/wrapper/gradle-wrapper.properties rename to android/gradle/wrapper/gradle-wrapper.properties diff --git a/android-sources/gradlew b/android/gradlew similarity index 100% rename from android-sources/gradlew rename to android/gradlew diff --git a/android-sources/gradlew.bat b/android/gradlew.bat similarity index 100% rename from android-sources/gradlew.bat rename to android/gradlew.bat diff --git a/android-sources/res/drawable-hdpi/icon.png b/android/res/drawable-hdpi/icon.png similarity index 100% rename from android-sources/res/drawable-hdpi/icon.png rename to android/res/drawable-hdpi/icon.png diff --git a/android-sources/res/drawable-ldpi/icon.png b/android/res/drawable-ldpi/icon.png similarity index 100% rename from android-sources/res/drawable-ldpi/icon.png rename to android/res/drawable-ldpi/icon.png diff --git a/android-sources/res/drawable-mdpi/icon.png b/android/res/drawable-mdpi/icon.png similarity index 100% rename from android-sources/res/drawable-mdpi/icon.png rename to android/res/drawable-mdpi/icon.png diff --git a/android-sources/res/values/libs.xml b/android/res/values/libs.xml similarity index 100% rename from android-sources/res/values/libs.xml rename to android/res/values/libs.xml diff --git a/blueROCK.pro b/blueROCK.pro index 120941a..6224de8 100644 --- a/blueROCK.pro +++ b/blueROCK.pro @@ -37,20 +37,23 @@ qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target +# Add version to define +DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\" + HEADERS += \ headers/appsettings.h \ headers/serverconn.h DISTFILES += \ CHANGELOG.md \ - android-sources/AndroidManifest.xml \ - android-sources/build.gradle \ - android-sources/gradle.properties \ - android-sources/gradle/wrapper/gradle-wrapper.jar \ - android-sources/gradle/wrapper/gradle-wrapper.properties \ - android-sources/gradlew \ - android-sources/gradlew.bat \ - android-sources/res/values/libs.xml + android/AndroidManifest.xml \ + android/build.gradle \ + android/gradle.properties \ + android/gradle/wrapper/gradle-wrapper.jar \ + android/gradle/wrapper/gradle-wrapper.properties \ + android/gradlew \ + android/gradlew.bat \ + android/res/values/libs.xml android { QT += androidextras @@ -70,10 +73,10 @@ android { ANDROID_VERSION_NAME = $$VERSION ANDROID_VERSION_CODE = $$droidVersionCode($$ANDROID_VERSION_NAME) + message(Android version code: $$ANDROID_VERSION_CODE) include(/home/dorian/Android/Sdk/android_openssl/openssl.pri) - ANDROID_ABIS = armeabi-v7a arm64-v8a - ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources + ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android } ios { @@ -81,5 +84,6 @@ ios { xcode_product_bundle_identifier_setting.value = "de.itsblue.bluerock" } +# this has to be the last line! ANDROID_ABIS = armeabi-v7a arm64-v8a diff --git a/resources/qml/Components/DisclaimerDialog.qml b/resources/qml/Components/DisclaimerDialog.qml new file mode 100644 index 0000000..c96c3cf --- /dev/null +++ b/resources/qml/Components/DisclaimerDialog.qml @@ -0,0 +1,53 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Controls.Material 2.15 + +Dialog { + id: control + + title: "" + property string content: "" + + parent: Overlay.overlay + + x: (parent.width - width) * 0.5 + y: (parent.height - height) * 0.5 + + width: parent.width * 0.8 + height: implicitHeight + + modal: true + + standardButtons: Dialog.Close + + header: Label { + text: control.title + visible: control.title + elide: Label.ElideRight + padding: 24 + bottomPadding: 0 + font.bold: true + font.pixelSize: 16 + background: Rectangle { + radius: 2 + color: control.Material.dialogColor + clip: true + } + onLinkActivated: { + Qt.openUrlExternally(link) + } + } + + contentItem: Label { + wrapMode: Text.Wrap + + width: control.width * 0.8 + height: implicitHeight + + text: control.content + + onLinkActivated: { + Qt.openUrlExternally(link) + } + } +} diff --git a/resources/qml/Components/SpeedFlowChartLocker.qml b/resources/qml/Components/SpeedFlowChartLocker.qml index b72ea2d..4418db4 100644 --- a/resources/qml/Components/SpeedFlowChartLocker.qml +++ b/resources/qml/Components/SpeedFlowChartLocker.qml @@ -40,7 +40,7 @@ Rectangle { anchors { fill: parent topMargin: parent.height * 0.05 - bottomMargin: parent.height * 0.1 + bottomMargin: parent.height * 0.05 rightMargin: parent.width * 0.1 + 20 leftMargin: parent.width * 0.1 + 20 } @@ -54,7 +54,7 @@ Rectangle { Layout.preferredHeight: height Layout.preferredWidth: width - width: lockedLayout.height * 0.1 + width: lockedLayout.height * 0.05 height: width mipmap: true @@ -92,10 +92,34 @@ Rectangle { enabled: speedFlowChartProduct.status === Product.Registered text: speedFlowChartProduct.status === Product.Registered ? "Buy now for " + speedFlowChartProduct.price - : qsTr("this item is currently unavailable") + : qsTr("This item is currently unavailable") icon.name: "buy" onClicked: speedFlowChartProduct.purchase() } + RowLayout { + + Button { + id: restorePurchaseButton + Layout.alignment: Layout.Center + visible: speedFlowChartProduct.status === Product.Registered + + flat: true + text: "restore purchase" + + onClicked: inAppProductStore.restorePurchases() + } + + Button { + id: contactSupportButton + Layout.alignment: Layout.Center + + flat: true + text: "contact support" + + onClicked: Qt.openUrlExternally("mailto:contact@itsblue.de") + } + + } } } diff --git a/resources/qml/Components/SpeedFlowChartPopup.qml b/resources/qml/Components/SpeedFlowChartPopup.qml index fcd8297..989bb42 100644 --- a/resources/qml/Components/SpeedFlowChartPopup.qml +++ b/resources/qml/Components/SpeedFlowChartPopup.qml @@ -8,7 +8,7 @@ Rectangle { property var flowchartData: ({}) // always unlock in debug mode - property bool unlocked: appSettings.read("speedBackendPurchase") === "1" || QT_DEBUG + property bool unlocked: appSettings.read("speedBackendPurchase") === "1" state: "hidden" @@ -23,17 +23,8 @@ Rectangle { color: Material.background - onStateChanged: { - if(state === "visible" && unlocked) { - speedFlowChartLoader.sourceComponent = speedFlowChartComponent - } - else if(state === "visible" && !unlocked) { - speedFlowChartLoader.sourceComponent = speedFlowChartLockerComponent - } - else { - speedFlowChartLoader.sourceComponent = undefined - } - } + onStateChanged: reloadState() + onUnlockedChanged: reloadState() function toggle() { if(control.state === "hidden"){ @@ -48,14 +39,26 @@ Rectangle { return control.state === "visible" } + function reloadState() { + if(state === "visible" && unlocked) { + speedFlowChartLoader.sourceComponent = speedFlowChartComponent + } + else if(state === "visible" && !unlocked) { + speedFlowChartLoader.sourceComponent = speedFlowChartLockerComponent + } + else { + speedFlowChartLoader.sourceComponent = undefined + } + } + Connections { target: speedFlowChartProduct function onPurchaseRestored() { - control.unlocked = appSettings.read("speedBackendPurchase") === "1" ? "unlocked":"locked" + control.unlocked = appSettings.read("speedBackendPurchase") === "1" } function onPurchaseSucceeded() { - control.unlocked = appSettings.read("speedBackendPurchase") === "1" ? "unlocked":"locked" + control.unlocked = appSettings.read("speedBackendPurchase") === "1" } } diff --git a/resources/qml/Pages/StartPage.qml b/resources/qml/Pages/StartPage.qml index 0d3ce8e..3e0d5ca 100644 --- a/resources/qml/Pages/StartPage.qml +++ b/resources/qml/Pages/StartPage.qml @@ -83,18 +83,33 @@ Page { } - ToolButton { - id: ifscDisclaimerButton - + RowLayout { anchors { horizontalCenter: parent.horizontalCenter bottom: bottomDigitalrockDisclaimerLabel.top } - text: "WHERE ARE THE IFSC RESULTS?" - font.bold: true + Button { + id: ifscDisclaimerButton - onClicked: ifscDisclaimerDialog.open() + flat: true + font.bold: true + font.pixelSize: 15 + + text: "Where are the IFSC results?" + + onClicked: ifscDisclaimerDialog.open() + } + + Button { + flat: true + + font.pixelSize: 15 + + text: "About blueROCK" + + onClicked: aboutBluerockDisclaimerDialog.open() + } } Label { @@ -120,37 +135,23 @@ Page { } } - Dialog { + + DisclaimerDialog { id: ifscDisclaimerDialog - - parent: Overlay.overlay - - x: (parent.width - width) * 0.5 - y: (parent.height - height) * 0.5 - - width: parent.width * 0.8 - height: implicitHeight - title: "Where are the IFSC results?" - modal: true + content: "Unfortunately, the IFSC has restricted the access to their data and is not willing to share results with blueROCK anymore. " + + "Because of this, blueROCK is no longer able to access and display IFSC results.

" + + "You can find current IFSC results over here and on their website." + } - standardButtons: Dialog.Close + DisclaimerDialog { + id: aboutBluerockDisclaimerDialog + title: "blueROCK v" + APP_VERSION + "
By Itsblue Development" + content: "This app was built using the Qt Framework " + + "licensed under the GNU lgplV3 license.

"+ - contentItem: Label { - wrapMode: Text.Wrap - - width: ifscDisclaimerDialog.width * 0.8 - height: implicitHeight - - text: - "Unfortunately, the IFSC has restricted the access to their data and is not willing to share results with blueROCK anymore. " + - "Because of this, blueROCK is no longer able to access and display IFSC results.

" + - "You can find current IFSC results over here and on their website." - - onLinkActivated: { - Qt.openUrlExternally(link) - } - } + "This app is open source and licensed under the GNU agplV3 license," + + "the source code can be found here." } diff --git a/resources/qml/main.qml b/resources/qml/main.qml index e0f650f..fbbafd4 100644 --- a/resources/qml/main.qml +++ b/resources/qml/main.qml @@ -478,9 +478,15 @@ Window { } Store { + id: inAppProductStore + Product { id: speedFlowChartProduct - identifier: "speed_flowchart" + //identifier: "speed_flowchart" + identifier: "android.test.purchased" + //identifier: "android.test.canceled" + //identifier: "android.test.refunded" + type: Product.Unlockable onPurchaseRestored: { diff --git a/resources/qml/qml.qrc b/resources/qml/qml.qrc index 2305758..81bf996 100644 --- a/resources/qml/qml.qrc +++ b/resources/qml/qml.qrc @@ -25,5 +25,6 @@ Components/SpeedFlowChartLocker.qml Components/SpeedFlowChartPopup.qml Components/BlueRockBadge.qml + Components/DisclaimerDialog.qml diff --git a/sources/main.cpp b/sources/main.cpp index 193c314..e099c5c 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -48,6 +48,8 @@ int main(int argc, char *argv[]) engine.rootContext()->setContextProperty("QT_DEBUG", false); #endif + engine.rootContext()->setContextProperty("APP_VERSION", APP_VERSION); + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1;