Commit a69963ab authored by Julius Künzel's avatar Julius Künzel
Browse files

Add advanced trimming tool: Slip

The slip tool allows to move in and out point of a (cut) clip by a certain amount while position and size of the clip stay the same.

Related to #1069

Commit includes:
- basis for advanced trimming tools (e.g. trimming preview in monitor)
- make editing tool available as enum in qml
- add slip tool
- add tests for slip
parent 43725072
Pipeline #77567 passed with stage
in 8 minutes and 29 seconds
......@@ -131,7 +131,19 @@ enum ProjectItemType { ProjectClipType = 0, ProjectFolderType, ProjectSubclipTyp
enum GraphicsRectItem { AVWidget = 70000, LabelWidget, TransitionWidget, GroupWidget };
enum ProjectTool { SelectTool = 0, RazorTool = 1, SpacerTool = 2 };
namespace ToolType {
Q_NAMESPACE
enum ProjectTool {
SelectTool = 0,
RazorTool = 1,
SpacerTool = 2,
RippleTool = 3,
RollTool = 4,
SlipTool = 5,
SlideTool = 6
};
Q_ENUM_NS(ProjectTool)
}
enum MonitorSceneType {
MonitorSceneNone = 0,
......@@ -140,7 +152,7 @@ enum MonitorSceneType {
MonitorSceneCorners,
MonitorSceneRoto,
MonitorSceneSplit,
MonitorSceneRipple,
MonitorSceneTrimming,
MonitorSplitTrack
};
......
......@@ -56,6 +56,7 @@
<Action name="select_tool" />
<Action name="razor_tool" />
<Action name="spacer_tool" />
<Action name="slip_tool" />
</Menu>
<Menu name="clip" ><text>&amp;Clip</text>
......@@ -282,6 +283,7 @@
<Action name="select_tool" />
<Action name="razor_tool" />
<Action name="spacer_tool" />
<Action name="slip_tool" />
<Separator />
<Action name="timeline_timecode" />
<Separator />
......
......@@ -235,9 +235,9 @@ int main(int argc, char *argv[])
"ClipState", // name in QML
"Error: only enums");
qmlRegisterUncreatableMetaObject(FileStatus::staticMetaObject, // static meta object
"com.enums", // import statement
1, 0, // major and minor version of the import
"ClipStatus", // name in QML
"com.enums", // import statement
1, 0, // major and minor version of the import
"ClipStatus", // name in QML
"Error: only enums");
qmlRegisterUncreatableMetaObject(ClipType::staticMetaObject, // static meta object
"com.enums", // import statement
......@@ -245,9 +245,14 @@ int main(int argc, char *argv[])
"ProducerType", // name in QML
"Error: only enums");
qmlRegisterUncreatableMetaObject(AssetListType::staticMetaObject, // static meta object
"com.enums", // import statement
1, 0, // major and minor version of the import
"AssetType", // name in QML
"Error: only enums");
qmlRegisterUncreatableMetaObject(ToolType::staticMetaObject, // static meta object
"com.enums", // import statement
1, 0, // major and minor version of the import
"AssetType", // name in QML
"ProjectTool", // name in QML
"Error: only enums");
if (parser.value(QStringLiteral("mlt-log")) == QStringLiteral("verbose")) {
mlt_log_set_level(MLT_LOG_VERBOSE);
......
......@@ -1205,10 +1205,41 @@ void MainWindow::setupActions()
// toolbar->addAction(m_buttonSpacerTool);
m_buttonSpacerTool->setCheckable(true);
m_buttonSpacerTool->setChecked(false);
/* TODO Implement Ripple
// TODO icon available (and properly working) in KF 5.86
m_buttonRippleTool = new QAction(QIcon::fromTheme(QStringLiteral("kdenlive-ripple")), i18n("Ripple tool"), this);
m_buttonRippleTool->setCheckable(true);
m_buttonRippleTool->setChecked(false);*/
/* TODO Implement Roll
// TODO icon available (and properly working) in KF 5.86
m_buttonRollTool = new QAction(QIcon::fromTheme(QStringLiteral("kdenlive-rolling")), i18n("Roll tool"), this);
m_buttonRollTool->setCheckable(true);
m_buttonRollTool->setChecked(false);*/
// TODO icon available (and properly working) in KF 5.86
//m_buttonSlipTool = new QAction(QIcon::fromTheme(QStringLiteral("kdenlive-slip")), i18n("Slip tool"), this);
m_buttonSlipTool = new QAction(QIcon::fromTheme(QStringLiteral("transform-move-horizontal")), i18n("Slip tool"), this);
m_buttonSlipTool->setCheckable(true);
m_buttonSlipTool->setChecked(false);
/* TODO Implement Slide
// TODO icon available (and properly working) in KF 5.86
m_buttonSlideTool = new QAction(QIcon::fromTheme(QStringLiteral("kdenlive-slide")), i18n("Slide tool"), this);
m_buttonSlideTool->setCheckable(true);
m_buttonSlideTool->setChecked(false);*/
auto *toolGroup = new QActionGroup(this);
toolGroup->addAction(m_buttonSelectTool);
toolGroup->addAction(m_buttonRazorTool);
toolGroup->addAction(m_buttonSpacerTool);
//toolGroup->addAction(m_buttonRippleTool);
//toolGroup->addAction(m_buttonRollTool);
toolGroup->addAction(m_buttonSlipTool);
//toolGroup->addAction(m_buttonSlideTool);
toolGroup->setExclusive(true);
QAction *collapseItem = new QAction(QIcon::fromTheme(QStringLiteral("collapse-all")), i18n("Collapse/Expand Item"), this);
......@@ -1349,6 +1380,10 @@ void MainWindow::setupActions()
addAction(QStringLiteral("select_tool"), m_buttonSelectTool, Qt::Key_S);
addAction(QStringLiteral("razor_tool"), m_buttonRazorTool, Qt::Key_X);
addAction(QStringLiteral("spacer_tool"), m_buttonSpacerTool, Qt::Key_M);
//addAction(QStringLiteral("ripple_tool"), m_buttonRippleTool);
//addAction(QStringLiteral("roll_tool"), m_buttonRollTool);
addAction(QStringLiteral("slip_tool"), m_buttonSlipTool);
//addAction(QStringLiteral("slide_tool"), m_buttonSlideTool);
addAction(QStringLiteral("automatic_transition"), m_buttonTimelineTags);
addAction(QStringLiteral("show_video_thumbs"), m_buttonVideoThumbs);
......@@ -2312,8 +2347,6 @@ void MainWindow::connectDocument()
connect(trackView->projectView(), &CustomTrackView::guidesUpdated, this, &MainWindow::slotGuidesUpdated);
connect(trackView->projectView(), &CustomTrackView::loadMonitorScene, m_projectMonitor, &Monitor::slotShowEffectScene);
connect(trackView->projectView(), &CustomTrackView::setQmlProperty, m_projectMonitor, &Monitor::setQmlProperty);
connect(m_projectMonitor, SIGNAL(acceptRipple(bool)), trackView->projectView(), SLOT(slotAcceptRipple(bool)));
connect(m_projectMonitor, SIGNAL(switchTrimMode(int)), trackView->projectView(), SLOT(switchTrimMode(int)));
connect(project, &KdenliveDoc::saveTimelinePreview, trackView, &Timeline::slotSaveTimelinePreview);
connect(trackView, SIGNAL(showTrackEffects(int, TrackInfo)), this, SLOT(slotTrackSelected(int, TrackInfo)));
......@@ -2420,9 +2453,6 @@ void MainWindow::connectDocument()
// Update guides info in render widget
// slotGuidesUpdated();
// set tool to select tool
setTrimMode(QString());
m_buttonSelectTool->setChecked(true);
connect(m_projectMonitorDock, &QDockWidget::visibilityChanged, m_projectMonitor, &Monitor::slotRefreshMonitor, Qt::UniqueConnection);
connect(m_clipMonitorDock, &QDockWidget::visibilityChanged, m_clipMonitor, &Monitor::slotRefreshMonitor, Qt::UniqueConnection);
......@@ -3152,11 +3182,19 @@ void MainWindow::slotClipEnd()
void MainWindow::slotChangeTool(QAction *action)
{
if (action == m_buttonSelectTool) {
slotSetTool(SelectTool);
slotSetTool(ToolType::SelectTool);
} else if (action == m_buttonRazorTool) {
slotSetTool(RazorTool);
slotSetTool(ToolType::RazorTool);
} else if (action == m_buttonSpacerTool) {
slotSetTool(SpacerTool);
slotSetTool(ToolType::SpacerTool);
} if (action == m_buttonRippleTool) {
slotSetTool(ToolType::RippleTool);
} if (action == m_buttonRollTool) {
slotSetTool(ToolType::RollTool);
} if (action == m_buttonSlipTool) {
slotSetTool(ToolType::SlipTool);
} if (action == m_buttonSlideTool) {
slotSetTool(ToolType::SlideTool);
}
}
......@@ -3180,7 +3218,7 @@ void MainWindow::slotChangeEdit(QAction *action)
// Disable spacer tool in insert mode
if (m_buttonSpacerTool->isChecked()) {
m_buttonSelectTool->setChecked(true);
slotSetTool(SelectTool);
slotSetTool(ToolType::SelectTool);
}
m_buttonSpacerTool->setEnabled(false);
} else {
......@@ -3188,11 +3226,12 @@ void MainWindow::slotChangeEdit(QAction *action)
}
}
void MainWindow::slotSetTool(ProjectTool tool)
void MainWindow::slotSetTool(ToolType::ProjectTool tool)
{
if (pCore->currentDoc()) {
showToolMessage();
getMainTimeline()->setTool(tool);
getMainTimeline()->controller()->updateTrimmingMode();
}
}
......@@ -3200,11 +3239,13 @@ void MainWindow::showToolMessage()
{
QString message;
if (m_buttonSelectTool->isChecked()) {
message = i18n("<b>Shift drag</b> for rubber-band selection, <b>Shift click</b> for multiple selection, <b>Ctrl drag</b> to pan");
message = xi18nc("@info:whatsthis", "<shortcut>Shift drag</shortcut> for rubber-band selection, <shortcut>Shift click</shortcut> for multiple selection, <shortcut>Ctrl drag</shortcut> to pan");
} else if (m_buttonRazorTool->isChecked()) {
message = i18n("<b>Shift</b> to preview cut frame");
message = xi18nc("@info:whatsthis", "<shortcut>Shift</shortcut> to preview cut frame");
} else if (m_buttonSpacerTool->isChecked()) {
message = i18n("<b>Ctrl</b> to apply on current track only, <b>Shift</b> to also move guides. You can combine both modifiers.");
message = xi18nc("@info:whatsthis", "<shortcut>Ctrl</shortcut> to apply on current track only, <shortcut>Shift</shortcut> to also move guides. You can combine both modifiers.");
} else if (m_buttonSlipTool->isChecked()) {
message = xi18nc("@info:whatsthis", "<shortcut>Click</shortcut> on an item to slip, <shortcut>Shift</shortcut> to slip only current item of the group"); //TODO
}
m_messageLabel->setKeyMap(message);
}
......@@ -4228,27 +4269,6 @@ void MainWindow::forceIconSet(bool force)
}
}
void MainWindow::slotSwitchTrimMode()
{
// TODO refac
/*
if (pCore->projectManager()->currentTimeline()) {
pCore->projectManager()->currentTimeline()->projectView()->switchTrimMode();
}
*/
}
void MainWindow::setTrimMode(const QString &mode){
Q_UNUSED(mode)
// TODO refac
/*
if (pCore->projectManager()->currentTimeline()) {
m_trimLabel->setText(mode);
m_trimLabel->setVisible(!mode.isEmpty());
}
*/
}
TimelineWidget *MainWindow::getMainTimeline() const
{
return m_timelineTabs->getMainTimeline();
......
......@@ -250,6 +250,10 @@ private:
QAction *m_buttonSelectTool;
QAction *m_buttonRazorTool;
QAction *m_buttonSpacerTool;
QAction *m_buttonRippleTool;
QAction *m_buttonRollTool;
QAction *m_buttonSlipTool;
QAction *m_buttonSlideTool;
QAction *m_buttonSnap;
QAction *m_saveAction;
QSlider *m_zoomSlider;
......@@ -395,7 +399,7 @@ private slots:
void slotAddProjectClipList(const QList<QUrl> &urls);
void slotChangeTool(QAction *action);
void slotChangeEdit(QAction *action);
void slotSetTool(ProjectTool tool);
void slotSetTool(ToolType::ProjectTool tool);
void slotSnapForward();
void slotSnapRewind();
void slotGuideForward();
......@@ -512,9 +516,6 @@ private slots:
void slotUpdateCompositing(QAction *compose);
/** @brief Update compositing action to display current project setting. */
void slotUpdateCompositeAction(int mode);
/** @brief Cycle through the different timeline trim modes. */
void slotSwitchTrimMode();
void setTrimMode(const QString &mode);
/** @brief Set timeline toolbar icon size. */
void setTimelineToolbarIconSize(QAction *a);
void slotEditItemSpeed();
......
......@@ -953,7 +953,9 @@ int GLWidget::setProducer(const std::shared_ptr<Mlt::Producer> &producer, bool i
m_proxy->resetPosition();
}
m_consumer->set("scrub_audio", 0);
m_proxy->setPosition(position > 0 ? position : m_producer->position());
if(position != -2) {
m_proxy->setPosition(position > 0 ? position : m_producer->position());
}
return error;
}
......
......@@ -53,7 +53,8 @@ class MonitorProxy;
using thread_function_t = void *(*)(void *);
/* QQuickView that renders an .
/** @class GLWidget
* @brief QQuickView that renders an .
*
* Creates an MLT consumer and renders a GL view from the consumer. This pipeline is one of:
*
......@@ -146,7 +147,13 @@ public:
protected:
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
/** @brief Update producer, should ONLY be called from monitor */
/** @brief Update producer, should ONLY be called from monitor
* @param producer
* @param isActive
* @param position If == 0 producer position will be used.
* If == -1 consumer position will be used if possible.
* If == -2 position will not be set.
*/
int setProducer(const std::shared_ptr<Mlt::Producer> &producer, bool isActive, int position);
int setProducer(const QString &file);
QString frameToTime(int frames) const;
......
......@@ -39,6 +39,8 @@
#include "jobs/cuttask.h"
#include "scopes/monitoraudiolevel.h"
#include "timeline2/model/snapmodel.hpp"
#include "timeline2/view/timelinewidget.h"
#include "timeline2/view/timelinecontroller.h"
#include "transitions/transitionsrepository.hpp"
#include "utils/thumbnailcache.hpp"
......@@ -448,11 +450,45 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
m_audioMeterWidget->setVisibility((KdenliveSettings::monitoraudio() & m_id) != 0);
}
// Trimming tool bar buttons
m_trimmingbar = new QToolBar(this);
m_trimmingbar->setIconSize(iconSize);
m_trimmingOffset = new QLabel();
m_trimmingbar->addWidget(m_trimmingOffset);
QAction *fiveLess = new QAction(i18n("-5"), this);
m_trimmingbar->addAction(fiveLess);
connect(fiveLess, &QAction::triggered, this, [&](){
slotTrimmingPos(-5);
pCore->window()->getCurrentTimeline()->model()->requestSlipSelection(-5, true);
});
QAction *oneLess = new QAction(i18n("-1"), this);
m_trimmingbar->addAction(oneLess);
connect(oneLess, &QAction::triggered, this, [&](){
slotTrimmingPos(-1);
pCore->window()->getCurrentTimeline()->model()->requestSlipSelection(-1, true);
});
QAction *oneMore = new QAction(i18n("+1"), this);
m_trimmingbar->addAction(oneMore);
connect(oneMore, &QAction::triggered, this, [&](){
slotTrimmingPos(1);
pCore->window()->getCurrentTimeline()->model()->requestSlipSelection(1, true);
});
QAction *fiveMore = new QAction(i18n("+5"), this);
m_trimmingbar->addAction(fiveMore);
connect(fiveMore, &QAction::triggered, this, [&](){
slotTrimmingPos(5);
pCore->window()->getCurrentTimeline()->model()->requestSlipSelection(5, true);
});
connect(m_timePos, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotSeek()));
layout->addWidget(m_toolbar);
if (m_recManager) {
layout->addWidget(m_recManager->toolbar());
}
layout->addWidget(m_trimmingbar);
m_trimmingbar->setVisible(false);
// Load monitor overlay qml
loadQmlScene(MonitorSceneDefault);
......@@ -1268,7 +1304,7 @@ void Monitor::slotZoneEnd()
void Monitor::slotRewind(double speed)
{
if (!slotActivateMonitor()) {
if (!slotActivateMonitor() || m_trimmingbar->isVisible()) {
return;
}
if (qFuzzyIsNull(speed)) {
......@@ -1291,7 +1327,7 @@ void Monitor::slotRewind(double speed)
void Monitor::slotForward(double speed, bool allowNormalPlay)
{
if (!slotActivateMonitor()) {
if (!slotActivateMonitor() || m_trimmingbar->isVisible()) {
return;
}
if (qFuzzyIsNull(speed)) {
......@@ -1442,6 +1478,9 @@ void Monitor::pause()
void Monitor::switchPlay(bool play)
{
if(m_trimmingbar->isVisible()) {
return;
}
m_speedIndex = 0;
m_playAction->setActive(play);
if (!KdenliveSettings::autoscroll()) {
......@@ -1460,7 +1499,7 @@ void Monitor::updatePlayAction(bool play)
void Monitor::slotSwitchPlay()
{
if (!slotActivateMonitor()) {
if (!slotActivateMonitor() || m_trimmingbar->isVisible()) {
return;
}
if (!KdenliveSettings::autoscroll()) {
......@@ -2197,14 +2236,11 @@ void Monitor::loadQmlScene(MonitorSceneType type, QVariant sceneData)
case MonitorSceneSplit:
QObject::connect(root, SIGNAL(qmlMoveSplit()), this, SLOT(slotAdjustEffectCompare()), Qt::UniqueConnection);
break;
case MonitorSceneTrimming:
case MonitorSceneGeometry:
case MonitorSceneCorners:
case MonitorSceneRoto:
break;
case MonitorSceneRipple:
QObject::connect(root, SIGNAL(doAcceptRipple(bool)), this, SIGNAL(acceptRipple(bool)), Qt::UniqueConnection);
QObject::connect(root, SIGNAL(switchTrimMode(int)), this, SIGNAL(switchTrimMode(int)), Qt::UniqueConnection);
break;
case MonitorSceneDefault:
QObject::connect(root, SIGNAL(editCurrentMarker()), this, SLOT(slotEditInlineMarker()), Qt::UniqueConnection);
m_qmlManager->setProperty(QStringLiteral("timecode"), m_timePos->displayText());
......@@ -2259,6 +2295,24 @@ void Monitor::slotSwitchRec(bool enable)
}
}
void Monitor::slotSwitchTrimming(bool enable)
{
if (!m_trimmingbar) {
return;
}
if (enable) {
loadQmlScene(MonitorSceneTrimming);
m_toolbar->setVisible(false);
m_trimmingbar->setVisible(true);
m_glMonitor->switchRuler(false);
} else if (m_trimmingbar->isVisible()) {
loadQmlScene(MonitorSceneDefault);
m_trimmingbar->setVisible(false);
m_toolbar->setVisible(true);
m_glMonitor->switchRuler(KdenliveSettings::displayClipMonitorInfo() & 0x01);
}
}
void Monitor::doKeyPressEvent(QKeyEvent *ev)
{
keyPressEvent(ev);
......@@ -2413,6 +2467,29 @@ void Monitor::slotStart()
m_glMonitor->getControllerProxy()->setPosition(0);
}
void Monitor::slotTrimmingPos(int pos, int offset, int frames1, int frames2)
{
if(m_glMonitor->producer() != pCore->window()->getCurrentTimeline()->model()->producer().get()) {
processSeek(pos);
}
QString tc(pCore->timecode().getDisplayTimecodeFromFrames(offset, KdenliveSettings::frametimecode()));
m_trimmingOffset->setText(tc);
m_glMonitor->getControllerProxy()->setTrimmingTC1(frames1);
m_glMonitor->getControllerProxy()->setTrimmingTC2(frames2);
}
void Monitor::slotTrimmingPos(int offset) {
offset = pCore->window()->getCurrentTimeline()->controller()->trimmingBoundOffset(offset);
if (m_glMonitor->producer() != pCore->window()->getCurrentTimeline()->model()->producer().get()) {
processSeek(m_glMonitor->producer()->position() + offset);
}
QString tc(pCore->timecode().getDisplayTimecodeFromFrames(offset, KdenliveSettings::frametimecode()));
m_trimmingOffset->setText(tc);
m_glMonitor->getControllerProxy()->setTrimmingTC1(offset, true);
m_glMonitor->getControllerProxy()->setTrimmingTC2(offset, true);
}
void Monitor::slotEnd()
{
if (!slotActivateMonitor()) {
......
......@@ -218,6 +218,8 @@ private:
bool m_loopClipTransition;
GenTime getSnapForPos(bool previous);
QToolBar *m_toolbar;
QToolBar *m_trimmingbar;
QLabel *m_trimmingOffset;
QSlider *m_audioSlider;
QAction *m_editMarker;
KMessageWidget *m_infoMessage;
......@@ -299,6 +301,18 @@ public slots:
void slotRewindOneFrame(int diff = 1);
void slotForwardOneFrame(int diff = 1);
void slotStart();
/** @brief Set position and information for the trimming preview
* @param pos Absolute position in frames
* @param offset Difference in frames beetween @p pos and the current position (to be displayed in the monitor toolbar)
* @param frames1 Position in frames to be displayed in the monitor overlay for preview tile one
* @param frames2 Position in frames to be displayed in the monitor overlay for preview tile two
*/
void slotTrimmingPos(int pos, int offset, int frames1, int frames2);
/** @brief Move the position for the trimming preview by the given offset
* @param offset How many frames the position should be moved
* @see slotTrimmingPos
*/
void slotTrimmingPos(int offset);
void slotEnd();
void slotSetZoneStart();
void slotSetZoneEnd();
......@@ -318,6 +332,8 @@ public slots:
void slotSwitchFullScreen(bool minimizeOnly = false) override;
/** @brief Display or hide the record toolbar */
void slotSwitchRec(bool enable);
/** @brief Display or hide the trimming toolbar and monitor scene*/
void slotSwitchTrimming(bool enable);
/** @brief Request QImage of current frame */
void slotGetCurrentImage(bool request);
/** @brief Enable/disable display of monitor's audio levels widget */
......@@ -365,8 +381,6 @@ signals:
void seekToNextSnap();
void createSplitOverlay(std::shared_ptr<Mlt::Filter>);
void removeSplitOverlay();
void acceptRipple(bool);
void switchTrimMode(int);
void activateTrack(int);
void autoKeyframeChanged();
};
......
......@@ -22,6 +22,7 @@
#include "doc/kdenlivedoc.h"
#include "kdenlivesettings.h"
#include "mainwindow.h"
#include "timeline2/view/timelinewidget.h"
#include <mlt++/Mlt.h>
......@@ -286,37 +287,57 @@ void MonitorManager::slotForward(double speed)
void MonitorManager::slotRewindOneFrame()
{
if (m_activeMonitor == m_clipMonitor) {
m_clipMonitor->slotRewindOneFrame();
} else if (m_activeMonitor == m_projectMonitor) {
m_projectMonitor->slotRewindOneFrame();
if (pCore->window()->getCurrentTimeline()->activeTool() == ToolType::SlipTool) {
m_projectMonitor->slotTrimmingPos(-1);
pCore->window()->getCurrentTimeline()->model()->requestSlipSelection(-1, true);
} else {
if (m_activeMonitor == m_clipMonitor) {
m_clipMonitor->slotRewindOneFrame();
} else if (m_activeMonitor == m_projectMonitor) {
m_projectMonitor->slotRewindOneFrame();
}
}
}
void MonitorManager::slotForwardOneFrame()
{
if (m_activeMonitor == m_clipMonitor) {
m_clipMonitor->slotForwardOneFrame();
} else if (m_activeMonitor == m_projectMonitor) {
m_projectMonitor->slotForwardOneFrame();
if (pCore->window()->getCurrentTimeline()->activeTool() == ToolType::SlipTool) {
m_projectMonitor->slotTrimmingPos(1);
pCore->window()->getCurrentTimeline()->model()->requestSlipSelection(1, true);
} else {
if (m_activeMonitor == m_clipMonitor) {
m_clipMonitor->slotForwardOneFrame();
} else if (m_activeMonitor == m_projectMonitor) {
m_projectMonitor->slotForwardOneFrame();
}
}
}
void MonitorManager::slotRewindOneSecond()
{
if (m_activeMonitor == m_clipMonitor) {
m_clipMonitor->slotRewindOneFrame(qRound(pCore->getCurrentFps()));
} else if (m_activeMonitor == m_projectMonitor) {
m_projectMonitor->slotRewindOneFrame(qRound(pCore->getCurrentFps()));
if (pCore->window()->getCurrentTimeline()->activeTool() == ToolType::SlipTool) {
m_projectMonitor->slotTrimmingPos(-qRound(pCore->getCurrentFps()));
pCore->window()->getCurrentTimeline()->model()->requestSlipSelection(-qRound(pCore->getCurrentFps()), true);
} else {
if (m_activeMonitor == m_clipMonitor) {
m_clipMonitor->slotRewindOneFrame(qRound(pCore->getCurrentFps()));
} else if (m_activeMonitor == m_projectMonitor) {
m_projectMonitor->slotRewindOneFrame(qRound(pCore->getCurrentFps()));
}
}
}
void MonitorManager::slotForwardOneSecond()
{
if (m_activeMonitor == m_clipMonitor) {
m_clipMonitor->slotForwardOneFrame(qRound(pCore->getCurrentFps()));
} else if (m_activeMonitor == m_projectMonitor) {
m_projectMonitor->slotForwardOneFrame(qRound(pCore->getCurrentFps()));
if (pCore->window()->getCurrentTimeline()->activeTool() == ToolType::SlipTool) {
m_projectMonitor->slotTrimmingPos(qRound(pCore->getCurrentFps()));
pCore->window()->getCurrentTimeline()->model()->requestSlipSelection(qRound(pCore->getCurrentFps()), true);
} else {
if (m_activeMonitor == m_clipMonitor) {
m_clipMonitor->slotForwardOneFrame(qRound(pCore->getCurrentFps()));
} else if (m_activeMonitor == m_projectMonitor) {
m_projectMonitor->slotForwardOneFrame(qRound(pCore->getCurrentFps()));
}
}
}
......@@ -697,6 +718,14 @@ bool MonitorManager::isMultiTrack() const
return false;
}
bool MonitorManager::isTrimming() const
{
if (m_projectMonitor && m_projectMonitor->m_trimmingbar) {
return m_projectMonitor->m_trimmingbar->isVisible();
}
return false;
}
void MonitorManager::updateBgColor()
{
if (m_projectMonitor) {
......
......@@ -68,6 +68,8 @@ public:
QDir getCacheFolder(CacheType type);
/** @brief Returns true if multitrack view is enabled in project monitor. */
bool isMultiTrack() const;
/** @brief Returns true if the project monitor shows a trimming preview. */