2.1 KiB · text History 495b6f2
import QtQuick
import QtQuick.Window
import org.kde.kirigami as Kirigami

// The live CI wall in a window of its own, for a second screen: F11 for
// full screen, Esc to leave it, R to flip the order. Created by
// store.openWallWindow(); there's one, and closing it destroys it.
Window {
    id: wallWindow

    required property var store

    transientParent: null
    flags: Qt.Window
    width: Kirigami.Units.gridUnit * 64
    height: Kirigami.Units.gridUnit * 36
    minimumWidth: Kirigami.Units.gridUnit * 20
    minimumHeight: Kirigami.Units.gridUnit * 12
    title: i18n("Live CI")

    Kirigami.Theme.colorSet: Kirigami.Theme.Window
    Kirigami.Theme.inherit: false
    // Translucent: the background goes see-through (and the cards
    // partly), the text stays solid — unlike KWin's window opacity,
    // which fades everything. T toggles it.
    readonly property bool translucent: store.wallTranslucent
    color: translucent ? Qt.alpha(Kirigami.Theme.backgroundColor, 0.35) : Kirigami.Theme.backgroundColor

    readonly property bool fullScreen: visibility === Window.FullScreen

    onClosing: {
        store.forgetWallWindow(wallWindow)
        wallWindow.destroy()
    }

    function present() {
        if (visibility === Window.Minimized) showNormal()
        else show()
        raise()
        requestActivate()
    }

    function toggleFullScreen() {
        if (fullScreen) showNormal()
        else showFullScreen()
    }

    Shortcut { sequences: [StandardKey.FullScreen]; onActivated: wallWindow.toggleFullScreen() }
    Shortcut { sequence: "Escape"; enabled: wallWindow.fullScreen; onActivated: wallWindow.showNormal() }
    Shortcut { sequence: "T"; onActivated: wallWindow.store.setWallTranslucent(!wallWindow.store.wallTranslucent) }
    Shortcut { sequence: "R"; onActivated: wallWindow.store.setWallNewestFirst(!wallWindow.store.wallNewestFirst) }

    WallView {
        anchors.fill: parent
        store: wallWindow.store
        inWindow: true
        translucent: wallWindow.translucent
        fullScreen: wallWindow.fullScreen
        onToggleFullScreen: wallWindow.toggleFullScreen()
    }
}