X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fprojectsettings.cpp;h=39e0a4c7b963c27388c44e0375efd1c0b74edbc8;hb=c6f581eb95db46086221714f84f7fd56a3e8153b;hp=51e8a461632c76a2046ae09f93b99d08dc7710c1;hpb=026a8436a56ccd5ee715de50d43ec699edf0456d;p=kdenlive diff --git a/src/projectsettings.cpp b/src/projectsettings.cpp index 51e8a461..39e0a4c7 100644 --- a/src/projectsettings.cpp +++ b/src/projectsettings.cpp @@ -65,7 +65,68 @@ ProjectSettings::ProjectSettings(ProjectList *projectlist, QStringList lumas, in video_thumbs->setChecked(KdenliveSettings::videothumbnails()); audio_tracks->setValue(audiotracks); video_tracks->setValue(videotracks); + 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()); + 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::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 + 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); audio_tracks->setEnabled(false); @@ -75,6 +136,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 &))); @@ -123,12 +185,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; @@ -140,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")); @@ -252,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")); @@ -260,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")); } @@ -304,6 +383,42 @@ bool ProjectSettings::enableAudioThumbs() const return audio_thumbs->isChecked(); } +bool ProjectSettings::useProxy() const +{ + return enable_proxy->isChecked(); +} + +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 +{ + 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 QStringList ProjectSettings::extractPlaylistUrls(QString path) @@ -368,7 +483,7 @@ QStringList ProjectSettings::extractSlideshowUrls(KUrl url) filters << "*." + ext; dir.setNameFilters(filters); QStringList result = dir.entryList(QDir::Files); - urls.append(path + filters.at(0) + " (" + i18n("%1 images found", result.count()) + ")"); + urls.append(path + filters.at(0) + " (" + i18np("1 image found", "%1 images found", result.count()) + ")"); } else { // this is a pattern slideshow, like sequence%4d.jpg QString filter = url.fileName(); @@ -381,7 +496,7 @@ QStringList ProjectSettings::extractSlideshowUrls(KUrl url) foreach(const QString & path, result) { if (rx.exactMatch(path)) count++; } - urls.append(url.path() + " (" + i18n("%1 images found", count) + ")"); + urls.append(url.path() + " (" + i18np("1 image found", "%1 images found", count) + ")"); } return urls; } @@ -418,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"