Spracherkennung für: .qml vermutete Sprache: Abap {ABAP[66] Delphi[66] SPS[55]} [Methode: maximale Elemente, drei Dimensionen]
/*****************************************************************************
* Copyright (C) 2020 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* ( at your option ) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
import QtQuick
import QtQuick.Window
import QtQuick.Templates as T
import VLC.MainInterface
import VLC.Style
import VLC.Widgets as Widgets
import VLC.Playlist
import VLC.Player
import VLC.Util
T.Control {
id: root
width: Helpers.alignRound(320, _alignNumber)
height: Helpers.alignRound(180, _alignNumber)
// Default size is always aligned, this only
// controls position alignment. Note that
// setting this may make dragging less smooth,
// depending on how big is the denominator
// for the fractional DPR (the bigger, the
// worse). See `Helpers::denominatorForFloat()`.
property bool pixelAlignedForDPR: !MainCtx.videoSurfaceCanHaveFractionalPosition
transform: Translate {
x: (root.x !== targetX) ? (targetX - root.x) : 0.0
y: (root.y !== targetY) ? (targetY - root.y) : 0.0
readonly property real targetX: root.pixelAlignedForDPR ? Helpers.alignRound(root.x, root._alignNumber)
: (MainCtx.videoSurfaceCanHaveFractionalPosition ? root.x
: Math.round(root.x))
readonly property real targetY: root.pixelAlignedForDPR ? Helpers.alignRound(root.y, root._alignNumber)
: (MainCtx.videoSurfaceCanHaveFractionalPosition ? root.y
: Math.round(root.y))
}
objectName: "pip window"
property real dragXMin: 0
property real dragXMax: 0
property real dragYMin: undefined
property real dragYMax: undefined
property int textStyle: Text.Outline
// `hideControls` being `false` does not necessarily mean that the buttons are shown:
property bool hideControls: MainCtx.usingTouch // By default controls are hidden with touch
Accessible.role: Accessible.Graphic
Accessible.focusable: false
Accessible.name: qsTr("video content")
property real _eDPR: MainCtx.effectiveDevicePixelRatio(Window.window) || 1.0
readonly property int _alignNumber: pixelAlignedForDPR ? Helpers.denominatorForFloat(_eDPR) : 1
Connections {
target: MainCtx
function onIntfDevicePixelRatioChanged() {
root._eDPR = MainCtx.effectiveDevicePixelRatio(root.Window.window) || 1.0
}
}
Drag.active: dragHandler.active
Drag.onActiveChanged: {
root.anchors.left = undefined
root.anchors.right = undefined
root.anchors.top = undefined
root.anchors.bottom = undefined
root.anchors.verticalCenter = undefined
root.anchors.horizontalCenter = undefined
}
DoubleClickIgnoringItem {
anchors.fill: parent
TapHandler {
gesturePolicy: TapHandler.WithinBounds
onDoubleTapped: (eventPoint, button) => {
// Docs are lying, there is no `deviceType`: QTBUG-135104
if (eventPoint.device.type !== PointerDevice.TouchScreen)
MainCtx.playerView = true
}
onTapped: (eventPoint, button) => {
// Docs are lying, there is no `deviceType`: QTBUG-135104
if (eventPoint.device.type === PointerDevice.TouchScreen) {
// Breaking the initial binding is intentional here:
root.hideControls = !root.hideControls
} else {
MainPlaylistController.togglePlayPause()
}
}
}
DragHandler {
id: dragHandler
target: root
cursorShape: Qt.DragMoveCursor
dragThreshold: 0
grabPermissions: PointerHandler.CanTakeOverFromAnything
xAxis.minimum: root.dragXMin
xAxis.maximum: root.dragXMax
yAxis.minimum: root.dragYMin
yAxis.maximum: root.dragYMax
}
HoverHandler {
id: hoverHandler
grabPermissions: PointerHandler.CanTakeOverFromAnything
cursorShape: Qt.ArrowCursor
Component.onCompleted: {
if (typeof blocking === 'boolean')
blocking = true // Qt 6.3 feature
}
}
}
background: VideoSurface {
id: videoSurface
videoSurfaceProvider: MainCtx.videoSurfaceProvider
color: (hoverHandler.hovered ||
playButton?.hovered ||
closeButton?.hovered ||
fullscreenButton?.hovered) ? "#10000000" : "transparent"
// It is acceptable for effects to exceed the boundaries of the
// parent. They are an exception to the "hypothetical clip test".
Widgets.DefaultShadow {
}
}
contentItem: Item {
visible: !root.hideControls &&
(hoverHandler.hovered ||
playButton.hovered ||
closeButton.hovered ||
fullscreenButton.hovered)
// Raise the content item so that the handlers of the control do
// not handle events that are to be handled by the handlers/items
// of the content item. Raising the content item should be fine
// because content item is supposed to be the foreground item.
z: 1
Widgets.IconButton {
id: playButton
anchors.centerIn: parent
font.pixelSize: VLCStyle.icon_large
description: qsTr("play/pause")
AccessibleCompat.id: "pipPlayButton"
text: (Player.playingState !== Player.PLAYING_STATE_PAUSED
&& Player.playingState !== Player.PLAYING_STATE_STOPPED)
? VLCIcons.pause_filled
: VLCIcons.play_filled
textStyle: root.textStyle
onClicked: MainPlaylistController.togglePlayPause()
}
Widgets.IconButton {
id: closeButton
anchors {
top: parent.top
topMargin: VLCStyle.margin_small
right: parent.right
rightMargin: VLCStyle.margin_small
}
font.pixelSize: VLCStyle.icon_PIP
description: qsTr("close video")
AccessibleCompat.id: "pipCloseButton"
text: VLCIcons.close
textStyle: root.textStyle
onClicked: MainPlaylistController.stop()
}
Widgets.IconButton {
id: fullscreenButton
anchors {
top: parent.top
topMargin: VLCStyle.margin_small
left: parent.left
leftMargin: VLCStyle.margin_small
}
font.pixelSize: VLCStyle.icon_PIP
description: qsTr("maximize player")
AccessibleCompat.id: "pipFullscreenButton"
text: VLCIcons.fullscreen
textStyle: root.textStyle
onClicked: MainCtx.playerView = true
}
}
}
[Dauer der Verarbeitung: 0.13 Sekunden, vorverarbeitet 2026-10-24]