1.4 KiB · text History 0fc5cce
// Renders sddm/theme/preview.png, the image KDE's login screen settings
// show for this theme. Re-run after changing the theme or its art:
//
//     QT_QPA_PLATFORM=offscreen qml6 tools/sddm-preview.qml
//
// The greeter's context objects are stood in for by ids here, which
// Main.qml resolves through the Loader's context.
import QtQuick 2.15
import QtQuick.Window 2.15

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

    QtObject { id: config
        property string backgrounds: "1920x1080"
        property string background: "#651d1d"
        property string foreground: "#fef3c7" }
    QtObject { id: sddm
        property string hostName: "neiam"
        property bool canPowerOff: true; property bool canReboot: true; property bool canSuspend: true
        signal loginFailed(); signal loginSucceeded()
        function login(u, p, s) {} }
    QtObject { id: userModel; property string lastUser: "" }
    ListModel { id: sessionModel; property int lastIndex: 0
        ListElement { name: "Plasma (Wayland)" } ListElement { name: "Plasma (X11)" } }

    Loader { id: theme; anchors.fill: parent; source: "../sddm/theme/Main.qml" }

    Timer {
        interval: 1000; running: true
        onTriggered: theme.item.grabToImage(function (result) {
            result.saveToFile(Qt.resolvedUrl("../sddm/theme/preview.png").toString().replace("file://", ""))
            Qt.quit()
        }, Qt.size(960, 540))
    }
}