Changeset View
Changeset View
Standalone View
Standalone View
src/timeline2/view/qml/Composition.qml
Context not available. | |||||
87 | mouseArea.focus = true | 87 | mouseArea.focus = true | ||
---|---|---|---|---|---|
88 | } | 88 | } | ||
89 | } | 89 | } | ||
90 | onTrackIdChanged: { | ||||
91 | compositionRoot.parentTrack = Logic.getTrackById(trackId) | ||||
92 | compositionRoot.y = compositionRoot.originalTrackId == -1 || trackId == originalTrackId ? 0 : parentTrack.y - Logic.getTrackById(compositionRoot.originalTrackId).y; | ||||
93 | } | ||||
90 | 94 | | |||
91 | onClipDurationChanged: { | 95 | onClipDurationChanged: { | ||
92 | width = clipDuration * timeScale; | 96 | width = clipDuration * timeScale; | ||
Context not available. | |||||
99 | onScrollXChanged: { | 103 | onScrollXChanged: { | ||
100 | labelRect.x = scrollX > modelStart * timeScale ? scrollX - modelStart * timeScale : 0 | 104 | labelRect.x = scrollX > modelStart * timeScale ? scrollX - modelStart * timeScale : 0 | ||
101 | } | 105 | } | ||
102 | function reparent(track) { | 106 | /*function reparent(track) { | ||
103 | parent = track | 107 | parent = track | ||
104 | isAudio = track.isAudio | 108 | isAudio = track.isAudio | ||
105 | parentTrack = track | 109 | parentTrack = track | ||
106 | displayHeight = track.height / 2 | 110 | displayHeight = track.height / 2 | ||
107 | compositionRoot.trackId = parentTrack.trackId | 111 | compositionRoot.trackId = parentTrack.trackId | ||
108 | } | 112 | }*/ | ||
109 | 113 | | |||
110 | SystemPalette { id: activePalette } | 114 | SystemPalette { id: activePalette } | ||
111 | Rectangle { | 115 | Rectangle { | ||
Context not available. | |||||
155 | outPoint: compositionRoot.clipDuration | 159 | outPoint: compositionRoot.clipDuration | ||
156 | } | 160 | } | ||
157 | } | 161 | } | ||
158 | Drag.active: mouseArea.drag.active | 162 | /*Drag.active: mouseArea.drag.active | ||
159 | Drag.proposedAction: Qt.MoveAction | 163 | Drag.proposedAction: Qt.MoveAction*/ | ||
160 | 164 | | |||
161 | states: [ | 165 | states: [ | ||
162 | State { | 166 | State { | ||
Context not available. | |||||
181 | MouseArea { | 185 | MouseArea { | ||
182 | id: mouseArea | 186 | id: mouseArea | ||
183 | anchors.fill: parent | 187 | anchors.fill: parent | ||
184 | acceptedButtons: Qt.LeftButton | 188 | acceptedButtons: Qt.RightButton | ||
185 | drag.target: compositionRoot | 189 | hoverEnabled: true | ||
186 | drag.axis: Drag.XAxis | | |||
187 | drag.smoothed: false | | |||
188 | property int startX | | |||
189 | 190 | | |||
190 | onPressed: { | 191 | /*onPressed: { | ||
191 | root.stopScrolling = true | 192 | root.stopScrolling = true | ||
192 | originalX = compositionRoot.x | 193 | originalX = compositionRoot.x | ||
193 | originalTrackId = compositionRoot.trackId | 194 | originalTrackId = compositionRoot.trackId | ||
Context not available. | |||||
197 | if (!compositionRoot.selected) { | 198 | if (!compositionRoot.selected) { | ||
198 | compositionRoot.clicked(compositionRoot, mouse.modifiers === Qt.ShiftModifier) | 199 | compositionRoot.clicked(compositionRoot, mouse.modifiers === Qt.ShiftModifier) | ||
199 | } | 200 | } | ||
200 | } | 201 | }*/ | ||
201 | Keys.onShortcutOverride: event.accepted = compositionRoot.isGrabbed && (event.key === Qt.Key_Left || event.key === Qt.Key_Right || event.key === Qt.Key_Up || event.key === Qt.Key_Down) | 202 | Keys.onShortcutOverride: event.accepted = compositionRoot.isGrabbed && (event.key === Qt.Key_Left || event.key === Qt.Key_Right || event.key === Qt.Key_Up || event.key === Qt.Key_Down) | ||
202 | Keys.onLeftPressed: { | 203 | Keys.onLeftPressed: { | ||
203 | controller.requestCompositionMove(compositionRoot.clipId, compositionRoot.originalTrackId, compositionRoot.modelStart - 1, true, true) | 204 | controller.requestCompositionMove(compositionRoot.clipId, compositionRoot.originalTrackId, compositionRoot.modelStart - 1, true, true) | ||
Context not available. | |||||
211 | Keys.onDownPressed: { | 212 | Keys.onDownPressed: { | ||
212 | controller.requestCompositionMove(compositionRoot.clipId, controller.getPreviousTrackId(compositionRoot.originalTrackId), compositionRoot.modelStart, true, true) | 213 | controller.requestCompositionMove(compositionRoot.clipId, controller.getPreviousTrackId(compositionRoot.originalTrackId), compositionRoot.modelStart, true, true) | ||
213 | } | 214 | } | ||
214 | onPositionChanged: { | 215 | cursorShape: (trimInMouseArea.drag.active || trimOutMouseArea.drag.active)? Qt.SizeHorCursor : | ||
215 | if (mouse.y < -height || (mouse.y > height && parentTrack.rootIndex.row < tracksRepeater.count - 1)) { | 216 | dragProxyArea.drag.active ? Qt.ClosedHandCursor : Qt.OpenHandCursor | ||
216 | var mapped = parentTrack.mapFromItem(compositionRoot, mouse.x, mouse.y).x | 217 | | ||
217 | compositionRoot.draggedToTrack(compositionRoot, mapToItem(null, 0, mouse.y).y, mapped) | 218 | onPressed: { | ||
218 | } else { | 219 | root.stopScrolling = true | ||
219 | compositionRoot.dragged(compositionRoot, mouse) | 220 | compositionRoot.forceActiveFocus(); | ||
221 | /*if (!compositionRoot.selected) { | ||||
222 | compositionRoot.clicked(compositionRoot, false) | ||||
223 | }*/ | ||||
224 | if (mouse.button == Qt.RightButton) { | ||||
225 | compositionMenu.item.clipId = compositionRoot.clipId | ||||
226 | compositionMenu.item.grouped = compositionRoot.grouped | ||||
227 | compositionMenu.item.trackId = compositionRoot.trackId | ||||
228 | compositionMenu.item.popup() | ||||
229 | } | ||||
220 | } | 230 | } | ||
231 | onEntered: { | ||||
232 | var itemPos = mapToItem(tracksContainerArea, 0, 0, width, height) | ||||
233 | initDrag(compositionRoot, itemPos, compositionRoot.clipId, compositionRoot.modelStart, compositionRoot.trackId, true) | ||||
221 | } | 234 | } | ||
222 | onReleased: { | 235 | onExited: { | ||
223 | root.stopScrolling = false | 236 | endDrag() | ||
224 | var delta = compositionRoot.x - startX | | |||
225 | if (Math.abs(delta) >= 1.0 || trackId !== originalTrackId) { | | |||
226 | compositionRoot.moved(compositionRoot) | | |||
227 | originalX = compositionRoot.x | | |||
228 | originalTrackId = trackId | | |||
229 | } else if (Math.abs(delta) >= 1.0) { | | |||
230 | compositionRoot.dropped(compositionRoot) | | |||
231 | } | | |||
232 | } | 237 | } | ||
233 | onDoubleClicked: { | 238 | onDoubleClicked: { | ||
234 | drag.target = undefined | 239 | drag.target = undefined | ||
Context not available. | |||||
246 | } | 251 | } | ||
247 | } | 252 | } | ||
248 | onWheel: zoomByWheel(wheel) | 253 | onWheel: zoomByWheel(wheel) | ||
249 | | ||||
250 | MouseArea { | | |||
251 | anchors.fill: parent | | |||
252 | acceptedButtons: Qt.RightButton | | |||
253 | cursorShape: (trimInMouseArea.drag.active || trimOutMouseArea.drag.active)? Qt.SizeHorCursor : | | |||
254 | drag.active? Qt.ClosedHandCursor : Qt.OpenHandCursor | | |||
255 | onPressed: { | | |||
256 | root.stopScrolling = true | | |||
257 | compositionRoot.forceActiveFocus(); | | |||
258 | if (!compositionRoot.selected) { | | |||
259 | compositionRoot.clicked(compositionRoot, false) | | |||
260 | } | | |||
261 | if (mouse.button == Qt.RightButton) { | | |||
262 | compositionMenu.item.clipId = compositionRoot.clipId | | |||
263 | compositionMenu.item.grouped = compositionRoot.grouped | | |||
264 | compositionMenu.item.trackId = compositionRoot.trackId | | |||
265 | compositionMenu.item.popup() | | |||
266 | } | | |||
267 | } | | |||
268 | } | | |||
269 | } | 254 | } | ||
270 | 255 | | |||
271 | Rectangle { | 256 | Rectangle { | ||
Context not available. | |||||
279 | Drag.active: trimInMouseArea.drag.active | 264 | Drag.active: trimInMouseArea.drag.active | ||
280 | Drag.proposedAction: Qt.MoveAction | 265 | Drag.proposedAction: Qt.MoveAction | ||
281 | enabled: !compositionRoot.grouped | 266 | enabled: !compositionRoot.grouped | ||
282 | visible: root.activeTool === 0 && !mouseArea.drag.active | 267 | visible: root.activeTool === 0 && !dragProxyArea.drag.active | ||
283 | 268 | | |||
284 | MouseArea { | 269 | MouseArea { | ||
285 | id: trimInMouseArea | 270 | id: trimInMouseArea | ||
Context not available. | |||||
326 | Drag.active: trimOutMouseArea.drag.active | 311 | Drag.active: trimOutMouseArea.drag.active | ||
327 | Drag.proposedAction: Qt.MoveAction | 312 | Drag.proposedAction: Qt.MoveAction | ||
328 | enabled: !compositionRoot.grouped | 313 | enabled: !compositionRoot.grouped | ||
329 | visible: root.activeTool === 0 && !mouseArea.drag.active | 314 | visible: root.activeTool === 0 && !dragProxyArea.drag.active | ||
330 | 315 | | |||
331 | MouseArea { | 316 | MouseArea { | ||
332 | id: trimOutMouseArea | 317 | id: trimOutMouseArea | ||
Context not available. |