Warning, /multimedia/kdenlive/src/monitor/view/kdenlivemonitorsplit.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 2.15
0007 import QtQuick.Controls 2.15
0008 
0009 Item {
0010     id: root
0011     objectName: "rootsplit"
0012     SystemPalette { id: activePalette }
0013 
0014     // default size, but scalable by user
0015     height: 300; width: 400
0016     property double timeScale: 1
0017     property int duration: 300
0018     property int mouseRulerPos: 0
0019     property int splitterPos
0020     property rect framesize
0021     property real baseUnit: fontMetrics.font.pixelSize * 0.8
0022     // percentage holds splitter pos relative to the scene percentage
0023     property double percentage
0024     property point profile: controller.profile
0025     property point center
0026     property double offsetx
0027     property double offsety
0028     property double scalex
0029     property double scaley
0030     property bool captureRightClick: false
0031     // Zoombar properties
0032     property double zoomStart: 0
0033     property double zoomFactor: 1
0034     property int zoomOffset: 0
0035     property bool showZoomBar: false
0036 
0037     signal qmlMoveSplit()
0038 
0039     function updateClickCapture() {
0040         root.captureRightClick = false
0041     }
0042 
0043     FontMetrics {
0044         id: fontMetrics
0045         font.family: "Arial"
0046     }
0047 
0048     percentage: 0.5
0049     splitterPos: this.width / 2
0050 
0051     onDurationChanged: {
0052         clipMonitorRuler.updateRuler()
0053     }
0054     onWidthChanged: {
0055         clipMonitorRuler.updateRuler()
0056     }
0057 
0058     MouseArea {
0059         width: root.width; height: root.height
0060         anchors.centerIn: parent
0061         hoverEnabled: true
0062         cursorShape: Qt.SizeHorCursor
0063         acceptedButtons: Qt.LeftButton
0064         onWheel: wheel => {
0065             controller.seek(wheel.angleDelta.x + wheel.angleDelta.y, wheel.modifiers)
0066         }
0067         onPressed: {
0068             root.captureRightClick = true
0069             root.percentage = (mouseX - (root.width - (root.profile.x * root.scalex)) / 2) / (root.profile.x * root.scalex)
0070             root.splitterPos = mouseX
0071             root.qmlMoveSplit()
0072         }
0073         onPositionChanged: {
0074             if (pressed) {
0075                 root.percentage = (mouseX - (root.width - (root.profile.x * root.scalex)) / 2) / (root.profile.x * root.scalex)
0076                 root.splitterPos = mouseX
0077                 root.qmlMoveSplit()
0078             }
0079             timer.restart()
0080             splitter.visible = true
0081         }
0082         onReleased: {
0083             root.captureRightClick = false
0084         }
0085         //onEntered: { splitter.visible = true }
0086         onExited: { splitter.visible = false }
0087     }
0088 
0089     Rectangle {
0090         id: splitter
0091         x: root.splitterPos
0092         y: 0
0093         width: 1
0094         height: root.height
0095         color: "red"
0096         visible: false
0097         Text {
0098             text: i18n("Effect")
0099             color: "red"
0100             anchors {
0101                 right: parent.left
0102                 top: parent.top
0103                 topMargin: 10
0104                 rightMargin: 10
0105             }
0106         }
0107     }
0108     MonitorRuler {
0109         id: clipMonitorRuler
0110         anchors {
0111             left: root.left
0112             right: root.right
0113             bottom: root.bottom
0114         }
0115         height: controller.rulerHeight
0116     }
0117 
0118     Timer {
0119         id: timer
0120 
0121         interval: 1000; running: false; repeat: false
0122         onTriggered:  {
0123             splitter.visible = false
0124         }
0125     }
0126 }