QObject(parent),
m_autosave(NULL),
m_url(url),
- m_zoom(7),
m_startPos(0),
m_render(render),
m_commandStack(new QUndoStack(undoGroup)),
m_projectFolder(projectFolder),
m_documentLoadingStep(0.0),
m_documentLoadingProgress(0),
- m_abortLoading(false),
- m_zoneStart(0),
- m_zoneEnd(100)
+ m_abortLoading(false)
{
m_clipManager = new ClipManager(this);
m_autoSaveTimer = new QTimer(this);
m_autoSaveTimer->setSingleShot(true);
bool success = false;
+
+ // init default document properties
+ m_documentProperties["zoom"] = "7";
+ m_documentProperties["zonein"] = "0";
+ m_documentProperties["zoneout"] = "100";
+
if (!url.isEmpty()) {
QString tmpFile;
success = KIO::NetAccess::download(url.path(), tmpFile, parent);
profileName = infoXml.attribute("profile");
m_projectFolder = infoXml.attribute("projectfolder");
-
m_startPos = infoXml.attribute("position").toInt();
- m_zoom = infoXml.attribute("zoom", "7").toInt();
- m_zoneStart = infoXml.attribute("zonein", "0").toInt();
- m_zoneEnd = infoXml.attribute("zoneout", "100").toInt();
+
+ QDomElement docproperties = infoXml.firstChildElement("documentproperties");
+ QDomNamedNodeMap props = docproperties.attributes();
+ for (int i = 0; i < props.count(); i++) {
+ m_documentProperties.insert(props.item(i).nodeName(), props.item(i).nodeValue());
+ }
// Build tracks
QDomElement e;
void KdenliveDoc::setZoom(int factor)
{
- m_zoom = factor;
+ m_documentProperties["zoom"] = QString::number(factor);
}
int KdenliveDoc::zoom() const
{
- return m_zoom;
+ return m_documentProperties.value("zoom").toInt();
}
void KdenliveDoc::setZone(int start, int end)
{
- m_zoneStart = start;
- m_zoneEnd = end;
+ m_documentProperties["zonein"] = QString::number(start);
+ m_documentProperties["zoneout"] = QString::number(end);
}
QPoint KdenliveDoc::zone() const
{
- return QPoint(m_zoneStart, m_zoneEnd);
+ return QPoint(m_documentProperties.value("zonein").toInt(), m_documentProperties.value("zoneout").toInt());
}
bool KdenliveDoc::saveSceneList(const QString &path, const QString &scene)
addedXml.setAttribute("kdenliveversion", VERSION);
addedXml.setAttribute("profile", profilePath());
addedXml.setAttribute("position", m_render->seekPosition().frames(m_fps));
- addedXml.setAttribute("zonein", m_zoneStart);
- addedXml.setAttribute("zoneout", m_zoneEnd);
addedXml.setAttribute("projectfolder", m_projectFolder.path());
- addedXml.setAttribute("zoom", m_zoom);
+
+ QDomElement docproperties = sceneList.createElement("documentproperties");
+ QMapIterator<QString, QString> i(m_documentProperties);
+ while (i.hasNext()) {
+ i.next();
+ docproperties.setAttribute(i.key(), i.value());
+ }
+ addedXml.appendChild(docproperties);
// Add profile info
QDomElement profileinfo = sceneList.createElement("profileinfo");
return (d.exec() == QDialog::Accepted);
}
+void KdenliveDoc::setDocumentProperty(const QString &name, const QString &value)
+{
+ m_documentProperties[name] = value;
+}
+
+const QString KdenliveDoc::getDocumentProperty(const QString &name) const
+{
+ return m_documentProperties.value(name);
+}
#include "kdenlivedoc.moc"
void setSceneList();
void updatePreviewSettings();
bool isTrackLocked(int ix) const;
+ void setDocumentProperty(const QString &name, const QString &value);
+ const QString getDocumentProperty(const QString &name) const;
private:
KUrl m_url;
QDomDocument m_document;
double m_fps;
- int m_zoom;
/** Cursor position at document opening */
int m_startPos;
int m_width;
double m_documentLoadingStep;
double m_documentLoadingProgress;
bool m_abortLoading;
- int m_zoneStart;
- int m_zoneEnd;
+ QMap <QString, QString> m_documentProperties;
QList <TrackInfo> m_tracksList;
QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path() : KdenliveSettings::defaultprojectfolder();
m_renderWidget = new RenderWidget(projectfolder, this);
connect(m_renderWidget, SIGNAL(doRender(const QStringList&, const QStringList&)), this, SLOT(slotDoRender(const QStringList&, const QStringList&)));
+ connect(m_renderWidget, SIGNAL(selectedRenderProfile(const QString &, const QString &)), this, SLOT(slotSetDocumentRenderProfile(const QString &, const QString &)));
connect(m_renderWidget, SIGNAL(abortProcess(const QString &)), this, SIGNAL(abortRenderJob(const QString &)));
connect(m_renderWidget, SIGNAL(openDvdWizard(const QString &, const QString &)), this, SLOT(slotDvdWizard(const QString &, const QString &)));
if (m_activeDocument) {
m_renderWidget->setProfile(m_activeDocument->mltProfile());
m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
+ m_renderWidget->setRenderProfile(m_activeDocument->getDocumentProperty("renderdestination"), m_activeDocument->getDocumentProperty("renderprofile"));
}
}
/*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
if (currentTab) m_renderWidget->setTimeline(currentTab);
m_renderWidget->setDocument(m_activeDocument);*/
m_renderWidget->show();
+ m_renderWidget->showNormal();
}
void MainWindow::slotDoRender(const QStringList args, const QStringList overlay_args)
if (m_renderWidget) {
m_renderWidget->setProfile(doc->mltProfile());
m_renderWidget->setDocumentPath(doc->projectFolder().path());
+ m_renderWidget->setRenderProfile(doc->getDocumentProperty("renderdestination"), doc->getDocumentProperty("renderprofile"));
}
//doc->setRenderer(m_projectMonitor->render);
m_commandStack->setActiveStack(doc->commandStack());
slotTranscode(urls);
}
+void MainWindow::slotSetDocumentRenderProfile(const QString &dest, const QString &name)
+{
+ if (m_activeDocument == NULL) return;
+ m_activeDocument->setDocumentProperty("renderdestination", dest);
+ m_activeDocument->setDocumentProperty("renderprofile", name);
+ m_activeDocument->setModified(true);
+}
+
#include "mainwindow.moc"
void slotMaximizeCurrent(bool show);
void slotTranscode(KUrl::List urls = KUrl::List());
void slotTranscodeClip();
+ void slotSetDocumentRenderProfile(const QString &dest, const QString &name);
signals:
Q_SCRIPTABLE void abortRenderJob(const QString &url);
renderParameters << scriptName;
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());
+
// insert item in running jobs list
QTreeWidgetItem *renderItem;
QList<QTreeWidgetItem *> existing = m_view.running_jobs->findItems(dest, Qt::MatchExactly, 1);
for (int i = 0; i < m_view.size_list->count(); i++) {
sizeItem = m_view.size_list->item(i);
- if ((sizeItem->data(GroupRole) == group || sizeItem->data(GroupRole).toString().isEmpty()) && sizeItem->data(MetaGroupRole) == destination) {
+ if ((sizeItem->data(GroupRole).toString() == group || sizeItem->data(GroupRole).toString().isEmpty()) && sizeItem->data(MetaGroupRole).toString() == destination) {
std = sizeItem->data(StandardRole).toString();
if (!std.isEmpty()) {
if (std.contains("PAL", Qt::CaseInsensitive)) sizeItem->setHidden(m_view.format_selection->currentIndex() != 0);
{
m_view.error_box->setVisible(false);
}
+
+void RenderWidget::setRenderProfile(const QString &dest, const QString &name)
+{
+ m_view.destination_list->blockSignals(true);
+ m_view.format_list->blockSignals(true);
+ m_view.size_list->blockSignals(true);
+ 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);
+ break;
+ }
+ }
+ QList<QListWidgetItem *> childs = m_view.size_list->findItems(name, Qt::MatchExactly);
+ if (!childs.isEmpty()) {
+ QListWidgetItem *profile = childs.at(0);
+ if (profile->isHidden()) {
+ QString group = profile->data(GroupRole).toString();
+ childs = m_view.format_list->findItems(group, Qt::MatchExactly);
+ if (!childs.isEmpty()) {
+ m_view.format_list->setCurrentItem(childs.at(0));
+ }
+ }
+ refreshView();
+ m_view.size_list->blockSignals(false);
+ m_view.size_list->setCurrentItem(profile);
+ } else m_view.size_list->blockSignals(false);
+ m_view.destination_list->blockSignals(false);
+ m_view.format_list->blockSignals(false);
+
+}
+
void setRenderStatus(const QString &dest, int status, const QString &error);
void setDocumentPath(const QString path);
void reloadProfiles();
+ void setRenderProfile(const QString &dest, const QString &name);
private slots:
void slotUpdateButtons(KUrl url);
void doRender(const QStringList&, const QStringList&);
void abortProcess(const QString &url);
void openDvdWizard(const QString &url, const QString &profile);
+ void selectedRenderProfile(const QString &category, const QString &name);
};