1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
22 #include <QTextStream>
28 #include <KApplication>
32 #include <KActionCollection>
33 #include <KStandardAction>
34 #include <KFileDialog>
35 #include <KMessageBox>
37 #include <KIO/NetAccess>
40 #include <KConfigDialog>
41 #include <KXMLGUIFactory>
43 #include <kstandarddirs.h>
44 #include <KUrlRequesterDialog>
45 #include <KTemporaryFile>
46 #include <KActionMenu>
49 #include <ktogglefullscreenaction.h>
51 #include <mlt++/Mlt.h>
53 #include "mainwindow.h"
54 #include "kdenlivesettings.h"
55 #include "kdenlivesettingsdialog.h"
56 #include "initeffects.h"
57 #include "profilesdialog.h"
58 #include "projectsettings.h"
60 #include "renderjob.h"
61 #include "clipmanager.h"
62 #include "projectlist.h"
64 #include "recmonitor.h"
65 #include "monitormanager.h"
66 #include "kdenlivedoc.h"
67 #include "trackview.h"
68 #include "customtrackview.h"
69 #include "effectslistview.h"
70 #include "effectstackview.h"
71 #include "transitionsettings.h"
72 #include "renderwidget.h"
74 #include "jogshuttle.h"
75 #include "clipproperties.h"
77 #define ID_STATUS_MSG 1
78 #define ID_EDITMODE_MSG 2
79 #define ID_TIMELINE_MSG 3
80 #define ID_TIMELINE_BUTTONS 5
81 #define ID_TIMELINE_POS 6
82 #define ID_TIMELINE_FORMAT 7
84 EffectsList MainWindow::videoEffects;
85 EffectsList MainWindow::audioEffects;
86 EffectsList MainWindow::customEffects;
87 EffectsList MainWindow::transitions;
89 MainWindow::MainWindow(QWidget *parent)
90 : KXmlGuiWindow(parent),
91 m_activeDocument(NULL), m_activeTimeline(NULL), m_renderWidget(NULL), m_jogProcess(NULL) {
92 setlocale(LC_NUMERIC, "POSIX");
94 setFont(KGlobalSettings::toolBarFont());
95 m_commandStack = new QUndoGroup;
96 m_timelineArea = new KTabWidget(this);
97 m_timelineArea->setTabReorderingEnabled(true);
98 m_timelineArea->setTabBarHidden(true);
100 QToolButton *closeTabButton = new QToolButton;
101 connect(closeTabButton, SIGNAL(clicked()), this, SLOT(slotRemoveTab()));
102 closeTabButton->setIcon(KIcon("tab-close"));
103 closeTabButton->adjustSize();
104 closeTabButton->setToolTip(i18n("Close the current tab"));
105 m_timelineArea->setCornerWidget(closeTabButton);
106 connect(m_timelineArea, SIGNAL(currentChanged(int)), this, SLOT(activateDocument()));
108 initEffects::parseEffectFiles();
109 m_monitorManager = new MonitorManager();
111 projectListDock = new QDockWidget(i18n("Project Tree"), this);
112 projectListDock->setObjectName("project_tree");
113 m_projectList = new ProjectList(this);
114 projectListDock->setWidget(m_projectList);
115 addDockWidget(Qt::TopDockWidgetArea, projectListDock);
117 effectListDock = new QDockWidget(i18n("Effect List"), this);
118 effectListDock->setObjectName("effect_list");
119 m_effectList = new EffectsListView();
121 //m_effectList = new KListWidget(this);
122 effectListDock->setWidget(m_effectList);
123 addDockWidget(Qt::TopDockWidgetArea, effectListDock);
125 effectStackDock = new QDockWidget(i18n("Effect Stack"), this);
126 effectStackDock->setObjectName("effect_stack");
127 effectStack = new EffectStackView(this);
128 effectStackDock->setWidget(effectStack);
129 addDockWidget(Qt::TopDockWidgetArea, effectStackDock);
131 transitionConfigDock = new QDockWidget(i18n("Transition"), this);
132 transitionConfigDock->setObjectName("transition");
133 transitionConfig = new TransitionSettings(this);
134 transitionConfigDock->setWidget(transitionConfig);
135 addDockWidget(Qt::TopDockWidgetArea, transitionConfigDock);
138 clipMonitorDock = new QDockWidget(i18n("Clip Monitor"), this);
139 clipMonitorDock->setObjectName("clip_monitor");
140 m_clipMonitor = new Monitor("clip", m_monitorManager, this);
141 clipMonitorDock->setWidget(m_clipMonitor);
142 addDockWidget(Qt::TopDockWidgetArea, clipMonitorDock);
143 //m_clipMonitor->stop();
145 projectMonitorDock = new QDockWidget(i18n("Project Monitor"), this);
146 projectMonitorDock->setObjectName("project_monitor");
147 m_projectMonitor = new Monitor("project", m_monitorManager, this);
148 projectMonitorDock->setWidget(m_projectMonitor);
149 addDockWidget(Qt::TopDockWidgetArea, projectMonitorDock);
151 recMonitorDock = new QDockWidget(i18n("Record Monitor"), this);
152 recMonitorDock->setObjectName("record_monitor");
153 m_recMonitor = new RecMonitor("record", this);
154 recMonitorDock->setWidget(m_recMonitor);
155 addDockWidget(Qt::TopDockWidgetArea, recMonitorDock);
157 connect(m_recMonitor, SIGNAL(addProjectClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
159 undoViewDock = new QDockWidget(i18n("Undo History"), this);
160 undoViewDock->setObjectName("undo_history");
161 m_undoView = new QUndoView(this);
162 m_undoView->setCleanIcon(KIcon("edit-clear"));
163 m_undoView->setEmptyLabel(i18n("Clean"));
164 undoViewDock->setWidget(m_undoView);
165 m_undoView->setGroup(m_commandStack);
166 addDockWidget(Qt::TopDockWidgetArea, undoViewDock);
168 overviewDock = new QDockWidget(i18n("Project Overview"), this);
169 overviewDock->setObjectName("project_overview");
170 //m_overView = new CustomTrackView(NULL, NULL, this);
171 //overviewDock->setWidget(m_overView);
172 addDockWidget(Qt::TopDockWidgetArea, overviewDock);
175 tabifyDockWidget(projectListDock, effectListDock);
176 tabifyDockWidget(projectListDock, effectStackDock);
177 tabifyDockWidget(projectListDock, transitionConfigDock);
178 tabifyDockWidget(projectListDock, undoViewDock);
179 projectListDock->raise();
181 tabifyDockWidget(clipMonitorDock, projectMonitorDock);
182 setCentralWidget(m_timelineArea);
184 setupGUI(Default, NULL /*"kdenliveui.rc"*/);
185 kDebug() << factory() << " " << factory()->container("video_effects_menu", this);
187 // build effects menus
189 QMenu *videoEffectsMenu = (QMenu*)(factory()->container("video_effects_menu", this));
190 QStringList effects = videoEffects.effectNames();
191 foreach(const QString &name, effects) {
192 action = new QAction(name, this);
193 action->setData(name);
194 videoEffectsMenu->addAction(action);
196 QMenu *audioEffectsMenu = (QMenu*)(factory()->container("audio_effects_menu", this));
197 effects = audioEffects.effectNames();
198 foreach(const QString &name, effects) {
199 action = new QAction(name, this);
200 action->setData(name);
201 audioEffectsMenu->addAction(action);
203 QMenu *customEffectsMenu = (QMenu*)(factory()->container("custom_effects_menu", this));
204 effects = customEffects.effectNames();
205 foreach(const QString &name, effects) {
206 action = new QAction(name, this);
207 action->setData(name);
208 customEffectsMenu->addAction(action);
211 connect(videoEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddVideoEffect(QAction *)));
212 connect(audioEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddAudioEffect(QAction *)));
213 connect(customEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddCustomEffect(QAction *)));
215 m_timelineContextMenu = new QMenu(this);
216 m_timelineContextClipMenu = new QMenu(this);
217 m_timelineContextTransitionMenu = new QMenu(this);
219 m_timelineContextClipMenu->addAction(actionCollection()->action("delete_timeline_clip"));
220 m_timelineContextClipMenu->addAction(actionCollection()->action("cut_timeline_clip"));
222 QMenu *markersMenu = (QMenu*)(factory()->container("marker_menu", this));
223 m_timelineContextClipMenu->addMenu(markersMenu);
224 m_timelineContextClipMenu->addMenu(videoEffectsMenu);
225 m_timelineContextClipMenu->addMenu(audioEffectsMenu);
226 m_timelineContextClipMenu->addMenu(customEffectsMenu);
228 m_timelineContextTransitionMenu->addAction(action);
230 connect(projectMonitorDock, SIGNAL(visibilityChanged(bool)), m_projectMonitor, SLOT(refreshMonitor(bool)));
231 connect(clipMonitorDock, SIGNAL(visibilityChanged(bool)), m_clipMonitor, SLOT(refreshMonitor(bool)));
232 //connect(m_monitorManager, SIGNAL(connectMonitors()), this, SLOT(slotConnectMonitors()));
233 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), this, SLOT(slotRaiseMonitor(bool)));
234 connect(m_effectList, SIGNAL(addEffect(QDomElement)), this, SLOT(slotAddEffect(QDomElement)));
235 m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
236 slotConnectMonitors();
238 setAutoSaveSettings();
241 activateShuttleDevice();
244 void MainWindow::queryQuit() {
245 kDebug() << "----- SAVING CONFUIG";
246 if (queryClose()) kapp->quit();
250 bool MainWindow::queryClose() {
252 if (m_activeDocument && m_activeDocument->isModified()) {
253 switch (KMessageBox::warningYesNoCancel(this, i18n("Save changes to document ?"))) {
254 case KMessageBox::Yes :
255 // save document here. If saving fails, return false;
257 case KMessageBox::No :
266 void MainWindow::activateShuttleDevice() {
267 if (m_jogProcess) delete m_jogProcess;
269 if (KdenliveSettings::enableshuttle() == false) return;
270 m_jogProcess = new JogShuttle(KdenliveSettings::shuttledevice());
271 connect(m_jogProcess, SIGNAL(rewind1()), m_monitorManager, SLOT(slotRewindOneFrame()));
272 connect(m_jogProcess, SIGNAL(forward1()), m_monitorManager, SLOT(slotForwardOneFrame()));
273 connect(m_jogProcess, SIGNAL(rewind(double)), m_monitorManager, SLOT(slotRewind(double)));
274 connect(m_jogProcess, SIGNAL(forward(double)), m_monitorManager, SLOT(slotForward(double)));
275 connect(m_jogProcess, SIGNAL(stop()), m_monitorManager, SLOT(slotPlay()));
276 connect(m_jogProcess, SIGNAL(button(int)), this, SLOT(slotShuttleButton(int)));
279 void MainWindow::slotShuttleButton(int code) {
282 slotShuttleAction(KdenliveSettings::shuttle1());
285 slotShuttleAction(KdenliveSettings::shuttle2());
288 slotShuttleAction(KdenliveSettings::shuttle3());
291 slotShuttleAction(KdenliveSettings::shuttle4());
294 slotShuttleAction(KdenliveSettings::shuttle5());
299 void MainWindow::slotShuttleAction(int code) {
304 m_monitorManager->slotPlay();
307 m_monitorManager->slotPlay();
312 void MainWindow::slotFullScreen() {
313 //KToggleFullScreenAction::setFullScreen(this, actionCollection()->action("fullscreen")->isChecked());
316 void MainWindow::slotAddEffect(QDomElement effect, GenTime pos, int track) {
317 if (!m_activeDocument) return;
318 if (effect.isNull()) {
319 kDebug() << "--- ERROR, TRYING TO APPEND NULL EFFECT";
322 TrackView *currentTimeLine = (TrackView *) m_timelineArea->currentWidget();
323 currentTimeLine->projectView()->slotAddEffect(effect, pos, track);
326 void MainWindow::slotRaiseMonitor(bool clipMonitor) {
327 if (clipMonitor) clipMonitorDock->raise();
328 else projectMonitorDock->raise();
331 void MainWindow::slotSetClipDuration(int id, int duration) {
332 if (!m_activeDocument) return;
333 m_activeDocument->setProducerDuration(id, duration);
336 void MainWindow::slotConnectMonitors() {
338 m_projectList->setRenderer(m_clipMonitor->render);
339 connect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &)));
340 connect(m_projectList, SIGNAL(receivedClipDuration(int, int)), this, SLOT(slotSetClipDuration(int, int)));
341 connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *)));
342 connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, int)), m_clipMonitor->render, SLOT(getFileProperties(const QDomElement &, int)));
343 connect(m_clipMonitor->render, SIGNAL(replyGetImage(int, int, const QPixmap &, int, int)), m_projectList, SLOT(slotReplyGetImage(int, int, const QPixmap &, int, int)));
344 connect(m_clipMonitor->render, SIGNAL(replyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &)), m_projectList, SLOT(slotReplyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &)));
347 void MainWindow::setupActions() {
349 m_timecodeFormat = new KComboBox(this);
350 m_timecodeFormat->addItem(i18n("hh:mm:ss::ff"));
351 m_timecodeFormat->addItem(i18n("Frames"));
353 statusProgressBar = new QProgressBar(this);
354 statusProgressBar->setMinimum(0);
355 statusProgressBar->setMaximum(100);
356 statusProgressBar->setMaximumWidth(150);
357 statusProgressBar->setVisible(false);
358 statusLabel = new QLabel(this);
360 QWidget *w = new QWidget;
362 QHBoxLayout *layout = new QHBoxLayout;
363 w->setLayout(layout);
364 layout->setContentsMargins(5, 0, 5, 0);
365 QToolBar *toolbar = new QToolBar("statusToolBar", this);
368 m_toolGroup = new QActionGroup(this);
370 QString style1 = "QToolButton { background-color: rgba(230, 230, 230, 20); border-style: inset; border:1px solid #666666;border-radius: 3px;margin: 0px 3px} QToolButton:checked { background-color: rgba(224, 0, 0, 100); border-style: inset; border:1px solid #666666;border-radius: 3px;}";
372 m_buttonSelectTool = toolbar->addAction(KIcon("kdenlive-select-tool"), i18n("Selection tool"));
373 m_buttonSelectTool->setCheckable(true);
374 m_buttonSelectTool->setChecked(true);
376 m_buttonRazorTool = toolbar->addAction(KIcon("edit-cut"), i18n("Razor tool"));
377 m_buttonRazorTool->setCheckable(true);
378 m_buttonRazorTool->setChecked(false);
380 m_toolGroup->addAction(m_buttonSelectTool);
381 m_toolGroup->addAction(m_buttonRazorTool);
382 m_toolGroup->setExclusive(true);
383 toolbar->setStyleSheet(style1);
384 connect(m_toolGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeTool(QAction *)));
386 toolbar->addSeparator();
387 m_buttonFitZoom = toolbar->addAction(KIcon("zoom-fit-best"), i18n("Fit zoom to project"));
388 m_buttonFitZoom->setCheckable(false);
389 connect(m_buttonFitZoom, SIGNAL(triggered()), this, SLOT(slotFitZoom()));
391 m_zoomSlider = new QSlider(Qt::Horizontal, this);
392 m_zoomSlider->setMaximum(13);
394 m_zoomSlider->setMaximumWidth(150);
395 m_zoomSlider->setMinimumWidth(100);
397 const int contentHeight = QFontMetrics(w->font()).height() + 3;
398 QString style = "QSlider::groove:horizontal { border: 1px solid #999999;height: 8px }";
399 style.append("QSlider::handle:horizontal { background-color: white; border: 1px solid #999999;width: 8px;margin: -2px 0;border-radius: 3px; }");
400 m_zoomSlider->setStyleSheet(style);
402 //m_zoomSlider->setMaximumHeight(contentHeight);
403 //m_zoomSlider->height() + 5;
404 statusBar()->setMinimumHeight(contentHeight + 5);
407 toolbar->addWidget(m_zoomSlider);
409 m_buttonVideoThumbs = toolbar->addAction(KIcon("video-mpeg"), i18n("Show videoo thumbnails"));
410 m_buttonVideoThumbs->setCheckable(true);
411 m_buttonVideoThumbs->setChecked(KdenliveSettings::audiothumbnails());
412 connect(m_buttonVideoThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchVideoThumbs()));
414 m_buttonAudioThumbs = toolbar->addAction(KIcon("audio-mpeg"), i18n("Show audio thumbnails"));
415 m_buttonAudioThumbs->setCheckable(true);
416 m_buttonAudioThumbs->setChecked(KdenliveSettings::videothumbnails());
417 connect(m_buttonAudioThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchAudioThumbs()));
419 m_buttonShowMarkers = toolbar->addAction(KIcon("audio-mpeg"), i18n("Show markers comments"));
420 m_buttonShowMarkers->setCheckable(true);
421 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
422 connect(m_buttonShowMarkers, SIGNAL(triggered()), this, SLOT(slotSwitchMarkersComments()));
423 layout->addWidget(toolbar);
425 statusBar()->insertPermanentWidget(0, statusProgressBar, 1);
426 statusBar()->insertPermanentWidget(1, statusLabel, 1);
427 statusBar()->insertPermanentWidget(ID_TIMELINE_BUTTONS, w);
428 statusBar()->insertPermanentFixedItem("00:00:00:00", ID_TIMELINE_POS);
429 statusBar()->insertPermanentWidget(ID_TIMELINE_FORMAT, m_timecodeFormat);
430 statusBar()->setMaximumHeight(statusBar()->font().pointSize() * 4);
432 actionCollection()->addAction("select_tool", m_buttonSelectTool);
433 actionCollection()->addAction("razor_tool", m_buttonRazorTool);
435 KAction* clearAction = new KAction(KIcon("document-new"), i18n("Clear"), this);
436 clearAction->setShortcut(Qt::CTRL + Qt::Key_W);
437 actionCollection()->addAction("clear", clearAction);
438 /*connect(clearAction, SIGNAL(triggered(bool)),
439 textArea, SLOT(clear()));*/
441 KAction* profilesAction = new KAction(KIcon("document-new"), i18n("Manage Profiles"), this);
442 actionCollection()->addAction("manage_profiles", profilesAction);
443 connect(profilesAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProfiles()));
445 KAction* projectAction = new KAction(KIcon("document-new"), i18n("Project Settings"), this);
446 actionCollection()->addAction("project_settings", projectAction);
447 connect(projectAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProjectSettings()));
449 KAction* projectRender = new KAction(KIcon("document-new"), i18n("Render Project"), this);
450 actionCollection()->addAction("project_render", projectRender);
451 connect(projectRender, SIGNAL(triggered(bool)), this, SLOT(slotRenderProject()));
453 KAction* monitorPlay = new KAction(KIcon("media-playback-start"), i18n("Play"), this);
454 monitorPlay->setShortcut(Qt::Key_Space);
455 actionCollection()->addAction("monitor_play", monitorPlay);
456 connect(monitorPlay, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotPlay()));
458 KAction* monitorSeekBackward = new KAction(KIcon("media-seek-backward"), i18n("Rewind"), this);
459 monitorSeekBackward->setShortcut(Qt::Key_J);
460 actionCollection()->addAction("monitor_seek_backward", monitorSeekBackward);
461 connect(monitorSeekBackward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewind()));
463 KAction* monitorSeekBackwardOneFrame = new KAction(KIcon("media-skip-backward"), i18n("Rewind 1 Frame"), this);
464 monitorSeekBackwardOneFrame->setShortcut(Qt::Key_Left);
465 actionCollection()->addAction("monitor_seek_backward-one-frame", monitorSeekBackwardOneFrame);
466 connect(monitorSeekBackwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewindOneFrame()));
468 KAction* monitorSeekSnapBackward = new KAction(KIcon("media-seek-backward"), i18n("Go to Previous Snap Point"), this);
469 monitorSeekSnapBackward->setShortcut(Qt::ALT + Qt::Key_Left);
470 actionCollection()->addAction("monitor_seek_snap_backward", monitorSeekSnapBackward);
471 connect(monitorSeekSnapBackward, SIGNAL(triggered(bool)), this, SLOT(slotSnapRewind()));
473 KAction* monitorSeekForward = new KAction(KIcon("media-seek-forward"), i18n("Forward"), this);
474 monitorSeekForward->setShortcut(Qt::Key_L);
475 actionCollection()->addAction("monitor_seek_forward", monitorSeekForward);
476 connect(monitorSeekForward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForward()));
478 KAction* monitorSeekForwardOneFrame = new KAction(KIcon("media-skip-forward"), i18n("Forward 1 Frame"), this);
479 monitorSeekForwardOneFrame->setShortcut(Qt::Key_Right);
480 actionCollection()->addAction("monitor_seek_forward-one-frame", monitorSeekForwardOneFrame);
481 connect(monitorSeekForwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneFrame()));
483 KAction* monitorSeekSnapForward = new KAction(KIcon("media-seek-forward"), i18n("Go to Next Snap Point"), this);
484 monitorSeekSnapForward->setShortcut(Qt::ALT + Qt::Key_Right);
485 actionCollection()->addAction("monitor_seek_snap_forward", monitorSeekSnapForward);
486 connect(monitorSeekSnapForward, SIGNAL(triggered(bool)), this, SLOT(slotSnapForward()));
488 KAction* deleteTimelineClip = new KAction(KIcon("edit-delete"), i18n("Delete Selected Item"), this);
489 deleteTimelineClip->setShortcut(Qt::Key_Delete);
490 actionCollection()->addAction("delete_timeline_clip", deleteTimelineClip);
491 connect(deleteTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotDeleteTimelineClip()));
493 KAction* cutTimelineClip = new KAction(KIcon("edit-cut"), i18n("Cut Clip"), this);
494 cutTimelineClip->setShortcut(Qt::SHIFT + Qt::Key_R);
495 actionCollection()->addAction("cut_timeline_clip", cutTimelineClip);
496 connect(cutTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotCutTimelineClip()));
498 KAction* addClipMarker = new KAction(KIcon("bookmark-new"), i18n("Add Marker to Clip"), this);
499 actionCollection()->addAction("add_clip_marker", addClipMarker);
500 connect(addClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotAddClipMarker()));
502 KAction* deleteClipMarker = new KAction(KIcon("edit-delete"), i18n("Delete Marker from Clip"), this);
503 actionCollection()->addAction("delete_clip_marker", deleteClipMarker);
504 connect(deleteClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotDeleteClipMarker()));
506 KAction* editClipMarker = new KAction(KIcon("document-properties"), i18n("Edit Marker"), this);
507 actionCollection()->addAction("edit_clip_marker", editClipMarker);
508 connect(editClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotEditClipMarker()));
510 KStandardAction::quit(this, SLOT(queryQuit()),
513 KStandardAction::open(this, SLOT(openFile()),
516 m_fileOpenRecent = KStandardAction::openRecent(this, SLOT(openFile(const KUrl &)),
519 KStandardAction::save(this, SLOT(saveFile()),
522 KStandardAction::saveAs(this, SLOT(saveFileAs()),
525 KStandardAction::openNew(this, SLOT(newFile()),
528 KStandardAction::preferences(this, SLOT(slotPreferences()),
531 KStandardAction::undo(this, SLOT(undo()),
534 KStandardAction::redo(this, SLOT(redo()),
537 KStandardAction::fullScreen(this, SLOT(slotFullScreen()), this, actionCollection());
539 connect(actionCollection(), SIGNAL(actionHovered(QAction*)),
540 this, SLOT(slotDisplayActionMessage(QAction*)));
541 //connect(actionCollection(), SIGNAL( clearStatusText() ),
542 //statusBar(), SLOT( clear() ) );
547 void MainWindow::undo() {
548 m_commandStack->undo();
551 void MainWindow::redo() {
552 m_commandStack->redo();
555 void MainWindow::slotDisplayActionMessage(QAction *a) {
556 statusBar()->showMessage(a->data().toString(), 3000);
559 void MainWindow::saveOptions() {
560 KdenliveSettings::self()->writeConfig();
561 KSharedConfigPtr config = KGlobal::config();
562 m_fileOpenRecent->saveEntries(KConfigGroup(config, "Recent Files"));
566 void MainWindow::readOptions() {
567 KSharedConfigPtr config = KGlobal::config();
568 m_fileOpenRecent->loadEntries(KConfigGroup(config, "Recent Files"));
571 void MainWindow::newFile() {
574 if (m_timelineArea->count() == 0) profileName = KdenliveSettings::default_profile();
576 ProjectSettings *w = new ProjectSettings;
577 if (w->exec() != QDialog::Accepted) return;
578 profileName = w->selectedProfile();
579 projectFolder = w->selectedFolder();
582 MltVideoProfile prof = ProfilesDialog::getVideoProfile(profileName);
583 if (prof.width == 0) prof = ProfilesDialog::getVideoProfile("dv_pal");
584 KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, prof, m_commandStack, this);
585 TrackView *trackView = new TrackView(doc, this);
586 m_timelineArea->addTab(trackView, KIcon("kdenlive"), i18n("Untitled") + " / " + prof.description);
587 if (m_timelineArea->count() == 1) {
588 connectDocumentInfo(doc);
589 connectDocument(trackView, doc);
590 } else m_timelineArea->setTabBarHidden(false);
593 void MainWindow::activateDocument() {
594 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
595 KdenliveDoc *currentDoc = currentTab->document();
596 connectDocumentInfo(currentDoc);
597 connectDocument(currentTab, currentDoc);
600 void MainWindow::slotRemoveTab() {
601 QWidget *w = m_timelineArea->currentWidget();
602 // closing current document
603 int ix = m_timelineArea->currentIndex() + 1;
604 if (ix == m_timelineArea->count()) ix = 0;
605 m_timelineArea->setCurrentIndex(ix);
606 TrackView *tabToClose = (TrackView *) w;
607 KdenliveDoc *docToClose = tabToClose->document();
608 m_timelineArea->removeTab(m_timelineArea->indexOf(w));
609 if (m_timelineArea->count() == 1) m_timelineArea->setTabBarHidden(true);
614 void MainWindow::saveFileAs(const QString &outputFileName) {
615 m_projectMonitor->saveSceneList(outputFileName, m_activeDocument->documentInfoXml());
616 m_activeDocument->setUrl(KUrl(outputFileName));
617 setCaption(m_activeDocument->description());
618 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
619 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), m_activeDocument->url().path());
620 m_activeDocument->setModified(false);
623 void MainWindow::saveFileAs() {
624 QString outputFile = KFileDialog::getSaveFileName();
625 if (QFile::exists(outputFile)) {
626 if (KMessageBox::questionYesNo(this, i18n("File already exists.\nDo you want to overwrite it ?")) == KMessageBox::No) return;
628 saveFileAs(outputFile);
631 void MainWindow::saveFile() {
632 if (!m_activeDocument) return;
633 if (m_activeDocument->url().isEmpty()) {
636 saveFileAs(m_activeDocument->url().path());
640 void MainWindow::openFile() { //changed
641 KUrl url = KFileDialog::getOpenUrl(KUrl(), "*.kdenlive|Kdenlive project files (*.kdenlive)\n*.westley|MLT project files (*.westley)");
642 if (url.isEmpty()) return;
643 m_fileOpenRecent->addUrl(url);
647 void MainWindow::openFile(const KUrl &url) { //new
648 //TODO: get video profile from url before opening it
649 MltVideoProfile prof = ProfilesDialog::getVideoProfile(KdenliveSettings::default_profile());
650 if (prof.width == 0) prof = ProfilesDialog::getVideoProfile("dv_pal");
651 KdenliveDoc *doc = new KdenliveDoc(url, KUrl(), prof, m_commandStack, this);
652 connectDocumentInfo(doc);
653 TrackView *trackView = new TrackView(doc, this);
654 m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description()));
655 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
656 if (m_timelineArea->count() > 1) m_timelineArea->setTabBarHidden(false);
657 slotGotProgressInfo(QString(), -1);
658 //connectDocument(trackView, doc);
662 void MainWindow::parseProfiles() {
663 //kdDebug()<<" + + YOUR MLT INSTALL WAS FOUND IN: "<< MLT_PREFIX <<endl;
665 //KdenliveSettings::setDefaulttmpfolder();
666 if (KdenliveSettings::mltpath().isEmpty()) {
667 KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
669 if (KdenliveSettings::rendererpath().isEmpty()) {
670 KdenliveSettings::setRendererpath(KStandardDirs::findExe("inigo"));
672 QStringList profilesFilter;
673 profilesFilter << "*";
674 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
676 if (profilesList.isEmpty()) {
677 // Cannot find MLT path, try finding inigo
678 QString profilePath = KdenliveSettings::rendererpath();
679 if (!profilePath.isEmpty()) {
680 profilePath = profilePath.section('/', 0, -3);
681 KdenliveSettings::setMltpath(profilePath + "/share/mlt/profiles/");
682 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
685 if (profilesList.isEmpty()) {
686 // Cannot find the MLT profiles, ask for location
687 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your Mlt profiles, please give the path"), this);
688 getUrl->fileDialog()->setMode(KFile::Directory);
690 KUrl mltPath = getUrl->selectedUrl();
692 if (mltPath.isEmpty()) exit(1);
693 KdenliveSettings::setMltpath(mltPath.path());
694 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
698 if (KdenliveSettings::rendererpath().isEmpty()) {
699 // Cannot find the MLT inigo renderer, ask for location
700 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find the inigo program required for rendering (part of Mlt)"), this);
702 KUrl rendererPath = getUrl->selectedUrl();
704 if (rendererPath.isEmpty()) exit(1);
705 KdenliveSettings::setRendererpath(rendererPath.path());
708 kDebug() << "RESULTING MLT PATH: " << KdenliveSettings::mltpath();
710 // Parse MLT profiles to build a list of available video formats
711 if (profilesList.isEmpty()) parseProfiles();
715 void MainWindow::slotEditProfiles() {
716 ProfilesDialog *w = new ProfilesDialog;
721 void MainWindow::slotEditProjectSettings() {
722 ProjectSettings *w = new ProjectSettings;
723 if (w->exec() == QDialog::Accepted) {
724 QString profile = w->selectedProfile();
725 m_activeDocument->setProfilePath(profile);
726 m_monitorManager->resetProfiles(profile);
727 setCaption(m_activeDocument->description());
728 KdenliveSettings::setCurrent_profile(m_activeDocument->profilePath());
729 if (m_renderWidget) m_renderWidget->setDocumentStandard(m_activeDocument->getDocumentStandard());
730 m_monitorManager->setTimecode(m_activeDocument->timecode());
731 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
733 // We need to desactivate & reactivate monitors to get a refresh
734 m_monitorManager->switchMonitors();
739 void MainWindow::slotRenderProject() {
740 if (!m_renderWidget) {
741 m_renderWidget = new RenderWidget(this);
742 connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, bool, bool)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, bool, bool)));
744 /*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
745 if (currentTab) m_renderWidget->setTimeline(currentTab);
746 m_renderWidget->setDocument(m_activeDocument);*/
747 m_renderWidget->show();
750 void MainWindow::slotDoRender(const QString &dest, const QString &render, const QStringList &avformat_args, bool zoneOnly, bool playAfter) {
751 if (dest.isEmpty()) return;
754 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
755 if (currentTab && zoneOnly) {
756 in = currentTab->inPoint();
757 out = currentTab->outPoint();
760 temp.setAutoRemove(false);
761 temp.setSuffix(".westley");
763 m_projectMonitor->saveSceneList(temp.fileName());
766 if (zoneOnly) args << "in=" + QString::number(in) << "out=" + QString::number(out);
767 QString videoPlayer = "-";
768 if (playAfter) videoPlayer = "kmplayer";
769 args << "inigo" << m_activeDocument->profilePath() << render << videoPlayer << temp.fileName() << dest << avformat_args;
770 QProcess::startDetached("kdenlive_render", args);
774 void MainWindow::slotUpdateMousePosition(int pos) {
775 if (m_activeDocument)
776 switch (m_timecodeFormat->currentIndex()) {
778 statusBar()->changeItem(m_activeDocument->timecode().getTimecodeFromFrames(pos), ID_TIMELINE_POS);
781 statusBar()->changeItem(QString::number(pos), ID_TIMELINE_POS);
785 void MainWindow::slotUpdateDocumentState(bool modified) {
786 setCaption(m_activeDocument->description(), modified);
788 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Link));
789 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("document-save"));
791 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Text));
792 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("kdenlive"));
796 void MainWindow::connectDocumentInfo(KdenliveDoc *doc) {
797 if (m_activeDocument) {
798 if (m_activeDocument == doc) return;
799 disconnect(m_activeDocument, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
801 connect(doc, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
804 void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //changed
805 //m_projectMonitor->stop();
806 kDebug() << "/////////////////// CONNECTING DOC TO PROJECT VIEW ////////////////";
807 if (m_activeDocument) {
808 if (m_activeDocument == doc) return;
809 m_activeDocument->backupMltPlaylist();
810 if (m_activeTimeline) {
811 disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
812 disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
813 disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
814 disconnect(m_activeDocument, SIGNAL(addProjectFolder(const QString, int, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, int, bool, bool)));
815 disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(int)), m_projectList, SLOT(slotDeleteClip(int)));
816 disconnect(m_activeDocument, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int)));
817 disconnect(m_activeDocument, SIGNAL(refreshClipThumbnail(int)), m_projectList, SLOT(slotRefreshClipThumbnail(int)));
818 disconnect(m_activeDocument, SIGNAL(deletTimelineClip(int)), m_activeTimeline, SLOT(slotDeleteClip(int)));
819 disconnect(m_activeTimeline, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
820 disconnect(trackView, SIGNAL(clipItemSelected(ClipItem*)), this, SLOT(slotActivateEffectStackView()));
821 disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*)));
822 disconnect(trackView, SIGNAL(transitionItemSelected(Transition*)), this, SLOT(slotActivateTransitionView()));
823 disconnect(m_zoomSlider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
824 disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
825 disconnect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
826 disconnect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
827 disconnect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
828 disconnect(effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
829 disconnect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
830 disconnect(transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
831 disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
833 m_activeDocument->setRenderer(NULL);
834 disconnect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &)));
835 m_clipMonitor->stop();
837 m_monitorManager->resetProfiles(doc->profilePath());
838 m_projectList->setDocument(doc);
839 connect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &)));
840 connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
841 connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
842 connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
843 connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
844 connect(doc, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
845 connect(doc, SIGNAL(addProjectFolder(const QString, int, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, int, bool, bool)));
846 connect(doc, SIGNAL(signalDeleteProjectClip(int)), m_projectList, SLOT(slotDeleteClip(int)));
847 connect(doc, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int)));
848 connect(doc, SIGNAL(refreshClipThumbnail(int)), m_projectList, SLOT(slotRefreshClipThumbnail(int)));
850 connect(doc, SIGNAL(deletTimelineClip(int)), trackView, SLOT(slotDeleteClip(int)));
851 connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
855 connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
856 connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), this, SLOT(slotActivateEffectStackView()));
857 connect(trackView, SIGNAL(transitionItemSelected(Transition*)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*)));
858 connect(trackView, SIGNAL(transitionItemSelected(Transition*)), this, SLOT(slotActivateTransitionView()));
859 m_zoomSlider->setValue(trackView->currentZoom());
860 connect(m_zoomSlider, SIGNAL(valueChanged(int)), trackView, SLOT(slotChangeZoom(int)));
861 connect(trackView->projectView(), SIGNAL(zoomIn()), this, SLOT(slotZoomIn()));
862 connect(trackView->projectView(), SIGNAL(zoomOut()), this, SLOT(slotZoomOut()));
863 connect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
864 connect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
865 connect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
866 connect(effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
867 connect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
868 connect(transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
869 connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
870 trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu);
871 m_activeTimeline = trackView;
872 KdenliveSettings::setCurrent_profile(doc->profilePath());
873 if (m_renderWidget) m_renderWidget->setDocumentStandard(doc->getDocumentStandard());
874 m_monitorManager->setTimecode(doc->timecode());
875 doc->setRenderer(m_projectMonitor->render);
876 m_commandStack->setActiveStack(doc->commandStack());
877 if (m_commandStack->isClean()) kDebug() << "//////////// UNDO STACK IS CLEAN";
878 else kDebug() << "//////////// UNDO STACK IS NOT CLEAN*******************";
880 //m_overView->setScene(trackView->projectScene());
881 //m_overView->scale(m_overView->width() / trackView->duration(), m_overView->height() / (50 * trackView->tracksNumber()));
882 //m_overView->fitInView(m_overView->itemAt(0, 50), Qt::KeepAspectRatio);
884 setCaption(doc->description());
885 m_activeDocument = doc;
888 void MainWindow::slotPreferences() {
889 //An instance of your dialog could be already created and could be
890 // cached, in which case you want to display the cached dialog
891 // instead of creating another one
892 if (KConfigDialog::showDialog("settings"))
895 // KConfigDialog didn't find an instance of this dialog, so lets
897 KdenliveSettingsDialog* dialog = new KdenliveSettingsDialog(this);
898 connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
902 void MainWindow::updateConfiguration() {
903 //TODO: we should apply settings to all projects, not only the current one
904 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
906 currentTab->refresh();
907 currentTab->projectView()->checkAutoScroll();
908 currentTab->projectView()->checkTrackHeight();
909 if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
911 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
912 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
913 activateShuttleDevice();
917 void MainWindow::slotSwitchVideoThumbs() {
918 KdenliveSettings::setVideothumbnails(!KdenliveSettings::videothumbnails());
919 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
921 currentTab->refresh();
923 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
926 void MainWindow::slotSwitchAudioThumbs() {
927 KdenliveSettings::setAudiothumbnails(!KdenliveSettings::audiothumbnails());
928 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
930 currentTab->refresh();
931 currentTab->projectView()->checkAutoScroll();
932 if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
934 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
937 void MainWindow::slotSwitchMarkersComments() {
938 KdenliveSettings::setShowmarkers(!KdenliveSettings::showmarkers());
939 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
941 currentTab->refresh();
943 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
949 void MainWindow::slotDeleteTimelineClip() {
950 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
952 currentTab->projectView()->deleteSelectedClips();
956 void MainWindow::slotAddClipMarker() {
957 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
959 currentTab->projectView()->slotAddClipMarker();
963 void MainWindow::slotDeleteClipMarker() {
964 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
966 currentTab->projectView()->slotDeleteClipMarker();
970 void MainWindow::slotEditClipMarker() {
971 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
973 currentTab->projectView()->slotEditClipMarker();
977 void MainWindow::slotCutTimelineClip() {
978 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
980 currentTab->projectView()->cutSelectedClips();
984 void MainWindow::slotAddProjectClip(KUrl url) {
985 if (m_activeDocument)
986 m_activeDocument->slotAddClipFile(url, QString());
989 void MainWindow::slotAddVideoEffect(QAction *result) {
991 QDomElement effect = videoEffects.getEffectByName(result->data().toString());
992 slotAddEffect(effect);
995 void MainWindow::slotAddAudioEffect(QAction *result) {
997 QDomElement effect = audioEffects.getEffectByName(result->data().toString());
998 slotAddEffect(effect);
1001 void MainWindow::slotAddCustomEffect(QAction *result) {
1002 if (!result) return;
1003 QDomElement effect = customEffects.getEffectByName(result->data().toString());
1004 slotAddEffect(effect);
1007 void MainWindow::slotZoomIn() {
1008 m_zoomSlider->setValue(m_zoomSlider->value() - 1);
1011 void MainWindow::slotZoomOut() {
1012 m_zoomSlider->setValue(m_zoomSlider->value() + 1);
1015 void MainWindow::slotFitZoom() {
1016 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1018 m_zoomSlider->setValue(currentTab->fitZoom());
1022 void MainWindow::slotGotProgressInfo(const QString &message, int progress) {
1023 statusProgressBar->setValue(progress);
1024 if (progress >= 0) {
1025 if (!message.isEmpty()) statusLabel->setText(message);
1026 statusProgressBar->setVisible(true);
1028 statusLabel->setText(QString());
1029 statusProgressBar->setVisible(false);
1033 void MainWindow::slotShowClipProperties(DocClipBase *clip) {
1034 if (clip->clipType() == TEXT) {
1035 m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
1038 ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
1039 if (dia.exec() == QDialog::Accepted) {
1040 m_projectList->slotUpdateClipProperties(dia.clipId(), dia.properties());
1041 if (dia.needsTimelineRefresh()) {
1042 // update clip occurences in timeline
1043 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1044 currentTab->projectView()->slotUpdateClip(dia.clipId());
1049 void MainWindow::customEvent(QEvent* e) {
1050 if (e->type() == QEvent::User) {
1051 // The timeline playing position changed...
1052 kDebug() << "RECIEVED JOG EVEMNT!!!";
1055 void MainWindow::slotActivateEffectStackView() {
1056 effectStack->raiseWindow(effectStackDock);
1059 void MainWindow::slotActivateTransitionView() {
1060 transitionConfig->raiseWindow(transitionConfigDock);
1063 void MainWindow::slotSnapRewind() {
1064 if (m_monitorManager->projectMonitorFocused()) {
1065 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1066 currentTab->projectView()->slotSeekToPreviousSnap();
1070 void MainWindow::slotSnapForward() {
1071 if (m_monitorManager->projectMonitorFocused()) {
1072 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1073 currentTab->projectView()->slotSeekToNextSnap();
1077 void MainWindow::slotChangeTool(QAction * action) {
1078 if (action == m_buttonSelectTool) slotSetTool(SELECTTOOL);
1079 else if (action == m_buttonRazorTool) slotSetTool(RAZORTOOL);
1082 void MainWindow::slotSetTool(PROJECTTOOL tool) {
1083 if (m_activeDocument) {
1084 //m_activeDocument->setTool(tool);
1085 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1086 currentTab->projectView()->setTool(tool);
1090 #include "mainwindow.moc"