kdenlivemonitor.qml 5.14 KB
Newer Older
1 2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
3 4
import QtQuick.Window 2.2
import Kdenlive.Controls 1.0
5
import QtQuick 2.4
6
import AudioThumb 1.0
7 8 9

Item {
    id: root
10
    objectName: "root"
11

12 13
    SystemPalette { id: activePalette }

14 15
    // default size, but scalable by user
    height: 300; width: 400
16
    property string markerText
17 18
    property string timecode
    property point profile
19
    property double zoom
20 21
    property double scalex
    property double scaley
22 23
    property bool dropped
    property string fps
24 25
    property bool showMarkers
    property bool showTimecode
26
    property bool showFps
27 28
    property bool showSafezone
    property bool showAudiothumb
29
    property bool showToolbar: false
30
    property real baseUnit: fontMetrics.font.pointSize
31 32 33 34 35
    property int duration: 300
    property bool mouseOverRuler: false
    property int mouseRulerPos: 0
    property double frameSize: 10
    property double timeScale: 1
36 37 38 39 40 41

    FontMetrics {
        id: fontMetrics
        font.family: "Arial"
    }

42 43 44
    onZoomChanged: {
        sceneToolBar.setZoom(root.zoom)
    }
45
    signal editCurrentMarker()
46
    signal toolBarChanged(bool doAccept)
47

48 49 50 51 52 53 54 55 56 57 58 59 60
    onDurationChanged: {
        timeScale = width / duration
        if (duration < 200) {
            frameSize = 5 * timeScale
        } else if (duration < 2500) {
            frameSize = 25 * timeScale
        } else if (duration < 10000) {
            frameSize = 50 * timeScale
        } else {
            frameSize = 100 * timeScale
        }
    }

61
    Item {
62
        id: monitorOverlay
63
        height: root.height - controller.rulerHeight
64 65 66 67 68 69 70 71
        width: root.width
        SceneToolBar {
            id: sceneToolBar
            anchors {
                left: parent.left
                top: parent.top
                topMargin: 10
                leftMargin: 10
72
            }
73
            visible: root.showToolbar
74 75
        }

76 77 78 79 80 81 82
        Item {
            id: frame
            objectName: "referenceframe"
            width: root.profile.x * root.scalex
            height: root.profile.y * root.scaley
            anchors.centerIn: parent
            visible: root.showSafezone
83

84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
            Rectangle {
            id: safezone
                objectName: "safezone"
                color: "transparent"
                border.color: "cyan"
                width: parent.width * 0.9
                height: parent.height * 0.9
                anchors.centerIn: parent
                Rectangle {
                    id: safetext
                    objectName: "safetext"
                    color: "transparent"
                    border.color: "cyan"
                    width: frame.width * 0.8
                    height: frame.height * 0.8
                    anchors.centerIn: parent
                }
                Rectangle {
                    color: "cyan"
                    width: root.width / 5
                    height: 1
                    anchors.centerIn: parent
                }
                Rectangle {
                    color: "cyan"
                    height: root.width / 5
                    width: 1
                    anchors.centerIn: parent
                }
            }
114 115
        }

116 117 118 119 120 121 122 123 124 125 126 127 128 129
        Text {
            id: timecode
            objectName: "timecode"
            color: "white"
            style: Text.Outline; 
            styleColor: "black"
            text: root.timecode
            font.pixelSize: root.baseUnit
            visible: root.showTimecode
            anchors {
                right: parent.right
                bottom: parent.bottom
                rightMargin: 4
            }
130
        }
131 132 133 134 135 136 137 138 139 140 141 142 143 144
        Text {
            id: fpsdropped
            objectName: "fpsdropped"
            color: root.dropped ? "red" : "white"
            style: Text.Outline;
            styleColor: "black"
            text: root.fps + "fps"
            visible: root.showFps
            font.pixelSize: root.baseUnit
            anchors {
                right: timecode.visible ? timecode.left : parent.right
                bottom: parent.bottom
                rightMargin: 10
            }
145
        }
146 147 148 149 150 151 152 153 154 155 156 157 158 159
        TextField {
            id: marker
            objectName: "markertext"
            activeFocusOnPress: true
            onEditingFinished: {
                root.markerText = marker.displayText
                marker.focus = false
                root.editCurrentMarker()
            }
            anchors {
                left: parent.left
                bottom: parent.bottom
            }
            visible: root.showMarkers && text != ""
160
            text: controller.markerComment
161 162 163 164
            maximumLength: 20
            style: TextFieldStyle {
                textColor: "white"
                background: Rectangle {
165
                    color: controller.position == controller.zoneIn ? "#9900ff00" : controller.position == controller.zoneOut ? "#99ff0000" : "#990000ff"
166 167
                    width: marker.width
                }
168
            }
169
            font.pixelSize: root.baseUnit
170
        }
171
    }
172 173 174 175 176 177 178
    MonitorRuler {
        id: clipMonitorRuler
        anchors {
            left: root.left
            right: root.right
            bottom: root.bottom
        }
179
        height: controller.rulerHeight
180
    }
181
}