]> git.sesse.net Git - kdenlive/blobdiff - src/titlewidget.cpp
Fix title duration, keeping compatibility with Kdenlive 0.92
[kdenlive] / src / titlewidget.cpp
index 5a9387491edcd1d7668cd8df8ecea27767ac6a83..b769fdf642cc7df3d6bde8db95bf5ba2283f8878 100644 (file)
@@ -1849,9 +1849,20 @@ void TitleWidget::saveTitle(KUrl url)
     if (anim_start->isChecked()) slotAnimStart(false);
     if (anim_end->isChecked()) slotAnimEnd(false);
     bool embed_image=false;
-    if (KMessageBox::questionYesNo(this, i18n("Do you want to embed Images into this TitleDocument?\nThis is most needed for sharing Titles.")) != KMessageBox::No)
+
+    // If we have images in the title, ask for embed
+    QList <QGraphicsItem *> list = graphicsView->scene()->items();
+    QGraphicsPixmapItem pix;
+    int pixmapType = pix.type();
+    foreach(const QGraphicsItem *item, list) {
+       if (item->type() == pixmapType && item != m_frameImage) {
+           embed_image = true;
+           break;
+       }
+    }
+    if (embed_image && KMessageBox::questionYesNo(this, i18n("Do you want to embed Images into this TitleDocument?\nThis is most needed for sharing Titles.")) != KMessageBox::Yes)
     {
-        embed_image=true;      
+        embed_image=false;
     }
     if (url.isEmpty()) {
         QPointer<KFileDialog> fs = new KFileDialog(KUrl(m_projectTitlePath), "application/x-kdenlivetitle", this);
@@ -1872,21 +1883,21 @@ void TitleWidget::saveTitle(KUrl url)
 QDomDocument TitleWidget::xml()
 {
     QDomDocument doc = m_titledocument.xml(m_startViewport, m_endViewport);
-    doc.documentElement().setAttribute("out", m_tc.getFrameCount(title_duration->text()));
+    doc.documentElement().setAttribute("duration", m_tc.getFrameCount(title_duration->text()));
     return doc;
 }
 
-int TitleWidget::outPoint() const
+int TitleWidget::duration() const
 {
     return m_tc.getFrameCount(title_duration->text());
 }
 
 void TitleWidget::setXml(QDomDocument doc)
 {
-    int out;
-    m_count = m_titledocument.loadFromXml(doc, m_startViewport, m_endViewport, &out, m_projectTitlePath);
+    int duration;
+    m_count = m_titledocument.loadFromXml(doc, m_startViewport, m_endViewport, &duration, m_projectTitlePath);
     adjustFrameSize();
-    title_duration->setText(m_tc.getTimecode(GenTime(out, m_render->fps())));
+    title_duration->setText(m_tc.getTimecode(GenTime(duration, m_render->fps())));
     /*if (doc.documentElement().hasAttribute("out")) {
     GenTime duration = GenTime(doc.documentElement().attribute("out").toDouble() / 1000.0);
     title_duration->setText(m_tc.getTimecode(duration));