+void MainWindow::slotMonitorRequestRenderFrame(bool request)
+{
+ if (request) {
+ m_projectMonitor->render->sendFrameForAnalysis = true;
+ return;
+ } else {
+ for (int i = 0; i < m_gfxScopesList.count(); i++) {
+ if (m_gfxScopesList.at(i)->isVisible() && tabifiedDockWidgets(m_gfxScopesList.at(i)).isEmpty() && static_cast<AbstractGfxScopeWidget *>(m_gfxScopesList.at(i)->widget())->autoRefreshEnabled()) {
+ request = true;
+ break;
+ }
+ }
+ }
+#ifdef DEBUG_MAINW
+ qDebug() << "Any scope accepting new frames? " << request;
+#endif
+ if (!request) {
+ m_projectMonitor->render->sendFrameForAnalysis = false;
+ }
+}
+
+void MainWindow::slotUpdateGfxScopeFrameRequest()
+{
+ // We need a delay to make sure widgets are hidden after a close event for example
+ QTimer::singleShot(500, this, SLOT(slotDoUpdateGfxScopeFrameRequest()));
+}
+
+void MainWindow::slotDoUpdateGfxScopeFrameRequest()
+{
+ // Check scopes
+ bool request = false;
+ for (int i = 0; i < m_gfxScopesList.count(); i++) {
+ if (!m_gfxScopesList.at(i)->widget()->visibleRegion().isEmpty() && static_cast<AbstractGfxScopeWidget *>(m_gfxScopesList.at(i)->widget())->autoRefreshEnabled()) {
+ kDebug() << "SCOPE VISIBLE: " << static_cast<AbstractGfxScopeWidget *>(m_gfxScopesList.at(i)->widget())->widgetName();
+ request = true;
+ break;
+ }
+ }
+ if (!request) {
+ if (!m_projectMonitor->effectSceneDisplayed()) {
+ m_projectMonitor->render->sendFrameForAnalysis = false;
+ }
+ m_clipMonitor->render->sendFrameForAnalysis = false;
+ if (m_recMonitor)
+ m_recMonitor->analyseFrames(false);
+ } else {
+ m_projectMonitor->render->sendFrameForAnalysis = true;
+ m_clipMonitor->render->sendFrameForAnalysis = true;
+ if (m_recMonitor)
+ m_recMonitor->analyseFrames(true);
+ }
+}
+
+void MainWindow::slotUpdateAudioScopeFrameRequest()
+{
+ QTimer::singleShot(500, this, SLOT(slotDoUpdateAudioScopeFrameRequest()));
+}
+
+void MainWindow::slotDoUpdateAudioScopeFrameRequest()
+{
+ bool request = false;
+ for (int i = 0; i < m_audioScopesList.count(); i++) {
+ if (!m_audioScopesList.at(i)->visibleRegion().isEmpty() && m_audioScopesList.at(i)->autoRefreshEnabled()) {
+ kDebug() << "AUDIO SCOPE VISIBLE: " << m_audioScopesList.at(i)->widgetName();
+ request = true;
+ break;
+ }
+ }
+ // Handle audio signal separately (no common interface)
+ if (!m_audiosignal->visibleRegion().isEmpty() && m_audiosignal->monitoringEnabled()) {
+ kDebug() << "AUDIO SCOPE VISIBLE: " << "audiosignal";
+ request = true;
+ }
+#ifdef DEBUG_MAINW
+ qDebug() << "Scopes Requesting Audio data: " << request;
+#endif
+ KdenliveSettings::setMonitor_audio(request);
+ m_monitorManager->slotUpdateAudioMonitoring();
+}
+
+void MainWindow::slotUpdateColorScopes()
+{
+ bool request = false;
+ for (int i = 0; i < m_gfxScopesList.count(); i++) {
+ // Check if we need the renderer to send a new frame for update
+ if (!m_gfxScopesList.at(i)->widget()->visibleRegion().isEmpty() && !(static_cast<AbstractGfxScopeWidget *>(m_gfxScopesList.at(i)->widget())->autoRefreshEnabled())) request = true;
+ static_cast<AbstractGfxScopeWidget *>(m_gfxScopesList.at(i)->widget())->slotActiveMonitorChanged();
+ }
+ if (request && m_monitorManager->activeRenderer()) {
+ m_monitorManager->activeRenderer()->sendFrameUpdate();
+ }
+ if (m_audiosignal->isVisible() && m_recMonitor->abstractRender()) {
+ connect(m_recMonitor->abstractRender(), SIGNAL(audioSamplesSignal(const QVector<int16_t>&, const int&, const int&, const int&)), m_audiosignal, SLOT(slotReceiveAudio(const QVector<int16_t>&, const int&, const int&, const int&)));
+ }
+}
+
+void MainWindow::slotClearColorScopes()
+{
+ for (int i = 0; i < m_gfxScopesList.count(); i++) {
+ static_cast<AbstractGfxScopeWidget *>(m_gfxScopesList.at(i)->widget())->slotClearMonitor();
+ }
+}
+
+void MainWindow::slotOpenStopmotion()
+{
+ if (m_stopmotion == NULL) {
+ m_stopmotion = new StopmotionWidget(m_monitorManager, m_activeDocument->projectFolder(), m_stopmotion_actions->actions(), this);
+ connect(m_stopmotion, SIGNAL(addOrUpdateSequence(const QString &)), m_projectList, SLOT(slotAddOrUpdateSequence(const QString)));
+ //for (int i = 0; i < m_gfxScopesList.count(); i++) {
+ // Check if we need the renderer to send a new frame for update
+ /*if (!m_scopesList.at(i)->widget()->visibleRegion().isEmpty() && !(static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget())->autoRefreshEnabled())) request = true;*/
+ //connect(m_stopmotion, SIGNAL(gotFrame(QImage)), static_cast<AbstractGfxScopeWidget *>(m_gfxScopesList.at(i)->widget()), SLOT(slotRenderZoneUpdated(QImage)));
+ //static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget())->slotMonitorCapture();
+ //}
+ }
+ m_stopmotion->show();
+}
+
+void MainWindow::slotDeleteClip(const QString &id)
+{
+ QList <ClipProperties *> list = findChildren<ClipProperties *>();
+ for (int i = 0; i < list.size(); ++i) {
+ list.at(i)->disableClipId(id);
+ }
+ m_projectList->slotDeleteClip(id);
+}
+
+void MainWindow::slotUpdateProxySettings()
+{
+ if (m_renderWidget) m_renderWidget->updateProxyConfig(m_projectList->useProxy());
+ if (KdenliveSettings::enableproxy())
+ KStandardDirs::makeDir(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) + "proxy/");
+ m_projectList->updateProxyConfig();
+}
+
+void MainWindow::slotInsertNotesTimecode()
+{
+ int frames = m_projectMonitor->render->seekPosition().frames(m_activeDocument->fps());
+ QString position = m_activeDocument->timecode().getTimecodeFromFrames(frames);
+ m_notesWidget->insertHtml("<a href=\"" + QString::number(frames) + "\">" + position + "</a> ");
+}
+
+void MainWindow::slotArchiveProject()
+{
+ QList <DocClipBase*> list = m_projectList->documentClipList();
+ QDomDocument doc = m_activeDocument->xmlSceneList(m_projectMonitor->sceneList(), m_projectList->expandedFolders());
+ ArchiveWidget *d = new ArchiveWidget(m_activeDocument->url().fileName(), doc, list, m_activeTimeline->projectView()->extractTransitionsLumas(), this);
+ d->exec();
+}
+
+
+void MainWindow::slotOpenBackupDialog(const KUrl url)
+{
+ KUrl projectFile;
+ KUrl projectFolder;
+ QString projectId;
+ kDebug()<<"// BACKUP URL: "<<url.path();
+ if (!url.isEmpty()) {
+ // we could not open the project file, guess where the backups are
+ projectFolder = KUrl(KdenliveSettings::defaultprojectfolder());
+ projectFile = url;
+ }
+ else {
+ projectFolder = m_activeDocument->projectFolder();
+ projectFile = m_activeDocument->url();
+ projectId = m_activeDocument->getDocumentProperty("documentid");
+ }
+
+ BackupWidget *dia = new BackupWidget(projectFile, projectFolder, projectId, this);
+ if (dia->exec() == QDialog::Accepted) {
+ QString requestedBackup = dia->selectedFile();
+ m_activeDocument->backupLastSavedVersion(projectFile.path());
+ closeCurrentDocument(false);
+ doOpenFile(KUrl(requestedBackup), NULL);
+ m_activeDocument->setUrl(projectFile);
+ m_activeDocument->setModified(true);
+ setCaption(m_activeDocument->description());
+ }
+ delete dia;
+}
+
+void MainWindow::slotElapsedTime()
+{
+ kDebug()<<"-----------------------------------------\n"<<"Time elapsed: "<<m_timer.elapsed()<<"\n-------------------------";
+}
+
+
+void MainWindow::slotDownloadAudio()
+{
+ QString currentFolder;
+ if (m_activeDocument) currentFolder = m_activeDocument->projectFolder().path();
+ else currentFolder = KdenliveSettings::defaultprojectfolder();
+ FreeSound *d = new FreeSound(currentFolder);
+ connect(d, SIGNAL(addClip(KUrl, const QString &)), this, SLOT(slotAddProjectClip(KUrl, const QString &)));
+ d->show();
+}
+