-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/menu-life' into 'main'
Feature/menu life See merge request asxa86/aspire!21
- Loading branch information
Showing
7 changed files
with
302 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,120 @@ | ||
import QtQuick | ||
import aspire | ||
|
||
Rectangle { | ||
Item { | ||
id: root | ||
|
||
property alias text: txtLife.text | ||
property alias textTime: time.text | ||
property bool active: false | ||
clip: true | ||
|
||
signal decrementClicked() | ||
signal incrementClicked() | ||
signal timeTriggered(int seconds) | ||
required property int index | ||
required property color background | ||
required property bool selected | ||
required property int life | ||
required property int time | ||
|
||
ButtonCircle { | ||
property point center: Qt.point(parent.width / 8, parent.height / 2) | ||
width: parent.width * 0.75 | ||
height: width | ||
x: center.x - width / 2 | ||
y: center.y - height / 2 | ||
|
||
onClicked: root.decrementClicked() | ||
Rectangle { | ||
id: mask | ||
anchors.fill: parent | ||
radius: width / 16 | ||
visible: false | ||
layer.enabled: true | ||
} | ||
|
||
ButtonCircle { | ||
property point center: Qt.point(parent.width - parent.width / 8, parent.height / 2) | ||
width: parent.width * 0.75 | ||
height: width | ||
x: center.x - width / 2 | ||
y: center.y - height / 2 | ||
Rectangle { | ||
id: glow | ||
anchors.fill: parent | ||
layer.enabled: true | ||
layer.effect: MultiEffect { | ||
blurEnabled: true | ||
blur: 0.1 | ||
brightness: 0.5 | ||
} | ||
|
||
radius: width / 16 | ||
color: "darkgoldenrod" | ||
opacity: selected ? 1 : 0 | ||
scale: 0.99 | ||
|
||
onClicked: root.incrementClicked() | ||
TapHandler { | ||
onLongPressed: { | ||
Actions.select(index); | ||
} | ||
} | ||
} | ||
|
||
TextEDH { | ||
id: txtLife | ||
Item { | ||
anchors.fill: parent | ||
layer.enabled: true | ||
layer.effect: MultiEffect { | ||
source: counter | ||
maskSource: mask | ||
maskEnabled: true | ||
} | ||
|
||
anchors.centerIn: parent | ||
font.pixelSize: Math.min(parent.width, parent.height) / 2 | ||
} | ||
scale: 0.98 | ||
|
||
Rectangle { | ||
width: parent.width | ||
height: parent.height * 0.1 | ||
Rectangle { | ||
anchors.fill: parent | ||
|
||
Component.onCompleted: { | ||
color = Style.color.cardback; | ||
color.a = 0.3; | ||
} | ||
gradient: Gradient { | ||
GradientStop { position: 0.0; color: root.background } | ||
GradientStop { position: 1.0; color: Qt.darker(root.background) } | ||
} | ||
|
||
TextEDH { | ||
id: time | ||
verticalAlignment: Text.AlignVCenter | ||
horizontalAlignment: Text.AlignHCenter | ||
font.pixelSize: parent.height | ||
anchors.left: parent.left | ||
anchors.verticalCenter: parent.verticalCenter | ||
anchors.leftMargin: 15 | ||
} | ||
} | ||
ButtonCircle { | ||
property point center: Qt.point(parent.width / 8, parent.height / 2) | ||
width: parent.width * 0.75 | ||
height: width | ||
x: center.x - width / 2 | ||
y: center.y - height / 2 | ||
|
||
onActiveChanged: { | ||
timer.running = root.active | ||
} | ||
onClicked: Actions.updateLife(root.index, root.life - 1) | ||
} | ||
|
||
ButtonCircle { | ||
property point center: Qt.point(parent.width - parent.width / 8, parent.height / 2) | ||
width: parent.width * 0.75 | ||
height: width | ||
x: center.x - width / 2 | ||
y: center.y - height / 2 | ||
|
||
onClicked: Actions.updateLife(root.index, root.life + 1) | ||
} | ||
|
||
TextEDH { | ||
anchors.centerIn: parent | ||
font.pixelSize: Math.min(parent.width, parent.height) / 2 | ||
text: root.life.toString() | ||
} | ||
|
||
Rectangle { | ||
width: parent.width | ||
height: parent.height * 0.1 | ||
|
||
Component.onCompleted: { | ||
color = Style.color.cardback; | ||
color.a = 0.3; | ||
} | ||
|
||
TextEDH { | ||
verticalAlignment: Text.AlignVCenter | ||
horizontalAlignment: Text.AlignHCenter | ||
font.pixelSize: parent.height | ||
anchors.left: parent.left | ||
anchors.verticalCenter: parent.verticalCenter | ||
anchors.leftMargin: 15 | ||
text: Qt.formatTime(new Date(root.time), "mm:ss") | ||
} | ||
} | ||
|
||
Timer { | ||
id: timer | ||
interval: 1000 | ||
repeat: true | ||
Timer { | ||
id: timer | ||
interval: 100 | ||
repeat: true | ||
running: root.selected | ||
|
||
onTriggered: { | ||
root.timeTriggered(interval / 1000) | ||
onTriggered: Actions.updateTime(root.index, root.time + interval) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.