#endif /* KDE_IS_VERSION(4,3,80) */
#include <KToolBar>
#include <KColorScheme>
+#include <KProgressDialog>
#include <QTextStream>
#include <QTimer>
#ifndef NO_JOGSHUTTLE
m_jogProcess(NULL),
#endif /* NO_JOGSHUTTLE */
- m_findActivated(false)
+ m_findActivated(false),
+ m_stopmotion(NULL)
{
// Create DBus interface
m_clipMonitorDock = new QDockWidget(i18n("Clip Monitor"), this);
m_clipMonitorDock->setObjectName("clip_monitor");
- m_clipMonitor = new Monitor("clip", m_monitorManager, QString());
+ m_clipMonitor = new Monitor("clip", m_monitorManager, QString(), m_timelineArea);
m_clipMonitorDock->setWidget(m_clipMonitor);
addDockWidget(Qt::TopDockWidgetArea, m_clipMonitorDock);
m_audiosignalDock->setObjectName("audiosignal");
m_audiosignalDock->setWidget(m_audiosignal);
addDockWidget(Qt::TopDockWidgetArea, m_audiosignalDock);
- if (m_projectMonitor){
- connect(m_projectMonitor->render, SIGNAL(showAudioSignal(const QByteArray&)), m_audiosignal, SLOT(showAudio(const QByteArray&)) );
+ if (m_projectMonitor) {
+ connect(m_projectMonitor->render, SIGNAL(showAudioSignal(const QByteArray&)), m_audiosignal, SLOT(showAudio(const QByteArray&)));
}
- if (m_clipMonitor){
- connect(m_clipMonitor->render, SIGNAL(showAudioSignal(const QByteArray&)), m_audiosignal, SLOT(showAudio(const QByteArray&)) );
+ if (m_clipMonitor) {
+ connect(m_clipMonitor->render, SIGNAL(showAudioSignal(const QByteArray&)), m_audiosignal, SLOT(showAudio(const QByteArray&)));
}
//connect(m_histogramDock, SIGNAL(visibilityChanged(bool)), this, SLOT(slotUpdateScopeFrameRequest()));
//connect(m_histogram, SIGNAL(requestAutoRefresh(bool)), this, SLOT(slotUpdateScopeFrameRequest()));
layoutActions->addAction("save_layout" + QString::number(i), save);
}
+ KAction *action;
+ // Stop motion actions. Beware of the order, we MUST use the same order in stopmotion/stopmotion.cpp
+ m_stopmotion_actions = new KActionCategory(i18n("Stop Motion"), actionCollection());
+ action = new KAction(KIcon("media-record"), i18n("Capture frame"), this);
+ action->setShortcut(Qt::Key_Space);
+ //action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+ m_stopmotion_actions->addAction("stopmotion_capture", action);
+ action = new KAction(i18n("Switch live / captured frame"), this);
+ //action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+ m_stopmotion_actions->addAction("stopmotion_switch", action);
+ action = new KAction(KIcon("edit-paste"), i18n("Show last frame over video"), this);
+ action->setCheckable(true);
+ action->setChecked(false);
+ m_stopmotion_actions->addAction("stopmotion_overlay", action);
setupGUI();
static_cast<QMenu*>(factory()->container("transcoders", this)),
clipInTimeline);
- KAction *action;
// build themes menus
QMenu *themesMenu = static_cast<QMenu*>(factory()->container("themes_menu", this));
QActionGroup *themegroup = new QActionGroup(this);
m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
slotConnectMonitors();
- // Disable drop B frames, see Kdenlive issue #1330, see also kdenlivesettingsdialog.cpp
- KdenliveSettings::setDropbframes(false);
-
// Open or create a file. Command line argument passed in Url has
// precedence, then "openlastproject", then just a plain empty file.
// If opening Url fails, openlastproject will _not_ be used.
activateShuttleDevice();
#endif /* NO_JOGSHUTTLE */
m_projectListDock->raise();
+
+ actionCollection()->addAssociatedWidget(m_clipMonitor->container());
+ actionCollection()->addAssociatedWidget(m_projectMonitor->container());
}
MainWindow::~MainWindow()
{
+ if (m_stopmotion) {
+ delete m_stopmotion;
+ }
m_effectStack->slotClipItemSelected(NULL, 0);
m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
void MainWindow::queryQuit()
{
if (queryClose()) {
- kapp->quit();
+ close();
}
}
switchMon->setShortcut(Qt::Key_T);
connect(switchMon, SIGNAL(triggered(bool)), this, SLOT(slotSwitchMonitors()));
+ KAction *fullMon = collection->addAction("monitor_fullscreen");
+ fullMon->setText(i18n("Switch monitor fullscreen"));
+ fullMon->setIcon(KIcon("view-fullscreen"));
+ connect(fullMon, SIGNAL(triggered(bool)), this, SLOT(slotSwitchFullscreen()));
+
KAction *insertTree = collection->addAction("insert_project_tree");
insertTree->setText(i18n("Insert zone in project tree"));
insertTree->setShortcut(Qt::CTRL + Qt::Key_I);
connect(reloadClip , SIGNAL(triggered()), m_projectList, SLOT(slotReloadClip()));
reloadClip->setEnabled(false);
+ QAction *stopMotion = new KAction(KIcon("image-x-generic"), i18n("Stop Motion Capture"), this);
+ collection->addAction("stopmotion", stopMotion);
+ connect(stopMotion , SIGNAL(triggered()), this, SLOT(slotOpenStopmotion()));
+
QMenu *addClips = new QMenu();
addClips->addAction(addClip);
addClips->addAction(addColorClip);
{
QString currentSceneList;
m_monitorManager->stopActiveMonitor();
- if (KdenliveSettings::dropbframes()) {
- KdenliveSettings::setDropbframes(false);
- m_activeDocument->clipManager()->updatePreviewSettings();
- currentSceneList = m_projectMonitor->sceneList();
- KdenliveSettings::setDropbframes(true);
- m_activeDocument->clipManager()->updatePreviewSettings();
- } else currentSceneList = m_projectMonitor->sceneList();
-
- if (m_activeDocument->saveSceneList(outputFileName, currentSceneList) == false)
+
+ if (m_activeDocument->saveSceneList(outputFileName, m_projectMonitor->sceneList()) == false)
return false;
// Save timeline thumbnails
{
if (!m_timelineArea->isEnabled()) return;
m_fileRevert->setEnabled(true);
- KdenliveDoc *doc = new KdenliveDoc(url, KdenliveSettings::defaultprojectfolder(), m_commandStack, KdenliveSettings::default_profile(), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), m_projectMonitor->render, m_notesWidget, this);
+
+ // Recreate stopmotion widget on document change
+ if (m_stopmotion) {
+ delete m_stopmotion;
+ m_stopmotion = NULL;
+ }
+
+ KProgressDialog progressDialog(this, i18n("Loading project"), i18n("Loading project"));
+ progressDialog.setAllowCancel(false);
+ progressDialog.progressBar()->setMaximum(4);
+ progressDialog.show();
+ progressDialog.progressBar()->setValue(0);
+ qApp->processEvents();
+
+ KdenliveDoc *doc = new KdenliveDoc(url, KdenliveSettings::defaultprojectfolder(), m_commandStack, KdenliveSettings::default_profile(), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), m_projectMonitor->render, m_notesWidget, this, &progressDialog);
+
+ progressDialog.progressBar()->setValue(1);
+ progressDialog.progressBar()->setMaximum(4);
+ progressDialog.setLabelText(i18n("Loading project"));
+ qApp->processEvents();
+
if (stale == NULL) {
stale = new KAutoSaveFile(url, doc);
doc->m_autosave = stale;
stale->setParent(doc);
}
connectDocumentInfo(doc);
+
+ progressDialog.progressBar()->setValue(2);
+ qApp->processEvents();
+
bool ok;
TrackView *trackView = new TrackView(doc, &ok, this);
+
+ progressDialog.progressBar()->setValue(3);
+ qApp->processEvents();
+
m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description()));
if (!ok) {
m_timelineArea->setEnabled(false);
m_projectMonitor->adjustRulerSize(trackView->duration());
m_projectMonitor->slotZoneMoved(trackView->inPoint(), trackView->outPoint());
m_clipMonitor->refreshMonitor(true);
+
+ progressDialog.progressBar()->setValue(4);
}
void MainWindow::recoverFiles(QList<KAutoSaveFile *> staleFiles)
{
double dar = m_activeDocument->dar();
+ // Recreate the stopmotion widget if profile changes
+ if (m_stopmotion) {
+ delete m_stopmotion;
+ m_stopmotion = NULL;
+ }
+
// Deselect current effect / transition
m_effectStack->slotClipItemSelected(NULL, 0);
m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
disconnect(m_activeDocument, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
- disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
+ disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), this, SLOT(slotDeleteClip(const QString &)));
disconnect(m_activeDocument, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
disconnect(m_activeDocument, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
disconnect(m_activeDocument, SIGNAL(deleteTimelineClip(const QString &)), m_activeTimeline, SLOT(slotDeleteClip(const QString &)));
}
//m_activeDocument->setRenderer(NULL);
disconnect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
- disconnect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
+ disconnect(m_projectList, SIGNAL(refreshClip()), m_monitorManager, SLOT(slotRefreshCurrentMonitor()));
m_clipMonitor->stop();
}
KdenliveSettings::setCurrent_profile(doc->profilePath());
m_transitionConfig->updateProjectFormat(doc->mltProfile(), doc->timecode(), doc->tracksList());
m_effectStack->updateProjectFormat(doc->mltProfile(), doc->timecode());
connect(m_projectList, SIGNAL(clipSelected(DocClipBase *, QPoint)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint)));
- connect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
+ connect(m_projectList, SIGNAL(refreshClip()), m_monitorManager, SLOT(slotRefreshCurrentMonitor()));
connect(m_projectList, SIGNAL(clipNeedsReload(const QString&, bool)), trackView->projectView(), SLOT(slotUpdateClip(const QString &, bool)));
connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
connect(doc, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
connect(doc, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
- connect(doc, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
+ connect(doc, SIGNAL(signalDeleteProjectClip(const QString &)), this, SLOT(slotDeleteClip(const QString &)));
connect(doc, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
connect(doc, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
#ifndef Q_WS_MAC
m_recMonitor->slotUpdateCaptureFolder(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash));
#endif
- if (KdenliveSettings::dropbframes()) slotUpdatePreviewSettings();
//Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
slotUpdateMousePosition(0);
// set tool to select tool
* cached, in which case you want to display the cached dialog
* instead of creating another one
*/
+ if (m_stopmotion) m_stopmotion->slotLive(false);
if (KConfigDialog::showDialog("settings")) {
KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
if (page != -1) d->showPage(page, option);
connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
//connect(dialog, SIGNAL(doResetProfile()), this, SLOT(slotDetectAudioDriver()));
connect(dialog, SIGNAL(doResetProfile()), m_monitorManager, SLOT(slotResetProfiles()));
- connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
#ifndef Q_WS_MAC
connect(dialog, SIGNAL(updateCaptureFolder()), this, SLOT(slotUpdateCaptureFolder()));
#endif
- //connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
dialog->show();
if (page != -1) dialog->showPage(page, option);
}
#endif
}
-void MainWindow::slotUpdatePreviewSettings()
-{
- if (m_activeDocument) {
- m_clipMonitor->slotSetXml(NULL);
- m_activeDocument->updatePreviewSettings();
- }
-}
-
void MainWindow::updateConfiguration()
{
//TODO: we should apply settings to all projects, not only the current one
}
// any type of clip but a title
- ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
- connect(&dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
- if (dia.exec() == QDialog::Accepted) {
- QMap <QString, QString> newprops = dia.properties();
- if (newprops.isEmpty()) return;
- EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
- m_activeDocument->commandStack()->push(command);
- m_activeDocument->setModified();
+ ClipProperties *dia = new ClipProperties(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
+ connect(dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
+ connect(dia, SIGNAL(applyNewClipProperties(const QString, QMap <QString, QString> , QMap <QString, QString> , bool, bool)), this, SLOT(slotApplyNewClipProperties(const QString, QMap <QString, QString> , QMap <QString, QString> , bool, bool)));
+ dia->show();
+}
- if (dia.needsTimelineRefresh()) {
- // update clip occurences in timeline
- m_activeTimeline->projectView()->slotUpdateClip(clip->getId(), dia.needsTimelineReload());
- }
+
+void MainWindow::slotApplyNewClipProperties(const QString id, QMap <QString, QString> props, QMap <QString, QString> newprops, bool refresh, bool reload)
+{
+ if (newprops.isEmpty()) return;
+ EditClipCommand *command = new EditClipCommand(m_projectList, id, props, newprops, true);
+ m_activeDocument->commandStack()->push(command);
+ m_activeDocument->setModified();
+
+ if (refresh) {
+ // update clip occurences in timeline
+ m_activeTimeline->projectView()->slotUpdateClip(id, reload);
}
}
else m_projectList->focusTree();
}
+void MainWindow::slotSwitchFullscreen()
+{
+ if (m_projectMonitor->isActive()) m_projectMonitor->slotSwitchFullScreen();
+ else m_clipMonitor->slotSwitchFullScreen();
+}
+
void MainWindow::slotInsertZoneToTree()
{
if (!m_clipMonitor->isActive() || m_clipMonitor->activeClip() == NULL) return;
{
QList <QDockWidget *> docks = findChildren<QDockWidget *>();
for (int i = 0; i < docks.count(); i++) {
- QDockWidget* dock=docks.at(i);
- if (show){
- dock->setTitleBarWidget(0);
- }else{
- if (!dock->isFloating()){
+ QDockWidget* dock = docks.at(i);
+ if (show) {
+ dock->setTitleBarWidget(0);
+ } else {
+ if (!dock->isFloating()) {
dock->setTitleBarWidget(new QWidget);
}
}
}
}
+void MainWindow::slotOpenStopmotion()
+{
+ if (m_stopmotion == NULL) {
+ m_stopmotion = new StopmotionWidget(m_activeDocument->projectFolder(), m_stopmotion_actions->actions(), this);
+ connect(m_stopmotion, SIGNAL(addOrUpdateSequence(const QString)), m_projectList, SLOT(slotAddOrUpdateSequence(const QString)));
+ }
+ 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);
+}
+
#include "mainwindow.moc"