162 lines
5.0 KiB
QML
162 lines
5.0 KiB
QML
/****************************************************************************
|
|
** ScStw Styling
|
|
** Copyright (C) 2020 Itsblue development
|
|
**
|
|
** This program is free software: you can redistribute it and/or modify
|
|
** it under the terms of the GNU General Public License as published by
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
** (at your option) any later version.
|
|
**
|
|
** This program is distributed in the hope that it will be useful,
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
** GNU General Public License for more details.
|
|
**
|
|
** You should have received a copy of the GNU General Public License
|
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
****************************************************************************/
|
|
|
|
import QtQuick 2.0
|
|
import QtQuick.Controls 2.0
|
|
import de.itsblue.ScStw 2.0
|
|
|
|
Column {
|
|
id: control
|
|
|
|
property var timers
|
|
property var colors
|
|
property var fontName
|
|
property bool showSecLabel: false
|
|
property bool showTimerLetter: true
|
|
property double textScale: 1
|
|
|
|
spacing: 0
|
|
|
|
Repeater {
|
|
id: timerRep
|
|
|
|
model: control.timers.length
|
|
|
|
delegate: Item {
|
|
id: timerDel
|
|
|
|
width: parent.width
|
|
height: control.height / timerRep.model
|
|
|
|
Text {
|
|
id: timerLetterLa
|
|
|
|
enabled: control.showTimerLetter && text !== ""
|
|
|
|
anchors {
|
|
left: parent.left
|
|
leftMargin: parent.width * 0.03
|
|
}
|
|
|
|
width: parent.width * 0.15
|
|
height: parent.height * 0.5
|
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
|
|
Text {
|
|
id: timerTextLa
|
|
|
|
anchors.centerIn: parent
|
|
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
|
|
|
|
color: ([ScStwTimer.WON,ScStwTimer.WILDCARD].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)
|
|
|
|
enabled: control.timers[index]["state"] !== ScStwTimer.DISABLED
|
|
|
|
text: control.timers[index]["text"]
|
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
font.pixelSize: height * control.textScale
|
|
font.styleName: control.fontName
|
|
minimumPixelSize: 1
|
|
}
|
|
|
|
Text {
|
|
id: reactTimeLa
|
|
|
|
property int rtime: control.timers[index]["reactionTime"]
|
|
|
|
anchors {
|
|
centerIn: parent
|
|
verticalCenterOffset: timerTextLa.contentHeight * 0.4 + reactTimeLa.contentHeight * 0.4 + timerTextLa.anchors.verticalCenterOffset
|
|
horizontalCenterOffset: parent.width * 0.06
|
|
}
|
|
|
|
width: parent.width * 0.6
|
|
height: parent.height * 0.15
|
|
|
|
scale: enabled ? 1:0.9
|
|
opacity: enabled ? 1:0
|
|
|
|
enabled: control.timers[index]["state"] >= ScStwTimer.STARTING && rtime !== 0
|
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
text: "reaction time (ms): " + Math.round(rtime)
|
|
|
|
color: control.colors.text
|
|
|
|
font.pixelSize: timerTextLa.font.pixelSize * control.textScale
|
|
font.styleName: control.fontName
|
|
minimumPixelSize: 1
|
|
|
|
Behavior on opacity {
|
|
NumberAnimation {
|
|
duration: 200
|
|
}
|
|
}
|
|
|
|
Behavior on scale {
|
|
NumberAnimation {
|
|
duration: 200
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
Behavior on opacity {
|
|
NumberAnimation {
|
|
duration: 200
|
|
}
|
|
}
|
|
}
|