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 ***************************************************************************/
21 #include "mainwindow.h"
22 #include "mainwindowadaptor.h"
23 #include "kdenlivesettings.h"
24 #include "kdenlivesettingsdialog.h"
25 #include "initeffects.h"
26 #include "profilesdialog.h"
27 #include "projectsettings.h"
29 #include "clipmanager.h"
30 #include "projectlist.h"
32 #include "recmonitor.h"
33 #include "monitormanager.h"
34 #include "kdenlivedoc.h"
35 #include "trackview.h"
36 #include "customtrackview.h"
37 #include "effectslistview.h"
38 #include "effectstackview.h"
39 #include "transitionsettings.h"
40 #include "renderwidget.h"
43 #include "jogshuttle.h"
44 #endif /* NO_JOGSHUTTLE */
45 #include "clipproperties.h"
47 #include "editclipcommand.h"
48 #include "titlewidget.h"
49 #include "markerdialog.h"
51 #include "interfaces.h"
52 #include "kdenlive-config.h"
53 #include "cliptranscode.h"
55 #include <KApplication>
59 #include <KActionCollection>
60 #include <KStandardAction>
61 #include <KFileDialog>
62 #include <KMessageBox>
64 #include <KIO/NetAccess>
67 #include <KConfigDialog>
68 #include <KXMLGUIFactory>
70 #include <kstandarddirs.h>
71 #include <KUrlRequesterDialog>
72 #include <KTemporaryFile>
73 #include <KActionMenu>
76 #include <ktogglefullscreenaction.h>
78 #include <KNotification>
79 #include <KNotifyConfigWidget>
80 #include <knewstuff2/engine.h>
81 #include <knewstuff2/ui/knewstuffaction.h>
83 #include <QTextStream>
90 static const char version[] = VERSION;
92 static const int ID_TIMELINE_POS = 0;
99 EffectsList MainWindow::videoEffects;
100 EffectsList MainWindow::audioEffects;
101 EffectsList MainWindow::customEffects;
102 EffectsList MainWindow::transitions;
104 MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent) :
105 KXmlGuiWindow(parent),
106 m_activeDocument(NULL),
107 m_activeTimeline(NULL),
108 m_renderWidget(NULL),
109 #ifndef NO_JOGSHUTTLE
111 #endif /* NO_JOGSHUTTLE */
112 m_findActivated(false)
115 // Create DBus interface
116 new MainWindowAdaptor(this);
117 QDBusConnection dbus = QDBusConnection::sessionBus();
118 dbus.registerObject("/MainWindow", this);
120 setlocale(LC_NUMERIC, "POSIX");
121 setFont(KGlobalSettings::toolBarFont());
122 parseProfiles(MltPath);
123 m_commandStack = new QUndoGroup;
124 m_timelineArea = new KTabWidget(this);
125 m_timelineArea->setTabReorderingEnabled(true);
126 m_timelineArea->setTabBarHidden(true);
128 QToolButton *closeTabButton = new QToolButton;
129 connect(closeTabButton, SIGNAL(clicked()), this, SLOT(closeCurrentDocument()));
130 closeTabButton->setIcon(KIcon("tab-close"));
131 closeTabButton->adjustSize();
132 closeTabButton->setToolTip(i18n("Close the current tab"));
133 m_timelineArea->setCornerWidget(closeTabButton);
134 connect(m_timelineArea, SIGNAL(currentChanged(int)), this, SLOT(activateDocument()));
136 connect(&m_findTimer, SIGNAL(timeout()), this, SLOT(findTimeout()));
137 m_findTimer.setSingleShot(true);
139 // FIXME: the next call returns a newly allocated object, which leaks
140 initEffects::parseEffectFiles();
141 //initEffects::parseCustomEffectsFile();
143 m_monitorManager = new MonitorManager();
145 m_projectListDock = new QDockWidget(i18n("Project Tree"), this);
146 m_projectListDock->setObjectName("project_tree");
147 m_projectList = new ProjectList(this);
148 m_projectListDock->setWidget(m_projectList);
149 addDockWidget(Qt::TopDockWidgetArea, m_projectListDock);
151 m_effectListDock = new QDockWidget(i18n("Effect List"), this);
152 m_effectListDock->setObjectName("effect_list");
153 m_effectList = new EffectsListView();
155 //m_effectList = new KListWidget(this);
156 m_effectListDock->setWidget(m_effectList);
157 addDockWidget(Qt::TopDockWidgetArea, m_effectListDock);
159 m_effectStackDock = new QDockWidget(i18n("Effect Stack"), this);
160 m_effectStackDock->setObjectName("effect_stack");
161 m_effectStack = new EffectStackView(this);
162 m_effectStackDock->setWidget(m_effectStack);
163 addDockWidget(Qt::TopDockWidgetArea, m_effectStackDock);
165 m_transitionConfigDock = new QDockWidget(i18n("Transition"), this);
166 m_transitionConfigDock->setObjectName("transition");
167 m_transitionConfig = new TransitionSettings(this);
168 m_transitionConfigDock->setWidget(m_transitionConfig);
169 addDockWidget(Qt::TopDockWidgetArea, m_transitionConfigDock);
171 KdenliveSettings::setCurrent_profile(KdenliveSettings::default_profile());
172 m_fileOpenRecent = KStandardAction::openRecent(this, SLOT(openFile(const KUrl &)),
176 m_clipMonitorDock = new QDockWidget(i18n("Clip Monitor"), this);
177 m_clipMonitorDock->setObjectName("clip_monitor");
178 m_clipMonitor = new Monitor("clip", m_monitorManager, this);
179 m_clipMonitorDock->setWidget(m_clipMonitor);
180 addDockWidget(Qt::TopDockWidgetArea, m_clipMonitorDock);
181 //m_clipMonitor->stop();
183 m_projectMonitorDock = new QDockWidget(i18n("Project Monitor"), this);
184 m_projectMonitorDock->setObjectName("project_monitor");
185 m_projectMonitor = new Monitor("project", m_monitorManager, this);
186 m_projectMonitorDock->setWidget(m_projectMonitor);
187 addDockWidget(Qt::TopDockWidgetArea, m_projectMonitorDock);
189 m_recMonitorDock = new QDockWidget(i18n("Record Monitor"), this);
190 m_recMonitorDock->setObjectName("record_monitor");
191 m_recMonitor = new RecMonitor("record", this);
192 m_recMonitorDock->setWidget(m_recMonitor);
193 addDockWidget(Qt::TopDockWidgetArea, m_recMonitorDock);
195 connect(m_recMonitor, SIGNAL(addProjectClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
196 connect(m_recMonitor, SIGNAL(showConfigDialog(int, int)), this, SLOT(slotPreferences(int, int)));
198 m_undoViewDock = new QDockWidget(i18n("Undo History"), this);
199 m_undoViewDock->setObjectName("undo_history");
200 m_undoView = new QUndoView(this);
201 m_undoView->setCleanIcon(KIcon("edit-clear"));
202 m_undoView->setEmptyLabel(i18n("Clean"));
203 m_undoViewDock->setWidget(m_undoView);
204 m_undoView->setGroup(m_commandStack);
205 addDockWidget(Qt::TopDockWidgetArea, m_undoViewDock);
207 //overviewDock = new QDockWidget(i18n("Project Overview"), this);
208 //overviewDock->setObjectName("project_overview");
209 //m_overView = new CustomTrackView(NULL, NULL, this);
210 //overviewDock->setWidget(m_overView);
211 //addDockWidget(Qt::TopDockWidgetArea, overviewDock);
214 //tabifyDockWidget(projectListDock, effectListDock);
215 tabifyDockWidget(m_projectListDock, m_effectStackDock);
216 tabifyDockWidget(m_projectListDock, m_transitionConfigDock);
217 //tabifyDockWidget(projectListDock, undoViewDock);
220 tabifyDockWidget(m_clipMonitorDock, m_projectMonitorDock);
221 tabifyDockWidget(m_clipMonitorDock, m_recMonitorDock);
222 setCentralWidget(m_timelineArea);
226 /*ScriptingPart* sp = new ScriptingPart(this, QStringList());
227 guiFactory()->addClient(sp);*/
231 //kDebug() << factory() << " " << factory()->container("video_effects_menu", this);
233 m_projectMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone);
234 m_clipMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone, static_cast<QMenu*>(factory()->container("marker_menu", this)));
235 m_projectList->setupGeneratorMenu(static_cast<QMenu*>(factory()->container("generators", this)), static_cast<QMenu*>(factory()->container("transcoders", this)));
237 // build effects menus
239 QMenu *videoEffectsMenu = static_cast<QMenu*>(factory()->container("video_effects_menu", this));
241 QStringList effectInfo;
242 QMap<QString, QStringList> effectsList;
243 for (int ix = 0; ix < videoEffects.count(); ix++) {
244 effectInfo = videoEffects.effectIdInfo(ix);
245 effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
248 foreach(const QStringList &value, effectsList) {
249 action = new QAction(value.at(0), this);
250 action->setData(value);
251 videoEffectsMenu->addAction(action);
254 QMenu *audioEffectsMenu = static_cast<QMenu*>(factory()->container("audio_effects_menu", this));
258 for (int ix = 0; ix < audioEffects.count(); ix++) {
259 effectInfo = audioEffects.effectIdInfo(ix);
260 effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
263 foreach(const QStringList &value, effectsList) {
264 action = new QAction(value.at(0), this);
265 action->setData(value);
266 audioEffectsMenu->addAction(action);
269 m_customEffectsMenu = static_cast<QMenu*>(factory()->container("custom_effects_menu", this));
271 if (customEffects.isEmpty()) m_customEffectsMenu->setEnabled(false);
272 else m_customEffectsMenu->setEnabled(true);
275 for (int ix = 0; ix < customEffects.count(); ix++) {
276 effectInfo = customEffects.effectIdInfo(ix);
277 effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
280 foreach(const QStringList &value, effectsList) {
281 action = new QAction(value.at(0), this);
282 action->setData(value);
283 m_customEffectsMenu->addAction(action);
286 QMenu *newEffect = new QMenu(this);
287 newEffect->addMenu(videoEffectsMenu);
288 newEffect->addMenu(audioEffectsMenu);
289 newEffect->addMenu(m_customEffectsMenu);
290 m_effectStack->setMenu(newEffect);
293 QMenu *viewMenu = static_cast<QMenu*>(factory()->container("dockwindows", this));
294 const QList<QAction *> viewActions = createPopupMenu()->actions();
295 viewMenu->insertActions(NULL, viewActions);
297 connect(videoEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddVideoEffect(QAction *)));
298 connect(audioEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddAudioEffect(QAction *)));
299 connect(m_customEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddCustomEffect(QAction *)));
301 m_timelineContextMenu = new QMenu(this);
302 m_timelineContextClipMenu = new QMenu(this);
303 m_timelineContextTransitionMenu = new QMenu(this);
306 QMenu *transitionsMenu = new QMenu(i18n("Add Transition"), this);
307 QStringList effects = transitions.effectNames();
310 for (int ix = 0; ix < transitions.count(); ix++) {
311 effectInfo = transitions.effectIdInfo(ix);
312 effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
314 foreach(const QStringList &value, effectsList) {
315 action = new QAction(value.at(0), this);
316 action->setData(value);
317 transitionsMenu->addAction(action);
319 connect(transitionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddTransition(QAction *)));
321 m_timelineContextMenu->addAction(actionCollection()->action("insert_space"));
322 m_timelineContextMenu->addAction(actionCollection()->action("delete_space"));
323 m_timelineContextMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Paste)));
325 m_timelineContextClipMenu->addAction(actionCollection()->action("delete_timeline_clip"));
326 m_timelineContextClipMenu->addAction(actionCollection()->action("change_clip_speed"));
327 m_timelineContextClipMenu->addAction(actionCollection()->action("group_clip"));
328 m_timelineContextClipMenu->addAction(actionCollection()->action("ungroup_clip"));
329 m_timelineContextClipMenu->addAction(actionCollection()->action("cut_timeline_clip"));
330 m_timelineContextClipMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
331 m_timelineContextClipMenu->addAction(actionCollection()->action("paste_effects"));
332 m_timelineContextClipMenu->addAction(actionCollection()->action("split_audio"));
334 QMenu *markersMenu = (QMenu*)(factory()->container("marker_menu", this));
335 m_timelineContextClipMenu->addMenu(markersMenu);
336 m_timelineContextClipMenu->addMenu(transitionsMenu);
337 m_timelineContextClipMenu->addMenu(videoEffectsMenu);
338 m_timelineContextClipMenu->addMenu(audioEffectsMenu);
339 //TODO: re-enable custom effects menu when it is implemented
340 m_timelineContextClipMenu->addMenu(m_customEffectsMenu);
342 m_timelineContextTransitionMenu->addAction(actionCollection()->action("delete_timeline_clip"));
343 m_timelineContextTransitionMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
345 m_timelineContextTransitionMenu->addAction(actionCollection()->action("auto_transition"));
347 connect(m_projectMonitorDock, SIGNAL(visibilityChanged(bool)), m_projectMonitor, SLOT(refreshMonitor(bool)));
348 connect(m_clipMonitorDock, SIGNAL(visibilityChanged(bool)), m_clipMonitor, SLOT(refreshMonitor(bool)));
349 //connect(m_monitorManager, SIGNAL(connectMonitors()), this, SLOT(slotConnectMonitors()));
350 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), this, SLOT(slotRaiseMonitor(bool)));
351 connect(m_effectList, SIGNAL(addEffect(QDomElement)), this, SLOT(slotAddEffect(QDomElement)));
352 connect(m_effectList, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
354 m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
355 slotConnectMonitors();
357 // Open or create a file. Command line argument passed in Url has
358 // precedence, then "openlastproject", then just a plain empty file.
359 // If opening Url fails, openlastproject will _not_ be used.
360 if (!Url.isEmpty()) {
363 if (KdenliveSettings::openlastproject()) {
367 if (m_timelineArea->count() == 0) {
371 #ifndef NO_JOGSHUTTLE
372 activateShuttleDevice();
373 #endif /* NO_JOGSHUTTLE */
374 m_projectListDock->raise();
377 void MainWindow::queryQuit()
379 kDebug() << "----- SAVING CONFUIG";
380 if (queryClose()) kapp->quit();
384 bool MainWindow::queryClose()
387 if (m_monitorManager) m_monitorManager->stopActiveMonitor();
388 if (m_activeDocument && m_activeDocument->isModified()) {
389 switch (KMessageBox::warningYesNoCancel(this, i18n("Save changes to document?"))) {
390 case KMessageBox::Yes :
391 // save document here. If saving fails, return false;
393 case KMessageBox::No :
394 // User does not want to save the changes, clear recovery files
395 m_activeDocument->m_autosave->resize(0);
405 void MainWindow::loadPlugins()
407 foreach(QObject *plugin, QPluginLoader::staticInstances())
408 populateMenus(plugin);
410 QStringList directories = KGlobal::dirs()->findDirs("module", QString());
412 filters << "libkdenlive*";
413 foreach(const QString &folder, directories) {
414 kDebug() << "// PARSING FIOLER: " << folder;
415 QDir pluginsDir(folder);
416 foreach(const QString &fileName, pluginsDir.entryList(filters, QDir::Files)) {
417 kDebug() << "// FOUND PLUGIN: " << fileName << "= " << pluginsDir.absoluteFilePath(fileName);
418 QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
419 QObject *plugin = loader.instance();
421 populateMenus(plugin);
422 m_pluginFileNames += fileName;
423 } else kDebug() << "// ERROR LOADING PLUGIN: " << fileName << ", " << loader.errorString();
429 void MainWindow::populateMenus(QObject *plugin)
431 QMenu *addMenu = static_cast<QMenu*>(factory()->container("generators", this));
432 ClipGenerator *iGenerator = qobject_cast<ClipGenerator *>(plugin);
434 addToMenu(plugin, iGenerator->generators(KdenliveSettings::producerslist()), addMenu, SLOT(generateClip()),
438 void MainWindow::addToMenu(QObject *plugin, const QStringList &texts,
439 QMenu *menu, const char *member,
440 QActionGroup *actionGroup)
442 kDebug() << "// ADD to MENU" << texts;
443 foreach(const QString &text, texts) {
444 QAction *action = new QAction(text, plugin);
445 action->setData(text);
446 connect(action, SIGNAL(triggered()), this, member);
447 menu->addAction(action);
450 action->setCheckable(true);
451 actionGroup->addAction(action);
456 void MainWindow::aboutPlugins()
458 //PluginDialog dialog(pluginsDir.path(), m_pluginFileNames, this);
463 void MainWindow::generateClip()
465 QAction *action = qobject_cast<QAction *>(sender());
466 ClipGenerator *iGenerator = qobject_cast<ClipGenerator *>(action->parent());
468 KUrl clipUrl = iGenerator->generatedClip(action->data().toString(), m_activeDocument->projectFolder(), QStringList(), QStringList(), 25, 720, 576);
469 if (!clipUrl.isEmpty()) {
470 m_projectList->slotAddClip(QList <QUrl> () << clipUrl);
474 void MainWindow::saveProperties(KConfig*)
476 // save properties here,used by session management
481 void MainWindow::readProperties(KConfig *config)
483 // read properties here,used by session management
484 QString Lastproject = config->group("Recent Files").readPathEntry("File1", QString());
485 openFile(KUrl(Lastproject));
488 void MainWindow::slotReloadEffects()
490 initEffects::parseCustomEffectsFile();
491 m_customEffectsMenu->clear();
492 const QStringList effects = customEffects.effectNames();
494 if (effects.isEmpty()) m_customEffectsMenu->setEnabled(false);
495 else m_customEffectsMenu->setEnabled(true);
497 foreach(const QString &name, effects) {
498 action = new QAction(name, this);
499 action->setData(name);
500 m_customEffectsMenu->addAction(action);
502 m_effectList->reloadEffectList();
505 #ifndef NO_JOGSHUTTLE
506 void MainWindow::activateShuttleDevice()
510 if (KdenliveSettings::enableshuttle() == false) return;
511 m_jogProcess = new JogShuttle(KdenliveSettings::shuttledevice());
512 connect(m_jogProcess, SIGNAL(rewind1()), m_monitorManager, SLOT(slotRewindOneFrame()));
513 connect(m_jogProcess, SIGNAL(forward1()), m_monitorManager, SLOT(slotForwardOneFrame()));
514 connect(m_jogProcess, SIGNAL(rewind(double)), m_monitorManager, SLOT(slotRewind(double)));
515 connect(m_jogProcess, SIGNAL(forward(double)), m_monitorManager, SLOT(slotForward(double)));
516 connect(m_jogProcess, SIGNAL(stop()), m_monitorManager, SLOT(slotPlay()));
517 connect(m_jogProcess, SIGNAL(button(int)), this, SLOT(slotShuttleButton(int)));
520 void MainWindow::slotShuttleButton(int code)
524 slotShuttleAction(KdenliveSettings::shuttle1());
527 slotShuttleAction(KdenliveSettings::shuttle2());
530 slotShuttleAction(KdenliveSettings::shuttle3());
533 slotShuttleAction(KdenliveSettings::shuttle4());
536 slotShuttleAction(KdenliveSettings::shuttle5());
541 void MainWindow::slotShuttleAction(int code)
547 m_monitorManager->slotPlay();
550 m_monitorManager->slotPlay();
554 #endif /* NO_JOGSHUTTLE */
556 void MainWindow::configureNotifications()
558 KNotifyConfigWidget::configure(this);
561 void MainWindow::slotFullScreen()
563 KToggleFullScreenAction::setFullScreen(this, actionCollection()->action("fullscreen")->isChecked());
566 void MainWindow::slotAddEffect(QDomElement effect, GenTime pos, int track)
568 if (!m_activeDocument) return;
569 if (effect.isNull()) {
570 kDebug() << "--- ERROR, TRYING TO APPEND NULL EFFECT";
573 m_activeTimeline->projectView()->slotAddEffect(effect.cloneNode().toElement(), pos, track);
576 void MainWindow::slotRaiseMonitor(bool clipMonitor)
578 if (clipMonitor) m_clipMonitorDock->raise();
579 else m_projectMonitorDock->raise();
582 void MainWindow::slotUpdateClip(const QString &id)
584 if (!m_activeDocument) return;
585 m_activeTimeline->projectView()->slotUpdateClip(id);
588 void MainWindow::slotConnectMonitors()
591 m_projectList->setRenderer(m_projectMonitor->render);
592 connect(m_projectList, SIGNAL(receivedClipDuration(const QString &)), this, SLOT(slotUpdateClip(const QString &)));
593 connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *)));
594 connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, const QString &, bool)), m_projectMonitor->render, SLOT(getFileProperties(const QDomElement &, const QString &, bool)));
595 connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QPixmap &)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QPixmap &)));
596 connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &, bool)), m_projectList, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &, bool)));
598 connect(m_projectMonitor->render, SIGNAL(removeInvalidClip(const QString &, bool)), m_projectList, SLOT(slotRemoveInvalidClip(const QString &, bool)));
600 connect(m_clipMonitor, SIGNAL(refreshClipThumbnail(const QString &)), m_projectList, SLOT(slotRefreshClipThumbnail(const QString &)));
602 connect(m_clipMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustClipMonitor()));
603 connect(m_projectMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustProjectMonitor()));
605 connect(m_clipMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
606 connect(m_projectMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
609 void MainWindow::slotAdjustClipMonitor()
611 m_clipMonitorDock->updateGeometry();
612 m_clipMonitorDock->adjustSize();
613 m_clipMonitor->resetSize();
616 void MainWindow::slotAdjustProjectMonitor()
618 m_projectMonitorDock->updateGeometry();
619 m_projectMonitorDock->adjustSize();
620 m_projectMonitor->resetSize();
623 void MainWindow::setupActions()
626 KActionCollection* collection = actionCollection();
627 m_timecodeFormat = new KComboBox(this);
628 m_timecodeFormat->addItem(i18n("hh:mm:ss::ff"));
629 m_timecodeFormat->addItem(i18n("Frames"));
631 m_statusProgressBar = new QProgressBar(this);
632 m_statusProgressBar->setMinimum(0);
633 m_statusProgressBar->setMaximum(100);
634 m_statusProgressBar->setMaximumWidth(150);
635 m_statusProgressBar->setVisible(false);
637 QWidget *w = new QWidget;
639 QHBoxLayout *layout = new QHBoxLayout;
640 w->setLayout(layout);
641 layout->setContentsMargins(5, 0, 5, 0);
642 QToolBar *toolbar = new QToolBar("statusToolBar", this);
645 m_toolGroup = new QActionGroup(this);
647 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;}";
649 m_buttonSelectTool = new KAction(KIcon("kdenlive-select-tool"), i18n("Selection tool"), this);
650 toolbar->addAction(m_buttonSelectTool);
651 m_buttonSelectTool->setCheckable(true);
652 m_buttonSelectTool->setChecked(true);
654 m_buttonRazorTool = new KAction(KIcon("edit-cut"), i18n("Razor tool"), this);
655 toolbar->addAction(m_buttonRazorTool);
656 m_buttonRazorTool->setCheckable(true);
657 m_buttonRazorTool->setChecked(false);
659 m_buttonSpacerTool = new KAction(KIcon("kdenlive-spacer-tool"), i18n("Spacer tool"), this);
660 toolbar->addAction(m_buttonSpacerTool);
661 m_buttonSpacerTool->setCheckable(true);
662 m_buttonSpacerTool->setChecked(false);
664 m_toolGroup->addAction(m_buttonSelectTool);
665 m_toolGroup->addAction(m_buttonRazorTool);
666 m_toolGroup->addAction(m_buttonSpacerTool);
667 m_toolGroup->setExclusive(true);
668 toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
670 QWidget * actionWidget;
671 actionWidget = toolbar->widgetForAction(m_buttonSelectTool);
672 actionWidget->setMaximumWidth(24);
673 actionWidget->setMinimumHeight(18);
675 actionWidget = toolbar->widgetForAction(m_buttonRazorTool);
676 actionWidget->setMaximumWidth(24);
677 actionWidget->setMinimumHeight(18);
679 actionWidget = toolbar->widgetForAction(m_buttonSpacerTool);
680 actionWidget->setMaximumWidth(24);
681 actionWidget->setMinimumHeight(18);
683 toolbar->setStyleSheet(style1);
684 connect(m_toolGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeTool(QAction *)));
686 toolbar->addSeparator();
687 m_buttonFitZoom = new KAction(KIcon("zoom-fit-best"), i18n("Fit zoom to project"), this);
688 toolbar->addAction(m_buttonFitZoom);
689 m_buttonFitZoom->setCheckable(false);
690 connect(m_buttonFitZoom, SIGNAL(triggered()), this, SLOT(slotFitZoom()));
692 actionWidget = toolbar->widgetForAction(m_buttonFitZoom);
693 actionWidget->setMaximumWidth(24);
694 actionWidget->setMinimumHeight(18);
696 m_zoomSlider = new QSlider(Qt::Horizontal, this);
697 m_zoomSlider->setMaximum(13);
698 m_zoomSlider->setPageStep(1);
700 m_zoomSlider->setMaximumWidth(150);
701 m_zoomSlider->setMinimumWidth(100);
703 const int contentHeight = QFontMetrics(w->font()).height() + 8;
705 QString style = "QSlider::groove:horizontal { background-color: rgba(230, 230, 230, 220);border: 1px solid #999999;height: 8px;border-radius: 3px;margin-top:3px }";
706 style.append("QSlider::handle:horizontal { background-color: white; border: 1px solid #999999;width: 9px;margin: -2px 0;border-radius: 3px; }");
708 m_zoomSlider->setStyleSheet(style);
710 //m_zoomSlider->height() + 5;
711 statusBar()->setMinimumHeight(contentHeight);
714 toolbar->addWidget(m_zoomSlider);
716 m_buttonVideoThumbs = new KAction(KIcon("kdenlive-show-videothumb"), i18n("Show video thumbnails"), this);
717 toolbar->addAction(m_buttonVideoThumbs);
718 m_buttonVideoThumbs->setCheckable(true);
719 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
720 connect(m_buttonVideoThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchVideoThumbs()));
722 m_buttonAudioThumbs = new KAction(KIcon("kdenlive-show-audiothumb"), i18n("Show audio thumbnails"), this);
723 toolbar->addAction(m_buttonAudioThumbs);
724 m_buttonAudioThumbs->setCheckable(true);
725 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
726 connect(m_buttonAudioThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchAudioThumbs()));
728 m_buttonShowMarkers = new KAction(KIcon("kdenlive-show-markers"), i18n("Show markers comments"), this);
729 toolbar->addAction(m_buttonShowMarkers);
730 m_buttonShowMarkers->setCheckable(true);
731 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
732 connect(m_buttonShowMarkers, SIGNAL(triggered()), this, SLOT(slotSwitchMarkersComments()));
734 m_buttonSnap = new KAction(KIcon("kdenlive-snap"), i18n("Snap"), this);
735 toolbar->addAction(m_buttonSnap);
736 m_buttonSnap->setCheckable(true);
737 m_buttonSnap->setChecked(KdenliveSettings::snaptopoints());
738 connect(m_buttonSnap, SIGNAL(triggered()), this, SLOT(slotSwitchSnap()));
739 layout->addWidget(toolbar);
742 actionWidget = toolbar->widgetForAction(m_buttonVideoThumbs);
743 actionWidget->setMaximumWidth(24);
744 actionWidget->setMinimumHeight(18);
746 actionWidget = toolbar->widgetForAction(m_buttonAudioThumbs);
747 actionWidget->setMaximumWidth(24);
748 actionWidget->setMinimumHeight(18);
750 actionWidget = toolbar->widgetForAction(m_buttonShowMarkers);
751 actionWidget->setMaximumWidth(24);
752 actionWidget->setMinimumHeight(18);
754 actionWidget = toolbar->widgetForAction(m_buttonSnap);
755 actionWidget->setMaximumWidth(24);
756 actionWidget->setMinimumHeight(18);
758 m_messageLabel = new StatusBarMessageLabel(this);
759 m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
761 statusBar()->addWidget(m_messageLabel, 10);
762 statusBar()->addWidget(m_statusProgressBar, 0);
763 statusBar()->addPermanentWidget(w);
764 statusBar()->insertPermanentFixedItem("00:00:00:00", ID_TIMELINE_POS);
765 statusBar()->addPermanentWidget(m_timecodeFormat);
766 statusBar()->setMaximumHeight(statusBar()->font().pointSize() * 4);
767 m_messageLabel->hide();
769 collection->addAction("select_tool", m_buttonSelectTool);
770 collection->addAction("razor_tool", m_buttonRazorTool);
771 collection->addAction("spacer_tool", m_buttonSpacerTool);
773 collection->addAction("show_video_thumbs", m_buttonVideoThumbs);
774 collection->addAction("show_audio_thumbs", m_buttonAudioThumbs);
775 collection->addAction("show_markers", m_buttonShowMarkers);
776 collection->addAction("snap", m_buttonSnap);
777 collection->addAction("zoom_fit", m_buttonFitZoom);
779 KAction* zoomIn = new KAction(KIcon("zoom-in"), i18n("Zoom In"), this);
780 collection->addAction("zoom_in", zoomIn);
781 connect(zoomIn, SIGNAL(triggered(bool)), this, SLOT(slotZoomIn()));
782 zoomIn->setShortcut(Qt::CTRL + Qt::Key_Plus);
784 KAction* zoomOut = new KAction(KIcon("zoom-out"), i18n("Zoom Out"), this);
785 collection->addAction("zoom_out", zoomOut);
786 connect(zoomOut, SIGNAL(triggered(bool)), this, SLOT(slotZoomOut()));
787 zoomOut->setShortcut(Qt::CTRL + Qt::Key_Minus);
789 m_projectSearch = new KAction(KIcon("edit-find"), i18n("Find"), this);
790 collection->addAction("project_find", m_projectSearch);
791 connect(m_projectSearch, SIGNAL(triggered(bool)), this, SLOT(slotFind()));
792 m_projectSearch->setShortcut(Qt::Key_Slash);
794 m_projectSearchNext = new KAction(KIcon("go-down-search"), i18n("Find Next"), this);
795 collection->addAction("project_find_next", m_projectSearchNext);
796 connect(m_projectSearchNext, SIGNAL(triggered(bool)), this, SLOT(slotFindNext()));
797 m_projectSearchNext->setShortcut(Qt::Key_F3);
798 m_projectSearchNext->setEnabled(false);
800 KAction* profilesAction = new KAction(KIcon("document-new"), i18n("Manage Project Profiles"), this);
801 collection->addAction("manage_profiles", profilesAction);
802 connect(profilesAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProfiles()));
804 KNS::standardAction(i18n("Download New Lumas..."), this, SLOT(slotGetNewLumaStuff()), actionCollection(), "get_new_lumas");
806 KNS::standardAction(i18n("Download New Render Profiles..."), this, SLOT(slotGetNewRenderStuff()), actionCollection(), "get_new_profiles");
808 KNS::standardAction(i18n("Download New Project Profiles..."), this, SLOT(slotGetNewMltProfileStuff()), actionCollection(), "get_new_mlt_profiles");
810 KAction* wizAction = new KAction(KIcon("configure"), i18n("Run Config Wizard"), this);
811 collection->addAction("run_wizard", wizAction);
812 connect(wizAction, SIGNAL(triggered(bool)), this, SLOT(slotRunWizard()));
814 KAction* projectAction = new KAction(KIcon("configure"), i18n("Project Settings"), this);
815 collection->addAction("project_settings", projectAction);
816 connect(projectAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProjectSettings()));
818 KAction* projectRender = new KAction(KIcon("media-record"), i18n("Render"), this);
819 collection->addAction("project_render", projectRender);
820 projectRender->setShortcut(Qt::CTRL + Qt::Key_Return);
821 connect(projectRender, SIGNAL(triggered(bool)), this, SLOT(slotRenderProject()));
823 KAction* monitorPlay = new KAction(KIcon("media-playback-start"), i18n("Play"), this);
824 KShortcut playShortcut;
825 playShortcut.setPrimary(Qt::Key_Space);
826 playShortcut.setAlternate(Qt::Key_K);
827 monitorPlay->setShortcut(playShortcut);
828 collection->addAction("monitor_play", monitorPlay);
829 connect(monitorPlay, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotPlay()));
831 m_playZone = new KAction(KIcon("media-playback-start"), i18n("Play Zone"), this);
832 m_playZone->setShortcut(Qt::CTRL + Qt::Key_Space);
833 collection->addAction("monitor_play_zone", m_playZone);
834 connect(m_playZone, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotPlayZone()));
836 m_loopZone = new KAction(KIcon("media-playback-start"), i18n("Loop Zone"), this);
837 m_loopZone->setShortcut(Qt::ALT + Qt::Key_Space);
838 collection->addAction("monitor_loop_zone", m_loopZone);
839 connect(m_loopZone, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotLoopZone()));
841 KAction *dvdWizard = new KAction(KIcon("media-optical"), i18n("DVD Wizard"), this);
842 collection->addAction("dvd_wizard", dvdWizard);
843 connect(dvdWizard, SIGNAL(triggered(bool)), this, SLOT(slotDvdWizard()));
845 KAction *transcodeClip = new KAction(KIcon("edit-copy"), i18n("Transcode Clip"), this);
846 collection->addAction("transcode_clip", transcodeClip);
847 connect(transcodeClip, SIGNAL(triggered(bool)), this, SLOT(slotTranscodeClip()));
849 KAction *markIn = collection->addAction("mark_in");
850 markIn->setText(i18n("Set In Point"));
851 markIn->setShortcut(Qt::Key_I);
852 connect(markIn, SIGNAL(triggered(bool)), this, SLOT(slotSetInPoint()));
854 KAction *markOut = collection->addAction("mark_out");
855 markOut->setText(i18n("Set Out Point"));
856 markOut->setShortcut(Qt::Key_O);
857 connect(markOut, SIGNAL(triggered(bool)), this, SLOT(slotSetOutPoint()));
859 KAction* monitorSeekBackward = new KAction(KIcon("media-seek-backward"), i18n("Rewind"), this);
860 monitorSeekBackward->setShortcut(Qt::Key_J);
861 collection->addAction("monitor_seek_backward", monitorSeekBackward);
862 connect(monitorSeekBackward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewind()));
864 KAction* monitorSeekBackwardOneFrame = new KAction(KIcon("media-skip-backward"), i18n("Rewind 1 Frame"), this);
865 monitorSeekBackwardOneFrame->setShortcut(Qt::Key_Left);
866 collection->addAction("monitor_seek_backward-one-frame", monitorSeekBackwardOneFrame);
867 connect(monitorSeekBackwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewindOneFrame()));
869 KAction* monitorSeekBackwardOneSecond = new KAction(KIcon("media-skip-backward"), i18n("Rewind 1 Second"), this);
870 monitorSeekBackwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Left);
871 collection->addAction("monitor_seek_backward-one-second", monitorSeekBackwardOneSecond);
872 connect(monitorSeekBackwardOneSecond, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewindOneSecond()));
874 KAction* monitorSeekSnapBackward = new KAction(KIcon("media-seek-backward"), i18n("Go to Previous Snap Point"), this);
875 monitorSeekSnapBackward->setShortcut(Qt::ALT + Qt::Key_Left);
876 collection->addAction("monitor_seek_snap_backward", monitorSeekSnapBackward);
877 connect(monitorSeekSnapBackward, SIGNAL(triggered(bool)), this, SLOT(slotSnapRewind()));
879 KAction* monitorSeekForward = new KAction(KIcon("media-seek-forward"), i18n("Forward"), this);
880 monitorSeekForward->setShortcut(Qt::Key_L);
881 collection->addAction("monitor_seek_forward", monitorSeekForward);
882 connect(monitorSeekForward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForward()));
884 KAction* clipStart = new KAction(KIcon("media-seek-backward"), i18n("Go to Clip Start"), this);
885 clipStart->setShortcut(Qt::Key_Home);
886 collection->addAction("seek_clip_start", clipStart);
887 connect(clipStart, SIGNAL(triggered(bool)), this, SLOT(slotClipStart()));
889 KAction* clipEnd = new KAction(KIcon("media-seek-forward"), i18n("Go to Clip End"), this);
890 clipEnd->setShortcut(Qt::Key_End);
891 collection->addAction("seek_clip_end", clipEnd);
892 connect(clipEnd, SIGNAL(triggered(bool)), this, SLOT(slotClipEnd()));
894 KAction* projectStart = new KAction(KIcon("go-first"), i18n("Go to Project Start"), this);
895 projectStart->setShortcut(Qt::CTRL + Qt::Key_Home);
896 collection->addAction("seek_start", projectStart);
897 connect(projectStart, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotStart()));
899 KAction* projectEnd = new KAction(KIcon("go-last"), i18n("Go to Project End"), this);
900 projectEnd->setShortcut(Qt::CTRL + Qt::Key_End);
901 collection->addAction("seek_end", projectEnd);
902 connect(projectEnd, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotEnd()));
904 KAction* monitorSeekForwardOneFrame = new KAction(KIcon("media-skip-forward"), i18n("Forward 1 Frame"), this);
905 monitorSeekForwardOneFrame->setShortcut(Qt::Key_Right);
906 collection->addAction("monitor_seek_forward-one-frame", monitorSeekForwardOneFrame);
907 connect(monitorSeekForwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneFrame()));
909 KAction* monitorSeekForwardOneSecond = new KAction(KIcon("media-skip-forward"), i18n("Forward 1 Second"), this);
910 monitorSeekForwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Right);
911 collection->addAction("monitor_seek_forward-one-second", monitorSeekForwardOneSecond);
912 connect(monitorSeekForwardOneSecond, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneSecond()));
914 KAction* monitorSeekSnapForward = new KAction(KIcon("media-seek-forward"), i18n("Go to Next Snap Point"), this);
915 monitorSeekSnapForward->setShortcut(Qt::ALT + Qt::Key_Right);
916 collection->addAction("monitor_seek_snap_forward", monitorSeekSnapForward);
917 connect(monitorSeekSnapForward, SIGNAL(triggered(bool)), this, SLOT(slotSnapForward()));
919 KAction* deleteTimelineClip = new KAction(KIcon("edit-delete"), i18n("Delete Selected Item"), this);
920 deleteTimelineClip->setShortcut(Qt::Key_Delete);
921 collection->addAction("delete_timeline_clip", deleteTimelineClip);
922 connect(deleteTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotDeleteTimelineClip()));
924 KAction* editTimelineClipSpeed = new KAction(i18n("Change Clip Speed"), this);
925 collection->addAction("change_clip_speed", editTimelineClipSpeed);
926 editTimelineClipSpeed->setData("change_speed");
927 connect(editTimelineClipSpeed, SIGNAL(triggered(bool)), this, SLOT(slotChangeClipSpeed()));
929 KAction *stickTransition = collection->addAction("auto_transition");
930 stickTransition->setData(QString("auto"));
931 stickTransition->setCheckable(true);
932 stickTransition->setEnabled(false);
933 stickTransition->setText(i18n("Automatic Transition"));
934 connect(stickTransition, SIGNAL(triggered(bool)), this, SLOT(slotAutoTransition()));
936 KAction* groupClip = new KAction(KIcon("object-group"), i18n("Group Clips"), this);
937 collection->addAction("group_clip", groupClip);
938 connect(groupClip, SIGNAL(triggered(bool)), this, SLOT(slotGroupClips()));
940 KAction* ungroupClip = new KAction(KIcon("object-ungroup"), i18n("Ungroup Clips"), this);
941 collection->addAction("ungroup_clip", ungroupClip);
942 ungroupClip->setData("ungroup_clip");
943 connect(ungroupClip, SIGNAL(triggered(bool)), this, SLOT(slotUnGroupClips()));
945 KAction* cutTimelineClip = new KAction(KIcon("edit-cut"), i18n("Cut Clip"), this);
946 cutTimelineClip->setShortcut(Qt::SHIFT + Qt::Key_R);
947 collection->addAction("cut_timeline_clip", cutTimelineClip);
948 connect(cutTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotCutTimelineClip()));
950 KAction* addClipMarker = new KAction(KIcon("bookmark-new"), i18n("Add Marker"), this);
951 collection->addAction("add_clip_marker", addClipMarker);
952 connect(addClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotAddClipMarker()));
954 KAction* deleteClipMarker = new KAction(KIcon("edit-delete"), i18n("Delete Marker"), this);
955 collection->addAction("delete_clip_marker", deleteClipMarker);
956 connect(deleteClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotDeleteClipMarker()));
958 KAction* deleteAllClipMarkers = new KAction(KIcon("edit-delete"), i18n("Delete All Markers"), this);
959 collection->addAction("delete_all_clip_markers", deleteAllClipMarkers);
960 connect(deleteAllClipMarkers, SIGNAL(triggered(bool)), this, SLOT(slotDeleteAllClipMarkers()));
962 KAction* editClipMarker = new KAction(KIcon("document-properties"), i18n("Edit Marker"), this);
963 collection->addAction("edit_clip_marker", editClipMarker);
964 connect(editClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotEditClipMarker()));
966 KAction* splitAudio = new KAction(KIcon("document-new"), i18n("Split Audio"), this);
967 collection->addAction("split_audio", splitAudio);
968 connect(splitAudio, SIGNAL(triggered(bool)), this, SLOT(slotSplitAudio()));
970 KAction* audioOnly = new KAction(KIcon("document-new"), i18n("Audio Only"), this);
971 collection->addAction("clip_audio_only", audioOnly);
972 audioOnly->setData("clip_audio_only");
973 audioOnly->setCheckable(true);
975 KAction* videoOnly = new KAction(KIcon("document-new"), i18n("Video Only"), this);
976 collection->addAction("clip_video_only", videoOnly);
977 videoOnly->setData("clip_video_only");
978 videoOnly->setCheckable(true);
980 KAction* audioAndVideo = new KAction(KIcon("document-new"), i18n("Audio and Video"), this);
981 collection->addAction("clip_audio_and_video", audioAndVideo);
982 audioAndVideo->setData("clip_audio_and_video");
983 audioAndVideo->setCheckable(true);
985 m_clipTypeGroup = new QActionGroup(this);
986 m_clipTypeGroup->addAction(audioOnly);
987 m_clipTypeGroup->addAction(videoOnly);
988 m_clipTypeGroup->addAction(audioAndVideo);
989 connect(m_clipTypeGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotUpdateClipType(QAction *)));
990 m_clipTypeGroup->setEnabled(false);
992 KAction *insertSpace = new KAction(KIcon(), i18n("Insert Space"), this);
993 collection->addAction("insert_space", insertSpace);
994 connect(insertSpace, SIGNAL(triggered()), this, SLOT(slotInsertSpace()));
996 KAction *removeSpace = new KAction(KIcon(), i18n("Remove Space"), this);
997 collection->addAction("delete_space", removeSpace);
998 connect(removeSpace, SIGNAL(triggered()), this, SLOT(slotRemoveSpace()));
1000 KAction *insertTrack = new KAction(KIcon(), i18n("Insert Track"), this);
1001 collection->addAction("insert_track", insertTrack);
1002 connect(insertTrack, SIGNAL(triggered()), this, SLOT(slotInsertTrack()));
1004 KAction *deleteTrack = new KAction(KIcon(), i18n("Delete Track"), this);
1005 collection->addAction("delete_track", deleteTrack);
1006 connect(deleteTrack, SIGNAL(triggered()), this, SLOT(slotDeleteTrack()));
1008 KAction *changeTrack = new KAction(KIcon(), i18n("Change Track"), this);
1009 collection->addAction("change_track", changeTrack);
1010 connect(changeTrack, SIGNAL(triggered()), this, SLOT(slotChangeTrack()));
1012 KAction *addGuide = new KAction(KIcon("document-new"), i18n("Add Guide"), this);
1013 collection->addAction("add_guide", addGuide);
1014 connect(addGuide, SIGNAL(triggered()), this, SLOT(slotAddGuide()));
1016 QAction *delGuide = new KAction(KIcon("edit-delete"), i18n("Delete Guide"), this);
1017 collection->addAction("delete_guide", delGuide);
1018 connect(delGuide, SIGNAL(triggered()), this, SLOT(slotDeleteGuide()));
1020 QAction *editGuide = new KAction(KIcon("document-properties"), i18n("Edit Guide"), this);
1021 collection->addAction("edit_guide", editGuide);
1022 connect(editGuide, SIGNAL(triggered()), this, SLOT(slotEditGuide()));
1024 QAction *delAllGuides = new KAction(KIcon("edit-delete"), i18n("Delete All Guides"), this);
1025 collection->addAction("delete_all_guides", delAllGuides);
1026 connect(delAllGuides, SIGNAL(triggered()), this, SLOT(slotDeleteAllGuides()));
1028 QAction *pasteEffects = new KAction(KIcon("edit-paste"), i18n("Paste Effects"), this);
1029 collection->addAction("paste_effects", pasteEffects);
1030 pasteEffects->setData("paste_effects");
1031 connect(pasteEffects , SIGNAL(triggered()), this, SLOT(slotPasteEffects()));
1033 QAction *showTimeline = new KAction(i18n("Show Timeline"), this);
1034 collection->addAction("show_timeline", showTimeline);
1035 showTimeline->setCheckable(true);
1036 showTimeline->setChecked(true);
1037 connect(showTimeline, SIGNAL(triggered(bool)), this, SLOT(slotShowTimeline(bool)));
1039 /*QAction *maxCurrent = new KAction(i18n("Maximize Current Widget"), this);
1040 collection->addAction("maximize_current", maxCurrent);
1041 maxCurrent->setCheckable(true);
1042 maxCurrent->setChecked(false);
1043 connect(maxCurrent, SIGNAL(triggered(bool)), this, SLOT(slotMaximizeCurrent(bool)));*/
1046 m_closeAction = KStandardAction::close(this, SLOT(closeCurrentDocument()), collection);
1048 KStandardAction::quit(this, SLOT(queryQuit()), collection);
1050 KStandardAction::open(this, SLOT(openFile()), collection);
1052 m_saveAction = KStandardAction::save(this, SLOT(saveFile()), collection);
1054 KStandardAction::saveAs(this, SLOT(saveFileAs()), collection);
1056 KStandardAction::openNew(this, SLOT(newFile()), collection);
1058 KStandardAction::preferences(this, SLOT(slotPreferences()), collection);
1060 KStandardAction::configureNotifications(this , SLOT(configureNotifications()), collection);
1062 KStandardAction::copy(this, SLOT(slotCopy()), collection);
1064 KStandardAction::paste(this, SLOT(slotPaste()), collection);
1066 KAction *undo = KStandardAction::undo(m_commandStack, SLOT(undo()), collection);
1067 undo->setEnabled(false);
1068 connect(m_commandStack, SIGNAL(canUndoChanged(bool)), undo, SLOT(setEnabled(bool)));
1070 KAction *redo = KStandardAction::redo(m_commandStack, SLOT(redo()), collection);
1071 redo->setEnabled(false);
1072 connect(m_commandStack, SIGNAL(canRedoChanged(bool)), redo, SLOT(setEnabled(bool)));
1074 KStandardAction::fullScreen(this, SLOT(slotFullScreen()), this, collection);
1077 //TODO: Add status tooltip to actions ?
1078 connect(collection, SIGNAL(actionHovered(QAction*)),
1079 this, SLOT(slotDisplayActionMessage(QAction*)));*/
1082 QAction *addClip = new KAction(KIcon("kdenlive-add-clip"), i18n("Add Clip"), this);
1083 collection->addAction("add_clip", addClip);
1084 connect(addClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddClip()));
1086 QAction *addColorClip = new KAction(KIcon("kdenlive-add-color-clip"), i18n("Add Color Clip"), this);
1087 collection->addAction("add_color_clip", addColorClip);
1088 connect(addColorClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddColorClip()));
1090 QAction *addSlideClip = new KAction(KIcon("kdenlive-add-slide-clip"), i18n("Add Slideshow Clip"), this);
1091 collection->addAction("add_slide_clip", addSlideClip);
1092 connect(addSlideClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddSlideshowClip()));
1094 QAction *addTitleClip = new KAction(KIcon("kdenlive-add-text-clip"), i18n("Add Title Clip"), this);
1095 collection->addAction("add_text_clip", addTitleClip);
1096 connect(addTitleClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddTitleClip()));
1098 QAction *addFolderButton = new KAction(KIcon("folder-new"), i18n("Create Folder"), this);
1099 collection->addAction("add_folder", addFolderButton);
1100 connect(addFolderButton , SIGNAL(triggered()), m_projectList, SLOT(slotAddFolder()));
1102 QAction *clipProperties = new KAction(KIcon("document-edit"), i18n("Clip Properties"), this);
1103 collection->addAction("clip_properties", clipProperties);
1104 clipProperties->setData("clip_properties");
1105 connect(clipProperties , SIGNAL(triggered()), m_projectList, SLOT(slotEditClip()));
1106 clipProperties->setEnabled(false);
1108 QAction *openClip = new KAction(KIcon("document-open"), i18n("Edit Clip"), this);
1109 collection->addAction("edit_clip", openClip);
1110 openClip->setData("edit_clip");
1111 connect(openClip , SIGNAL(triggered()), m_projectList, SLOT(slotOpenClip()));
1112 openClip->setEnabled(false);
1114 QAction *deleteClip = new KAction(KIcon("edit-delete"), i18n("Delete Clip"), this);
1115 collection->addAction("delete_clip", deleteClip);
1116 deleteClip->setData("delete_clip");
1117 connect(deleteClip , SIGNAL(triggered()), m_projectList, SLOT(slotRemoveClip()));
1118 deleteClip->setEnabled(false);
1120 QAction *reloadClip = new KAction(KIcon("view-refresh"), i18n("Reload Clip"), this);
1121 collection->addAction("reload_clip", reloadClip);
1122 reloadClip->setData("reload_clip");
1123 connect(reloadClip , SIGNAL(triggered()), m_projectList, SLOT(slotReloadClip()));
1124 reloadClip->setEnabled(false);
1126 QMenu *addClips = new QMenu();
1127 addClips->addAction(addClip);
1128 addClips->addAction(addColorClip);
1129 addClips->addAction(addSlideClip);
1130 addClips->addAction(addTitleClip);
1131 addClips->addAction(addFolderButton);
1133 addClips->addAction(reloadClip);
1134 addClips->addAction(clipProperties);
1135 addClips->addAction(openClip);
1136 addClips->addAction(deleteClip);
1137 m_projectList->setupMenu(addClips, addClip);
1139 //connect(collection, SIGNAL( clearStatusText() ),
1140 //statusBar(), SLOT( clear() ) );
1143 void MainWindow::slotDisplayActionMessage(QAction *a)
1145 statusBar()->showMessage(a->data().toString(), 3000);
1148 void MainWindow::saveOptions()
1150 KdenliveSettings::self()->writeConfig();
1151 KSharedConfigPtr config = KGlobal::config();
1152 m_fileOpenRecent->saveEntries(KConfigGroup(config, "Recent Files"));
1153 KConfigGroup treecolumns(config, "Project Tree");
1154 treecolumns.writeEntry("columns", m_projectList->headerInfo());
1158 void MainWindow::readOptions()
1160 KSharedConfigPtr config = KGlobal::config();
1161 m_fileOpenRecent->loadEntries(KConfigGroup(config, "Recent Files"));
1162 KConfigGroup initialGroup(config, "version");
1163 bool upgrade = false;
1164 if (initialGroup.exists()) {
1165 if (initialGroup.readEntry("version", QString()).section(' ', 0, 0) != QString(version).section(' ', 0, 0))
1168 if (initialGroup.readEntry("version") == "0.7") {
1169 //Add new settings from 0.7.1
1170 if (KdenliveSettings::defaultprojectfolder().isEmpty()) {
1171 QString path = QDir::homePath() + "/kdenlive";
1172 if (KStandardDirs::makeDir(path) == false) kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path;
1173 KdenliveSettings::setDefaultprojectfolder(path);
1179 if (!initialGroup.exists() || upgrade) {
1180 // this is our first run, show Wizard
1181 Wizard *w = new Wizard(upgrade, this);
1182 if (w->exec() == QDialog::Accepted && w->isOk()) {
1183 w->adjustSettings();
1184 initialGroup.writeEntry("version", version);
1190 KConfigGroup treecolumns(config, "Project Tree");
1191 const QByteArray state = treecolumns.readEntry("columns", QByteArray());
1192 if (!state.isEmpty())
1193 m_projectList->setHeaderInfo(state);
1196 void MainWindow::slotRunWizard()
1198 Wizard *w = new Wizard(false, this);
1199 if (w->exec() == QDialog::Accepted && w->isOk()) {
1200 w->adjustSettings();
1205 void MainWindow::newFile(bool showProjectSettings)
1207 QString profileName;
1209 QPoint projectTracks(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks());
1210 if (!showProjectSettings && m_timelineArea->count() == 0) {
1211 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1212 profileName = KdenliveSettings::default_profile();
1214 ProjectSettings *w = new ProjectSettings(projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, this);
1215 if (w->exec() != QDialog::Accepted) return;
1216 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1217 KdenliveSettings::setVideothumbnails(w->enableVideoThumbs());
1218 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
1219 KdenliveSettings::setAudiothumbnails(w->enableAudioThumbs());
1220 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
1221 profileName = w->selectedProfile();
1222 projectFolder = w->selectedFolder();
1223 projectTracks = w->tracks();
1226 KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, projectTracks, m_projectMonitor->render, this);
1227 doc->m_autosave = new KAutoSaveFile(KUrl(), doc);
1228 TrackView *trackView = new TrackView(doc, this);
1229 m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description());
1230 if (m_timelineArea->count() == 1) {
1231 connectDocumentInfo(doc);
1232 connectDocument(trackView, doc);
1233 } else m_timelineArea->setTabBarHidden(false);
1234 m_closeAction->setEnabled(m_timelineArea->count() > 1);
1237 void MainWindow::activateDocument()
1239 if (m_timelineArea->currentWidget() == NULL) return;
1240 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1241 KdenliveDoc *currentDoc = currentTab->document();
1242 connectDocumentInfo(currentDoc);
1243 connectDocument(currentTab, currentDoc);
1246 void MainWindow::closeCurrentDocument()
1248 QWidget *w = m_timelineArea->currentWidget();
1250 // closing current document
1251 int ix = m_timelineArea->currentIndex() + 1;
1252 if (ix == m_timelineArea->count()) ix = 0;
1253 m_timelineArea->setCurrentIndex(ix);
1254 TrackView *tabToClose = (TrackView *) w;
1255 KdenliveDoc *docToClose = tabToClose->document();
1256 if (docToClose && docToClose->isModified()) {
1257 switch (KMessageBox::warningYesNoCancel(this, i18n("Save changes to document?"))) {
1258 case KMessageBox::Yes :
1259 // save document here. If saving fails, return false;
1260 if (saveFile() == false) return;
1262 case KMessageBox::Cancel :
1268 m_timelineArea->removeTab(m_timelineArea->indexOf(w));
1269 if (m_timelineArea->count() == 1) {
1270 m_timelineArea->setTabBarHidden(true);
1271 m_closeAction->setEnabled(false);
1275 if (m_timelineArea->count() == 0) {
1276 m_activeDocument = NULL;
1277 m_effectStack->clear();
1278 m_transitionConfig->slotTransitionItemSelected(NULL, false);
1282 bool MainWindow::saveFileAs(const QString &outputFileName)
1284 QString currentSceneList;
1285 if (KdenliveSettings::dropbframes()) {
1286 KdenliveSettings::setDropbframes(false);
1287 m_activeDocument->clipManager()->updatePreviewSettings();
1288 currentSceneList = m_projectMonitor->sceneList();
1289 KdenliveSettings::setDropbframes(true);
1290 m_activeDocument->clipManager()->updatePreviewSettings();
1291 } else currentSceneList = m_projectMonitor->sceneList();
1293 if (m_activeDocument->saveSceneList(outputFileName, currentSceneList) == false)
1296 // Save timeline thumbnails
1297 m_activeTimeline->projectView()->saveThumbnails();
1298 m_activeDocument->setUrl(KUrl(outputFileName));
1299 if (m_activeDocument->m_autosave == NULL) {
1300 m_activeDocument->m_autosave = new KAutoSaveFile(KUrl(outputFileName), this);
1301 } else m_activeDocument->m_autosave->setManagedFile(KUrl(outputFileName));
1302 setCaption(m_activeDocument->description());
1303 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
1304 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), m_activeDocument->url().path());
1305 m_activeDocument->setModified(false);
1306 m_fileOpenRecent->addUrl(KUrl(outputFileName));
1310 bool MainWindow::saveFileAs()
1312 // Check that the Kdenlive mime type is correctly installed
1313 QString mimetype = "application/x-kdenlive";
1314 KMimeType::Ptr mime = KMimeType::mimeType(mimetype);
1315 if (!mime) mimetype = "*.kdenlive";
1317 QString outputFile = KFileDialog::getSaveFileName(KUrl(), mimetype);
1318 if (outputFile.isEmpty()) return false;
1319 if (QFile::exists(outputFile)) {
1320 if (KMessageBox::questionYesNo(this, i18n("File already exists.\nDo you want to overwrite it?")) == KMessageBox::No) return false;
1322 return saveFileAs(outputFile);
1325 bool MainWindow::saveFile()
1327 if (!m_activeDocument) return true;
1328 if (m_activeDocument->url().isEmpty()) {
1329 return saveFileAs();
1331 bool result = saveFileAs(m_activeDocument->url().path());
1332 m_activeDocument->m_autosave->resize(0);
1337 void MainWindow::openFile()
1339 // Check that the Kdenlive mime type is correctly installed
1340 QString mimetype = "application/x-kdenlive";
1341 KMimeType::Ptr mime = KMimeType::mimeType(mimetype);
1342 if (!mime) mimetype = "*.kdenlive";
1344 KUrl url = KFileDialog::getOpenUrl(KUrl("kfiledialog:///projectfolder"), mimetype);
1345 if (url.isEmpty()) return;
1346 m_fileOpenRecent->addUrl(url);
1350 void MainWindow::openLastFile()
1352 KSharedConfigPtr config = KGlobal::config();
1353 KUrl::List urls = m_fileOpenRecent->urls();
1354 //WARNING: this is buggy, we get a random url, not the last one. Bug in KRecentFileAction?
1355 if (urls.isEmpty()) newFile(false);
1356 else openFile(urls.last());
1359 void MainWindow::openFile(const KUrl &url)
1361 // Check if the document is already opened
1362 const int ct = m_timelineArea->count();
1363 bool isOpened = false;
1365 for (i = 0; i < ct; i++) {
1366 TrackView *tab = (TrackView *) m_timelineArea->widget(i);
1367 KdenliveDoc *doc = tab->document();
1368 if (doc->url() == url) {
1374 m_timelineArea->setCurrentIndex(i);
1378 // Check for backup file
1379 QList<KAutoSaveFile *> staleFiles = KAutoSaveFile::staleFiles(url);
1380 if (!staleFiles.isEmpty()) {
1381 if (KMessageBox::questionYesNo(this,
1382 i18n("Auto-saved files exist. Do you want to recover them now?"),
1383 i18n("File Recovery"),
1384 KGuiItem(i18n("Recover")), KGuiItem(i18n("Don't recover"))) == KMessageBox::Yes) {
1385 recoverFiles(staleFiles);
1388 // remove the stale files
1389 foreach(KAutoSaveFile *stale, staleFiles) {
1390 stale->open(QIODevice::ReadWrite);
1395 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1396 doOpenFile(url, NULL);
1399 void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
1401 KdenliveDoc *doc = new KdenliveDoc(url, KUrl(), m_commandStack, QString(), QPoint(3, 2), m_projectMonitor->render, this);
1402 if (stale == NULL) {
1403 stale = new KAutoSaveFile(url, doc);
1404 doc->m_autosave = stale;
1406 doc->m_autosave = stale;
1407 doc->setUrl(stale->managedFile());
1408 doc->setModified(true);
1409 stale->setParent(doc);
1411 connectDocumentInfo(doc);
1412 TrackView *trackView = new TrackView(doc, this);
1413 m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description()));
1414 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
1415 trackView->setDuration(trackView->duration());
1416 trackView->projectView()->initCursorPos(m_projectMonitor->render->seekPosition().frames(doc->fps()));
1418 if (m_timelineArea->count() > 1) m_timelineArea->setTabBarHidden(false);
1419 slotGotProgressInfo(QString(), -1);
1420 m_clipMonitor->refreshMonitor(true);
1421 m_projectMonitor->adjustRulerSize(trackView->duration());
1422 m_projectMonitor->slotZoneMoved(trackView->inPoint(), trackView->outPoint());
1425 void MainWindow::recoverFiles(QList<KAutoSaveFile *> staleFiles)
1427 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1428 foreach(KAutoSaveFile *stale, staleFiles) {
1429 /*if (!stale->open(QIODevice::QIODevice::ReadOnly)) {
1430 // show an error message; we could not steal the lockfile
1431 // maybe another application got to the file before us?
1435 kDebug() << "// OPENING RECOVERY: " << stale->fileName() << "\nMANAGED: " << stale->managedFile().path();
1436 // the stalefiles also contain ".lock" files so we must ignore them... bug in KAutoSaveFile?
1437 if (!stale->fileName().endsWith(".lock")) doOpenFile(KUrl(stale->fileName()), stale);
1438 else KIO::NetAccess::del(KUrl(stale->fileName()), this);
1443 void MainWindow::parseProfiles(const QString &mltPath)
1445 //kdDebug()<<" + + YOUR MLT INSTALL WAS FOUND IN: "<< MLT_PREFIX <<endl;
1447 //KdenliveSettings::setDefaulttmpfolder();
1448 if (!mltPath.isEmpty()) {
1449 KdenliveSettings::setMltpath(mltPath + "/share/mlt/profiles/");
1450 KdenliveSettings::setRendererpath(mltPath + "/bin/melt");
1453 if (KdenliveSettings::mltpath().isEmpty()) {
1454 KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
1456 if (KdenliveSettings::rendererpath().isEmpty() || KdenliveSettings::rendererpath().endsWith("inigo")) {
1457 QString meltPath = QString(MLT_PREFIX) + QString("/bin/melt");
1458 if (!QFile::exists(meltPath))
1459 meltPath = KStandardDirs::findExe("melt");
1460 KdenliveSettings::setRendererpath(meltPath);
1462 QStringList profilesFilter;
1463 profilesFilter << "*";
1464 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1466 if (profilesList.isEmpty()) {
1467 // Cannot find MLT path, try finding melt
1468 QString profilePath = KdenliveSettings::rendererpath();
1469 if (!profilePath.isEmpty()) {
1470 profilePath = profilePath.section('/', 0, -3);
1471 KdenliveSettings::setMltpath(profilePath + "/share/mlt/profiles/");
1472 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1475 if (profilesList.isEmpty()) {
1476 // Cannot find the MLT profiles, ask for location
1477 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your Mlt profiles, please give the path"), this);
1478 getUrl->fileDialog()->setMode(KFile::Directory);
1479 if (getUrl->exec() == QDialog::Rejected) {
1482 KUrl mltPath = getUrl->selectedUrl();
1484 if (mltPath.isEmpty()) ::exit(0);
1485 KdenliveSettings::setMltpath(mltPath.path());
1486 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1490 if (KdenliveSettings::rendererpath().isEmpty()) {
1491 // Cannot find the MLT melt renderer, ask for location
1492 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the melt program required for rendering (part of Mlt)"), this);
1493 if (getUrl->exec() == QDialog::Rejected) {
1496 KUrl rendererPath = getUrl->selectedUrl();
1498 if (rendererPath.isEmpty()) ::exit(0);
1499 KdenliveSettings::setRendererpath(rendererPath.path());
1502 kDebug() << "RESULTING MLT PATH: " << KdenliveSettings::mltpath();
1504 // Parse MLT profiles to build a list of available video formats
1505 if (profilesList.isEmpty()) parseProfiles();
1509 void MainWindow::slotEditProfiles()
1511 ProfilesDialog *w = new ProfilesDialog;
1512 if (w->exec() == QDialog::Accepted) {
1513 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
1514 if (d) d->checkProfile();
1519 void MainWindow::slotEditProjectSettings()
1521 QPoint p = m_activeDocument->getTracksCount();
1522 ProjectSettings *w = new ProjectSettings(p.x(), p.y(), m_activeDocument->projectFolder().path(), true, this);
1524 if (w->exec() == QDialog::Accepted) {
1525 QString profile = w->selectedProfile();
1526 m_activeDocument->setProjectFolder(w->selectedFolder());
1527 if (m_renderWidget) m_renderWidget->setDocumentPath(w->selectedFolder().path());
1528 if (m_activeDocument->profilePath() != profile) {
1529 // Profile was changed
1530 m_activeDocument->setProfilePath(profile);
1531 KdenliveSettings::setCurrent_profile(profile);
1532 KdenliveSettings::setProject_fps(m_activeDocument->fps());
1533 setCaption(m_activeDocument->description(), m_activeDocument->isModified());
1534 m_monitorManager->resetProfiles(m_activeDocument->timecode());
1535 if (m_renderWidget) m_renderWidget->setProfile(m_activeDocument->mltProfile());
1536 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
1537 m_activeDocument->clipManager()->resetProducersList(m_projectMonitor->render->producersList());
1539 // We need to desactivate & reactivate monitors to get a refresh
1540 m_monitorManager->switchMonitors();
1546 void MainWindow::slotRenderProject()
1548 if (!m_renderWidget) {
1549 QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path() : KdenliveSettings::defaultprojectfolder();
1550 m_renderWidget = new RenderWidget(projectfolder, this);
1551 connect(m_renderWidget, SIGNAL(doRender(const QStringList&, const QStringList&)), this, SLOT(slotDoRender(const QStringList&, const QStringList&)));
1552 connect(m_renderWidget, SIGNAL(abortProcess(const QString &)), this, SIGNAL(abortRenderJob(const QString &)));
1553 connect(m_renderWidget, SIGNAL(openDvdWizard(const QString &, const QString &)), this, SLOT(slotDvdWizard(const QString &, const QString &)));
1554 if (m_activeDocument) {
1555 m_renderWidget->setProfile(m_activeDocument->mltProfile());
1556 m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
1559 /*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1560 if (currentTab) m_renderWidget->setTimeline(currentTab);
1561 m_renderWidget->setDocument(m_activeDocument);*/
1562 m_renderWidget->show();
1565 void MainWindow::slotDoRender(const QStringList args, const QStringList overlay_args)
1567 QString dest = args.at(0);
1568 QString render = args.at(1);
1569 QStringList avformat_args = args.at(2).split(' ');
1570 bool zoneOnly = args.at(3).toInt();
1571 bool playAfter = args.at(4).toInt();
1572 double guideStart = args.at(5).toDouble();
1573 double guideEnd = args.at(6).toDouble();
1574 bool resizeProfile = args.at(7).toInt();
1575 QString scriptExport = args.at(8);
1576 bool createChapterFile = args.at(9).toInt();
1578 if (dest.isEmpty()) return;
1582 if (m_activeTimeline && zoneOnly) {
1583 in = m_activeTimeline->inPoint();
1584 out = m_activeTimeline->outPoint();
1587 KTemporaryFile temp;
1588 temp.setAutoRemove(false);
1589 temp.setSuffix(".mlt");
1590 if (!scriptExport.isEmpty() || temp.open()) {
1591 if (KdenliveSettings::dropbframes()) {
1592 KdenliveSettings::setDropbframes(false);
1593 m_activeDocument->clipManager()->updatePreviewSettings();
1594 if (!scriptExport.isEmpty()) m_projectMonitor->saveSceneList(scriptExport + ".mlt");
1595 else m_projectMonitor->saveSceneList(temp.fileName());
1596 KdenliveSettings::setDropbframes(true);
1597 m_activeDocument->clipManager()->updatePreviewSettings();
1599 if (!scriptExport.isEmpty()) m_projectMonitor->saveSceneList(scriptExport + ".mlt");
1600 else m_projectMonitor->saveSceneList(temp.fileName());
1604 if (scriptExport.isEmpty()) args << "-erase";
1605 if (KdenliveSettings::usekuiserver()) args << "-kuiserver";
1606 if (zoneOnly) args << "in=" + QString::number(in) << "out=" + QString::number(out);
1607 else if (guideStart != -1) {
1608 args << "in=" + QString::number(GenTime(guideStart).frames(m_activeDocument->fps())) << "out=" + QString::number(GenTime(guideEnd).frames(m_activeDocument->fps()));
1610 if (!overlay_args.isEmpty()) args << "preargs=" + overlay_args.join(" ");
1611 QString videoPlayer = "-";
1613 videoPlayer = KdenliveSettings::defaultplayerapp();
1614 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."));
1616 if (!QFile::exists(KdenliveSettings::rendererpath())) {
1617 KMessageBox::sorry(this, i18n("Cannot find the melt program required for rendering (part of Mlt)"));
1618 setRenderingProgress(dest, -3);
1621 args << KdenliveSettings::rendererpath() << m_activeDocument->profilePath() << render << videoPlayer;
1623 for (int i = 0; i < avformat_args.count(); i++) {
1624 if (avformat_args.at(i).startsWith("profile=")) {
1625 if (avformat_args.at(i).section('=', 1) != m_activeDocument->profilePath()) resizeProfile = true;
1630 if (resizeProfile) {
1631 // The rendering profile is different from project profile, so use MLT's special producer_consumer
1632 if (scriptExport.isEmpty()) args << "consumer:" + temp.fileName();
1633 else args << "consumer:$SOURCE";
1635 if (scriptExport.isEmpty()) args << temp.fileName();
1636 else args << "$SOURCE";
1638 if (scriptExport.isEmpty()) args << dest;
1639 else args << "$TARGET";
1640 args << avformat_args;
1641 QString renderer = QCoreApplication::applicationDirPath() + QString("/kdenlive_render");
1642 if (!QFile::exists(renderer)) renderer = "kdenlive_render";
1643 if (scriptExport.isEmpty()) {
1644 QProcess::startDetached(renderer, args);
1645 KNotification::event("RenderStarted", i18n("Rendering <i>%1</i> started", dest), QPixmap(), this);
1647 // Generate script file
1648 QFile file(scriptExport);
1649 if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
1650 KMessageBox::error(this, i18n("Cannot write to file %1", scriptExport));
1654 QTextStream outStream(&file);
1655 outStream << "#! /bin/sh" << "\n" << "\n";
1656 outStream << "SOURCE=" << "\"" + scriptExport + ".westley\"" << "\n";
1657 outStream << "TARGET=" << "\"" + dest + "\"" << "\n";
1658 outStream << renderer << " " << args.join(" ") << "\n" << "\n";
1659 if (file.error() != QFile::NoError) {
1660 KMessageBox::error(this, i18n("Cannot write to file %1", scriptExport));
1665 QFile::setPermissions(scriptExport, file.permissions() | QFile::ExeUser);
1668 if (createChapterFile) {
1670 QDomElement chapters = doc.createElement("chapters");
1671 chapters.setAttribute("fps", m_activeDocument->fps());
1672 doc.appendChild(chapters);
1674 QDomElement guidesxml = m_activeDocument->guidesXml();
1675 if (!zoneOnly) out = (int) GenTime(m_activeDocument->projectDuration()).frames(m_activeDocument->fps());
1677 QDomNodeList nodes = guidesxml.elementsByTagName("guide");
1678 for (int i = 0; i < nodes.count(); i++) {
1679 QDomElement e = nodes.item(i).toElement();
1681 QString comment = e.attribute("comment");
1682 int time = (int) GenTime(e.attribute("time").toDouble()).frames(m_activeDocument->fps());
1683 if (time >= in && time < out) {
1684 if (zoneOnly) time = time - in;
1685 QDomElement chapter = doc.createElement("chapter");
1686 chapters.appendChild(chapter);
1687 chapter.setAttribute("title", comment);
1688 chapter.setAttribute("time", time);
1692 if (chapters.childNodes().count() > 0) {
1693 if (m_activeTimeline->projectView()->hasGuide(out, 0) == -1) {
1694 // Always insert a guide in pos 0
1695 QDomElement chapter = doc.createElement("chapter");
1696 chapters.insertBefore(chapter, QDomNode());
1697 chapter.setAttribute("title", i18n("Start"));
1698 chapter.setAttribute("time", "0");
1700 // save chapters file
1701 QFile file(dest + ".dvdchapter");
1702 if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
1703 kWarning() << "////// ERROR writing DVD CHAPTER file: " << dest + ".dvdchapter";
1705 file.write(doc.toString().toUtf8());
1706 if (file.error() != QFile::NoError)
1707 kWarning() << "////// ERROR writing DVD CHAPTER file: " << dest + ".dvdchapter";
1715 void MainWindow::setRenderingProgress(const QString &url, int progress)
1717 if (m_renderWidget) m_renderWidget->setRenderJob(url, progress);
1720 void MainWindow::setRenderingFinished(const QString &url, int status, const QString &error)
1722 if (m_renderWidget) m_renderWidget->setRenderStatus(url, status, error);
1725 void MainWindow::slotUpdateMousePosition(int pos)
1727 if (m_activeDocument)
1728 switch (m_timecodeFormat->currentIndex()) {
1730 statusBar()->changeItem(m_activeDocument->timecode().getTimecodeFromFrames(pos), ID_TIMELINE_POS);
1733 statusBar()->changeItem(QString::number(pos), ID_TIMELINE_POS);
1737 void MainWindow::slotUpdateDocumentState(bool modified)
1739 if (!m_activeDocument) return;
1740 setCaption(m_activeDocument->description(), modified);
1741 m_saveAction->setEnabled(modified);
1743 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Link));
1744 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("document-save"));
1746 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Text));
1747 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("kdenlive"));
1751 void MainWindow::connectDocumentInfo(KdenliveDoc *doc)
1753 if (m_activeDocument) {
1754 if (m_activeDocument == doc) return;
1755 disconnect(m_activeDocument, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
1757 connect(doc, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
1760 void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //changed
1762 //m_projectMonitor->stop();
1763 m_closeAction->setEnabled(m_timelineArea->count() > 1);
1764 kDebug() << "/////////////////// CONNECTING DOC TO PROJECT VIEW ////////////////";
1765 if (m_activeDocument) {
1766 if (m_activeDocument == doc) return;
1767 if (m_activeTimeline) {
1768 disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
1769 disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeTimeline, SLOT(slotSetZone(QPoint)));
1770 disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
1771 disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
1772 disconnect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers()), m_activeDocument, SLOT(checkProjectClips()));
1775 disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
1776 disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
1777 disconnect(m_activeDocument, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
1778 disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
1779 disconnect(m_activeDocument, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
1780 disconnect(m_activeDocument, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
1781 disconnect(m_activeDocument, SIGNAL(deleteTimelineClip(const QString &)), m_activeTimeline, SLOT(slotDeleteClip(const QString &)));
1782 disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), m_effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
1783 disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
1784 disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*, bool)), m_transitionConfig, SLOT(slotTransitionItemSelected(Transition*, bool)));
1785 disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*, bool)), this, SLOT(slotActivateTransitionView(Transition *)));
1786 disconnect(m_zoomSlider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
1787 disconnect(m_activeTimeline->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
1788 disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
1789 disconnect(m_activeTimeline, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
1790 disconnect(m_activeTimeline, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
1791 disconnect(m_activeTimeline, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
1792 disconnect(m_activeTimeline, SIGNAL(changeTrack(int)), this, SLOT(slotChangeTrack(int)));
1793 disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
1794 disconnect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
1795 disconnect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
1796 disconnect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
1797 disconnect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
1798 disconnect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
1799 disconnect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
1800 disconnect(m_transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), m_activeTimeline->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
1801 disconnect(m_transitionConfig, SIGNAL(seekTimeline(int)), m_activeTimeline->projectView() , SLOT(setCursorPos(int)));
1802 disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
1803 disconnect(m_activeTimeline, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
1804 disconnect(m_projectList, SIGNAL(loadingIsOver()), m_activeTimeline->projectView(), SLOT(slotUpdateAllThumbs()));
1805 m_effectStack->clear();
1807 //m_activeDocument->setRenderer(NULL);
1808 disconnect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
1809 m_clipMonitor->stop();
1811 KdenliveSettings::setCurrent_profile(doc->profilePath());
1812 KdenliveSettings::setProject_fps(doc->fps());
1813 m_monitorManager->resetProfiles(doc->timecode());
1814 m_projectList->setDocument(doc);
1815 m_transitionConfig->updateProjectFormat(doc->mltProfile(), doc->timecode(), trackView->tracksNumber());
1816 m_effectStack->updateProjectFormat(doc->mltProfile(), doc->timecode());
1817 connect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
1818 connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
1819 connect(m_projectList, SIGNAL(clipNameChanged(const QString, const QString)), trackView->projectView(), SLOT(clipNameChanged(const QString, const QString)));
1822 connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
1823 connect(trackView, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
1824 connect(trackView, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
1825 connect(trackView, SIGNAL(changeTrack(int)), this, SLOT(slotChangeTrack(int)));
1826 connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
1827 connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
1828 connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
1829 connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
1830 connect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers()), doc, SLOT(checkProjectClips()));
1831 connect(doc, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
1832 connect(doc, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
1833 connect(doc, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
1834 connect(doc, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
1835 connect(doc, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
1837 connect(doc, SIGNAL(deleteTimelineClip(const QString &)), trackView, SLOT(slotDeleteClip(const QString &)));
1838 connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
1839 connect(doc, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
1842 connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), m_effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
1843 connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
1844 connect(trackView, SIGNAL(transitionItemSelected(Transition*, bool)), m_transitionConfig, SLOT(slotTransitionItemSelected(Transition*, bool)));
1845 connect(trackView, SIGNAL(transitionItemSelected(Transition*, bool)), this, SLOT(slotActivateTransitionView(Transition *)));
1846 m_zoomSlider->setValue(doc->zoom());
1847 connect(m_zoomSlider, SIGNAL(valueChanged(int)), trackView, SLOT(slotChangeZoom(int)));
1848 connect(trackView->projectView(), SIGNAL(zoomIn()), this, SLOT(slotZoomIn()));
1849 connect(trackView->projectView(), SIGNAL(zoomOut()), this, SLOT(slotZoomOut()));
1850 connect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
1852 connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
1855 connect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
1856 connect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
1857 connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
1858 connect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
1859 connect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
1860 connect(m_transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
1861 connect(m_transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
1862 connect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
1864 connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
1865 connect(trackView, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
1866 connect(m_projectList, SIGNAL(loadingIsOver()), trackView->projectView(), SLOT(slotUpdateAllThumbs()));
1868 trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu, m_clipTypeGroup);
1869 m_activeTimeline = trackView;
1870 if (m_renderWidget) {
1871 m_renderWidget->setProfile(doc->mltProfile());
1872 m_renderWidget->setDocumentPath(doc->projectFolder().path());
1874 //doc->setRenderer(m_projectMonitor->render);
1875 m_commandStack->setActiveStack(doc->commandStack());
1876 KdenliveSettings::setProject_display_ratio(doc->dar());
1877 m_projectList->updateAllClips();
1878 //doc->clipManager()->checkAudioThumbs();
1880 //m_overView->setScene(trackView->projectScene());
1881 //m_overView->scale(m_overView->width() / trackView->duration(), m_overView->height() / (50 * trackView->tracksNumber()));
1882 //m_overView->fitInView(m_overView->itemAt(0, 50), Qt::KeepAspectRatio);
1884 setCaption(doc->description(), doc->isModified());
1885 m_saveAction->setEnabled(doc->isModified());
1886 m_activeDocument = doc;
1887 if (KdenliveSettings::dropbframes()) slotUpdatePreviewSettings();
1889 // set tool to select tool
1890 m_buttonSelectTool->setChecked(true);
1893 void MainWindow::slotZoneMoved(int start, int end)
1895 m_activeDocument->setZone(start, end);
1896 m_projectMonitor->slotZoneMoved(start, end);
1899 void MainWindow::slotGuidesUpdated()
1901 if (m_renderWidget) m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
1904 void MainWindow::slotPreferences(int page, int option)
1906 //An instance of your dialog could be already created and could be
1907 // cached, in which case you want to display the cached dialog
1908 // instead of creating another one
1909 if (KConfigDialog::showDialog("settings")) {
1910 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
1911 if (page != -1) d->showPage(page, option);
1915 // KConfigDialog didn't find an instance of this dialog, so lets
1917 KdenliveSettingsDialog* dialog = new KdenliveSettingsDialog(this);
1918 connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
1919 connect(dialog, SIGNAL(doResetProfile()), m_monitorManager, SLOT(slotResetProfiles()));
1920 connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
1921 connect(dialog, SIGNAL(updateCaptureFolder()), m_recMonitor, SLOT(slotUpdateCaptureFolder()));
1922 //connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
1924 if (page != -1) dialog->showPage(page, option);
1927 void MainWindow::slotUpdatePreviewSettings()
1929 if (m_activeDocument) {
1930 m_clipMonitor->slotSetXml(NULL, 0);
1931 m_activeDocument->updatePreviewSettings();
1935 void MainWindow::updateConfiguration()
1937 //TODO: we should apply settings to all projects, not only the current one
1938 if (m_activeTimeline) {
1939 m_activeTimeline->refresh();
1940 m_activeTimeline->projectView()->checkAutoScroll();
1941 m_activeTimeline->projectView()->checkTrackHeight();
1942 if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
1944 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
1945 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
1946 #ifndef NO_JOGSHUTTLE
1947 activateShuttleDevice();
1948 #endif /* NO_JOGSHUTTLE */
1953 void MainWindow::slotSwitchVideoThumbs()
1955 KdenliveSettings::setVideothumbnails(!KdenliveSettings::videothumbnails());
1956 if (m_activeTimeline) {
1957 m_activeTimeline->projectView()->slotUpdateAllThumbs();
1959 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
1962 void MainWindow::slotSwitchAudioThumbs()
1964 KdenliveSettings::setAudiothumbnails(!KdenliveSettings::audiothumbnails());
1965 if (m_activeTimeline) {
1966 m_activeTimeline->refresh();
1967 m_activeTimeline->projectView()->checkAutoScroll();
1968 if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
1970 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
1973 void MainWindow::slotSwitchMarkersComments()
1975 KdenliveSettings::setShowmarkers(!KdenliveSettings::showmarkers());
1976 if (m_activeTimeline) {
1977 m_activeTimeline->refresh();
1979 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
1982 void MainWindow::slotSwitchSnap()
1984 KdenliveSettings::setSnaptopoints(!KdenliveSettings::snaptopoints());
1985 m_buttonSnap->setChecked(KdenliveSettings::snaptopoints());
1989 void MainWindow::slotDeleteTimelineClip()
1991 if (QApplication::focusWidget()->parentWidget()->parentWidget() == m_projectListDock) m_projectList->slotRemoveClip();
1992 else if (m_activeTimeline) {
1993 m_activeTimeline->projectView()->deleteSelectedClips();
1997 void MainWindow::slotChangeClipSpeed()
1999 if (m_activeTimeline) {
2000 m_activeTimeline->projectView()->changeClipSpeed();
2004 void MainWindow::slotAddClipMarker()
2006 DocClipBase *clip = NULL;
2008 if (m_projectMonitor->isActive()) {
2009 if (m_activeTimeline) {
2010 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2012 pos = m_projectMonitor->position() - item->startPos() + item->cropStart();
2013 clip = item->baseClip();
2017 clip = m_clipMonitor->activeClip();
2018 pos = m_clipMonitor->position();
2021 m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), ErrorMessage);
2024 QString id = clip->getId();
2025 CommentedTime marker(pos, i18n("Marker"));
2026 MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Add Marker"), this);
2027 if (d.exec() == QDialog::Accepted) {
2028 m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
2030 if (m_clipMonitor->isActive()) m_clipMonitor->checkOverlay();
2033 void MainWindow::slotDeleteClipMarker()
2035 DocClipBase *clip = NULL;
2037 if (m_projectMonitor->isActive()) {
2038 if (m_activeTimeline) {
2039 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2041 pos = m_projectMonitor->position() - item->startPos() + item->cropStart();
2042 clip = item->baseClip();
2046 clip = m_clipMonitor->activeClip();
2047 pos = m_clipMonitor->position();
2050 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2054 QString id = clip->getId();
2055 QString comment = clip->markerComment(pos);
2056 if (comment.isEmpty()) {
2057 m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
2060 m_activeTimeline->projectView()->slotDeleteClipMarker(comment, id, pos);
2061 if (m_clipMonitor->isActive()) m_clipMonitor->checkOverlay();
2065 void MainWindow::slotDeleteAllClipMarkers()
2067 DocClipBase *clip = NULL;
2068 if (m_projectMonitor->isActive()) {
2069 if (m_activeTimeline) {
2070 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2072 clip = item->baseClip();
2076 clip = m_clipMonitor->activeClip();
2079 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2082 m_activeTimeline->projectView()->slotDeleteAllClipMarkers(clip->getId());
2083 if (m_clipMonitor->isActive()) m_clipMonitor->checkOverlay();
2086 void MainWindow::slotEditClipMarker()
2088 DocClipBase *clip = NULL;
2090 if (m_projectMonitor->isActive()) {
2091 if (m_activeTimeline) {
2092 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2094 pos = m_projectMonitor->position() - item->startPos() + item->cropStart();
2095 clip = item->baseClip();
2099 clip = m_clipMonitor->activeClip();
2100 pos = m_clipMonitor->position();
2103 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2107 QString id = clip->getId();
2108 QString oldcomment = clip->markerComment(pos);
2109 if (oldcomment.isEmpty()) {
2110 m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
2114 CommentedTime marker(pos, oldcomment);
2115 MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Edit Marker"), this);
2116 if (d.exec() == QDialog::Accepted) {
2117 m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
2118 if (d.newMarker().time() != pos) {
2119 // remove old marker
2120 m_activeTimeline->projectView()->slotAddClipMarker(id, pos, QString());
2122 if (m_clipMonitor->isActive()) m_clipMonitor->checkOverlay();
2126 void MainWindow::slotAddGuide()
2128 if (m_activeTimeline)
2129 m_activeTimeline->projectView()->slotAddGuide();
2132 void MainWindow::slotInsertSpace()
2134 if (m_activeTimeline)
2135 m_activeTimeline->projectView()->slotInsertSpace();
2138 void MainWindow::slotRemoveSpace()
2140 if (m_activeTimeline)
2141 m_activeTimeline->projectView()->slotRemoveSpace();
2144 void MainWindow::slotInsertTrack(int ix)
2146 m_projectMonitor->activateMonitor();
2147 if (m_activeTimeline)
2148 m_activeTimeline->projectView()->slotInsertTrack(ix);
2151 void MainWindow::slotDeleteTrack(int ix)
2153 m_projectMonitor->activateMonitor();
2154 if (m_activeTimeline)
2155 m_activeTimeline->projectView()->slotDeleteTrack(ix);
2158 void MainWindow::slotChangeTrack(int ix)
2160 m_projectMonitor->activateMonitor();
2161 if (m_activeTimeline)
2162 m_activeTimeline->projectView()->slotChangeTrack(ix);
2165 void MainWindow::slotEditGuide()
2167 if (m_activeTimeline)
2168 m_activeTimeline->projectView()->slotEditGuide();
2171 void MainWindow::slotDeleteGuide()
2173 if (m_activeTimeline)
2174 m_activeTimeline->projectView()->slotDeleteGuide();
2177 void MainWindow::slotDeleteAllGuides()
2179 if (m_activeTimeline)
2180 m_activeTimeline->projectView()->slotDeleteAllGuides();
2183 void MainWindow::slotCutTimelineClip()
2185 if (m_activeTimeline) {
2186 m_activeTimeline->projectView()->cutSelectedClips();
2190 void MainWindow::slotGroupClips()
2192 if (m_activeTimeline) {
2193 m_activeTimeline->projectView()->groupClips();
2197 void MainWindow::slotUnGroupClips()
2199 if (m_activeTimeline) {
2200 m_activeTimeline->projectView()->groupClips(false);
2204 void MainWindow::slotAddProjectClip(KUrl url)
2206 if (m_activeDocument)
2207 m_activeDocument->slotAddClipFile(url, QString());
2210 void MainWindow::slotAddTransition(QAction *result)
2212 if (!result) return;
2213 QStringList info = result->data().toStringList();
2214 if (info.isEmpty()) return;
2215 QDomElement transition = transitions.getEffectByTag(info.at(1), info.at(2));
2216 if (m_activeTimeline && !transition.isNull()) {
2217 m_activeTimeline->projectView()->slotAddTransitionToSelectedClips(transition.cloneNode().toElement());
2221 void MainWindow::slotAddVideoEffect(QAction *result)
2223 if (!result) return;
2224 QStringList info = result->data().toStringList();
2225 if (info.isEmpty()) return;
2226 QDomElement effect = videoEffects.getEffectByTag(info.at(1), info.at(2));
2227 slotAddEffect(effect);
2230 void MainWindow::slotAddAudioEffect(QAction *result)
2232 if (!result) return;
2233 QStringList info = result->data().toStringList();
2234 if (info.isEmpty()) return;
2235 QDomElement effect = audioEffects.getEffectByTag(info.at(1), info.at(2));
2236 slotAddEffect(effect);
2239 void MainWindow::slotAddCustomEffect(QAction *result)
2241 if (!result) return;
2242 QStringList info = result->data().toStringList();
2243 if (info.isEmpty()) return;
2244 QDomElement effect = customEffects.getEffectByTag(info.at(1), info.at(2));
2245 slotAddEffect(effect);
2248 void MainWindow::slotZoomIn()
2250 m_zoomSlider->setValue(m_zoomSlider->value() - 1);
2253 void MainWindow::slotZoomOut()
2255 m_zoomSlider->setValue(m_zoomSlider->value() + 1);
2258 void MainWindow::slotFitZoom()
2260 if (m_activeTimeline) {
2261 m_zoomSlider->setValue(m_activeTimeline->fitZoom());
2265 void MainWindow::slotGotProgressInfo(const QString &message, int progress)
2267 m_statusProgressBar->setValue(progress);
2268 if (progress >= 0) {
2269 if (!message.isEmpty()) m_messageLabel->setMessage(message, InformationMessage);//statusLabel->setText(message);
2270 m_statusProgressBar->setVisible(true);
2272 m_messageLabel->setMessage(QString(), DefaultMessage);
2273 m_statusProgressBar->setVisible(false);
2277 void MainWindow::slotShowClipProperties(DocClipBase *clip)
2279 if (clip->clipType() == TEXT) {
2280 QString titlepath = m_activeDocument->projectFolder().path() + "/titles/";
2281 QString path = clip->getProperty("resource");
2282 TitleWidget *dia_ui = new TitleWidget(KUrl(), titlepath, m_projectMonitor->render, this);
2284 doc.setContent(clip->getProperty("xmldata"));
2285 dia_ui->setXml(doc);
2286 if (dia_ui->exec() == QDialog::Accepted) {
2287 QImage pix = dia_ui->renderedPixmap();
2289 //slotAddClipFile(KUrl("/tmp/kdenlivetitle.png"), QString(), -1);
2290 //m_clipManager->slotEditTextClipFile(id, dia_ui->xml().toString());
2291 QMap <QString, QString> newprops;
2292 newprops.insert("xmldata", dia_ui->xml().toString());
2293 EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
2294 m_activeDocument->commandStack()->push(command);
2295 m_clipMonitor->refreshMonitor(true);
2296 m_activeDocument->setModified(true);
2300 //m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
2303 ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
2304 connect(&dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
2305 if (dia.exec() == QDialog::Accepted) {
2306 EditClipCommand *command = new EditClipCommand(m_projectList, dia.clipId(), clip->properties(), dia.properties(), true);
2307 m_activeDocument->commandStack()->push(command);
2309 //m_projectList->slotUpdateClipProperties(dia.clipId(), dia.properties());
2310 if (dia.needsTimelineRefresh()) {
2311 // update clip occurences in timeline
2312 m_activeTimeline->projectView()->slotUpdateClip(dia.clipId());
2317 void MainWindow::customEvent(QEvent* e)
2319 if (e->type() == QEvent::User) {
2320 // The timeline playing position changed...
2321 kDebug() << "RECEIVED JOG EVEMNT!!!";
2324 void MainWindow::slotActivateEffectStackView()
2326 m_effectStack->raiseWindow(m_effectStackDock);
2329 void MainWindow::slotActivateTransitionView(Transition *t)
2331 if (t) m_transitionConfig->raiseWindow(m_transitionConfigDock);
2334 void MainWindow::slotSnapRewind()
2336 if (m_projectMonitor->isActive()) {
2337 if (m_activeTimeline)
2338 m_activeTimeline->projectView()->slotSeekToPreviousSnap();
2339 } else m_clipMonitor->slotSeekToPreviousSnap();
2342 void MainWindow::slotSnapForward()
2344 if (m_projectMonitor->isActive()) {
2345 if (m_activeTimeline)
2346 m_activeTimeline->projectView()->slotSeekToNextSnap();
2347 } else m_clipMonitor->slotSeekToNextSnap();
2350 void MainWindow::slotClipStart()
2352 if (m_projectMonitor->isActive()) {
2353 if (m_activeTimeline)
2354 m_activeTimeline->projectView()->clipStart();
2358 void MainWindow::slotClipEnd()
2360 if (m_projectMonitor->isActive()) {
2361 if (m_activeTimeline)
2362 m_activeTimeline->projectView()->clipEnd();
2366 void MainWindow::slotChangeTool(QAction * action)
2368 if (action == m_buttonSelectTool) slotSetTool(SELECTTOOL);
2369 else if (action == m_buttonRazorTool) slotSetTool(RAZORTOOL);
2370 else if (action == m_buttonSpacerTool) slotSetTool(SPACERTOOL);
2373 void MainWindow::slotSetTool(PROJECTTOOL tool)
2375 if (m_activeDocument && m_activeTimeline) {
2376 //m_activeDocument->setTool(tool);
2377 m_activeTimeline->projectView()->setTool(tool);
2381 void MainWindow::slotCopy()
2383 if (!m_activeDocument || !m_activeTimeline) return;
2384 m_activeTimeline->projectView()->copyClip();
2387 void MainWindow::slotPaste()
2389 if (!m_activeDocument || !m_activeTimeline) return;
2390 m_activeTimeline->projectView()->pasteClip();
2393 void MainWindow::slotPasteEffects()
2395 if (!m_activeDocument || !m_activeTimeline) return;
2396 m_activeTimeline->projectView()->pasteClipEffects();
2399 void MainWindow::slotFind()
2401 if (!m_activeDocument || !m_activeTimeline) return;
2402 m_projectSearch->setEnabled(false);
2403 m_findActivated = true;
2404 m_findString.clear();
2405 m_activeTimeline->projectView()->initSearchStrings();
2406 statusBar()->showMessage(i18n("Starting -- find text as you type"));
2407 m_findTimer.start(5000);
2408 qApp->installEventFilter(this);
2411 void MainWindow::slotFindNext()
2413 if (m_activeTimeline && m_activeTimeline->projectView()->findNextString(m_findString)) {
2414 statusBar()->showMessage(i18n("Found: %1", m_findString));
2416 statusBar()->showMessage(i18n("Reached end of project"));
2418 m_findTimer.start(4000);
2421 void MainWindow::findAhead()
2423 if (m_activeTimeline && m_activeTimeline->projectView()->findString(m_findString)) {
2424 m_projectSearchNext->setEnabled(true);
2425 statusBar()->showMessage(i18n("Found: %1", m_findString));
2427 m_projectSearchNext->setEnabled(false);
2428 statusBar()->showMessage(i18n("Not found: %1", m_findString));
2432 void MainWindow::findTimeout()
2434 m_projectSearchNext->setEnabled(false);
2435 m_findActivated = false;
2436 m_findString.clear();
2437 statusBar()->showMessage(i18n("Find stopped"), 3000);
2438 if (m_activeTimeline) m_activeTimeline->projectView()->clearSearchStrings();
2439 m_projectSearch->setEnabled(true);
2440 removeEventFilter(this);
2443 void MainWindow::keyPressEvent(QKeyEvent *ke)
2445 if (m_findActivated) {
2446 if (ke->key() == Qt::Key_Backspace) {
2447 m_findString = m_findString.left(m_findString.length() - 1);
2449 if (!m_findString.isEmpty()) {
2455 m_findTimer.start(4000);
2458 } else if (ke->key() == Qt::Key_Escape) {
2462 } else if (ke->key() == Qt::Key_Space || !ke->text().trimmed().isEmpty()) {
2463 m_findString += ke->text();
2467 m_findTimer.start(4000);
2471 } else KXmlGuiWindow::keyPressEvent(ke);
2475 /** Gets called when the window gets hidden */
2476 void MainWindow::hideEvent(QHideEvent */*event*/)
2478 // kDebug() << "I was hidden";
2479 // issue http://www.kdenlive.org/mantis/view.php?id=231
2480 if (isMinimized()) {
2481 // kDebug() << "I am minimized";
2482 if (m_monitorManager) m_monitorManager->stopActiveMonitor();
2486 bool MainWindow::eventFilter(QObject *obj, QEvent *event)
2488 if (m_findActivated) {
2489 if (event->type() == QEvent::ShortcutOverride) {
2490 QKeyEvent* ke = (QKeyEvent*) event;
2491 if (ke->text().trimmed().isEmpty()) return false;
2494 } else return false;
2496 // pass the event on to the parent class
2497 return QMainWindow::eventFilter(obj, event);
2501 void MainWindow::slotSaveZone(Render *render, QPoint zone)
2503 KDialog *dialog = new KDialog(this);
2504 dialog->setCaption("Save clip zone");
2505 dialog->setButtons(KDialog::Ok | KDialog::Cancel);
2507 QWidget *widget = new QWidget(dialog);
2508 dialog->setMainWidget(widget);
2510 QVBoxLayout *vbox = new QVBoxLayout(widget);
2511 QLabel *label1 = new QLabel(i18n("Save clip zone as:"), this);
2512 QString path = m_activeDocument->projectFolder().path();
2514 path.append("untitled.mlt");
2515 KUrlRequester *url = new KUrlRequester(KUrl(path), this);
2516 url->setFilter("video/mlt-playlist");
2517 QLabel *label2 = new QLabel(i18n("Description:"), this);
2518 KLineEdit *edit = new KLineEdit(this);
2519 vbox->addWidget(label1);
2520 vbox->addWidget(url);
2521 vbox->addWidget(label2);
2522 vbox->addWidget(edit);
2523 if (dialog->exec() == QDialog::Accepted) render->saveZone(url->url(), edit->text(), zone);
2527 void MainWindow::slotSetInPoint()
2529 if (m_clipMonitor->isActive()) {
2530 m_clipMonitor->slotSetZoneStart();
2531 } else m_activeTimeline->projectView()->setInPoint();
2534 void MainWindow::slotSetOutPoint()
2536 if (m_clipMonitor->isActive()) {
2537 m_clipMonitor->slotSetZoneEnd();
2538 } else m_activeTimeline->projectView()->setOutPoint();
2541 void MainWindow::slotGetNewLumaStuff()
2543 //KNS::Entry::List download();
2544 KNS::Entry::List entries = KNS::Engine::download();
2545 // list of changed entries
2546 kDebug() << "// PARSING KNS";
2547 foreach(KNS::Entry* entry, entries) {
2548 // care only about installed ones
2549 if (entry->status() == KNS::Entry::Installed) {
2550 foreach(const QString &file, entry->installedFiles()) {
2551 kDebug() << "// CURRENTLY INSTALLED: " << file;
2555 qDeleteAll(entries);
2556 initEffects::refreshLumas();
2559 void MainWindow::slotGetNewRenderStuff()
2561 //KNS::Entry::List download();
2563 KNS::Engine engine(0);
2564 if (engine.init("kdenlive_render.knsrc")) {
2565 KNS::Entry::List entries = engine.downloadDialogModal(this);
2567 if (entries.size() > 0) {
2568 foreach(KNS::Entry* entry, entries) {
2569 // care only about installed ones
2570 if (entry->status() == KNS::Entry::Installed) {
2571 foreach(const QString &file, entry->installedFiles()) {
2572 kDebug() << "// CURRENTLY INSTALLED: " << file;
2577 if (m_renderWidget) m_renderWidget->reloadProfiles();
2581 void MainWindow::slotGetNewMltProfileStuff()
2583 //KNS::Entry::List download();
2585 KNS::Engine engine(0);
2586 if (engine.init("kdenlive_mltprofiles.knsrc")) {
2587 KNS::Entry::List entries = engine.downloadDialogModal(this);
2589 if (entries.size() > 0) {
2590 foreach(KNS::Entry* entry, entries) {
2591 // care only about installed ones
2592 if (entry->status() == KNS::Entry::Installed) {
2593 foreach(const QString &file, entry->installedFiles()) {
2594 kDebug() << "// CURRENTLY INSTALLED: " << file;
2599 // update the list of profiles in settings dialog
2600 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
2601 if (d) d->checkProfile();
2606 void MainWindow::slotAutoTransition()
2608 if (m_activeTimeline) m_activeTimeline->projectView()->autoTransition();
2611 void MainWindow::slotSplitAudio()
2613 if (m_activeTimeline) m_activeTimeline->projectView()->splitAudio();
2616 void MainWindow::slotUpdateClipType(QAction *action)
2618 if (m_activeTimeline) {
2619 if (action->data().toString() == "clip_audio_only") m_activeTimeline->projectView()->setAudioOnly();
2620 else if (action->data().toString() == "clip_video_only") m_activeTimeline->projectView()->setVideoOnly();
2621 else m_activeTimeline->projectView()->setAudioAndVideo();
2625 void MainWindow::slotDvdWizard(const QString &url, const QString &profile)
2627 DvdWizard *w = new DvdWizard(url, profile, this);
2631 void MainWindow::slotShowTimeline(bool show)
2633 if (show == false) {
2634 m_timelineState = saveState();
2635 centralWidget()->setHidden(true);
2637 centralWidget()->setHidden(false);
2638 restoreState(m_timelineState);
2642 void MainWindow::slotMaximizeCurrent(bool show)
2644 //TODO: is there a way to maximize current widget?
2647 m_timelineState = saveState();
2648 QWidget *par = focusWidget()->parentWidget();
2649 while (par->parentWidget() && par->parentWidget() != this) {
2650 par = par->parentWidget();
2652 kDebug() << "CURRENT WIDGET: " << par->objectName();
2655 //centralWidget()->setHidden(false);
2656 //restoreState(m_timelineState);
2660 void MainWindow::loadTranscoders()
2662 QMenu *transMenu = static_cast<QMenu*>(factory()->container("transcoders", this));
2664 KSharedConfigPtr config = KGlobal::config();
2665 KConfigGroup transConfig(config, "Transcoding");
2667 QMap< QString, QString > profiles = transConfig.entryMap();
2668 QMapIterator<QString, QString> i(profiles);
2669 while (i.hasNext()) {
2671 QAction *a = transMenu->addAction(i.key());
2672 a->setData(i.value());
2673 connect(a, SIGNAL(triggered()), this, SLOT(slotTranscode()));
2677 void MainWindow::slotTranscode(QString url)
2680 if (url.isEmpty()) {
2681 url = m_projectList->currentClipUrl();
2682 QAction *action = qobject_cast<QAction *>(sender());
2683 params = action->data().toString();
2686 if (url.isEmpty()) return;
2687 ClipTranscode *d = new ClipTranscode(url, params);
2688 connect(d, SIGNAL(addClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
2690 //QProcess::startDetached("ffmpeg", parameters);
2693 void MainWindow::slotTranscodeClip()
2695 KUrl url = KFileDialog::getOpenUrl(KUrl("kfiledialog:///projectfolder"));
2696 if (url.isEmpty()) return;
2697 slotTranscode(url.path());
2700 #include "mainwindow.moc"