- 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 { T.BusyIndicator {
id: control id: control
property var image: "qrc:/images/SpeedHold.png" property var image: "qrc:/images/SpeedHoldBlack.png"
implicitWidth: leftPadding + rightPadding implicitWidth: leftPadding + rightPadding
implicitHeight: topPadding + bottomPadding implicitHeight: topPadding + bottomPadding

View file

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