Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++
7.1 KB
Raw Blame
// G2.5: the fullscreen control bar, in its own top-level window.
//
// In fullscreen the picture is the whole screen, and the native D3D12 video window
// is drawn above everything in the main window's scene. A bar in the main scene
// would need a hole cut out of the picture; the design (and D1 in the goal plan)
// puts it in a separate small window instead. It is owned by the main window
// (always above it, never above other applications), takes keyboard focus only
// while typing a parameter, and is hidden outright when the controls
// hide, so a hidden bar composes nothing over the video.
//
// The window is taller than the pill so the preset menu can open upwards inside it;
// the pointer only hits the pill (or the open menu) because the rest is masked off.
import QtQuick
import QtQuick.Window

Window {
    id: win
    objectName: "fullscreenBar"
    required property Window owner
    property bool shown: false
    signal requestPage(string page)
    signal requestDialog(string key)
    signal requestFullscreen()
    signal requestLock()
    signal requestMove()
    signal requestHide()
    signal requestPlaylist()
    // Pointer movement over the bar keeps the controls up (the main window cannot
    // see it here).
    signal activity()
    readonly property bool hovered: bar.hovered
    readonly property bool menuOpen: bar.menuOpen
    readonly property bool editing: bar.editing
    readonly property bool interacting: bar.interacting
    // G3.2 (D1): the same window carries the cinema pill in windowed 极简 mode, where
    // it straddles the picture's bottom edge: its top is pillTop (owner-relative),
    // half over the native video window and half below it. In fullscreen it sits
    // 24px above the screen edge.
    property bool cinema: false
    property real pillTop: 0

    transientParent: owner
    // Keep the native flags stable: toggling WindowDoesNotAcceptFocus while
    // visible can discard the software-rendered translucent window contents.
    // Ordinary clicks hand activation back to the owner; typing keeps it here.
    flags: Qt.Tool | Qt.FramelessWindowHint
    // Clicking the video or another window must commit, too: the QML input
    // can retain activeFocus inside a window that no longer has OS focus.
    onActiveChanged: {
        if (!active && editing) bar.finishEditing()
        else if (active && !interacting) Qt.callLater(function() {
            if (win.active && !win.interacting) owner.requestActivate()
        })
    }
    onInteractingChanged: if (!interacting && active) Qt.callLater(function() {
        if (win.active && !win.interacting) owner.requestActivate()
    })
    onShownChanged: {
        if (!shown && editing) bar.finishEditing()
        if (shown && cinema) enter()
    }
    color: "transparent"

    // Room for the pill plus the preset menu above it (VMenu is at most 420 tall).
    readonly property int menuRoom: 440
    // At least 760: the transport needs the middle column. A portrait film's narrow
    // window lets the pill reach past the picture's sides.
    readonly property int barWidth: Math.min(860, Math.max(760, owner.width - 48))
    width: barWidth
    height: 92 + menuRoom
    // Centred; fullscreen: 24px above the screen's bottom edge (the design's 24px
    // side margin); cinema: .cine-bar top = --pic-h - 46. Kept on the owner's screen.
    x: {
        const cx = owner.x + Math.round((owner.width - width) / 2)
        const s = owner.screen
        return s ? Math.max(s.virtualX, Math.min(cx, s.virtualX + s.width - width)) : cx
    }
    y: cinema ? owner.y + Math.round(pillTop) - menuRoom
              : owner.y + owner.height - height - 24

    // Hidden outright rather than transparent, so it composes nothing over the video
    // (the PresentMon comparison in the plan measures exactly this). The fade is
    // the design's control fade: opacity .2s; the window goes when it finishes.
    property real fade: shown ? 1 : 0
    Behavior on fade { NumberAnimation { duration: Theme.d(200) } }
    visible: shown || fade > 0.01
    onVisibleChanged: veyra.logUi("ui-fullscreen", "control window visible=" + visible)

    // The seek preview rises above the pill, so its window region must include it.
    // With the menu open, the whole window takes input to allow outside-click close.
    // The pill's hover tips open above its buttons; while the pointer is on the pill
    // a band above it stays in the region, or the mask would cut the tip off and the
    // picture would show through it (field report 2026-10-02).
    readonly property int tipRoom: 56
    readonly property rect hitRect: menuOpen ? Qt.rect(0, 0, width, height)
                                             : bar.seekPreviewOpen ? Qt.rect(0, menuRoom - 122, width, 214)
                                             : bar.hovered ? Qt.rect(0, menuRoom - tipRoom, width, 92 + tipRoom)
                                             : Qt.rect(0, menuRoom, width, 92)
    onHitRectChanged: veyra.setWindowMask(win, hitRect)
    Component.onCompleted: veyra.setWindowMask(win, hitRect)

    // barIn (pages.css): from opacity 0, translate 30px, scale .94, .8s --spring
    // after .12s. Played by enter() when the cinema page shows.
    property real enterDy: 0
    property real enterScale: 1
    property real enterOpacity: 1
    function enter() { barIn.restart() }
    // The cinema pill enters with barIn each time it appears (page shown, dialog
    // closed); the fullscreen one keeps the plain fade and rise.
    SequentialAnimation {
        id: barIn
        ScriptAction { script: { win.enterDy = 30; win.enterScale = 0.94; win.enterOpacity = 0 } }
        PauseAnimation { duration: Theme.d(120) }
        ParallelAnimation {
            NumberAnimation { target: win; property: "enterDy"; to: 0; duration: Theme.d(800); easing.bezierCurve: Theme.spring }
            NumberAnimation { target: win; property: "enterScale"; to: 1; duration: Theme.d(800); easing.bezierCurve: Theme.spring }
            NumberAnimation { target: win; property: "enterOpacity"; to: 1; duration: Theme.d(800); easing.bezierCurve: Theme.spring }
        }
    }

    CineBar {
        id: bar
        x: 0
        y: win.menuRoom
        width: win.width
        height: 92
        fullscreen: !win.cinema
        menuBottomLimit: win.menuRoom - 16
        opacity: win.fade * win.enterOpacity
        // barIn-like rise while showing: translate 30px -> 0 with the fade.
        transform: Translate { y: (win.cinema ? 0 : (1 - win.fade) * 30) + win.enterDy }
        scale: win.enterScale
        onRequestPage: p => win.requestPage(p)
        onRequestDialog: k => win.requestDialog(k)
        onRequestFullscreen: win.requestFullscreen()
        onRequestLock: win.requestLock()
        onRequestMove: win.requestMove()
        onRequestHide: win.requestHide()
        onRequestPlaylist: win.requestPlaylist()
        HoverHandler {
            // Real movement only: hover repeats while the bar animates.
            property point last: Qt.point(-1, -1)
            onPointChanged: {
                const p = point.scenePosition
                if (Math.abs(p.x - last.x) < 1 && Math.abs(p.y - last.y) < 1) return
                last = p
                win.activity()
            }
        }
    }
}