Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
259
Issues
259
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
9d72b089
Commit
9d72b089
authored
May 15, 2018
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lift zone random behavior
parent
5cd743b0
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
48 deletions
+24
-48
src/mainwindow.cpp
src/mainwindow.cpp
+1
-1
src/timeline2/model/clipmodel.cpp
src/timeline2/model/clipmodel.cpp
+3
-1
src/timeline2/model/timelinefunctions.cpp
src/timeline2/model/timelinefunctions.cpp
+8
-5
src/timeline2/model/trackmodel.cpp
src/timeline2/model/trackmodel.cpp
+6
-15
src/timeline2/view/timelinecontroller.cpp
src/timeline2/view/timelinecontroller.cpp
+2
-22
src/timeline2/view/timelinecontroller.h
src/timeline2/view/timelinecontroller.h
+4
-4
No files found.
src/mainwindow.cpp
View file @
9d72b089
...
...
@@ -2528,7 +2528,7 @@ void MainWindow::slotExtractZone()
void
MainWindow
::
slotLiftZone
()
{
getMainTimeline
()
->
controller
()
->
liftZone
(
m_clipMonitor
->
getZoneInfo
()
);
getMainTimeline
()
->
controller
()
->
extractZone
(
m_clipMonitor
->
getZoneInfo
(),
true
);
}
void
MainWindow
::
slotPreviewRender
()
...
...
src/timeline2/model/clipmodel.cpp
View file @
9d72b089
...
...
@@ -69,7 +69,6 @@ int ClipModel::construct(const std::shared_ptr<TimelineModel> &parent, const QSt
state
=
stateFromBool
(
videoAudio
);
std
::
shared_ptr
<
Mlt
::
Producer
>
cutProducer
=
binClip
->
getTimelineProducer
(
id
,
state
,
1.
);
std
::
shared_ptr
<
ClipModel
>
clip
(
new
ClipModel
(
parent
,
cutProducer
,
binClipId
,
id
,
state
));
clip
->
setClipState_lambda
(
state
)();
parent
->
registerClip
(
clip
);
...
...
@@ -483,6 +482,9 @@ bool ClipModel::setClipState(PlaylistState::ClipState state, Fun &undo, Fun &red
if
(
state
==
PlaylistState
::
AudioOnly
&&
!
canBeAudio
())
{
return
false
;
}
if
(
state
==
m_currentState
)
{
return
true
;
}
auto
old_state
=
m_currentState
;
auto
operation
=
setClipState_lambda
(
state
);
if
(
operation
())
{
...
...
src/timeline2/model/timelinefunctions.cpp
View file @
9d72b089
...
...
@@ -222,12 +222,12 @@ bool TimelineFunctions::extractZone(std::shared_ptr<TimelineItemModel> timeline,
// Start undoable command
std
::
function
<
bool
(
void
)
>
undo
=
[]()
{
return
true
;
};
std
::
function
<
bool
(
void
)
>
redo
=
[]()
{
return
true
;
};
bool
result
=
fals
e
;
bool
result
=
tru
e
;
for
(
int
trackId
:
tracks
)
{
result
=
TimelineFunctions
::
liftZone
(
timeline
,
trackId
,
zone
,
undo
,
redo
);
if
(
result
&&
!
liftOnly
)
{
result
=
TimelineFunctions
::
removeSpace
(
timeline
,
trackId
,
zone
,
undo
,
redo
);
result
=
result
&&
TimelineFunctions
::
liftZone
(
timeline
,
trackId
,
zone
,
undo
,
redo
);
}
if
(
result
&&
!
liftOnly
)
{
result
=
TimelineFunctions
::
removeSpace
(
timeline
,
-
1
,
zone
,
undo
,
redo
);
}
pCore
->
pushUndo
(
undo
,
redo
,
liftOnly
?
i18n
(
"Lift zone"
)
:
i18n
(
"Extract zone"
));
return
result
;
...
...
@@ -305,6 +305,9 @@ bool TimelineFunctions::removeSpace(std::shared_ptr<TimelineItemModel> timeline,
if
(
result
)
{
result
=
timeline
->
requestClipUngroup
(
clipId
,
undo
,
redo
);
}
if
(
!
result
)
{
undo
();
}
}
}
else
{
// only 1 clip to be moved
...
...
src/timeline2/model/trackmodel.cpp
View file @
9d72b089
...
...
@@ -594,24 +594,15 @@ int TrackModel::getClipByRow(int row) const
std
::
unordered_set
<
int
>
TrackModel
::
getClipsAfterPosition
(
int
position
,
int
end
)
{
READ_LOCK
();
// TODO: this function doesn't take into accounts the fact that there are two tracks
std
::
unordered_set
<
int
>
ids
;
int
ix
=
m_playlists
[
0
].
get_clip_index_at
(
position
);
if
(
end
>
-
1
)
{
end
=
m_playlists
[
0
].
get_clip_index_at
(
end
);
if
(
end
<
m_playlists
[
0
].
count
())
{
end
++
;
}
}
else
{
end
=
m_playlists
[
0
].
count
();
}
while
(
ix
<
end
)
{
QSharedPointer
<
Mlt
::
Producer
>
prod
(
m_playlists
[
0
].
get_clip
(
ix
));
ix
++
;
if
(
prod
->
is_blank
())
{
for
(
auto
clp
:
m_allClips
)
{
int
pos
=
clp
.
second
->
getPosition
();
if
(
end
>
-
1
&&
pos
>=
end
)
{
continue
;
}
ids
.
insert
(
prod
->
get_int
(
"_kdenlive_cid"
));
if
(
pos
>=
position
)
{
ids
.
insert
(
clp
.
first
);
}
}
return
ids
;
}
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
9d72b089
...
...
@@ -1384,7 +1384,7 @@ void TimelineController::switchCompositing(int mode)
pCore
->
requestMonitorRefresh
();
}
void
TimelineController
::
extractZone
(
QPoint
zone
)
void
TimelineController
::
extractZone
(
QPoint
zone
,
bool
liftOnly
)
{
QVector
<
int
>
tracks
;
if
(
audioTarget
()
>=
0
)
{
...
...
@@ -1401,7 +1401,7 @@ void TimelineController::extractZone(QPoint zone)
zone
.
setY
(
timelinePosition
()
+
zone
.
y
()
-
zone
.
x
());
zone
.
setX
(
timelinePosition
());
}
TimelineFunctions
::
extractZone
(
m_model
,
tracks
,
m_zone
==
QPoint
()
?
zone
:
m_zone
,
false
);
TimelineFunctions
::
extractZone
(
m_model
,
tracks
,
m_zone
==
QPoint
()
?
zone
:
m_zone
,
liftOnly
);
}
void
TimelineController
::
extract
(
int
clipId
)
...
...
@@ -1413,26 +1413,6 @@ void TimelineController::extract(int clipId)
TimelineFunctions
::
extractZone
(
m_model
,
QVector
<
int
>
()
<<
track
,
zone
,
false
);
}
void
TimelineController
::
liftZone
(
QPoint
zone
)
{
QVector
<
int
>
tracks
;
if
(
audioTarget
()
>=
0
)
{
tracks
<<
audioTarget
();
}
if
(
videoTarget
()
>=
0
)
{
tracks
<<
videoTarget
();
}
if
(
tracks
.
isEmpty
())
{
tracks
<<
m_activeTrack
;
}
if
(
m_zone
==
QPoint
())
{
// Use current timeline position and clip zone length
zone
.
setY
(
timelinePosition
()
+
zone
.
y
()
-
zone
.
x
());
zone
.
setX
(
timelinePosition
());
}
TimelineFunctions
::
extractZone
(
m_model
,
tracks
,
m_zone
==
QPoint
()
?
zone
:
m_zone
,
true
);
}
int
TimelineController
::
insertZone
(
const
QString
&
binId
,
QPoint
zone
,
bool
overwrite
)
{
std
::
shared_ptr
<
ProjectClip
>
clip
=
pCore
->
bin
()
->
getBinClip
(
binId
);
...
...
src/timeline2/view/timelinecontroller.h
View file @
9d72b089
...
...
@@ -343,10 +343,10 @@ public:
/** @brief Change a clip item's speed in timeline */
Q_INVOKABLE
void
changeItemSpeed
(
int
clipId
,
int
speed
);
/** @brief Delete selected zone and fill gap by moving following clips
*/
void
extractZone
(
QPoint
zone
);
/** @brief Delete selected zone
*/
void
liftZone
(
QPoint
zon
e
);
/** @brief Delete selected zone and fill gap by moving following clips
* @param lift if true, the zone will simply be deleted but clips won't be moved
*/
void
extractZone
(
QPoint
zone
,
bool
liftOnly
=
fals
e
);
/** @brief Insert clip monitor into timeline
* @returns the zone end position or -1 on fail
*/
...
...
Write
Preview
Markdown
is supported
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