app/resources/qml/Components/SpeedFlowChartLocker.qml
2021-07-05 20:55:34 +02:00

131 lines
4.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
Page {
id: control
anchors.fill: parent
Connections {
target: speedFlowChartProduct
function onPurchaseFailed() {
//% "Purchase failed"
purchaseBt.text = qsTrId("#purchaseFailed")
purchaseBt.enabled = false
buttonTextResetTimer.start()
}
}
Timer {
id: buttonTextResetTimer
interval: 2000
running: false
repeat: false
onTriggered: {
purchaseBt.text = (speedFlowChartProduct.status === Product.Registered
//% "Buy now for"
? qsTrId("#buyNowFor") + " " + speedFlowChartProduct.price
//% "This item is currently unavailable"
: qsTrId("#itemIsUnavailable"))
purchaseBt.enabled = true
}
}
Column {
id: lockedLayout
anchors {
fill: parent
topMargin: parent.height * 0.02
bottomMargin: parent.height * 0.05
rightMargin: parent.width * 0.1 + 20
leftMargin: parent.width * 0.1 + 20
}
spacing: lockedLayout.height * 0.01
Label {
anchors.horizontalCenter: parent.horizontalCenter
height: lockedLayout.height * 0.03
width: lockedLayout.width
//% "This is a premium feature."
text: qsTrId("#thisIsAPremiumFeature")
font.pixelSize: height
font.bold: true
fontSizeMode: Text.Fit
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
minimumPixelSize: 1
}
SwipeGallery {
property string platformIcons: Qt.platform.os === "osx" || Qt.platform.os === "iso" ? "ios":"android"
height: lockedLayout.height * 0.85
width: lockedLayout.width
images: [
"qrc:/screenshots/SpeedFlowchartDemo/" + platformIcons + "/1.jpeg",
"qrc:/screenshots/SpeedFlowchartDemo/" + platformIcons + "/2.jpeg",
"qrc:/screenshots/SpeedFlowchartDemo/" + platformIcons + "/3.jpeg"
]
}
Button {
id: purchaseBt
anchors.horizontalCenter: parent.horizontalCenter
height: lockedLayout.height * 0.07
enabled: speedFlowChartProduct.status === Product.Registered
text: speedFlowChartProduct.status === Product.Registered
? "\uf218 "+ qsTrId("#buyNowFor") + " " + speedFlowChartProduct.price
: qsTrId("#itemIsUnavailable")
font.family: fa5solid.name
font.pixelSize: height * 0.4
font.capitalization: Font.MixedCase
onClicked: speedFlowChartProduct.purchase()
}
RowLayout {
id: bottomRow
anchors.horizontalCenter: parent.horizontalCenter
height: lockedLayout.height * 0.065
Button {
id: restorePurchaseButton
Layout.alignment: Layout.Center
Layout.preferredHeight: bottomRow.height
//visible: speedFlowChartProduct.status === Product.Registered
flat: true
font.pixelSize: height * 0.4
font.capitalization: Font.MixedCase
//% "Restore purchase"
text: qsTrId("#restorePurchase")
onClicked: inAppProductStore.restorePurchases()
}
Button {
id: contactSupportButton
Layout.alignment: Layout.Center
Layout.preferredHeight: bottomRow.height
flat: true
font.pixelSize: height * 0.4
font.capitalization: Font.MixedCase
//% "contact support"
text: qsTrId("#contact support")
onClicked: Qt.openUrlExternally("mailto:contact@itsblue.de")
}
}
}
}