75 lines
2.3 KiB
QML
75 lines
2.3 KiB
QML
import QtQuick
|
|
import org.kde.plasma.plasmoid
|
|
import "lumen"
|
|
|
|
WallpaperItem {
|
|
id: root
|
|
|
|
readonly property var activeConfiguration: {
|
|
if (typeof wallpaper !== "undefined" && wallpaper && wallpaper.configuration)
|
|
return wallpaper.configuration
|
|
return typeof configuration !== "undefined" ? configuration : null
|
|
}
|
|
|
|
function option(name, fallback) {
|
|
if (!activeConfiguration)
|
|
return fallback
|
|
const value = activeConfiguration[name]
|
|
return value === undefined ? fallback : value
|
|
}
|
|
|
|
VulkanWallpaper {
|
|
id: engine
|
|
anchors.fill: parent
|
|
shaderUrl: {
|
|
const path = String(root.option("shaderPath", ""))
|
|
return path.length > 0 ? path : Qt.resolvedUrl("shaders/Lumen.frag")
|
|
}
|
|
targetFps: Number(root.option("targetFps", 30))
|
|
speed: Number(root.option("speed", 1.0))
|
|
running: Boolean(root.option("running", true))
|
|
mouseEnabled: Boolean(root.option("mouseEnabled", true))
|
|
watchSource: Boolean(root.option("watchSource", true))
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: "#111522"
|
|
visible: engine.errorMessage.length > 0 && !engine.fallbackActive
|
|
|
|
Text {
|
|
anchors.centerIn: parent
|
|
width: Math.min(parent.width * 0.8, 640)
|
|
horizontalAlignment: Text.AlignHCenter
|
|
wrapMode: Text.Wrap
|
|
color: "#f3f5fa"
|
|
font.pixelSize: 16
|
|
text: "Lumen Wallpaper\n\n" + engine.errorMessage
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.bottom: parent.bottom
|
|
anchors.bottomMargin: 80
|
|
height: warningText.implicitHeight + 16
|
|
color: "#cc421f35"
|
|
visible: engine.fallbackActive && engine.errorMessage.length > 0
|
|
|
|
Text {
|
|
id: warningText
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
anchors.margins: 12
|
|
horizontalAlignment: Text.AlignHCenter
|
|
wrapMode: Text.Wrap
|
|
elide: Text.ElideRight
|
|
maximumLineCount: 3
|
|
color: "#ffd9e2"
|
|
text: "Lumen: using the last working shader\n" + engine.errorMessage
|
|
}
|
|
}
|
|
}
|