app/resources/qml/Components/SpeedFlowChartLocker.qml

126 lines
3.1 KiB
QML
Raw Normal View History

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtPurchasing 1.12
Rectangle {
id: speedFlowChartLockedOverlay
anchors.fill: parent
anchors.margins: -20
color: "white"
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
2021-06-06 21:53:41 +02:00
bottomMargin: parent.height * 0.05
rightMargin: parent.width * 0.1 + 20
leftMargin: parent.width * 0.1 + 20
}
//spacing: parent.height * 0.05
Image {
id: name
Layout.alignment: Layout.Center
Layout.preferredHeight: height
Layout.preferredWidth: width
2021-06-06 21:53:41 +02:00
width: lockedLayout.height * 0.05
height: width
mipmap: true
source: "qrc:/icons/lock.png"
}
Text {
Layout.fillWidth: true
height: parent.height * 0.05
text: qsTr("This is a premium feature.")
font.bold: true
font.pixelSize: parent.height * 0.05
fontSizeMode: Text.Fit
minimumPixelSize: 1
horizontalAlignment: Text.AlignHCenter
}
SwipeGallery {
Layout.fillHeight: true
Layout.fillWidth: true
images: ["qrc:/screenshots/SpeedFlowchartDemo/1.png","qrc:/screenshots/SpeedFlowchartDemo/2.png","qrc:/screenshots/SpeedFlowchartDemo/3.png"]
}
Button {
id: purchaseBt
Layout.alignment: Layout.Center
enabled: speedFlowChartProduct.status === Product.Registered
text: speedFlowChartProduct.status === Product.Registered
? "Buy now for " + speedFlowChartProduct.price
2021-06-06 21:53:41 +02:00
: qsTr("This item is currently unavailable")
icon.name: "buy"
onClicked: speedFlowChartProduct.purchase()
}
2021-06-06 21:53:41 +02:00
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")
}
}
}
}