Files
OpenVR-AdvancedSettings-frame/src/res/qml/StatisticsPage.qml
T
Vasily 76507bd602 Move common elements into /common/ and change imports
Elements work like they've always done, this just moves the commonly
used components away from the global namespace.

The qmldir file still does something, although at this point it is
unknown exactly how it's used and whether or not it could be changed to
simplify imports across the block.
2019-02-02 16:09:01 +01:00

235 lines
6.4 KiB
QML

import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import matzman666.advsettings 1.0
import "common"
MyStackViewPage {
headerText: "Statistics"
content: ColumnLayout {
spacing: 18
GridLayout {
columns: 3
MyText {
text: "HMD Distance Moved:"
}
MyText {
id: statsHmdMovedText
text: "-00.0"
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
Layout.rightMargin: 10
}
MyPushButton {
text: "Reset"
onClicked: {
StatisticsTabController.statsDistanceResetClicked()
}
}
MyText {
text: "HMD Rotations:"
}
MyText {
id: statsHmdRotationText
text: "0.0 CCW"
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
Layout.rightMargin: 10
}
MyPushButton {
text: "Reset"
onClicked: {
StatisticsTabController.statsRotationResetClicked()
}
}
MyText {
text: "Left Controller Max Speed:"
}
MyText {
id: statsLeftControllerSpeedText
text: "99.9 m/s"
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
Layout.rightMargin: 10
}
MyPushButton {
text: "Reset"
onClicked: {
StatisticsTabController.statsLeftControllerSpeedResetClicked()
}
}
MyText {
text: "Right Controller Max Speed:"
}
MyText {
id: statsRightControllerSpeedText
text: "99.9 m/s"
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
Layout.rightMargin: 10
}
MyPushButton {
text: "Reset"
onClicked: {
StatisticsTabController.statsRightControllerSpeedResetClicked()
}
}
}
GridLayout {
columns: 3
Layout.topMargin: 32
MyText {
text: "Presented Frames:"
}
MyText {
id: statsPresentedFramesText
text: "000"
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
Layout.rightMargin: 10
}
MyPushButton {
text: "Reset"
onClicked: {
StatisticsTabController.presentedFramesResetClicked()
}
}
MyText {
text: "Dropped Frames:"
}
MyText {
id: statsDroppedFramesText
text: "000"
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
Layout.rightMargin: 10
}
MyPushButton {
text: "Reset"
onClicked: {
StatisticsTabController.droppedFramesResetClicked()
}
}
MyText {
text: "Reprojected Frames:"
}
MyText {
id: statsReprojectionFramesText
text: "000"
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
Layout.rightMargin: 10
}
MyPushButton {
text: "Reset"
onClicked: {
StatisticsTabController.reprojectedFramesResetClicked()
}
}
MyText {
text: "Timed Out:"
}
MyText {
id: statsTimedOutText
text: "000"
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
Layout.rightMargin: 10
}
MyPushButton {
text: "Reset"
onClicked: {
StatisticsTabController.timedOutResetClicked()
}
}
MyText {
text: "Reprojection Ratio:"
}
MyText {
id: statstotalRatioText
text: "0.0"
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
Layout.rightMargin: 10
}
MyPushButton {
text: "Reset"
onClicked: {
StatisticsTabController.totalRatioResetClicked()
}
}
}
Item {
Layout.fillHeight: true
}
function updateStatistics() {
statsHmdMovedText.text = StatisticsTabController.hmdDistanceMoved.toFixed(1) + " m"
var rotations = StatisticsTabController.hmdRotations
if (rotations > 0) {
statsHmdRotationText.text = rotations.toFixed(2) + " CCW"
} else {
statsHmdRotationText.text = -rotations.toFixed(2) + " CW"
}
statsLeftControllerSpeedText.text = " " + StatisticsTabController.leftControllerMaxSpeed.toFixed(1) + " m/s"
statsRightControllerSpeedText.text = " " + StatisticsTabController.rightControllerMaxSpeed.toFixed(1) + " m/s"
statsPresentedFramesText.text = StatisticsTabController.presentedFrames
statsDroppedFramesText.text = StatisticsTabController.droppedFrames
statsReprojectionFramesText.text = StatisticsTabController.reprojectedFrames
statsTimedOutText.text = StatisticsTabController.timedOut
statstotalRatioText.text = (StatisticsTabController.totalReprojectedRatio*100.0).toFixed(1) + "%"
}
Timer {
id: statisticsUpdateTimer
repeat: true
interval: 100
onTriggered: {
parent.updateStatistics()
}
}
onVisibleChanged: {
if (visible) {
updateStatistics()
statisticsUpdateTimer.start()
} else {
statisticsUpdateTimer.stop()
}
}
}
}