X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Farchivewidget.cpp;h=19f28437288d30a6a2a8702dd22352ce605b807f;hb=e5bed1802f629406c47711f2a6e26f7c0286b11f;hp=6dc3cda02f286d6f9bc7c546f261c027cee9711a;hpb=3f578497a9945693a9806ef8a3a9e79c341b65c3;p=kdenlive diff --git a/src/archivewidget.cpp b/src/archivewidget.cpp index 6dc3cda0..19f28437 100644 --- a/src/archivewidget.cpp +++ b/src/archivewidget.cpp @@ -197,7 +197,7 @@ ArchiveWidget::ArchiveWidget(QString projectName, QDomDocument doc, QList setText(0, files_list->topLevelItem(i)->text(0) + " " + i18np("(%1 item)", "(%1 items)", items)); + parentItem->setText(0, files_list->topLevelItem(i)->text(0) + ' ' + i18np("(%1 item)", "(%1 items)", items)); } } if (m_name.isEmpty()) m_name = i18n("Untitled"); @@ -223,6 +223,7 @@ ArchiveWidget::ArchiveWidget(const KUrl &url, QWidget * parent): connect(this, SIGNAL(showMessage(const QString &, const QString &)), this, SLOT(slotDisplayMessage(const QString &, const QString &))); compressed_archive->setHidden(true); + proxy_only->setHidden(true); project_files->setHidden(true); files_list->setHidden(true); label->setText(i18n("Extract to")); @@ -355,7 +356,7 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, QStringList items QString filter = slideUrl.fileName(); QString ext = filter.section('.', -1); filter = filter.section('%', 0, -2); - QString regexp = "^" + filter + "\\d+\\." + ext + "$"; + QString regexp = '^' + filter + "\\d+\\." + ext + '$'; QRegExp rx(regexp); QStringList slideImages; QString directory = dir.absolutePath(); @@ -375,10 +376,10 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, QStringList items else if (filesList.contains(fileName)) { // we have 2 files with same name int ix = 0; - QString newFileName = fileName.section('.', 0, -2) + "_" + QString::number(ix) + "." + fileName.section('.', -1); + QString newFileName = fileName.section('.', 0, -2) + '_' + QString::number(ix) + '.' + fileName.section('.', -1); while (filesList.contains(newFileName)) { ix ++; - newFileName = fileName.section('.', 0, -2) + "_" + QString::number(ix) + "." + fileName.section('.', -1); + newFileName = fileName.section('.', 0, -2) + '_' + QString::number(ix) + '.' + fileName.section('.', -1); } fileName = newFileName; item->setData(0, Qt::UserRole, fileName); @@ -441,7 +442,7 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, QMap topLevelItemCount(); i++) { parentItem = files_list->topLevelItem(i); if (parentItem->isDisabled()) { @@ -547,15 +548,16 @@ bool ArchiveWidget::slotStartArchiving(bool firstPass) else isSlideshow = false; files_list->setCurrentItem(parentItem); parentItem->setExpanded(true); - destPath = parentItem->data(0, Qt::UserRole).toString() + "/"; + destPath = parentItem->data(0, Qt::UserRole).toString() + '/'; destUrl = KUrl(archive_url->url().path(KUrl::AddTrailingSlash) + destPath); QTreeWidgetItem *item; for (int j = 0; j < parentItem->childCount(); j++) { item = parentItem->child(j); if (item->isDisabled()) continue; // Special case: slideshows + items++; if (isSlideshow) { - destPath += item->data(0, Qt::UserRole).toString() + "/"; + destPath += item->data(0, Qt::UserRole).toString() + '/'; destUrl = KUrl(archive_url->url().path(KUrl::AddTrailingSlash) + destPath); QStringList srcFiles = item->data(0, Qt::UserRole + 1).toStringList(); for (int k = 0; k < srcFiles.count(); k++) { @@ -585,6 +587,12 @@ bool ArchiveWidget::slotStartArchiving(bool firstPass) } } + if (items == 0) { + // No clips to archive + slotArchivingFinished(NULL, true); + return true; + } + if (destPath.isEmpty()) { if (m_duplicateFiles.isEmpty()) return false; QMapIterator i(m_duplicateFiles); @@ -623,10 +631,10 @@ bool ArchiveWidget::slotStartArchiving(bool firstPass) return true; } -void ArchiveWidget::slotArchivingFinished(KJob *job) +void ArchiveWidget::slotArchivingFinished(KJob *job, bool finished) { if (job == NULL || job->error() == 0) { - if (slotStartArchiving(false)) { + if (!finished && slotStartArchiving(false)) { // We still have files to archive return; } @@ -680,7 +688,7 @@ bool ArchiveWidget::processProjectFile() KUrl src(item->text(0)); KUrl dest = destUrl; if (isSlideshow) { - dest = KUrl(destUrl.path(KUrl::AddTrailingSlash) + item->data(0, Qt::UserRole).toString() + "/" + src.fileName()); + dest = KUrl(destUrl.path(KUrl::AddTrailingSlash) + item->data(0, Qt::UserRole).toString() + '/' + src.fileName()); } else if (item->data(0, Qt::UserRole).isNull()) { dest.addPath(src.fileName()); @@ -694,7 +702,7 @@ bool ArchiveWidget::processProjectFile() } QDomElement mlt = m_doc.documentElement(); - QString root = mlt.attribute("root") + "/"; + QString root = mlt.attribute("root") + '/'; // Adjust global settings QString basePath; @@ -760,8 +768,8 @@ bool ArchiveWidget::processProjectFile() QString endString("\""); endString.append(basePath); playList.replace(startString, endString); - startString = ">" + archive_url->url().path(KUrl::RemoveTrailingSlash); - endString = ">" + basePath; + startString = '>' + archive_url->url().path(KUrl::RemoveTrailingSlash); + endString = '>' + basePath; playList.replace(startString, endString); } @@ -905,7 +913,7 @@ void ArchiveWidget::slotExtractingFinished() error = true; } else { - QString playList = file.readAll(); + QString playList = QString::fromUtf8(file.readAll()); file.close(); if (playList.isEmpty()) { error = true; @@ -996,7 +1004,7 @@ void ArchiveWidget::slotProxyOnly(int onlyProxy) itemsCount ++; } } - parentItem->setText(0, parentItem->text(0).section("(", 0, 0) + i18np("(%1 item)", "(%1 items)", itemsCount)); + parentItem->setText(0, parentItem->text(0).section('(', 0, 0) + i18np("(%1 item)", "(%1 items)", itemsCount)); } project_files->setText(i18np("%1 file to archive, requires %2", "%1 files to archive, requires %2", total, KIO::convertSize(m_requestedSize))); slotCheckSpace();