]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
* Allow to edit transparent background for images in group properties
[kdenlive] / src / mainwindow.cpp
index bbfaa6e37c3b3d3444770c012c6301b8d40273c8..9a3382f9f62c9dbbe27f43c4e9a105e3c56b6cca 100644 (file)
@@ -156,6 +156,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
     if (!KdenliveSettings::colortheme().isEmpty()) slotChangePalette(NULL, KdenliveSettings::colortheme());
     setFont(KGlobalSettings::toolBarFont());
     parseProfiles(MltPath);
+    KdenliveSettings::setCurrent_profile(KdenliveSettings::default_profile());
     m_commandStack = new QUndoGroup;
     setDockNestingEnabled(true);
     m_timelineArea = new KTabWidget(this);
@@ -373,7 +374,6 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
     setCentralWidget(m_timelineArea);
 
 
-    KdenliveSettings::setCurrent_profile(KdenliveSettings::default_profile());
     m_fileOpenRecent = KStandardAction::openRecent(this, SLOT(openFile(const KUrl &)), actionCollection());
     readOptions();
     m_fileRevert = KStandardAction::revert(this, SLOT(slotRevert()), actionCollection());
@@ -617,13 +617,6 @@ MainWindow::~MainWindow()
     Mlt::Factory::close();
 }
 
-void MainWindow::queryQuit()
-{
-    if (queryClose()) {
-        close();
-    }
-}
-
 //virtual
 bool MainWindow::queryClose()
 {
@@ -1526,7 +1519,7 @@ void MainWindow::setupActions()
     connect(maxCurrent, SIGNAL(triggered(bool)), this, SLOT(slotMaximizeCurrent(bool)));*/
 
     m_closeAction = KStandardAction::close(this,  SLOT(closeCurrentDocument()),   collection);
-    KStandardAction::quit(this,                   SLOT(queryQuit()),              collection);
+    KStandardAction::quit(this,                   SLOT(close()),              collection);
     KStandardAction::open(this,                   SLOT(openFile()),               collection);
     m_saveAction = KStandardAction::save(this,    SLOT(saveFile()),               collection);
     KStandardAction::saveAs(this,                 SLOT(saveFileAs()),             collection);
@@ -1803,6 +1796,10 @@ void MainWindow::newFile(bool showProjectSettings, bool force)
     QString profileName = KdenliveSettings::default_profile();
     KUrl projectFolder = KdenliveSettings::defaultprojectfolder();
     QPoint projectTracks(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks());
+    bool useProxy = KdenliveSettings::enableproxy();
+    QString proxyParams = KdenliveSettings::proxyparams();
+    bool generateProxy = KdenliveSettings::enableproxy();
+    int proxyMinSize = 1000;
     if (!showProjectSettings) {
         if (!KdenliveSettings::activatetabs())
             if (!closeCurrentDocument())
@@ -1821,11 +1818,19 @@ void MainWindow::newFile(bool showProjectSettings, bool force)
         profileName = w->selectedProfile();
         projectFolder = w->selectedFolder();
         projectTracks = w->tracks();
+        useProxy = w->useProxy();
+        proxyParams = w->proxyParams();
+        generateProxy = w->generateProxy();
+        proxyMinSize = w->proxyMinSize();
         delete w;
     }
     m_timelineArea->setEnabled(true);
     m_projectList->setEnabled(true);
     KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, projectTracks, m_projectMonitor->render, m_notesWidget, this);
+    doc->setDocumentProperty("useproxy", QString::number((int) useProxy));
+    doc->setDocumentProperty("proxyparams", proxyParams);
+    doc->setDocumentProperty("generateproxy", QString::number((int) generateProxy));
+    doc->setDocumentProperty("proxyminsize", QString::number(proxyMinSize));
     doc->m_autosave = new KAutoSaveFile(KUrl(), doc);
     bool ok;
     TrackView *trackView = new TrackView(doc, &ok, this);
@@ -2219,6 +2224,13 @@ void MainWindow::slotEditProjectSettings()
         if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs();
         if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) slotSwitchAudioThumbs();
         if (m_activeDocument->profilePath() != profile) slotUpdateProjectProfile(profile);
+        m_activeDocument->setDocumentProperty("proxyparams", w->proxyParams());
+        m_activeDocument->setDocumentProperty("generateproxy", QString::number((int) w->generateProxy()));
+        m_activeDocument->setDocumentProperty("proxyminsize", QString::number(w->proxyMinSize()));
+        if (QString::number((int) w->useProxy()) != m_activeDocument->getDocumentProperty("enableproxy")) {
+            m_activeDocument->setDocumentProperty("enableproxy", QString::number((int) w->useProxy()));
+            slotUpdateProxySettings();
+        }
     }
     delete w;
 }
@@ -2265,7 +2277,7 @@ void MainWindow::slotRenderProject()
 {
     if (!m_renderWidget) {
         QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) : KdenliveSettings::defaultprojectfolder();
-        m_renderWidget = new RenderWidget(projectfolder, this);
+        m_renderWidget = new RenderWidget(projectfolder, m_projectList->useProxy(), this);
         connect(m_renderWidget, SIGNAL(shutdown()), this, SLOT(slotShutdown()));
         connect(m_renderWidget, SIGNAL(selectedRenderProfile(QMap <QString, QString>)), this, SLOT(slotSetDocumentRenderProfile(QMap <QString, QString>)));
         connect(m_renderWidget, SIGNAL(prepareRenderingData(bool, bool, const QString&)), this, SLOT(slotPrepareRendering(bool, bool, const QString&)));
@@ -2573,7 +2585,6 @@ void MainWindow::slotPreferences(int page, int option)
     
     KdenliveSettingsDialog* dialog = new KdenliveSettingsDialog(actions, this);
     connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
-    connect(dialog, SIGNAL(updateProxySettings()), this, SLOT(slotUpdateProxySettings()));
     connect(dialog, SIGNAL(doResetProfile()), m_monitorManager, SLOT(slotResetProfiles()));
 #ifndef Q_WS_MAC
     connect(dialog, SIGNAL(updateCaptureFolder()), this, SLOT(slotUpdateCaptureFolder()));
@@ -3181,10 +3192,17 @@ void MainWindow::slotShowClipProperties(QList <DocClipBase *> cliplist, QMap<QSt
     ClipProperties dia(cliplist, m_activeDocument->timecode(), commonproperties, this);
     if (dia.exec() == QDialog::Accepted) {
         QUndoCommand *command = new QUndoCommand();
+        QMap <QString, QString> newImageProps = dia.properties();
+        // Transparency setting applies only for images
+        QMap <QString, QString> newProps = newImageProps;
+        newProps.remove("transparency");
         command->setText(i18n("Edit clips"));
         for (int i = 0; i < cliplist.count(); i++) {
             DocClipBase *clip = cliplist.at(i);
-            new EditClipCommand(m_projectList, clip->getId(), clip->properties(), dia.properties(), true, command);
+            if (clip->clipType() == IMAGE)
+                new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newImageProps, true, command);
+            else 
+                new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newProps, true, command);
         }
         m_activeDocument->commandStack()->push(command);
         for (int i = 0; i < cliplist.count(); i++)
@@ -3805,7 +3823,7 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS
     } else exportAudio = m_renderWidget->selectedAudioExport();
     
     // Do we want proxy rendering
-    if (KdenliveSettings::enableproxy() && !m_renderWidget->proxyRendering()) {
+    if (m_projectList->useProxy() && !m_renderWidget->proxyRendering()) {
         // replace proxy clips with originals
         QMap <QString, QString> proxies = m_projectList->getProxies();
         QMapIterator<QString, QString> i(proxies);
@@ -4139,7 +4157,7 @@ void MainWindow::slotDeleteClip(const QString &id)
 
 void MainWindow::slotUpdateProxySettings()
 {
-    if (m_renderWidget) m_renderWidget->updateProxyConfig();
+    if (m_renderWidget) m_renderWidget->updateProxyConfig(m_projectList->useProxy());
     if (KdenliveSettings::enableproxy())
         KStandardDirs::makeDir(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) + "proxy/");
     m_projectList->updateProxyConfig();