app/resources/qml/Components/SpeedFlowChartLocker.qml

120 lines
3.1 KiB
QML

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.15
import QtPurchasing 1.12
Rectangle {
id: speedFlowChartLockedOverlay
anchors.fill: parent
anchors.margins: -20
color: Material.background
Connections {
target: speedFlowChartProduct
function onPurchaseFailed() {
purchaseBt.text = qsTr("Purchase failed")
purchaseBt.enabled = false
buttonTextResetTimer.start()
}
}
Timer {
id: buttonTextResetTimer
interval: 2000
running: false
repeat: false
onTriggered: {
purchaseBt.text = (speedFlowChartProduct.status === Product.Registered
? "Buy now for " + speedFlowChartProduct.price
: qsTr("this item is currently unavailable"))
purchaseBt.enabled = true
}
}
ColumnLayout {
id: lockedLayout
anchors {
fill: parent
topMargin: parent.height * 0.05
bottomMargin: parent.height * 0.05
rightMargin: parent.width * 0.1 + 20
leftMargin: parent.width * 0.1 + 20
}
//spacing: parent.height * 0.05
Label {
Layout.fillWidth: true
height: parent.height * 0.015
text: qsTr("This is a premium feature.")
font.bold: true
font.pixelSize: height
fontSizeMode: Text.Fit
minimumPixelSize: 1
horizontalAlignment: Text.AlignHCenter
}
SwipeGallery {
property string platformIcons: Qt.platform.os === "osx" || Qt.platform.os === "iso" ? "ios":"android"
Layout.fillHeight: true
Layout.fillWidth: true
images: [
"qrc:/screenshots/SpeedFlowchartDemo/" + platformIcons + "/1.jpeg",
"qrc:/screenshots/SpeedFlowchartDemo/" + platformIcons + "/2.jpeg",
"qrc:/screenshots/SpeedFlowchartDemo/" + platformIcons + "/3.jpeg"
]
}
Button {
id: purchaseBt
Layout.alignment: Layout.Center
enabled: speedFlowChartProduct.status === Product.Registered
text: speedFlowChartProduct.status === Product.Registered
? "\uf218 Buy now for " + speedFlowChartProduct.price
: qsTr("This item is currently unavailable")
font.family: fa5solid.name
onClicked: speedFlowChartProduct.purchase()
}
RowLayout {
Layout.alignment: Layout.Center
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")
}
}
}
}