-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I attached a patch which adds "crop end" to the duration dialog.
See: http://www.kdenlive.org/mantis/view.php?id=1371

regards ttill
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkt+624ACgkQzwEyz7QP6nS1egCgsIUh9RoyivqyPs080J8B4FLG
D2IAnR8BltVh8rQduIWqXencdzuPI2Gk
=5ONH
-----END PGP SIGNATURE-----
Index: src/widgets/clipdurationdialog_ui.ui
===================================================================
--- src/widgets/clipdurationdialog_ui.ui	(revision 4318)
+++ src/widgets/clipdurationdialog_ui.ui	(working copy)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>226</width>
-    <height>169</height>
+    <height>213</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -242,7 +242,82 @@
      </item>
     </layout>
    </item>
-   <item row="3" column="0" colspan="2">
+   <item row="4" column="0">
+    <widget class="QLabel" name="end_label">
+     <property name="text">
+      <string>Crop end</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout_4">
+     <item>
+      <widget class="KRestrictedLine" name="end_position">
+       <property name="inputMask">
+        <string>99:99:99:99; </string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout_4">
+       <property name="spacing">
+        <number>0</number>
+       </property>
+       <item>
+        <widget class="QToolButton" name="end_up">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Maximum">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>16777215</width>
+           <height>18</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>...</string>
+         </property>
+         <property name="autoRaise">
+          <bool>true</bool>
+         </property>
+         <property name="arrowType">
+          <enum>Qt::UpArrow</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QToolButton" name="end_down">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Maximum">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>16777215</width>
+           <height>18</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>...</string>
+         </property>
+         <property name="autoRaise">
+          <bool>true</bool>
+         </property>
+         <property name="arrowType">
+          <enum>Qt::DownArrow</enum>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item row="5" column="0" colspan="2">
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
@@ -255,7 +330,7 @@
      </property>
     </spacer>
    </item>
-   <item row="4" column="0" colspan="2">
+   <item row="6" column="0" colspan="2">
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
Index: src/clipdurationdialog.cpp
===================================================================
--- src/clipdurationdialog.cpp	(revision 4318)
+++ src/clipdurationdialog.cpp	(working copy)
@@ -50,21 +50,29 @@
         m_view.crop_down->hide();
         m_view.crop_position->hide();
         m_view.crop_label->hide();
+        m_view.end_up->hide();
+        m_view.end_down->hide();
+        m_view.end_position->hide();
+        m_view.end_label->hide();
     }
 
     m_crop = m_clip->cropStart().frames(m_fps);
     m_view.clip_position->setText(tc.getTimecode(m_clip->startPos()));
     m_view.crop_position->setText(tc.getTimecode(m_clip->cropStart()));
     m_view.clip_duration->setText(tc.getTimecode(m_clip->cropDuration()));
+    m_view.end_position->setText(tc.getTimecode(m_clip->maxDuration() - m_clip->cropDuration() - m_clip->cropStart()));
     connect(m_view.position_up, SIGNAL(clicked()), this, SLOT(slotPosUp()));
     connect(m_view.position_down, SIGNAL(clicked()), this, SLOT(slotPosDown()));
     connect(m_view.crop_up, SIGNAL(clicked()), this, SLOT(slotCropUp()));
     connect(m_view.crop_down, SIGNAL(clicked()), this, SLOT(slotCropDown()));
     connect(m_view.duration_up, SIGNAL(clicked()), this, SLOT(slotDurUp()));
     connect(m_view.duration_down, SIGNAL(clicked()), this, SLOT(slotDurDown()));
+    connect(m_view.end_up, SIGNAL(clicked()), this, SLOT(slotEndUp()));
+    connect(m_view.end_down, SIGNAL(clicked()), this, SLOT(slotEndDown()));
     connect(m_view.crop_position, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckCrop()));
     connect(m_view.clip_duration, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckDuration()));
     connect(m_view.clip_position, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckStart()));
+    connect(m_view.end_position, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckEnd()));
     adjustSize();
 }
 
@@ -101,6 +109,12 @@
         m_view.clip_duration->setText(m_tc.getTimecode(maxDuration - start));
         m_view.clip_duration->blockSignals(false);
     }
+    
+	dur = m_tc.getFrameCount(m_view.clip_duration->text());
+	GenTime durationUp(dur, m_fps);
+	m_view.end_position->blockSignals(true);
+	m_view.end_position->setText(m_tc.getTimecode(m_clip->maxDuration() - durationUp - cropStart));
+	m_view.end_position->blockSignals(false);
 }
 
 void ClipDurationDialog::slotCheckCrop()
@@ -127,6 +141,21 @@
     }
 }
 
+void ClipDurationDialog::slotCheckEnd()
+{
+	int crop = m_tc.getFrameCount(m_view.crop_position->text());
+	int end = m_tc.getFrameCount(m_view.end_position->text());
+	int dur = m_tc.getFrameCount(m_tc.getTimecode(m_clip->maxDuration())) - crop - end;
+	if(dur >= 0) {
+		m_view.clip_duration->setText(m_tc.getTimecode(GenTime(dur, m_fps)));
+	} else {
+		dur = m_tc.getFrameCount(m_view.clip_duration->text());
+		m_view.end_position->blockSignals(true);
+		m_view.end_position->setText(m_tc.getTimecode(m_clip->maxDuration() - GenTime(crop + dur, m_fps)));
+		m_view.end_position->blockSignals(false);
+	}
+}
+
 void ClipDurationDialog::slotPosUp()
 {
     int position = m_tc.getFrameCount(m_view.clip_position->text());
@@ -177,6 +206,21 @@
     m_view.crop_position->setText(m_tc.getTimecode(GenTime(crop, m_fps)));
 }
 
+void ClipDurationDialog::slotEndUp()
+{
+	int end = m_tc.getFrameCount(m_view.end_position->text());
+	end ++;
+	m_view.end_position->setText(m_tc.getTimecode(GenTime(end, m_fps)));
+}
+
+void ClipDurationDialog::slotEndDown()
+{
+	int end = m_tc.getFrameCount(m_view.end_position->text());
+	if (end <= 0) return;
+	end --;
+	m_view.end_position->setText(m_tc.getTimecode(GenTime(end, m_fps)));
+}
+
 GenTime ClipDurationDialog::startPos() const
 {
     int pos = m_tc.getFrameCount(m_view.clip_position->text());
@@ -212,7 +256,12 @@
             slotCropUp();
         else
             slotCropDown();
-    }
+    } else if (m_view.end_position->underMouse()) {
+		if (event->delta() > 0)
+			slotEndUp();
+		else
+			slotEndDown();
+	}
 }
 
 #include "clipdurationdialog.moc"
Index: src/clipdurationdialog.h
===================================================================
--- src/clipdurationdialog.h	(revision 4318)
+++ src/clipdurationdialog.h	(working copy)
@@ -48,9 +48,12 @@
     void slotDurDown();
     void slotCropUp();
     void slotCropDown();
+    void slotEndUp();
+    void slotEndDown();
     void slotCheckDuration();
     void slotCheckStart();
     void slotCheckCrop();
+    void slotCheckEnd();
 
 private:
     Ui::ClipDurationDialog_UI m_view;
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Kdenlive-devel mailing list
Kdenlive-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kdenlive-devel

Reply via email to