| 1 |
import QtQuick |
| 2 |
import Muse.Ui |
| 3 |
import Muse.UiComponents |
| 4 |
|
| 5 |
Rectangle { |
| 6 |
|
| 7 |
id: root |
| 8 |
|
| 9 |
property color borderColor: "#000000" |
| 10 |
property int borderWidth: 1 |
| 11 |
property bool timelinePressed: false |
| 12 |
|
| 13 |
signal setPlaybackPosition(real x) |
| 14 |
signal playCursorMousePositionChanged(real x) |
| 15 |
|
| 16 |
Rectangle { |
| 17 |
id: cursor |
| 18 |
|
| 19 |
x: -width / 2 |
| 20 |
width: 3 |
| 21 |
height: root.height |
| 22 |
color: "#ffffff" |
| 23 |
|
| 24 |
|
| 25 |
// draw borders without top one |
| 26 |
Rectangle { |
| 27 |
id: leftBorder |
| 28 |
color: borderColor |
| 29 |
width: borderWidth |
| 30 |
height: parent.height |
| 31 |
anchors.left: parent.left |
| 32 |
} |
| 33 |
Rectangle { |
| 34 |
id: rightBorder |
| 35 |
color: borderColor |
| 36 |
width: borderWidth |
| 37 |
height: parent.height |
| 38 |
anchors.right: parent.right |
| 39 |
} |
| 40 |
Rectangle { |
| 41 |
id: bottomBorder |
| 42 |
color: borderColor |
| 43 |
width: root.width |
| 44 |
height: borderWidth |
| 45 |
anchors.bottom: parent.bottom |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
StyledIconLabel { |
| 50 |
id: playheadIcon |
| 51 |
|
| 52 |
x: -(playheadIcon.width) / 2 - 0.5 |
| 53 |
y: -playheadIcon.height |
| 54 |
z: 1 |
| 55 |
|
| 56 |
iconCode: IconCode.PLAYHEAD_FILLED |
| 57 |
|
| 58 |
font.pixelSize: 17 |
| 59 |
color: "black" |
| 60 |
|
| 61 |
StyledIconLabel { |
| 62 |
id: playheadFill |
| 63 |
|
| 64 |
x: 1.1 |
| 65 |
y: 0.9 |
| 66 |
|
| 67 |
iconCode: IconCode.PLAYHEAD_FILLED |
| 68 |
|
| 69 |
font.pixelSize: 15 |
| 70 |
color: "white" |
| 71 |
} |
| 72 |
|
| 73 |
MouseArea { |
| 74 |
anchors.fill: parent |
| 75 |
hoverEnabled: true |
| 76 |
cursorShape: pressed || timelinePressed ? Qt.ClosedHandCursor : Qt.OpenHandCursor |
| 77 |
|
| 78 |
onPositionChanged: function(e) { |
| 79 |
var ix = mapToItem(root.parent, e.x, e.y).x |
| 80 |
if (pressed) { |
| 81 |
setPlaybackPosition(ix) |
| 82 |
} |
| 83 |
playCursorMousePositionChanged(ix) |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
} |
| 88 |
} |