foxygit / TV-Launcher Log in
commits tags

/qml/Backdrop.qml · 1.24 KB

raw
import QtQuick
import TvLauncher

// Bakgrund: vald bild, annars en mörk färgtoning i Bigscreen-stil.
Item {
    id: backdrop

    Rectangle {
        anchors.fill: parent
        gradient: Gradient {
            GradientStop { position: 0.0; color: Theme.backdropTop }
            GradientStop { position: 0.55; color: Theme.backdropMid }
            GradientStop { position: 1.0; color: Theme.backdropBottom }
        }
    }
    Rectangle {
        anchors.fill: parent
        gradient: Gradient {
            orientation: Gradient.Horizontal
            GradientStop { position: 0.0; color: "#00000000" }
            GradientStop { position: 1.0; color: Theme.alpha(Theme.backdropGlow, 0.25) }
        }
    }

    Image {
        id: img
        anchors.fill: parent
        source: prefs.wallpaper !== "" ? "file://" + prefs.wallpaper : ""
        fillMode: Image.PreserveAspectCrop
        sourceSize: Qt.size(backdrop.width, backdrop.height)
        asynchronous: true
        cache: false
        opacity: status === Image.Ready ? 1 : 0
        Behavior on opacity { NumberAnimation { duration: 400 } }
    }

    // Dämpning så att text och rutor syns.
    Rectangle {
        anchors.fill: parent
        color: "black"
        opacity: prefs.dim
    }
}