- fixed url

- fixed performance issues
This commit is contained in:
Dorian Zedler 2020-06-13 17:09:54 +02:00
parent ac0d1a4616
commit 75c6756162
Signed by: dorian
GPG key ID: 989DE36109AFA354
2 changed files with 28 additions and 32 deletions

View file

@ -23,7 +23,7 @@ import QtQuick.Controls 2.0
T.BusyIndicator {
id: control
property var image: "qrc:/images/SpeedHold.png"
property var image: "qrc:/images/SpeedHoldBlack.png"
implicitWidth: leftPadding + rightPadding
implicitHeight: topPadding + bottomPadding

View file

@ -28,26 +28,14 @@ Column {
property var fontName
property bool showSecLabel: false
property bool showTimerLetter: true
opacity: backend.scStwClient.state === ScStwClient.CONNECTED ? 1:0
property double textScale: 1
spacing: 0
Repeater {
id: timerRep
property var clearedTimers: removeDisabledTimers(control.timers)
function removeDisabledTimers(timers) {
var ret = []
for(var i = 0; i < timers.length; i++) {
if(timers[i]["state"] !== ScStwTimer.DISABLED)
ret.push(timers[i])
}
return ret
}
model: clearedTimers.length
model: control.timers.length
delegate: Item {
id: timerDel
@ -55,17 +43,16 @@ Column {
width: parent.width
height: control.height / timerRep.model
Label {
id: laneNameLa
Text {
id: timerLetterLa
visible: control.showTimerLetter
enabled: control.showTimerLetter && text !== ""
anchors {
left: parent.left
leftMargin: parent.width * 0.03
}
leftPadding: parent.width * 0.03
width: parent.width * 0.15
height: parent.height * 0.5
@ -74,45 +61,54 @@ Column {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
text: timerRep.clearedTimers[index]["letter"]
opacity: enabled ? 1:0
text: control.timers[index]["letter"]
color: control.colors.accent
font.pixelSize: height
font.styleName: control.fontName
Behavior on opacity {
NumberAnimation {
duration: 200
}
}
}
Label {
Text {
id: timerTextLa
anchors.centerIn: parent
anchors.horizontalCenterOffset: laneNameLa.text !== "" ? parent.width * 0.06:0
anchors.horizontalCenterOffset: timerLetterLa.enabled ? parent.width * 0.06:0
anchors.verticalCenterOffset: -(parent.height * 0.04 * reactTimeLa.opacity)
width: parent.width * 0.8
height: parent.height * 0.8
elide: "ElideRight"
color: ([ScStwTimer.WON].indexOf(timerRep.clearedTimers[index]["state"]) >= 0 ? control.colors.success :
[ScStwTimer.FAILED,ScStwTimer.LOST].indexOf(timerRep.clearedTimers[index]["state"]) >= 0 ? control.colors.error:
color: ([ScStwTimer.WON].indexOf(control.timers[index]["state"]) >= 0 ? control.colors.success :
[ScStwTimer.FAILED,ScStwTimer.LOST].indexOf(control.timers[index]["state"]) >= 0 ? control.colors.error:
control.colors.text)
text: timerRep.clearedTimers[index]["text"]
enabled: control.timers[index]["state"] !== ScStwTimer.DISABLED
text: control.timers[index]["text"]
fontSizeMode: Text.Fit
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pixelSize: height
font.pixelSize: height * 0.5
font.styleName: control.fontName
minimumPixelSize: 1
}
Label {
Text {
id: reactTimeLa
property int rtime: timerRep.clearedTimers[index]["reactionTime"]
property int rtime: control.timers[index]["reactionTime"]
anchors {
centerIn: parent
@ -126,7 +122,7 @@ Column {
scale: enabled ? 1:0.9
opacity: enabled ? 1:0
enabled: timerRep.clearedTimers[index]["state"] >= ScStwTimer.STARTING && rtime !== 0
enabled: control.timers[index]["state"] >= ScStwTimer.STARTING && rtime !== 0
fontSizeMode: Text.Fit
@ -137,7 +133,7 @@ Column {
color: control.colors.text
font.pixelSize: timerTextLa.font.pixelSize * 0.5
font.pixelSize: timerTextLa.font.pixelSize * control.textScale
font.styleName: control.fontName
minimumPixelSize: 1