Cleanup seeking logic, get rid of confusing blue bar indicating real MLT position, pause on seek

parent 2b2a2b06
......@@ -713,8 +713,8 @@ Mlt::Profile *Core::thumbProfile()
int Core::getTimelinePosition() const
{
if (m_mainWindow && m_guiConstructed) {
return m_mainWindow->getCurrentTimeline()->controller()->timelinePosition();
if (m_guiConstructed) {
return m_monitorManager->projectMonitor()->position();
}
return 0;
}
......
......@@ -346,7 +346,7 @@ void MainWindow::init()
case ObjectType::TimelineClip:
case ObjectType::TimelineComposition:
case ObjectType::Master:
getCurrentTimeline()->controller()->setPosition(pos);
m_projectMonitor->requestSeek(pos);
break;
case ObjectType::BinClip:
m_clipMonitor->requestSeek(pos);
......
......@@ -130,7 +130,6 @@ GLWidget::GLWidget(int id, QObject *parent)
registerTimelineItems();
m_proxy = new MonitorProxy(this);
connect(m_proxy, &MonitorProxy::seekRequestChanged, this, &GLWidget::requestSeek);
rootContext()->setContextProperty("controller", m_proxy);
}
......@@ -645,42 +644,20 @@ void GLWidget::wheelEvent(QWheelEvent *event)
event->accept();
}
void GLWidget::requestSeek()
void GLWidget::requestSeek(int position)
{
if (!m_producer) {
return;
}
if (m_proxy->seeking()) {
m_producer->seek(m_proxy->seekPosition());
if (!qFuzzyIsNull(m_producer->get_speed())) {
m_consumer->purge();
}
if (m_consumer->is_stopped()) {
m_consumer->start();
}
m_consumer->set("refresh", 1);
m_producer->seek(position);
if (!qFuzzyIsNull(m_producer->get_speed())) {
m_consumer->purge();
}
}
void GLWidget::seek(int pos)
{
if (!m_proxy->seeking()) {
m_producer->seek(pos);
if (m_consumer->is_stopped()) {
m_consumer->start();
} else {
m_consumer->purge();
m_consumer->set("refresh", 1);
}
if (m_consumer->is_stopped()) {
m_consumer->start();
}
m_proxy->setSeekPosition(pos);
m_consumer->set("refresh", 1);
}
void GLWidget::requestRefresh()
{
if (m_proxy->seeking()) {
return;
}
if (m_producer && qFuzzyIsNull(m_producer->get_speed())) {
m_refreshTimer.start();
}
......@@ -694,9 +671,6 @@ QString GLWidget::frameToTime(int frames) const
void GLWidget::refresh()
{
m_refreshTimer.stop();
if (m_proxy->seeking()) {
return;
}
QMutexLocker locker(&m_mltMutex);
if (m_consumer->is_stopped()) {
m_consumer->start();
......@@ -707,19 +681,10 @@ void GLWidget::refresh()
bool GLWidget::checkFrameNumber(int pos, int offset)
{
emit consumerPosition(pos);
if (!m_proxy->setPosition(pos)) {
emit seekPosition(m_proxy->seekOrCurrentPosition());
}
const double speed = m_producer->get_speed();
if (m_proxy->seeking()) {
m_producer->set_speed(0);
m_producer->seek(m_proxy->seekPosition());
if (qFuzzyIsNull(speed)) {
m_consumer->set("refresh", 1);
} else {
m_producer->set_speed(speed);
}
return true;
bool isPlaying = !qFuzzyIsNull(speed);
if (isPlaying) {
m_proxy->positionFromConsumer(pos);
}
int maxPos = m_producer->get_int("out");
if (m_isLoopMode || m_isZoneMode) {
......@@ -951,7 +916,7 @@ int GLWidget::setProducer(const std::shared_ptr<Mlt::Producer> &producer, bool i
if (isActive) {
startConsumer();
}
m_proxy->requestSeekPosition(position > 0 ? position : m_producer->position());
m_proxy->setPosition(position > 0 ? position : m_producer->position());
return error;
}
......@@ -1301,7 +1266,7 @@ void GLWidget::purgeCache()
{
if (m_consumer) {
m_consumer->purge();
m_producer->seek(m_proxy->position() + 1);
m_producer->seek(m_proxy->getPosition() + 1);
}
}
......@@ -1639,7 +1604,6 @@ void GLWidget::refreshSceneLayout()
void GLWidget::switchPlay(bool play, double speed)
{
m_proxy->setSeekPosition(-1);
if (!m_producer || !m_consumer) {
return;
}
......@@ -1668,7 +1632,6 @@ bool GLWidget::playZone(bool loop)
pCore->displayMessage(i18n("Select a zone to play"), InformationMessage, 500);
return false;
}
m_proxy->setSeekPosition(-1);
m_producer->seek(m_proxy->zoneIn());
m_producer->set_speed(0);
m_consumer->purge();
......@@ -1689,7 +1652,6 @@ bool GLWidget::loopClip()
pCore->displayMessage(i18n("Select a zone to play"), InformationMessage, 500);
return false;
}
m_proxy->setSeekPosition(-1);
m_producer->seek(0);
m_producer->set_speed(0);
m_consumer->purge();
......@@ -1721,7 +1683,7 @@ MonitorProxy *GLWidget::getControllerProxy()
int GLWidget::getCurrentPos() const
{
return m_proxy->seeking() ? m_proxy->seekPosition() : m_consumer->position();
return m_consumer->position();
}
void GLWidget::setRulerInfo(int duration, const std::shared_ptr<MarkerListModel> &model)
......@@ -1756,7 +1718,6 @@ void GLWidget::startConsumer()
void GLWidget::stop()
{
m_refreshTimer.stop();
m_proxy->setSeekPosition(-1);
// why this lock?
QMutexLocker locker(&m_mltMutex);
if (m_producer) {
......
......@@ -151,8 +151,8 @@ protected:
QString frameToTime(int frames) const;
public slots:
void seek(int pos);
void requestSeek();
//void seek(int pos);
void requestSeek(int position);
void setZoom(float zoom);
void setOffsetX(int x, int max);
void setOffsetY(int y, int max);
......@@ -182,7 +182,6 @@ signals:
void lockMonitor(bool);
void passKeyEvent(QKeyEvent *);
void panView(const QPoint &diff);
void seekPosition(int);
void consumerPosition(int);
void activateMonitor();
......
......@@ -157,7 +157,8 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
m_glMonitor = new GLWidget((int)id);
connect(m_glMonitor, &GLWidget::passKeyEvent, this, &Monitor::doKeyPressEvent);
connect(m_glMonitor, &GLWidget::panView, this, &Monitor::panView);
connect(m_glMonitor, &GLWidget::seekPosition, this, &Monitor::seekPosition, Qt::DirectConnection);
connect(m_glMonitor->getControllerProxy(), &MonitorProxy::requestSeek, this, &Monitor::processSeek, Qt::DirectConnection);
connect(m_glMonitor, &GLWidget::consumerPosition, this, &Monitor::seekPosition, Qt::DirectConnection);
connect(m_glMonitor, &GLWidget::consumerPosition, this, &Monitor::slotSeekPosition);
connect(m_glMonitor, &GLWidget::activateMonitor, this, &AbstractMonitor::slotActivateMonitor, Qt::DirectConnection);
m_videoWidget = QWidget::createWindowContainer(qobject_cast<QWindow *>(m_glMonitor));
......@@ -618,20 +619,20 @@ void Monitor::setGuides(const QMap<double, QString> &guides)
void Monitor::slotSeekToPreviousSnap()
{
if (m_controller) {
m_glMonitor->seek(getSnapForPos(true).frames(m_monitorManager->timecode().fps()));
m_glMonitor->getControllerProxy()->setPosition(getSnapForPos(true).frames(m_monitorManager->timecode().fps()));
}
}
void Monitor::slotSeekToNextSnap()
{
if (m_controller) {
m_glMonitor->seek(getSnapForPos(false).frames(m_monitorManager->timecode().fps()));
m_glMonitor->getControllerProxy()->setPosition(getSnapForPos(false).frames(m_monitorManager->timecode().fps()));
}
}
int Monitor::position()
{
return m_glMonitor->getCurrentPos();
return m_glMonitor->getControllerProxy()->getPosition();
}
GenTime Monitor::getSnapForPos(bool previous)
......@@ -949,7 +950,7 @@ void Monitor::slotMouseSeek(int eventDelta, uint modifiers)
if (eventDelta > 0) {
delta = 0 - delta;
}
m_glMonitor->seek(m_glMonitor->getCurrentPos() - delta);
m_glMonitor->getControllerProxy()->setPosition(m_glMonitor->getCurrentPos() - delta);
} else if ((modifiers & Qt::AltModifier) != 0u) {
if (eventDelta >= 0) {
emit seekToPreviousSnap();
......@@ -1084,7 +1085,7 @@ void Monitor::slotSeek()
void Monitor::slotSeek(int pos)
{
slotActivateMonitor();
m_glMonitor->seek(pos);
m_glMonitor->getControllerProxy()->setPosition(pos);
m_monitorManager->cleanMixer();
}
......@@ -1130,13 +1131,13 @@ int Monitor::getZoneEnd()
void Monitor::slotZoneStart()
{
slotActivateMonitor();
m_glMonitor->getControllerProxy()->pauseAndSeek(m_glMonitor->getControllerProxy()->zoneIn());
m_glMonitor->getControllerProxy()->setPosition(m_glMonitor->getControllerProxy()->zoneIn());
}
void Monitor::slotZoneEnd()
{
slotActivateMonitor();
m_glMonitor->getControllerProxy()->pauseAndSeek(m_glMonitor->getControllerProxy()->zoneOut() - 1);
m_glMonitor->getControllerProxy()->setPosition(m_glMonitor->getControllerProxy()->zoneOut() - 1);
}
void Monitor::slotRewind(double speed)
......@@ -1172,13 +1173,13 @@ void Monitor::slotForward(double speed)
void Monitor::slotRewindOneFrame(int diff)
{
slotActivateMonitor();
m_glMonitor->seek(m_glMonitor->getCurrentPos() - diff);
m_glMonitor->getControllerProxy()->setPosition(m_glMonitor->getCurrentPos() - diff);
}
void Monitor::slotForwardOneFrame(int diff)
{
slotActivateMonitor();
m_glMonitor->seek(m_glMonitor->getCurrentPos() + diff);
m_glMonitor->getControllerProxy()->setPosition(m_glMonitor->getCurrentPos() + diff);
}
void Monitor::adjustRulerSize(int length, const std::shared_ptr<MarkerListModel> &markerModel)
......@@ -2038,12 +2039,18 @@ void Monitor::panView(QPoint diff)
}
}
void Monitor::requestSeek(int pos)
void Monitor::processSeek(int pos)
{
m_glMonitor->seek(pos);
pause();
m_glMonitor->requestSeek(pos);
m_monitorManager->cleanMixer();
}
void Monitor::requestSeek(int pos)
{
m_glMonitor->getControllerProxy()->setPosition(pos);
}
void Monitor::setProducer(std::shared_ptr<Mlt::Producer> producer, int pos)
{
m_glMonitor->setProducer(std::move(producer), isActive(), pos);
......@@ -2064,7 +2071,7 @@ void Monitor::slotStart()
{
slotActivateMonitor();
m_glMonitor->switchPlay(false);
m_glMonitor->seek(0);
m_glMonitor->getControllerProxy()->setPosition(0);
}
void Monitor::slotEnd()
......@@ -2072,9 +2079,9 @@ void Monitor::slotEnd()
slotActivateMonitor();
m_glMonitor->switchPlay(false);
if (m_id == Kdenlive::ClipMonitor) {
m_glMonitor->seek(m_glMonitor->duration());
m_glMonitor->getControllerProxy()->setPosition(m_glMonitor->duration());
} else {
m_glMonitor->seek(pCore->projectDuration() - 1);
m_glMonitor->getControllerProxy()->setPosition(pCore->projectDuration() - 1);
}
}
......@@ -2117,3 +2124,8 @@ void Monitor::updateBgColor()
{
m_glMonitor->m_bgColor = KdenliveSettings::window_background();
}
MonitorProxy *Monitor::getControllerProxy()
{
return m_glMonitor->getControllerProxy();
}
......@@ -45,6 +45,7 @@ class RecManager;
class QmlManager;
class GLWidget;
class MonitorAudioLevel;
class MonitorProxy;
namespace Mlt {
class Profile;
......@@ -153,6 +154,8 @@ public:
void setConsumerProperty(const QString &name, const QString &value);
/** @brief Play or Loop zone sets a fake "out" on the producer. It is necessary to reset this before reloading the producer */
void resetPlayOrLoopZone(const QString &binId);
/** @brief Returns a pointer to monitor proxy, allowing to manage seek and consumer position */
MonitorProxy *getControllerProxy();
protected:
void mousePressEvent(QMouseEvent *event) override;
......@@ -263,6 +266,8 @@ private slots:
void slotSeekPosition(int);
void addSnapPoint(int pos);
void removeSnapPoint(int pos);
/** @brief Pause monitor and process seek */
void processSeek(int pos);
public slots:
void slotSetScreen(int screenIndex);
......@@ -324,8 +329,6 @@ signals:
void screenChanged(int screenIndex);
void seekPosition(int pos);
void updateScene();
/** @brief Request a timeline seeking if diff is true, position is a relative offset, otherwise an absolute position */
void seekTimeline(int position);
void durationChanged(int);
void refreshClipThumbnail(const QString &);
void zoneUpdated(const QPoint &);
......
......@@ -32,13 +32,10 @@
#include <mlt++/MltProducer.h>
#include <mlt++/MltProfile.h>
#define SEEK_INACTIVE (-1)
MonitorProxy::MonitorProxy(GLWidget *parent)
: QObject(parent)
, q(parent)
, m_position(0)
, m_seekPosition(-1)
, m_zoneIn(0)
, m_zoneOut(-1)
, m_hasAV(false)
......@@ -46,17 +43,7 @@ MonitorProxy::MonitorProxy(GLWidget *parent)
{
}
int MonitorProxy::seekPosition() const
{
return m_seekPosition;
}
bool MonitorProxy::seeking() const
{
return m_seekPosition != SEEK_INACTIVE;
}
int MonitorProxy::position() const
int MonitorProxy::getPosition() const
{
return m_position;
}
......@@ -85,34 +72,23 @@ QString MonitorProxy::markerComment() const
return m_markerComment;
}
void MonitorProxy::requestSeekPosition(int pos)
{
q->activateMonitor();
m_seekPosition = pos;
emit seekPositionChanged();
emit seekRequestChanged();
}
int MonitorProxy::seekOrCurrentPosition() const
{
return m_seekPosition == SEEK_INACTIVE ? m_position : m_seekPosition;
}
bool MonitorProxy::setPosition(int pos)
{
if (m_seekPosition == pos) {
m_position = pos;
m_seekPosition = SEEK_INACTIVE;
emit seekPositionChanged();
} else if (m_position == pos) {
if (m_position == pos) {
return true;
} else {
m_position = pos;
}
m_position = pos;
emit requestSeek(pos);
emit positionChanged();
return false;
}
void MonitorProxy::positionFromConsumer(int pos)
{
m_position = pos;
emit positionChanged();
}
void MonitorProxy::setMarkerComment(const QString &comment)
{
if (m_markerComment == comment) {
......@@ -122,18 +98,6 @@ void MonitorProxy::setMarkerComment(const QString &comment)
emit markerCommentChanged();
}
void MonitorProxy::setSeekPosition(int pos)
{
m_seekPosition = pos;
emit seekPositionChanged();
}
void MonitorProxy::pauseAndSeek(int pos)
{
q->switchPlay(false);
requestSeekPosition(pos);
}
int MonitorProxy::zoneIn() const
{
return m_zoneIn;
......
......@@ -37,8 +37,7 @@ class MonitorProxy : public QObject
{
Q_OBJECT
// Q_PROPERTY(int consumerPosition READ consumerPosition NOTIFY consumerPositionChanged)
Q_PROPERTY(int position READ position NOTIFY positionChanged)
Q_PROPERTY(int seekPosition READ seekPosition WRITE setSeekPosition NOTIFY seekPositionChanged)
Q_PROPERTY(int position MEMBER m_position WRITE setPosition NOTIFY positionChanged)
Q_PROPERTY(int zoneIn READ zoneIn WRITE setZoneIn NOTIFY zoneChanged)
Q_PROPERTY(int zoneOut READ zoneOut WRITE setZoneOut NOTIFY zoneChanged)
Q_PROPERTY(int rulerHeight READ rulerHeight NOTIFY rulerHeightChanged)
......@@ -57,26 +56,19 @@ class MonitorProxy : public QObject
public:
MonitorProxy(GLWidget *parent);
int seekPosition() const;
/** brief: Returns true if we are still in a seek operation
* */
bool seeking() const;
int position() const;
int rulerHeight() const;
int overlayType() const;
void setOverlayType(int ix);
QString markerComment() const;
Q_INVOKABLE void requestSeekPosition(int pos);
/** brief: Returns seek position or consumer position when not seeking
* */
int seekOrCurrentPosition() const;
/** brief: update position and end seeking if we reached the requested seek position.
* returns true if the position was unchanged, false otherwise
* */
bool setPosition(int pos);
int getPosition() const;
Q_INVOKABLE bool setPosition(int pos);
void positionFromConsumer(int pos);
void setMarkerComment(const QString &comment);
void setSeekPosition(int pos);
void pauseAndSeek(int pos);
int zoneIn() const;
int zoneOut() const;
void setZoneIn(int pos);
......@@ -96,8 +88,7 @@ public:
signals:
void positionChanged();
void seekPositionChanged();
void seekRequestChanged();
void requestSeek(int pos);
void zoneChanged();
void saveZone();
void markerCommentChanged();
......@@ -118,7 +109,6 @@ signals:
private:
GLWidget *q;
int m_position;
int m_seekPosition;
int m_zoneIn;
int m_zoneOut;
bool m_hasAV;
......
......@@ -67,7 +67,7 @@ Rectangle {
onPressed: {
if (mouse.buttons === Qt.LeftButton) {
var pos = Math.max(mouseX, 0)
controller.requestSeekPosition(Math.min(pos / root.timeScale, root.duration));
controller.position = Math.min(pos / root.timeScale, root.duration);
}
}
onPositionChanged: {
......@@ -75,7 +75,7 @@ Rectangle {
var pos = Math.max(mouseX, 0)
root.mouseRulerPos = pos
if (pressed) {
controller.requestSeekPosition(Math.min(pos / root.timeScale, root.duration));
controller.position = Math.min(pos / root.timeScale, root.duration);
}
}
}
......@@ -237,14 +237,14 @@ Rectangle {
hoverEnabled: true
//onDoubleClicked: timeline.editMarker(clipRoot.binId, model.frame)
onClicked: {
controller.requestSeekPosition(model.frame)
controller.position = model.frame
}
}
}
}
}
Rectangle {
/*Rectangle {
id: seekCursor
visible: controller.seekPosition > -1
color: activePalette.highlight
......@@ -253,5 +253,5 @@ Rectangle {
opacity: 0.5
x: controller.seekPosition * root.timeScale
y: 0
}
}*/
}
......@@ -181,7 +181,7 @@ Item {
onPositionChanged: {
if (mouse.modifiers & Qt.ShiftModifier) {
var pos = Math.max(mouseX, 0)
controller.requestSeekPosition(Math.min(pos / root.timeScale, root.duration));
controller.setPosition(Math.min(pos / root.timeScale, root.duration));
}
}
}
......
......@@ -862,7 +862,7 @@ bool ProjectManager::updateTimeline(int pos, int scrollPos)
return false;
}
m_mainTimelineModel = TimelineItemModel::construct(&pCore->getCurrentProfile()->profile(), m_project->getGuideModel(), m_project->commandStack());
pCore->window()->getMainTimeline()->setModel(m_mainTimelineModel);
pCore->window()->getMainTimeline()->setModel(m_mainTimelineModel, pCore->monitorManager()->projectMonitor()->getControllerProxy());
if (!constructTimelineFromMelt(m_mainTimelineModel, tractor, m_progressDialog)) {
//TODO: act on project load failure
qDebug()<<"// Project failed to load!!";
......@@ -878,6 +878,7 @@ bool ProjectManager::updateTimeline(int pos, int scrollPos)
m_mainTimelineModel->loadGroups(groupsData);
}
connect(pCore->window()->getMainTimeline()->controller(), &TimelineController::durationChanged, this, &ProjectManager::adjustProjectDuration);
pCore->monitorManager()->projectMonitor()->slotActivateMonitor();
pCore->monitorManager()->projectMonitor()->setProducer(m_mainTimelineModel->producer(), pos);
pCore->monitorManager()->projectMonitor()->adjustRulerSize(m_mainTimelineModel->duration() - 1, m_project->getGuideModel());
pCore->window()->getMainTimeline()->controller()->setZone(m_project->zone());
......
......@@ -441,7 +441,7 @@ Rectangle {
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onDoubleClicked: timeline.editMarker(clipRoot.clipId, model.frame)
onClicked: timeline.position = (clipRoot.x + markerBase.x) / timeline.scaleFactor
onClicked: proxy.position = (clipRoot.x + markerBase.x) / timeline.scaleFactor
}
}
Text {
......
......@@ -176,7 +176,7 @@ Item {
var yPos = (compositionRoot.height - mouse.y) / compositionRoot.height
keyframeModel.addKeyframe(xPos + compositionRoot.inPoint, yPos)
} else {
timeline.position = compositionRoot.x / timeline.scaleFactor
proxy.position = compositionRoot.x / timeline.scaleFactor
}
} else {
timeline.editItemDuration(clipId)
......
......@@ -185,9 +185,8 @@ Rectangle
var newPos = frame == inPoint ? inPoint : Math.round((keyframe.x + parent.x + root.baseUnit / 2) / timeScale) + inPoint
if (newPos == frame && keyframe.value == keyframe.height - parent.y - root.baseUnit / 2) {
var pos = masterObject.modelStart + frame - inPoint
if (timeline.position != pos) {
timeline.seekPosition = pos
timeline.position = timeline.seekPosition
if (proxy.position != pos) {
proxy.position = pos
}
return
}
......
......@@ -18,7 +18,7 @@
function scrollIfNeeded() {
if (!scrollView) return;
var x = timeline.position * timeline.scaleFactor;
var x = root.consumerPosition * timeline.scaleFactor;
if (x > scrollView.flickableItem.contentX + scrollView.width - 50)
scrollView.flickableItem.contentX = x - scrollView.width + 50;
else if (x < 50)
......
This diff is collapsed.
This diff is collapsed.
......@@ -48,12 +48,8 @@ class TimelineController : public QObject
Q_PROPERTY(int duration READ duration NOTIFY durationChanged)
Q_PROPERTY(int fullDuration READ fullDuration NOTIFY durationChanged)
Q_PROPERTY(bool audioThumbFormat READ audioThumbFormat NOTIFY audioThumbFormatChanged)
/* @brief holds the current timeline position
*/
Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged)
Q_PROPERTY(int zoneIn READ zoneIn WRITE setZoneIn NOTIFY zoneChanged)
Q_PROPERTY(int zoneOut READ zoneOut WRITE setZoneOut NOTIFY zoneChanged)
Q_PROPERTY(int seekPosition READ seekPosition WRITE setSeekPosition NOTIFY seekPositionChanged)
Q_PROPERTY(bool ripple READ ripple NOTIFY rippleChanged)
Q_PROPERTY(bool scrub READ scrub NOTIFY scrubChanged)
Q_PROPERTY(bool snap READ snap NOTIFY snapChanged)
......@@ -147,10 +143,8 @@ public:
Q_INVOKABLE int fullDuration() const;
/* @brief Returns the current cursor position (frame currently displayed by MLT)
*/
Q_INVOKABLE int position() const { return m_position; }
/* @brief Returns the seek request position (-1 = no seek pending)
*/
Q_INVOKABLE int seekPosition() const { return m_seekPosition; }
Q_INVOKABLE int audioTarget() const;
Q_INVOKABLE int videoTarget() const;
Q_INVOKABLE bool hasAudioTarget() const;
......@@ -452,8 +446,6 @@ public:
void updateClip(int clipId, const QVector<int> &roles);
void showClipKeyframes(int clipId, bool value);
void showCompositionKeyframes(int clipId, bool value);
/** @brief Returns last usable timeline position (seek request or current pos) */
int timelinePosition() const;
/** @brief Adjust all timeline tracks height */
void resetTrackHeight();
/** @brief timeline preview params changed, reset */
......@@ -482,12 +474,10 @@ public:
public slots:
void resetView();
Q_INVOKABLE void setSeekPosition(int position);
Q_INVOKABLE void setAudioTarget(int track);
void setIntAudioTarget(QList <int> tracks);
Q_INVOKABLE void setVideoTarget(int track);
Q_INVOKABLE void setActiveTrack(int track);
void onSeeked(int position);
void addEffectToCurrentClip(const QStringList &effectData);
/** @brief Dis / enable timeline preview. */
void disablePreview(bool disable);
......@@ -516,8 +506,6 @@ private:
KActionCollection *m_actionCollection;
std::shared_ptr<TimelineItemModel> m_model;
bool m_usePreview;
int m_position;
int m_seekPosition;
int m_audioTarget;
int m_videoTarget;
int m_activeTrack;
......@@ -549,8 +537,6 @@ signals:
void scaleFactorChanged();
void audioThumbFormatChanged();
void durationChanged();
void positionChanged();
void seekPositionChanged();
void audioTargetChanged();
void videoTargetChanged();
void hasAudioTargetChanged();
......
......@@ -69,11 +69,7 @@ TimelineWidget *TimelineTabs::getCurrentTimeline() const
void TimelineTabs::connectTimeline(TimelineWidget *timeline)
{
connect(pCore->monitorManager()->projectMonitor(), &Monitor::seekTimeline, timeline->controller(), &TimelineController::setPosition, Qt::DirectConnection);
connect(timeline->controller(), &TimelineController::seeked, pCore->monitorManager()->projectMonitor(), &Monitor::requestSeek, Qt::DirectConnection);
connect(pCore->monitorManager()->projectMonitor(), &Monitor::seekPosition, timeline->controller(), &TimelineController::onSeeked, Qt::DirectConnection);
connect(timeline, &TimelineWidget::focusProjectMonitor, pCore->monitorManager(), &MonitorManager::focusProjectMonitor);
connect(this, &TimelineTabs::audioThumbFormatChanged, timeline->controller(), &TimelineController::audioThumbFormatChanged);
connect(this, &TimelineTabs::showThumbnailsChanged, timeline->controller(), &TimelineController::showThumbnailsChanged);
connect(this, &TimelineTabs::showAudioThumbnailsChanged, timeline->controller(), &TimelineController::showAudioThumbnailsChanged);
......@@ -86,12 +82,8 @@ void TimelineTabs::connectTimeline(TimelineWidget *timeline)
void TimelineTabs::disconnectTimeline(TimelineWidget *timeline)
{
disconnect(pCore->monitorManager()->projectMonitor(), &Monitor::seekTimeline, timeline->controller(), &TimelineController::setPosition);
disconnect(timeline->controller(), &TimelineController::seeked, pCore->monitorManager()->projectMonitor(), &Monitor::requestSeek);
disconnect(pCore->monitorManager()->projectMonitor(), &Monitor::seekPosition, timeline->controller(), &TimelineController::onSeeked);
disconnect(timeline, &TimelineWidget::focusProjectMonitor, pCore->monitorManager(), &MonitorManager::focusProjectMonitor);
disconnect(timeline->controller(), &TimelineController::durationChanged, pCore->projectManager(), &ProjectManager::adjustProjectDuration);
disconnect(this, &TimelineTabs::audioThumbFormatChanged, timeline->controller(), &TimelineController::audioThumbFormatChanged);
disconnect(this, &TimelineTabs::showThumbnailsChanged, timeline->controller(), &TimelineController::showThumbnailsChanged);
disconnect(this, &TimelineTabs::showAudioThumbnailsChanged, timeline->controller(), &TimelineController::showAudioThumbnailsChanged);
......
......@@ -33,6 +33,7 @@
#include "mainwindow.h"
#include "profiles/profilemodel.hpp"
#include "project/projectmanager.h"
#include "monitor/monitorproxy.h"
#include "qml/timelineitems.h"
#include "qmltypes/thumbnailprovider.h"
#include "timelinecontroller.h"
......@@ -82,7 +83,6 @@ TimelineWidget::TimelineWidget(QWidget *parent)
engine()->addImageProvider(QStringLiteral("thumbnail"), m_thumbnailer);
setVisible(false);
setFocusPolicy(Qt::StrongFocus);
// connect(&*m_model, SIGNAL(seeked(int)), this, SLOT(onSeeked(int)));