]> git.sesse.net Git - kdenlive/commitdiff
Duration of color / image / text clips is now correctly set to a maximum value of...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 12 Dec 2008 12:13:45 +0000 (12:13 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 12 Dec 2008 12:13:45 +0000 (12:13 +0000)
http://www.kdenlive.org:80/mantis/view.php?id=439

svn path=/branches/KDE4/; revision=2777

src/clipitem.cpp
src/clipproperties.cpp
src/clipproperties.h
src/docclipbase.cpp

index e1810bf531c70e07945e43ac498a42cfc7abf695..dcff6614a45e25e0f5f52085b9c8f9e90b50448c 100644 (file)
@@ -955,7 +955,7 @@ void ClipItem::resizeEnd(int posx, double speed, bool updateKeyFrames) {
     const int max = (startPos() - cropStart() + maxDuration()).frames(m_fps) + 1;
     if (posx > max) posx = max;
     if (posx == endPos().frames(m_fps)) return;
-    kDebug() << "// NEW POS: " << posx << ", OLD END: " << endPos().frames(m_fps);
+    //kDebug() << "// NEW POS: " << posx << ", OLD END: " << endPos().frames(m_fps);
     const int previous = (cropStart() + duration()).frames(m_fps);
     AbstractClipItem::resizeEnd(posx, m_speed);
     if (updateKeyFrames) checkEffectsKeyframesPos(previous, (cropStart() + duration()).frames(m_fps), false);
index e88a93a7401ab41ccbc7743d2ef7a6fbaccc50ee..03f686b69ea3f9388f93b7bd28ab920f95f340dc 100644 (file)
@@ -186,11 +186,12 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg
         m_view.tabWidget->removeTab(VIDEOTAB);
         m_view.clip_thumb->setHidden(true);
     }
-    if (t != IMAGE && t != COLOR && t != TEXT) m_view.clip_duration->setReadOnly(true);
 
     KFileItem f(KFileItem::Unknown, KFileItem::Unknown, url, true);
     m_view.clip_filesize->setText(KIO::convertSize(f.size()));
     m_view.clip_duration->setText(tc.getTimecode(m_clip->duration(), m_fps));
+    if (t != IMAGE && t != COLOR && t != TEXT) m_view.clip_duration->setReadOnly(true);
+    else connect(m_view.clip_duration, SIGNAL(editingFinished()), this, SLOT(slotCheckMaxLength()));
 
     // markers
     m_view.marker_new->setIcon(KIcon("document-new"));
@@ -423,6 +424,13 @@ void ClipProperties::parseFolder() {
     m_view.clip_thumb->setPixmap(pix);
 }
 
+void ClipProperties::slotCheckMaxLength() {
+    int duration = m_tc.getFrameCount(m_view.clip_duration->text(), m_fps);
+    if (duration > m_clip->maxDuration().frames(m_fps)) {
+       m_view.clip_duration->setText(m_tc.getTimecode(m_clip->maxDuration(), m_fps));
+    }
+}
+
 #include "clipproperties.moc"
 
 
index e90fd3b7eb5fb0d095cae1cefdcc508edb2e3490..929cc75bcc6d1c4f6c40e4e48d8ffbe4c50d91d5 100644 (file)
@@ -43,6 +43,7 @@ private slots:
     void slotEditMarker();
     void slotDeleteMarker();
     void slotFillMarkersList();
+    void slotCheckMaxLength();
 
 private:
     Ui::ClipProperties_UI m_view;
index 7950189e177c0f217088ce2ff359c0bf35ddf9a2..5dabc00da9dce2b68f450eea7dbd2d8bb373e9d6 100644 (file)
@@ -166,7 +166,7 @@ const GenTime &DocClipBase::duration() const {
 
 const GenTime &DocClipBase::maxDuration() const {
     if (m_clipType == COLOR || m_clipType == IMAGE || m_clipType == TEXT || (m_clipType == SLIDESHOW &&  m_properties.value("loop") == "1")) {
-        const GenTime dur(10000, KdenliveSettings::project_fps());
+        const GenTime dur(15000, KdenliveSettings::project_fps());
         return dur;
     }
     return m_duration;