-void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //changed
-{
- //m_projectMonitor->stop();
- kDebug()<<"/////////////////// CONNECTING DOC TO PROJECT VIEW ////////////////";
- if (m_activeDocument) {
- if (m_activeDocument == doc) return;
- m_activeDocument->setProducers(m_projectList->producersList());
- m_activeDocument->setRenderer(NULL);
- }
- connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
- connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
- connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
- connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView->projectView(), SLOT(setDuration(int)));
- connect(doc, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
- connect(doc, SIGNAL(signalDeleteProjectClip(int)), m_projectList, SLOT(slotDeleteClip(int)));
- connect(doc, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int)));
- connect(doc, SIGNAL(deletTimelineClip(int)), trackView, SLOT(slotDeleteClip(int)));
- connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
- connect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
- connect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
- connect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
-
- m_projectList->setDocument(doc);
- m_monitorManager->setTimecode(doc->timecode());
- doc->setRenderer(m_projectMonitor->render);
- //m_undoView->setStack(0);
- m_commandStack = doc->commandStack();
-
- m_overView->setScene(trackView->projectScene());
- m_overView->scale(m_overView->width() / trackView->duration(), m_overView->height() / (50 * trackView->tracksNumber()));
- //m_overView->fitInView(m_overView->itemAt(0, 50), Qt::KeepAspectRatio);
- QAction *redo = m_commandStack->createRedoAction(actionCollection());
- QAction *undo = m_commandStack->createUndoAction(actionCollection());
-
- QWidget* w = factory()->container("mainToolBar", this);
- if(w) {
- if (actionCollection()->action("undo"))
- delete actionCollection()->action("undo");
- if(actionCollection()->action("redo"))
- delete actionCollection()->action("redo");
-
- actionCollection()->addAction("undo", undo);
- actionCollection()->addAction("redo", redo);
- w->addAction(undo);
- w->addAction(redo);
- }
- m_undoView->setStack(doc->commandStack());
- m_activeDocument = doc;
-}
-
-void MainWindow::slotPreferences()
-{
- //An instance of your dialog could be already created and could be
- // cached, in which case you want to display the cached dialog
- // instead of creating another one
- if ( KConfigDialog::showDialog( "settings" ) )
- return;
-
- // KConfigDialog didn't find an instance of this dialog, so lets
- // create it :
- KdenliveSettingsDialog* dialog = new KdenliveSettingsDialog(this);
- //connect( dialog, SIGNAL(settingsChanged()), this, SLOT(updateConfiguration()) );
- dialog->show();
-}
-void MainWindow::customEvent ( QEvent * event ){
- if (event->type()==10005){
- ProgressEvent* p=(ProgressEvent*) event;
- statusProgressBar->setValue(p->value());
- if (p->value()>0) {
- statusLabel->setText(tr("Creating Audio Thumbs"));
- statusProgressBar->setVisible(true);
- }
- else {
- statusLabel->setText("");
- statusProgressBar->setVisible(false);
- }
- }
+void MainWindow::slotDoRender(const QString &dest, const QString &render, const QStringList &avformat_args, bool zoneOnly, bool playAfter) {
+ if (dest.isEmpty()) return;
+ int in;
+ int out;
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab && zoneOnly) {
+ in = currentTab->inPoint();
+ out = currentTab->outPoint();
+ }
+ KTemporaryFile temp;
+ temp.setAutoRemove(false);
+ temp.setSuffix(".westley");
+ if (temp.open()) {
+ m_projectMonitor->saveSceneList(temp.fileName());
+ QStringList args;
+ args << "-erase";
+ if (zoneOnly) args << "in=" + QString::number(in) << "out=" + QString::number(out);
+ QString videoPlayer = "-";
+ if (playAfter) videoPlayer = "kmplayer";
+ args << "inigo" << m_activeDocument->profilePath() << render << videoPlayer << temp.fileName() << dest << avformat_args;
+ QProcess::startDetached("kdenlive_render", args);
+ }
+}
+
+void MainWindow::slotUpdateMousePosition(int pos) {
+ if (m_activeDocument)
+ switch (m_timecodeFormat->currentIndex()) {
+ case 0:
+ statusBar()->changeItem(m_activeDocument->timecode().getTimecodeFromFrames(pos), ID_TIMELINE_POS);
+ break;
+ default:
+ statusBar()->changeItem(QString::number(pos), ID_TIMELINE_POS);
+ }
+}
+
+void MainWindow::slotUpdateDocumentState(bool modified) {
+ setCaption(m_activeDocument->description(), modified);
+ if (modified) {
+ m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Link));
+ m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("document-save"));
+ } else {
+ m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Text));
+ m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("kdenlive"));
+ }
+}
+
+void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //changed
+ //m_projectMonitor->stop();
+ kDebug() << "/////////////////// CONNECTING DOC TO PROJECT VIEW ////////////////";
+ if (m_activeDocument) {
+ if (m_activeDocument == doc) return;
+ m_activeDocument->backupMltPlaylist();
+ if (m_activeTimeline) {
+ disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
+ disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
+ disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
+ disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(int)), m_projectList, SLOT(slotDeleteClip(int)));
+ disconnect(m_activeDocument, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int)));
+ disconnect(m_activeDocument, SIGNAL(deletTimelineClip(int)), m_activeTimeline, SLOT(slotDeleteClip(int)));
+ disconnect(m_activeDocument, SIGNAL(thumbsProgress(KUrl, int)), this, SLOT(slotGotProgressInfo(KUrl, int)));
+ disconnect(m_activeTimeline, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
+ disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*)));
+ disconnect(timeline_buttons_ui.zoom_slider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
+ disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
+ disconnect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
+ disconnect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
+ disconnect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
+ disconnect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
+ disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
+ }
+ m_activeDocument->setRenderer(NULL);
+ disconnect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &)));
+ m_clipMonitor->stop();
+ }
+ m_monitorManager->resetProfiles(doc->profilePath());
+ m_projectList->setDocument(doc);
+ connect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &)));
+ connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
+ connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
+ connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
+ connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
+ connect(doc, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
+ connect(doc, SIGNAL(signalDeleteProjectClip(int)), m_projectList, SLOT(slotDeleteClip(int)));
+ connect(doc, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int)));
+ connect(doc, SIGNAL(deletTimelineClip(int)), trackView, SLOT(slotDeleteClip(int)));
+ connect(doc, SIGNAL(thumbsProgress(KUrl, int)), this, SLOT(slotGotProgressInfo(KUrl, int)));
+ connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
+
+ connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
+ connect(trackView, SIGNAL(transitionItemSelected(Transition*)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*)));
+ timeline_buttons_ui.zoom_slider->setValue(trackView->currentZoom());
+ connect(timeline_buttons_ui.zoom_slider, SIGNAL(valueChanged(int)), trackView, SLOT(slotChangeZoom(int)));
+ connect(trackView->projectView(), SIGNAL(zoomIn()), this, SLOT(slotZoomIn()));
+ connect(trackView->projectView(), SIGNAL(zoomOut()), this, SLOT(slotZoomOut()));
+ connect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
+ connect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
+ connect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
+ connect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
+ connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
+ trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu);
+ m_activeTimeline = trackView;
+ KdenliveSettings::setCurrent_profile(doc->profilePath());
+ if (m_renderWidget) m_renderWidget->setDocumentStandard(doc->getDocumentStandard());
+ m_monitorManager->setTimecode(doc->timecode());
+ doc->setRenderer(m_projectMonitor->render);
+ m_commandStack->setActiveStack(doc->commandStack());
+ if (m_commandStack->isClean()) kDebug() << "//////////// UNDO STACK IS CLEAN";
+ else kDebug() << "//////////// UNDO STACK IS NOT CLEAN*******************";
+
+ m_overView->setScene(trackView->projectScene());
+ //m_overView->scale(m_overView->width() / trackView->duration(), m_overView->height() / (50 * trackView->tracksNumber()));
+ //m_overView->fitInView(m_overView->itemAt(0, 50), Qt::KeepAspectRatio);
+
+ setCaption(doc->description());
+ m_activeDocument = doc;
+}
+
+void MainWindow::slotPreferences() {
+ //An instance of your dialog could be already created and could be
+ // cached, in which case you want to display the cached dialog
+ // instead of creating another one
+ if (KConfigDialog::showDialog("settings"))
+ return;
+
+ // KConfigDialog didn't find an instance of this dialog, so lets
+ // create it :
+ KdenliveSettingsDialog* dialog = new KdenliveSettingsDialog(this);
+ connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
+ dialog->show();
+}
+
+void MainWindow::updateConfiguration() {
+ //TODO: we should apply settings to all projects, not only the current one
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab) {
+ currentTab->refresh();
+ currentTab->projectView()->checkAutoScroll();
+ if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
+ }
+ timeline_buttons_ui.buttonAudio->setDown(KdenliveSettings::audiothumbnails());
+ timeline_buttons_ui.buttonVideo->setDown(KdenliveSettings::videothumbnails());
+ activateShuttleDevice();
+}
+
+void MainWindow::slotSwitchVideoThumbs() {
+ KdenliveSettings::setVideothumbnails(!KdenliveSettings::videothumbnails());
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab) {
+ currentTab->refresh();
+ }
+ timeline_buttons_ui.buttonVideo->setDown(KdenliveSettings::videothumbnails());
+}
+
+void MainWindow::slotSwitchAudioThumbs() {
+ KdenliveSettings::setAudiothumbnails(!KdenliveSettings::audiothumbnails());
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab) {
+ currentTab->refresh();
+ currentTab->projectView()->checkAutoScroll();
+ if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
+ }
+ timeline_buttons_ui.buttonAudio->setDown(KdenliveSettings::audiothumbnails());
+}
+
+void MainWindow::slotDeleteTimelineClip() {
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab) {
+ currentTab->projectView()->deleteSelectedClips();
+ }