X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fprojectsettings.cpp;h=39e0a4c7b963c27388c44e0375efd1c0b74edbc8;hb=5656bd3de057eaaa103f921348d4e62eeeb968d5;hp=a12eeab42bb851f2348c6a1e47603e5682ae7934;hpb=ade7290445e275aca81bb280012a0b3c90b7f959;p=kdenlive diff --git a/src/projectsettings.cpp b/src/projectsettings.cpp index a12eeab4..39e0a4c7 100644 --- a/src/projectsettings.cpp +++ b/src/projectsettings.cpp @@ -65,29 +65,67 @@ 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 + QString profileFile = KStandardDirs::locateLocal("appdata", "encodingprofiles.rc"); + KConfig conf(profileFile, KConfig::SimpleConfig); + 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 (params == proxyparameters && extension == proxyextension) { + // 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); @@ -149,8 +187,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); @@ -178,7 +218,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")); @@ -290,6 +330,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")); @@ -298,7 +339,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")); } @@ -369,12 +410,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 @@ -490,7 +533,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"