+void ProjectSettings::slotDeleteProxies()
+{
+ if (KMessageBox::warningContinueCancel(this, i18n("Deleting proxy clips will disable proxies for this project.")) != KMessageBox::Continue) return;
+ buttonBox->setEnabled(false);
+ enable_proxy->setChecked(false);
+ emit disableProxies();
+ KIO::NetAccess::del(KUrl(project_folder->url().path(KUrl::AddTrailingSlash) + "proxy/"), this);
+ KStandardDirs::makeDir(project_folder->url().path(KUrl::AddTrailingSlash) + "proxy/");
+ buttonBox->setEnabled(true);
+ slotUpdateFiles(true);
+}
+
+void ProjectSettings::slotUpdateFiles(bool cacheOnly)
+{
+ KIO::DirectorySizeJob *job = KIO::directorySize(project_folder->url().path(KUrl::AddTrailingSlash) + "thumbs/");
+ job->exec();
+ thumbs_count->setText(QString::number(job->totalFiles()));
+ thumbs_size->setText(KIO::convertSize(job->totalSize()));
+ job = KIO::directorySize(project_folder->url().path(KUrl::AddTrailingSlash) + "proxy/");
+ job->exec();
+ proxy_count->setText(QString::number(job->totalFiles()));
+ proxy_size->setText(KIO::convertSize(job->totalSize()));
+ delete job;
+ if (cacheOnly) return;
+ int unused = 0;
+ int used = 0;
+ KIO::filesize_t usedSize = 0;
+ KIO::filesize_t unUsedSize = 0;
+ QList <DocClipBase*> list = m_projectList->documentClipList();
+ files_list->clear();
+
+ // List all files that are used in the project. That also means:
+ // images included in slideshow and titles, files in playlist clips
+ // TODO: images used in luma transitions?
+
+ // Setup categories
+ QTreeWidgetItem *videos = new QTreeWidgetItem(files_list, QStringList() << i18n("Video clips"));
+ videos->setIcon(0, KIcon("video-x-generic"));
+ videos->setExpanded(true);
+ QTreeWidgetItem *sounds = new QTreeWidgetItem(files_list, QStringList() << i18n("Audio clips"));
+ sounds->setIcon(0, KIcon("audio-x-generic"));
+ sounds->setExpanded(true);
+ QTreeWidgetItem *images = new QTreeWidgetItem(files_list, QStringList() << i18n("Image clips"));
+ images->setIcon(0, KIcon("image-x-generic"));
+ images->setExpanded(true);
+ QTreeWidgetItem *slideshows = new QTreeWidgetItem(files_list, QStringList() << i18n("Slideshow clips"));
+ slideshows->setIcon(0, KIcon("image-x-generic"));
+ slideshows->setExpanded(true);
+ QTreeWidgetItem *texts = new QTreeWidgetItem(files_list, QStringList() << i18n("Text clips"));
+ texts->setIcon(0, KIcon("text-plain"));
+ texts->setExpanded(true);
+ QTreeWidgetItem *others = new QTreeWidgetItem(files_list, QStringList() << i18n("Other clips"));
+ others->setIcon(0, KIcon("unknown"));
+ others->setExpanded(true);
+ int count = 0;
+ QStringList allFonts;
+ foreach(const QString & file, m_lumas) {
+ count++;
+ new QTreeWidgetItem(images, QStringList() << file);
+ }
+
+ for (int i = 0; i < list.count(); i++) {
+ DocClipBase *clip = list.at(i);
+ if (clip->clipType() == SLIDESHOW) {
+ QStringList subfiles = extractSlideshowUrls(clip->fileURL());
+ foreach(const QString & file, subfiles) {
+ count++;
+ new QTreeWidgetItem(slideshows, QStringList() << file);
+ }
+ } else if (!clip->fileURL().isEmpty()) {
+ //allFiles.append(clip->fileURL().path());
+ switch (clip->clipType()) {
+ case TEXT:
+ new QTreeWidgetItem(texts, QStringList() << clip->fileURL().path());
+ break;
+ case AUDIO:
+ new QTreeWidgetItem(sounds, QStringList() << clip->fileURL().path());
+ break;
+ case IMAGE:
+ new QTreeWidgetItem(images, QStringList() << clip->fileURL().path());
+ break;
+ case UNKNOWN:
+ new QTreeWidgetItem(others, QStringList() << clip->fileURL().path());
+ break;
+ default:
+ new QTreeWidgetItem(videos, QStringList() << clip->fileURL().path());
+ break;
+ }
+ count++;
+ }
+ if (clip->clipType() == TEXT) {
+ QStringList imagefiles = TitleWidget::extractImageList(clip->getProperty("xmldata"));
+ QStringList fonts = TitleWidget::extractFontList(clip->getProperty("xmldata"));
+ foreach(const QString & file, imagefiles) {
+ count++;
+ new QTreeWidgetItem(images, QStringList() << file);
+ }
+ allFonts << fonts;
+ } else if (clip->clipType() == PLAYLIST) {
+ QStringList files = extractPlaylistUrls(clip->fileURL().path());
+ foreach(const QString & file, files) {
+ count++;
+ new QTreeWidgetItem(others, QStringList() << file);
+ }
+ }
+
+ if (clip->numReferences() == 0) {
+ unused++;
+ unUsedSize += clip->fileSize();
+ } else {
+ used++;
+ usedSize += clip->fileSize();
+ }
+ }
+ allFonts.removeDuplicates();
+ // Hide unused categories
+ for (int i = 0; i < files_list->topLevelItemCount(); i++) {
+ if (files_list->topLevelItem(i)->childCount() == 0) {
+ files_list->topLevelItem(i)->setHidden(true);
+ }
+ }
+ files_count->setText(QString::number(count));
+ fonts_list->addItems(allFonts);
+ if (allFonts.isEmpty()) {
+ fonts_list->setHidden(true);
+ label_fonts->setHidden(true);
+ }
+ used_count->setText(QString::number(used));
+ used_size->setText(KIO::convertSize(usedSize));
+ unused_count->setText(QString::number(unused));
+ unused_size->setText(KIO::convertSize(unUsedSize));
+ delete_unused->setEnabled(unused > 0);
+}
+
+void ProjectSettings::accept()
+{
+ if (!m_savedProject && selectedProfile() != KdenliveSettings::current_profile())
+ if (KMessageBox::warningContinueCancel(this, i18n("Changing the profile of your project cannot be undone.\nIt is recommended to save your project before attempting this operation that might cause some corruption in transitions.\n Are you sure you want to proceed?"), i18n("Confirm profile change")) == KMessageBox::Cancel) return;
+ QDialog::accept();
+}