Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 0e28ca0b authored by Nicolas Carion's avatar Nicolas Carion

[Timeline2] Move clips in same track and undo now working in view

parent ed0e16b4
......@@ -66,8 +66,8 @@ std::shared_ptr<TimelineModel> TimelineModel::construct(std::weak_ptr<DocUndoSta
int ix2 = TrackModel::construct(ptr);
int clipId = ClipModel::construct(ptr, prod);
int clipId2 = ClipModel::construct(ptr, prod);
ptr->requestClipMove(clipId, ix, 100);
ptr->requestClipMove(clipId2, ix2, 50);
ptr->requestClipMove(clipId, ix, 100, false);
ptr->requestClipMove(clipId2, ix2, 50, false);
ptr->getTrackById(ix)->setProperty("kdenlive:trackheight", "60");
ptr->getTrackById(ix2)->setProperty("kdenlive:trackheight", "140");
}
......@@ -195,6 +195,7 @@ QVariant TimelineModel::data(const QModelIndex &index, int role) const
if (!m_tractor || !index.isValid()) {
return QVariant();
}
qDebug() << "DATA requested "<<index<<roleNames()[role];
const int id = (int)index.internalId();
if (isClip(id)) {
// Get data for a clip
......@@ -215,7 +216,6 @@ QVariant TimelineModel::data(const QModelIndex &index, int role) const
case IsBlankRole: //probably useless
return false;
case StartRole:
qDebug() << "start query for clip "<<id<<"Value="<<m_allClips.at(id)->getPosition();
return m_allClips.at(id)->getPosition();
case DurationRole:
return m_allClips.at(id)->getPlaytime();
......@@ -334,8 +334,7 @@ bool TimelineModel::requestClipMove(int cid, int tid, int position, Fun &undo, F
// endInsertRows();
auto operation = [cid, tid, this]() {
m_allClips[cid]->setCurrentTrackId(tid);
// emit dataChanged(makeClipIndexFromID(cid),makeClipIndexFromID(cid));
emit dataChanged(makeTrackIndexFromID(tid),makeTrackIndexFromID(tid));
emit dataChanged(makeClipIndexFromID(cid),makeClipIndexFromID(cid), {StartRole});
return true;
};
auto reverse = [cid, old_tid, this]() {
......@@ -346,9 +345,8 @@ bool TimelineModel::requestClipMove(int cid, int tid, int position, Fun &undo, F
if (old_tid != -1) {
local_undo = [local_undo, old_tid, cid, this]() {
bool v = local_undo();
//emit dataChanged(makeTrackIndexFromID(old_tid),makeTrackIndexFromID(old_tid));
emit dataChanged(QModelIndex(), QModelIndex());
qDebug()<<"DATA CHANGED SIGNAL";
emit dataChanged(makeClipIndexFromID(cid),makeClipIndexFromID(cid), {StartRole});
qDebug()<<"Moved back"<<cid<<"to position"<<m_allClips[cid]->getPosition();
return v;
};
......@@ -360,7 +358,7 @@ bool TimelineModel::requestClipMove(int cid, int tid, int position, Fun &undo, F
bool TimelineModel::requestClipMove(int cid, int tid, int position, bool logUndo)
{
Q_ASSERT(m_allClips.count(cid) > 0);
if (m_allClips[cid]->getPosition() == position) {
if (m_allClips[cid]->getPosition() == position && m_allClips[cid]->getCurrentTrackId() == tid) {
return true;
}
if (m_groups->getRootId(cid) != cid) {
......
......@@ -29,6 +29,7 @@ Rectangle {
property string clipName: ''
property string clipResource: ''
property string mltService: ''
property int modelStart: x
property int inPoint: 0
property int outPoint: 0
property int clipDuration: 0
......@@ -56,6 +57,10 @@ Rectangle {
signal trimmingOut(var clip, real delta, var mouse)
signal trimmedOut(var clip)
onModelStartChanged: {
console.log("MODEL START CHANGED !!!!!!", modelStart, clip, x);
x = modelStart * timeScale;
}
SystemPalette { id: activePalette }
color: Qt.darker(getColor())
......
......@@ -75,6 +75,7 @@ Column{
width: model.duration * timeScale
height: parent.height
x: model.start * timeScale
modelStart: model.start
trackIndex: trackRoot.DelegateModel.itemsIndex
fadeIn: 0 //model.fadeIn
fadeOut: 0 //model.fadeOut
......@@ -82,6 +83,7 @@ Column{
speed: 1 //model.speed
selected: trackRoot.isCurrentTrack && trackRoot.selection.indexOf(index) !== -1
onClicked: trackRoot.clipClicked(clip, trackRoot);
onMoved: {
var fromTrack = clip.originalTrackIndex
......
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