viewport()->update();
}
-
+bool sortGuidesList(const Guide *g1 , const Guide *g2) {
+ return (*g1).position() < (*g2).position();
+}
void CustomTrackView::editGuide(const GenTime oldPos, const GenTime pos, const QString &comment) {
if (oldPos > GenTime() && pos > GenTime()) {
}
if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
}
+ qSort(m_guides.begin(), m_guides.end(), sortGuidesList);
m_document->syncGuides(m_guides);
}
Guide *g = new Guide(this, pos, comment, m_document->fps(), m_tracksHeight * m_scene->m_tracksList.count());
scene()->addItem(g);
m_guides.append(g);
+ qSort(m_guides.begin(), m_guides.end(), sortGuidesList);
m_document->syncGuides(m_guides);
return true;
}
QDomElement e;
m_guidesXml.clear();
m_guidesXml = doc.createElement("guides");
+
for (int i = 0; i < guides.count(); i++) {
e = doc.createElement("guide");
e.setAttribute("time", guides.at(i)->position().ms() / 1000);
e.setAttribute("comment", guides.at(i)->label());
m_guidesXml.appendChild(e);
}
+ emit guidesUpdated();
+}
+
+QDomElement KdenliveDoc::guidesXml() const {
+ return m_guidesXml;
}
void KdenliveDoc::slotAutoSave() {
if (m_render) m_scenelist = m_render->sceneList();
}
+double KdenliveDoc::projectDuration() const {
+ if (m_render) return GenTime(m_render->getLength(), m_fps).ms() / 1000;
+}
+
double KdenliveDoc::fps() const {
return m_fps;
}
int getProducerDuration(const QString &id);
Render *renderer();
QDomElement m_guidesXml;
+ QDomElement guidesXml() const;
ClipManager *clipManager();
void addClip(const QDomElement &elem, const QString &clipId);
void addFolder(const QString foldername, const QString &clipId, bool edit);
void setZoom(int factor);
int zoom() const;
const double dar();
+ double projectDuration() const;
private:
KUrl m_url;
/** emited when the document state has been modified (= needs saving or not) */
void docModified(bool);
void selectLastAddedClip(const QString &);
+ void guidesUpdated();
};
#endif
void MainWindow::slotRenderProject() {
if (!m_renderWidget) {
m_renderWidget = new RenderWidget(this);
- connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool)));
+ connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double)));
+ if (m_activeDocument) m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
}
/*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
if (currentTab) m_renderWidget->setTimeline(currentTab);
m_renderWidget->show();
}
-void MainWindow::slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter) {
+void MainWindow::slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd) {
if (dest.isEmpty()) return;
int in;
int out;
QStringList args;
args << "-erase";
if (zoneOnly) args << "in=" + QString::number(in) << "out=" + QString::number(out);
+ else if (guideStart != -1) {
+ args << "in=" + QString::number(GenTime(guideStart).frames(m_activeDocument->fps())) << "out=" + QString::number(GenTime(guideEnd).frames(m_activeDocument->fps()));
+ }
if (!overlay_args.isEmpty()) args << "preargs=" + overlay_args.join(" ");
QString videoPlayer = "-";
if (playAfter) {
disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
+ disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
disconnect(m_activeDocument, SIGNAL(addProjectFolder(const QString, const QString &, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, const QString &, bool, bool)));
disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
connect(doc, SIGNAL(deleteTimelineClip(const QString &)), trackView, SLOT(slotDeleteClip(const QString &)));
connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
-
+ connect(doc, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
m_activeDocument = doc;
}
+void MainWindow::slotGuidesUpdated() {
+ if (m_renderWidget) m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
+}
+
void MainWindow::slotPreferences(int page, int option) {
//An instance of your dialog could be already created and could be
// cached, in which case you want to display the cached dialog
void slotSwitchMarkersComments();
void slotSwitchSnap();
void slotRenderProject();
- void slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter);
+ void slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd);
void slotFullScreen();
void slotUpdateDocumentState(bool modified);
void slotZoomIn();
void slotEditGuide();
void slotDeleteGuide();
void slotDeleteAllGuides();
+ void slotGuidesUpdated();
void slotCopy();
void slotPaste();
connect(m_view.format_list, SIGNAL(currentRowChanged(int)), this, SLOT(refreshView()));
connect(m_view.size_list, SIGNAL(currentRowChanged(int)), this, SLOT(refreshParams()));
+ connect(m_view.render_guide, SIGNAL(clicked(bool)), this, SLOT(slotUpdateGuideBox()));
+ connect(m_view.render_zone, SIGNAL(clicked(bool)), this, SLOT(slotUpdateGuideBox()));
+ connect(m_view.render_full, SIGNAL(clicked(bool)), this, SLOT(slotUpdateGuideBox()));
+
+ connect(m_view.guide_end, SIGNAL(activated(int)), this, SLOT(slotCheckStartGuidePosition()));
+ connect(m_view.guide_start, SIGNAL(activated(int)), this, SLOT(slotCheckEndGuidePosition()));
+
+
m_view.buttonStart->setEnabled(false);
+ m_view.guides_box->setVisible(false);
parseProfiles();
}
+void RenderWidget::slotUpdateGuideBox() {
+ m_view.guides_box->setVisible(m_view.render_guide->isChecked());
+}
+
+void RenderWidget::slotCheckStartGuidePosition() {
+ if (m_view.guide_start->currentIndex() > m_view.guide_end->currentIndex())
+ m_view.guide_start->setCurrentIndex(m_view.guide_end->currentIndex());
+}
+
+void RenderWidget::slotCheckEndGuidePosition() {
+ if (m_view.guide_end->currentIndex() < m_view.guide_start->currentIndex())
+ m_view.guide_end->setCurrentIndex(m_view.guide_start->currentIndex());
+}
+
+void RenderWidget::setGuides(QDomElement guidesxml, double duration) {
+ m_view.guide_start->clear();
+ m_view.guide_end->clear();
+ QDomNodeList nodes = guidesxml.elementsByTagName("guide");
+ if (nodes.count() > 0) {
+ m_view.guide_start->addItem(i18n("Start"), "0");
+ m_view.render_guide->setEnabled(true);
+ } else m_view.render_guide->setEnabled(false);
+ 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());
+ }
+ }
+ if (nodes.count() > 0)
+ m_view.guide_end->addItem(i18n("End"), QString::number(duration));
+}
+
void RenderWidget::slotUpdateButtons() {
if (m_view.out_file->url().isEmpty()) m_view.buttonStart->setEnabled(false);
else m_view.buttonStart->setEnabled(true);
overlayargs << "-attach" << "data_feed:attr_check" << "-attach";
overlayargs << "data_show:" + filterFile << "_fezzik=1" << "dynamic=1";
}
- emit doRender(m_view.out_file->url().path(), item->data(RenderRole).toString(), overlayargs, m_view.advanced_params->text().split(' '), m_view.zone_only->isChecked(), m_view.play_after->isChecked());
+ double startPos = -1;
+ double endPos = -1;
+ if (m_view.render_guide->isChecked()) {
+ startPos = m_view.guide_start->itemData(m_view.guide_start->currentIndex()).toDouble();
+ endPos = m_view.guide_end->itemData(m_view.guide_end->currentIndex()).toDouble();
+ }
+ emit doRender(m_view.out_file->url().path(), item->data(RenderRole).toString(), overlayargs, m_view.advanced_params->text().split(' '), m_view.render_zone->isChecked(), m_view.play_after->isChecked(), startPos, endPos);
}
void RenderWidget::setDocumentStandard(QString std) {
public:
RenderWidget(QWidget * parent = 0);
void setDocumentStandard(QString std);
+ void setGuides(QDomElement guidesxml, double duration);
private slots:
void slotUpdateButtons();
void slotSaveProfile();
void slotEditProfile();
void slotDeleteProfile();
+ void slotUpdateGuideBox();
+ void slotCheckStartGuidePosition();
+ void slotCheckEndGuidePosition();
+
private:
Ui::RenderWidget_UI m_view;
void parseFile(QString exportFile, bool editable);
signals:
- void doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool);
+ void doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double);
};
<rect>
<x>0</x>
<y>0</y>
- <width>340</width>
- <height>339</height>
+ <width>424</width>
+ <height>381</height>
</rect>
</property>
<property name="windowTitle" >
</property>
</widget>
</item>
- <item row="0" column="1" colspan="3" >
+ <item row="0" column="1" colspan="2" >
<widget class="KUrlRequester" name="out_file" />
</item>
- <item row="2" column="0" colspan="3" >
- <widget class="QCheckBox" name="zone_only" >
- <property name="text" >
- <string>Selected zone only</string>
- </property>
- </widget>
- </item>
- <item row="2" column="3" >
- <widget class="QCheckBox" name="play_after" >
- <property name="text" >
- <string>Play after render</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0" >
- <widget class="KPushButton" name="buttonStart" >
- <property name="text" >
- <string>Start</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1" >
- <spacer name="horizontalSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>153</width>
- <height>27</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="4" column="2" colspan="2" >
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Close</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="4" >
+ <item row="1" column="0" colspan="3" >
<widget class="KTabWidget" name="ktabwidget" >
<property name="currentIndex" >
<number>0</number>
</widget>
</widget>
</item>
- <item row="3" column="0" colspan="2" >
- <widget class="QCheckBox" name="tc_overlay" >
+ <item row="2" column="0" colspan="2" >
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <widget class="QRadioButton" name="render_full" >
+ <property name="text" >
+ <string>Full project</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="render_zone" >
+ <property name="text" >
+ <string>Selected zone</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="render_guide" >
+ <property name="text" >
+ <string>Guide zone</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="0" colspan="3" >
+ <widget class="QGroupBox" name="guides_box" >
+ <property name="title" >
+ <string/>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_4" >
+ <property name="text" >
+ <string>From</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="KComboBox" name="guide_start" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>to</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3" >
+ <widget class="KComboBox" name="guide_end" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="3" >
+ <layout class="QHBoxLayout" name="horizontalLayout_3" >
+ <item>
+ <widget class="QCheckBox" name="play_after" >
+ <property name="text" >
+ <string>Play after render</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="tc_overlay" >
+ <property name="text" >
+ <string>Timecode overlay</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="5" column="0" >
+ <widget class="KPushButton" name="buttonStart" >
<property name="text" >
- <string>Timecode overlay</string>
+ <string>Start</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1" >
+ <spacer name="horizontalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>153</width>
+ <height>27</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="2" >
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>