Warning, /multimedia/kdenlive/src/monitor/view/kdenlivemonitor.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2015 Jean-Baptiste Mardelle <jb@kdenlive.org>
0003 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005
0006 import QtQuick.Controls 2.15
0007 import QtQuick.Window 2.15
0008 import Kdenlive.Controls 1.0
0009 import QtQuick 2.15
0010
0011 Item {
0012 id: root
0013 objectName: "root"
0014
0015 SystemPalette { id: activePalette }
0016
0017 // default size, but scalable by user
0018 height: 300; width: 400
0019 property string markerText
0020 property point profile: controller.profile
0021 property double zoom
0022 property point center
0023 property double scalex
0024 property double scaley
0025 property bool captureRightClick: false
0026 property bool dropped: false
0027 property string fps: '-'
0028 property bool showMarkers: false
0029 property bool showTimecode: false
0030 property bool showFps: false
0031 property bool showSafezone: false
0032 property bool showAudiothumb: false
0033 // Zoombar properties
0034 property double zoomStart: 0
0035 property double zoomFactor: 1
0036 property int zoomOffset: 0
0037 property bool showZoomBar: false
0038 property double offsetx : 0
0039 property double offsety : 0
0040 property real baseUnit: fontMetrics.font.pixelSize * 0.8
0041 property int duration: 300
0042 property int mouseRulerPos: 0
0043 property double frameSize: 10
0044 property double timeScale: 1
0045 property int overlayType: controller.overlayType
0046 property color overlayColor: controller.overlayColor
0047 property bool isClipMonitor: false
0048
0049 function updateClickCapture() {
0050 root.captureRightClick = false
0051 }
0052
0053 FontMetrics {
0054 id: fontMetrics
0055 font: fixedFont
0056 }
0057
0058 signal editCurrentMarker()
0059 signal startRecording()
0060
0061 onDurationChanged: {
0062 clipMonitorRuler.updateRuler()
0063 }
0064
0065 onWidthChanged: {
0066 clipMonitorRuler.updateRuler()
0067 }
0068 function updatePalette() {
0069 clipMonitorRuler.forceRepaint()
0070 }
0071
0072 function startCountdown() {
0073 countDownLoader.source = "Countdown.qml"
0074 }
0075 function stopCountdown() {
0076 root.startRecording()
0077 countDownLoader.source = ""
0078 }
0079
0080 function switchOverlay() {
0081 if (controller.overlayType >= 5) {
0082 controller.overlayType = 0
0083 } else {
0084 controller.overlayType = controller.overlayType + 1;
0085 }
0086 root.overlayType = controller.overlayType
0087 }
0088 MouseArea {
0089 id: barOverArea
0090 hoverEnabled: true
0091 acceptedButtons: Qt.NoButton
0092 anchors.fill: parent
0093 onWheel: wheel => {
0094 controller.seek(wheel.angleDelta.x + wheel.angleDelta.y, wheel.modifiers)
0095 }
0096 onEntered: {
0097 controller.setWidgetKeyBinding(i18n("<b>Click</b> to play, <b>Double click</b> for fullscreen, <b>Hover right</b> for toolbar, <b>Wheel</b> or <b>arrows</b> to seek, <b>Ctrl wheel</b> to zoom"));
0098 }
0099 onExited: {
0100 controller.setWidgetKeyBinding();
0101 }
0102 }
0103 DropArea { //Drop area for effects
0104 id: effectArea
0105 anchors.fill: parent
0106 keys: 'kdenlive/effect'
0107 property string droppedData
0108 property string droppedDataSource
0109 onEntered: drag => {
0110 drag.acceptProposedAction()
0111 droppedData = drag.getDataAsString('kdenlive/effect')
0112 droppedDataSource = drag.getDataAsString('kdenlive/effectsource')
0113 }
0114 onDropped: {
0115 controller.addEffect(droppedData, droppedDataSource)
0116 droppedData = ""
0117 droppedDataSource = ""
0118 }
0119 }
0120 SceneToolBar {
0121 id: sceneToolBar
0122 anchors {
0123 right: parent.right
0124 top: parent.top
0125 topMargin: 4
0126 rightMargin: 4
0127 leftMargin: 4
0128 }
0129 }
0130
0131 Item {
0132 height: root.height - controller.rulerHeight
0133 width: root.width
0134 Item {
0135 id: frame
0136 objectName: "referenceframe"
0137 width: root.profile.x * root.scalex
0138 height: root.profile.y * root.scaley
0139 x: root.center.x - width / 2 - root.offsetx;
0140 y: root.center.y - height / 2 - root.offsety;
0141
0142 Loader {
0143 anchors.fill: parent
0144 source: {
0145 switch(root.overlayType)
0146 {
0147 case 0:
0148 return '';
0149 case 1:
0150 return "OverlayStandard.qml";
0151 case 2:
0152 return "OverlayMinimal.qml";
0153 case 3:
0154 return "OverlayCenter.qml";
0155 case 4:
0156 return "OverlayCenterDiagonal.qml";
0157 case 5:
0158 return "OverlayThirds.qml";
0159 }
0160 }
0161 }
0162 Loader {
0163 id: countDownLoader
0164 anchors.fill: parent
0165 }
0166 }
0167 Item {
0168 id: monitorOverlay
0169 anchors.fill: parent
0170
0171 Label {
0172 id: timecode
0173 font.family: fontMetrics.font.family
0174 font.pointSize: 1.5 * fontMetrics.font.pointSize
0175 objectName: "timecode"
0176 color: "#ffffff"
0177 padding: 2
0178 background: Rectangle {
0179 color: "#66000000"
0180 }
0181 text: controller.timecode
0182 visible: root.showTimecode
0183 anchors {
0184 right: parent.right
0185 bottom: parent.bottom
0186 bottomMargin: root.zoomOffset
0187 }
0188 }
0189 Label {
0190 id: fpsdropped
0191 font.family: fontMetrics.font.family
0192 font.pointSize: 1.5 * fontMetrics.font.pointSize
0193 objectName: "fpsdropped"
0194 color: "#ffffff"
0195 padding: 2
0196 background: Rectangle {
0197 color: root.dropped ? "#99ff0000" : "#66004400"
0198 }
0199 text: i18n("%1fps", root.fps)
0200 visible: root.showFps
0201 anchors {
0202 right: timecode.visible ? timecode.left : parent.right
0203 bottom: parent.bottom
0204 bottomMargin: root.zoomOffset
0205 }
0206 }
0207 Label {
0208 id: labelSpeed
0209 font: fixedFont
0210 anchors {
0211 left: parent.left
0212 top: parent.top
0213 }
0214 visible: Math.abs(controller.speed) > 1
0215 text: "x" + controller.speed
0216 color: "white"
0217 background: Rectangle {
0218 color: "darkgreen"
0219 }
0220 padding: 5
0221 horizontalAlignment: TextInput.AlignHCenter
0222 }
0223 Label {
0224 id: inPoint
0225 font: fixedFont
0226 anchors {
0227 left: parent.left
0228 bottom: parent.bottom
0229 bottomMargin: root.zoomOffset
0230 }
0231 visible: root.showMarkers && controller.position == controller.zoneIn
0232 text: i18n("In Point")
0233 color: "white"
0234 background: Rectangle {
0235 color: "#228b22"
0236 }
0237 padding: 5
0238 horizontalAlignment: TextInput.AlignHCenter
0239 }
0240 Label {
0241 id: outPoint
0242 font: fixedFont
0243 anchors {
0244 left: inPoint.visible ? inPoint.right : parent.left
0245 bottom: parent.bottom
0246 bottomMargin: root.zoomOffset
0247 }
0248 visible: root.showMarkers && controller.position == controller.zoneOut
0249 text: i18n("Out Point")
0250 color: "white"
0251 background: Rectangle {
0252 color: "#770000"
0253 }
0254 padding: 5
0255 horizontalAlignment: TextInput.AlignHCenter
0256 }
0257 TextField {
0258 id: marker
0259 font: fixedFont
0260 objectName: "markertext"
0261 activeFocusOnPress: true
0262 onEditingFinished: {
0263 root.markerText = marker.displayText
0264 marker.focus = false
0265 root.editCurrentMarker()
0266 }
0267 anchors {
0268 left: outPoint.visible ? outPoint.right : inPoint.visible ? inPoint.right : parent.left
0269 bottom: parent.bottom
0270 bottomMargin: root.zoomOffset
0271 }
0272 visible: root.showMarkers && text != ""
0273 text: controller.markerComment
0274 height: inPoint.height
0275 width: fontMetrics.boundingRect(displayText).width + 10
0276 horizontalAlignment: displayText == text ? TextInput.AlignHCenter : TextInput.AlignLeft
0277 background: Rectangle {
0278 color: controller.markerColor
0279 }
0280 color: "#000"
0281 padding: 0
0282 maximumLength: 25
0283 }
0284 }
0285 }
0286 MonitorRuler {
0287 id: clipMonitorRuler
0288 anchors {
0289 left: root.left
0290 right: root.right
0291 bottom: root.bottom
0292 }
0293 height: controller.rulerHeight
0294 }
0295 }