plugins/showfps: Allow showfps to work without kirigami and quickcharts
showfps is a handy plugin when deploying to a new platform because it will render something that says "I am here". Since both kirigami and quickcharts are quite high level, we add a variant that just depends on QtQuick and shows the fps which is what we promise anyway. Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
This commit is contained in:
parent
b202ecf711
commit
f9b9149ba4
2 changed files with 34 additions and 0 deletions
29
src/plugins/showfps/qml/main-fallback.qml
Normal file
29
src/plugins/showfps/qml/main-fallback.qml
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2022 Arjen Hiemstra <ahiemstra@heimr.nl>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
required property QtObject effect
|
||||
color: Qt.rgba(1.0, 1.0, 1.0, 0.5)
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
Text {
|
||||
color: root.effect.paintColor
|
||||
text: root.effect.fps + "/" + root.effect.maximumFps
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: i18nc("@label", "This effect is not a benchmark")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -74,6 +74,11 @@ void ShowFpsEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::millis
|
|||
m_scene = std::make_unique<OffscreenQuickScene>();
|
||||
const auto url = QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/showfps/qml/main.qml")));
|
||||
m_scene->setSource(url, {{QStringLiteral("effect"), QVariant::fromValue(this)}});
|
||||
if (!m_scene->rootItem()) {
|
||||
// main-fallback.qml has less dependencies than main.qml, so it should work on any system where kwin compiles
|
||||
const auto fallbackUrl = QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/showfps/qml/main-fallback.qml")));
|
||||
m_scene->setSource(fallbackUrl, {{QStringLiteral("effect"), QVariant::fromValue(this)}});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue