X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fclipdurationdialog.cpp;h=24d5cb7b74da4d4d325a5a1923f2f1bec76af411;hb=c24658bd34221d735f0641c924b890e1a6be7101;hp=18838af418fcde95b3bcf26be163496fdff61cc6;hpb=bc466710b2ce4939247da2d2ad567a0683d995cf;p=kdenlive diff --git a/src/clipdurationdialog.cpp b/src/clipdurationdialog.cpp index 18838af4..24d5cb7b 100644 --- a/src/clipdurationdialog.cpp +++ b/src/clipdurationdialog.cpp @@ -23,10 +23,11 @@ #include #include +#include #include -ClipDurationDialog::ClipDurationDialog(AbstractClipItem *clip, Timecode tc, GenTime min, GenTime max, QWidget * parent): +ClipDurationDialog::ClipDurationDialog(AbstractClipItem *clip, const Timecode &tc, const GenTime &min, const GenTime &max, QWidget * parent): QDialog(parent), m_clip(clip), m_min(min), @@ -36,24 +37,24 @@ ClipDurationDialog::ClipDurationDialog(AbstractClipItem *clip, Timecode tc, GenT setupUi(this); m_pos = new TimecodeDisplay(tc); - m_dur = new TimecodeDisplay(tc); m_cropStart = new TimecodeDisplay(tc); + m_dur = new TimecodeDisplay(tc); m_cropEnd = new TimecodeDisplay(tc); clip_position_box->addWidget(m_pos); + crop_start_box->addWidget(m_cropStart); clip_duration_box->addWidget(m_dur); - crop_start_box->addWidget(m_cropStart), crop_end_box->addWidget(m_cropEnd); bool allowCrop = true; - if (clip->type() == AVWIDGET) { + if (clip->type() == AVWidget) { ClipItem *item = static_cast (clip); - int t = item->clipType(); - if (t == COLOR || t == IMAGE || t == TEXT) + const int t = item->clipType(); + if (t == Color || t == Image || t == Text) allowCrop = false; } - if (!allowCrop || clip->type() == TRANSITIONWIDGET) { + if (!allowCrop || clip->type() == TransitionWidget) { m_cropStart->setHidden(true); crop_label->hide(); m_cropEnd->setHidden(true), @@ -67,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(); } @@ -144,13 +145,14 @@ void ClipDurationDialog::slotCheckEnd() { GenTime cropStart = m_cropStart->gentime(); GenTime cropEnd = m_cropEnd->gentime(); - GenTime duration = m_clip->maxDuration() - cropStart - cropEnd; + GenTime duration = m_clip->maxDuration() - cropEnd - cropStart; if (duration >= GenTime()) { m_dur->setValue(duration); + slotCheckDuration(); } else { m_cropEnd->blockSignals(true); - m_cropEnd->setValue(m_clip->maxDuration() - cropStart - m_dur->gentime()); + m_cropEnd->setValue(m_clip->maxDuration() - m_dur->gentime() - cropStart); m_cropEnd->blockSignals(false); } }