#include "renderwidget.h"
#include "kdenlivesettings.h"
#include "ui_saveprofile_ui.h"
+#include "timecode.h"
#include <KStandardDirs>
#include <KDebug>
void RenderWidget::setDocumentPath(const QString path)
{
+ if (m_view.out_file->url().directory() == KUrl(m_projectFolder).directory()) {
+ const QString fileName = m_view.out_file->url().fileName();
+ m_view.out_file->setUrl(KUrl(path + fileName));
+ }
m_projectFolder = path;
- const QString fileName = m_view.out_file->url().fileName();
- m_view.out_file->setUrl(KUrl(m_projectFolder + fileName));
parseScriptFiles();
+
}
void RenderWidget::slotUpdateGuideBox()
m_view.render_guide->setEnabled(false);
m_view.create_chapter->setEnabled(false);
}
+ double fps = (double) m_profile.frame_rate_num / m_profile.frame_rate_den;
for (int i = 0; i < nodes.count(); i++) {
QDomElement e = nodes.item(i).toElement();
if (!e.isNull()) {
- m_view.guide_start->addItem(e.attribute("comment"), e.attribute("time").toDouble());
- m_view.guide_end->addItem(e.attribute("comment"), e.attribute("time").toDouble());
+ GenTime pos = GenTime(e.attribute("time").toDouble());
+ const QString guidePos = Timecode::getStringTimecode(pos.frames(fps), fps);
+ m_view.guide_start->addItem(e.attribute("comment") + '/' + guidePos, e.attribute("time").toDouble());
+ m_view.guide_end->addItem(e.attribute("comment") + '/' + guidePos, e.attribute("time").toDouble());
}
}
if (nodes.count() > 0)
KMessageBox::sorry(this, i18n("Cannot play video after rendering because the default video player application is not set.\nPlease define it in Kdenlive settings dialog."));
QString chapterFile;
if (m_view.create_chapter->isChecked()) chapterFile = m_view.out_file->url().path() + ".dvdchapter";
+
+ // mantisbt 1051
+ KStandardDirs::makeDir(m_view.out_file->url().directory());
+
emit prepareRenderingData(scriptExport, m_view.render_zone->isChecked(), chapterFile);
}
// Check whether target file has an extension.
// If not, ask whether extension should be added or not.
QString extension = item->data(ExtensionRole).toString();
- if (!dest.endsWith(extension)) {
+ if (!dest.endsWith(extension, Qt::CaseInsensitive)) {
if (KMessageBox::questionYesNo(this, i18n("File has no extension. Add extension (%1)?", extension)) == KMessageBox::Yes) {
dest.append("." + extension);
}
render_process_args << "in=" + QString::number(GenTime(guideStart).frames(fps)) << "out=" + QString::number(GenTime(guideEnd).frames(fps));
}
- render_process_args << overlayargs;
+ if (!overlayargs.isEmpty()) render_process_args << "preargs=" + overlayargs.join(" ");
+
render_process_args << KdenliveSettings::rendererpath() << m_profile.path << item->data(RenderRole).toString();
if (m_view.play_after->isChecked()) render_process_args << KdenliveSettings::KdenliveSettings::defaultplayerapp();
else render_process_args << "-";
QString scriptName;
if (scriptExport) {
-
- /*renderParameters << scriptName;
- if (group == "dvd") renderParameters << QString::number(m_view.create_chapter->isChecked());
- else renderParameters << QString::number(false);
- emit doRender(renderParameters, overlayargs);*/
-
// Generate script file
QFile file(scriptPath);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
m_view.tabWidget->setCurrentIndex(1);
// Save rendering profile to document
- emit selectedRenderProfile(m_view.size_list->currentItem()->data(MetaGroupRole).toString(), m_view.size_list->currentItem()->text());
+ emit selectedRenderProfile(m_view.size_list->currentItem()->data(MetaGroupRole).toString(), m_view.size_list->currentItem()->text(), dest);
// insert item in running jobs list
QTreeWidgetItem *renderItem;
if (!sizeItem->isHidden()) {
// Make sure the selected profile uses an installed avformat codec / format
std = sizeItem->data(ParamsRole).toString();
-
if (!formatsList.isEmpty()) {
QString format;
if (std.startsWith("f=")) format = std.section("f=", 1, 1);
KUrl RenderWidget::filenameWithExtension(KUrl url, QString extension)
{
- QString path;
- if (!url.isEmpty()) {
- path = url.path();
- int pos = path.lastIndexOf('.') + 1;
- if (pos == 0) path.append('.' + extension);
- else path = path.left(pos) + extension;
+ QString directory = url.directory(KUrl::AppendTrailingSlash | KUrl::ObeyTrailingSlash);
+ QString filename = url.fileName(KUrl::ObeyTrailingSlash);
+ QString ext;
- } else {
- path = m_projectFolder + "untitled." + extension;
+ if (extension.at(0) == '.') ext = extension;
+ else ext = '.' + extension;
+
+ if (filename.isEmpty()) filename = i18n("untitled");
+
+ int pos = filename.lastIndexOf('.');
+ if (pos == 0) filename.append(ext);
+ else {
+ if (!filename.endsWith(ext, Qt::CaseInsensitive)) {
+ filename = filename.left(pos) + ext;
+ }
}
- return KUrl(path);
+
+ return KUrl(directory + filename);
}
QListWidgetItem *item;
QDomNodeList groups = doc.elementsByTagName("group");
+ const QStringList acodecsList = KdenliveSettings::audiocodecs();
+ bool replaceVorbisCodec = false;
+ if (!acodecsList.contains("vorbis") && acodecsList.contains("libvorbis")) replaceVorbisCodec = true;
+
+
if (editable || groups.count() == 0) {
QDomElement profiles = doc.documentElement();
if (editable && profiles.attribute("version", 0).toInt() < 1) {
QString profileName = profile.attribute("name");
QString standard = profile.attribute("standard");
QString params = profile.attribute("args");
+
+ if (replaceVorbisCodec && params.contains("acodec=vorbis")) {
+ // replace vorbis with libvorbis
+ params = params.replace("vorbis", "libvorbis");
+ }
+
+
QString category = profile.attribute("category", i18n("Custom"));
QString dest = profile.attribute("destinationid");
QString prof_extension = profile.attribute("extension");
if (!gname.isNull()) {
metagroupName = gname.firstChild().nodeValue();
metagroupId = gname.toElement().attribute("id");
- if (!metagroupName.isEmpty() && !m_view.destination_list->contains(metagroupName)) {
+
+ if (!metagroupName.isEmpty() && m_view.destination_list->findData(metagroupId) == -1) {
if (metagroupId == "dvd") icon = KIcon("media-optical");
else if (metagroupId == "audioonly") icon = KIcon("audio-x-generic");
else if (metagroupId == "websites") icon = KIcon("applications-internet");
profileName = profileElement.attribute("name");
standard = profileElement.attribute("standard");
params = profileElement.attribute("args");
+
+ if (replaceVorbisCodec && params.contains("acodec=vorbis")) {
+ // replace vorbis with libvorbis
+ params = params.replace("vorbis", "libvorbis");
+ }
prof_extension = profileElement.attribute("extension");
if (!prof_extension.isEmpty()) extension = prof_extension;
item = new QListWidgetItem(profileName, m_view.size_list);
m_view.error_box->setVisible(false);
}
-void RenderWidget::setRenderProfile(const QString &dest, const QString &name)
+void RenderWidget::setRenderProfile(const QString &dest, const QString &name, const QString &url)
{
m_view.destination_list->blockSignals(true);
m_view.format_list->blockSignals(true);
m_view.size_list->blockSignals(true);
+
+ if (!url.isEmpty()) m_view.out_file->setUrl(KUrl(url));
+
for (int i = 0; i < m_view.destination_list->count(); i++) {
if (m_view.destination_list->itemData(i, Qt::UserRole) == dest) {
m_view.destination_list->setCurrentIndex(i);