1.1 KiB · text History 0d30999
// Renders splash/theme/contents/previews/{splash,preview}.png, the
// images KDE's splash screen and global theme settings show. Re-run
// after changing the splash or the wallpaper art:
//
//     QT_QPA_PLATFORM=offscreen qml6 tools/splash-preview.qml
import QtQuick 2.15
import QtQuick.Window 2.15

Window {
    width: 1920; height: 1080; visible: true

    Loader {
        id: splash
        anchors.fill: parent
        Component.onCompleted: setSource("../splash/theme/contents/splash/Splash.qml", {
            imageDir: Qt.resolvedUrl("../wallpaper/theme/contents/images").toString().replace("file://", ""),
            stage: 4,
        })
    }

    function path(name) {
        return Qt.resolvedUrl("../splash/theme/contents/previews/" + name).toString().replace("file://", "")
    }

    Timer {
        interval: 1500; running: true
        onTriggered: splash.item.grabToImage(function (full) {
            full.saveToFile(path("splash.png"))
            splash.item.grabToImage(function (small) {
                small.saveToFile(path("preview.png"))
                Qt.quit()
            }, Qt.size(480, 270))
        }, Qt.size(960, 540))
    }
}