X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fprojectsettings.cpp;h=0504ba827552e0af64caa4553c26606a192fec7d;hb=e74ed82c3ebc6b5b86106632f5dabdc524ac695a;hp=f4ca1a0c6b3ebe9675abebabca33361c5edbba31;hpb=20d4364a78e758384f8b16fc5a697566e3ea278a;p=kdenlive diff --git a/src/projectsettings.cpp b/src/projectsettings.cpp index f4ca1a0c..0504ba82 100644 --- a/src/projectsettings.cpp +++ b/src/projectsettings.cpp @@ -65,23 +65,66 @@ ProjectSettings::ProjectSettings(ProjectList *projectlist, QStringList lumas, in video_thumbs->setChecked(KdenliveSettings::videothumbnails()); audio_tracks->setValue(audiotracks); video_tracks->setValue(videotracks); - connect(enable_proxy, SIGNAL(toggled(bool)), proxy_box, SLOT(setEnabled(bool))); connect(generate_proxy, SIGNAL(toggled(bool)), proxy_minsize, SLOT(setEnabled(bool))); - + connect(generate_imageproxy, SIGNAL(toggled(bool)), proxy_imageminsize, SLOT(setEnabled(bool))); + QString proxyparameters; + QString proxyextension; if (projectlist) { - enable_proxy->setChecked(projectlist->useProxy()); - generate_proxy->setChecked(projectlist->generateProxy()); - proxy_minsize->setValue(projectlist->proxyMinSize()); - proxy_params->setText(projectlist->proxyParams()); - proxy_box->setEnabled(projectlist->useProxy()); + enable_proxy->setChecked(projectlist->getDocumentProperty("enableproxy").toInt()); + generate_proxy->setChecked(projectlist->getDocumentProperty("generateproxy").toInt()); + proxy_minsize->setValue(projectlist->getDocumentProperty("proxyminsize").toInt()); + proxyparameters = projectlist->getDocumentProperty("proxyparams"); + generate_imageproxy->setChecked(projectlist->getDocumentProperty("generateimageproxy").toInt()); + proxy_imageminsize->setValue(projectlist->getDocumentProperty("proxyimageminsize").toInt()); + proxyextension = projectlist->getDocumentProperty("proxyextension"); } else { enable_proxy->setChecked(KdenliveSettings::enableproxy()); - generate_proxy->setChecked(KdenliveSettings::enableproxy()); - proxy_minsize->setValue(1000); - proxy_params->setText(KdenliveSettings::proxyparams()); - proxy_box->setEnabled(KdenliveSettings::enableproxy()); + generate_proxy->setChecked(KdenliveSettings::generateproxy()); + proxy_minsize->setValue(KdenliveSettings::proxyminsize()); + proxyparameters = KdenliveSettings::proxyparams(); + generate_imageproxy->setChecked(KdenliveSettings::generateimageproxy()); + proxy_imageminsize->setValue(KdenliveSettings::proxyimageminsize()); + proxyextension = KdenliveSettings::proxyextension(); + } + + proxy_minsize->setEnabled(generate_proxy->isChecked()); + proxy_imageminsize->setEnabled(generate_imageproxy->isChecked()); + + + // load proxy profiles + KConfig conf("encodingprofiles.rc", KConfig::FullConfig, "appdata"); + KConfigGroup group(&conf, "proxy"); + QMap values = group.entryMap(); + QMapIterator k(values); + int ix = -1; + while (k.hasNext()) { + k.next(); + if (!k.key().isEmpty()) { + QString params = k.value().section(';', 0, 0); + QString extension = k.value().section(';', 1, 1); + if (ix == -1 && ((params == proxyparameters && extension == proxyextension) || (proxyparameters.isEmpty() || proxyextension.isEmpty()))) { + // this is the current profile + ix = proxy_profile->count(); + } + proxy_profile->addItem(k.key(), k.value()); + } + } + if (ix == -1) { + // Current project proxy settings not found + ix = proxy_profile->count(); + proxy_profile->addItem(i18n("Current Settings"), QString(proxyparameters + ';' + proxyextension)); + } + proxy_profile->setCurrentIndex(ix); + slotUpdateProxyParams(); + + // Proxy GUI stuff + proxy_showprofileinfo->setIcon(KIcon("help-about")); + connect(proxy_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateProxyParams())); + proxyparams->setVisible(false); + proxyparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5); + connect(proxy_showprofileinfo, SIGNAL(clicked(bool)), proxyparams, SLOT(setVisible(bool))); if (readOnlyTracks) { video_tracks->setEnabled(false); @@ -92,6 +135,7 @@ ProjectSettings::ProjectSettings(ProjectList *projectlist, QStringList lumas, in slotUpdateFiles(); connect(clear_cache, SIGNAL(clicked()), this, SLOT(slotClearCache())); connect(delete_unused, SIGNAL(clicked()), this, SLOT(slotDeleteUnused())); + connect(delete_proxies, SIGNAL(clicked()), this, SLOT(slotDeleteProxies())); } else tabWidget->widget(1)->setEnabled(false); connect(profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay())); connect(project_folder, SIGNAL(textChanged(const QString &)), this, SLOT(slotUpdateButton(const QString &))); @@ -140,12 +184,28 @@ void ProjectSettings::slotClearCache() slotUpdateFiles(true); } +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/"); + 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; @@ -157,7 +217,7 @@ void ProjectSettings::slotUpdateFiles(bool cacheOnly) // 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, files used for LADSPA effects? + // TODO: images used in luma transitions? // Setup categories QTreeWidgetItem *videos = new QTreeWidgetItem(files_list, QStringList() << i18n("Video clips")); @@ -238,9 +298,7 @@ void ProjectSettings::slotUpdateFiles(bool cacheOnly) usedSize += clip->fileSize(); } } -#if QT_VERSION >= 0x040500 allFonts.removeDuplicates(); -#endif // Hide unused categories for (int i = 0; i < files_list->topLevelItemCount(); i++) { if (files_list->topLevelItem(i)->childCount() == 0) { @@ -269,6 +327,7 @@ void ProjectSettings::accept() void ProjectSettings::slotUpdateDisplay() { + QLocale locale; QString currentProfile = profiles_list->itemData(profiles_list->currentIndex()).toString(); QMap< QString, QString > values = ProfilesDialog::getSettingsFromFile(currentProfile); p_size->setText(values.value("width") + 'x' + values.value("height")); @@ -277,7 +336,7 @@ void ProjectSettings::slotUpdateDisplay() p_display->setText(values.value("display_aspect_num") + '/' + values.value("display_aspect_den")); if (values.value("progressive").toInt() == 0) { p_progressive->setText(i18n("Interlaced (%1 fields per second)", - QString::number((double)2 * values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2))); + locale.toString((double)2 * values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2))); } else { p_progressive->setText(i18n("Progressive")); } @@ -331,14 +390,31 @@ bool ProjectSettings::generateProxy() const return generate_proxy->isChecked(); } +bool ProjectSettings::generateImageProxy() const +{ + return generate_imageproxy->isChecked(); +} + int ProjectSettings::proxyMinSize() const { return proxy_minsize->value(); } +int ProjectSettings::proxyImageMinSize() const +{ + return proxy_imageminsize->value(); +} + QString ProjectSettings::proxyParams() const { - return proxy_params->toPlainText(); + QString params = proxy_profile->itemData(proxy_profile->currentIndex()).toString(); + return params.section(';', 0, 0); +} + +QString ProjectSettings::proxyExtension() const +{ + QString params = proxy_profile->itemData(proxy_profile->currentIndex()).toString(); + return params.section(';', 1, 1); } //static @@ -454,7 +530,11 @@ void ProjectSettings::slotExportToText() KIO::NetAccess::upload(tmpfile.fileName(), savePath, 0); } - +void ProjectSettings::slotUpdateProxyParams() +{ + QString params = proxy_profile->itemData(proxy_profile->currentIndex()).toString(); + proxyparams->setPlainText(params.section(';', 0, 0)); +} #include "projectsettings.moc"