]> git.sesse.net Git - kdenlive/commitdiff
Image clips can be proxied too now
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 19 Feb 2011 11:13:31 +0000 (11:13 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 19 Feb 2011 11:13:31 +0000 (11:13 +0000)
svn path=/trunk/kdenlive/; revision=5426

14 files changed:
src/clipproperties.cpp
src/geometrywidget.cpp
src/kdenlivedoc.cpp
src/kdenlivesettings.kcfg
src/kdenlivesettingsdialog.cpp
src/mainwindow.cpp
src/projectlist.cpp
src/projectlist.h
src/projectsettings.cpp
src/projectsettings.h
src/renderer.cpp
src/widgets/clipproperties_ui.ui
src/widgets/configproject_ui.ui
src/widgets/projectsettings_ui.ui

index 866349a6adcd0a9ad89d8691713d8199b6f9f9f2..875f85e94e4380a594016ce45bd9e378ec759287 100644 (file)
@@ -223,7 +223,11 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg
         l->addWidget(pb);
         connect(pb, SIGNAL(clicked()), this, SLOT(slotDeleteProxy()));
         m_proxyContainer->setLayout(l);
-        if (t == AUDIO) {
+        if (t == IMAGE) {
+            m_view.tab_image->layout()->addWidget(line);
+            m_view.tab_image->layout()->addWidget(m_proxyContainer);
+        }
+        else if (t == AUDIO) {
             m_view.tab_audio->layout()->addWidget(line);
             m_view.tab_audio->layout()->addWidget(m_proxyContainer);
         }
index 7eae9fd88d833f12a51ed73132166204efa141a0..0de02ec0dd571915dc2ac4244431f0c6b63388ec 100644 (file)
@@ -92,24 +92,24 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
     connect(m_ui.buttonSync,      SIGNAL(toggled(bool)), this, SLOT(slotSetSynchronize(bool)));
 
     m_spinX = new DragValue(i18n("X"), 0, 0, -1, QString(), false, this);
-    m_spinX->setRange(-10000, 10000);
+    m_spinX->setRange(-99000, 99000);
     m_ui.horizontalLayout->addWidget(m_spinX);
     
     m_spinY = new DragValue(i18n("Y"), 0, 0, -1, QString(), false, this);
-    m_spinY->setRange(-10000, 10000);
+    m_spinY->setRange(-99000, 99000);
     m_ui.horizontalLayout->addWidget(m_spinY);
     
     m_spinWidth = new DragValue(i18n("W"), m_monitor->render->frameRenderWidth(), 0, -1, QString(), false, this);
-    m_spinWidth->setRange(1, 10000);
+    m_spinWidth->setRange(1, 99000);
     m_ui.horizontalLayout->addWidget(m_spinWidth);
     
     m_spinHeight = new DragValue(i18n("H"), m_monitor->render->renderHeight(), 0, -1, QString(), false, this);
-    m_spinHeight->setRange(1, 10000);
+    m_spinHeight->setRange(1, 99000);
     m_ui.horizontalLayout->addWidget(m_spinHeight);
     m_ui.horizontalLayout->addStretch(10);
     
     m_spinSize = new DragValue(i18n("Size"), 100, 2, -1, i18n("%"), false, this);
-    m_spinSize->setRange(1, 10000);
+    m_spinSize->setRange(1, 99000);
     m_ui.horizontalLayout2->addWidget(m_spinSize);
     
     m_opacity = new DragValue(i18n("Opacity"), 100, 0, -1, i18n("%"), true, this);
index 60a96c7601f5e9d6f1b64cc139d219063471b211..d6e2cb43c62a332aa11cc7771d717a5ee8784dd9 100644 (file)
@@ -76,8 +76,11 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
     m_documentProperties["zoneout"] = "100";
     m_documentProperties["enableproxy"] = QString::number((int) KdenliveSettings::enableproxy());
     m_documentProperties["proxyparams"] = KdenliveSettings::proxyparams();
+    m_documentProperties["proxyextension"] = KdenliveSettings::proxyextension();
     m_documentProperties["generateproxy"] = QString::number((int) KdenliveSettings::generateproxy());
     m_documentProperties["proxyminsize"] = QString::number(KdenliveSettings::proxyminsize());
+    m_documentProperties["generateimageproxy"] = QString::number((int) KdenliveSettings::generateimageproxy());
+    m_documentProperties["proxyimageminsize"] = QString::number(KdenliveSettings::proxyimageminsize());
     
     // Load properties
     QMapIterator<QString, QString> i(properties);
index dff10c95c7596e9c34295cff23233918031bd1ba..8e0dc584d1ab861794fe2900c7f7f0dac9a00ea6 100644 (file)
       <default>false</default>
     </entry>
     
+    <entry name="generateimageproxy" type="Bool">
+      <label>Auto generate proxy for new image clips.</label>
+      <default>false</default>
+    </entry>
+    
     <entry name="proxyminsize" type="Int">
       <label>Minimum source size for proxy creation.</label>
       <default>1000</default>
     </entry>
     
+    <entry name="proxyimageminsize" type="Int">
+      <label>Minimum source size for proxy creation.</label>
+      <default>2000</default>
+    </entry>
+    
+    <entry name="proxyextension" type="String">
+      <label>File extension for proxy clips.</label>
+      <default>avi</default>
+    </entry>
+    
     <entry name="proxyparams" type="String">
       <label>Proxy clips transcoding parameters.</label>
       <default>-f avi -acodec libmp3lame -ac 2 -ab 92k -ar 48000 -vcodec mpeg2video -g 5 -deinterlace -s 480x270 -b 150k</default>
index 7e2e91690292386827d53700a64ae61688613b9e..bd9da80fd07d59bbf9641c826287c305992b0775 100644 (file)
@@ -64,8 +64,9 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& map
     QWidget *p8 = new QWidget;
     m_configProject.setupUi(p8);
     m_page8 = addPage(p8, i18n("Project Defaults"), "document-new");
-    connect(m_configProject.kcfg_enableproxy, SIGNAL(toggled(bool)), m_configProject.proxy_frame, SLOT(setEnabled(bool)));
-    m_configProject.proxy_frame->setEnabled(KdenliveSettings::enableproxy());
+    connect(m_configProject.kcfg_generateproxy, SIGNAL(toggled(bool)), m_configProject.kcfg_proxyminsize, SLOT(setEnabled(bool)));
+    m_configProject.kcfg_proxyminsize->setEnabled(KdenliveSettings::generateproxy());
+    m_configProject.kcfg_proxyparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5);
 
     QWidget *p3 = new QWidget;
     m_configTimeline.setupUi(p3);
index 52e53d56d3e6773aa0619374d47d271b12c9541a..d9e824d483796f041de44f7a911bf447e9bdcf79 100644 (file)
@@ -1802,8 +1802,11 @@ void MainWindow::newFile(bool showProjectSettings, bool force)
         // set up default properties
         documentProperties.insert("enableproxy", QString::number((int) KdenliveSettings::enableproxy()));
         documentProperties.insert("generateproxy", QString::number((int) KdenliveSettings::generateproxy()));
-        documentProperties.insert("proxyparams", KdenliveSettings::proxyparams());
         documentProperties.insert("proxyminsize", QString::number(KdenliveSettings::proxyminsize()));
+        documentProperties.insert("proxyparams", KdenliveSettings::proxyparams());
+        documentProperties.insert("proxyextension", KdenliveSettings::proxyextension());
+        documentProperties.insert("generateimageproxy", QString::number((int) KdenliveSettings::generateimageproxy()));
+        documentProperties.insert("proxyimageminsize", QString::number(KdenliveSettings::proxyimageminsize()));
         if (!KdenliveSettings::activatetabs())
             if (!closeCurrentDocument())
                 return;
@@ -1823,8 +1826,11 @@ void MainWindow::newFile(bool showProjectSettings, bool force)
         projectTracks = w->tracks();
         documentProperties.insert("enableproxy", QString::number((int) w->useProxy()));
         documentProperties.insert("generateproxy", QString::number((int) w->generateProxy()));
-        documentProperties.insert("proxyparams", w->proxyParams());
         documentProperties.insert("proxyminsize", QString::number(w->proxyMinSize()));
+        documentProperties.insert("proxyparams", w->proxyParams());
+        documentProperties.insert("proxyextension", w->proxyExtension());
+        documentProperties.insert("generateimageproxy", QString::number((int) w->generateImageProxy()));
+        documentProperties.insert("proxyimageminsize", QString::number(w->proxyImageMinSize()));
         delete w;
     }
     m_timelineArea->setEnabled(true);
@@ -2232,6 +2238,10 @@ void MainWindow::slotEditProjectSettings()
                 //m_activeDocument->rebuildAllProxies();
             }
         }
+        if (m_activeDocument->getDocumentProperty("proxyextension") != w->proxyExtension()) {
+            m_activeDocument->setModified();
+            m_activeDocument->setDocumentProperty("proxyextension", w->proxyExtension());
+        }
         if (m_activeDocument->getDocumentProperty("generateproxy") != QString::number((int) w->generateProxy())) {
             m_activeDocument->setModified();
             m_activeDocument->setDocumentProperty("generateproxy", QString::number((int) w->generateProxy()));
@@ -2240,6 +2250,14 @@ void MainWindow::slotEditProjectSettings()
             m_activeDocument->setModified();
             m_activeDocument->setDocumentProperty("proxyminsize", QString::number(w->proxyMinSize()));
         }
+        if (m_activeDocument->getDocumentProperty("generateimageproxy") != QString::number((int) w->generateImageProxy())) {
+            m_activeDocument->setModified();
+            m_activeDocument->setDocumentProperty("generateimageproxy", QString::number((int) w->generateImageProxy()));
+        }
+        if (m_activeDocument->getDocumentProperty("proxyimageminsize") != QString::number(w->proxyImageMinSize())) {
+            m_activeDocument->setModified();
+            m_activeDocument->setDocumentProperty("proxyimageminsize", QString::number(w->proxyImageMinSize()));
+        }
         if (QString::number((int) w->useProxy()) != m_activeDocument->getDocumentProperty("enableproxy")) {
             m_activeDocument->setDocumentProperty("enableproxy", QString::number((int) w->useProxy()));
             m_activeDocument->setModified();
index e6eda4e7823d21f18b23b456a91fbef7461c4b34..286121b30e698b919fb959822601d808cf4b671d 100644 (file)
@@ -1004,7 +1004,7 @@ void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
         m_infoQueue.insert(clip->getId(), e);
     }
     else if (item->hasProxy() && !item->isProxyRunning()) {
-        slotCreateProxy(clip->getId());
+        slotCreateProxy(clip->getId(), false);
     }
     clip->askForAudioThumbs();
     
@@ -1059,6 +1059,15 @@ void ProjectList::slotGotProxy(const QString &id)
         // Proxy clip successfully created
         QDomElement e = item->referencedClip()->toXML().cloneNode().toElement();  
         //e.removeAttribute("file_hash");
+
+        // Make sure we get the correct producer length if it was adjusted in timeline
+        CLIPTYPE t = item->clipType();
+        if (t == COLOR || t == IMAGE || t == SLIDESHOW || t == TEXT) {
+            int length = QString(item->referencedClip()->producerProperty("length")).toInt();
+            if (length > 0 && !e.hasAttribute("length")) {
+                e.setAttribute("length", length);
+            }
+        }
         e.setAttribute("replace", 1);
         m_infoQueue.insert(id, e);
         if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
@@ -1149,8 +1158,9 @@ void ProjectList::updateAllClips()
             } else {
                 if (item->data(0, Qt::DecorationRole).isNull())
                     requestClipThumbnail(clip->getId());
-                if (item->data(0, DurationRole).toString().isEmpty())
+                if (item->data(0, DurationRole).toString().isEmpty()) {
                     item->changeDuration(item->referencedClip()->producer()->get_playtime());
+                }
             }
             item->setData(0, UsageRole, QString::number(item->numReferences()));
         }
@@ -1600,11 +1610,11 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
         DocClipBase *clip = item->referencedClip();
         if (!useProxy() && item->referencedClip()->getProperty("proxy").isEmpty()) setProxyStatus(item, NOPROXY);
         if (useProxy() && generateProxy() && item->referencedClip()->getProperty("proxy") == "-") setProxyStatus(item, NOPROXY);
-        else if (useProxy() && !item->isProxyRunning() && (item->clipType() == AV || item->clipType() == VIDEO) && generateProxy() && size.section('x', 0, 0).toInt() > proxyMinSize()) {
+        else if (useProxy() && !item->isProxyRunning() && (item->clipType() == AV || item->clipType() == VIDEO) && generateProxy() && size.section('x', 0, 0).toInt() > m_doc->getDocumentProperty("proxyminsize").toInt()) {
             if (clip->getProperty("proxy").isEmpty()) {
                 QString proxydir = m_doc->projectFolder().path( KUrl::AddTrailingSlash) + "proxy/";
                 QMap <QString, QString> newProps;
-                newProps.insert("proxy", proxydir + item->referencedClip()->getClipHash() + ".avi");
+                newProps.insert("proxy", proxydir + item->referencedClip()->getClipHash() + "." + m_doc->getDocumentProperty("proxyextension"));
                 QMap <QString, QString> oldProps = clip->properties();
                 oldProps.insert("proxy", QString());
                 EditClipCommand *command = new EditClipCommand(this, clipId, oldProps, newProps, true);
@@ -1719,6 +1729,11 @@ bool ProjectList::adjustProjectProfileToItem(ProjectItem *item)
     return profileUpdated;
 }
 
+QString ProjectList::getDocumentProperty(const QString &key) const
+{
+    return m_doc->getDocumentProperty(key);
+}
+
 bool ProjectList::useProxy() const
 {
     return m_doc->getDocumentProperty("enableproxy").toInt();
@@ -1729,14 +1744,9 @@ bool ProjectList::generateProxy() const
     return m_doc->getDocumentProperty("generateproxy").toInt();
 }
 
-int ProjectList::proxyMinSize() const
-{
-    return m_doc->getDocumentProperty("proxyminsize").toInt();
-}
-
-QString ProjectList::proxyParams() const
+bool ProjectList::generateImageProxy() const
 {
-    return m_doc->getDocumentProperty("proxyparams").simplified();
+    return m_doc->getDocumentProperty("generateimageproxy").toInt();
 }
 
 void ProjectList::slotReplyGetImage(const QString &clipId, const QPixmap &pix)
@@ -2073,10 +2083,16 @@ QMap <QString, QString> ProjectList::getProxies()
     return list;
 }
 
-void ProjectList::slotCreateProxy(const QString id)
+void ProjectList::slotCreateProxy(const QString id, bool createProducer)
 {
     ProjectItem *item = getItemById(id);
     if (!item || item->isProxyRunning()) return;
+    
+    // If proxy producer already exists, skip creation
+    if (!createProducer) {
+        setProxyStatus(id, PROXYDONE);
+        return;
+    }
     setProxyStatus(id, PROXYWAITING);
     if (m_abortProxyId.contains(id)) m_abortProxyId.removeAll(id);
     emit projectModified();
@@ -2123,10 +2139,62 @@ void ProjectList::slotGenerateProxy(const QString id)
         file.close();
         QFile::remove(path);
     }
+    if (item->clipType() == IMAGE) {
+        // Image proxy
+        QImage i(url);
+        if (i.isNull()) {
+            // Cannot load image
+            setProxyStatus(id, PROXYCRASHED);
+            return;
+        }
+        QImage proxy;
+        // Images are scaled to profile size. 
+        //TODO: Make it be configurable?
+        if (i.width() > i.height()) proxy = i.scaledToWidth(m_render->frameRenderWidth());
+        else proxy = i.scaledToHeight(m_render->renderHeight());
+        int exif_orientation = QString(item->referencedClip()->producerProperty("_exif_orientation")).toInt();
+        if (exif_orientation > 1) {
+            // Rotate image according to exif data
+            QImage processed;
+            QMatrix matrix;
+
+            switch ( exif_orientation ) {
+                case 2:
+                  matrix.scale( -1, 1 );
+                  break;
+                case 3:
+                  matrix.rotate( 180 );
+                  break;
+                case 4:
+                  matrix.scale( 1, -1 );
+                  break;
+                case 5:
+                  matrix.rotate( 270 );
+                  matrix.scale( -1, 1 );
+                  break;
+                case 6:
+                  matrix.rotate( 90 );
+                  break;
+                case 7:
+                  matrix.rotate( 90 );
+                  matrix.scale( -1, 1 );
+                  break;
+                case 8:
+                  matrix.rotate( 270 );
+                  break;
+              }
+              processed = proxy.transformed( matrix );
+              processed.save(path);
+        }
+        else proxy.save(path);
+        setProxyStatus(id, PROXYDONE);
+        slotGotProxy(id);
+        return;
+    }
 
     QStringList parameters;
     parameters << "-i" << url;
-    QString params = proxyParams();
+    QString params = m_doc->getDocumentProperty("proxyparams").simplified();
     foreach(QString s, params.split(' '))
     parameters << s;
 
@@ -2185,13 +2253,36 @@ void ProjectList::updateProxyConfig()
         if ((t == VIDEO || t == AV || t == UNKNOWN) && item->referencedClip() != NULL) {
             if  (generateProxy() && useProxy() && !item->isProxyRunning()) {
                 DocClipBase *clip = item->referencedClip();
-                if (clip->getProperty("frame_size").section('x', 0, 0).toInt() > proxyMinSize()) {
+                if (clip->getProperty("frame_size").section('x', 0, 0).toInt() > m_doc->getDocumentProperty("proxyminsize").toInt()) {
+                    if (clip->getProperty("proxy").isEmpty()) {
+                        // We need to insert empty proxy in old properties so that undo will work
+                        QMap <QString, QString> oldProps = clip->properties();
+                        oldProps.insert("proxy", QString());
+                        QMap <QString, QString> newProps;
+                        newProps.insert("proxy", proxydir + item->referencedClip()->getClipHash() + "." + m_doc->getDocumentProperty("proxyextension"));
+                        new EditClipCommand(this, clip->getId(), oldProps, newProps, true, command);
+                    }
+                }
+            }
+            else if (item->hasProxy()) {
+                // remove proxy
+                QMap <QString, QString> newProps;
+                newProps.insert("proxy", QString());
+                newProps.insert("replace", "1");
+                new EditClipCommand(this, item->clipId(), item->referencedClip()->properties(), newProps, true, command);
+            }
+        }
+        else if (t == IMAGE && item->referencedClip() != NULL) {
+            if  (generateImageProxy() && useProxy()) {
+                DocClipBase *clip = item->referencedClip();
+                int maxImageSize = m_doc->getDocumentProperty("proxyimageminsize").toInt();
+                if (clip->getProperty("frame_size").section('x', 0, 0).toInt() > maxImageSize || clip->getProperty("frame_size").section('x', 1, 1).toInt() > maxImageSize) {
                     if (clip->getProperty("proxy").isEmpty()) {
                         // We need to insert empty proxy in old properties so that undo will work
                         QMap <QString, QString> oldProps = clip->properties();
                         oldProps.insert("proxy", QString());
                         QMap <QString, QString> newProps;
-                        newProps.insert("proxy", proxydir + item->referencedClip()->getClipHash() + ".avi");
+                        newProps.insert("proxy", proxydir + item->referencedClip()->getClipHash() + ".png");
                         new EditClipCommand(this, clip->getId(), oldProps, newProps, true, command);
                     }
                 }
@@ -2202,11 +2293,6 @@ void ProjectList::updateProxyConfig()
                 newProps.insert("proxy", QString());
                 newProps.insert("replace", "1");
                 new EditClipCommand(this, item->clipId(), item->referencedClip()->properties(), newProps, true, command);
-                /*item->referencedClip()->clearProperty("proxy");
-                QDomElement e = item->toXml().cloneNode().toElement();
-                e.removeAttribute("file_hash");
-                e.setAttribute("replace", 1);
-                m_infoQueue.insert(item->clipId(), e);*/
             }
         }
         ++it;
@@ -2242,11 +2328,11 @@ void ProjectList::slotProxyCurrentItem(bool doProxy)
         if (listItem->type() == PROJECTCLIPTYPE) {
             ProjectItem *item = static_cast <ProjectItem*>(listItem);
             CLIPTYPE t = item->clipType();
-            if ((t == VIDEO || t == AV || t == UNKNOWN) && item->referencedClip()) {
+            if ((t == VIDEO || t == AV || t == UNKNOWN || t == IMAGE) && item->referencedClip()) {
                 oldProps = item->referencedClip()->properties();
                 if (doProxy) {
                     newProps.clear();
-                    QString path = proxydir + item->referencedClip()->getClipHash() + ".avi";                
+                    QString path = proxydir + item->referencedClip()->getClipHash() + "." + (t == IMAGE ? "png" : m_doc->getDocumentProperty("proxyextension"));
                     newProps.insert("proxy", path);
                     // We need to insert empty proxy so that undo will work
                     oldProps.insert("proxy", QString());
index 266775f7c606b18fac29c93a837fb643b8c9d641..a39e84e9e42fffb6d0d1cf0e5cbbc9145e3977c9 100644 (file)
@@ -195,14 +195,15 @@ public:
     QMap <QString, QString> getProxies();
     /** @brief Enable / disable proxies. */
     void updateProxyConfig();
-    /** @brief Does this project automatically use proxies. */
+    /** @brief Get a property from the document. */
+    QString getDocumentProperty(const QString &key) const;
+    
+    /** @brief Does this project allow proxies. */
     bool useProxy() const;
-    /** @brief proxy parameters for this project. */
-    QString proxyParams() const;
     /** @brief Should we automatically create proxy clips for newly added clips. */
     bool generateProxy() const;
-    /** @brief Minimum clip width to create proxy. */
-    int proxyMinSize() const;
+    /** @brief Should we automatically create proxy clips for newly added clips. */
+    bool generateImageProxy() const;
 
 public slots:
     void setDocument(KdenliveDoc *doc);
@@ -329,7 +330,7 @@ private slots:
     /** @brief Enable / disable proxy for current clip. */
     void slotProxyCurrentItem(bool doProxy);
     /** @brief Put clip in the proxy waiting list. */
-    void slotCreateProxy(const QString id);
+    void slotCreateProxy(const QString id, bool createProducer = true);
     /** @brief Stop creation of this clip's proxy. */
     void slotAbortProxy(const QString id);
     /** @brief Start creation of proxy clip. */
index c4e8e4d125de6a3a1887e17d1034e69c9160767f..a12eeab42bb851f2348c6a1e47603e5682ae7934 100644 (file)
@@ -65,22 +65,28 @@ ProjectSettings::ProjectSettings(ProjectList *projectlist, QStringList lumas, in
     video_thumbs->setChecked(KdenliveSettings::videothumbnails());
     audio_tracks->setValue(audiotracks);
     video_tracks->setValue(videotracks);
-    connect(enable_proxy, SIGNAL(toggled(bool)), proxy_box, SLOT(setEnabled(bool)));
+    proxy_params->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5);
     connect(generate_proxy, SIGNAL(toggled(bool)), proxy_minsize, SLOT(setEnabled(bool)));
+    connect(generate_imageproxy, SIGNAL(toggled(bool)), proxy_imageminsize, SLOT(setEnabled(bool)));
     
     if (projectlist) {
-        enable_proxy->setChecked(projectlist->useProxy());
-        generate_proxy->setChecked(projectlist->generateProxy());
-        proxy_minsize->setValue(projectlist->proxyMinSize());
-        proxy_params->setText(projectlist->proxyParams());
-        proxy_box->setEnabled(projectlist->useProxy());
+        enable_proxy->setChecked(projectlist->getDocumentProperty("enableproxy").toInt());
+        generate_proxy->setChecked(projectlist->getDocumentProperty("generateproxy").toInt());
+        proxy_minsize->setValue(projectlist->getDocumentProperty("proxyminsize").toInt());
+        proxy_params->setPlainText(projectlist->getDocumentProperty("proxyparams"));
+        generate_imageproxy->setChecked(projectlist->getDocumentProperty("generateimageproxy").toInt());
+        proxy_imageminsize->setValue(projectlist->getDocumentProperty("proxyimageminsize").toInt());
+        proxy_extension->setText(projectlist->getDocumentProperty("proxyextension"));
     }
     else {
         enable_proxy->setChecked(KdenliveSettings::enableproxy());
         generate_proxy->setChecked(KdenliveSettings::generateproxy());
         proxy_minsize->setValue(KdenliveSettings::proxyminsize());
-        proxy_params->setText(KdenliveSettings::proxyparams());
-        proxy_box->setEnabled(KdenliveSettings::enableproxy());
+        proxy_params->setPlainText(KdenliveSettings::proxyparams());
+        generate_imageproxy->setChecked(KdenliveSettings::generateimageproxy());
+        proxy_imageminsize->setValue(KdenliveSettings::proxyimageminsize());
+        proxy_extension->setText(KdenliveSettings::proxyextension());
+      
     }
     
     if (readOnlyTracks) {
@@ -92,6 +98,7 @@ ProjectSettings::ProjectSettings(ProjectList *projectlist, QStringList lumas, in
         slotUpdateFiles();
         connect(clear_cache, SIGNAL(clicked()), this, SLOT(slotClearCache()));
         connect(delete_unused, SIGNAL(clicked()), this, SLOT(slotDeleteUnused()));
+        connect(delete_proxies, SIGNAL(clicked()), this, SLOT(slotDeleteProxies()));
     } else tabWidget->widget(1)->setEnabled(false);
     connect(profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
     connect(project_folder, SIGNAL(textChanged(const QString &)), this, SLOT(slotUpdateButton(const QString &)));
@@ -140,12 +147,26 @@ void ProjectSettings::slotClearCache()
     slotUpdateFiles(true);
 }
 
+void ProjectSettings::slotDeleteProxies()
+{
+    buttonBox->setEnabled(false);
+    
+    KIO::NetAccess::del(KUrl(project_folder->url().path(KUrl::AddTrailingSlash) + "proxy/"), this);
+    KStandardDirs::makeDir(project_folder->url().path(KUrl::AddTrailingSlash) + "proxy/");
+    buttonBox->setEnabled(true);
+    slotUpdateFiles(true);
+}
+
 void ProjectSettings::slotUpdateFiles(bool cacheOnly)
 {
-    KIO::DirectorySizeJob * job = KIO::directorySize(project_folder->url().path(KUrl::AddTrailingSlash) + "thumbs/");
+    KIO::DirectorySizeJob *job = KIO::directorySize(project_folder->url().path(KUrl::AddTrailingSlash) + "thumbs/");
     job->exec();
     thumbs_count->setText(QString::number(job->totalFiles()));
     thumbs_size->setText(KIO::convertSize(job->totalSize()));
+    job = KIO::directorySize(project_folder->url().path(KUrl::AddTrailingSlash) + "proxy/");
+    job->exec();
+    proxy_count->setText(QString::number(job->totalFiles()));
+    proxy_size->setText(KIO::convertSize(job->totalSize()));
     delete job;
     if (cacheOnly) return;
     int unused = 0;
@@ -331,16 +352,31 @@ bool ProjectSettings::generateProxy() const
     return generate_proxy->isChecked();
 }
 
+bool ProjectSettings::generateImageProxy() const
+{
+    return generate_imageproxy->isChecked();
+}
+
 int ProjectSettings::proxyMinSize() const
 {
     return proxy_minsize->value();
 }
 
+int ProjectSettings::proxyImageMinSize() const
+{
+    return proxy_imageminsize->value();
+}
+
 QString ProjectSettings::proxyParams() const
 {
     return proxy_params->toPlainText();
 }
 
+QString ProjectSettings::proxyExtension() const
+{
+    return proxy_extension->text();
+}
+
 //static
 QStringList ProjectSettings::extractPlaylistUrls(QString path)
 {
index 9654d7fa367aeeffc620843cc4aabd833950d054..1209fb9cf496a2a295fb68b4103a4aaa772ce8f8 100644 (file)
@@ -41,7 +41,10 @@ public:
     bool useProxy() const;
     bool generateProxy() const;
     int proxyMinSize() const;
+    bool generateImageProxy() const;
+    int proxyImageMinSize() const;
     QString proxyParams() const;
+    QString proxyExtension() const;
     static QStringList extractPlaylistUrls(QString path);
     static QStringList extractSlideshowUrls(KUrl url);
 
@@ -53,6 +56,7 @@ private slots:
     void slotUpdateButton(const QString &path);
     void slotUpdateFiles(bool cacheOnly = false);
     void slotClearCache();
+    void slotDeleteProxies();
     void slotDeleteUnused();
     /** @brief Export project data to text file. */
     void slotExportToText();
index 55ad1a0f57524ac109e15f45ecd5c44463568bc1..ca03e6221d8c2f1e0b73d56c112edf92f5b93c97 100644 (file)
@@ -540,6 +540,8 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int
     QString path;
     if (xml.hasAttribute("proxy") && xml.attribute("proxy") != "-") path = xml.attribute("proxy");
     else path = xml.attribute("resource");
+    
+    
     KUrl url = KUrl(path);
     Mlt::Producer *producer = NULL;
     CLIPTYPE type = (CLIPTYPE)xml.attribute("type").toInt();
@@ -627,17 +629,22 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int
         int full_luma = xml.attribute("full_luma").toInt();
         if (full_luma != 0) producer->set("set.force_full_luma", full_luma);
     }
-
+    
+    int clipOut = 0;
+    if (xml.hasAttribute("out")) clipOut = xml.attribute("out").toInt();
+    
     // setup length here as otherwise default length (currently 15000 frames in MLT) will be taken even if outpoint is larger
     if (type == COLOR || type == TEXT || type == IMAGE || type == SLIDESHOW) {
         int length;
-        if (xml.hasAttribute("length")) length = xml.attribute("length").toInt();
+        if (xml.hasAttribute("length")) {
+            length = xml.attribute("length").toInt();
+            clipOut = length - 1;
+        }
         else length = xml.attribute("out").toInt() - xml.attribute("in").toInt();
         producer->set("length", length);
     }
 
-    if (xml.hasAttribute("out"))
-        producer->set_in_and_out(xml.attribute("in").toInt(), xml.attribute("out").toInt());
+    if (clipOut > 0) producer->set_in_and_out(xml.attribute("in").toInt(), clipOut);
 
     producer->set("id", clipId.toUtf8().constData());
 
index a156b798d776099877ba03c25ad3417036db97b9..62bf44926720421bbfa33a49339fd9c64a7c4c6e 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>280</width>
-    <height>520</height>
+    <height>503</height>
    </rect>
   </property>
   <property name="windowTitle">
        </item>
       </layout>
      </widget>
-     <widget class="QWidget" name="tab_2">
+     <widget class="QWidget" name="tab_slideshow">
       <attribute name="title">
        <string>Slideshow</string>
       </attribute>
        </item>
       </layout>
      </widget>
-     <widget class="QWidget" name="tab_4">
+     <widget class="QWidget" name="tab_image">
       <attribute name="title">
        <string>Image</string>
       </attribute>
-      <layout class="QGridLayout" name="gridLayout_8">
-       <item row="0" column="0">
-        <widget class="QLabel" name="label_16">
-         <property name="text">
-          <string>Image size</string>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="1">
-        <widget class="KLineEdit" name="image_size">
-         <property name="readOnly">
-          <bool>true</bool>
-         </property>
-        </widget>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
+          <widget class="QLabel" name="label_16">
+           <property name="text">
+            <string>Image size</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="KLineEdit" name="image_size">
+           <property name="readOnly">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </item>
-       <item row="1" column="0" colspan="2">
+       <item>
         <widget class="QCheckBox" name="image_transparency">
          <property name="text">
           <string>Transparent background</string>
          </property>
         </widget>
        </item>
-       <item row="2" column="0">
+       <item>
         <spacer name="verticalSpacer_7">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
index 51b0eae145f130ec7649716d381f2323b5043213..1b0d0b5b8f373fae6103af3635c36ae766c34469 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>312</width>
-    <height>294</height>
+    <width>333</width>
+    <height>353</height>
    </rect>
   </property>
   <property name="windowTitle">
     </spacer>
    </item>
    <item row="2" column="0" colspan="5">
-    <widget class="QCheckBox" name="kcfg_enableproxy">
-     <property name="text">
-      <string>Enable proxy clips</string>
+    <widget class="QGroupBox" name="kcfg_enableproxy">
+     <property name="title">
+      <string>Proxy clips</string>
      </property>
-    </widget>
-   </item>
-   <item row="3" column="0" colspan="5">
-    <widget class="QFrame" name="proxy_frame">
-     <property name="frameShape">
-      <enum>QFrame::NoFrame</enum>
+     <property name="checkable">
+      <bool>true</bool>
      </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
+     <property name="checked">
+      <bool>false</bool>
      </property>
      <layout class="QGridLayout" name="gridLayout">
-      <property name="margin">
-       <number>0</number>
-      </property>
       <item row="0" column="0">
        <widget class="QCheckBox" name="kcfg_generateproxy">
         <property name="text">
-         <string>Generate proxy if clip larger than</string>
+         <string>Generate for videos larger than</string>
         </property>
        </widget>
       </item>
        </widget>
       </item>
       <item row="1" column="0">
-       <widget class="QLabel" name="label">
+       <widget class="QCheckBox" name="kcfg_generateimageproxy">
         <property name="text">
-         <string>Transcoding parameters</string>
+         <string>Generate for images larger than</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="KIntSpinBox" name="kcfg_proxyimageminsize">
+        <property name="suffix">
+         <string>pixels</string>
+        </property>
+        <property name="minimum">
+         <number>500</number>
+        </property>
+        <property name="maximum">
+         <number>100000</number>
+        </property>
+        <property name="value">
+         <number>2000</number>
         </property>
        </widget>
       </item>
       <item row="2" column="0" colspan="2">
-       <widget class="QPlainTextEdit" name="kcfg_proxyparams"/>
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>FFmpeg video transcoding parameters</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0" colspan="2">
+       <widget class="QPlainTextEdit" name="kcfg_proxyparams">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="0">
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>File extension</string>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="1">
+       <widget class="KLineEdit" name="kcfg_proxyextension">
+        <property name="text">
+         <string>avi</string>
+        </property>
+       </widget>
       </item>
      </layout>
     </widget>
    </item>
-   <item row="4" column="0">
+   <item row="3" column="0">
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
      <property name="sizeHint" stdset="0">
       <size>
        <width>20</width>
-       <height>21</height>
+       <height>40</height>
       </size>
      </property>
     </spacer>
    <extends>QSpinBox</extends>
    <header>knuminput.h</header>
   </customwidget>
+  <customwidget>
+   <class>KLineEdit</class>
+   <extends>QLineEdit</extends>
+   <header>klineedit.h</header>
+  </customwidget>
   <customwidget>
    <class>KComboBox</class>
    <extends>QComboBox</extends>
index 1d297ff31eaf19f39d0cdbab550937cb687bd4b5..73d200a862ced1ff24ec200fd9885891adedd0a9 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>321</width>
-    <height>462</height>
+    <width>337</width>
+    <height>527</height>
    </rect>
   </property>
   <property name="windowTitle">
         </spacer>
        </item>
        <item row="4" column="0" colspan="4">
-        <widget class="QCheckBox" name="enable_proxy">
-         <property name="text">
-          <string>Enable proxy clips</string>
+        <widget class="QGroupBox" name="enable_proxy">
+         <property name="title">
+          <string>Proxy clips</string>
          </property>
-        </widget>
-       </item>
-       <item row="5" column="0" colspan="4">
-        <widget class="QFrame" name="proxy_box">
-         <property name="frameShape">
-          <enum>QFrame::NoFrame</enum>
+         <property name="checkable">
+          <bool>true</bool>
          </property>
-         <property name="frameShadow">
-          <enum>QFrame::Raised</enum>
+         <property name="checked">
+          <bool>false</bool>
          </property>
          <layout class="QGridLayout" name="gridLayout_2">
-          <property name="margin">
-           <number>0</number>
-          </property>
           <item row="0" column="0">
            <widget class="QCheckBox" name="generate_proxy">
             <property name="text">
-             <string>Generate proxy if clip  larger than</string>
+             <string>Generate for videos larger than</string>
             </property>
            </widget>
           </item>
             </property>
            </widget>
           </item>
-          <item row="1" column="0" colspan="2">
-           <widget class="QTextEdit" name="proxy_params"/>
+          <item row="1" column="0">
+           <widget class="QCheckBox" name="generate_imageproxy">
+            <property name="text">
+             <string>Generate for images larger than</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="KIntSpinBox" name="proxy_imageminsize">
+            <property name="suffix">
+             <string>pixels</string>
+            </property>
+            <property name="minimum">
+             <number>500</number>
+            </property>
+            <property name="maximum">
+             <number>100000</number>
+            </property>
+            <property name="value">
+             <number>2000</number>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="0" colspan="2">
+           <widget class="QLabel" name="label_16">
+            <property name="text">
+             <string>FFmpeg video transcoding parameters</string>
+            </property>
+           </widget>
+          </item>
+          <item row="3" column="0" colspan="2">
+           <widget class="QPlainTextEdit" name="proxy_params"/>
+          </item>
+          <item row="4" column="0">
+           <widget class="QLabel" name="label_17">
+            <property name="text">
+             <string>File extension</string>
+            </property>
+           </widget>
+          </item>
+          <item row="4" column="1">
+           <widget class="KLineEdit" name="proxy_extension">
+            <property name="text">
+             <string>avi</string>
+            </property>
+           </widget>
           </item>
          </layout>
         </widget>
        </item>
-       <item row="6" column="0" colspan="2">
-        <spacer name="verticalSpacer">
-         <property name="orientation">
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>105</width>
-           <height>17</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_2">
        <string>Project Files</string>
       </attribute>
       <layout class="QGridLayout" name="gridLayout_4">
-       <item row="0" column="0">
+       <item row="0" column="0" colspan="2">
         <widget class="QLabel" name="label_12">
          <property name="text">
           <string>Clips used in project:</string>
          </property>
         </widget>
        </item>
-       <item row="0" column="1">
+       <item row="0" column="2">
         <widget class="QLabel" name="used_count">
          <property name="text">
           <string/>
          </property>
         </widget>
        </item>
-       <item row="1" column="1">
+       <item row="1" column="2">
         <widget class="QLabel" name="unused_count">
          <property name="text">
           <string/>
          </property>
         </widget>
        </item>
-       <item row="2" column="1">
+       <item row="2" column="2">
         <widget class="QLabel" name="thumbs_count">
          <property name="text">
           <string/>
         </widget>
        </item>
        <item row="3" column="0">
-        <widget class="QLabel" name="label_13">
+        <widget class="QLabel" name="label_14">
          <property name="text">
-          <string>Project files</string>
+          <string>Proxy clips</string>
          </property>
         </widget>
        </item>
-       <item row="3" column="1">
-        <widget class="QLabel" name="files_count">
+       <item row="3" column="2">
+        <widget class="QLabel" name="proxy_count">
          <property name="text">
           <string/>
          </property>
         </widget>
        </item>
-       <item row="5" column="0" colspan="5">
-        <widget class="QLabel" name="label_fonts">
+       <item row="3" column="3">
+        <widget class="QLabel" name="proxy_size">
          <property name="text">
-          <string>Fonts</string>
+          <string/>
          </property>
         </widget>
        </item>
-       <item row="6" column="0" colspan="5">
-        <widget class="QListWidget" name="fonts_list">
-         <property name="alternatingRowColors">
-          <bool>true</bool>
+       <item row="3" column="4">
+        <widget class="KPushButton" name="delete_proxies">
+         <property name="text">
+          <string>Delete proxies</string>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="0">
+        <widget class="QLabel" name="label_13">
+         <property name="text">
+          <string>Project files</string>
          </property>
         </widget>
        </item>
-       <item row="4" column="0" colspan="5">
+       <item row="4" column="3" colspan="2">
+        <widget class="KTreeWidgetSearchLine" name="list_search"/>
+       </item>
+       <item row="5" column="0" colspan="5">
         <widget class="QTreeWidget" name="files_list">
          <property name="alternatingRowColors">
           <bool>true</bool>
          </column>
         </widget>
        </item>
-       <item row="3" column="2" colspan="3">
-        <widget class="KTreeWidgetSearchLine" name="list_search"/>
+       <item row="6" column="0">
+        <widget class="QLabel" name="label_fonts">
+         <property name="text">
+          <string>Fonts</string>
+         </property>
+        </widget>
        </item>
-       <item row="7" column="0">
+       <item row="7" column="0" colspan="5">
+        <widget class="QListWidget" name="fonts_list">
+         <property name="alternatingRowColors">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="8" column="0" colspan="2">
         <widget class="QPushButton" name="button_export">
          <property name="text">
           <string>Plain text export</string>
          </property>
         </widget>
        </item>
+       <item row="4" column="2">
+        <widget class="QLabel" name="files_count">
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
     </widget>