Reintroduce missing marker menu in timeline clip context menu

parent 53648675
......@@ -66,6 +66,29 @@ Menu {
onTriggered: timeline.splitVideo(clipId)
visible: !grouped && canBeVideo && clipStatus == ClipState.AudioOnly
}
Menu {
title: i18n('Markers')
MenuItem {
text: i18n('Add Marker')
onTriggered: timeline.addMarker(clipId, timeline.position)
}
MenuItem {
text: i18n('Add Marker/Guide quickly')
onTriggered: timeline.addQuickMarker(clipId, timeline.position)
}
MenuItem {
text: i18n('Edit Marker')
onTriggered: timeline.editMarker(clipId, timeline.position)
}
MenuItem {
text: i18n('Delete Marker')
onTriggered: timeline.deleteMarker(clipId, timeline.position)
}
MenuItem {
text: i18n('Delete All Markers')
onTriggered: timeline.deleteAllMarkers(clipId)
}
}
MenuItem {
text: i18n('Set Audio Reference')
onTriggered: timeline.setAudioRef(clipId)
......
......@@ -583,13 +583,46 @@ void TimelineController::setOutPoint()
}
}
void TimelineController::editMarker(const QString &cid, int frame)
void TimelineController::editMarker(int cid, int position)
{
std::shared_ptr<ProjectClip> clip = pCore->bin()->getBinClip(cid);
GenTime pos(frame, pCore->getCurrentFps());
Q_ASSERT(m_model->isClip(cid));
std::shared_ptr<ProjectClip> clip = pCore->bin()->getBinClip(getClipBinId(cid));
GenTime pos(position - m_model->getClipPosition(cid) + m_model->getClipIn(cid), pCore->getCurrentFps());
clip->getMarkerModel()->editMarkerGui(pos, qApp->activeWindow(), false, clip.get());
}
void TimelineController::addMarker(int cid, int position)
{
Q_ASSERT(m_model->isClip(cid));
std::shared_ptr<ProjectClip> clip = pCore->bin()->getBinClip(getClipBinId(cid));
GenTime pos(position - m_model->getClipPosition(cid) + m_model->getClipIn(cid), pCore->getCurrentFps());
clip->getMarkerModel()->editMarkerGui(pos, qApp->activeWindow(), true, clip.get());
}
void TimelineController::addQuickMarker(int cid, int position)
{
Q_ASSERT(m_model->isClip(cid));
std::shared_ptr<ProjectClip> clip = pCore->bin()->getBinClip(getClipBinId(cid));
GenTime pos(position - m_model->getClipPosition(cid) + m_model->getClipIn(cid), pCore->getCurrentFps());
CommentedTime marker(pos, pCore->currentDoc()->timecode().getDisplayTimecode(pos, false), KdenliveSettings::default_marker_type());
clip->getMarkerModel()->addMarker(marker.time(), marker.comment(), marker.markerType());
}
void TimelineController::deleteMarker(int cid, int position)
{
Q_ASSERT(m_model->isClip(cid));
std::shared_ptr<ProjectClip> clip = pCore->bin()->getBinClip(getClipBinId(cid));
GenTime pos(position - m_model->getClipPosition(cid) + m_model->getClipIn(cid), pCore->getCurrentFps());
clip->getMarkerModel()->removeMarker(pos);
}
void TimelineController::deleteAllMarkers(int cid)
{
Q_ASSERT(m_model->isClip(cid));
std::shared_ptr<ProjectClip> clip = pCore->bin()->getBinClip(getClipBinId(cid));
clip->getMarkerModel()->removeAllMarkers();
}
void TimelineController::editGuide(int frame)
{
if (frame == -1) {
......
......@@ -228,7 +228,19 @@ public:
Q_INVOKABLE void unGroupSelection(int cid = -1);
/* @brief Ask for edit marker dialog
*/
Q_INVOKABLE void editMarker(const QString &cid, int frame);
Q_INVOKABLE void editMarker(int cid, int position);
/* @brief Ask for marker add dialog
*/
Q_INVOKABLE void addMarker(int cid, int position);
/* @brief Ask for quick marker add (without dialog)
*/
Q_INVOKABLE void addQuickMarker(int cid, int position);
/* @brief Ask for marker delete
*/
Q_INVOKABLE void deleteMarker(int cid, int position);
/* @brief Ask for all markers delete
*/
Q_INVOKABLE void deleteAllMarkers(int cid);
/* @brief Ask for edit timeline guide dialog
*/
Q_INVOKABLE void editGuide(int frame = -1);
......
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