Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
0a787872
Commit
0a787872
authored
Jul 30, 2009
by
Hugo Beauzee-Luyssen
Browse files
Implemented do/redo for moving clips
parent
5afc10e8
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/Workflow/MainWorkflow.cpp
View file @
0a787872
...
...
@@ -195,6 +195,13 @@ qint64 MainWorkflow::getLength() const
return
m_length
;
}
qint64
MainWorkflow
::
getClipPosition
(
const
QUuid
&
uuid
,
unsigned
int
trackId
)
const
{
Q_ASSERT
(
trackId
<
m_trackCount
);
return
m_tracks
[
trackId
]
->
getClipPosition
(
uuid
);
}
void
MainWorkflow
::
trackEndReached
(
unsigned
int
trackId
)
{
m_tracks
[
trackId
].
deactivate
();
...
...
@@ -244,9 +251,9 @@ void MainWorkflow::deleteInstance()
}
}
void
MainWorkflow
::
clipMoved
(
QUuid
clipUuid
,
int
oldTrack
,
int
newTrack
,
qint64
startingFrame
)
void
MainWorkflow
::
moveClip
(
const
QUuid
&
clipUuid
,
unsigned
int
oldTrack
,
unsigned
int
newTrack
,
qint64
startingFrame
)
{
Q_ASSERT
(
newTrack
<
m_trackCount
&&
oldTrack
<
m_trackCount
&&
oldTrack
>=
0
&&
newTrack
>=
0
);
Q_ASSERT
(
newTrack
<
m_trackCount
&&
oldTrack
<
m_trackCount
);
if
(
oldTrack
==
newTrack
)
{
...
...
src/Workflow/MainWorkflow.h
View file @
0a787872
...
...
@@ -81,6 +81,9 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
static
MainWorkflow
*
getInstance
();
static
void
deleteInstance
();
Clip
*
removeClip
(
const
QUuid
&
uuid
,
unsigned
int
trackId
);
void
moveClip
(
const
QUuid
&
uuid
,
unsigned
int
oldTrack
,
unsigned
int
newTrack
,
qint64
pos
);
qint64
getClipPosition
(
const
QUuid
&
uuid
,
unsigned
int
trackId
)
const
;
private:
static
MainWorkflow
*
m_instance
;
...
...
@@ -108,9 +111,6 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
QWaitCondition
*
m_synchroneRenderWaitCondition
;
QMutex
*
m_synchroneRenderWaitConditionMutex
;
public
slots
:
void
clipMoved
(
QUuid
,
int
,
int
,
qint64
);
private
slots
:
void
trackEndReached
(
unsigned
int
trackId
);
void
trackPaused
();
...
...
src/Workflow/TrackWorkflow.cpp
View file @
0a787872
...
...
@@ -82,6 +82,20 @@ qint64 TrackWorkflow::getLength() const
return
m_length
;
}
qint64
TrackWorkflow
::
getClipPosition
(
const
QUuid
&
uuid
)
const
{
QMap
<
qint64
,
ClipWorkflow
*>::
const_iterator
it
=
m_clips
.
begin
();
QMap
<
qint64
,
ClipWorkflow
*>::
const_iterator
end
=
m_clips
.
end
();
while
(
it
!=
end
)
{
if
(
it
.
value
()
->
getClip
()
->
getUuid
()
==
uuid
)
return
it
.
key
();
++
it
;
}
return
-
1
;
}
unsigned
char
*
TrackWorkflow
::
renderClip
(
ClipWorkflow
*
cw
,
qint64
currentFrame
,
qint64
start
,
bool
needRepositioning
,
bool
pauseAfterRender
)
...
...
src/Workflow/TrackWorkflow.h
View file @
0a787872
...
...
@@ -58,6 +58,7 @@ class TrackWorkflow : public QObject
void
addClip
(
Clip
*
,
qint64
start
);
void
addClip
(
ClipWorkflow
*
,
qint64
start
);
void
activateOneFrameOnly
();
qint64
getClipPosition
(
const
QUuid
&
uuid
)
const
;
/**
* Returns the output that has been computed in synchrone mode.
*/
...
...
src/commands/Commands.hpp
View file @
0a787872
...
...
@@ -61,6 +61,34 @@ namespace Commands
unsigned
int
m_trackNumber
;
qint64
m_pos
;
};
NEW_COMMAND
(
MoveClip
)
{
public:
MoveClip
(
::
MainWorkflow
*
workflow
,
const
QUuid
&
uuid
,
unsigned
int
oldTrack
,
unsigned
int
newTrack
,
qint64
newPos
)
:
m_workflow
(
workflow
),
m_uuid
(
uuid
),
m_oldTrack
(
oldTrack
),
m_newTrack
(
newTrack
),
m_pos
(
newPos
)
{
setText
(
"Moving clip"
);
m_oldPos
=
m_workflow
->
getClipPosition
(
uuid
,
oldTrack
);
}
virtual
void
redo
()
{
m_workflow
->
moveClip
(
m_uuid
,
m_oldTrack
,
m_newTrack
,
m_pos
);
}
virtual
void
undo
()
{
m_workflow
->
moveClip
(
m_uuid
,
m_newTrack
,
m_oldTrack
,
m_oldPos
);
}
private:
::
MainWorkflow
*
m_workflow
;
QUuid
m_uuid
;
unsigned
int
m_oldTrack
;
unsigned
int
m_newTrack
;
qint64
m_pos
;
qint64
m_oldPos
;
};
}
}
...
...
src/gui/Timeline.cpp
View file @
0a787872
...
...
@@ -59,8 +59,6 @@ Timeline::Timeline( QWidget *parent ) :
setDuration
(
0
);
connect
(
m_tracksView
->
horizontalScrollBar
(),
SIGNAL
(
valueChanged
(
int
)
),
m_tracksRuler
,
SLOT
(
moveRuler
(
int
)
)
);
connect
(
m_tracksView
,
SIGNAL
(
durationChanged
(
int
)
),
this
,
SLOT
(
setDuration
(
int
)
)
);
connect
(
m_tracksView
,
SIGNAL
(
clipMoved
(
QUuid
,
int
,
int
,
qint64
)
),
MainWorkflow
::
getInstance
(),
SLOT
(
clipMoved
(
QUuid
,
int
,
int
,
qint64
)
)
);
}
Timeline
::~
Timeline
()
...
...
src/gui/TracksView.cpp
View file @
0a787872
...
...
@@ -364,10 +364,13 @@ void TracksView::mouseReleaseEvent( QMouseEvent* event )
updateDuration
();
if
(
m_layout
->
itemAt
(
0
)
->
graphicsItem
()
->
childItems
().
count
()
>
0
)
addVideoTrack
();
emit
clipMoved
(
movieItem
->
clip
()
->
getUuid
(),
movieItem
->
oldTrackNumber
,
movieItem
->
trackNumber
(),
(
qint64
)
movieItem
->
pos
().
x
()
);
// emit clipMoved( movieItem->clip()->getUuid(),
// movieItem->oldTrackNumber,
// movieItem->trackNumber(),
// (qint64)movieItem->pos().x() );
Commands
::
trigger
(
new
Commands
::
MainWorkflow
::
MoveClip
(
m_mainWorkflow
,
movieItem
->
clip
()
->
getUuid
(),
movieItem
->
oldTrackNumber
,
movieItem
->
trackNumber
(),
(
qint64
)
movieItem
->
pos
().
x
()
)
);
movieItem
->
oldTrackNumber
=
movieItem
->
trackNumber
();
m_actionMove
=
false
;
m_actionRelativeX
=
-
1
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment