From 3c98191107f87acbb743c4d17d4db51836ff3317 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Wed, 14 Nov 2012 09:30:44 +0100 Subject: [PATCH] Fix timecode widget sometimes emitting value changed twice causing unnecessary refresh --- src/clipdurationdialog.cpp | 8 ++++---- src/geometryval.cpp | 2 +- src/geometrywidget.cpp | 2 +- src/kthumb.cpp | 3 +++ src/markerdialog.cpp | 2 +- src/monitor.cpp | 2 +- src/positionedit.cpp | 2 +- src/simplekeyframes/simplekeyframewidget.cpp | 2 +- src/timecodedisplay.cpp | 13 +++++-------- src/timecodedisplay.h | 6 +++--- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/clipdurationdialog.cpp b/src/clipdurationdialog.cpp index a9fbb934..69436e26 100644 --- a/src/clipdurationdialog.cpp +++ b/src/clipdurationdialog.cpp @@ -68,10 +68,10 @@ ClipDurationDialog::ClipDurationDialog(AbstractClipItem *clip, Timecode tc, GenT m_cropStart->setValue(m_clip->cropStart()); m_cropEnd->setValue(m_clip->maxDuration() - m_clip->cropDuration() - m_clip->cropStart()); - connect(m_pos, SIGNAL(editingFinished()), this, SLOT(slotCheckStart())); - connect(m_dur, SIGNAL(editingFinished()), this, SLOT(slotCheckDuration())); - connect(m_cropStart, SIGNAL(editingFinished()), this, SLOT(slotCheckCrop())); - connect(m_cropEnd, SIGNAL(editingFinished()), this, SLOT(slotCheckEnd())); + connect(m_pos, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotCheckStart())); + connect(m_dur, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotCheckDuration())); + connect(m_cropStart, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotCheckCrop())); + connect(m_cropEnd, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotCheckEnd())); adjustSize(); } diff --git a/src/geometryval.cpp b/src/geometryval.cpp index f28cb1b5..2c52f685 100644 --- a/src/geometryval.cpp +++ b/src/geometryval.cpp @@ -419,7 +419,7 @@ void Geometryval::setupParam(const QDomElement par, int minFrame, int maxFrame) slotUpdateGeometry(); if (!m_fixedMode) { m_timePos.setRange(0, maxFrame - minFrame - 1); - connect(&m_timePos, SIGNAL(editingFinished()), this , SLOT(slotPositionChanged())); + connect(&m_timePos, SIGNAL(timeCodeEditingFinished()), this , SLOT(slotPositionChanged())); } connect(spinTransp, SIGNAL(valueChanged(int)), this , SLOT(slotTransparencyChanged(int))); } diff --git a/src/geometrywidget.cpp b/src/geometrywidget.cpp index e92f029c..d51c38ca 100644 --- a/src/geometrywidget.cpp +++ b/src/geometrywidget.cpp @@ -90,7 +90,7 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos, connect(m_timeline, SIGNAL(keyframeMoved(int)), this, SLOT(slotKeyframeMoved(int))); connect(m_timeline, SIGNAL(addKeyframe(int)), this, SLOT(slotAddKeyframe(int))); connect(m_timeline, SIGNAL(removeKeyframe(int)), this, SLOT(slotDeleteKeyframe(int))); - connect(m_timePos, SIGNAL(editingFinished()), this, SLOT(slotPositionChanged())); + connect(m_timePos, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotPositionChanged())); connect(m_ui.buttonPrevious, SIGNAL(clicked()), this, SLOT(slotPreviousKeyframe())); connect(m_ui.buttonNext, SIGNAL(clicked()), this, SLOT(slotNextKeyframe())); connect(m_ui.buttonAddDelete, SIGNAL(clicked()), this, SLOT(slotAddDeleteKeyframe())); diff --git a/src/kthumb.cpp b/src/kthumb.cpp index 66cdad24..128b4506 100644 --- a/src/kthumb.cpp +++ b/src/kthumb.cpp @@ -168,6 +168,9 @@ QImage KThumb::getProducerFrame(int framepos, int frameWidth, int displayWidth, QMutexLocker lock(&m_mutex); m_producer->seek(framepos); Mlt::Frame *frame = m_producer->get_frame(); + /*frame->set("rescale.interp", "nearest"); + frame->set("deinterlace_method", "onefield"); + frame->set("top_field_first", -1 );*/ QImage p = getFrame(frame, frameWidth, displayWidth, height); delete frame; return p; diff --git a/src/markerdialog.cpp b/src/markerdialog.cpp index e789cc15..3402fb2b 100644 --- a/src/markerdialog.cpp +++ b/src/markerdialog.cpp @@ -93,7 +93,7 @@ MarkerDialog::MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, cons clip_thumb->setFixedHeight(p.height()); clip_thumb->setPixmap(p); } - connect(m_in, SIGNAL(editingFinished()), this, SIGNAL(updateThumb())); + connect(m_in, SIGNAL(timeCodeEditingFinished()), this, SIGNAL(updateThumb())); } else { clip_thumb->setHidden(true); } diff --git a/src/monitor.cpp b/src/monitor.cpp index 02a9d921..9a08767e 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -202,7 +202,7 @@ Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profil m_toolbar->addWidget(spacer); m_timePos = new TimecodeDisplay(m_monitorManager->timecode(), this); m_toolbar->addWidget(m_timePos); - connect(m_timePos, SIGNAL(editingFinished()), this, SLOT(slotSeek())); + connect(m_timePos, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotSeek())); m_toolbar->setMaximumHeight(s * 1.5); layout->addWidget(m_toolbar); } diff --git a/src/positionedit.cpp b/src/positionedit.cpp index f03b8da3..aaeac222 100644 --- a/src/positionedit.cpp +++ b/src/positionedit.cpp @@ -46,7 +46,7 @@ PositionEdit::PositionEdit(const QString name, int pos, int min, int max, const connect(m_slider, SIGNAL(valueChanged(int)), m_display, SLOT(setValue(int))); connect(m_slider, SIGNAL(valueChanged(int)), this, SIGNAL(parameterChanged(int))); - connect(m_display, SIGNAL(editingFinished()), this, SLOT(slotUpdatePosition())); + connect(m_display, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotUpdatePosition())); m_slider->setValue(pos); } diff --git a/src/simplekeyframes/simplekeyframewidget.cpp b/src/simplekeyframes/simplekeyframewidget.cpp index 20ede65f..51651560 100644 --- a/src/simplekeyframes/simplekeyframewidget.cpp +++ b/src/simplekeyframes/simplekeyframewidget.cpp @@ -60,7 +60,7 @@ SimpleKeyframeWidget::SimpleKeyframeWidget(Timecode t, int duration, QWidget *pa l->addWidget(m_buttonNext, 1, 2); l->addWidget(m_time, 1, 3, Qt::AlignRight); - connect(m_time, SIGNAL(editingFinished()), this, SLOT(slotSetPosition())); + connect(m_time, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotSetPosition())); connect(m_timeline, SIGNAL(positionChanged(int)), this, SLOT(slotSetPosition(int))); connect(m_timeline, SIGNAL(atKeyframe(bool)), this, SLOT(slotAtKeyframe(bool))); connect(m_timeline, SIGNAL(keyframeAdded(int)), this, SIGNAL(keyframeAdded(int))); diff --git a/src/timecodedisplay.cpp b/src/timecodedisplay.cpp index 93cf6d84..fe4ed4cb 100644 --- a/src/timecodedisplay.cpp +++ b/src/timecodedisplay.cpp @@ -72,7 +72,6 @@ void TimecodeDisplay::stepBy(int steps) { int val = m_value + steps; setValue(val); - emit editingFinished(); } void TimecodeDisplay::setTimeCodeFormat(bool frametimecode, bool init) @@ -121,14 +120,12 @@ void TimecodeDisplay::mouseReleaseEvent(QMouseEvent *e) } } -/* + void TimecodeDisplay::wheelEvent(QWheelEvent *e) { - if (e->delta() > 0) - slotValueUp(); - else - slotValueDown(); -}*/ + QAbstractSpinBox::wheelEvent(e); + clearFocus(); +} int TimecodeDisplay::maximum() const @@ -195,7 +192,7 @@ void TimecodeDisplay::slotEditingFinished() lineEdit()->deselect(); if (m_frametimecode) setValue(lineEdit()->text().toInt()); else setValue(lineEdit()->text()); - emit editingFinished(); + emit timeCodeEditingFinished(); } #include diff --git a/src/timecodedisplay.h b/src/timecodedisplay.h index e3ae03f7..97bd353e 100644 --- a/src/timecodedisplay.h +++ b/src/timecodedisplay.h @@ -93,7 +93,7 @@ public slots: void setValue(const QString &value); void setValue(GenTime value); - /** @brief Sets value's format accorrding to Kdenlive's settings. + /** @brief Sets value's format according to Kdenlive's settings. * @param t (optional, if already existing) Timecode object to use */ void slotUpdateTimeCodeFormat(); @@ -108,12 +108,12 @@ signals: * @param final if the value is final ie not produced during sliding (on slider release it's final) */ void valueChanged(int value, bool final); - void editingFinished(); + void timeCodeEditingFinished(); protected: virtual void keyPressEvent(QKeyEvent *e); virtual void mouseReleaseEvent(QMouseEvent *); -// virtual void wheelEvent(QWheelEvent *e); + virtual void wheelEvent(QWheelEvent *e); virtual QAbstractSpinBox::StepEnabled stepEnabled () const; }; -- 2.39.2