1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -05:00

wrap shaders in a loader

This commit is contained in:
bbedward
2025-09-25 23:33:57 -04:00
parent 066d1847e4
commit c7b4e2c49d

View File

@@ -77,7 +77,6 @@ LazyLoader {
monitor: modelData.name monitor: modelData.name
} }
Component.onDestruction: { Component.onDestruction: {
weProc.stop() weProc.stop()
} }
@@ -116,8 +115,10 @@ LazyLoader {
} }
function changeWallpaper(newPath, force) { function changeWallpaper(newPath, force) {
if (!force && newPath === currentWallpaper.source) return if (!force && newPath === currentWallpaper.source)
if (!newPath || newPath.startsWith("#")) return return
if (!newPath || newPath.startsWith("#"))
return
if (root.transitioning) { if (root.transitioning) {
transitionAnimation.stop() transitionAnimation.stop()
@@ -163,7 +164,6 @@ LazyLoader {
} }
} }
Loader { Loader {
anchors.fill: parent anchors.fill: parent
active: !root.source || root.isColorSource active: !root.source || root.isColorSource
@@ -212,15 +212,14 @@ LazyLoader {
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
onStatusChanged: { onStatusChanged: {
if (status !== Image.Ready) return if (status !== Image.Ready)
return
if (root.actualTransitionType === "none") { if (root.actualTransitionType === "none") {
currentWallpaper.source = source currentWallpaper.source = source
nextWallpaper.source = "" nextWallpaper.source = ""
root.transitionProgress = 0.0 root.transitionProgress = 0.0
} else { } else {
currentWallpaper.layer.enabled = true
layer.enabled = true
visible = true visible = true
if (!root.transitioning) { if (!root.transitioning) {
transitionAnimation.start() transitionAnimation.start()
@@ -229,11 +228,36 @@ LazyLoader {
} }
} }
ShaderEffect { Loader {
id: fadeShader id: effectLoader
anchors.fill: parent anchors.fill: parent
visible: root.actualTransitionType === "fade" && (root.hasCurrent || root.booting) active: root.actualTransitionType !== "none" && (root.hasCurrent || root.booting)
sourceComponent: {
switch (root.actualTransitionType) {
case "fade":
return fadeComp
case "wipe":
return wipeComp
case "disc":
return discComp
case "stripes":
return stripesComp
case "iris bloom":
return irisComp
case "pixelate":
return pixelateComp
case "portal":
return portalComp
default:
return null
}
}
}
Component {
id: fadeComp
ShaderEffect {
anchors.fill: parent
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper property variant source2: nextWallpaper
property real progress: root.transitionProgress property real progress: root.transitionProgress
@@ -245,15 +269,14 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height) property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width property real screenWidth: modelData.width
property real screenHeight: modelData.height property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_fade.frag.qsb") fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_fade.frag.qsb")
} }
}
Component {
id: wipeComp
ShaderEffect { ShaderEffect {
id: wipeShader
anchors.fill: parent anchors.fill: parent
visible: root.actualTransitionType === "wipe" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper property variant source2: nextWallpaper
property real progress: root.transitionProgress property real progress: root.transitionProgress
@@ -267,15 +290,14 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height) property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width property real screenWidth: modelData.width
property real screenHeight: modelData.height property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_wipe.frag.qsb") fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_wipe.frag.qsb")
} }
}
Component {
id: discComp
ShaderEffect { ShaderEffect {
id: discShader
anchors.fill: parent anchors.fill: parent
visible: root.actualTransitionType === "disc" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper property variant source2: nextWallpaper
property real progress: root.transitionProgress property real progress: root.transitionProgress
@@ -291,15 +313,14 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height) property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width property real screenWidth: modelData.width
property real screenHeight: modelData.height property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_disc.frag.qsb") fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_disc.frag.qsb")
} }
}
Component {
id: stripesComp
ShaderEffect { ShaderEffect {
id: stripesShader
anchors.fill: parent anchors.fill: parent
visible: root.actualTransitionType === "stripes" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper property variant source2: nextWallpaper
property real progress: root.transitionProgress property real progress: root.transitionProgress
@@ -315,15 +336,14 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height) property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width property real screenWidth: modelData.width
property real screenHeight: modelData.height property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_stripes.frag.qsb") fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_stripes.frag.qsb")
} }
}
Component {
id: irisComp
ShaderEffect { ShaderEffect {
id: irisBloomShader
anchors.fill: parent anchors.fill: parent
visible: root.actualTransitionType === "iris bloom" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper property variant source2: nextWallpaper
property real progress: root.transitionProgress property real progress: root.transitionProgress
@@ -339,19 +359,18 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height) property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width property real screenWidth: modelData.width
property real screenHeight: modelData.height property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_iris_bloom.frag.qsb") fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_iris_bloom.frag.qsb")
} }
}
Component {
id: pixelateComp
ShaderEffect { ShaderEffect {
id: pixelateShader
anchors.fill: parent anchors.fill: parent
visible: root.actualTransitionType === "pixelate" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper property variant source2: nextWallpaper
property real progress: root.transitionProgress property real progress: root.transitionProgress
property real smoothness: root.edgeSmoothness // controls starting block size property real smoothness: root.edgeSmoothness
property real fillMode: root.fillMode property real fillMode: root.fillMode
property vector4d fillColor: root.fillColor property vector4d fillColor: root.fillColor
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : modelData.width) property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : modelData.width)
@@ -363,15 +382,14 @@ LazyLoader {
property real centerX: root.discCenterX property real centerX: root.discCenterX
property real centerY: root.discCenterY property real centerY: root.discCenterY
property real aspectRatio: root.width / root.height property real aspectRatio: root.width / root.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_pixelate.frag.qsb") fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_pixelate.frag.qsb")
} }
}
Component {
id: portalComp
ShaderEffect { ShaderEffect {
id: portalShader
anchors.fill: parent anchors.fill: parent
visible: root.actualTransitionType === "portal" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper property variant source2: nextWallpaper
property real progress: root.transitionProgress property real progress: root.transitionProgress
@@ -387,9 +405,9 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height) property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width property real screenWidth: modelData.width
property real screenHeight: modelData.height property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_portal.frag.qsb") fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_portal.frag.qsb")
} }
}
NumberAnimation { NumberAnimation {
id: transitionAnimation id: transitionAnimation
@@ -407,8 +425,6 @@ LazyLoader {
nextWallpaper.source = "" nextWallpaper.source = ""
nextWallpaper.visible = false nextWallpaper.visible = false
currentWallpaper.visible = root.actualTransitionType === "none" currentWallpaper.visible = root.actualTransitionType === "none"
currentWallpaper.layer.enabled = false
nextWallpaper.layer.enabled = false
root.transitionProgress = 0.0 root.transitionProgress = 0.0
}) })
} }