app/resources/qml/ProfilesDialog/ResultListPage.qml

125 lines
3.2 KiB
QML

/*
Speed Climbing Stopwatch - Simple Stopwatch for Climbers
Copyright (C) 2018 - 2019 Itsblue Development - Dorian Zeder
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import de.itsblue.ScStw 2.0
import de.itsblue.ScStw.Styling 2.0
import de.itsblue.ScStw.Styling.Components 1.0
import de.itsblue.ScStwApp 2.0
import "../components"
RemoteDataListView {
id: resultView
property string userName
property string title: userName
property string secondButt: "none"
signal opened()
anchors.margins: 10
clip: true
onOpened: {
loadData()
}
loadData: function () {
status = 905
listData = {}
listData = speedBackend.getResults(userName)
status = listData.lenght !== false ? 200:0
}
delegate: SmoothItemDelegate {
id: resultDel
width: parent.width
height: resultView.height / 4
backgroundRect.radius: 0
function getDateText(){
return new Date(listData[index]["timestamp"]*1000).toLocaleString(Qt.locale(), "dddd, dd.MMM HH:mm")
}
Rectangle {
color: "grey"
height: 1
width: parent.width * 0.9
visible: index > 0
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.top
}
}
Column {
anchors.fill: parent
anchors.leftMargin: parent.width * 0.05
Label {
id: dateLa
height: parent.height / parent.children.length
font.pixelSize: height * 0.8
fontSizeMode: Text.Fit
color: appTheme.theme.colors.text
text: resultDel.getDateText()
}
Label {
id: resultLa
height: parent.height / parent.children.length
font.pixelSize: height * 0.8
fontSizeMode: Text.Fit
color: appTheme.theme.colors.text
text: qsTr("result: ") + (listData[index]["result"] / 1000).toFixed(3) + " s"
}
Label {
id: reactionTimeLa
height: parent.height / parent.children.length
font.pixelSize: height * 0.8
fontSizeMode: Text.Fit
color: appTheme.theme.colors.text
text: qsTr("reaction time: ") + listData[index]["reactionTime"].toFixed(0) + " ms"
}
}
}
}