Commit 22b55c98 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Merge branch '1912'

parents e36d045c 7b474696
Pipeline #11432 passed with stage
in 13 minutes and 58 seconds
......@@ -1687,12 +1687,13 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
QDomNodeList props = main_playlist.elementsByTagName(QStringLiteral("property"));
QJsonArray guidesList;
QMap<QString, QJsonArray> markersList;
QLocale locale;
for (int i = 0; i < props.count(); ++i) {
QDomNode n = props.at(i);
QString prop = n.toElement().attribute(QStringLiteral("name"));
if (prop.startsWith(QLatin1String("kdenlive:guide."))) {
// Process guide
double guidePos = prop.section(QLatin1Char('.'), 1).toDouble();
double guidePos = locale.toDouble(prop.section(QLatin1Char('.'), 1));
QJsonObject currentGuide;
currentGuide.insert(QStringLiteral("pos"), QJsonValue(GenTime(guidePos).frames(pCore->getCurrentFps())));
currentGuide.insert(QStringLiteral("comment"), QJsonValue(n.firstChild().nodeValue()));
......@@ -1702,7 +1703,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
guidesList.push_back(currentGuide);
} else if (prop.startsWith(QLatin1String("kdenlive:marker."))) {
// Process marker
double markerPos = prop.section(QLatin1Char(':'), -1).toDouble();
double markerPos = locale.toDouble(prop.section(QLatin1Char(':'), -1));
QString markerBinClip = prop.section(QLatin1Char('.'), 1).section(QLatin1Char(':'), 0, 0);
QString markerData = n.firstChild().nodeValue();
int markerType = markerData.section(QLatin1Char(':'), 0, 0).toInt();
......
......@@ -682,15 +682,12 @@ void GLWidget::refresh()
bool GLWidget::checkFrameNumber(int pos, int offset)
{
emit consumerPosition(pos);
const double speed = m_producer->get_speed();
bool isPlaying = !qFuzzyIsNull(speed);
if (isPlaying) {
m_proxy->positionFromConsumer(pos);
}
m_proxy->positionFromConsumer(pos, isPlaying);
int maxPos = m_producer->get_int("out");
if (m_isLoopMode || m_isZoneMode) {
if (qFuzzyIsNull(speed) && pos >= maxPos) {
if (!isPlaying && pos >= maxPos) {
m_consumer->purge();
if (!m_isLoopMode) {
return false;
......@@ -701,7 +698,7 @@ bool GLWidget::checkFrameNumber(int pos, int offset)
return true;
}
return true;
} else if (!qFuzzyIsNull(speed)) {
} else if (isPlaying) {
maxPos -= offset;
if (pos >= (maxPos - 1) && speed > 0.) {
// Playing past last clip, pause
......@@ -918,6 +915,7 @@ int GLWidget::setProducer(const std::shared_ptr<Mlt::Producer> &producer, bool i
if (isActive) {
startConsumer();
}
m_consumer->set("scrub_audio", 0);
m_proxy->setPosition(position > 0 ? position : m_producer->position());
return error;
}
......@@ -1688,7 +1686,7 @@ MonitorProxy *GLWidget::getControllerProxy()
int GLWidget::getCurrentPos() const
{
return m_consumer->position();
return m_proxy->getPosition();
}
void GLWidget::setRulerInfo(int duration, const std::shared_ptr<MarkerListModel> &model)
......
......@@ -159,7 +159,7 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
connect(m_glMonitor, &GLWidget::panView, this, &Monitor::panView);
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->getControllerProxy(), &MonitorProxy::positionChanged, this, &Monitor::slotSeekPosition);
connect(m_glMonitor, &GLWidget::activateMonitor, this, &AbstractMonitor::slotActivateMonitor, Qt::DirectConnection);
m_videoWidget = QWidget::createWindowContainer(qobject_cast<QWindow *>(m_glMonitor));
m_videoWidget->setAcceptDrops(true);
......
......@@ -40,6 +40,7 @@ MonitorProxy::MonitorProxy(GLWidget *parent)
, m_zoneOut(-1)
, m_hasAV(false)
, m_clipType(0)
, m_seekFinished(true)
{
}
......@@ -79,14 +80,29 @@ bool MonitorProxy::setPosition(int pos)
}
m_position = pos;
emit requestSeek(pos);
emit positionChanged();
if (m_seekFinished) {
m_seekFinished = false;
emit seekFinishedChanged();
}
emit positionChanged(pos);
return false;
}
void MonitorProxy::positionFromConsumer(int pos)
void MonitorProxy::positionFromConsumer(int pos, bool playing)
{
m_position = pos;
emit positionChanged();
if (playing) {
m_position = pos;
emit positionChanged(pos);
if (!m_seekFinished) {
m_seekFinished = true;
emit seekFinishedChanged();
}
} else {
if (!m_seekFinished && m_position == pos) {
m_seekFinished = true;
emit seekFinishedChanged();
}
}
}
void MonitorProxy::setMarkerComment(const QString &comment)
......
......@@ -38,6 +38,7 @@ class MonitorProxy : public QObject
Q_OBJECT
// Q_PROPERTY(int consumerPosition READ consumerPosition NOTIFY consumerPositionChanged)
Q_PROPERTY(int position MEMBER m_position WRITE setPosition NOTIFY positionChanged)
Q_PROPERTY(int seekFinished MEMBER m_seekFinished NOTIFY seekFinishedChanged)
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)
......@@ -67,7 +68,7 @@ public:
* */
int getPosition() const;
Q_INVOKABLE bool setPosition(int pos);
void positionFromConsumer(int pos);
void positionFromConsumer(int pos, bool playing);
void setMarkerComment(const QString &comment);
int zoneIn() const;
int zoneOut() const;
......@@ -87,7 +88,8 @@ public:
void setAudioThumb(const QUrl thumbPath = QUrl());
signals:
void positionChanged();
void positionChanged(int);
void seekFinishedChanged();
void requestSeek(int pos);
void zoneChanged();
void saveZone();
......@@ -116,6 +118,7 @@ private:
QString m_markerComment;
QString m_clipName;
int m_clipType;
bool m_seekFinished;
};
#endif
......@@ -9,11 +9,15 @@ Rectangle {
id: ruler
color: activePalette.base
property bool containsMouse: rulerMouseArea.containsMouse
property bool seekingFinished : controller.seekFinished
Rectangle {
color: activePalette.light
width: parent.width
height: 1
}
onSeekingFinishedChanged : {
playhead.opacity = seekingFinished ? 1 : 0.5
}
Timer {
id: zoneToolTipTimer
......@@ -103,7 +107,7 @@ Rectangle {
visible: controller.position > -1
height: ruler.height * 0.5
width: ruler.height * 1
opacity: 0.8
opacity: 1
anchors.top: ruler.top
fillColor: activePalette.windowText
x: controller.position * root.timeScale - (width / 2)
......
......@@ -248,6 +248,12 @@ Rectangle {
property int viewActiveTrack: timeline.activeTrack
property int wheelAccumulatedDelta: 0
readonly property int defaultDeltasPerStep: 120
property bool seekingFinished : proxy.seekFinished
onSeekingFinishedChanged : {
playhead.opacity = seekingFinished ? 1 : 0.5
}
//onCurrentTrackChanged: timeline.selection = []
onTimeScaleChanged: {
......
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