]> git.sesse.net Git - kdenlive/blobdiff - src/archivewidget.cpp
Const'ref
[kdenlive] / src / archivewidget.cpp
index 14ef2b75d9860e4258c6e78e5b83ecbbd6d6f44e..a645172e5a9efe19f83a28dc7423d5a5f6d353c4 100644 (file)
@@ -281,7 +281,7 @@ void ArchiveWidget::openArchiveForExtraction()
     // Check that it is a kdenlive project archive
     bool isProjectArchive = false;
     QStringList files = m_extractArchive->directory()->entries();
-    for (int i = 0; i < files.count(); i++) {
+    for (int i = 0; i < files.count(); ++i) {
         if (files.at(i).endsWith(".kdenlive")) {
             m_projectName = files.at(i);
             isProjectArchive = true;
@@ -325,7 +325,7 @@ bool ArchiveWidget::closeAccepted()
 }
 
 
-void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, QStringList items)
+void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, const QStringList& items)
 {
     QStringList filesList;
     QString fileName;
@@ -343,14 +343,13 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, QStringList items
             if (slideUrl.fileName().startsWith(".all.")) {
                 // mimetype slideshow (for example *.png)
                     QStringList filters;
-                    QString extension;
                     // TODO: improve jpeg image detection with extension like jpeg, requires change in MLT image producers
                     filters << "*." + slideUrl.fileName().section('.', -1);
                     dir.setNameFilters(filters);
                     QFileInfoList resultList = dir.entryInfoList(QDir::Files);
                     QStringList slideImages;
                     qint64 totalSize = 0;
-                    for (int i = 0; i < resultList.count(); i++) {
+                    for (int i = 0; i < resultList.count(); ++i) {
                         totalSize += resultList.at(i).size();
                         slideImages << resultList.at(i).absoluteFilePath();
                     }
@@ -435,7 +434,7 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, const QMap <QStri
                     QFileInfoList resultList = dir.entryInfoList(QDir::Files);
                     QStringList slideImages;
                     qint64 totalSize = 0;
-                    for (int i = 0; i < resultList.count(); i++) {
+                    for (int i = 0; i < resultList.count(); ++i) {
                         totalSize += resultList.at(i).size();
                         slideImages << resultList.at(i).absoluteFilePath();
                     }
@@ -539,7 +538,7 @@ bool ArchiveWidget::slotStartArchiving(bool firstPass)
     int items = 0;
     
     // We parse all files going into one folder, then start the copy job
-    for (int i = 0; i < files_list->topLevelItemCount(); i++) {
+    for (int i = 0; i < files_list->topLevelItemCount(); ++i) {
         parentItem = files_list->topLevelItem(i);
         if (parentItem->isDisabled()) {
             parentItem->setExpanded(false);
@@ -617,7 +616,7 @@ bool ArchiveWidget::slotStartArchiving(bool firstPass)
 
     if (isArchive) {
         m_foldersList.append(destPath);
-        for (int i = 0; i < files.count(); i++) {
+        for (int i = 0; i < files.count(); ++i) {
             m_filesList.insert(files.at(i).path(), destPath + files.at(i).fileName());
         }
         slotArchivingFinished();
@@ -665,7 +664,7 @@ void ArchiveWidget::slotArchivingFinished(KJob *job, bool finished)
         archive_url->setEnabled(true);
         proxy_only->setEnabled(true);
         compressed_archive->setEnabled(true);
-        for (int i = 0; i < files_list->topLevelItemCount(); i++) {
+        for (int i = 0; i < files_list->topLevelItemCount(); ++i) {
             files_list->topLevelItem(i)->setDisabled(false);
             for (int j = 0; j < files_list->topLevelItem(i)->childCount(); j++)
                 files_list->topLevelItem(i)->child(j)->setDisabled(false);        
@@ -685,7 +684,7 @@ bool ArchiveWidget::processProjectFile()
     QTreeWidgetItem *item;
     bool isArchive = compressed_archive->isChecked();
 
-    for (int i = 0; i < files_list->topLevelItemCount(); i++) {
+    for (int i = 0; i < files_list->topLevelItemCount(); ++i) {
         QTreeWidgetItem *parentItem = files_list->topLevelItem(i);
         if (parentItem->childCount() > 0) {
             destUrl = KUrl(archive_url->url().path(KUrl::AddTrailingSlash) + parentItem->data(0, Qt::UserRole).toString());
@@ -721,7 +720,7 @@ bool ArchiveWidget::processProjectFile()
 
     // process kdenlive producers
     QDomNodeList prods = mlt.elementsByTagName("kdenlive_producer");
-    for (int i = 0; i < prods.count(); i++) {
+    for (int i = 0; i < prods.count(); ++i) {
         QDomElement e = prods.item(i).toElement();
         if (e.isNull()) continue;
         if (e.hasAttribute("resource")) {
@@ -738,7 +737,7 @@ bool ArchiveWidget::processProjectFile()
 
     // process mlt producers
     prods = mlt.elementsByTagName("producer");
-    for (int i = 0; i < prods.count(); i++) {
+    for (int i = 0; i < prods.count(); ++i) {
         QDomElement e = prods.item(i).toElement();
         if (e.isNull()) continue;
         QString src = EffectsList::property(e, "resource");
@@ -753,7 +752,7 @@ bool ArchiveWidget::processProjectFile()
     // process mlt transitions (for luma files)
     prods = mlt.elementsByTagName("transition");
     QString attribute;
-    for (int i = 0; i < prods.count(); i++) {
+    for (int i = 0; i < prods.count(); ++i) {
         QDomElement e = prods.item(i).toElement();
         if (e.isNull()) continue;
         attribute = "resource";
@@ -833,9 +832,10 @@ void ArchiveWidget::createArchive()
     // Add project file
     bool result = false;
     if (m_temp) {
-       archive.addLocalFile(m_temp->fileName(), m_name + ".kdenlive");
-       result = archive.close();
-       delete m_temp;
+        archive.addLocalFile(m_temp->fileName(), m_name + ".kdenlive");
+        result = archive.close();
+        delete m_temp;
+        m_temp = 0;
     }
     emit archivingFinished(result);
 }
@@ -854,7 +854,7 @@ void ArchiveWidget::slotArchivingFinished(bool result)
     archive_url->setEnabled(true);
     proxy_only->setEnabled(true);
     compressed_archive->setEnabled(true);
-    for (int i = 0; i < files_list->topLevelItemCount(); i++) {
+    for (int i = 0; i < files_list->topLevelItemCount(); ++i) {
         files_list->topLevelItem(i)->setDisabled(false);
         for (int j = 0; j < files_list->topLevelItem(i)->childCount(); j++)
             files_list->topLevelItem(i)->child(j)->setDisabled(false);
@@ -903,7 +903,7 @@ void ArchiveWidget::doExtracting()
     emit extractingFinished();    
 }
 
-QString ArchiveWidget::extractedProjectFile()
+QString ArchiveWidget::extractedProjectFile() const
 {
     return archive_url->url().path(KUrl::AddTrailingSlash) + m_projectName;
 }
@@ -954,7 +954,7 @@ void ArchiveWidget::slotProxyOnly(int onlyProxy)
         QTreeWidgetItem *parentItem = NULL;
 
         // Build list of existing proxy ids
-        for (int i = 0; i < files_list->topLevelItemCount(); i++) {
+        for (int i = 0; i < files_list->topLevelItemCount(); ++i) {
             parentItem = files_list->topLevelItem(i);
             if (parentItem->data(0, Qt::UserRole).toString() == "proxy") break;
         }
@@ -965,7 +965,7 @@ void ArchiveWidget::slotProxyOnly(int onlyProxy)
         }
         
         // Parse all items to disable original clips for existing proxies
-        for (int i = 0; i < proxyIdList.count(); i++) {
+        for (int i = 0; i < proxyIdList.count(); ++i) {
             QString id = proxyIdList.at(i);
             if (id.isEmpty()) continue;
             for (int j = 0; j < files_list->topLevelItemCount(); j++) {
@@ -984,7 +984,7 @@ void ArchiveWidget::slotProxyOnly(int onlyProxy)
     }
     else {
         // Archive all clips
-        for (int i = 0; i < files_list->topLevelItemCount(); i++) {
+        for (int i = 0; i < files_list->topLevelItemCount(); ++i) {
             QTreeWidgetItem *parentItem = files_list->topLevelItem(i);
             int items = parentItem->childCount();
             for (int j = 0; j < items; j++) {
@@ -995,7 +995,7 @@ void ArchiveWidget::slotProxyOnly(int onlyProxy)
     
     // Calculate requested size
     int total = 0;
-    for (int i = 0; i < files_list->topLevelItemCount(); i++) {
+    for (int i = 0; i < files_list->topLevelItemCount(); ++i) {
         QTreeWidgetItem *parentItem = files_list->topLevelItem(i);
         int items = parentItem->childCount();
         int itemsCount = 0;
@@ -1015,3 +1015,5 @@ void ArchiveWidget::slotProxyOnly(int onlyProxy)
     slotCheckSpace();
 }
 
+
+#include "archivewidget.moc"