[vlmc-devel] Commands: Move clips to right positions if they are resized
Yikai Lu
git at videolan.org
Mon Jul 11 14:21:25 CEST 2016
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Mon Jul 11 21:17:00 2016 +0900| [238c035e29d108a31cc63d2fb7d4ed2a45ed31d7] | committer: Yikai Lu
Commands: Move clips to right positions if they are resized
> https://code.videolan.org/videolan/vlmc/commit/238c035e29d108a31cc63d2fb7d4ed2a45ed31d7
---
src/Commands/Commands.cpp | 4 ++--
src/Workflow/TrackWorkflow.cpp | 19 +++++++++++--------
src/Workflow/TrackWorkflow.h | 2 +-
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/Commands/Commands.cpp b/src/Commands/Commands.cpp
index 6f8ee33..5ca1302 100644
--- a/src/Commands/Commands.cpp
+++ b/src/Commands/Commands.cpp
@@ -222,13 +222,13 @@ Commands::Clip::Resize::retranslate()
void
Commands::Clip::Resize::internalRedo()
{
- m_trackWorkflow->resizeClip( m_clip->uuid(), m_newBegin, m_newEnd );
+ m_trackWorkflow->resizeClip( m_clip->uuid(), m_newBegin, m_newEnd, m_newPos );
}
void
Commands::Clip::Resize::internalUndo()
{
- m_trackWorkflow->resizeClip( m_clip->uuid(), m_oldBegin, m_oldEnd );
+ m_trackWorkflow->resizeClip( m_clip->uuid(), m_oldBegin, m_oldEnd, m_oldPos );
}
Commands::Clip::Split::Split( TrackWorkflow *tw, std::shared_ptr<::Clip> const& toSplit,
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index 2837a83..aba5e06 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -146,19 +146,22 @@ TrackWorkflow::moveClip( const QUuid& id, qint64 startingFrame )
}
void
-TrackWorkflow::resizeClip( const QUuid &id, qint64 begin, qint64 end )
+TrackWorkflow::resizeClip( const QUuid &id, qint64 begin, qint64 end, qint64 pos )
{
- QWriteLocker lock( m_clipsLock );
-
- for ( auto it = m_clips.begin(); it != m_clips.end(); ++it )
{
- auto clip = it.value();
- if ( clip->uuid() == id )
+ QWriteLocker lock( m_clipsLock );
+
+ for ( auto it = m_clips.begin(); it != m_clips.end(); ++it )
{
- auto track = trackFromFormats( clip->formats() );
- track->resizeClip( track->clipIndexAt( it.key() ), begin, end );
+ auto clip = it.value();
+ if ( clip->uuid() == id )
+ {
+ auto track = trackFromFormats( clip->formats() );
+ track->resizeClip( track->clipIndexAt( it.key() ), begin, end );
+ }
}
}
+ moveClip( id, pos );
}
void
diff --git a/src/Workflow/TrackWorkflow.h b/src/Workflow/TrackWorkflow.h
index ec00cf3..909b2ee 100644
--- a/src/Workflow/TrackWorkflow.h
+++ b/src/Workflow/TrackWorkflow.h
@@ -65,7 +65,7 @@ class TrackWorkflow : public QObject
inline Backend::ITrack* trackFromFormats( Clip::Formats formats );
void moveClip( const QUuid& id, qint64 startingFrame );
- void resizeClip( const QUuid& id, qint64 begin, qint64 end );
+ void resizeClip( const QUuid& id, qint64 begin, qint64 end, qint64 pos );
std::shared_ptr<Clip> removeClip( const QUuid& id );
void addClip( std::shared_ptr<Clip> const& clip, qint64 start );
qint64 getClipPosition( const QUuid& uuid ) const;
More information about the Vlmc-devel
mailing list