X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fprojectsettings.cpp;h=0504ba827552e0af64caa4553c26606a192fec7d;hb=14ca746a71f42aaf144c44f59aec2140e87f3915;hp=d6762537ec43cfa74e62754371eaf37b564927af;hpb=5a0c47a5868ec91b6747f306e84d92f7ecdf4f99;p=kdenlive diff --git a/src/projectsettings.cpp b/src/projectsettings.cpp index d6762537..0504ba82 100644 --- a/src/projectsettings.cpp +++ b/src/projectsettings.cpp @@ -65,32 +65,66 @@ ProjectSettings::ProjectSettings(ProjectList *projectlist, QStringList lumas, in video_thumbs->setChecked(KdenliveSettings::videothumbnails()); audio_tracks->setValue(audiotracks); video_tracks->setValue(videotracks); - proxy_params->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5); 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->getDocumentProperty("enableproxy").toInt()); generate_proxy->setChecked(projectlist->getDocumentProperty("generateproxy").toInt()); proxy_minsize->setValue(projectlist->getDocumentProperty("proxyminsize").toInt()); - proxy_params->setPlainText(projectlist->getDocumentProperty("proxyparams")); + proxyparameters = projectlist->getDocumentProperty("proxyparams"); generate_imageproxy->setChecked(projectlist->getDocumentProperty("generateimageproxy").toInt()); proxy_imageminsize->setValue(projectlist->getDocumentProperty("proxyimageminsize").toInt()); - proxy_extension->setText(projectlist->getDocumentProperty("proxyextension")); + proxyextension = projectlist->getDocumentProperty("proxyextension"); } else { enable_proxy->setChecked(KdenliveSettings::enableproxy()); generate_proxy->setChecked(KdenliveSettings::generateproxy()); proxy_minsize->setValue(KdenliveSettings::proxyminsize()); - proxy_params->setPlainText(KdenliveSettings::proxyparams()); + proxyparameters = KdenliveSettings::proxyparams(); generate_imageproxy->setChecked(KdenliveSettings::generateimageproxy()); proxy_imageminsize->setValue(KdenliveSettings::proxyimageminsize()); - proxy_extension->setText(KdenliveSettings::proxyextension()); + 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); @@ -152,8 +186,10 @@ void ProjectSettings::slotClearCache() 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); @@ -181,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")); @@ -262,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) { @@ -293,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")); @@ -301,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")); } @@ -372,12 +407,14 @@ int ProjectSettings::proxyImageMinSize() const 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 { - return proxy_extension->text(); + QString params = proxy_profile->itemData(proxy_profile->currentIndex()).toString(); + return params.section(';', 1, 1); } //static @@ -493,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"