aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <[email protected]>2016-06-24 08:59:44 +0200
committerJean-Baptiste Mardelle <[email protected]>2016-06-24 09:00:51 +0200
commit32ccaa68f72b9759a90509fdfbb0072ad9b13fc5 (patch)
treec4b9328c4b155bec33677804b2bdbf51ebc1a0b2
parentb79722496d202132cffe1258255267d02818fdce (diff)
Store proxy profile info in proxy clip name, no more separate folders, fix info & deletion of proxies in cached data widget
-rw-r--r--src/bin/bin.cpp11
-rw-r--r--src/bin/bin.h2
-rw-r--r--src/doc/kdenlivedoc.cpp20
-rw-r--r--src/doc/kdenlivedoc.h2
-rw-r--r--src/project/dialogs/temporarydata.cpp38
-rw-r--r--src/project/dialogs/temporarydata.h3
6 files changed, 49 insertions, 27 deletions
diff --git a/src/bin/bin.cpp b/src/bin/bin.cpp
index 1dae471..7dcb750 100644
--- a/src/bin/bin.cpp
+++ b/src/bin/bin.cpp
@@ -3239,6 +3239,17 @@ void Bin::refreshProxySettings()
} else delete masterCommand;
}
+QStringList Bin::getProxyHashList()
+{
+ QStringList list;
+ QList <ProjectClip*> clipList = m_rootFolder->childClips();
+ foreach (ProjectClip *clp, clipList) {
+ if (clp->clipType() == AV || clp->clipType() == Video || clp->clipType() == Playlist)
+ list << clp->hash();
+ }
+ return list;
+}
+
void Bin::slotSendAudioThumb(QString id)
{
ProjectClip *clip = m_rootFolder->clip(id);
diff --git a/src/bin/bin.h b/src/bin/bin.h
index 50b76da..a7db1ed 100644
--- a/src/bin/bin.h
+++ b/src/bin/bin.h
@@ -526,6 +526,8 @@ public:
/** @brief Command adding a bin clip */
bool addClip(QDomElement elem, const QString &clipId);
void rebuildProxies();
+ /** @brief Return a list of all clips hashes used in this project */
+ QStringList getProxyHashList();
private slots:
void slotAddClip();
diff --git a/src/doc/kdenlivedoc.cpp b/src/doc/kdenlivedoc.cpp
index 107ee6f..962b19d 100644
--- a/src/doc/kdenlivedoc.cpp
+++ b/src/doc/kdenlivedoc.cpp
@@ -330,7 +330,7 @@ int KdenliveDoc::setSceneList()
return -1;
}
pCore->bin()->isLoading = false;
-
+
bool ok = false;
QDir thumbsFolder = getCacheDir(CacheThumbs, &ok);
if (ok)
@@ -1276,16 +1276,12 @@ void KdenliveDoc::slotProxyCurrentItem(bool doProxy, QList<ProjectClip *> clipLi
if (!ok) {
// Error
}
- QString extension = getDocumentProperty(QStringLiteral("proxyextension"));
- QString proxyFolder;
+ QString extension = QStringLiteral(".") + getDocumentProperty(QStringLiteral("proxyextension"));
QString params = getDocumentProperty(QStringLiteral("proxyparams"));
if (params.contains(QStringLiteral("-s "))) {
- proxyFolder = params.section(QStringLiteral("-s "), 1).section(QStringLiteral("x"), 0, 0);
+ QString proxySize = params.section(QStringLiteral("-s "), 1).section(QStringLiteral("x"), 0, 0);
+ extension.prepend(QStringLiteral("-") + proxySize);
}
- proxyFolder.append(QStringLiteral("-") + extension);
- qDebug()<<" PXY FOLDER: "<<proxyFolder;
- dir.mkdir(proxyFolder);
- dir.cd(proxyFolder);
// Prepare updated properties
QMap <QString, QString> newProps;
@@ -1305,9 +1301,8 @@ void KdenliveDoc::slotProxyCurrentItem(bool doProxy, QList<ProjectClip *> clipLi
if (doProxy) {
newProps.clear();
- QString path = dir.absoluteFilePath(item->hash() + '.' + (t == Image ? QStringLiteral("png") : extension));
+ QString path = dir.absoluteFilePath(item->hash() + (t == Image ? QStringLiteral(".png") : extension));
// insert required duration for proxy
- qDebug()<<" PXY PATH: "<<path;
newProps.insert(QStringLiteral("proxy_out"), item->getProducerProperty(QStringLiteral("out")));
newProps.insert(QStringLiteral("kdenlive:proxy"), path);
}
@@ -1661,3 +1656,8 @@ QDir KdenliveDoc::getCacheDir(CacheType type, bool *ok) const
}
return dir;
}
+
+QStringList KdenliveDoc::getProxyHashList()
+{
+ return pCore->bin()->getProxyHashList();
+}
diff --git a/src/doc/kdenlivedoc.h b/src/doc/kdenlivedoc.h
index a75d874..a47fc4e 100644
--- a/src/doc/kdenlivedoc.h
+++ b/src/doc/kdenlivedoc.h
@@ -169,6 +169,8 @@ public:
QDir getCacheDir(CacheType type, bool *ok) const;
/** @brief Create standard cache dirs for the project */
void initCacheDirs();
+ /** @brief Get a list of all proxy hash used in this project */
+ QStringList getProxyHashList();
private:
QUrl m_url;
diff --git a/src/project/dialogs/temporarydata.cpp b/src/project/dialogs/temporarydata.cpp
index c1540e9..5ea0e0a 100644
--- a/src/project/dialogs/temporarydata.cpp
+++ b/src/project/dialogs/temporarydata.cpp
@@ -186,6 +186,10 @@ TemporaryData::TemporaryData(KdenliveDoc *doc, bool currentProjectOnly, QWidget
m_grid->addWidget(del, 5, 4);
m_currentPage->setLayout(m_grid);
+ m_proxies = m_doc->getProxyHashList();
+ for (int i = 0; i < m_proxies.count(); i++) {
+ m_proxies[i].append(QStringLiteral("*"));
+ }
if (currentProjectOnly) {
lay->addWidget(m_currentPage);
@@ -220,8 +224,13 @@ void TemporaryData::updateDataInfo()
preview = m_doc->getCacheDir(CacheProxy, &ok);
if (ok) {
- KIO::DirectorySizeJob *job = KIO::directorySize(QUrl::fromLocalFile(preview.absolutePath()));
- connect(job, &KIO::DirectorySizeJob::result, this, &TemporaryData::gotProxySize);
+ preview.setNameFilters(m_proxies);
+ QFileInfoList fList = preview.entryInfoList();
+ qint64 size = 0;
+ foreach(const QFileInfo &info, fList) {
+ size += info.size();
+ }
+ gotProxySize(size);
}
preview = m_doc->getCacheDir(CacheAudio, &ok);
@@ -234,6 +243,8 @@ void TemporaryData::updateDataInfo()
KIO::DirectorySizeJob *job = KIO::directorySize(QUrl::fromLocalFile(preview.absolutePath()));
connect(job, &KIO::DirectorySizeJob::result, this, &TemporaryData::gotThumbSize);
}
+ if (m_globalPage)
+ updateGlobalInfo();
}
void TemporaryData::gotPreviewSize(KJob *job)
@@ -253,13 +264,8 @@ void TemporaryData::gotPreviewSize(KJob *job)
updateTotal();
}
-void TemporaryData::gotProxySize(KJob *job)
+void TemporaryData::gotProxySize(qint64 total)
{
- KIO::DirectorySizeJob *sourceJob = static_cast<KIO::DirectorySizeJob *> (job);
- qulonglong total = sourceJob->totalSize();
- if (sourceJob->totalFiles() == 0) {
- total = 0;
- }
QLayoutItem *button = m_grid->itemAtPosition(1, 4);
if (button && button->widget()) {
button->widget()->setEnabled(total > 0);
@@ -344,18 +350,19 @@ void TemporaryData::deleteProxy()
{
bool ok = false;
QDir dir = m_doc->getCacheDir(CacheProxy, &ok);
- if (!ok) {
+ if (!ok || dir.dirName() != QLatin1String("proxy")) {
return;
}
- if (KMessageBox::warningContinueCancel(this, i18n("Delete all data in the cache proxy folder:\n%1", dir.absolutePath())) != KMessageBox::Continue) {
+ dir.setNameFilters(m_proxies);
+ QStringList files = dir.entryList(QDir::Files);
+ if (KMessageBox::warningContinueCancelList(this, i18n("Delete all project data in the cache proxy folder:\n%1", dir.absolutePath()), files) != KMessageBox::Continue) {
return;
}
- if (dir.dirName() == QLatin1String("proxy")) {
- dir.removeRecursively();
- dir.mkpath(".");
- emit disableProxies();
- updateDataInfo();
+ foreach(const QString &file, files) {
+ dir.remove(file);
}
+ emit disableProxies();
+ updateDataInfo();
}
void TemporaryData::deleteAudio()
@@ -467,7 +474,6 @@ void TemporaryData::buildGlobalCacheDialog(int minHeight)
lay->setColumnStretch(4, 10);
lay->setRowStretch(0, 10);
connect(m_listWidget, &QTreeWidget::itemSelectionChanged, this, &TemporaryData::refreshGlobalPie);
- updateGlobalInfo();
}
void TemporaryData::updateGlobalInfo()
diff --git a/src/project/dialogs/temporarydata.h b/src/project/dialogs/temporarydata.h
index 7a9d322..1c5c4be 100644
--- a/src/project/dialogs/temporarydata.h
+++ b/src/project/dialogs/temporarydata.h
@@ -112,6 +112,7 @@ private:
QStringList m_globalDirectories;
QString m_processingDirectory;
QDir m_globalDir;
+ QStringList m_proxies;
QPushButton *m_globalDelete;
void updateDataInfo();
void updateGlobalInfo();
@@ -121,7 +122,7 @@ private:
private slots:
void gotPreviewSize(KJob *job);
- void gotProxySize(KJob *job);
+ void gotProxySize(qint64 total);
void gotAudioSize(KJob *job);
void gotThumbSize(KJob *job);
void gotFolderSize(KJob *job);