Commit c25fa35a authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Always keep timeline cursor visible when seeking with keyboard, not only when...

Always keep timeline cursor visible when seeking with keyboard, not only when "follow playhead when playing is enabled".
Related to #903
parent ed9daa20
......@@ -1321,7 +1321,7 @@ void Monitor::slotRewind(double speed)
m_speedLabel->setText(QString("x%1").arg(speed));
}
}
m_playAction->setActive(true);
updatePlayAction(true);
m_glMonitor->switchPlay(true, speed);
}
......@@ -1336,7 +1336,7 @@ void Monitor::slotForward(double speed, bool allowNormalPlay)
if (allowNormalPlay) {
m_glMonitor->purgeCache();
resetSpeedInfo();
m_playAction->setActive(true);
updatePlayAction(true);
m_glMonitor->switchPlay(true, 1);
return;
} else {
......@@ -1352,7 +1352,7 @@ void Monitor::slotForward(double speed, bool allowNormalPlay)
m_speedLabel->setFixedWidth(QWIDGETSIZE_MAX);
m_speedLabel->setText(QString("x%1").arg(speed));
}
m_playAction->setActive(true);
updatePlayAction(true);
m_glMonitor->switchPlay(true, speed);
}
......@@ -1393,7 +1393,7 @@ void Monitor::adjustRulerSize(int length, const std::shared_ptr<MarkerListModel>
void Monitor::stop()
{
m_playAction->setActive(false);
updatePlayAction(false);
m_glMonitor->stop();
}
......@@ -1452,23 +1452,35 @@ void Monitor::pause()
if (!m_playAction->isActive() || !slotActivateMonitor()) {
return;
}
m_glMonitor->switchPlay(false);
m_playAction->setActive(false);
resetSpeedInfo();
switchPlay(false);
}
void Monitor::switchPlay(bool play)
{
m_playAction->setActive(play);
if (!KdenliveSettings::autoscroll()) {
emit pCore->autoScrollChanged();
}
m_glMonitor->switchPlay(play);
resetSpeedInfo();
}
void Monitor::updatePlayAction(bool play)
{
m_playAction->setActive(play);
if (!KdenliveSettings::autoscroll()) {
emit pCore->autoScrollChanged();
}
}
void Monitor::slotSwitchPlay()
{
if (!slotActivateMonitor()) {
return;
}
if (!KdenliveSettings::autoscroll()) {
emit pCore->autoScrollChanged();
}
m_glMonitor->switchPlay(m_playAction->isActive());
bool showDropped = false;
if (m_id == Kdenlive::ClipMonitor) {
......@@ -1490,6 +1502,11 @@ void Monitor::slotPlay()
m_playAction->trigger();
}
bool Monitor::isPlaying() const
{
return m_playAction->isActive();
}
void Monitor::resetPlayOrLoopZone(const QString &binId)
{
if (activeClipId() == binId) {
......@@ -1504,7 +1521,7 @@ void Monitor::slotPlayZone()
}
bool ok = m_glMonitor->playZone();
if (ok) {
m_playAction->setActive(true);
updatePlayAction(true);
}
}
......@@ -1515,7 +1532,7 @@ void Monitor::slotLoopZone()
}
bool ok = m_glMonitor->playZone(true);
if (ok) {
m_playAction->setActive(true);
updatePlayAction(true);
}
}
......@@ -1526,7 +1543,7 @@ void Monitor::slotLoopClip(QPoint inOut)
}
bool ok = m_glMonitor->loopClip(inOut);
if (ok) {
m_playAction->setActive(true);
updatePlayAction(true);
}
}
......@@ -1623,7 +1640,7 @@ void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int i
m_snaps->addPoint((int)m_controller->frameDuration() - 1);
// Loading new clip / zone, stop if playing
if (m_playAction->isActive()) {
m_playAction->setActive(false);
updatePlayAction(false);
}
m_audioMeterWidget->audioChannels = controller->audioInfo() ? controller->audioInfo()->channels() : 0;
m_controller->getMarkerModel()->registerSnapModel(m_snaps);
......@@ -1937,7 +1954,7 @@ void Monitor::updateAudioForAnalysis()
void Monitor::onFrameDisplayed(const SharedFrame &frame)
{
if (!m_glMonitor->checkFrameNumber(frame.get_position(), m_offset, m_playAction->isActive())) {
m_playAction->setActive(false);
updatePlayAction(false);
}
emit m_monitorManager->frameDisplayed(frame);
}
......
......@@ -163,6 +163,8 @@ public:
void refreshAudioThumbs();
/** @brief Trigger a refresh of audio thumbs on notrmalization change */
void normalizeAudioThumbs();
/** @brief Returns true if monitor is playing */
bool isPlaying() const;
protected:
......@@ -294,6 +296,7 @@ public slots:
void stop() override;
void start() override;
void switchPlay(bool play);
void updatePlayAction(bool play);
void slotPlay() override;
void pause();
void slotPlayZone();
......
......@@ -72,11 +72,11 @@ Item {
}
}
onReleased: {
root.autoScrolling = timeline.autoScroll
if (subtitleBase.textEditBegin) {
mouse.accepted = false
return
}
root.autoScrolling = timeline.autoScroll
if (startMove) {
startMove = false
if (subtitleBase.x < 0)
......
......@@ -2714,7 +2714,7 @@ bool TimelineController::hasVideoTarget() const
bool TimelineController::autoScroll() const
{
return KdenliveSettings::autoscroll();
return !pCore->monitorManager()->projectMonitor()->isPlaying() || KdenliveSettings::autoscroll();
}
void TimelineController::resetTrackHeight()
......
......@@ -164,7 +164,7 @@ public:
Q_INVOKABLE int hasAudioTarget() const;
Q_INVOKABLE int clipTargets() const;
Q_INVOKABLE bool hasVideoTarget() const;
Q_INVOKABLE bool autoScroll() const;
bool autoScroll() const;
Q_INVOKABLE int activeTrack() const { return m_activeTrack; }
Q_INVOKABLE QColor videoColor() const;
Q_INVOKABLE QColor audioColor() const;
......
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