Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
6c1ac094
Commit
6c1ac094
authored
Nov 03, 2022
by
Jean-Baptiste Mardelle
Browse files
Fix several small issues / crash in new guides widget
parent
66216267
Pipeline
#260656
passed with stage
in 10 minutes and 46 seconds
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/assets/assetpanel.cpp
View file @
6c1ac094
...
...
@@ -530,12 +530,12 @@ void AssetPanel::updateAssetPosition(int itemId)
if
(
m_effectStackWidget
->
isVisible
())
{
ObjectId
id
=
{
ObjectType
::
TimelineClip
,
itemId
};
if
(
m_effectStackWidget
->
stackOwner
()
==
id
)
{
emit
pCore
->
getMonitor
(
Kdenlive
::
ProjectMonitor
)
->
seekPosition
(
pCore
->
get
Timeline
Position
());
emit
pCore
->
getMonitor
(
Kdenlive
::
ProjectMonitor
)
->
seekPosition
(
pCore
->
get
Monitor
Position
());
}
}
else
if
(
m_transitionWidget
->
isVisible
())
{
ObjectId
id
=
{
ObjectType
::
TimelineComposition
,
itemId
};
if
(
m_transitionWidget
->
stackOwner
()
==
id
)
{
emit
pCore
->
getMonitor
(
Kdenlive
::
ProjectMonitor
)
->
seekPosition
(
pCore
->
get
Timeline
Position
());
emit
pCore
->
getMonitor
(
Kdenlive
::
ProjectMonitor
)
->
seekPosition
(
pCore
->
get
Monitor
Position
());
}
}
}
src/assets/view/widgets/keyframewidget.cpp
View file @
6c1ac094
...
...
@@ -465,7 +465,7 @@ void KeyframeWidget::slotRefresh()
m_keyframeview
->
setDuration
(
duration
);
m_time
->
setRange
(
0
,
duration
-
1
);
if
(
m_model
->
monitorId
==
Kdenlive
::
ProjectMonitor
)
{
monitorSeek
(
pCore
->
get
Timeline
Position
());
monitorSeek
(
pCore
->
get
Monitor
Position
());
}
else
{
int
pos
=
m_time
->
getValue
();
bool
isInRange
=
pos
>=
in
&&
pos
<
out
;
...
...
src/core.cpp
View file @
6c1ac094
...
...
@@ -987,10 +987,15 @@ Mlt::Profile *Core::thumbProfile()
return
m_thumbProfile
.
get
();
}
int
Core
::
get
Timeline
Position
()
const
int
Core
::
get
Monitor
Position
(
Kdenlive
::
MonitorId
id
)
const
{
if
(
m_guiConstructed
)
{
return
m_monitorManager
->
projectMonitor
()
->
position
();
switch
(
id
)
{
case
Kdenlive
::
ClipMonitor
:
return
m_monitorManager
->
clipMonitor
()
->
position
();
default:
return
m_monitorManager
->
projectMonitor
()
->
position
();
}
}
return
0
;
}
...
...
src/core.h
View file @
6c1ac094
...
...
@@ -217,8 +217,8 @@ public:
int
projectDuration
()
const
;
/** @brief Returns true if current project has some rendered timeline preview */
bool
hasTimelinePreview
()
const
;
/** @brief Returns
current timeline curs
or position */
int
get
TimelinePosition
(
)
const
;
/** @brief Returns
monit
or position */
int
get
MonitorPosition
(
Kdenlive
::
MonitorId
id
=
Kdenlive
::
ProjectMonitor
)
const
;
/** @brief Handles audio and video capture **/
void
startMediaCapture
(
int
tid
,
bool
,
bool
);
void
stopMediaCapture
(
int
tid
,
bool
,
bool
);
...
...
src/dialogs/subtitleedit.cpp
View file @
6c1ac094
...
...
@@ -346,7 +346,7 @@ void SubtitleEdit::goToPrevious()
id
=
m_model
->
getPreviousSub
(
m_activeSub
);
}
else
{
// Start from timeline cursor position
int
cursorPos
=
pCore
->
get
Timeline
Position
();
int
cursorPos
=
pCore
->
get
Monitor
Position
();
std
::
unordered_set
<
int
>
sids
=
m_model
->
getItemsInRange
(
cursorPos
,
cursorPos
);
if
(
sids
.
empty
())
{
sids
=
m_model
->
getItemsInRange
(
0
,
cursorPos
);
...
...
@@ -378,7 +378,7 @@ void SubtitleEdit::goToNext()
id
=
m_model
->
getNextSub
(
m_activeSub
);
}
else
{
// Start from timeline cursor position
int
cursorPos
=
pCore
->
get
Timeline
Position
();
int
cursorPos
=
pCore
->
get
Monitor
Position
();
std
::
unordered_set
<
int
>
sids
=
m_model
->
getItemsInRange
(
cursorPos
,
cursorPos
);
if
(
sids
.
empty
())
{
sids
=
m_model
->
getItemsInRange
(
cursorPos
,
-
1
);
...
...
src/effects/effectstack/view/collapsibleeffectview.cpp
View file @
6c1ac094
...
...
@@ -147,7 +147,7 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
if
(
m_model
->
getOwnerId
().
first
==
ObjectType
::
BinClip
)
{
m_outPos
->
setValue
(
pCore
->
getMonitor
(
Kdenlive
::
ClipMonitor
)
->
position
());
}
else
{
m_inPos
->
setValue
(
pCore
->
get
Timeline
Position
());
m_inPos
->
setValue
(
pCore
->
get
Monitor
Position
());
}
updateEffectZone
();
});
...
...
@@ -155,7 +155,7 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
if
(
m_model
->
getOwnerId
().
first
==
ObjectType
::
BinClip
)
{
m_outPos
->
setValue
(
pCore
->
getMonitor
(
Kdenlive
::
ClipMonitor
)
->
position
());
}
else
{
m_outPos
->
setValue
(
pCore
->
get
Timeline
Position
());
m_outPos
->
setValue
(
pCore
->
get
Monitor
Position
());
}
updateEffectZone
();
});
...
...
@@ -931,7 +931,7 @@ void CollapsibleEffectView::switchInOut(bool checked)
if
(
!
checked
)
{
inOut
=
{
0
,
0
};
}
else
{
int
in
=
pCore
->
get
Timeline
Position
();
int
in
=
pCore
->
get
Monitor
Position
();
inOut
=
{
in
,
in
+
pCore
->
getDurationFromString
(
KdenliveSettings
::
transition_duration
())};
}
break
;
...
...
src/project/dialogs/guidecategories.cpp
View file @
6c1ac094
...
...
@@ -132,10 +132,11 @@ GuideCategories::GuideCategories(KdenliveDoc *doc, QWidget *parent)
if
(
!
editItem
())
{
delete
item
;
}
guide_delete
->
setEnabled
(
guides_list
->
count
()
>
1
);
});
connect
(
guide_delete
,
&
QPushButton
::
clicked
,
this
,
[
=
]()
{
auto
*
item
=
guides_list
->
currentItem
();
if
(
!
item
)
{
if
(
!
item
||
guides_list
->
count
()
==
1
)
{
return
;
}
int
count
=
item
->
data
(
Qt
::
UserRole
+
2
).
toInt
();
...
...
@@ -146,6 +147,7 @@ GuideCategories::GuideCategories(KdenliveDoc *doc, QWidget *parent)
}
}
delete
item
;
guide_delete
->
setEnabled
(
guides_list
->
count
()
>
1
);
});
}
...
...
src/project/dialogs/guideslist.cpp
View file @
6c1ac094
...
...
@@ -188,7 +188,7 @@ void GuidesList::editGuide(const QModelIndex &ix)
int
frame
=
m_proxy
->
data
(
ix
,
MarkerListModel
::
FrameRole
).
toInt
();
GenTime
pos
(
frame
,
pCore
->
getCurrentFps
());
if
(
auto
markerModel
=
m_model
.
lock
())
{
markerModel
->
editMarkerGui
(
pos
,
qApp
->
activeWindow
(),
false
);
markerModel
->
editMarkerGui
(
pos
,
qApp
->
activeWindow
(),
false
,
m_clip
.
get
()
);
}
}
...
...
@@ -211,18 +211,18 @@ void GuidesList::removeGuide()
void
GuidesList
::
addGuide
()
{
int
frame
=
pCore
->
get
TimelinePosition
(
);
int
frame
=
pCore
->
get
MonitorPosition
(
m_markerMode
?
Kdenlive
::
ClipMonitor
:
Kdenlive
::
ProjectMonitor
);
if
(
frame
>=
0
)
{
GenTime
pos
(
frame
,
pCore
->
getCurrentFps
());
if
(
auto
markerModel
=
m_model
.
lock
())
{
markerModel
->
addMultipleMarkersGui
(
pos
,
this
,
true
);
markerModel
->
addMultipleMarkersGui
(
pos
,
this
,
true
,
m_clip
.
get
()
);
}
}
}
void
GuidesList
::
selectionChanged
(
const
QItemSelection
&
selected
,
const
QItemSelection
&
)
{
if
(
selected
.
isEmpty
())
{
if
(
selected
.
indexes
().
isEmpty
())
{
return
;
}
const
QModelIndex
ix
=
selected
.
indexes
().
first
();
...
...
@@ -230,13 +230,18 @@ void GuidesList::selectionChanged(const QItemSelection &selected, const QItemSel
return
;
}
int
pos
=
m_proxy
->
data
(
ix
,
MarkerListModel
::
FrameRole
).
toInt
();
pCore
->
seekMonitor
(
Kdenlive
::
ProjectMonitor
,
pos
);
pCore
->
seekMonitor
(
m_markerMode
?
Kdenlive
::
ClipMonitor
:
Kdenlive
::
ProjectMonitor
,
pos
);
}
GuidesList
::~
GuidesList
()
=
default
;
void
GuidesList
::
setClipMarkerModel
(
std
::
shared_ptr
<
ProjectClip
>
clip
)
{
m_markerMode
=
true
;
if
(
clip
==
m_clip
)
{
return
;
}
m_clip
=
clip
;
if
(
clip
==
nullptr
)
{
m_sortModel
=
nullptr
;
m_proxy
->
setSourceModel
(
m_sortModel
);
...
...
@@ -246,7 +251,6 @@ void GuidesList::setClipMarkerModel(std::shared_ptr<ProjectClip> clip)
return
;
}
setEnabled
(
true
);
m_markerMode
=
true
;
guideslist_label
->
setText
(
i18n
(
"Markers for %1"
,
clip
->
clipName
()));
m_sortModel
=
clip
->
getFilteredMarkerModel
().
get
();
m_model
=
clip
->
getMarkerModel
();
...
...
@@ -262,6 +266,8 @@ void GuidesList::setClipMarkerModel(std::shared_ptr<ProjectClip> clip)
void
GuidesList
::
setModel
(
std
::
weak_ptr
<
MarkerListModel
>
model
,
std
::
shared_ptr
<
MarkerSortModel
>
viewModel
)
{
m_clip
=
nullptr
;
m_markerMode
=
false
;
if
(
viewModel
.
get
()
==
m_sortModel
)
{
// already displayed
return
;
...
...
@@ -307,6 +313,7 @@ void GuidesList::rebuildCategories()
}
QMapIterator
<
int
,
Core
::
MarkerCategory
>
i
(
pCore
->
markerTypes
);
bool
defaultCategoryFound
=
false
;
while
(
i
.
hasNext
())
{
i
.
next
();
pixmap
.
fill
(
i
.
value
().
color
);
...
...
@@ -319,10 +326,19 @@ void GuidesList::rebuildCategories()
markerDefaultMenu
->
addAction
(
ac
);
if
(
i
.
key
()
==
KdenliveSettings
::
default_marker_type
())
{
default_category
->
setIcon
(
colorIcon
);
defaultCategoryFound
=
true
;
}
catGroup
->
addButton
(
cb
);
m_categoriesLayout
.
addWidget
(
cb
);
}
if
(
!
defaultCategoryFound
)
{
// Default marker category not found. set it to first one
QAction
*
ac
=
markerDefaultMenu
->
actions
().
first
();
if
(
ac
)
{
default_category
->
setIcon
(
ac
->
icon
());
KdenliveSettings
::
setDefault_marker_type
(
ac
->
data
().
toInt
());
}
}
connect
(
catGroup
,
&
QButtonGroup
::
buttonToggled
,
this
,
&
GuidesList
::
updateFilter
);
}
...
...
@@ -352,7 +368,6 @@ void GuidesList::updateFilter(QAbstractButton *, bool)
}
pCore
->
currentDoc
()
->
setGuidesFilter
(
filters
);
emit
pCore
->
refreshActiveGuides
();
qDebug
()
<<
"::: GOT FILTERS: "
<<
filters
;
}
void
GuidesList
::
filterView
(
const
QString
&
text
)
...
...
src/project/dialogs/guideslist.h
View file @
6c1ac094
...
...
@@ -50,6 +50,7 @@ private:
std
::
weak_ptr
<
MarkerListModel
>
m_model
;
QIdentityProxyModel
*
m_proxy
{
nullptr
};
MarkerSortModel
*
m_sortModel
{
nullptr
};
std
::
shared_ptr
<
ProjectClip
>
m_clip
;
QVBoxLayout
m_categoriesLayout
;
QButtonGroup
*
catGroup
{
nullptr
};
QActionGroup
*
m_filterGroup
;
...
...
src/timeline2/model/timelinemodel.cpp
View file @
6c1ac094
...
...
@@ -939,7 +939,7 @@ bool TimelineModel::mixClip(int idToMove, const QString &mixId, int delta)
}
if
(
previousClip
>
-
1
&&
nextClip
>
-
1
)
{
// We have a clip before and a clip after, check timeline cursor position to decide where to mix
int
cursor
=
pCore
->
get
Timeline
Position
();
int
cursor
=
pCore
->
get
Monitor
Position
();
if
(
cursor
<
mixPosition
+
clipDuration
/
2
)
{
nextClip
=
-
1
;
}
else
{
...
...
@@ -3041,7 +3041,7 @@ int TimelineModel::requestItemResizeInfo(int itemId, int in, int out, int size,
}
int
proposed_size
=
size
;
if
(
!
skipSnaps
)
{
int
timelinePos
=
pCore
->
get
Timeline
Position
();
int
timelinePos
=
pCore
->
get
Monitor
Position
();
m_snaps
->
addPoint
(
timelinePos
);
proposed_size
=
m_snaps
->
proposeSize
(
in
,
out
,
getBoundaries
(
itemId
),
size
,
right
,
snapDistance
);
m_snaps
->
removePoint
(
timelinePos
);
...
...
@@ -3116,7 +3116,7 @@ int TimelineModel::requestItemSpeedChange(int itemId, int size, bool right, int
size
=
out
-
getTrackById_const
(
trackId
)
->
getBlankStart
(
in
-
1
);
}
}
int
timelinePos
=
pCore
->
get
Timeline
Position
();
int
timelinePos
=
pCore
->
get
Monitor
Position
();
m_snaps
->
addPoint
(
timelinePos
);
int
proposed_size
=
m_snaps
->
proposeSize
(
in
,
out
,
getBoundaries
(
itemId
),
size
,
right
,
snapDistance
);
m_snaps
->
removePoint
(
timelinePos
);
...
...
@@ -4674,7 +4674,7 @@ void TimelineModel::setUndoStack(std::weak_ptr<DocUndoStack> undo_stack)
int
TimelineModel
::
suggestSnapPoint
(
int
pos
,
int
snapDistance
)
{
int
cursorPosition
=
pCore
->
get
Timeline
Position
();
int
cursorPosition
=
pCore
->
get
Monitor
Position
();
m_snaps
->
addPoint
(
cursorPosition
);
int
snapped
=
m_snaps
->
getClosestPoint
(
pos
);
m_snaps
->
removePoint
(
cursorPosition
);
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
6c1ac094
...
...
@@ -319,20 +319,20 @@ bool TimelineController::selectCurrentItem(ObjectType type, bool select, bool ad
{
int
currentClip
=
-
1
;
if
(
type
==
ObjectType
::
TimelineClip
)
{
currentClip
=
m_model
->
isSubtitleTrack
(
m_activeTrack
)
?
m_model
->
getSubtitleByPosition
(
pCore
->
get
Timeline
Position
())
:
m_model
->
getClipByPosition
(
m_activeTrack
,
pCore
->
get
Timeline
Position
());
currentClip
=
m_model
->
isSubtitleTrack
(
m_activeTrack
)
?
m_model
->
getSubtitleByPosition
(
pCore
->
get
Monitor
Position
())
:
m_model
->
getClipByPosition
(
m_activeTrack
,
pCore
->
get
Monitor
Position
());
}
else
if
(
type
==
ObjectType
::
TimelineComposition
)
{
currentClip
=
m_model
->
getCompositionByPosition
(
m_activeTrack
,
pCore
->
get
Timeline
Position
());
currentClip
=
m_model
->
getCompositionByPosition
(
m_activeTrack
,
pCore
->
get
Monitor
Position
());
}
else
if
(
type
==
ObjectType
::
TimelineMix
)
{
if
(
m_activeTrack
>=
0
)
{
currentClip
=
m_model
->
getClipByPosition
(
m_activeTrack
,
pCore
->
get
Timeline
Position
());
currentClip
=
m_model
->
getClipByPosition
(
m_activeTrack
,
pCore
->
get
Monitor
Position
());
}
if
(
currentClip
>
-
1
)
{
if
(
m_model
->
hasClipEndMix
(
currentClip
))
{
int
mixPartner
=
m_model
->
getTrackById_const
(
m_activeTrack
)
->
getSecondMixPartner
(
currentClip
);
int
clipEnd
=
m_model
->
getClipPosition
(
currentClip
)
+
m_model
->
getClipPlaytime
(
currentClip
);
int
mixStart
=
clipEnd
-
m_model
->
getMixDuration
(
mixPartner
);
if
(
mixStart
<
pCore
->
get
Timeline
Position
()
&&
pCore
->
get
Timeline
Position
()
<
clipEnd
)
{
if
(
mixStart
<
pCore
->
get
Monitor
Position
()
&&
pCore
->
get
Monitor
Position
()
<
clipEnd
)
{
if
(
select
)
{
m_model
->
requestMixSelection
(
mixPartner
);
return
true
;
...
...
@@ -342,7 +342,7 @@ bool TimelineController::selectCurrentItem(ObjectType type, bool select, bool ad
}
}
}
int
delta
=
pCore
->
get
Timeline
Position
()
-
m_model
->
getClipPosition
(
currentClip
);
int
delta
=
pCore
->
get
Monitor
Position
()
-
m_model
->
getClipPosition
(
currentClip
);
if
(
m_model
->
getMixDuration
(
currentClip
)
>=
delta
)
{
if
(
select
)
{
m_model
->
requestMixSelection
(
currentClip
);
...
...
@@ -437,7 +437,7 @@ int TimelineController::insertClip(int tid, int position, const QString &data_st
tid
=
m_activeTrack
;
}
if
(
position
==
-
1
)
{
position
=
pCore
->
get
Timeline
Position
();
position
=
pCore
->
get
Monitor
Position
();
}
if
(
!
m_model
->
requestClipInsertion
(
data_str
,
tid
,
position
,
id
,
logUndo
,
refreshView
,
useTargets
))
{
id
=
-
1
;
...
...
@@ -452,7 +452,7 @@ QList<int> TimelineController::insertClips(int tid, int position, const QStringL
tid
=
m_activeTrack
;
}
if
(
position
==
-
1
)
{
position
=
pCore
->
get
Timeline
Position
();
position
=
pCore
->
get
Monitor
Position
();
}
TimelineFunctions
::
requestMultipleClipsInsertion
(
m_model
,
binIds
,
tid
,
position
,
clipIds
,
logUndo
,
refreshView
);
// we don't need to check the return value of the above function, in case of failure it will return an empty list of ids.
...
...
@@ -648,7 +648,7 @@ int TimelineController::getMainSelectedItem(bool restrictToCurrentPos, bool allo
}
}
if
(
m_model
->
isClip
(
itemId
))
{
int
position
=
pCore
->
get
Timeline
Position
();
int
position
=
pCore
->
get
Monitor
Position
();
int
start
=
m_model
->
getClipPosition
(
itemId
);
int
end
=
start
+
m_model
->
getClipPlaytime
(
itemId
);
if
(
position
>=
start
&&
position
<=
end
)
{
...
...
@@ -852,15 +852,15 @@ void TimelineController::gotoNextSnap()
m_activeSnaps
.
push_back
(
m_zone
.
y
()
-
1
);
}
std
::
vector
<
int
>
canceled
=
pCore
->
currentDoc
()
->
getFilteredGuideModel
()
->
getIgnoredSnapPoints
();
int
nextSnap
=
m_model
->
getNextSnapPos
(
pCore
->
get
Timeline
Position
(),
m_activeSnaps
,
canceled
);
if
(
nextSnap
>
pCore
->
get
Timeline
Position
())
{
int
nextSnap
=
m_model
->
getNextSnapPos
(
pCore
->
get
Monitor
Position
(),
m_activeSnaps
,
canceled
);
if
(
nextSnap
>
pCore
->
get
Monitor
Position
())
{
setPosition
(
nextSnap
);
}
}
void
TimelineController
::
gotoPreviousSnap
()
{
if
(
pCore
->
get
Timeline
Position
()
>
0
)
{
if
(
pCore
->
get
Monitor
Position
()
>
0
)
{
if
(
m_activeSnaps
.
empty
()
||
pCore
->
undoIndex
()
!=
m_snapStackIndex
)
{
m_snapStackIndex
=
pCore
->
undoIndex
();
m_activeSnaps
.
clear
();
...
...
@@ -869,14 +869,14 @@ void TimelineController::gotoPreviousSnap()
m_activeSnaps
.
push_back
(
m_zone
.
y
()
-
1
);
}
std
::
vector
<
int
>
canceled
=
pCore
->
currentDoc
()
->
getFilteredGuideModel
()
->
getIgnoredSnapPoints
();
setPosition
(
m_model
->
getPreviousSnapPos
(
pCore
->
get
Timeline
Position
(),
m_activeSnaps
,
canceled
));
setPosition
(
m_model
->
getPreviousSnapPos
(
pCore
->
get
Monitor
Position
(),
m_activeSnaps
,
canceled
));
}
}
void
TimelineController
::
gotoNextGuide
()
{
QList
<
CommentedTime
>
guides
=
pCore
->
currentDoc
()
->
getGuideModel
()
->
getAllMarkers
();
int
pos
=
pCore
->
get
Timeline
Position
();
int
pos
=
pCore
->
get
Monitor
Position
();
double
fps
=
pCore
->
getCurrentFps
();
for
(
auto
&
guide
:
guides
)
{
if
(
guide
.
time
().
frames
(
fps
)
>
pos
)
{
...
...
@@ -889,9 +889,9 @@ void TimelineController::gotoNextGuide()
void
TimelineController
::
gotoPreviousGuide
()
{
if
(
pCore
->
get
Timeline
Position
()
>
0
)
{
if
(
pCore
->
get
Monitor
Position
()
>
0
)
{
QList
<
CommentedTime
>
guides
=
pCore
->
currentDoc
()
->
getGuideModel
()
->
getAllMarkers
();
int
pos
=
pCore
->
get
Timeline
Position
();
int
pos
=
pCore
->
get
Monitor
Position
();
double
fps
=
pCore
->
getCurrentFps
();
int
lastGuidePos
=
0
;
for
(
auto
&
guide
:
guides
)
{
...
...
@@ -969,7 +969,7 @@ void TimelineController::setInPoint(bool ripple)
m_model
->
requestItemResize
(
id
,
size
,
false
,
true
,
0
,
false
);
}
};
int
cursorPos
=
pCore
->
get
Timeline
Position
();
int
cursorPos
=
pCore
->
get
Monitor
Position
();
const
auto
selection
=
m_model
->
getCurrentSelection
();
bool
selectionFound
=
false
;
if
(
!
selection
.
empty
())
{
...
...
@@ -1048,7 +1048,7 @@ void TimelineController::setOutPoint(bool ripple)
m_model
->
requestItemResize
(
id
,
size
,
true
,
true
,
0
,
false
);
}
};
int
cursorPos
=
pCore
->
get
Timeline
Position
();
int
cursorPos
=
pCore
->
get
Monitor
Position
();
const
auto
selection
=
m_model
->
getCurrentSelection
();
bool
selectionFound
=
false
;
if
(
!
selection
.
empty
())
{
...
...
@@ -1126,7 +1126,7 @@ void TimelineController::editMarker(int cid, int position)
double
speed
=
m_model
->
getClipSpeed
(
cid
);
if
(
position
==
-
1
)
{
// Calculate marker position relative to timeline cursor
position
=
pCore
->
get
Timeline
Position
()
-
m_model
->
getClipPosition
(
cid
)
+
m_model
->
getClipIn
(
cid
);
position
=
pCore
->
get
Monitor
Position
()
-
m_model
->
getClipPosition
(
cid
)
+
m_model
->
getClipIn
(
cid
);
position
=
int
(
position
*
speed
);
}
if
(
position
<
(
m_model
->
getClipIn
(
cid
)
*
speed
)
||
position
>
(
m_model
->
getClipIn
(
cid
)
*
speed
+
m_model
->
getClipPlaytime
(
cid
)))
{
...
...
@@ -1155,7 +1155,7 @@ void TimelineController::addMarker(int cid, int position)
double
speed
=
m_model
->
getClipSpeed
(
cid
);
if
(
position
==
-
1
)
{
// Calculate marker position relative to timeline cursor
position
=
pCore
->
get
Timeline
Position
()
-
m_model
->
getClipPosition
(
cid
)
+
m_model
->
getClipIn
(
cid
);
position
=
pCore
->
get
Monitor
Position
()
-
m_model
->
getClipPosition
(
cid
)
+
m_model
->
getClipIn
(
cid
);
position
=
int
(
position
*
speed
);
}
if
(
position
<
(
m_model
->
getClipIn
(
cid
)
*
speed
)
||
position
>
(
m_model
->
getClipIn
(
cid
)
*
speed
+
m_model
->
getClipPlaytime
(
cid
)))
{
...
...
@@ -1195,7 +1195,7 @@ void TimelineController::addQuickMarker(int cid, int position)
double
speed
=
m_model
->
getClipSpeed
(
cid
);
if
(
position
==
-
1
)
{
// Calculate marker position relative to timeline cursor
position
=
pCore
->
get
Timeline
Position
()
-
m_model
->
getClipPosition
(
cid
);
position
=
pCore
->
get
Monitor
Position
()
-
m_model
->
getClipPosition
(
cid
);
position
=
int
(
position
*
speed
);
}
if
(
position
<
(
m_model
->
getClipIn
(
cid
)
*
speed
)
||
position
>
((
m_model
->
getClipIn
(
cid
)
+
m_model
->
getClipPlaytime
(
cid
)
*
speed
)))
{
...
...
@@ -1221,7 +1221,7 @@ void TimelineController::deleteMarker(int cid, int position)
double
speed
=
m_model
->
getClipSpeed
(
cid
);
if
(
position
==
-
1
)
{
// Calculate marker position relative to timeline cursor
position
=
pCore
->
get
Timeline
Position
()
-
m_model
->
getClipPosition
(
cid
)
+
m_model
->
getClipIn
(
cid
);
position
=
pCore
->
get
Monitor
Position
()
-
m_model
->
getClipPosition
(
cid
)
+
m_model
->
getClipIn
(
cid
);
position
=
int
(
position
*
speed
);
}
if
(
position
<
(
m_model
->
getClipIn
(
cid
)
*
speed
)
||
position
>
(
m_model
->
getClipIn
(
cid
)
*
speed
+
m_model
->
getClipPlaytime
(
cid
)))
{
...
...
@@ -1250,7 +1250,7 @@ void TimelineController::deleteAllMarkers(int cid)
void
TimelineController
::
editGuide
(
int
frame
)
{
if
(
frame
==
-
1
)
{
frame
=
pCore
->
get
Timeline
Position
();
frame
=
pCore
->
get
Monitor
Position
();
}
auto
guideModel
=
pCore
->
currentDoc
()
->
getGuideModel
();
GenTime
pos
(
frame
,
pCore
->
getCurrentFps
());
...
...
@@ -1309,7 +1309,7 @@ void TimelineController::switchGuide(int frame, bool deleteOnly, bool showGui)
{
bool
markerFound
=
false
;
if
(
frame
==
-
1
)
{
frame
=
pCore
->
get
Timeline
Position
();
frame
=
pCore
->
get
Monitor
Position
();
}
CommentedTime
marker
=
pCore
->
currentDoc
()
->
getGuideModel
()
->
getMarker
(
frame
,
&
markerFound
);
if
(
!
markerFound
)
{
...
...
@@ -1357,7 +1357,7 @@ void TimelineController::addAsset(const QVariantMap &data)
// Move timeline cursor inside clip if it is not
int
in
=
m_model
->
getClipPosition
(
cid
);
int
out
=
in
+
m_model
->
getClipPlaytime
(
cid
);
int
position
=
pCore
->
get
Timeline
Position
();
int
position
=
pCore
->
get
Monitor
Position
();
if
(
position
<
in
||
position
>
out
)
{
emit
seeked
(
in
);
}
...
...
@@ -1667,7 +1667,7 @@ void TimelineController::selectItems(const QVariantList &tracks, int startFrame,
void
TimelineController
::
requestClipCut
(
int
clipId
,
int
position
)
{
if
(
position
==
-
1
)
{
position
=
pCore
->
get
Timeline
Position
();
position
=
pCore
->
get
Monitor
Position
();
}
TimelineFunctions
::
requestClipCut
(
m_model
,
clipId
,
position
);
}
...
...
@@ -1675,7 +1675,7 @@ void TimelineController::requestClipCut(int clipId, int position)
void
TimelineController
::
cutClipUnderCursor
(
int
position
,
int
track
)
{
if
(
position
==
-
1
)
{
position
=
pCore
->
get
Timeline
Position
();
position
=
pCore
->
get
Monitor
Position
();
}
QMutexLocker
lk
(
&
m_metaMutex
);
bool
foundClip
=
false
;
...
...
@@ -1724,7 +1724,7 @@ void TimelineController::cutSubtitle(int id, int cursorPos)
return
requestClipCut
(
id
,
-
1
);
}
// Cut subtitle at edit position
int
timelinePos
=
pCore
->
get
Timeline
Position
();
int
timelinePos
=
pCore
->
get
Monitor
Position
();
GenTime
position
(
timelinePos
,
pCore
->
getCurrentFps
());
GenTime
start
=
m_model
->
m_allSubtitles
.
at
(
id
);
auto
subtitleModel
=
pCore
->
getSubtitleModel
();
...
...
@@ -1757,7 +1757,7 @@ void TimelineController::cutSubtitle(int id, int cursorPos)
void
TimelineController
::
cutAllClipsUnderCursor
(
int
position
)
{
if
(
position
==
-
1
)
{
position
=
pCore
->
get
Timeline
Position
();
position
=
pCore
->
get
Monitor
Position
();
}
QMutexLocker
lk
(
&
m_metaMutex
);
TimelineFunctions
::
requestClipCutAll
(
m_model
,
position
);
...
...
@@ -1814,7 +1814,7 @@ void TimelineController::seekCurrentClip(bool seekToEnd)
if
(
!
selection
.
empty
())
{
cid
=
*
selection
.
begin
();
}
else
{
int
cursorPos
=
pCore
->
get
Timeline
Position
();
int
cursorPos
=
pCore
->
get
Monitor
Position
();
cid
=
m_model
->
getClipByPosition
(
m_activeTrack
,
cursorPos
);
if
(
cid
<
0
)
{
/* If the cursor is at the clip end it is one frame after the clip,
...
...
@@ -1864,7 +1864,7 @@ int TimelineController::getMouseTrack()
bool
TimelineController
::
positionIsInItem
(
int
id
)
{
int
in
=
m_model
->
getItemPosition
(
id
);
int
position
=
pCore
->
get
Timeline
Position
();
int
position
=
pCore
->
get
Monitor
Position
();
if
(
in
>
position
)
{
return
false
;
}
...
...
@@ -1904,7 +1904,7 @@ void TimelineController::addEffectToCurrentClip(const QStringList &effectData)
QList
<
int
>
activeClips
;
for
(
int
track
=
m_model
->
getTracksCount
()
-
1
;
track
>=
0
;
track
--
)
{
int
trackIx
=
m_model
->
getTrackIndexFromPosition
(
track
);
int
cid
=
m_model
->
getClipByPosition
(
trackIx
,
pCore
->
get
Timeline
Position
());
int
cid
=
m_model
->
getClipByPosition
(
trackIx
,
pCore
->
get
Monitor
Position
());
if
(
cid
>
-
1
)
{
activeClips
<<
cid
;
}
...
...
@@ -2587,7 +2587,7 @@ QMap<QString, QString> TimelineController::documentProperties()
props
.
insert
(
QStringLiteral
(
"audioTarget"
),
QString
::
number
(
audioTarget
));
props
.
insert
(
QStringLiteral
(
"videoTarget"
),
QString
::
number
(
videoTarget
));
props
.
insert
(
QStringLiteral
(
"activeTrack"
),
QString
::
number
(
activeTrack
));
props
.
insert
(
QStringLiteral
(
"position"
),
QString
::
number
(
pCore
->
get
Timeline
Position
()));
props
.
insert
(
QStringLiteral
(
"position"
),
QString
::
number
(
pCore
->
get
Monitor
Position
()));
QVariant
returnedValue
;
QMetaObject
::
invokeMethod
(
m_root
,
"getScrollPos"
,
Q_RETURN_ARG
(
QVariant
,
returnedValue
));
int
scrollPos
=
returnedValue
.
toInt
();
...
...
@@ -2607,7 +2607,7 @@ int TimelineController::getMenuOrTimelinePos() const
{
int
frame
=
m_root
->
property
(
"clickFrame"
).
toInt
();
if
(
frame
==
-
1
)
{
frame
=
pCore
->
get
Timeline
Position
();
frame
=
pCore
->
get
Monitor
Position
();
}
return
frame
;
}
...
...
@@ -2837,8 +2837,8 @@ void TimelineController::extractZone(QPoint zone, bool liftOnly)
}
if
(
m_zone
.
isNull
())
{
// Use current timeline position and clip zone length
zone
.
setY
(
pCore
->
get
Timeline
Position
()
+
zone
.
y
()
-
zone
.
x
());
zone
.
setX
(
pCore
->
get
Timeline
Position
());
zone
.
setY
(
pCore
->
get
Monitor
Position
()
+
zone
.
y
()
-
zone
.
x
());
zone
.
setX
(
pCore
->
get
Monitor
Position
());
}
TimelineFunctions
::
extractZone
(
m_model
,
tracks
,
m_zone
==
QPoint
()
?
zone
:
m_zone
,
liftOnly
);
if
(
!
liftOnly
&&
!
m_zone
.
isNull
())
{
...
...
@@ -3004,7 +3004,7 @@ bool TimelineController::insertClipZone(const QString &binId, int tid, int posit
bool
res
=
TimelineFunctions
::
insertZone
(
m_model
,
target_tracks
,
binId
,
position
,
zone
,
overwrite
,
false
,
undo
,
redo
);
if
(
res
)
{
int
newPos
=
position
+
(
zone
.
y
()
-
zone
.
x
());
int
currentPos
=
pCore
->
get
Timeline
Position
();
int
currentPos
=
pCore
->
get
Monitor
Position
();
Fun
redoPos
=
[
this
,
newPos
]()
{
Kdenlive
::
MonitorId
activeMonitor
=
pCore
->
monitorManager
()
->
activeMonitor
()
->
id
();
pCore
->
monitorManager
()
->
activateMonitor
(
Kdenlive
::
ProjectMonitor
);
...
...
@@ -3057,7 +3057,7 @@ int TimelineController::insertZone(const QString &binId, QPoint zone, bool overw
sourceZone
=
QPoint
(
zone
.
x
(),
zone
.
x
()
+
m_zone
.
y
()
-
m_zone
.
x
());
}
else
{
// Use current timeline pos and clip zone for in/out
insertPoint
=
pCore
->
get
Timeline
Position
();
insertPoint
=
pCore
->
get
Monitor
Position
();
sourceZone
=
zone
;
}
QList
<
int
>
target_tracks
;
...
...
@@ -3076,7 +3076,7 @@ int TimelineController::insertZone(const QString &binId, QPoint zone, bool overw
bool
res
=
TimelineFunctions
::
insertZone
(
m_model
,
target_tracks
,
binId
,
insertPoint
,
sourceZone
,
overwrite
,
true
,
undo
,
redo
);
if
(
res
)
{
int
newPos
=
insertPoint
+
(
sourceZone
.
y
()
-
sourceZone
.
x
());
int
currentPos
=
pCore
->
get
Timeline
Position
();
int
currentPos
=
pCore
->
get
Monitor
Position
();
Fun
redoPos
=
[
this
,
newPos
]()
{
setPosition
(
newPos
);
pCore
->
getMonitor
(
Kdenlive
::
ProjectMonitor
)
->
refreshMonitorIfActive
();
...
...
@@ -3169,7 +3169,7 @@ void TimelineController::addEffectToClip(const QString &assetId, int clipId)
// Move timeline cursor inside clip if it is not
int
in
=
m_model
->
getClipPosition
(
clipId
);
int
out
=
in
+
m_model
->
getClipPlaytime
(
clipId
);
int
position
=
pCore
->
get
Timeline
Position
();
int
position
=
pCore
->
get
Monitor
Position
();
if
(
position
<
in
||
position
>
out
)
{
emit
seeked
(
in
);
}
...
...
@@ -4544,7 +4544,7 @@ void TimelineController::switchRecording(int trackId, bool record)
pCore
->
displayMessage
(
i18n
(
"Impossible to capture on a locked track"
),
ErrorMessage
,
500
);
return
;
}
m_recordStart
.
first
=
pCore
->
get
Timeline
Position
();
m_recordStart
.
first
=
pCore
->
get
Monitor
Position
();
m_recordTrack
=
trackId
;
int
maximumSpace
=
m_model
->
getTrackById_const
(
trackId
)
->
getBlankEnd
(
m_recordStart
.
first
);
if
(
maximumSpace
==
INT_MAX
)
{
...
...
@@ -4680,7 +4680,7 @@ bool TimelineController::refreshIfVisible(int cid)
++
it
;
continue
;
}
int
child
=
m_model
->
getClipByPosition
(
target_track
,
pCore
->
get
Timeline
Position
());