2022-12-07 14:22:11 +01:00
|
|
|
import QtQuick
|
|
|
|
|
import "../Flowee" as Flowee
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
|
|
|
|
signal activated;
|
|
|
|
|
|
|
|
|
|
height: 60
|
|
|
|
|
Rectangle {
|
|
|
|
|
x: 30
|
|
|
|
|
width: parent.height
|
|
|
|
|
height: width
|
|
|
|
|
radius: width / 2
|
2023-02-21 16:40:46 +01:00
|
|
|
color: palette.window
|
2022-12-07 14:22:11 +01:00
|
|
|
}
|
|
|
|
|
Rectangle {
|
|
|
|
|
x: parent.width - width - 30
|
|
|
|
|
width: parent.height
|
|
|
|
|
height: width
|
|
|
|
|
radius: width / 2
|
2023-02-21 16:40:46 +01:00
|
|
|
color: palette.window
|
2022-12-07 14:22:11 +01:00
|
|
|
}
|
|
|
|
|
Rectangle {
|
|
|
|
|
x: 30 + parent.height / 2
|
|
|
|
|
width: parent.width - 30 - 30 - parent.height
|
|
|
|
|
height: parent.height
|
2023-02-21 16:40:46 +01:00
|
|
|
color: palette.window
|
2022-12-07 14:22:11 +01:00
|
|
|
}
|
|
|
|
|
Flowee.Label {
|
|
|
|
|
id: textLabel
|
|
|
|
|
text: qsTr("SLIDE TO SEND")
|
2023-02-22 22:18:11 +01:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: 30 + 50 // because the circle covers that.
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.rightMargin: 80
|
|
|
|
|
fontSizeMode: Text.HorizontalFit // account for long translations
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2022-12-07 14:22:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: dragCircle
|
|
|
|
|
width: parent.height - 5
|
|
|
|
|
height: width
|
|
|
|
|
radius: width / 2
|
|
|
|
|
x: 35
|
|
|
|
|
y: 2.5
|
2023-02-22 22:18:11 +01:00
|
|
|
opacity: 0.7
|
2022-12-07 14:22:11 +01:00
|
|
|
color: {
|
|
|
|
|
if (root.enabled)
|
|
|
|
|
return Pay.useDarkSkin ? mainWindow.floweeGreen : mainWindow.floweeBlue;
|
2023-02-21 16:40:46 +01:00
|
|
|
return Qt.darker(palette.button, 1.2);
|
2022-12-07 14:22:11 +01:00
|
|
|
}
|
|
|
|
|
property bool finished: false
|
|
|
|
|
onXChanged: {
|
2022-12-21 14:10:13 +01:00
|
|
|
if (x >= root.width - 120) {
|
2022-12-07 14:22:11 +01:00
|
|
|
finished = true;
|
|
|
|
|
root.activated();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DragHandler {
|
|
|
|
|
id: dragHandler
|
|
|
|
|
yAxis.enabled: false
|
|
|
|
|
xAxis.enabled: !dragCircle.finished
|
|
|
|
|
xAxis.minimum: 35
|
|
|
|
|
xAxis.maximum: root.width - 70
|
|
|
|
|
acceptedButtons: Qt.LeftButton
|
|
|
|
|
cursorShape: Qt.DragMoveCursor
|
|
|
|
|
onActiveChanged: {
|
|
|
|
|
// should the user abort the swipe, move it back
|
|
|
|
|
if (!active && !dragCircle.finished)
|
|
|
|
|
parent.x = 35
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Behavior on x {
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
id: revertAnim
|
|
|
|
|
easing.type: Easing.OutElastic
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|