Fix forward/rewind affecting wrong monitor

BUG: 416917
parent f74d3dc2
Pipeline #14270 passed with stage
in 14 minutes and 10 seconds
......@@ -87,6 +87,8 @@ public slots:
virtual void stop() = 0;
virtual void start() = 0;
virtual void slotPlay() = 0;
virtual void slotRewind(double speed = 0) = 0;
virtual void slotForward(double speed = 0) = 0;
virtual void refreshMonitorIfActive(bool directUpdate = false) = 0;
virtual void slotMouseSeek(int eventDelta, uint modifiers) = 0;
bool slotActivateMonitor();
......
......@@ -262,13 +262,14 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
manager->getAction(QStringLiteral("mark_out"))->trigger();
});
}
m_toolbar->addAction(manager->getAction(QStringLiteral("monitor_seek_backward")));
// Per monitor rewind action
QAction *rewind = new QAction(QIcon::fromTheme(QStringLiteral("media-seek-backward")), i18n("Rewind"), this);
m_toolbar->addAction(rewind);
connect(rewind, &QAction::triggered, this, &Monitor::slotRewind);
auto *playButton = new QToolButton(m_toolbar);
m_playMenu = new QMenu(i18n("Play..."), this);
connect(m_playMenu, &QMenu::aboutToShow, [this]() {
slotActivateMonitor();
});
connect(m_playMenu, &QMenu::aboutToShow, this, &Monitor::slotActivateMonitor);
QAction *originalPlayAction = static_cast<KDualAction *>(manager->getAction(QStringLiteral("monitor_play")));
m_playAction = new KDualAction(i18n("Play"), i18n("Pause"), this);
m_playAction->setInactiveIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));
......@@ -287,7 +288,11 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
playButton->setMenu(m_playMenu);
playButton->setPopupMode(QToolButton::MenuButtonPopup);
m_toolbar->addWidget(playButton);
m_toolbar->addAction(manager->getAction(QStringLiteral("monitor_seek_forward")));
// Per monitor forward action
QAction *forward = new QAction(QIcon::fromTheme(QStringLiteral("media-seek-forward")), i18n("Forward"), this);
m_toolbar->addAction(forward);
connect(forward, &QAction::triggered, this, &Monitor::slotForward);
playButton->setDefaultAction(m_playAction);
m_configMenu = new QMenu(i18n("Misc..."), this);
......@@ -1181,8 +1186,8 @@ void Monitor::slotRewind(double speed)
speed = currentspeed * 1.5;
}
}
m_glMonitor->switchPlay(true, speed);
m_playAction->setActive(true);
m_glMonitor->switchPlay(true, speed);
}
void Monitor::slotForward(double speed)
......@@ -1197,8 +1202,8 @@ void Monitor::slotForward(double speed)
speed = currentspeed * 1.2;
}
}
m_glMonitor->switchPlay(true, speed);
m_playAction->setActive(true);
m_glMonitor->switchPlay(true, speed);
}
void Monitor::slotRewindOneFrame(int diff)
......
......@@ -290,8 +290,8 @@ public slots:
void slotLoopZone();
/** @brief Loops the selected item (clip or transition). */
void slotLoopClip();
void slotForward(double speed = 0);
void slotRewind(double speed = 0);
void slotForward(double speed = 0) override;
void slotRewind(double speed = 0) override;
void slotRewindOneFrame(int diff = 1);
void slotForwardOneFrame(int diff = 1);
void slotStart();
......
......@@ -235,19 +235,15 @@ void MonitorManager::slotLoopZone()
void MonitorManager::slotRewind(double speed)
{
if (m_activeMonitor == m_clipMonitor) {
m_clipMonitor->slotRewind(speed);
} else if (m_activeMonitor == m_projectMonitor) {
m_projectMonitor->slotRewind(speed);
if (m_activeMonitor) {
m_activeMonitor->slotRewind(speed);
}
}
void MonitorManager::slotForward(double speed)
{
if (m_activeMonitor == m_clipMonitor) {
m_clipMonitor->slotForward(speed);
} else if (m_activeMonitor == m_projectMonitor) {
m_projectMonitor->slotForward(speed);
if (m_activeMonitor) {
m_activeMonitor->slotForward(speed);
}
}
......@@ -387,7 +383,7 @@ void MonitorManager::setupActions()
pCore->window()->addAction(QStringLiteral("monitor_zoomout"), monitorZoomOut);
QAction *monitorSeekBackward = new QAction(QIcon::fromTheme(QStringLiteral("media-seek-backward")), i18n("Rewind"), this);
connect(monitorSeekBackward, SIGNAL(triggered(bool)), SLOT(slotRewind()));
connect(monitorSeekBackward, &QAction::triggered, this, &MonitorManager::slotRewind);
pCore->window()->addAction(QStringLiteral("monitor_seek_backward"), monitorSeekBackward, Qt::Key_J);
QAction *monitorSeekBackwardOneFrame = new QAction(QIcon::fromTheme(QStringLiteral("media-skip-backward")), i18n("Rewind 1 Frame"), this);
......@@ -399,7 +395,7 @@ void MonitorManager::setupActions()
pCore->window()->addAction(QStringLiteral("monitor_seek_backward-one-second"), monitorSeekBackwardOneSecond, Qt::SHIFT + Qt::Key_Left);
QAction *monitorSeekForward = new QAction(QIcon::fromTheme(QStringLiteral("media-seek-forward")), i18n("Forward"), this);
connect(monitorSeekForward, SIGNAL(triggered(bool)), SLOT(slotForward()));
connect(monitorSeekForward, &QAction::triggered, this, &MonitorManager::slotForward);
pCore->window()->addAction(QStringLiteral("monitor_seek_forward"), monitorSeekForward, Qt::Key_L);
QAction *projectStart = new QAction(QIcon::fromTheme(QStringLiteral("go-first")), i18n("Go to Project Start"), this);
......
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