2021-06-06 18:34:27 +02:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Controls.Material 2.15
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: control
|
|
|
|
|
|
|
|
property var flowchartData: ({})
|
|
|
|
|
|
|
|
// always unlock in debug mode
|
2021-06-25 23:22:28 +02:00
|
|
|
//property bool unlocked: QT_DEBUG || appSettings.read("speedBackendPurchase") === "1"
|
|
|
|
property bool unlocked: appSettings.read("speedBackendPurchase") === "1"
|
2021-06-06 18:34:27 +02:00
|
|
|
|
2021-06-07 20:56:53 +02:00
|
|
|
|
2021-06-06 18:34:27 +02:00
|
|
|
state: "hidden"
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
bottom: parent.bottom
|
|
|
|
left: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
color: Material.background
|
|
|
|
|
2021-06-06 21:53:41 +02:00
|
|
|
onStateChanged: reloadState()
|
|
|
|
onUnlockedChanged: reloadState()
|
2021-06-06 18:34:27 +02:00
|
|
|
|
|
|
|
function toggle() {
|
|
|
|
if(control.state === "hidden"){
|
|
|
|
control.state = "visible"
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
control.state = "hidden"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function isVisible() {
|
|
|
|
return control.state === "visible"
|
|
|
|
}
|
|
|
|
|
2021-06-06 21:53:41 +02:00
|
|
|
function reloadState() {
|
|
|
|
if(state === "visible" && unlocked) {
|
|
|
|
speedFlowChartLoader.sourceComponent = speedFlowChartComponent
|
|
|
|
}
|
|
|
|
else if(state === "visible" && !unlocked) {
|
|
|
|
speedFlowChartLoader.sourceComponent = speedFlowChartLockerComponent
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
speedFlowChartLoader.sourceComponent = undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-06 18:34:27 +02:00
|
|
|
Connections {
|
|
|
|
target: speedFlowChartProduct
|
|
|
|
function onPurchaseRestored() {
|
2021-06-06 21:53:41 +02:00
|
|
|
control.unlocked = appSettings.read("speedBackendPurchase") === "1"
|
2021-06-06 18:34:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function onPurchaseSucceeded() {
|
2021-06-06 21:53:41 +02:00
|
|
|
control.unlocked = appSettings.read("speedBackendPurchase") === "1"
|
2021-06-06 18:34:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: speedFlowChartLoader
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: speedFlowChartComponent
|
|
|
|
SpeedFlowChart {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 10
|
|
|
|
|
|
|
|
flowchartData: control.flowchartData
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: speedFlowChartLockerComponent
|
|
|
|
|
|
|
|
SpeedFlowChartLocker {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "hidden"
|
|
|
|
PropertyChanges {
|
|
|
|
target: control
|
|
|
|
opacity: 0
|
|
|
|
anchors.leftMargin: 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
State {
|
|
|
|
name: "visible"
|
|
|
|
PropertyChanges {
|
|
|
|
target: control
|
|
|
|
opacity: 1
|
|
|
|
anchors.leftMargin: -parent.width
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
transitions: [
|
|
|
|
Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
properties: "opacity,scale,anchors.leftMargin"
|
|
|
|
duration: 200
|
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|