Preliminary support for display indicator of composition a_track in timeline

parent 615efca4
...@@ -69,6 +69,11 @@ int CompositionModel::getPosition() const ...@@ -69,6 +69,11 @@ int CompositionModel::getPosition() const
return m_position; return m_position;
} }
int CompositionModel::getTargetTrack() const
{
return transition()->get_a_track();
}
int CompositionModel::getPlaytime() const int CompositionModel::getPlaytime() const
{ {
return transition()->get_length(); return transition()->get_length();
......
...@@ -63,6 +63,10 @@ public: ...@@ -63,6 +63,10 @@ public:
*/ */
int getCurrentTrackId() const; int getCurrentTrackId() const;
/* @brief returns the target track for this compositon (a_track)
*/
int getTargetTrack() const;
/* @brief returns the current position of the composition (-1 if not inserted) /* @brief returns the current position of the composition (-1 if not inserted)
*/ */
int getPosition() const; int getPosition() const;
......
...@@ -193,6 +193,7 @@ QHash<int, QByteArray> TimelineItemModel::roleNames() const ...@@ -193,6 +193,7 @@ QHash<int, QByteArray> TimelineItemModel::roleNames() const
roles[SpeedRole] = "speed"; roles[SpeedRole] = "speed";
roles[HeightRole] = "trackHeight"; roles[HeightRole] = "trackHeight";
roles[ItemIdRole] = "item"; roles[ItemIdRole] = "item";
roles[ItemATrack] = "a_track";
return roles; return roles;
} }
...@@ -318,6 +319,9 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const ...@@ -318,6 +319,9 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
return 100; return 100;
case BinIdRole: case BinIdRole:
return 5; return 5;
case ItemATrack:
return 2;
//return compo->getTargetTrack();
case MarkersRole: { case MarkersRole: {
QVariantList markersList; QVariantList markersList;
return markersList; return markersList;
......
...@@ -87,6 +87,7 @@ public: ...@@ -87,6 +87,7 @@ public:
IsCompositionRole,/// clip only IsCompositionRole,/// clip only
FileHashRole, /// clip only FileHashRole, /// clip only
SpeedRole, /// clip only SpeedRole, /// clip only
ItemATrack, /// composition only
ItemIdRole ItemIdRole
}; };
......
...@@ -145,9 +145,9 @@ public: ...@@ -145,9 +145,9 @@ public:
*/ */
Q_INVOKABLE bool requestCompositionMove(int compoId, int trackId, int position, bool updateView = true, bool logUndo = true); Q_INVOKABLE bool requestCompositionMove(int compoId, int trackId, int position, bool updateView = true, bool logUndo = true);
int getCompositionTrackId(int compoId) const; Q_INVOKABLE int getCompositionTrackId(int compoId) const;
int getCompositionPosition(int compoId) const; Q_INVOKABLE int getCompositionPosition(int compoId) const;
int getCompositionPlaytime(int compoId) const; Q_INVOKABLE int getCompositionPlaytime(int compoId) const;
Q_INVOKABLE int suggestCompositionMove(int compoId, int trackId, int position); Q_INVOKABLE int suggestCompositionMove(int compoId, int trackId, int position);
protected: protected:
......
...@@ -43,12 +43,14 @@ Rectangle { ...@@ -43,12 +43,14 @@ Rectangle {
property int binId: 0 property int binId: 0
property int trackIndex //Index in track repeater property int trackIndex //Index in track repeater
property int trackId: -42 //Id in the model property int trackId: -42 //Id in the model
property int a_track: -1
property int clipId //Id of the clip in the model property int clipId //Id of the clip in the model
property int originalTrackId: trackId property int originalTrackId: trackId
property int originalX: x property int originalX: x
property int originalDuration: clipDuration property int originalDuration: clipDuration
property int lastValidDuration: clipDuration property int lastValidDuration: clipDuration
property int draggedX: x property int draggedX: x
property int a_trackPos: -1
property bool selected: false property bool selected: false
property double speed: 1.0 property double speed: 1.0
property color borderColor: 'black' property color borderColor: 'black'
...@@ -78,7 +80,7 @@ Rectangle { ...@@ -78,7 +80,7 @@ Rectangle {
border.color: selected? 'red' : borderColor border.color: selected? 'red' : borderColor
border.width: 1.5 border.width: 1.5
clip: true clip: false
Drag.active: mouseArea.drag.active Drag.active: mouseArea.drag.active
Drag.proposedAction: Qt.MoveAction Drag.proposedAction: Qt.MoveAction
opacity: Drag.active? 0.5 : 1.0 opacity: Drag.active? 0.5 : 1.0
...@@ -113,7 +115,7 @@ Rectangle { ...@@ -113,7 +115,7 @@ Rectangle {
anchors.topMargin: parent.border.width anchors.topMargin: parent.border.width
anchors.leftMargin: parent.border.width anchors.leftMargin: parent.border.width
// + ((isAudio || !settings.timelineShowThumbnails) ? 0 : inThumbnail.width) // + ((isAudio || !settings.timelineShowThumbnails) ? 0 : inThumbnail.width)
width: label.width + 2 width: Math.min(label.width + 2, parent.width - 2)
height: label.height height: label.height
} }
...@@ -121,6 +123,8 @@ Rectangle { ...@@ -121,6 +123,8 @@ Rectangle {
id: label id: label
text: clipName text: clipName
font.pixelSize: root.baseUnit font.pixelSize: root.baseUnit
width: parent.width - 2
clip: true
anchors { anchors {
top: parent.top top: parent.top
left: parent.left left: parent.left
...@@ -131,6 +135,19 @@ Rectangle { ...@@ -131,6 +135,19 @@ Rectangle {
color: 'black' color: 'black'
} }
// target track
Rectangle {
width: parent.width
height: 5
color: 'red'
y: a_trackPos
}
onA_trackChanged: {
console.log('+++++++++++++++++++++\na_tk: ', a_trackPos, ' : ', a_track)
a_trackPos = root.getTrackYFromId(a_track)
}
states: [ states: [
State { State {
name: 'normal' name: 'normal'
......
...@@ -48,6 +48,13 @@ function getTrackIdFromPos(pos) { ...@@ -48,6 +48,13 @@ function getTrackIdFromPos(pos) {
return -1 return -1
} }
function getTrackYFromId(id) {
if (id >= 0 && id < tracksRepeater.count) {
return trackHeaderRepeater.itemAt(id).y - scrollView.flickableItem.contentY
}
return -1
}
function acceptDrop(xml) { function acceptDrop(xml) {
var position = Math.round((dropTarget.x + scrollView.flickableItem.contentX - headerWidth) / timeline.scaleFactor) var position = Math.round((dropTarget.x + scrollView.flickableItem.contentX - headerWidth) / timeline.scaleFactor)
timeline.insertClip(currentTrack, position, xml) timeline.insertClip(currentTrack, position, xml)
......
...@@ -69,6 +69,12 @@ Column{ ...@@ -69,6 +69,12 @@ Column{
value: trackRoot.selection.indexOf(loader.item.clipId) !== -1 value: trackRoot.selection.indexOf(loader.item.clipId) !== -1
when: loader.status == Loader.Ready when: loader.status == Loader.Ready
} }
Binding {
target: loader.item
property: "a_track"
value: loader.item.a_track
when: loader.item.isComposition && loader.status == Loader.Ready
}
sourceComponent: { sourceComponent: {
if (model.isComposition) { if (model.isComposition) {
return compositionDelegate return compositionDelegate
...@@ -93,6 +99,8 @@ Column{ ...@@ -93,6 +99,8 @@ Column{
item.markers= model.markers item.markers= model.markers
item.fadeIn= 0 //model.fadeIn item.fadeIn= 0 //model.fadeIn
item.fadeOut= 0 //model.fadeOut item.fadeOut= 0 //model.fadeOut
} else {
item.a_track = model.a_track
} }
item.width= model.duration * timeScale item.width= model.duration * timeScale
item.modelStart= model.start item.modelStart= model.start
......
...@@ -49,6 +49,9 @@ Rectangle { ...@@ -49,6 +49,9 @@ Rectangle {
} }
} }
function getTrackYFromId(a_track) {
return Logic.getTrackYFromId(a_track)
}
function getTrackColor(audio, header) { function getTrackColor(audio, header) {
var col = activePalette.alternateBase var col = activePalette.alternateBase
...@@ -135,7 +138,7 @@ Rectangle { ...@@ -135,7 +138,7 @@ Rectangle {
var frame = controller.getCompositionPosition(clipBeingDroppedId) var frame = controller.getCompositionPosition(clipBeingDroppedId)
var track = controller.getCompositionTrackId(clipBeingDroppedId) var track = controller.getCompositionTrackId(clipBeingDroppedId)
// we simulate insertion at the final position so that stored undo has correct value // we simulate insertion at the final position so that stored undo has correct value
controller.requestCompositionDeletion(clipBeingDroppedId, false) controller.requestItemDeletion(clipBeingDroppedId, false)
timeline.insertComposition(track, frame, clipBeingDroppedData, true) timeline.insertComposition(track, frame, clipBeingDroppedData, true)
} }
clipBeingDroppedId = -1 clipBeingDroppedId = -1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment