diff options
author | Daniel d'Andrada <daniel.dandrada@luxoft.com> | 2018-03-26 18:05:15 +0200 |
---|---|---|
committer | Lukáš Tinkl <ltinkl@luxoft.com> | 2018-03-30 08:30:34 +0000 |
commit | caf20588fcd750e89f2c832b012c1c535406ef50 (patch) | |
tree | dcb62444dc843e28969cf90a248b2559cad547f8 | |
parent | 4570c511247f4b65ba86a150b01d7bb3049ccbe8 (diff) |
Show an FPS overlay on any application window
Change-Id: Ic536b9a732e8072234e4c4f1751853c5f416f222
Reviewed-by: Lukáš Tinkl <ltinkl@luxoft.com>
-rw-r--r-- | imports/assets/translations/cs_CZ.ts | 16 | ||||
-rw-r--r-- | imports/assets/translations/de_DE.ts | 16 | ||||
-rw-r--r-- | imports/assets/translations/en_GB.ts | 16 | ||||
-rw-r--r-- | imports/assets/translations/en_US.ts | 16 | ||||
-rw-r--r-- | imports/assets/translations/ja_JP.ts | 16 | ||||
-rw-r--r-- | imports/assets/translations/ko_KR.ts | 16 | ||||
-rw-r--r-- | imports/assets/translations/zh_CN.ts | 16 | ||||
-rw-r--r-- | imports/shared/utils/AppUIScreen.qml | 14 | ||||
-rw-r--r-- | imports/shared/utils/MonitorOverlay.qml (renamed from sysui/procmon/MonitorOverlay.qml) | 3 | ||||
-rw-r--r-- | imports/shared/utils/SecondaryWindow.qml | 13 | ||||
-rw-r--r-- | imports/shared/utils/qmldir | 1 | ||||
-rw-r--r-- | imports/system/models/application/ApplicationInfo.qml | 18 | ||||
-rw-r--r-- | sysui/about/About.qml | 1 | ||||
-rw-r--r-- | sysui/about/AboutPerformance.qml | 95 | ||||
-rw-r--r-- | sysui/display/CenterConsoleMonitorOverlay.qml | 3 | ||||
-rw-r--r-- | sysui/instrumentcluster/InstrumentClusterWindow.qml | 2 |
16 files changed, 234 insertions, 28 deletions
diff --git a/imports/assets/translations/cs_CZ.ts b/imports/assets/translations/cs_CZ.ts index ee180838..7cb3868b 100644 --- a/imports/assets/translations/cs_CZ.ts +++ b/imports/assets/translations/cs_CZ.ts @@ -48,6 +48,22 @@ UX na cestu</translation> <source>Instrument Cluster Performance Overlay</source> <translation type="unfinished"></translation> </message> + <message> + <source>System UI Compositing Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Application Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 primary window</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 secondary window</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>AboutRunningApps</name> diff --git a/imports/assets/translations/de_DE.ts b/imports/assets/translations/de_DE.ts index fc2d6785..7d784d57 100644 --- a/imports/assets/translations/de_DE.ts +++ b/imports/assets/translations/de_DE.ts @@ -47,6 +47,22 @@ UX to the road</source> <source>Instrument Cluster Performance Overlay</source> <translation type="unfinished"></translation> </message> + <message> + <source>System UI Compositing Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Application Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 primary window</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 secondary window</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>AboutRunningApps</name> diff --git a/imports/assets/translations/en_GB.ts b/imports/assets/translations/en_GB.ts index 03f0aa75..12748ad4 100644 --- a/imports/assets/translations/en_GB.ts +++ b/imports/assets/translations/en_GB.ts @@ -39,6 +39,22 @@ UX to the road</source> <source>Instrument Cluster Performance Overlay</source> <translation type="unfinished"></translation> </message> + <message> + <source>System UI Compositing Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Application Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 primary window</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 secondary window</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>AboutRunningApps</name> diff --git a/imports/assets/translations/en_US.ts b/imports/assets/translations/en_US.ts index 671bf890..a63b2b96 100644 --- a/imports/assets/translations/en_US.ts +++ b/imports/assets/translations/en_US.ts @@ -39,6 +39,22 @@ UX to the road</source> <source>Instrument Cluster Performance Overlay</source> <translation type="unfinished"></translation> </message> + <message> + <source>System UI Compositing Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Application Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 primary window</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 secondary window</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>AboutRunningApps</name> diff --git a/imports/assets/translations/ja_JP.ts b/imports/assets/translations/ja_JP.ts index ebdbdfd1..257e6193 100644 --- a/imports/assets/translations/ja_JP.ts +++ b/imports/assets/translations/ja_JP.ts @@ -47,6 +47,22 @@ UX to the road</source> <source>Instrument Cluster Performance Overlay</source> <translation type="unfinished"></translation> </message> + <message> + <source>System UI Compositing Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Application Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 primary window</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 secondary window</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>AboutRunningApps</name> diff --git a/imports/assets/translations/ko_KR.ts b/imports/assets/translations/ko_KR.ts index 414f4c82..bef84e38 100644 --- a/imports/assets/translations/ko_KR.ts +++ b/imports/assets/translations/ko_KR.ts @@ -54,6 +54,22 @@ UX to the road</source> <source>Instrument Cluster Performance Overlay</source> <translation type="unfinished"></translation> </message> + <message> + <source>System UI Compositing Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Application Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 primary window</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 secondary window</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>AboutRunningApps</name> diff --git a/imports/assets/translations/zh_CN.ts b/imports/assets/translations/zh_CN.ts index f2fafa2a..43d96afa 100644 --- a/imports/assets/translations/zh_CN.ts +++ b/imports/assets/translations/zh_CN.ts @@ -54,6 +54,22 @@ UX to the road</source> <source>Instrument Cluster Performance Overlay</source> <translation type="unfinished"></translation> </message> + <message> + <source>System UI Compositing Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Application Windows:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 primary window</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%1 secondary window</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>AboutRunningApps</name> diff --git a/imports/shared/utils/AppUIScreen.qml b/imports/shared/utils/AppUIScreen.qml index db235e52..da019911 100644 --- a/imports/shared/utils/AppUIScreen.qml +++ b/imports/shared/utils/AppUIScreen.qml @@ -128,9 +128,23 @@ ApplicationManagerWindow { case "locale": Style.languageLocale = value; break; + case "performanceMonitorEnabled": + monitorOverlay.fpsVisible = value; + break; } } + MonitorOverlay { + id: monitorOverlay + x: root.exposedRect.x + y: root.exposedRect.y + width: root.exposedRect.width - NeptuneStyle.dp(100) + height: root.exposedRect.height - NeptuneStyle.dp(50) + fpsVisible: false + window: root + z: 9999 + } + UISettings { onThemeChanged: updateTheme() onAccentColorChanged: { diff --git a/sysui/procmon/MonitorOverlay.qml b/imports/shared/utils/MonitorOverlay.qml index 6a4a16ff..efcaf9ef 100644 --- a/sysui/procmon/MonitorOverlay.qml +++ b/imports/shared/utils/MonitorOverlay.qml @@ -41,6 +41,9 @@ Item { property bool fpsVisible default property alias columnData: column.data + implicitWidth: column.width + implicitHeight: column.height + visible: fpsVisible FrameTimer { diff --git a/imports/shared/utils/SecondaryWindow.qml b/imports/shared/utils/SecondaryWindow.qml index d0322dc8..6ece863c 100644 --- a/imports/shared/utils/SecondaryWindow.qml +++ b/imports/shared/utils/SecondaryWindow.qml @@ -34,6 +34,7 @@ import QtApplicationManager 1.0 import com.pelagicore.settings 1.0 import com.pelagicore.styles.neptune 3.0 +import utils 1.0 ApplicationManagerWindow { id: root @@ -47,9 +48,21 @@ ApplicationManagerWindow { case "neptuneScale": root.NeptuneStyle.scale = value; break; + case "performanceMonitorEnabled": + performanceOverlay.fpsVisible = value; + break; } } + MonitorOverlay { + id: performanceOverlay + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + fpsVisible: false + window: root + z: 9999 + } + UISettings { onThemeChanged: updateTheme() Component.onCompleted: updateTheme() diff --git a/imports/shared/utils/qmldir b/imports/shared/utils/qmldir index d7f72196..6646b55f 100644 --- a/imports/shared/utils/qmldir +++ b/imports/shared/utils/qmldir @@ -1,5 +1,6 @@ singleton Style 1.0 Style.qml AppUIScreen 1.0 AppUIScreen.qml +MonitorOverlay 1.0 MonitorOverlay.qml StageLoader 1.0 StageLoader.qml Store 1.0 Store.qml singleton Logging 1.0 Logging.qml diff --git a/imports/system/models/application/ApplicationInfo.qml b/imports/system/models/application/ApplicationInfo.qml index dfe58890..e3cc9e1e 100644 --- a/imports/system/models/application/ApplicationInfo.qml +++ b/imports/system/models/application/ApplicationInfo.qml @@ -116,6 +116,16 @@ QtObject { property real exposedRectBottomMargin property real exposedRectTopMargin + /* + Whether a performance monitor overlay is enabled on the primary window + */ + property bool windowPerfMonitorEnabled: false + + /* + Whether a performance monitor overlay is enabled on the secondary window + */ + property bool secondaryWindowPerfMonitorEnabled: false + function start() { // TODO Add a start() method to QtAM::Application itself if (application) { @@ -175,6 +185,14 @@ QtObject { if (window) AM.WindowManager.setWindowProperty(window, "locale", localeCode); } + onWindowPerfMonitorEnabledChanged: { + if (window) + AM.WindowManager.setWindowProperty(window, "performanceMonitorEnabled", windowPerfMonitorEnabled); + } + onSecondaryWindowPerfMonitorEnabledChanged: { + if (window) + AM.WindowManager.setWindowProperty(secondaryWindow, "performanceMonitorEnabled", secondaryWindowPerfMonitorEnabled); + } onSecondaryWindowChanged: { if (secondaryWindow) diff --git a/sysui/about/About.qml b/sysui/about/About.qml index 11425f08..15b8c834 100644 --- a/sysui/about/About.qml +++ b/sysui/about/About.qml @@ -122,6 +122,7 @@ NeptunePopup { applicationModel: root.applicationModel } AboutPerformance { + applicationModel: root.applicationModel } } } diff --git a/sysui/about/AboutPerformance.qml b/sysui/about/AboutPerformance.qml index 01e8e40b..8baef78c 100644 --- a/sysui/about/AboutPerformance.qml +++ b/sysui/about/AboutPerformance.qml @@ -35,34 +35,81 @@ import QtQuick.Controls 2.3 import com.pelagicore.styles.neptune 3.0 import models.system 1.0 -Column { - topPadding: NeptuneStyle.dp(20) - spacing: NeptuneStyle.dp(20) +Flickable { + id: root - Label { - width: parent.width - wrapMode: Text.WordWrap - text: qsTr("Enabling performance monitoring forces System UI and/or the chosen" + - " application to constantly redraw itself, therefore having a constant," + - " unnecessary, GPU/CPU consumption.") - font.pixelSize: NeptuneStyle.fontSizeS - } + property var applicationModel + + clip: true + contentWidth: column.width + contentHeight: column.height + + Column { + id: column + width: root.width + + topPadding: NeptuneStyle.dp(20) + spacing: NeptuneStyle.dp(20) - SwitchDelegate { - width: parent.width - text: qsTr("Center Console Performance Overlay") - checked: SystemModel.centerConsolePerfOverlayEnabled - onToggled: { - SystemModel.centerConsolePerfOverlayEnabled = checked; + Label { + width: parent.width + wrapMode: Text.WordWrap + text: qsTr("Enabling performance monitoring forces System UI and/or the chosen" + + " application to constantly redraw itself, therefore having a constant," + + " unnecessary, GPU/CPU consumption.") + font.pixelSize: NeptuneStyle.fontSizeS + } + + Label { + text: qsTr("System UI Compositing Windows:") + font.weight: Font.Bold + } + + SwitchDelegate { + width: parent.width + text: qsTr("Center Console Performance Overlay") + checked: SystemModel.centerConsolePerfOverlayEnabled + onToggled: { + SystemModel.centerConsolePerfOverlayEnabled = checked; + } + } + + SwitchDelegate { + width: parent.width + text: qsTr("Instrument Cluster Performance Overlay") + checked: SystemModel.instrumentClusterPerfOverlayEnabled + onToggled: { + SystemModel.instrumentClusterPerfOverlayEnabled = checked; + } + } + + Label { + text: qsTr("Application Windows:") + font.weight: Font.Bold } - } - SwitchDelegate { - width: parent.width - text: qsTr("Instrument Cluster Performance Overlay") - checked: SystemModel.instrumentClusterPerfOverlayEnabled - onToggled: { - SystemModel.instrumentClusterPerfOverlayEnabled = checked; + Repeater { + model: root.applicationModel + delegate: Column { + width: parent.width + height: implicitHeight + spacing: NeptuneStyle.dp(20) + visible: model.appInfo.window != null || model.appInfo.secondaryWindow != null + SwitchDelegate { + id: primarySwitch + width: parent.width + text: qsTr("%1 primary window").arg(model.appInfo.name) + visible: model.appInfo.window != null + Binding { target: model.appInfo; property: "windowPerfMonitorEnabled"; value: primarySwitch.checked } + } + SwitchDelegate { + id: secondarySwitch + width: parent.width + text: qsTr("%1 secondary window").arg(model.appInfo.name) + visible: model.appInfo.secondaryWindow != null + Binding { target: model.appInfo; property: "secondaryWindowPerfMonitorEnabled"; value: secondarySwitch.checked } + } + } } } } diff --git a/sysui/display/CenterConsoleMonitorOverlay.qml b/sysui/display/CenterConsoleMonitorOverlay.qml index a73d6e14..5f1881bc 100644 --- a/sysui/display/CenterConsoleMonitorOverlay.qml +++ b/sysui/display/CenterConsoleMonitorOverlay.qml @@ -32,9 +32,8 @@ import QtQuick 2.10 import QtQuick.Controls 2.2 -import "../procmon" - import com.pelagicore.styles.neptune 3.0 +import utils 1.0 MonitorOverlay { id: root diff --git a/sysui/instrumentcluster/InstrumentClusterWindow.qml b/sysui/instrumentcluster/InstrumentClusterWindow.qml index 443189cc..5368587f 100644 --- a/sysui/instrumentcluster/InstrumentClusterWindow.qml +++ b/sysui/instrumentcluster/InstrumentClusterWindow.qml @@ -38,8 +38,6 @@ import QtApplicationManager 1.0 import com.pelagicore.styles.neptune 3.0 import com.pelagicore.settings 1.0 as Settings -import "../procmon" - Window { id: root width: Style.instrumentClusterWidth |