Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

*Assign 'g' shortcut to add/remove guide

*Add got to next/previous guide with CTRL+arrow
related to #563
parent 21a78368
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kdenlive" version="176" translationDomain="kdenlive">
<kpartgui name="kdenlive" version="177" translationDomain="kdenlive">
<MenuBar>
<Menu name="file" >
<Action name="dvd_wizard" />
......@@ -169,12 +169,14 @@
<Separator />
<Menu name="monitor_go" ><text>Go To</text>
<Action name="seek_start" />
<Action name="monitor_seek_guide_backward" />
<Action name="monitor_seek_snap_backward" />
<Action name="seek_zone_start" />
<Action name="seek_clip_start" />
<Action name="seek_clip_end" />
<Action name="seek_zone_end" />
<Action name="monitor_seek_snap_forward" />
<Action name="monitor_seek_guide_forward" />
<Action name="seek_end" />
</Menu>
<Menu name="monitor_seek" ><text>Seek</text>
......
......@@ -995,7 +995,7 @@ void MainWindow::setupActions()
m_useTimelineZone->setInactiveIcon(QIcon::fromTheme(QStringLiteral("timeline-use-zone-off")));
m_useTimelineZone->setAutoToggle(true);
connect(m_useTimelineZone, &KDualAction::activeChangedByUser, this, &MainWindow::slotSwitchTimelineZone);
addAction(QStringLiteral("use_timeline_zone_in_edit"), m_useTimelineZone, Qt::Key_G);
addAction(QStringLiteral("use_timeline_zone_in_edit"), m_useTimelineZone);
m_compositeAction = new KSelectAction(QIcon::fromTheme(QStringLiteral("composite-track-off")), i18n("Track compositing"), this);
m_compositeAction->setToolTip(i18n("Track compositing"));
......@@ -1415,13 +1415,16 @@ void MainWindow::setupActions()
addAction(QStringLiteral("monitor_seek_snap_backward"), i18n("Go to Previous Snap Point"), this, SLOT(slotSnapRewind()),
QIcon::fromTheme(QStringLiteral("media-seek-backward")), Qt::ALT + Qt::Key_Left);
addAction(QStringLiteral("monitor_seek_guide_backward"), i18n("Go to Previous Guide"), this, SLOT(slotGuideRewind()),
QIcon::fromTheme(QStringLiteral("media-seek-backward")), Qt::CTRL + Qt::Key_Left);
addAction(QStringLiteral("seek_clip_start"), i18n("Go to Clip Start"), this, SLOT(slotClipStart()), QIcon::fromTheme(QStringLiteral("media-seek-backward")),
Qt::Key_Home);
addAction(QStringLiteral("seek_clip_end"), i18n("Go to Clip End"), this, SLOT(slotClipEnd()), QIcon::fromTheme(QStringLiteral("media-seek-forward")),
Qt::Key_End);
addAction(QStringLiteral("monitor_seek_snap_forward"), i18n("Go to Next Snap Point"), this, SLOT(slotSnapForward()),
QIcon::fromTheme(QStringLiteral("media-seek-forward")), Qt::ALT + Qt::Key_Right);
addAction(QStringLiteral("monitor_seek_guide_forward"), i18n("Go to Next Guide"), this, SLOT(slotGuideForward()),
QIcon::fromTheme(QStringLiteral("media-seek-forward")), Qt::CTRL + Qt::Key_Right);
addAction(QStringLiteral("align_playhead"), i18n("Align Playhead to Mouse Position"), this, SLOT(slotAlignPlayheadToMousePos()), QIcon(), Qt::Key_P);
addAction(QStringLiteral("grab_item"), i18n("Grab Current Item"), this, SLOT(slotGrabItem()), QIcon::fromTheme(QStringLiteral("transform-move")),
......@@ -1615,7 +1618,7 @@ void MainWindow::setupActions()
disablePreview->setCheckable(true);
addAction(QStringLiteral("disable_preview"), disablePreview);
addAction(QStringLiteral("add_guide"), i18n("Add/Remove Guide"), this, SLOT(slotAddGuide()), QIcon::fromTheme(QStringLiteral("list-add")));
addAction(QStringLiteral("add_guide"), i18n("Add/Remove Guide"), this, SLOT(slotAddGuide()), QIcon::fromTheme(QStringLiteral("list-add")), Qt::Key_G);
addAction(QStringLiteral("delete_guide"), i18n("Delete Guide"), this, SLOT(slotDeleteGuide()), QIcon::fromTheme(QStringLiteral("edit-delete")));
addAction(QStringLiteral("edit_guide"), i18n("Edit Guide"), this, SLOT(slotEditGuide()), QIcon::fromTheme(QStringLiteral("document-properties")));
addAction(QStringLiteral("delete_all_guides"), i18n("Delete All Guides"), this, SLOT(slotDeleteAllGuides()),
......@@ -2861,6 +2864,24 @@ void MainWindow::slotSnapForward()
}
}
void MainWindow::slotGuideRewind()
{
if (m_projectMonitor->isActive()) {
getMainTimeline()->controller()->gotoPreviousGuide();
} else {
m_clipMonitor->slotSeekToPreviousSnap();
}
}
void MainWindow::slotGuideForward()
{
if (m_projectMonitor->isActive()) {
getMainTimeline()->controller()->gotoNextGuide();
} else {
m_clipMonitor->slotSeekToNextSnap();
}
}
void MainWindow::slotClipStart()
{
if (m_projectMonitor->isActive()) {
......
......@@ -358,6 +358,8 @@ private slots:
void slotSetTool(ProjectTool tool);
void slotSnapForward();
void slotSnapRewind();
void slotGuideForward();
void slotGuideRewind();
void slotClipStart();
void slotClipEnd();
void slotSelectClipInTimeline();
......
......@@ -646,6 +646,38 @@ void TimelineController::gotoPreviousSnap()
}
}
void TimelineController::gotoNextGuide()
{
QList<CommentedTime> guides = pCore->projectManager()->current()->getGuideModel()->getAllMarkers();
int pos = pCore->getTimelinePosition();
double fps = pCore->getCurrentFps();
for (auto &guide : guides) {
if (guide.time().frames(fps) > pos) {
setPosition(guide.time().frames(fps));
return;
}
}
setPosition(m_duration - 1);
}
void TimelineController::gotoPreviousGuide()
{
if (pCore->getTimelinePosition() > 0) {
QList<CommentedTime> guides = pCore->projectManager()->current()->getGuideModel()->getAllMarkers();
int pos = pCore->getTimelinePosition();
double fps = pCore->getCurrentFps();
int lastGuidePos = 0;
for (auto &guide : guides) {
if (guide.time().frames(fps) >= pos) {
setPosition(lastGuidePos);
return;
}
lastGuidePos = guide.time().frames(fps);
}
setPosition(lastGuidePos);
}
}
void TimelineController::groupSelection()
{
const auto selection = m_model->getCurrentSelection();
......
......@@ -303,6 +303,13 @@ public:
/* @brief Seek to previous snap point
*/
void gotoPreviousSnap();
/* @brief Seek to previous guide
*/
void gotoPreviousGuide();
/* @brief Seek to next guide
*/
void gotoNextGuide();
/* @brief Set current item's start point to cursor position
*/
void setInPoint();
......
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