]> git.sesse.net Git - kdenlive/commitdiff
Fix opening of title with profile different than current one
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 2 Aug 2009 20:10:58 +0000 (20:10 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 2 Aug 2009 20:10:58 +0000 (20:10 +0000)
svn path=/trunk/kdenlive/; revision=3795

src/titledocument.cpp
src/titledocument.h
src/titlewidget.cpp
src/titlewidget.h

index 5c077a0a296a768eb3b208cf054e2399f6bc89a4..9ff9e6d56e3ac1b8d15e84a5097ea19a10ca4956 100644 (file)
@@ -220,8 +220,10 @@ int TitleDocument::loadFromXml(QDomDocument doc, QGraphicsPolygonItem* startv, Q
         int doc_width = doc.documentElement().attribute("width").toInt();
         int doc_height = doc.documentElement().attribute("height").toInt();
         if (doc_width != m_width || doc_height != m_height) {
-            KMessageBox::information(kapp->activeWindow(), i18n("This title clip was created with a different frame size. It will now be converted to the current project's size."), i18n("Resizing Title Clip"));
+            KMessageBox::information(kapp->activeWindow(), i18n("This title clip was created with a different frame size."), i18n("Title Profile"));
             //TODO: convert using QTransform
+            m_width = doc_width;
+            m_height = doc_height;
         }
     }
     //TODO: get default title duration instead of hardcoded one
@@ -395,3 +397,15 @@ QTransform TitleDocument::stringToTransform(const QString& s)
                l.at(6).toDouble(), l.at(7).toDouble(), l.at(8).toDouble()
            );
 }
+
+int TitleDocument::frameWidth() const
+{
+    return m_width;
+}
+
+int TitleDocument::frameHeight() const
+{
+    return m_height;
+}
+
+
index cc669f7056b2008d7b5e13539249edb0202f1cd7..cc5d838e6fcb6213c405f750a18d1fcccc3b0b78 100644 (file)
@@ -37,6 +37,8 @@ public:
     /** \brief Get the background color (incl. alpha) from the document, if possibly
      * \returns The background color of the document, inclusive alpha. If none found, returns (0,0,0,0) */
     QColor getBackgroundColor();
+    int frameWidth() const;
+    int frameHeight() const;
 
     enum ItemOrigin {OriginXLeft = 0, OriginYTop = 1};
     enum AxisPosition {AxisDefault = 0, AxisInverted = 1};
index 938ff35a7903f0cfff71b912836b58efcf5f31ec..dec833f3b0fbb10eea2b9d624dce1db4868833b2 100644 (file)
@@ -261,7 +261,6 @@ TitleWidget::TitleWidget(KUrl url, Timecode tc, QString projectTitlePath, Render
     readChoices();
 
     initViewports();
-    QTimer::singleShot(500, this, SLOT(slotAdjustZoom()));
     graphicsView->show();
     //graphicsView->setRenderHint(QPainter::Antialiasing);
     graphicsView->setInteractive(true);
@@ -271,11 +270,13 @@ TitleWidget::TitleWidget(KUrl url, Timecode tc, QString projectTitlePath, Render
     if (!url.isEmpty()) {
         double out;
         m_count = m_titledocument.loadDocument(url, m_startViewport, m_endViewport, &out) + 1;
+        adjustFrameSize();
         title_duration->setText(m_tc.getTimecode(GenTime(out), m_render->fps()));
         slotSelectTool();
     } else {
         slotTextTool();
     }
+    QTimer::singleShot(200, this, SLOT(slotAdjustZoom()));
 }
 
 TitleWidget::~TitleWidget()
@@ -1314,6 +1315,7 @@ void TitleWidget::loadTitle()
         m_scene->clearTextSelection();
         double out;
         m_count = m_titledocument.loadDocument(url, m_startViewport, m_endViewport, &out) + 1;
+        adjustFrameSize();
         title_duration->setText(m_tc.getTimecode(GenTime(out / 1000.0), m_render->fps()));
         insertingValues = true;
         startViewportX->setValue(m_startViewport->data(0).toInt());
@@ -1324,6 +1326,7 @@ void TitleWidget::loadTitle()
         endViewportSize->setValue(m_endViewport->data(2).toInt());
         insertingValues = false;
         slotSelectTool();
+        slotAdjustZoom();
     }
 }
 
@@ -1355,7 +1358,7 @@ void TitleWidget::setXml(QDomDocument doc)
 {
     double out;
     m_count = m_titledocument.loadFromXml(doc, m_startViewport, m_endViewport, &out);
-    kDebug() << "\n\n// TITLE OUT: " << out;
+    adjustFrameSize();
     title_duration->setText(m_tc.getTimecode(GenTime(out / 1000.0), m_render->fps()));
     /*if (doc.documentElement().hasAttribute("out")) {
     GenTime duration = GenTime(doc.documentElement().attribute("out").toDouble() / 1000.0);
@@ -1385,7 +1388,7 @@ void TitleWidget::setXml(QDomDocument doc)
     kcolorbutton->setColor(background_color);
     horizontalSlider->blockSignals(false);
     kcolorbutton->blockSignals(false);
-
+    QTimer::singleShot(200, this, SLOT(slotAdjustZoom()));
     slotSelectTool();
 }
 
@@ -1505,3 +1508,14 @@ void TitleWidget::readChoices()
     cropImage->setChecked(titleConfig.readEntry("crop_image", cropImage->isChecked()));
 }
 
+void TitleWidget::adjustFrameSize()
+{
+    m_frameWidth = m_titledocument.frameWidth();
+    m_frameHeight = m_titledocument.frameHeight();
+    m_frameBorder->setRect(0, 0, m_frameWidth, m_frameHeight);
+    displayBackgroundFrame();
+}
+
+
+
+
index 26e7e84af0c7a0a0bc1f2ad6af597b570bdb9caa..ac60a32556f231ed87e7b63d6d959b3ab54ba5df 100644 (file)
@@ -144,6 +144,8 @@ private:
     /** \brief Check a tool button. */
     void checkButton(TITLETOOL toolType);
 
+    void adjustFrameSize();
+
 public slots:
     void slotNewText(QGraphicsTextItem *tt);
     void slotNewRect(QGraphicsRectItem *rect);