]> git.sesse.net Git - kdenlive/blobdiff - src/clipdurationdialog.cpp
Cleaning code style of Definitions.
[kdenlive] / src / clipdurationdialog.cpp
index 18838af418fcde95b3bcf26be163496fdff61cc6..24d5cb7b74da4d4d325a5a1923f2f1bec76af411 100644 (file)
 
 #include <KDebug>
 #include <KMessageBox>
+#include <KGlobalSettings>
 
 #include <QWheelEvent>
 
-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 <ClipItem *>(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);
     }
 }