Commit 40f51140 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Merge branch '2012'

parents d27eec9e 01f6e42d
Pipeline #42775 passed with stage
in 10 minutes and 16 seconds
......@@ -986,9 +986,10 @@ const QString ProjectClip::hash()
return getFileHash();
}
const QByteArray ProjectClip::getFolderHash(QDir dir)
const QByteArray ProjectClip::getFolderHash(QDir dir, QString fileName)
{
QByteArray fileData = dir.entryList(QDir::Files).join(QLatin1Char(',')).toUtf8();
fileName.append(dir.entryList(QDir::Files).join(QLatin1Char(',')));
QByteArray fileData = fileName.toUtf8();
return QCryptographicHash::hash(fileData, QCryptographicHash::Md5);
}
......@@ -998,7 +999,7 @@ const QString ProjectClip::getFileHash()
QByteArray fileHash;
switch (m_clipType) {
case ClipType::SlideShow:
fileHash = getFolderHash(QFileInfo(clipUrl()).absoluteDir());
fileHash = getFolderHash(QFileInfo(clipUrl()).absoluteDir(), QFileInfo(clipUrl()).fileName());
break;
case ClipType::Text:
fileData = getProducerProperty(QStringLiteral("xmldata")).toUtf8();
......
......@@ -244,7 +244,7 @@ public:
/** @brief Get the list of audio stream effects for a defined stream. */
QStringList getAudioStreamEffect(int streamIndex) const override;
/** @brief Calculate the folder's hash (based on the files it contains). */
static const QByteArray getFolderHash(QDir dir);
static const QByteArray getFolderHash(QDir dir, QString fileName);
/** @brief Check if the clip is included in timeline and reset its occurences on producer reload. */
void updateTimelineOnReload();
......
......@@ -1294,7 +1294,7 @@ void RenderWidget::prepareRendering(bool delayedRendering, const QString &chapte
}
// replace proxy clips with originals
QMap<QString, QString> proxies = pCore->projectItemModel()->getProxies(pCore->currentDoc()->documentRoot());
QMap<QString, QString> proxies = pCore->projectItemModel()->getProxies(root);
QDomNodeList producers = doc.elementsByTagName(QStringLiteral("producer"));
QString producerResource;
......
......@@ -294,9 +294,11 @@ bool DocumentChecker::hasErrorInClips()
continue;
}
// Check for slideshows
QString slidePattern;
bool slideshow = resource.contains(QStringLiteral("/.all.")) || resource.contains(QLatin1Char('?')) || resource.contains(QLatin1Char('%'));
if (slideshow) {
if (service == QLatin1String("qimage") || service == QLatin1String("pixbuf")) {
slidePattern = QFileInfo(resource).fileName();
resource = QFileInfo(resource).absolutePath();
} else if (service.startsWith(QLatin1String("avformat")) && Xml::hasXmlProperty(e, QStringLiteral("ttl"))) {
// Fix MLT 6.20 avformat slideshows
......@@ -332,7 +334,7 @@ bool DocumentChecker::hasErrorInClips()
// Check if file changed
const QByteArray hash = Xml::getXmlProperty(e, "kdenlive:file_hash").toLatin1();
if (!hash.isEmpty()) {
const QByteArray fileData = slideshow ? ProjectClip::getFolderHash(QDir(resource)).toHex() : ProjectClip::calculateHash(resource).first.toHex();
const QByteArray fileData = slideshow ? ProjectClip::getFolderHash(QDir(resource), slidePattern).toHex() : ProjectClip::calculateHash(resource).first.toHex();
if (hash != fileData) {
// For slideshow clips, silently upgrade hash
if (slideshow) {
......@@ -1019,7 +1021,7 @@ QString DocumentChecker::searchDirRecursively(const QDir &dir, const QString &ma
QStringList filesAndDirs;
QString fileName = QFileInfo(fullName).fileName();
// Check main dir
QString fileHash = ProjectClip::getFolderHash(dir).toHex();
QString fileHash = ProjectClip::getFolderHash(dir, fileName).toHex();
if (fileHash == matchHash) {
return dir.absoluteFilePath(fileName);
}
......@@ -1027,7 +1029,7 @@ QString DocumentChecker::searchDirRecursively(const QDir &dir, const QString &ma
const QStringList subDirs = dir.entryList(QDir::AllDirs | QDir::NoDot | QDir::NoDotDot);
for (const QString &sub : subDirs) {
QDir subFolder(dir.absoluteFilePath(sub));
fileHash = ProjectClip::getFolderHash(subFolder).toHex();
fileHash = ProjectClip::getFolderHash(subFolder, fileName).toHex();
if (fileHash == matchHash) {
return subFolder.absoluteFilePath(fileName);
}
......
......@@ -676,7 +676,6 @@ void KdenliveDoc::setProjectFolder(const QUrl &url)
void KdenliveDoc::moveProjectData(const QString & /*src*/, const QString &dest)
{
// Move proxies
QList<QUrl> cacheUrls;
auto binClips = pCore->projectItemModel()->getAllClipIds();
// First step: all clips referenced by the bin model exist and are inserted
......@@ -707,7 +706,7 @@ void KdenliveDoc::moveProjectData(const QString & /*src*/, const QString &dest)
if (proxyDir.mkpath(QStringLiteral("."))) {
KIO::CopyJob *job = KIO::move(cacheUrls, QUrl::fromLocalFile(proxyDir.absolutePath()));
KJobWidgets::setWindow(job, QApplication::activeWindow());
if (static_cast<int>(job->exec()) > 0) {
if (!job->exec()) {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Moving proxy clips failed: %1", job->errorText()));
}
}
......@@ -1299,7 +1298,7 @@ void KdenliveDoc::loadDocumentProperties()
QDomElement baseElement = m_document.documentElement();
m_documentRoot = baseElement.attribute(QStringLiteral("root"));
if (!m_documentRoot.isEmpty()) {
m_documentRoot = QDir::cleanPath(m_documentRoot) + QDir::separator();
m_documentRoot = QDir::cleanPath(m_documentRoot) + QLatin1Char('/');
}
if (!list.isEmpty()) {
QDomElement pl = list.at(0).toElement();
......
......@@ -848,10 +848,10 @@ void ProjectManager::saveZone(const QStringList &info, const QDir &dir)
void ProjectManager::moveProjectData(const QString &src, const QString &dest)
{
// Move tmp folder (thumbnails, timeline preview)
m_project->moveProjectData(src, dest);
KIO::CopyJob *copyJob = KIO::move(QUrl::fromLocalFile(src), QUrl::fromLocalFile(dest));
connect(copyJob, &KJob::result, this, &ProjectManager::slotMoveFinished);
connect(copyJob, SIGNAL(percent(KJob*,ulong)), this, SLOT(slotMoveProgress(KJob*,ulong)));
m_project->moveProjectData(src, dest);
}
void ProjectManager::slotMoveProgress(KJob *, unsigned long progress)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment