]> git.sesse.net Git - kdenlive/blobdiff - src/kdenlivedoc.cpp
Various changes for getting an OpenGL context (almost) everywhere it is needed.
[kdenlive] / src / kdenlivedoc.cpp
index 3fe26a4ce265fa7c5b2d54f90cd01ddb2b8b83a2..127cd32c3a163c4ad6968c586d2ad0444f9147de 100644 (file)
@@ -61,7 +61,7 @@
 
 const double DOCUMENTVERSION = 0.88;
 
-KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QMap <QString, QString>& properties, const QMap <QString, QString>& metadata, const QPoint &tracks, Render *render, KTextEdit *notes, bool *openBackup, MainWindow *parent, KProgressDialog *progressDialog) :
+KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QMap <QString, QString>& properties, const QMap <QString, QString>& metadata, const QPoint &tracks, Render *render, KTextEdit *notes, bool *openBackup, QGLWidget *glContext, MainWindow *parent, KProgressDialog *progressDialog) :
     QObject(parent),
     m_autosave(NULL),
     m_url(url),
@@ -83,7 +83,7 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
     m_profile.display_aspect_den = 0;
     m_profile.colorspace = 0;
 
-    m_clipManager = new ClipManager(this);
+    m_clipManager = new ClipManager(this, glContext);
     m_autoSaveTimer = new QTimer(this);
     m_autoSaveTimer->setSingleShot(true);
     connect(m_clipManager, SIGNAL(displayMessage(QString,int)), parent, SLOT(slotGotProgressInfo(QString,int)));
@@ -841,6 +841,7 @@ void KdenliveDoc::setProjectFolder(KUrl url)
     KStandardDirs::makeDir(url.path());
     KStandardDirs::makeDir(url.path(KUrl::AddTrailingSlash) + "titles/");
     KStandardDirs::makeDir(url.path(KUrl::AddTrailingSlash) + "thumbs/");
+    KStandardDirs::makeDir(url.path(KUrl::AddTrailingSlash) + "proxy/");
     if (KMessageBox::questionYesNo(kapp->activeWindow(), i18n("You have changed the project folder. Do you want to copy the cached data from %1 to the new folder %2?", m_projectFolder.path(), url.path())) == KMessageBox::Yes) moveProjectData(url);
     m_projectFolder = url;
 
@@ -862,13 +863,17 @@ void KdenliveDoc::moveProjectData(const KUrl &url)
         }
         QString hash = clip->getClipHash();
         KUrl oldVideoThumbUrl = KUrl(m_projectFolder.path(KUrl::AddTrailingSlash) + "thumbs/" + hash + ".png");
-        KUrl oldAudioThumbUrl = KUrl(m_projectFolder.path(KUrl::AddTrailingSlash) + "thumbs/" + hash + ".thumb");
         if (KIO::NetAccess::exists(oldVideoThumbUrl, KIO::NetAccess::SourceSide, 0)) {
             cacheUrls << oldVideoThumbUrl;
         }
+        KUrl oldAudioThumbUrl = KUrl(m_projectFolder.path(KUrl::AddTrailingSlash) + "thumbs/" + hash + ".thumb");
         if (KIO::NetAccess::exists(oldAudioThumbUrl, KIO::NetAccess::SourceSide, 0)) {
             cacheUrls << oldAudioThumbUrl;
         }
+        KUrl oldVideoProxyUrl = KUrl(m_projectFolder.path(KUrl::AddTrailingSlash) + "proxy/" + hash + '.' + KdenliveSettings::proxyextension());
+        if (KIO::NetAccess::exists(oldVideoProxyUrl, KIO::NetAccess::SourceSide, 0)) {
+            cacheUrls << oldVideoProxyUrl;
+        }
     }
     if (!cacheUrls.isEmpty()) {
         KIO::Job *job = KIO::copy(cacheUrls, KUrl(url.path(KUrl::AddTrailingSlash) + "thumbs/"));
@@ -1145,6 +1150,7 @@ bool KdenliveDoc::addClip(QDomElement elem, const QString &clipId, bool createCl
                 elem.setAttribute("placeholder", '1');
             }
             if (!newpath.isEmpty()) {
+                kDebug() << "// NEW CLIP PATH FOR CLIP " << clipId << " : " << newpath;
                 if (elem.attribute("type").toInt() == SlideShow)
                     newpath.append('/' + extension);
                 elem.setAttribute("resource", newpath);
@@ -1207,9 +1213,11 @@ QString KdenliveDoc::searchFileRecursively(const QDir &dir, const QString &match
                 fileHash = QCryptographicHash::hash(fileData, QCryptographicHash::Md5);
                 if (QString(fileHash.toHex()) == matchHash)
                     return file.fileName();
+                else
+                    kDebug() << filesAndDirs.at(i) << "size match but not hash";
             }
         }
-        kDebug() << filesAndDirs.at(i) << file.size() << fileHash.toHex();
+        //kDebug() << filesAndDirs.at(i) << file.size() << fileHash.toHex();
     }
     filesAndDirs = dir.entryList(QDir::Dirs | QDir::Readable | QDir::Executable | QDir::NoDotAndDotDot);
     for (int i = 0; i < filesAndDirs.size() && foundFileName.isEmpty(); ++i) {