1/* 2 SPDX-FileCopyrightText: 2015 Jean-Baptiste Mardelle <jb@kdenlive.org> 3 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 4*/ 5 6import QtQuick 2.11 7import QtQuick.Controls 1.4 8import QtQuick.Controls.Styles 1.4 9 10Item { 11 id: root 12 objectName: "rootsplit" 13 SystemPalette { id: activePalette } 14 15 // default size, but scalable by user 16 height: 300; width: 400 17 property double timeScale: 1 18 property int duration: 300 19 property int mouseRulerPos: 0 20 property int splitterPos 21 property rect framesize 22 property real baseUnit: fontMetrics.font.pixelSize * 0.8 23 // percentage holds splitter pos relative to the scene percentage 24 property double percentage 25 property point profile: controller.profile 26 property point center 27 property double offsetx 28 property double offsety 29 property double scalex 30 property double scaley 31 property bool captureRightClick: false 32 // Zoombar properties 33 property double zoomStart: 0 34 property double zoomFactor: 1 35 property int zoomOffset: 0 36 property bool showZoomBar: false 37 38 signal qmlMoveSplit() 39 40 FontMetrics { 41 id: fontMetrics 42 font.family: "Arial" 43 } 44 45 percentage: 0.5 46 splitterPos: this.width / 2 47 48 onDurationChanged: { 49 clipMonitorRuler.updateRuler() 50 } 51 onWidthChanged: { 52 clipMonitorRuler.updateRuler() 53 } 54 55 MouseArea { 56 width: root.width; height: root.height 57 anchors.centerIn: parent 58 hoverEnabled: true 59 cursorShape: Qt.SizeHorCursor 60 acceptedButtons: Qt.LeftButton 61 onWheel: { 62 controller.seek(wheel.angleDelta.x + wheel.angleDelta.y, wheel.modifiers) 63 } 64 onPressed: { 65 root.percentage = (mouseX - (root.width - (root.profile.x * root.scalex)) / 2) / (root.profile.x * root.scalex) 66 root.splitterPos = mouseX 67 root.qmlMoveSplit() 68 } 69 onPositionChanged: { 70 if (pressed) { 71 root.percentage = (mouseX - (root.width - (root.profile.x * root.scalex)) / 2) / (root.profile.x * root.scalex) 72 root.splitterPos = mouseX 73 root.qmlMoveSplit() 74 } 75 timer.restart() 76 splitter.visible = true 77 } 78 //onEntered: { splitter.visible = true } 79 onExited: { splitter.visible = false } 80 } 81 82 Rectangle { 83 id: splitter 84 x: root.splitterPos 85 y: 0 86 width: 1 87 height: root.height 88 color: "red" 89 visible: false 90 Text { 91 text: i18n("Effect") 92 color: "red" 93 anchors { 94 right: parent.left 95 top: parent.top 96 topMargin: 10 97 rightMargin: 10 98 } 99 } 100 } 101 MonitorRuler { 102 id: clipMonitorRuler 103 anchors { 104 left: root.left 105 right: root.right 106 bottom: root.bottom 107 } 108 height: controller.rulerHeight 109 } 110 111 Timer { 112 id: timer 113 114 interval: 1000; running: false; repeat: false 115 onTriggered: { 116 splitter.visible = false 117 } 118 } 119} 120