Warning, /plasma/kwin/src/plugins/showfps/qml/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2022 Arjen Hiemstra <ahiemstra@heimr.nl>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick
0008 import QtQuick.Controls
0009 import QtQuick.Layouts
0010 
0011 import org.kde.kirigami 2.18 as Kirigami
0012 import org.kde.quickcharts as Charts
0013 import org.kde.quickcharts.controls as ChartControls
0014 
0015 Rectangle {
0016     id: root
0017 
0018     required property QtObject effect
0019 
0020     readonly property color gridColor: Qt.rgba(Kirigami.Theme.backgroundColor.r,
0021                                                Kirigami.Theme.backgroundColor.g,
0022                                                Kirigami.Theme.backgroundColor.b,
0023                                                0.25)
0024 
0025     color: Qt.rgba(1.0, 1.0, 1.0, 0.5)
0026 
0027     ColumnLayout {
0028         anchors.fill: parent
0029 
0030         RowLayout {
0031             Layout.fillWidth: true
0032             Layout.fillHeight: true
0033 
0034             Charts.BarChart {
0035                 id: fpsChart
0036 
0037                 Layout.preferredWidth: Kirigami.Units.gridUnit
0038                 Layout.fillHeight: true
0039 
0040                 yRange.minimum: root.effect.maximumFps + 10
0041                 yRange.increment: 10
0042 
0043                 valueSources: Charts.SingleValueSource { value: root.effect.fps }
0044 
0045                 colorSource: Charts.SingleValueSource { value: Kirigami.Theme.highlightColor }
0046 
0047                 ChartControls.GridLines {
0048                     anchors.fill: parent
0049                     z: -1
0050 
0051                     chart: fpsChart
0052 
0053                     direction: ChartControls.GridLines.Vertical;
0054 
0055                     major.visible: false
0056 
0057                     minor.frequency: 10
0058                     minor.lineWidth: 1
0059                     minor.color: root.gridColor
0060                 }
0061             }
0062 
0063             Charts.BarChart {
0064                 Layout.fillWidth: true
0065                 Layout.fillHeight: true
0066 
0067                 yRange.minimum: 100
0068                 yRange.increment: 10
0069 
0070                 xRange.from: 0
0071                 xRange.to: 50
0072                 xRange.automatic: false
0073 
0074                 indexingMode: Charts.Chart.IndexSourceValues
0075 
0076                 valueSources: Charts.HistoryProxySource {
0077                     source: Charts.SingleValueSource {
0078                         value: root.effect.paintDuration
0079                     }
0080                     maximumHistory: 100
0081                     fillMode: Charts.HistoryProxySource.FillFromStart
0082                 }
0083 
0084                 colorSource: Charts.HistoryProxySource {
0085                     source: Charts.SingleValueSource {
0086                         value: root.effect.paintColor
0087                     }
0088                     maximumHistory: 100
0089                     fillMode: Charts.HistoryProxySource.FillFromStart
0090                 }
0091 
0092                 ChartControls.GridLines {
0093                     anchors.fill: parent
0094                     z: -1
0095 
0096                     chart: parent
0097 
0098                     direction: ChartControls.GridLines.Vertical;
0099 
0100                     major.visible: false
0101 
0102                     minor.frequency: 10
0103                     minor.lineWidth: 1
0104                     minor.color: root.gridColor
0105                 }
0106 
0107                 Label {
0108                     anchors.top: parent.top
0109                     anchors.horizontalCenter: parent.horizontalCenter
0110                     text: i18nc("@label", "Paint Duration")
0111                     font: Kirigami.Theme.smallFont
0112                 }
0113             }
0114 
0115             Charts.BarChart {
0116                 Layout.fillWidth: true
0117                 Layout.fillHeight: true
0118 
0119                 yRange.minimum: Qt.application.screens[0].width * Qt.application.screens[0].height
0120                 yRange.increment: 500000
0121 
0122                 xRange.from: 0
0123                 xRange.to: 50
0124                 xRange.automatic: false
0125 
0126                 indexingMode: Charts.Chart.IndexSourceValues
0127 
0128                 valueSources: Charts.HistoryProxySource {
0129                     source: Charts.SingleValueSource {
0130                         value: root.effect.paintAmount
0131                     }
0132                     maximumHistory: 100
0133                     fillMode: Charts.HistoryProxySource.FillFromStart
0134                 }
0135 
0136                 colorSource: Charts.HistoryProxySource {
0137                     source: Charts.SingleValueSource {
0138                         value: root.effect.paintColor
0139                     }
0140                     maximumHistory: 100
0141                     fillMode: Charts.HistoryProxySource.FillFromStart
0142                 }
0143 
0144                 ChartControls.GridLines {
0145                     anchors.fill: parent
0146                     z: -1
0147 
0148                     chart: parent
0149 
0150                     direction: ChartControls.GridLines.Vertical;
0151 
0152                     major.visible: false
0153 
0154                     minor.frequency: 100000
0155                     minor.lineWidth: 1
0156                     minor.color: root.gridColor
0157                 }
0158 
0159                 Label {
0160                     anchors.top: parent.top
0161                     anchors.horizontalCenter: parent.horizontalCenter
0162                     text: i18nc("@label", "Paint Amount")
0163                     font: Kirigami.Theme.smallFont
0164                 }
0165             }
0166         }
0167 
0168         RowLayout {
0169             Layout.fillWidth: true
0170 
0171             ChartControls.LegendDelegate {
0172                 Layout.fillWidth: true
0173                 Layout.preferredWidth: 0
0174 
0175                 name: i18nc("@label", "Current FPS")
0176                 value: root.effect.fps
0177                 color: Kirigami.Theme.highlightColor
0178             }
0179 
0180             ChartControls.LegendDelegate {
0181                 Layout.fillWidth: true
0182                 Layout.preferredWidth: 0
0183 
0184                 name: i18nc("@label", "Maximum FPS")
0185                 value: root.effect.maximumFps
0186                 color: Kirigami.Theme.neutralTextColor
0187             }
0188         }
0189 
0190         Label {
0191             Layout.fillWidth: true
0192             text: i18nc("@label", "This effect is not a benchmark")
0193         }
0194     }
0195 }