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>
29 #include <KApplication>
33 #include <KActionCollection>
34 #include <KStandardAction>
35 #include <KFileDialog>
36 #include <KMessageBox>
38 #include <KIO/NetAccess>
41 #include <KConfigDialog>
42 #include <KXMLGUIFactory>
44 #include <kstandarddirs.h>
45 #include <KUrlRequesterDialog>
46 #include <KTemporaryFile>
47 #include <KActionMenu>
50 #include <ktogglefullscreenaction.h>
52 #include <KNotification>
53 #include <KNotifyConfigWidget>
54 #include <knewstuff2/engine.h>
55 #include <knewstuff2/ui/knewstuffaction.h>
57 #include "mainwindow.h"
58 #include "kdenlivesettings.h"
59 #include "kdenlivesettingsdialog.h"
60 #include "initeffects.h"
61 #include "profilesdialog.h"
62 #include "projectsettings.h"
64 #include "clipmanager.h"
65 #include "projectlist.h"
67 #include "recmonitor.h"
68 #include "monitormanager.h"
69 #include "kdenlivedoc.h"
70 #include "trackview.h"
71 #include "customtrackview.h"
72 #include "effectslistview.h"
73 #include "effectstackview.h"
74 #include "transitionsettings.h"
75 #include "renderwidget.h"
78 #include "jogshuttle.h"
79 #endif /* NO_JOGSHUTTLE */
80 #include "clipproperties.h"
82 #include "editclipcommand.h"
83 #include "titlewidget.h"
84 #include "markerdialog.h"
87 static const int ID_STATUS_MSG = 1;
88 static const int ID_EDITMODE_MSG = 2;
89 static const int ID_TIMELINE_MSG = 3;
90 static const int ID_TIMELINE_BUTTONS = 5;
91 static const int ID_TIMELINE_POS = 6;
92 static const int ID_TIMELINE_FORMAT = 7;
98 EffectsList MainWindow::videoEffects;
99 EffectsList MainWindow::audioEffects;
100 EffectsList MainWindow::customEffects;
101 EffectsList MainWindow::transitions;
103 MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent)
104 : KXmlGuiWindow(parent),
105 m_activeDocument(NULL), m_activeTimeline(NULL), m_renderWidget(NULL),
106 #ifndef NO_JOGSHUTTLE
108 #endif /* NO_JOGSHUTTLE */
109 m_findActivated(false), m_initialized(false) {
110 setlocale(LC_NUMERIC, "POSIX");
111 setFont(KGlobalSettings::toolBarFont());
112 parseProfiles(MltPath);
113 m_commandStack = new QUndoGroup;
114 m_timelineArea = new KTabWidget(this);
115 m_timelineArea->setTabReorderingEnabled(true);
116 m_timelineArea->setTabBarHidden(true);
118 QToolButton *closeTabButton = new QToolButton;
119 connect(closeTabButton, SIGNAL(clicked()), this, SLOT(closeCurrentDocument()));
120 closeTabButton->setIcon(KIcon("tab-close"));
121 closeTabButton->adjustSize();
122 closeTabButton->setToolTip(i18n("Close the current tab"));
123 m_timelineArea->setCornerWidget(closeTabButton);
124 connect(m_timelineArea, SIGNAL(currentChanged(int)), this, SLOT(activateDocument()));
126 connect(&m_findTimer, SIGNAL(timeout()), this, SLOT(findTimeout()));
127 m_findTimer.setSingleShot(true);
129 initEffects::parseEffectFiles();
130 //initEffects::parseCustomEffectsFile();
132 m_monitorManager = new MonitorManager();
134 projectListDock = new QDockWidget(i18n("Project Tree"), this);
135 projectListDock->setObjectName("project_tree");
136 m_projectList = new ProjectList(this);
137 projectListDock->setWidget(m_projectList);
138 addDockWidget(Qt::TopDockWidgetArea, projectListDock);
140 effectListDock = new QDockWidget(i18n("Effect List"), this);
141 effectListDock->setObjectName("effect_list");
142 m_effectList = new EffectsListView();
144 //m_effectList = new KListWidget(this);
145 effectListDock->setWidget(m_effectList);
146 addDockWidget(Qt::TopDockWidgetArea, effectListDock);
148 effectStackDock = new QDockWidget(i18n("Effect Stack"), this);
149 effectStackDock->setObjectName("effect_stack");
150 effectStack = new EffectStackView(this);
151 effectStackDock->setWidget(effectStack);
152 addDockWidget(Qt::TopDockWidgetArea, effectStackDock);
154 transitionConfigDock = new QDockWidget(i18n("Transition"), this);
155 transitionConfigDock->setObjectName("transition");
156 transitionConfig = new TransitionSettings(this);
157 transitionConfigDock->setWidget(transitionConfig);
158 addDockWidget(Qt::TopDockWidgetArea, transitionConfigDock);
160 KdenliveSettings::setCurrent_profile(KdenliveSettings::default_profile());
161 m_fileOpenRecent = KStandardAction::openRecent(this, SLOT(openFile(const KUrl &)),
165 clipMonitorDock = new QDockWidget(i18n("Clip Monitor"), this);
166 clipMonitorDock->setObjectName("clip_monitor");
167 m_clipMonitor = new Monitor("clip", m_monitorManager, this);
168 clipMonitorDock->setWidget(m_clipMonitor);
169 addDockWidget(Qt::TopDockWidgetArea, clipMonitorDock);
170 //m_clipMonitor->stop();
172 projectMonitorDock = new QDockWidget(i18n("Project Monitor"), this);
173 projectMonitorDock->setObjectName("project_monitor");
174 m_projectMonitor = new Monitor("project", m_monitorManager, this);
175 projectMonitorDock->setWidget(m_projectMonitor);
176 addDockWidget(Qt::TopDockWidgetArea, projectMonitorDock);
178 recMonitorDock = new QDockWidget(i18n("Record Monitor"), this);
179 recMonitorDock->setObjectName("record_monitor");
180 m_recMonitor = new RecMonitor("record", this);
181 recMonitorDock->setWidget(m_recMonitor);
182 addDockWidget(Qt::TopDockWidgetArea, recMonitorDock);
184 connect(m_recMonitor, SIGNAL(addProjectClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
185 connect(m_recMonitor, SIGNAL(showConfigDialog(int, int)), this, SLOT(slotPreferences(int, int)));
187 undoViewDock = new QDockWidget(i18n("Undo History"), this);
188 undoViewDock->setObjectName("undo_history");
189 m_undoView = new QUndoView(this);
190 m_undoView->setCleanIcon(KIcon("edit-clear"));
191 m_undoView->setEmptyLabel(i18n("Clean"));
192 undoViewDock->setWidget(m_undoView);
193 m_undoView->setGroup(m_commandStack);
194 addDockWidget(Qt::TopDockWidgetArea, undoViewDock);
196 //overviewDock = new QDockWidget(i18n("Project Overview"), this);
197 //overviewDock->setObjectName("project_overview");
198 //m_overView = new CustomTrackView(NULL, NULL, this);
199 //overviewDock->setWidget(m_overView);
200 //addDockWidget(Qt::TopDockWidgetArea, overviewDock);
203 //tabifyDockWidget(projectListDock, effectListDock);
204 tabifyDockWidget(projectListDock, effectStackDock);
205 tabifyDockWidget(projectListDock, transitionConfigDock);
206 //tabifyDockWidget(projectListDock, undoViewDock);
209 tabifyDockWidget(clipMonitorDock, projectMonitorDock);
210 tabifyDockWidget(clipMonitorDock, recMonitorDock);
211 setCentralWidget(m_timelineArea);
214 //kDebug() << factory() << " " << factory()->container("video_effects_menu", this);
216 m_projectMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)));
217 m_clipMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), static_cast<QMenu*>(factory()->container("marker_menu", this)));
219 // build effects menus
221 QMenu *videoEffectsMenu = static_cast<QMenu*>(factory()->container("video_effects_menu", this));
223 QStringList effectInfo;
224 QMap<QString, QStringList> effectsList;
225 for (int ix = 0; ix < videoEffects.count(); ix++) {
226 effectInfo = videoEffects.effectIdInfo(ix);
227 effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
230 foreach(QStringList value, effectsList) {
231 action = new QAction(value.at(0), this);
232 action->setData(value);
233 videoEffectsMenu->addAction(action);
236 QMenu *audioEffectsMenu = static_cast<QMenu*>(factory()->container("audio_effects_menu", this));
240 for (int ix = 0; ix < audioEffects.count(); ix++) {
241 effectInfo = audioEffects.effectIdInfo(ix);
242 effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
245 foreach(QStringList value, effectsList) {
246 action = new QAction(value.at(0), this);
247 action->setData(value);
248 audioEffectsMenu->addAction(action);
251 m_customEffectsMenu = static_cast<QMenu*>(factory()->container("custom_effects_menu", this));
253 if (customEffects.isEmpty()) m_customEffectsMenu->setEnabled(false);
254 else m_customEffectsMenu->setEnabled(true);
257 for (int ix = 0; ix < customEffects.count(); ix++) {
258 effectInfo = customEffects.effectIdInfo(ix);
259 effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
262 foreach(QStringList value, effectsList) {
263 action = new QAction(value.at(0), this);
264 action->setData(value);
265 m_customEffectsMenu->addAction(action);
268 QMenu *newEffect = new QMenu(this);
269 newEffect->addMenu(videoEffectsMenu);
270 newEffect->addMenu(audioEffectsMenu);
271 newEffect->addMenu(m_customEffectsMenu);
272 effectStack->setMenu(newEffect);
275 QMenu *viewMenu = static_cast<QMenu*>(factory()->container("dockwindows", this));
276 const QList<QAction *> viewActions = createPopupMenu()->actions();
277 viewMenu->insertActions(NULL, viewActions);
279 connect(videoEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddVideoEffect(QAction *)));
280 connect(audioEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddAudioEffect(QAction *)));
281 connect(m_customEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddCustomEffect(QAction *)));
283 m_timelineContextMenu = new QMenu(this);
284 m_timelineContextClipMenu = new QMenu(this);
285 m_timelineContextTransitionMenu = new QMenu(this);
288 QMenu *transitionsMenu = new QMenu(i18n("Add Transition"), this);
289 QStringList effects = transitions.effectNames();
292 for (int ix = 0; ix < transitions.count(); ix++) {
293 effectInfo = transitions.effectIdInfo(ix);
294 effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
296 foreach(QStringList value, effectsList) {
297 action = new QAction(value.at(0), this);
298 action->setData(value);
299 transitionsMenu->addAction(action);
301 connect(transitionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddTransition(QAction *)));
303 m_timelineContextMenu->addAction(actionCollection()->action("insert_space"));
304 m_timelineContextMenu->addAction(actionCollection()->action("delete_space"));
305 m_timelineContextMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Paste)));
307 m_timelineContextClipMenu->addAction(actionCollection()->action("delete_timeline_clip"));
308 m_timelineContextClipMenu->addAction(actionCollection()->action("change_clip_speed"));
309 m_timelineContextClipMenu->addAction(actionCollection()->action("cut_timeline_clip"));
310 m_timelineContextClipMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
311 m_timelineContextClipMenu->addAction(actionCollection()->action("paste_effects"));
313 QMenu *markersMenu = (QMenu*)(factory()->container("marker_menu", this));
314 m_timelineContextClipMenu->addMenu(markersMenu);
315 m_timelineContextClipMenu->addMenu(transitionsMenu);
316 m_timelineContextClipMenu->addMenu(videoEffectsMenu);
317 m_timelineContextClipMenu->addMenu(audioEffectsMenu);
318 //TODO: re-enable custom effects menu when it is implemented
319 m_timelineContextClipMenu->addMenu(m_customEffectsMenu);
321 m_timelineContextTransitionMenu->addAction(actionCollection()->action("delete_timeline_clip"));
322 m_timelineContextTransitionMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
324 m_timelineContextTransitionMenu->addAction(actionCollection()->action("auto_transition"));
326 connect(projectMonitorDock, SIGNAL(visibilityChanged(bool)), m_projectMonitor, SLOT(refreshMonitor(bool)));
327 connect(clipMonitorDock, SIGNAL(visibilityChanged(bool)), m_clipMonitor, SLOT(refreshMonitor(bool)));
328 //connect(m_monitorManager, SIGNAL(connectMonitors()), this, SLOT(slotConnectMonitors()));
329 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), this, SLOT(slotRaiseMonitor(bool)));
330 connect(m_effectList, SIGNAL(addEffect(QDomElement)), this, SLOT(slotAddEffect(QDomElement)));
331 connect(m_effectList, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
333 m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
334 slotConnectMonitors();
336 // Open or create a file. Command line argument passed in Url has
337 // precedence, then "openlastproject", then just a plain empty file.
338 // If opening Url fails, openlastproject will _not_ be used.
339 if (!Url.isEmpty()) {
342 if (KdenliveSettings::openlastproject()) {
346 if (m_timelineArea->count() == 0) {
350 #ifndef NO_JOGSHUTTLE
351 activateShuttleDevice();
352 #endif /* NO_JOGSHUTTLE */
353 projectListDock->raise();
356 void MainWindow::queryQuit() {
357 kDebug() << "----- SAVING CONFUIG";
358 if (queryClose()) kapp->quit();
362 bool MainWindow::queryClose() {
364 if (m_monitorManager) m_monitorManager->stopActiveMonitor();
365 if (m_activeDocument && m_activeDocument->isModified()) {
366 switch (KMessageBox::warningYesNoCancel(this, i18n("Save changes to document ?"))) {
367 case KMessageBox::Yes :
368 // save document here. If saving fails, return false;
370 case KMessageBox::No :
379 void MainWindow::saveProperties(KConfig*) {
380 // save properties here,used by session management
385 void MainWindow::readProperties(KConfig *config) {
386 // read properties here,used by session management
387 QString Lastproject = config->group("Recent Files").readPathEntry("File1", QString());
388 openFile(KUrl(Lastproject));
391 void MainWindow::slotReloadEffects() {
392 initEffects::parseCustomEffectsFile();
393 m_customEffectsMenu->clear();
394 const QStringList effects = customEffects.effectNames();
396 if (effects.isEmpty()) m_customEffectsMenu->setEnabled(false);
397 else m_customEffectsMenu->setEnabled(true);
399 foreach(const QString &name, effects) {
400 action = new QAction(name, this);
401 action->setData(name);
402 m_customEffectsMenu->addAction(action);
404 m_effectList->reloadEffectList();
407 #ifndef NO_JOGSHUTTLE
408 void MainWindow::activateShuttleDevice() {
409 if (m_jogProcess) delete m_jogProcess;
411 if (KdenliveSettings::enableshuttle() == false) return;
412 m_jogProcess = new JogShuttle(KdenliveSettings::shuttledevice());
413 connect(m_jogProcess, SIGNAL(rewind1()), m_monitorManager, SLOT(slotRewindOneFrame()));
414 connect(m_jogProcess, SIGNAL(forward1()), m_monitorManager, SLOT(slotForwardOneFrame()));
415 connect(m_jogProcess, SIGNAL(rewind(double)), m_monitorManager, SLOT(slotRewind(double)));
416 connect(m_jogProcess, SIGNAL(forward(double)), m_monitorManager, SLOT(slotForward(double)));
417 connect(m_jogProcess, SIGNAL(stop()), m_monitorManager, SLOT(slotPlay()));
418 connect(m_jogProcess, SIGNAL(button(int)), this, SLOT(slotShuttleButton(int)));
421 void MainWindow::slotShuttleButton(int code) {
424 slotShuttleAction(KdenliveSettings::shuttle1());
427 slotShuttleAction(KdenliveSettings::shuttle2());
430 slotShuttleAction(KdenliveSettings::shuttle3());
433 slotShuttleAction(KdenliveSettings::shuttle4());
436 slotShuttleAction(KdenliveSettings::shuttle5());
441 void MainWindow::slotShuttleAction(int code) {
446 m_monitorManager->slotPlay();
449 m_monitorManager->slotPlay();
453 #endif /* NO_JOGSHUTTLE */
455 void MainWindow::configureNotifications() {
456 KNotifyConfigWidget::configure(this);
459 void MainWindow::slotFullScreen() {
460 KToggleFullScreenAction::setFullScreen(this, actionCollection()->action("fullscreen")->isChecked());
463 void MainWindow::slotAddEffect(QDomElement effect, GenTime pos, int track) {
464 if (!m_activeDocument) return;
465 if (effect.isNull()) {
466 kDebug() << "--- ERROR, TRYING TO APPEND NULL EFFECT";
469 TrackView *currentTimeLine = (TrackView *) m_timelineArea->currentWidget();
470 currentTimeLine->projectView()->slotAddEffect(effect.cloneNode().toElement(), pos, track);
473 void MainWindow::slotRaiseMonitor(bool clipMonitor) {
474 if (clipMonitor) clipMonitorDock->raise();
475 else projectMonitorDock->raise();
478 void MainWindow::slotSetClipDuration(const QString &id, int duration) {
479 if (!m_activeDocument) return;
480 m_activeDocument->setProducerDuration(id, duration);
483 void MainWindow::slotConnectMonitors() {
485 m_projectList->setRenderer(m_projectMonitor->render);
486 connect(m_projectList, SIGNAL(receivedClipDuration(const QString &, int)), this, SLOT(slotSetClipDuration(const QString &, int)));
487 connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *)));
488 connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, const QString &)), m_projectMonitor->render, SLOT(getFileProperties(const QDomElement &, const QString &)));
489 connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, int, const QPixmap &, int, int)), m_projectList, SLOT(slotReplyGetImage(const QString &, int, const QPixmap &, int, int)));
490 connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &)), m_projectList, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &)));
492 connect(m_projectMonitor->render, SIGNAL(removeInvalidClip(const QString &)), m_projectList, SLOT(slotRemoveInvalidClip(const QString &)));
494 connect(m_clipMonitor, SIGNAL(refreshClipThumbnail(const QString &)), m_projectList, SLOT(slotRefreshClipThumbnail(const QString &)));
496 connect(m_clipMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustClipMonitor()));
497 connect(m_projectMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustProjectMonitor()));
499 connect(m_clipMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
500 connect(m_projectMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
503 void MainWindow::slotAdjustClipMonitor() {
504 clipMonitorDock->updateGeometry();
505 clipMonitorDock->adjustSize();
506 m_clipMonitor->resetSize();
509 void MainWindow::slotAdjustProjectMonitor() {
510 projectMonitorDock->updateGeometry();
511 projectMonitorDock->adjustSize();
512 m_projectMonitor->resetSize();
515 void MainWindow::setupActions() {
517 KActionCollection* collection = actionCollection();
518 m_timecodeFormat = new KComboBox(this);
519 m_timecodeFormat->addItem(i18n("hh:mm:ss::ff"));
520 m_timecodeFormat->addItem(i18n("Frames"));
522 statusProgressBar = new QProgressBar(this);
523 statusProgressBar->setMinimum(0);
524 statusProgressBar->setMaximum(100);
525 statusProgressBar->setMaximumWidth(150);
526 statusProgressBar->setVisible(false);
528 QWidget *w = new QWidget;
530 QHBoxLayout *layout = new QHBoxLayout;
531 w->setLayout(layout);
532 layout->setContentsMargins(5, 0, 5, 0);
533 QToolBar *toolbar = new QToolBar("statusToolBar", this);
536 m_toolGroup = new QActionGroup(this);
538 QString style1 = "QToolButton {background-color: rgba(230, 230, 230, 220); border-style: inset; border:1px solid #999999;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton:checked { background-color: rgba(224, 224, 0, 100); border-style: inset; border:1px solid #cc6666;border-radius: 3px;}";
540 m_buttonSelectTool = new KAction(KIcon("kdenlive-select-tool"), i18n("Selection tool"), this);
541 toolbar->addAction(m_buttonSelectTool);
542 m_buttonSelectTool->setCheckable(true);
543 m_buttonSelectTool->setChecked(true);
545 m_buttonRazorTool = new KAction(KIcon("edit-cut"), i18n("Razor tool"), this);
546 toolbar->addAction(m_buttonRazorTool);
547 m_buttonRazorTool->setCheckable(true);
548 m_buttonRazorTool->setChecked(false);
550 m_buttonSpacerTool = new KAction(KIcon("kdenlive-spacer-tool"), i18n("Spacer tool"), this);
551 toolbar->addAction(m_buttonSpacerTool);
552 m_buttonSpacerTool->setCheckable(true);
553 m_buttonSpacerTool->setChecked(false);
555 m_toolGroup->addAction(m_buttonSelectTool);
556 m_toolGroup->addAction(m_buttonRazorTool);
557 m_toolGroup->addAction(m_buttonSpacerTool);
558 m_toolGroup->setExclusive(true);
559 toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
561 QWidget * actionWidget;
562 actionWidget = toolbar->widgetForAction(m_buttonSelectTool);
563 actionWidget->setMaximumWidth(24);
564 actionWidget->setMinimumHeight(17);
566 actionWidget = toolbar->widgetForAction(m_buttonRazorTool);
567 actionWidget->setMaximumWidth(24);
568 actionWidget->setMinimumHeight(17);
570 actionWidget = toolbar->widgetForAction(m_buttonSpacerTool);
571 actionWidget->setMaximumWidth(24);
572 actionWidget->setMinimumHeight(17);
574 toolbar->setStyleSheet(style1);
575 connect(m_toolGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeTool(QAction *)));
577 toolbar->addSeparator();
578 m_buttonFitZoom = new KAction(KIcon("zoom-fit-best"), i18n("Fit zoom to project"), this);
579 toolbar->addAction(m_buttonFitZoom);
580 m_buttonFitZoom->setCheckable(false);
581 connect(m_buttonFitZoom, SIGNAL(triggered()), this, SLOT(slotFitZoom()));
583 actionWidget = toolbar->widgetForAction(m_buttonFitZoom);
584 actionWidget->setMaximumWidth(24);
585 actionWidget->setMinimumHeight(17);
587 m_zoomSlider = new QSlider(Qt::Horizontal, this);
588 m_zoomSlider->setMaximum(13);
589 m_zoomSlider->setPageStep(1);
591 m_zoomSlider->setMaximumWidth(150);
592 m_zoomSlider->setMinimumWidth(100);
594 const int contentHeight = QFontMetrics(w->font()).height() + 8;
596 QString style = "QSlider::groove:horizontal { background-color: rgba(230, 230, 230, 220);border: 1px solid #999999;height: 8px;border-radius: 3px;margin-top:3px }";
597 style.append("QSlider::handle:horizontal { background-color: white; border: 1px solid #999999;width: 9px;margin: -2px 0;border-radius: 3px; }");
599 m_zoomSlider->setStyleSheet(style);
601 //m_zoomSlider->height() + 5;
602 statusBar()->setMinimumHeight(contentHeight);
605 toolbar->addWidget(m_zoomSlider);
607 m_buttonVideoThumbs = new KAction(KIcon("kdenlive-show-videothumb"), i18n("Show video thumbnails"), this);
608 toolbar->addAction(m_buttonVideoThumbs);
609 m_buttonVideoThumbs->setCheckable(true);
610 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
611 connect(m_buttonVideoThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchVideoThumbs()));
613 m_buttonAudioThumbs = new KAction(KIcon("kdenlive-show-audiothumb"), i18n("Show audio thumbnails"), this);
614 toolbar->addAction(m_buttonAudioThumbs);
615 m_buttonAudioThumbs->setCheckable(true);
616 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
617 connect(m_buttonAudioThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchAudioThumbs()));
619 m_buttonShowMarkers = new KAction(KIcon("kdenlive-show-markers"), i18n("Show markers comments"), this);
620 toolbar->addAction(m_buttonShowMarkers);
621 m_buttonShowMarkers->setCheckable(true);
622 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
623 connect(m_buttonShowMarkers, SIGNAL(triggered()), this, SLOT(slotSwitchMarkersComments()));
625 m_buttonSnap = new KAction(KIcon("kdenlive-snap"), i18n("Snap"), this);
626 toolbar->addAction(m_buttonSnap);
627 m_buttonSnap->setCheckable(true);
628 m_buttonSnap->setChecked(KdenliveSettings::snaptopoints());
629 connect(m_buttonSnap, SIGNAL(triggered()), this, SLOT(slotSwitchSnap()));
630 layout->addWidget(toolbar);
633 actionWidget = toolbar->widgetForAction(m_buttonVideoThumbs);
634 actionWidget->setMaximumWidth(24);
635 actionWidget->setMinimumHeight(17);
637 actionWidget = toolbar->widgetForAction(m_buttonAudioThumbs);
638 actionWidget->setMaximumWidth(24);
639 actionWidget->setMinimumHeight(17);
641 actionWidget = toolbar->widgetForAction(m_buttonShowMarkers);
642 actionWidget->setMaximumWidth(24);
643 actionWidget->setMinimumHeight(17);
645 actionWidget = toolbar->widgetForAction(m_buttonSnap);
646 actionWidget->setMaximumWidth(24);
647 actionWidget->setMinimumHeight(17);
649 m_messageLabel = new StatusBarMessageLabel(this);
650 m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
652 statusBar()->addWidget(m_messageLabel, 10);
653 statusBar()->addWidget(statusProgressBar, 0);
654 statusBar()->insertPermanentWidget(ID_TIMELINE_BUTTONS, w);
655 statusBar()->insertPermanentFixedItem("00:00:00:00", ID_TIMELINE_POS);
656 statusBar()->insertPermanentWidget(ID_TIMELINE_FORMAT, m_timecodeFormat);
657 statusBar()->setMaximumHeight(statusBar()->font().pointSize() * 4);
658 m_messageLabel->hide();
660 collection->addAction("select_tool", m_buttonSelectTool);
661 collection->addAction("razor_tool", m_buttonRazorTool);
662 collection->addAction("spacer_tool", m_buttonSpacerTool);
664 collection->addAction("show_video_thumbs", m_buttonVideoThumbs);
665 collection->addAction("show_audio_thumbs", m_buttonAudioThumbs);
666 collection->addAction("show_markers", m_buttonShowMarkers);
667 collection->addAction("snap", m_buttonSnap);
668 collection->addAction("zoom_fit", m_buttonFitZoom);
670 KAction* zoomIn = new KAction(KIcon("zoom-in"), i18n("Zoom In"), this);
671 collection->addAction("zoom_in", zoomIn);
672 connect(zoomIn, SIGNAL(triggered(bool)), this, SLOT(slotZoomIn()));
673 zoomIn->setShortcut(Qt::CTRL + Qt::Key_Plus);
675 KAction* zoomOut = new KAction(KIcon("zoom-out"), i18n("Zoom Out"), this);
676 collection->addAction("zoom_out", zoomOut);
677 connect(zoomOut, SIGNAL(triggered(bool)), this, SLOT(slotZoomOut()));
678 zoomOut->setShortcut(Qt::CTRL + Qt::Key_Minus);
680 m_projectSearch = new KAction(KIcon("edit-find"), i18n("Find"), this);
681 collection->addAction("project_find", m_projectSearch);
682 connect(m_projectSearch, SIGNAL(triggered(bool)), this, SLOT(slotFind()));
683 m_projectSearch->setShortcut(Qt::Key_Slash);
685 m_projectSearchNext = new KAction(KIcon("go-down-search"), i18n("Find Next"), this);
686 collection->addAction("project_find_next", m_projectSearchNext);
687 connect(m_projectSearchNext, SIGNAL(triggered(bool)), this, SLOT(slotFindNext()));
688 m_projectSearchNext->setShortcut(Qt::Key_F3);
689 m_projectSearchNext->setEnabled(false);
691 KAction* profilesAction = new KAction(KIcon("document-new"), i18n("Manage Profiles"), this);
692 collection->addAction("manage_profiles", profilesAction);
693 connect(profilesAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProfiles()));
695 KAction* fileGHNS = KNS::standardAction(i18n("Download New Lumas..."), this, SLOT(slotGetNewStuff()), actionCollection(), "get_new_stuff");
697 KAction* wizAction = new KAction(KIcon("configure"), i18n("Run Config Wizard"), this);
698 collection->addAction("run_wizard", wizAction);
699 connect(wizAction, SIGNAL(triggered(bool)), this, SLOT(slotRunWizard()));
701 KAction* projectAction = new KAction(KIcon("configure"), i18n("Project Settings"), this);
702 collection->addAction("project_settings", projectAction);
703 connect(projectAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProjectSettings()));
705 KAction* projectRender = new KAction(KIcon("media-record"), i18n("Render"), this);
706 collection->addAction("project_render", projectRender);
707 projectRender->setShortcut(Qt::CTRL + Qt::Key_Return);
708 connect(projectRender, SIGNAL(triggered(bool)), this, SLOT(slotRenderProject()));
710 KAction* monitorPlay = new KAction(KIcon("media-playback-start"), i18n("Play"), this);
711 KShortcut playShortcut;
712 playShortcut.setPrimary(Qt::Key_Space);
713 playShortcut.setAlternate(Qt::Key_K);
714 monitorPlay->setShortcut(playShortcut);
715 collection->addAction("monitor_play", monitorPlay);
716 connect(monitorPlay, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotPlay()));
718 KAction *markIn = collection->addAction("mark_in");
719 markIn->setText(i18n("Set In Point"));
720 markIn->setShortcut(Qt::Key_I);
721 connect(markIn, SIGNAL(triggered(bool)), this, SLOT(slotSetInPoint()));
723 KAction *markOut = collection->addAction("mark_out");
724 markOut->setText(i18n("Set Out Point"));
725 markOut->setShortcut(Qt::Key_O);
726 connect(markOut, SIGNAL(triggered(bool)), this, SLOT(slotSetOutPoint()));
728 KAction* monitorSeekBackward = new KAction(KIcon("media-seek-backward"), i18n("Rewind"), this);
729 monitorSeekBackward->setShortcut(Qt::Key_J);
730 collection->addAction("monitor_seek_backward", monitorSeekBackward);
731 connect(monitorSeekBackward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewind()));
733 KAction* monitorSeekBackwardOneFrame = new KAction(KIcon("media-skip-backward"), i18n("Rewind 1 Frame"), this);
734 monitorSeekBackwardOneFrame->setShortcut(Qt::Key_Left);
735 collection->addAction("monitor_seek_backward-one-frame", monitorSeekBackwardOneFrame);
736 connect(monitorSeekBackwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewindOneFrame()));
738 KAction* monitorSeekBackwardOneSecond = new KAction(KIcon("media-skip-backward"), i18n("Rewind 1 Second"), this);
739 monitorSeekBackwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Left);
740 collection->addAction("monitor_seek_backward-one-second", monitorSeekBackwardOneSecond);
741 connect(monitorSeekBackwardOneSecond, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewindOneSecond()));
743 KAction* monitorSeekSnapBackward = new KAction(KIcon("media-seek-backward"), i18n("Go to Previous Snap Point"), this);
744 monitorSeekSnapBackward->setShortcut(Qt::ALT + Qt::Key_Left);
745 collection->addAction("monitor_seek_snap_backward", monitorSeekSnapBackward);
746 connect(monitorSeekSnapBackward, SIGNAL(triggered(bool)), this, SLOT(slotSnapRewind()));
748 KAction* monitorSeekForward = new KAction(KIcon("media-seek-forward"), i18n("Forward"), this);
749 monitorSeekForward->setShortcut(Qt::Key_L);
750 collection->addAction("monitor_seek_forward", monitorSeekForward);
751 connect(monitorSeekForward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForward()));
753 KAction* clipStart = new KAction(KIcon("media-seek-backward"), i18n("Go to Clip Start"), this);
754 clipStart->setShortcut(Qt::Key_Home);
755 collection->addAction("seek_clip_start", clipStart);
756 connect(clipStart, SIGNAL(triggered(bool)), this, SLOT(slotClipStart()));
758 KAction* clipEnd = new KAction(KIcon("media-seek-forward"), i18n("Go to Clip End"), this);
759 clipEnd->setShortcut(Qt::Key_End);
760 collection->addAction("seek_clip_end", clipEnd);
761 connect(clipEnd, SIGNAL(triggered(bool)), this, SLOT(slotClipEnd()));
763 KAction* projectStart = new KAction(KIcon("go-first"), i18n("Go to Project Start"), this);
764 projectStart->setShortcut(Qt::CTRL + Qt::Key_Home);
765 collection->addAction("seek_start", projectStart);
766 connect(projectStart, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotStart()));
768 KAction* projectEnd = new KAction(KIcon("go-last"), i18n("Go to Project End"), this);
769 projectEnd->setShortcut(Qt::CTRL + Qt::Key_End);
770 collection->addAction("seek_end", projectEnd);
771 connect(projectEnd, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotEnd()));
773 KAction* monitorSeekForwardOneFrame = new KAction(KIcon("media-skip-forward"), i18n("Forward 1 Frame"), this);
774 monitorSeekForwardOneFrame->setShortcut(Qt::Key_Right);
775 collection->addAction("monitor_seek_forward-one-frame", monitorSeekForwardOneFrame);
776 connect(monitorSeekForwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneFrame()));
778 KAction* monitorSeekForwardOneSecond = new KAction(KIcon("media-skip-forward"), i18n("Forward 1 Second"), this);
779 monitorSeekForwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Right);
780 collection->addAction("monitor_seek_forward-one-second", monitorSeekForwardOneSecond);
781 connect(monitorSeekForwardOneSecond, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneSecond()));
783 KAction* monitorSeekSnapForward = new KAction(KIcon("media-seek-forward"), i18n("Go to Next Snap Point"), this);
784 monitorSeekSnapForward->setShortcut(Qt::ALT + Qt::Key_Right);
785 collection->addAction("monitor_seek_snap_forward", monitorSeekSnapForward);
786 connect(monitorSeekSnapForward, SIGNAL(triggered(bool)), this, SLOT(slotSnapForward()));
788 KAction* deleteTimelineClip = new KAction(KIcon("edit-delete"), i18n("Delete Selected Item"), this);
789 deleteTimelineClip->setShortcut(Qt::Key_Delete);
790 collection->addAction("delete_timeline_clip", deleteTimelineClip);
791 connect(deleteTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotDeleteTimelineClip()));
793 KAction* editTimelineClipSpeed = new KAction(i18n("Change Clip Speed"), this);
794 collection->addAction("change_clip_speed", editTimelineClipSpeed);
795 connect(editTimelineClipSpeed, SIGNAL(triggered(bool)), this, SLOT(slotChangeClipSpeed()));
797 KAction *stickTransition = collection->addAction("auto_transition");
798 stickTransition->setData(QString("auto"));
799 stickTransition->setCheckable(true);
800 stickTransition->setEnabled(false);
801 stickTransition->setText(i18n("Automatic Transition"));
802 connect(stickTransition, SIGNAL(triggered(bool)), this, SLOT(slotAutoTransition()));
804 KAction* cutTimelineClip = new KAction(KIcon("edit-cut"), i18n("Cut Clip"), this);
805 cutTimelineClip->setShortcut(Qt::SHIFT + Qt::Key_R);
806 collection->addAction("cut_timeline_clip", cutTimelineClip);
807 connect(cutTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotCutTimelineClip()));
809 KAction* addClipMarker = new KAction(KIcon("bookmark-new"), i18n("Add Marker"), this);
810 collection->addAction("add_clip_marker", addClipMarker);
811 connect(addClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotAddClipMarker()));
813 KAction* deleteClipMarker = new KAction(KIcon("edit-delete"), i18n("Delete Marker"), this);
814 collection->addAction("delete_clip_marker", deleteClipMarker);
815 connect(deleteClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotDeleteClipMarker()));
817 KAction* deleteAllClipMarkers = new KAction(KIcon("edit-delete"), i18n("Delete All Markers"), this);
818 collection->addAction("delete_all_clip_markers", deleteAllClipMarkers);
819 connect(deleteAllClipMarkers, SIGNAL(triggered(bool)), this, SLOT(slotDeleteAllClipMarkers()));
821 KAction* editClipMarker = new KAction(KIcon("document-properties"), i18n("Edit Marker"), this);
822 collection->addAction("edit_clip_marker", editClipMarker);
823 connect(editClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotEditClipMarker()));
825 KAction *insertSpace = new KAction(KIcon(), i18n("Insert Space"), this);
826 collection->addAction("insert_space", insertSpace);
827 connect(insertSpace, SIGNAL(triggered()), this, SLOT(slotInsertSpace()));
829 KAction *removeSpace = new KAction(KIcon(), i18n("Remove Space"), this);
830 collection->addAction("delete_space", removeSpace);
831 connect(removeSpace, SIGNAL(triggered()), this, SLOT(slotRemoveSpace()));
833 KAction *insertTrack = new KAction(KIcon(), i18n("Insert Track"), this);
834 collection->addAction("insert_track", insertTrack);
835 connect(insertTrack, SIGNAL(triggered()), this, SLOT(slotInsertTrack()));
837 KAction *deleteTrack = new KAction(KIcon(), i18n("Delete Track"), this);
838 collection->addAction("delete_track", deleteTrack);
839 connect(deleteTrack, SIGNAL(triggered()), this, SLOT(slotDeleteTrack()));
841 KAction *changeTrack = new KAction(KIcon(), i18n("Change Track"), this);
842 collection->addAction("change_track", changeTrack);
843 connect(changeTrack, SIGNAL(triggered()), this, SLOT(slotChangeTrack()));
845 KAction *addGuide = new KAction(KIcon("document-new"), i18n("Add Guide"), this);
846 collection->addAction("add_guide", addGuide);
847 connect(addGuide, SIGNAL(triggered()), this, SLOT(slotAddGuide()));
849 QAction *delGuide = new KAction(KIcon("edit-delete"), i18n("Delete Guide"), this);
850 collection->addAction("delete_guide", delGuide);
851 connect(delGuide, SIGNAL(triggered()), this, SLOT(slotDeleteGuide()));
853 QAction *editGuide = new KAction(KIcon("document-properties"), i18n("Edit Guide"), this);
854 collection->addAction("edit_guide", editGuide);
855 connect(editGuide, SIGNAL(triggered()), this, SLOT(slotEditGuide()));
857 QAction *delAllGuides = new KAction(KIcon("edit-delete"), i18n("Delete All Guides"), this);
858 collection->addAction("delete_all_guides", delAllGuides);
859 connect(delAllGuides, SIGNAL(triggered()), this, SLOT(slotDeleteAllGuides()));
861 QAction *pasteEffects = new KAction(KIcon("edit-paste"), i18n("Paste Effects"), this);
862 collection->addAction("paste_effects", pasteEffects);
863 connect(pasteEffects , SIGNAL(triggered()), this, SLOT(slotPasteEffects()));
865 m_closeAction = KStandardAction::close(this, SLOT(closeCurrentDocument()), collection);
867 KStandardAction::quit(this, SLOT(queryQuit()), collection);
869 KStandardAction::open(this, SLOT(openFile()), collection);
871 m_saveAction = KStandardAction::save(this, SLOT(saveFile()), collection);
873 KStandardAction::saveAs(this, SLOT(saveFileAs()), collection);
875 KStandardAction::openNew(this, SLOT(newFile()), collection);
877 KStandardAction::preferences(this, SLOT(slotPreferences()), collection);
879 KStandardAction::configureNotifications(this , SLOT(configureNotifications()), collection);
881 KStandardAction::copy(this, SLOT(slotCopy()), collection);
883 KStandardAction::paste(this, SLOT(slotPaste()), collection);
885 KAction *undo = KStandardAction::undo(m_commandStack, SLOT(undo()), collection);
886 undo->setEnabled(false);
887 connect(m_commandStack, SIGNAL(canUndoChanged(bool)), undo, SLOT(setEnabled(bool)));
889 KAction *redo = KStandardAction::redo(m_commandStack, SLOT(redo()), collection);
890 redo->setEnabled(false);
891 connect(m_commandStack, SIGNAL(canRedoChanged(bool)), redo, SLOT(setEnabled(bool)));
893 KStandardAction::fullScreen(this, SLOT(slotFullScreen()), this, collection);
895 connect(collection, SIGNAL(actionHovered(QAction*)),
896 this, SLOT(slotDisplayActionMessage(QAction*)));
897 //connect(collection, SIGNAL( clearStatusText() ),
898 //statusBar(), SLOT( clear() ) );
901 void MainWindow::slotDisplayActionMessage(QAction *a) {
902 statusBar()->showMessage(a->data().toString(), 3000);
905 void MainWindow::saveOptions() {
906 KdenliveSettings::self()->writeConfig();
907 KSharedConfigPtr config = KGlobal::config();
908 m_fileOpenRecent->saveEntries(KConfigGroup(config, "Recent Files"));
909 KConfigGroup treecolumns(config, "Project Tree");
910 treecolumns.writeEntry("columns", m_projectList->headerInfo());
914 void MainWindow::readOptions() {
915 KSharedConfigPtr config = KGlobal::config();
916 m_fileOpenRecent->loadEntries(KConfigGroup(config, "Recent Files"));
917 KConfigGroup initialGroup(config, "version");
918 if (!initialGroup.exists()) {
919 // this is our first run, show Wizard
920 Wizard *w = new Wizard(this);
921 if (w->exec() == QDialog::Accepted && w->isOk()) {
923 initialGroup.writeEntry("version", "0.7");
928 } else if (initialGroup.readEntry("version") == "0.7") {
929 //Add new settings from 0.7.1
930 if (KdenliveSettings::defaultprojectfolder().isEmpty()) {
931 QString path = QDir::homePath() + "/kdenlive";
932 if (KStandardDirs::makeDir(path) == false) kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path;
933 KdenliveSettings::setDefaultprojectfolder(path);
936 KConfigGroup treecolumns(config, "Project Tree");
937 const QByteArray state = treecolumns.readEntry("columns", QByteArray());
938 if (!state.isEmpty())
939 m_projectList->setHeaderInfo(state);
942 void MainWindow::slotRunWizard() {
943 Wizard *w = new Wizard(this);
944 if (w->exec() == QDialog::Accepted && w->isOk()) {
950 void MainWindow::newFile(bool showProjectSettings) {
953 QPoint projectTracks(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks());
954 if (!showProjectSettings && m_timelineArea->count() == 0) {
955 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
956 profileName = KdenliveSettings::default_profile();
958 ProjectSettings *w = new ProjectSettings(projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, this);
959 if (w->exec() != QDialog::Accepted) return;
960 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
961 profileName = w->selectedProfile();
962 projectFolder = w->selectedFolder();
963 projectTracks = w->tracks();
966 KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, projectTracks, m_projectMonitor->render, this);
967 doc->m_autosave = new KAutoSaveFile(KUrl(), doc);
968 TrackView *trackView = new TrackView(doc, this);
969 m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description());
970 if (m_timelineArea->count() == 1) {
971 connectDocumentInfo(doc);
972 connectDocument(trackView, doc);
973 } else m_timelineArea->setTabBarHidden(false);
974 m_closeAction->setEnabled(m_timelineArea->count() > 1);
977 void MainWindow::activateDocument() {
978 if (m_timelineArea->currentWidget() == NULL) return;
979 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
980 KdenliveDoc *currentDoc = currentTab->document();
981 connectDocumentInfo(currentDoc);
982 connectDocument(currentTab, currentDoc);
985 void MainWindow::closeCurrentDocument() {
986 QWidget *w = m_timelineArea->currentWidget();
988 // closing current document
989 int ix = m_timelineArea->currentIndex() + 1;
990 if (ix == m_timelineArea->count()) ix = 0;
991 m_timelineArea->setCurrentIndex(ix);
992 TrackView *tabToClose = (TrackView *) w;
993 KdenliveDoc *docToClose = tabToClose->document();
994 if (docToClose && docToClose->isModified()) {
995 switch (KMessageBox::warningYesNoCancel(this, i18n("Save changes to document ?"))) {
996 case KMessageBox::Yes :
997 // save document here. If saving fails, return false;
1000 case KMessageBox::Cancel :
1006 m_timelineArea->removeTab(m_timelineArea->indexOf(w));
1007 if (m_timelineArea->count() == 1) {
1008 m_timelineArea->setTabBarHidden(true);
1009 m_closeAction->setEnabled(false);
1013 if (m_timelineArea->count() == 0) {
1014 m_activeDocument = NULL;
1015 effectStack->clear();
1016 transitionConfig->slotTransitionItemSelected(NULL, false);
1020 bool MainWindow::saveFileAs(const QString &outputFileName) {
1021 QDomDocument currentSceneList = m_projectMonitor->sceneList();
1022 if (m_activeDocument->saveSceneList(outputFileName, currentSceneList) == false)
1025 // Save timeline thumbnails
1026 m_activeTimeline->projectView()->saveThumbnails();
1027 m_activeDocument->setUrl(KUrl(outputFileName));
1028 if (m_activeDocument->m_autosave == NULL) {
1029 m_activeDocument->m_autosave = new KAutoSaveFile(KUrl(outputFileName), this);
1030 } else m_activeDocument->m_autosave->setManagedFile(KUrl(outputFileName));
1031 setCaption(m_activeDocument->description());
1032 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
1033 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), m_activeDocument->url().path());
1034 m_activeDocument->setModified(false);
1035 m_fileOpenRecent->addUrl(KUrl(outputFileName));
1039 bool MainWindow::saveFileAs() {
1040 // Check that the Kdenlive mime type is correctly installed
1041 QString mimetype = "application/x-kdenlive";
1042 KMimeType::Ptr mime = KMimeType::mimeType(mimetype);
1043 if (!mime) mimetype = "*.kdenlive";
1045 QString outputFile = KFileDialog::getSaveFileName(KUrl(), mimetype);
1046 if (outputFile.isEmpty()) return false;
1047 if (QFile::exists(outputFile)) {
1048 if (KMessageBox::questionYesNo(this, i18n("File already exists.\nDo you want to overwrite it ?")) == KMessageBox::No) return false;
1050 return saveFileAs(outputFile);
1053 bool MainWindow::saveFile() {
1054 if (!m_activeDocument) return true;
1055 if (m_activeDocument->url().isEmpty()) {
1056 return saveFileAs();
1058 bool result = saveFileAs(m_activeDocument->url().path());
1059 m_activeDocument->m_autosave->resize(0);
1064 void MainWindow::openFile() {
1065 // Check that the Kdenlive mime type is correctly installed
1066 QString mimetype = "application/x-kdenlive";
1067 KMimeType::Ptr mime = KMimeType::mimeType(mimetype);
1068 if (!mime) mimetype = "*.kdenlive";
1070 KUrl url = KFileDialog::getOpenUrl(KUrl(), mimetype);
1071 if (url.isEmpty()) return;
1072 m_fileOpenRecent->addUrl(url);
1076 void MainWindow::openLastFile() {
1077 KSharedConfigPtr config = KGlobal::config();
1078 KUrl::List urls = m_fileOpenRecent->urls();
1079 //WARNING: this is buggy, we get a random url, not the last one. Bug in KRecentFileAction ?
1080 if (urls.isEmpty()) newFile(false);
1081 else openFile(urls.last());
1084 void MainWindow::openFile(const KUrl &url) {
1085 // Check if the document is already opened
1086 const int ct = m_timelineArea->count();
1087 bool isOpened = false;
1089 for (i = 0; i < ct; i++) {
1090 TrackView *tab = (TrackView *) m_timelineArea->widget(i);
1091 KdenliveDoc *doc = tab->document();
1092 if (doc->url() == url) {
1098 m_timelineArea->setCurrentIndex(i);
1102 // Check for backup file
1103 QList<KAutoSaveFile *> staleFiles = KAutoSaveFile::staleFiles(url);
1104 if (!staleFiles.isEmpty()) {
1105 if (KMessageBox::questionYesNo(this,
1106 i18n("Auto-saved files exist. Do you want to recover them now?"),
1107 i18n("File Recovery"),
1108 KGuiItem(i18n("Recover")), KGuiItem(i18n("Don't recover"))) == KMessageBox::Yes) {
1109 recoverFiles(staleFiles);
1112 // remove the stale files
1113 foreach(KAutoSaveFile *stale, staleFiles) {
1114 stale->open(QIODevice::ReadWrite);
1119 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1120 doOpenFile(url, NULL);
1123 void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale) {
1125 doc = new KdenliveDoc(url, KUrl(), m_commandStack, QString(), QPoint(3, 2), m_projectMonitor->render, this);
1126 if (stale == NULL) {
1127 stale = new KAutoSaveFile(url, doc);
1128 doc->m_autosave = stale;
1130 doc->m_autosave = stale;
1131 doc->setUrl(stale->managedFile());
1132 doc->setModified(true);
1133 stale->setParent(doc);
1135 connectDocumentInfo(doc);
1136 TrackView *trackView = new TrackView(doc, this);
1137 m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description()));
1138 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
1139 trackView->setDuration(trackView->duration());
1140 trackView->projectView()->setCursorPos(m_projectMonitor->render->seekPosition().frames(doc->fps()));
1141 if (m_timelineArea->count() > 1) m_timelineArea->setTabBarHidden(false);
1142 slotGotProgressInfo(QString(), -1);
1143 m_clipMonitor->refreshMonitor(true);
1146 void MainWindow::recoverFiles(QList<KAutoSaveFile *> staleFiles) {
1147 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1148 foreach(KAutoSaveFile *stale, staleFiles) {
1149 /*if (!stale->open(QIODevice::QIODevice::ReadOnly)) {
1150 // show an error message; we could not steal the lockfile
1151 // maybe another application got to the file before us?
1155 kDebug() << "// OPENING RECOVERY: " << stale->fileName() << "\nMANAGED: " << stale->managedFile().path();
1156 // the stalefiles also contain ".lock" files so we must ignore them... bug in KAutoSaveFile ?
1157 if (!stale->fileName().endsWith(".lock")) doOpenFile(KUrl(stale->fileName()), stale);
1158 else KIO::NetAccess::del(KUrl(stale->fileName()), this);
1163 void MainWindow::parseProfiles(const QString &mltPath) {
1164 //kdDebug()<<" + + YOUR MLT INSTALL WAS FOUND IN: "<< MLT_PREFIX <<endl;
1166 //KdenliveSettings::setDefaulttmpfolder();
1167 if (!mltPath.isEmpty()) {
1168 KdenliveSettings::setMltpath(mltPath + "/share/mlt/profiles/");
1169 KdenliveSettings::setRendererpath(mltPath + "/bin/inigo");
1172 if (KdenliveSettings::mltpath().isEmpty()) {
1173 KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
1175 if (KdenliveSettings::rendererpath().isEmpty()) {
1176 QString inigoPath = QString(MLT_PREFIX) + QString("/bin/inigo");
1177 if (!QFile::exists(inigoPath))
1178 inigoPath = KStandardDirs::findExe("inigo");
1179 else KdenliveSettings::setRendererpath(inigoPath);
1181 QStringList profilesFilter;
1182 profilesFilter << "*";
1183 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1185 if (profilesList.isEmpty()) {
1186 // Cannot find MLT path, try finding inigo
1187 QString profilePath = KdenliveSettings::rendererpath();
1188 if (!profilePath.isEmpty()) {
1189 profilePath = profilePath.section('/', 0, -3);
1190 KdenliveSettings::setMltpath(profilePath + "/share/mlt/profiles/");
1191 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1194 if (profilesList.isEmpty()) {
1195 // Cannot find the MLT profiles, ask for location
1196 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your Mlt profiles, please give the path"), this);
1197 getUrl->fileDialog()->setMode(KFile::Directory);
1198 if (getUrl->exec() == QDialog::Rejected) {
1201 KUrl mltPath = getUrl->selectedUrl();
1203 if (mltPath.isEmpty()) ::exit(0);
1204 KdenliveSettings::setMltpath(mltPath.path());
1205 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1209 if (KdenliveSettings::rendererpath().isEmpty()) {
1210 // Cannot find the MLT inigo renderer, ask for location
1211 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the inigo program required for rendering (part of Mlt)"), this);
1212 if (getUrl->exec() == QDialog::Rejected) {
1215 KUrl rendererPath = getUrl->selectedUrl();
1217 if (rendererPath.isEmpty()) ::exit(0);
1218 KdenliveSettings::setRendererpath(rendererPath.path());
1221 kDebug() << "RESULTING MLT PATH: " << KdenliveSettings::mltpath();
1223 // Parse MLT profiles to build a list of available video formats
1224 if (profilesList.isEmpty()) parseProfiles();
1228 void MainWindow::slotEditProfiles() {
1229 ProfilesDialog *w = new ProfilesDialog;
1234 void MainWindow::slotEditProjectSettings() {
1235 QPoint p = m_activeDocument->getTracksCount();
1236 ProjectSettings *w = new ProjectSettings(p.x(), p.y(), m_activeDocument->projectFolder().path(), true, this);
1238 if (w->exec() == QDialog::Accepted) {
1239 QString profile = w->selectedProfile();
1240 m_activeDocument->setProjectFolder(w->selectedFolder());
1241 if (m_activeDocument->profilePath() != profile) {
1242 // Profile was changed
1243 m_activeDocument->setProfilePath(profile);
1244 KdenliveSettings::setCurrent_profile(profile);
1245 KdenliveSettings::setProject_fps(m_activeDocument->fps());
1246 setCaption(m_activeDocument->description(), m_activeDocument->isModified());
1247 m_monitorManager->resetProfiles(m_activeDocument->timecode());
1248 if (m_renderWidget) m_renderWidget->setProfile(m_activeDocument->mltProfile());
1249 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
1251 // We need to desactivate & reactivate monitors to get a refresh
1252 m_monitorManager->switchMonitors();
1258 void MainWindow::slotRenderProject() {
1259 if (!m_renderWidget) {
1260 m_renderWidget = new RenderWidget(this);
1261 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)));
1262 if (m_activeDocument) {
1263 m_renderWidget->setProfile(m_activeDocument->mltProfile());
1264 m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
1267 /*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1268 if (currentTab) m_renderWidget->setTimeline(currentTab);
1269 m_renderWidget->setDocument(m_activeDocument);*/
1270 m_renderWidget->show();
1273 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) {
1274 if (dest.isEmpty()) return;
1277 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1278 if (currentTab && zoneOnly) {
1279 in = currentTab->inPoint();
1280 out = currentTab->outPoint();
1282 KTemporaryFile temp;
1283 temp.setAutoRemove(false);
1284 temp.setSuffix(".westley");
1286 m_projectMonitor->saveSceneList(temp.fileName());
1289 if (zoneOnly) args << "in=" + QString::number(in) << "out=" + QString::number(out);
1290 else if (guideStart != -1) {
1291 args << "in=" + QString::number(GenTime(guideStart).frames(m_activeDocument->fps())) << "out=" + QString::number(GenTime(guideEnd).frames(m_activeDocument->fps()));
1293 if (!overlay_args.isEmpty()) args << "preargs=" + overlay_args.join(" ");
1294 QString videoPlayer = "-";
1296 videoPlayer = KdenliveSettings::defaultplayerapp();
1297 if (videoPlayer.isEmpty()) KMessageBox::sorry(this, i18n("Cannot play video after rendering because the default video player application is not set.\nPlease define it in Kdenlive settings dialog."));
1299 if (!QFile::exists(KdenliveSettings::rendererpath())) {
1300 KMessageBox::sorry(this, i18n("Cannot find the inigo program required for rendering (part of Mlt)"));
1303 args << KdenliveSettings::rendererpath() << m_activeDocument->profilePath() << render << videoPlayer << temp.fileName() << dest << avformat_args;
1304 QString renderer = QCoreApplication::applicationDirPath() + QString("/kdenlive_render");
1305 if (!QFile::exists(renderer)) renderer = "kdenlive_render";
1306 QProcess::startDetached(renderer, args);
1308 KNotification::event("RenderStarted", i18n("Rendering <i>%1</i> started", dest), QPixmap(), this);
1312 void MainWindow::slotUpdateMousePosition(int pos) {
1313 if (m_activeDocument)
1314 switch (m_timecodeFormat->currentIndex()) {
1316 statusBar()->changeItem(m_activeDocument->timecode().getTimecodeFromFrames(pos), ID_TIMELINE_POS);
1319 statusBar()->changeItem(QString::number(pos), ID_TIMELINE_POS);
1323 void MainWindow::slotUpdateDocumentState(bool modified) {
1324 setCaption(m_activeDocument->description(), modified);
1325 m_saveAction->setEnabled(modified);
1327 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Link));
1328 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("document-save"));
1330 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Text));
1331 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("kdenlive"));
1335 void MainWindow::connectDocumentInfo(KdenliveDoc *doc) {
1336 if (m_activeDocument) {
1337 if (m_activeDocument == doc) return;
1338 disconnect(m_activeDocument, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
1340 connect(doc, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
1343 void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //changed
1344 //m_projectMonitor->stop();
1345 m_closeAction->setEnabled(m_timelineArea->count() > 1);
1346 kDebug() << "/////////////////// CONNECTING DOC TO PROJECT VIEW ////////////////";
1347 if (m_activeDocument) {
1348 if (m_activeDocument == doc) return;
1349 m_activeDocument->backupMltPlaylist();
1350 if (m_activeTimeline) {
1351 disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
1352 disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeTimeline, SLOT(slotSetZone(QPoint)));
1353 disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
1354 disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
1357 disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
1358 disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
1359 disconnect(m_activeDocument, SIGNAL(addProjectFolder(const QString, const QString &, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, const QString &, bool, bool)));
1360 disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
1361 disconnect(m_activeDocument, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
1362 disconnect(m_activeDocument, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
1363 disconnect(m_activeDocument, SIGNAL(deleteTimelineClip(const QString &)), m_activeTimeline, SLOT(slotDeleteClip(const QString &)));
1364 disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
1365 disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
1366 disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*, bool)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*, bool)));
1367 disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*, bool)), this, SLOT(slotActivateTransitionView()));
1368 disconnect(m_zoomSlider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
1369 disconnect(m_activeTimeline->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
1370 disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
1371 disconnect(m_activeTimeline, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
1372 disconnect(m_activeTimeline, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
1373 disconnect(m_activeTimeline, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
1374 disconnect(m_activeTimeline, SIGNAL(changeTrack(int)), this, SLOT(slotChangeTrack(int)));
1375 disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
1376 disconnect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
1377 disconnect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
1378 disconnect(effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
1379 disconnect(effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
1380 disconnect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
1381 disconnect(effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
1382 disconnect(transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), m_activeTimeline->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
1383 disconnect(transitionConfig, SIGNAL(transitionTrackUpdated(Transition *, int)), m_activeTimeline->projectView() , SLOT(slotTransitionTrackUpdated(Transition *, int)));
1384 disconnect(transitionConfig, SIGNAL(seekTimeline(int)), m_activeTimeline->projectView() , SLOT(setCursorPos(int)));
1385 disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
1386 disconnect(m_activeTimeline, SIGNAL(zoneMoved(int, int)), m_projectMonitor, SLOT(slotZoneMoved(int, int)));
1387 disconnect(m_projectList, SIGNAL(loadingIsOver()), m_activeTimeline->projectView(), SLOT(slotUpdateAllThumbs()));
1388 effectStack->clear();
1390 //m_activeDocument->setRenderer(NULL);
1391 disconnect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
1392 m_clipMonitor->stop();
1394 KdenliveSettings::setCurrent_profile(doc->profilePath());
1395 KdenliveSettings::setProject_fps(doc->fps());
1396 m_monitorManager->resetProfiles(doc->timecode());
1397 m_projectList->setDocument(doc);
1398 transitionConfig->updateProjectFormat(doc->mltProfile(), doc->timecode(), trackView->tracksNumber());
1399 effectStack->updateProjectFormat(doc->mltProfile(), doc->timecode());
1400 connect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
1401 connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
1402 connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
1403 connect(trackView, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
1404 connect(trackView, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
1405 connect(trackView, SIGNAL(changeTrack(int)), this, SLOT(slotChangeTrack(int)));
1406 connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
1407 connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
1408 connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
1409 connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
1410 connect(doc, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
1411 connect(doc, SIGNAL(addProjectFolder(const QString, const QString &, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, const QString &, bool, bool)));
1412 connect(doc, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
1413 connect(doc, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
1414 connect(doc, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
1416 connect(doc, SIGNAL(deleteTimelineClip(const QString &)), trackView, SLOT(slotDeleteClip(const QString &)));
1417 connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
1418 connect(doc, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
1421 connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
1422 connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
1423 connect(trackView, SIGNAL(transitionItemSelected(Transition*, bool)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*, bool)));
1424 connect(trackView, SIGNAL(transitionItemSelected(Transition*, bool)), this, SLOT(slotActivateTransitionView()));
1425 m_zoomSlider->setValue(doc->zoom());
1426 connect(m_zoomSlider, SIGNAL(valueChanged(int)), trackView, SLOT(slotChangeZoom(int)));
1427 connect(trackView->projectView(), SIGNAL(zoomIn()), this, SLOT(slotZoomIn()));
1428 connect(trackView->projectView(), SIGNAL(zoomOut()), this, SLOT(slotZoomOut()));
1429 connect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
1431 connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
1434 connect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
1435 connect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
1436 connect(effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
1437 connect(effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
1438 connect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
1439 connect(transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
1440 connect(transitionConfig, SIGNAL(transitionTrackUpdated(Transition *, int)), trackView->projectView() , SLOT(slotTransitionTrackUpdated(Transition *, int)));
1441 connect(transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
1442 connect(effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
1444 connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
1445 connect(trackView, SIGNAL(zoneMoved(int, int)), m_projectMonitor, SLOT(slotZoneMoved(int, int)));
1446 connect(m_projectList, SIGNAL(loadingIsOver()), trackView->projectView(), SLOT(slotUpdateAllThumbs()));
1448 trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu);
1449 m_activeTimeline = trackView;
1450 if (m_renderWidget) m_renderWidget->setProfile(doc->mltProfile());
1451 //doc->setRenderer(m_projectMonitor->render);
1452 m_commandStack->setActiveStack(doc->commandStack());
1453 KdenliveSettings::setProject_display_ratio(doc->dar());
1454 m_projectList->updateAllClips();
1455 //doc->clipManager()->checkAudioThumbs();
1457 //m_overView->setScene(trackView->projectScene());
1458 //m_overView->scale(m_overView->width() / trackView->duration(), m_overView->height() / (50 * trackView->tracksNumber()));
1459 //m_overView->fitInView(m_overView->itemAt(0, 50), Qt::KeepAspectRatio);
1461 setCaption(doc->description(), doc->isModified());
1462 m_saveAction->setEnabled(doc->isModified());
1463 m_activeDocument = doc;
1465 // set tool to select tool
1466 m_buttonSelectTool->setChecked(true);
1469 void MainWindow::slotGuidesUpdated() {
1470 if (m_renderWidget) m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
1473 void MainWindow::slotPreferences(int page, int option) {
1474 //An instance of your dialog could be already created and could be
1475 // cached, in which case you want to display the cached dialog
1476 // instead of creating another one
1477 if (KConfigDialog::showDialog("settings")) {
1478 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
1479 if (page != -1) d->showPage(page, option);
1484 // KConfigDialog didn't find an instance of this dialog, so lets
1486 KdenliveSettingsDialog* dialog = new KdenliveSettingsDialog(this);
1487 connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
1488 connect(dialog, SIGNAL(doResetProfile()), m_monitorManager, SLOT(slotResetProfiles()));
1490 if (page != -1) dialog->showPage(page, option);
1493 void MainWindow::updateConfiguration() {
1494 //TODO: we should apply settings to all projects, not only the current one
1495 if (m_activeTimeline) {
1496 m_activeTimeline->refresh();
1497 m_activeTimeline->projectView()->checkAutoScroll();
1498 m_activeTimeline->projectView()->checkTrackHeight();
1499 if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
1501 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
1502 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
1503 #ifndef NO_JOGSHUTTLE
1504 activateShuttleDevice();
1505 #endif /* NO_JOGSHUTTLE */
1509 void MainWindow::slotSwitchVideoThumbs() {
1510 KdenliveSettings::setVideothumbnails(!KdenliveSettings::videothumbnails());
1511 if (m_activeTimeline) {
1512 m_activeTimeline->refresh();
1514 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
1517 void MainWindow::slotSwitchAudioThumbs() {
1518 KdenliveSettings::setAudiothumbnails(!KdenliveSettings::audiothumbnails());
1519 if (m_activeTimeline) {
1520 m_activeTimeline->refresh();
1521 m_activeTimeline->projectView()->checkAutoScroll();
1522 if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
1524 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
1527 void MainWindow::slotSwitchMarkersComments() {
1528 KdenliveSettings::setShowmarkers(!KdenliveSettings::showmarkers());
1529 if (m_activeTimeline) {
1530 m_activeTimeline->refresh();
1532 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
1535 void MainWindow::slotSwitchSnap() {
1536 KdenliveSettings::setSnaptopoints(!KdenliveSettings::snaptopoints());
1537 m_buttonSnap->setChecked(KdenliveSettings::snaptopoints());
1541 void MainWindow::slotDeleteTimelineClip() {
1542 if (QApplication::focusWidget()->parentWidget()->parentWidget() == projectListDock) m_projectList->slotRemoveClip();
1543 else if (m_activeTimeline) {
1544 m_activeTimeline->projectView()->deleteSelectedClips();
1548 void MainWindow::slotChangeClipSpeed() {
1549 if (m_activeTimeline) {
1550 m_activeTimeline->projectView()->changeClipSpeed();
1554 void MainWindow::slotAddClipMarker() {
1555 DocClipBase *clip = NULL;
1557 if (m_projectMonitor->isActive()) {
1558 if (m_activeTimeline) {
1559 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
1561 pos = m_projectMonitor->position() - item->startPos() + item->cropStart();
1562 clip = item->baseClip();
1566 clip = m_clipMonitor->activeClip();
1567 pos = m_clipMonitor->position();
1570 m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), ErrorMessage);
1573 QString id = clip->getId();
1574 CommentedTime marker(pos, i18n("Marker"));
1575 MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Add Marker"), this);
1576 if (d.exec() == QDialog::Accepted) {
1577 m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
1579 if (m_clipMonitor->isActive()) m_clipMonitor->checkOverlay();
1582 void MainWindow::slotDeleteClipMarker() {
1583 DocClipBase *clip = NULL;
1585 if (m_projectMonitor->isActive()) {
1586 if (m_activeTimeline) {
1587 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
1589 pos = m_projectMonitor->position() - item->startPos() + item->cropStart();
1590 clip = item->baseClip();
1594 clip = m_clipMonitor->activeClip();
1595 pos = m_clipMonitor->position();
1598 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
1602 QString id = clip->getId();
1603 QString comment = clip->markerComment(pos);
1604 if (comment.isEmpty()) {
1605 m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
1608 m_activeTimeline->projectView()->slotDeleteClipMarker(comment, id, pos);
1609 if (m_clipMonitor->isActive()) m_clipMonitor->checkOverlay();
1613 void MainWindow::slotDeleteAllClipMarkers() {
1614 DocClipBase *clip = NULL;
1615 if (m_projectMonitor->isActive()) {
1616 if (m_activeTimeline) {
1617 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
1619 clip = item->baseClip();
1623 clip = m_clipMonitor->activeClip();
1626 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
1629 m_activeTimeline->projectView()->slotDeleteAllClipMarkers(clip->getId());
1630 if (m_clipMonitor->isActive()) m_clipMonitor->checkOverlay();
1633 void MainWindow::slotEditClipMarker() {
1634 DocClipBase *clip = NULL;
1636 if (m_projectMonitor->isActive()) {
1637 if (m_activeTimeline) {
1638 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
1640 pos = m_projectMonitor->position() - item->startPos() + item->cropStart();
1641 clip = item->baseClip();
1645 clip = m_clipMonitor->activeClip();
1646 pos = m_clipMonitor->position();
1649 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
1653 QString id = clip->getId();
1654 QString oldcomment = clip->markerComment(pos);
1655 if (oldcomment.isEmpty()) {
1656 m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
1660 CommentedTime marker(pos, oldcomment);
1661 MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Edit Marker"), this);
1662 if (d.exec() == QDialog::Accepted) {
1663 m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
1664 if (d.newMarker().time() != pos) {
1665 // remove old marker
1666 m_activeTimeline->projectView()->slotAddClipMarker(id, pos, QString());
1668 if (m_clipMonitor->isActive()) m_clipMonitor->checkOverlay();
1672 void MainWindow::slotAddGuide() {
1673 if (m_activeTimeline)
1674 m_activeTimeline->projectView()->slotAddGuide();
1677 void MainWindow::slotInsertSpace() {
1678 if (m_activeTimeline)
1679 m_activeTimeline->projectView()->slotInsertSpace();
1682 void MainWindow::slotRemoveSpace() {
1683 if (m_activeTimeline)
1684 m_activeTimeline->projectView()->slotRemoveSpace();
1687 void MainWindow::slotInsertTrack(int ix) {
1688 m_projectMonitor->activateMonitor();
1689 if (m_activeTimeline)
1690 m_activeTimeline->projectView()->slotInsertTrack(ix);
1693 void MainWindow::slotDeleteTrack(int ix) {
1694 m_projectMonitor->activateMonitor();
1695 if (m_activeTimeline)
1696 m_activeTimeline->projectView()->slotDeleteTrack(ix);
1699 void MainWindow::slotChangeTrack(int ix) {
1700 m_projectMonitor->activateMonitor();
1701 if (m_activeTimeline)
1702 m_activeTimeline->projectView()->slotChangeTrack(ix);
1705 void MainWindow::slotEditGuide() {
1706 if (m_activeTimeline)
1707 m_activeTimeline->projectView()->slotEditGuide();
1710 void MainWindow::slotDeleteGuide() {
1711 if (m_activeTimeline)
1712 m_activeTimeline->projectView()->slotDeleteGuide();
1715 void MainWindow::slotDeleteAllGuides() {
1716 if (m_activeTimeline)
1717 m_activeTimeline->projectView()->slotDeleteAllGuides();
1720 void MainWindow::slotCutTimelineClip() {
1721 if (m_activeTimeline) {
1722 m_activeTimeline->projectView()->cutSelectedClips();
1726 void MainWindow::slotAddProjectClip(KUrl url) {
1727 if (m_activeDocument)
1728 m_activeDocument->slotAddClipFile(url, QString());
1731 void MainWindow::slotAddTransition(QAction *result) {
1732 if (!result) return;
1733 QStringList info = result->data().toStringList();
1734 if (info.isEmpty()) return;
1735 QDomElement transition = transitions.getEffectByTag(info.at(1), info.at(2));
1736 if (m_activeTimeline && !transition.isNull()) {
1737 m_activeTimeline->projectView()->slotAddTransitionToSelectedClips(transition.cloneNode().toElement());
1741 void MainWindow::slotAddVideoEffect(QAction *result) {
1742 if (!result) return;
1743 QStringList info = result->data().toStringList();
1744 if (info.isEmpty()) return;
1745 QDomElement effect = videoEffects.getEffectByTag(info.at(1), info.at(2));
1746 slotAddEffect(effect);
1749 void MainWindow::slotAddAudioEffect(QAction *result) {
1750 if (!result) return;
1751 QStringList info = result->data().toStringList();
1752 if (info.isEmpty()) return;
1753 QDomElement effect = audioEffects.getEffectByTag(info.at(1), info.at(2));
1754 slotAddEffect(effect);
1757 void MainWindow::slotAddCustomEffect(QAction *result) {
1758 if (!result) return;
1759 QStringList info = result->data().toStringList();
1760 if (info.isEmpty()) return;
1761 QDomElement effect = customEffects.getEffectByTag(info.at(1), info.at(2));
1762 slotAddEffect(effect);
1765 void MainWindow::slotZoomIn() {
1766 m_zoomSlider->setValue(m_zoomSlider->value() - 1);
1769 void MainWindow::slotZoomOut() {
1770 m_zoomSlider->setValue(m_zoomSlider->value() + 1);
1773 void MainWindow::slotFitZoom() {
1774 if (m_activeTimeline) {
1775 m_zoomSlider->setValue(m_activeTimeline->fitZoom());
1779 void MainWindow::slotGotProgressInfo(const QString &message, int progress) {
1780 statusProgressBar->setValue(progress);
1781 if (progress >= 0) {
1782 if (!message.isEmpty()) m_messageLabel->setMessage(message, InformationMessage);//statusLabel->setText(message);
1783 statusProgressBar->setVisible(true);
1785 m_messageLabel->setMessage(QString(), DefaultMessage);
1786 statusProgressBar->setVisible(false);
1790 void MainWindow::slotShowClipProperties(DocClipBase *clip) {
1791 if (clip->clipType() == TEXT) {
1792 QString titlepath = m_activeDocument->projectFolder().path() + "/titles/";
1793 QString path = clip->getProperty("resource");
1794 TitleWidget *dia_ui = new TitleWidget(KUrl(), titlepath, m_projectMonitor->render, this);
1796 doc.setContent(clip->getProperty("xmldata"));
1797 dia_ui->setXml(doc);
1798 if (dia_ui->exec() == QDialog::Accepted) {
1799 QPixmap pix = dia_ui->renderedPixmap();
1801 //slotAddClipFile(KUrl("/tmp/kdenlivetitle.png"), QString(), -1);
1802 //m_clipManager->slotEditTextClipFile(id, dia_ui->xml().toString());
1803 QMap <QString, QString> newprops;
1804 newprops.insert("xmldata", dia_ui->xml().toString());
1805 EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
1806 m_activeDocument->commandStack()->push(command);
1807 m_clipMonitor->refreshMonitor(true);
1808 m_activeDocument->setModified(true);
1812 //m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
1815 ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
1816 connect(&dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
1817 if (dia.exec() == QDialog::Accepted) {
1818 EditClipCommand *command = new EditClipCommand(m_projectList, dia.clipId(), clip->properties(), dia.properties(), true);
1819 m_activeDocument->commandStack()->push(command);
1821 //m_projectList->slotUpdateClipProperties(dia.clipId(), dia.properties());
1822 if (dia.needsTimelineRefresh()) {
1823 // update clip occurences in timeline
1824 m_activeTimeline->projectView()->slotUpdateClip(dia.clipId());
1829 void MainWindow::customEvent(QEvent* e) {
1830 if (e->type() == QEvent::User) {
1831 // The timeline playing position changed...
1832 kDebug() << "RECIEVED JOG EVEMNT!!!";
1835 void MainWindow::slotActivateEffectStackView() {
1836 effectStack->raiseWindow(effectStackDock);
1839 void MainWindow::slotActivateTransitionView() {
1840 transitionConfig->raiseWindow(transitionConfigDock);
1843 void MainWindow::slotSnapRewind() {
1844 if (m_projectMonitor->isActive()) {
1845 if (m_activeTimeline)
1846 m_activeTimeline->projectView()->slotSeekToPreviousSnap();
1847 } else m_clipMonitor->slotSeekToPreviousSnap();
1850 void MainWindow::slotSnapForward() {
1851 if (m_projectMonitor->isActive()) {
1852 if (m_activeTimeline)
1853 m_activeTimeline->projectView()->slotSeekToNextSnap();
1854 } else m_clipMonitor->slotSeekToNextSnap();
1857 void MainWindow::slotClipStart() {
1858 if (m_projectMonitor->isActive()) {
1859 if (m_activeTimeline)
1860 m_activeTimeline->projectView()->clipStart();
1864 void MainWindow::slotClipEnd() {
1865 if (m_projectMonitor->isActive()) {
1866 if (m_activeTimeline)
1867 m_activeTimeline->projectView()->clipEnd();
1871 void MainWindow::slotChangeTool(QAction * action) {
1872 if (action == m_buttonSelectTool) slotSetTool(SELECTTOOL);
1873 else if (action == m_buttonRazorTool) slotSetTool(RAZORTOOL);
1874 else if (action == m_buttonSpacerTool) slotSetTool(SPACERTOOL);
1877 void MainWindow::slotSetTool(PROJECTTOOL tool) {
1878 if (m_activeDocument && m_activeTimeline) {
1879 //m_activeDocument->setTool(tool);
1880 m_activeTimeline->projectView()->setTool(tool);
1884 void MainWindow::slotCopy() {
1885 if (!m_activeDocument || !m_activeTimeline) return;
1886 m_activeTimeline->projectView()->copyClip();
1889 void MainWindow::slotPaste() {
1890 if (!m_activeDocument || !m_activeTimeline) return;
1891 m_activeTimeline->projectView()->pasteClip();
1894 void MainWindow::slotPasteEffects() {
1895 if (!m_activeDocument || !m_activeTimeline) return;
1896 m_activeTimeline->projectView()->pasteClipEffects();
1899 void MainWindow::slotFind() {
1900 if (!m_activeDocument || !m_activeTimeline) return;
1901 m_projectSearch->setEnabled(false);
1902 m_findActivated = true;
1903 m_findString = QString();
1904 m_activeTimeline->projectView()->initSearchStrings();
1905 statusBar()->showMessage(i18n("Starting -- find text as you type"));
1906 m_findTimer.start(5000);
1907 qApp->installEventFilter(this);
1910 void MainWindow::slotFindNext() {
1911 if (m_activeTimeline && m_activeTimeline->projectView()->findNextString(m_findString)) {
1912 statusBar()->showMessage(i18n("Found : %1", m_findString));
1914 statusBar()->showMessage(i18n("Reached end of project"));
1916 m_findTimer.start(4000);
1919 void MainWindow::findAhead() {
1920 if (m_activeTimeline && m_activeTimeline->projectView()->findString(m_findString)) {
1921 m_projectSearchNext->setEnabled(true);
1922 statusBar()->showMessage(i18n("Found : %1", m_findString));
1924 m_projectSearchNext->setEnabled(false);
1925 statusBar()->showMessage(i18n("Not found : %1", m_findString));
1929 void MainWindow::findTimeout() {
1930 m_projectSearchNext->setEnabled(false);
1931 m_findActivated = false;
1932 m_findString = QString();
1933 statusBar()->showMessage(i18n("Find stopped"), 3000);
1934 if (m_activeTimeline) m_activeTimeline->projectView()->clearSearchStrings();
1935 m_projectSearch->setEnabled(true);
1936 removeEventFilter(this);
1939 void MainWindow::keyPressEvent(QKeyEvent *ke) {
1940 if (m_findActivated) {
1941 if (ke->key() == Qt::Key_Backspace) {
1942 m_findString = m_findString.left(m_findString.length() - 1);
1944 if (!m_findString.isEmpty()) {
1950 m_findTimer.start(4000);
1953 } else if (ke->key() == Qt::Key_Escape) {
1957 } else if (ke->key() == Qt::Key_Space || !ke->text().trimmed().isEmpty()) {
1958 m_findString += ke->text();
1962 m_findTimer.start(4000);
1966 } else KXmlGuiWindow::keyPressEvent(ke);
1970 /** Gets called when the window gets hidden */
1971 void MainWindow::hideEvent(QHideEvent *event) {
1972 // kDebug() << "I was hidden";
1973 // issue http://www.kdenlive.org/mantis/view.php?id=231
1974 if (this->isMinimized()) {
1975 // kDebug() << "I am minimized";
1976 if (m_monitorManager) m_monitorManager->stopActiveMonitor();
1980 bool MainWindow::eventFilter(QObject *obj, QEvent *event) {
1981 if (m_findActivated) {
1982 if (event->type() == QEvent::ShortcutOverride) {
1983 QKeyEvent* ke = (QKeyEvent*) event;
1984 if (ke->text().trimmed().isEmpty()) return false;
1987 } else return false;
1989 // pass the event on to the parent class
1990 return QMainWindow::eventFilter(obj, event);
1994 void MainWindow::slotSaveZone(Render *render, QPoint zone) {
1995 KDialog *dialog = new KDialog(this);
1996 dialog->setCaption("Save clip zone");
1997 dialog->setButtons(KDialog::Ok | KDialog::Cancel);
1999 QWidget *widget = new QWidget(dialog);
2000 dialog->setMainWidget(widget);
2002 QVBoxLayout *vbox = new QVBoxLayout(widget);
2003 QLabel *label1 = new QLabel(i18n("Save clip zone as:"), this);
2004 QString path = m_activeDocument->projectFolder().path();
2006 path.append("untitled.westley");
2007 KUrlRequester *url = new KUrlRequester(KUrl(path), this);
2008 url->setFilter("video/mlt-playlist");
2009 QLabel *label2 = new QLabel(i18n("Description:"), this);
2010 KLineEdit *edit = new KLineEdit(this);
2011 vbox->addWidget(label1);
2012 vbox->addWidget(url);
2013 vbox->addWidget(label2);
2014 vbox->addWidget(edit);
2015 if (dialog->exec() == QDialog::Accepted) render->saveZone(url->url(), edit->text(), zone);
2019 void MainWindow::slotSetInPoint() {
2020 if (m_clipMonitor->isActive()) {
2021 m_clipMonitor->slotSetZoneStart();
2022 } else m_activeTimeline->projectView()->setInPoint();
2025 void MainWindow::slotSetOutPoint() {
2026 if (m_clipMonitor->isActive()) {
2027 m_clipMonitor->slotSetZoneEnd();
2028 } else m_activeTimeline->projectView()->setOutPoint();
2031 void MainWindow::slotGetNewStuff() {
2032 //KNS::Entry::List download();
2033 KNS::Entry::List entries = KNS::Engine::download();
2034 int numberInstalled = 0;
2035 // list of changed entries
2036 kDebug() << "// PARSING KNS";
2037 foreach(KNS::Entry* entry, entries) {
2038 // care only about installed ones
2039 if (entry->status() == KNS::Entry::Installed) {
2040 foreach(const QString &file, entry->installedFiles()) {
2041 kDebug() << "// CURRENTLY INSTALLED: " << file;
2045 qDeleteAll(entries);
2046 initEffects::refreshLumas();
2049 void MainWindow::slotAutoTransition() {
2050 m_activeTimeline->projectView()->autoTransition();
2053 #include "mainwindow.moc"