fix: hide nexus wall preview when wall disabled
This commit is contained in:
parent
ab3f3e2376
commit
eed3c712da
1 changed files with 79 additions and 38 deletions
|
|
@ -44,61 +44,102 @@ ColumnLayout {
|
||||||
radius: Tokens.rounding.large
|
radius: Tokens.rounding.large
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: wallIndicatorLoader
|
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
opacity: Config.background.wallpaperEnabled ? 0 : 1
|
||||||
opacity: 0
|
|
||||||
active: opacity > 0
|
active: opacity > 0
|
||||||
|
|
||||||
sourceComponent: StyledRect {
|
sourceComponent: ColumnLayout {
|
||||||
implicitWidth: wallLoadingIndicator.implicitSize + Tokens.padding.largeIncreased * 2
|
spacing: Tokens.spacing.extraSmall
|
||||||
implicitHeight: wallLoadingIndicator.implicitSize + Tokens.padding.largeIncreased * 2
|
|
||||||
|
|
||||||
color: Colours.palette.m3primaryContainer
|
MaterialIcon {
|
||||||
radius: Tokens.rounding.full
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
text: "hide_image"
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font: Tokens.font.icon.extraLarge
|
||||||
|
}
|
||||||
|
|
||||||
LoadingIndicator {
|
StyledText {
|
||||||
id: wallLoadingIndicator
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
text: qsTr("Wallpaper disabled")
|
||||||
anchors.centerIn: parent
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
containsIcon: true
|
font: Tokens.font.body.large
|
||||||
implicitSize: Math.min(wallWrapper.implicitWidth, wallWrapper.implicitHeight) * 0.4
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {
|
Anim {
|
||||||
type: Anim.DefaultEffects
|
type: Anim.SlowEffects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Item {
|
||||||
id: wallLoadDebounceTimer
|
|
||||||
|
|
||||||
interval: 100
|
|
||||||
onTriggered: {
|
|
||||||
if (wallImg.status !== Image.Ready)
|
|
||||||
wallIndicatorLoader.opacity = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FadeImage {
|
|
||||||
id: wallImg
|
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: Wallpapers.current
|
opacity: Config.background.wallpaperEnabled ? 1 : 0
|
||||||
preventInit: wallIndicatorLoader.opacity > 0
|
|
||||||
fadeOutAnim: Anim.DefaultEffects
|
|
||||||
fadeInAnim: Anim.SlowEffects
|
|
||||||
|
|
||||||
onSourceChanged: wallLoadDebounceTimer.restart()
|
Behavior on opacity {
|
||||||
|
Anim {
|
||||||
|
type: Anim.SlowEffects
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onStatusChanged: {
|
Loader {
|
||||||
if (status === Image.Ready) {
|
id: wallIndicatorLoader
|
||||||
wallLoadDebounceTimer.stop();
|
|
||||||
wallIndicatorLoader.opacity = 0;
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
opacity: 0
|
||||||
|
active: opacity > 0
|
||||||
|
|
||||||
|
sourceComponent: StyledRect {
|
||||||
|
implicitWidth: wallLoadingIndicator.implicitSize + Tokens.padding.largeIncreased * 2
|
||||||
|
implicitHeight: wallLoadingIndicator.implicitSize + Tokens.padding.largeIncreased * 2
|
||||||
|
|
||||||
|
color: Colours.palette.m3primaryContainer
|
||||||
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
|
LoadingIndicator {
|
||||||
|
id: wallLoadingIndicator
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
containsIcon: true
|
||||||
|
implicitSize: Math.min(wallWrapper.implicitWidth, wallWrapper.implicitHeight) * 0.4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {
|
||||||
|
type: Anim.DefaultEffects
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: wallLoadDebounceTimer
|
||||||
|
|
||||||
|
interval: 100
|
||||||
|
onTriggered: {
|
||||||
|
if (wallImg.status !== Image.Ready)
|
||||||
|
wallIndicatorLoader.opacity = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FadeImage {
|
||||||
|
id: wallImg
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
source: Wallpapers.current
|
||||||
|
preventInit: wallIndicatorLoader.opacity > 0
|
||||||
|
fadeOutAnim: Anim.DefaultEffects
|
||||||
|
fadeInAnim: Anim.SlowEffects
|
||||||
|
|
||||||
|
onSourceChanged: wallLoadDebounceTimer.restart()
|
||||||
|
|
||||||
|
onStatusChanged: {
|
||||||
|
if (status === Image.Ready) {
|
||||||
|
wallLoadDebounceTimer.stop();
|
||||||
|
wallIndicatorLoader.opacity = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue