]> git.sesse.net Git - kdenlive/blobdiff - src/dvdwizardmenu.cpp
Add transcoding profile to fix Sony Mpeg files:
[kdenlive] / src / dvdwizardmenu.cpp
index ab7390d67c633187006996c387f404ff54c804ec..bb48547f7bbf5c8c1ab2026f35522847459bd8a3 100644 (file)
@@ -37,6 +37,8 @@ DvdWizardMenu::DvdWizardMenu(const QString &profile, QWidget *parent) :
 
     m_view.add_button->setIcon(KIcon("document-new"));
     m_view.delete_button->setIcon(KIcon("trash-empty"));
+    m_view.zoom_button->setIcon(KIcon("zoom-in"));
+    m_view.unzoom_button->setIcon(KIcon("zoom-out"));
 
     m_view.add_button->setToolTip(i18n("Add new button"));
     m_view.delete_button->setToolTip(i18n("Delete current button"));
@@ -104,6 +106,8 @@ DvdWizardMenu::DvdWizardMenu(const QString &profile, QWidget *parent) :
 
     connect(m_view.add_button, SIGNAL(pressed()), this, SLOT(addButton()));
     connect(m_view.delete_button, SIGNAL(pressed()), this, SLOT(deleteButton()));
+    connect(m_view.zoom_button, SIGNAL(pressed()), this, SLOT(slotZoom()));
+    connect(m_view.unzoom_button, SIGNAL(pressed()), this, SLOT(slotUnZoom()));
     connect(m_scene, SIGNAL(selectionChanged()), this, SLOT(buttonChanged()));
     connect(m_scene, SIGNAL(changed(const QList<QRectF> &)), this, SIGNAL(completeChanged()));
 
@@ -298,7 +302,7 @@ void DvdWizardMenu::checkBackgroundType(int ix)
     if (ix == 0) {
         m_view.background_color->setVisible(true);
         m_view.background_image->setVisible(false);
-        m_scene->removeItem(m_background);
+        if (m_background->scene() != 0) m_scene->removeItem(m_background);
     } else {
         m_view.background_color->setVisible(false);
         m_view.background_image->setVisible(true);
@@ -306,7 +310,7 @@ void DvdWizardMenu::checkBackgroundType(int ix)
             m_view.background_image->setFilter("*");
             m_scene->addItem(m_background);
         } else {
-            m_scene->removeItem(m_background);
+            if (m_background->scene() != 0) m_scene->removeItem(m_background);
             m_view.background_image->setFilter("video/mpeg");
         }
     }
@@ -321,12 +325,12 @@ void DvdWizardMenu::buildImage()
 {
     emit completeChanged();
     if (m_view.background_image->url().isEmpty()) {
-        m_scene->removeItem(m_background);
+        if (m_background->scene() != 0) m_scene->removeItem(m_background);
         return;
     }
     QPixmap pix;
     if (!pix.load(m_view.background_image->url().path())) {
-        m_scene->removeItem(m_background);
+        if (m_background->scene() != 0) m_scene->removeItem(m_background);
         return;
     }
     pix = pix.scaled(m_width, m_height);
@@ -337,7 +341,7 @@ void DvdWizardMenu::buildImage()
 void DvdWizardMenu::checkBackground()
 {
     if (m_view.background_list->currentIndex() != 1) {
-        m_scene->removeItem(m_background);
+        if (m_background->scene() != 0) m_scene->removeItem(m_background);
     } else {
         m_scene->addItem(m_background);
     }
@@ -389,9 +393,9 @@ void DvdWizardMenu::createButtonImages(const QString &img1, const QString &img2,
         QPainter p(&img);
         p.setRenderHints(QPainter::Antialiasing, false);
         p.setRenderHints(QPainter::TextAntialiasing, false);
-        m_scene->removeItem(m_safeRect);
-        m_scene->removeItem(m_color);
-        m_scene->removeItem(m_background);
+        if (m_safeRect->scene() != 0) m_scene->removeItem(m_safeRect);
+        if (m_color->scene() != 0) m_scene->removeItem(m_color);
+        if (m_background->scene() != 0) m_scene->removeItem(m_background);
         m_scene->render(&p, QRectF(0, 0, m_width, m_height));
         p.end();
         img.setNumColors(4);
@@ -507,18 +511,18 @@ bool DvdWizardMenu::isPalMenu() const
 QDomElement DvdWizardMenu::toXml() const
 {
     QDomDocument doc;
-    if (!m_view.create_menu->isChecked()) return doc.documentElement();
     QDomElement xml = doc.createElement("menu");
     doc.appendChild(xml);
+    xml.setAttribute("enabled", m_view.create_menu->isChecked());
     if (m_view.background_list->currentIndex() == 0) {
         // Color bg
         xml.setAttribute("background_color", m_view.background_color->color().name());
     } else if (m_view.background_list->currentIndex() == 1) {
         // Image bg
-        xml.setAttribute("background_image", m_view.background_image->text());
+        xml.setAttribute("background_image", m_view.background_image->url().path());
     } else {
         // Video bg
-        xml.setAttribute("background_video", m_view.background_image->text());
+        xml.setAttribute("background_video", m_view.background_image->url().path());
     }
     xml.setAttribute("text_color", m_view.text_color->color().name());
     xml.setAttribute("selected_color", m_view.selected_color->color().name());
@@ -553,16 +557,16 @@ void DvdWizardMenu::loadXml(QDomElement xml)
     kDebug() << "// LOADING MENU";
     if (xml.isNull()) return;
     kDebug() << "// LOADING MENU 1";
-    m_view.create_menu->setChecked(true) ;
+    m_view.create_menu->setChecked(xml.attribute("enabled").toInt());
     if (xml.hasAttribute("background_color")) {
         m_view.background_list->setCurrentIndex(0);
         m_view.background_color->setColor(xml.attribute("background_color"));
     } else if (xml.hasAttribute("background_image")) {
         m_view.background_list->setCurrentIndex(1);
-        m_view.background_image->setPath(xml.attribute("background_image"));
+        m_view.background_image->setUrl(KUrl(xml.attribute("background_image")));
     } else if (xml.hasAttribute("background_video")) {
         m_view.background_list->setCurrentIndex(2);
-        m_view.background_image->setPath(xml.attribute("background_video"));
+        m_view.background_image->setUrl(KUrl(xml.attribute("background_video")));
     }
 
     m_view.text_color->setColor(xml.attribute("text_color"));
@@ -604,3 +608,13 @@ void DvdWizardMenu::loadXml(QDomElement xml)
     }
 }
 
+void DvdWizardMenu::slotZoom()
+{
+    m_view.menu_preview->scale(2.0, 2.0);
+}
+
+void DvdWizardMenu::slotUnZoom()
+{
+    m_view.menu_preview->scale(0.5, 0.5);
+}
+